text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> /// Returns the column index in the result set for a given column name.
///
/// If there is no AS clause then the name of the column is unspecified and
/// may change from one release of SQLite to the next.
///
/// If associated DB schema can be altered concurrently, you should mak... | code_fim | hard | {
"lang": "rust",
"repo": "Genomicsplc/rusqlite",
"path": "/src/column.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> // Get our local public key:
let mut app_report = node_connection.report().clone();
let (node_report, incoming_mutations) = await!(app_report.incoming_reports())
.map_err(|_| FundsError::GetReportError)?;
// We currently don't need live updates about report mutations:
drop(inco... | code_fim | hard | {
"lang": "rust",
"repo": "haposan/stctrl",
"path": "/src/funds.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: haposan/stctrl path: /src/funds.rs
use clap::ArgMatches;
use app::{NodeConnection, AppRoutes, AppSendFunds,
string_to_public_key, PublicKey};
use app::uid::gen_uid;
use app::invoice::{InvoiceId, INVOICE_ID_LEN};
use app::route::{FriendsRoute, RouteWithCapacity};
#[derive(Debug)]
p... | code_fim | hard | {
"lang": "rust",
"repo": "haposan/stctrl",
"path": "/src/funds.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: vyuham/rtrcrs path: /src/color.rs
/// Defines a pixel's color as an RGB value.
pub type Color = crate::Vec3;
<|fim_suffix|> Color::new(sample(color.x), sample(color.y), sample(color.z))
}<|fim_middle|>/// Used to smoothen edges using Antialiasing.
pub fn anti_aliased(color: Color, samples_pe... | code_fim | hard | {
"lang": "rust",
"repo": "vyuham/rtrcrs",
"path": "/src/color.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Color::new(sample(color.x), sample(color.y), sample(color.z))
}<|fim_prefix|>// repo: vyuham/rtrcrs path: /src/color.rs
/// Defines a pixel's color as an RGB value.
pub type Color = crate::Vec3;
<|fim_middle|>/// Used to smoothen edges using Antialiasing.
pub fn anti_aliased(color: Color, samples_pe... | code_fim | hard | {
"lang": "rust",
"repo": "vyuham/rtrcrs",
"path": "/src/color.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let result = actual.out;
assert_eq!(result, "15");
}<|fim_prefix|>// repo: JosephTLyons/nushell path: /crates/nu-command/tests/commands/random/chars.rs
use nu_test_support::{nu, pipeline};
<|fim_middle|>#[test]
fn generates_chars_of_specified_length() {
let actual = nu!(
cwd: ".", pi... | code_fim | medium | {
"lang": "rust",
"repo": "JosephTLyons/nushell",
"path": "/crates/nu-command/tests/commands/random/chars.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: JosephTLyons/nushell path: /crates/nu-command/tests/commands/random/chars.rs
use nu_test_support::{nu, pipeline};
<|fim_suffix|> let result = actual.out;
assert_eq!(result, "15");
}<|fim_middle|>#[test]
fn generates_chars_of_specified_length() {
let actual = nu!(
cwd: ".", pi... | code_fim | medium | {
"lang": "rust",
"repo": "JosephTLyons/nushell",
"path": "/crates/nu-command/tests/commands/random/chars.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let cm = Arc::<SourceMap>::default();
let handler = Arc::new(Handler::with_tty_emitter(
ColorConfig::Auto,
true,
false,
Some(cm.clone()),
));
let c = swc::Compiler::new(cm.clone());
let fm = cm
.load_file(Path::new("foo.js"))
.expect("fa... | code_fim | medium | {
"lang": "rust",
"repo": "dsherret/swc",
"path": "/examples/usage.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: dsherret/swc path: /examples/usage.rs
use std::{path::Path, sync::Arc};
use swc::{self, config::Options};
use swc_common::{
errors::{ColorConfig, Handler},
SourceMap,
};
fn main() {
<|fim_suffix|> c.process_js_file(
fm,
&handler,
&Options {
..Defau... | code_fim | hard | {
"lang": "rust",
"repo": "dsherret/swc",
"path": "/examples/usage.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ChrisVeigl/brainflow path: /rust-package/brainflow/src/data_filter.rs
let log_file = log_file.as_ref();
let log_file = CString::new(log_file)?;
let res = unsafe { data_handler::set_log_file_data_handler(log_file.as_ptr()) };
Ok(check_brainflow_exit_code(res)?)
}
/// Apply low pass ... | code_fim | hard | {
"lang": "rust",
"repo": "ChrisVeigl/brainflow",
"path": "/rust-package/brainflow/src/data_filter.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> unsafe { avg_band_powers.set_len(5) };
unsafe { stddev_band_powers.set_len(5) };
Ok((avg_band_powers, stddev_band_powers))
}
/// Calculate band power.
pub fn get_band_power(psd: Psd, freq_start: f64, freq_end: f64) -> Result<f64> {
let mut band_power = 0.0;
let mut psd = psd;
let ... | code_fim | hard | {
"lang": "rust",
"repo": "ChrisVeigl/brainflow",
"path": "/rust-package/brainflow/src/data_filter.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ChrisVeigl/brainflow path: /rust-package/brainflow/src/data_filter.rs
le, can be called any time.
pub fn set_log_file<S: AsRef<str>>(log_file: S) -> Result<()> {
let log_file = log_file.as_ref();
let log_file = CString::new(log_file)?;
let res = unsafe { data_handler::set_log_file_da... | code_fim | hard | {
"lang": "rust",
"repo": "ChrisVeigl/brainflow",
"path": "/rust-package/brainflow/src/data_filter.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: boost-entropy-repos-org/errol path: /src/bin/sync.rs
extern crate diesel;
extern crate errol;
use errol::models::GithubIssue;
#[allow(unused_imports)] use diesel::prelude::*;
use errol::*;
<|fim_suffix|> use errol::schema::github_issues::dsl::*;
let connection = establish_connection();
... | code_fim | medium | {
"lang": "rust",
"repo": "boost-entropy-repos-org/errol",
"path": "/src/bin/sync.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> use errol::schema::github_issues::dsl::*;
let connection = establish_connection();
let results = github_issues
.limit(5)
.load::<GithubIssue>(&connection)
.expect("Error loading GitHub issues");
println!("Displaying {} GitHub issues", results.len());
for post i... | code_fim | medium | {
"lang": "rust",
"repo": "boost-entropy-repos-org/errol",
"path": "/src/bin/sync.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: jonas-hagen/hx711-examples path: /linux-embedded-hal/src/main.rs
#[macro_use(block)]
extern crate nb;
use embedded_hal::blocking::delay::DelayUs;
extern crate linux_embedded_hal as hal;
extern crate hx711;
use std::{thread, time};
use hx711::Hx711;
use hal::Pin;
use hal::sysfs_gpio::Directio... | code_fim | hard | {
"lang": "rust",
"repo": "jonas-hagen/hx711-examples",
"path": "/linux-embedded-hal/src/main.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
fn main() {
println!("Using HX711 with DOUT on GPIO23 and PD_SCK on GPIO24");
let dout = Pin::new(23); // Header pin 16
let pd_sck = Pin::new(24); // Header pin 18
dout.export().unwrap();
pd_sck.export().unwrap();
while !dout.is_exported() {};
while !pd_sck.is_exported() {}... | code_fim | hard | {
"lang": "rust",
"repo": "jonas-hagen/hx711-examples",
"path": "/linux-embedded-hal/src/main.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn new_app() -> App<'static> {
return App::new("tag")
.about("Tag an resource with a key and (optional) value pair")
}
pub fn get_matches() -> () {
}
}<|fim_prefix|>// repo: clpi/di-client path: /di-cli/src/cmd/tag.rs
use chrono::{DateTime, Utc};
use clap::{Clap,... | code_fim | medium | {
"lang": "rust",
"repo": "clpi/di-client",
"path": "/di-cli/src/cmd/tag.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: clpi/di-client path: /di-cli/src/cmd/tag.rs
use chrono::{DateTime, Utc};
use clap::{Clap, Arg, ArgEnum, App};
#[derive(Clap, Debug)]
pub struct TagCmd {
#[clap(
long="name",
short='n',
about="Name of the tag (tag key)"
)]
name: String,
#[clap(
lon... | code_fim | medium | {
"lang": "rust",
"repo": "clpi/di-client",
"path": "/di-cli/src/cmd/tag.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: jmacmoe/lisp path: /src/main.rs
use std::io::{self, Write};
mod parser;
fn main() {
println!("Lispr Version 0.1.0");
println!("Press Ctrl+C to Exit");
loop {
print!("lispr> ");
io::stdout().flush()
.expect("Failed to output prompt");
<|fim_suffix|> ... | code_fim | medium | {
"lang": "rust",
"repo": "jmacmoe/lisp",
"path": "/src/main.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: aJns/aoc2020 path: /d02/02.rs
use std::fs::File;
use std::io::{self, Write, BufRead};
use std::path::Path;
use std::str;
use std::vec;
fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
where P: AsRef<Path>, {
let file = File::open(filename)?;
Ok(io::BufReader::... | code_fim | hard | {
"lang": "rust",
"repo": "aJns/aoc2020",
"path": "/d02/02.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut counter: i32 = 0;
for pass in pass_vec.iter() {
let parsed = match parse_pass(pass) {
Some(x) => x,
None => panic!("lskdhfoisehf")
};
if is_valid(&parsed) {
counter += 1;
}
}
writeln!(io::stdout(), "{} passwords ... | code_fim | hard | {
"lang": "rust",
"repo": "aJns/aoc2020",
"path": "/d02/02.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let i1 = pass.min - 1;
let i2 = pass.max - 1 - i1 - 1; // .nth() on chars consumes the preceding elements
let mut chars = pass.word.chars();
let first = match chars.nth(i1) {
Some(x) => x == pass.cha,
None => false
};
let second = match chars.nth(i2) {
Some(... | code_fim | hard | {
"lang": "rust",
"repo": "aJns/aoc2020",
"path": "/d02/02.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: YorozuyaDev/compiler path: /core/typechecker/expressions.rs
mod anonymous_function;
mod argument;
mod array;
mod call;
mod for_condition;
mod hashmap;
mod infix;
mod prefix;
mod suffix;
pub use argument::function_arguments_to_string;
use crate::{
Environment,
typechecker::TTypes,
};
use s... | code_fim | hard | {
"lang": "rust",
"repo": "YorozuyaDev/compiler",
"path": "/core/typechecker/expressions.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> // Number
if let Some(number) = expression.get_number() {
return Ok(TTypes::new_type(Types::NUMBER, String::from("number"), number.get_token()));
}
// Prefix
if let Some(prefix_exp) = expression.get_prefix() {
return prefix::check(&prefix_exp, environment);
}
// String
if let Som... | code_fim | hard | {
"lang": "rust",
"repo": "YorozuyaDev/compiler",
"path": "/core/typechecker/expressions.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: rust-lang/rust path: /tests/ui/regions/do-not-suggest-adding-bound-to-opaque-type.rs
pub trait T {}
struct S<'a>(&'a ());
impl<'a> T for S<'a> {}
<|fim_suffix|> let x = ();
S(&x) //~ ERROR `x` does not live long enough
}
fn main() {}<|fim_middle|>fn foo() -> impl T {
| code_fim | easy | {
"lang": "rust",
"repo": "rust-lang/rust",
"path": "/tests/ui/regions/do-not-suggest-adding-bound-to-opaque-type.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>fn foo() -> impl T {
let x = ();
S(&x) //~ ERROR `x` does not live long enough
}
fn main() {}<|fim_prefix|>// repo: rust-lang/rust path: /tests/ui/regions/do-not-suggest-adding-bound-to-opaque-type.rs
pub trait T {}
struct S<'a>(&'a ());
<|fim_middle|>impl<'a> T for S<'a> {}
| code_fim | easy | {
"lang": "rust",
"repo": "rust-lang/rust",
"path": "/tests/ui/regions/do-not-suggest-adding-bound-to-opaque-type.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
// Version with unicode support
fn is_palindrome_unicode(s: &str) -> bool {
let len = s.chars().count();
s.chars().take(len / 2).eq(input.chars().rev().take(len / 2));
}<|fim_prefix|>// repo: stfnwong/LCLCLCLC path: /codegen/palindrome.rs
/*
* Determine if a string is a palindrome
*/
// tail... | code_fim | hard | {
"lang": "rust",
"repo": "stfnwong/LCLCLCLC",
"path": "/codegen/palindrome.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: stfnwong/LCLCLCLC path: /codegen/palindrome.rs
/*
* Determine if a string is a palindrome
*/
// tail recursive palindrome
fn is_palindrome(bytes: &[u8]) -> bool {
if bytes.len() <= 1 {
true
}
else if bytes.len() == 2 {
bytes[0] == bytes[1]
}
else if bytes[... | code_fim | medium | {
"lang": "rust",
"repo": "stfnwong/LCLCLCLC",
"path": "/codegen/palindrome.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.header_number_next = last_header.header.number + 1;
Ok(last_header.header.number)
}
/// Feed a block and apply changes to storage if it's valid.
pub fn feed_block(
&mut self,
block: &BlockHeaderWithChanges,
state_ro... | code_fim | hard | {
"lang": "rust",
"repo": "EthWorks/phala-blockchain",
"path": "/crates/phactory/api/src/lib.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: EthWorks/phala-blockchain path: /crates/phactory/api/src/lib.rs
= Vec<HeaderToSync>;
pub type RawStorageKey = Vec<u8>;
#[derive(Debug, Encode, Decode, Clone)]
pub struct StorageKV<T: FullCodec + Clone>(pub RawStorageKey, pub T);
impl<T: FullCodec + Clone> StorageKV<T> {
... | code_fim | hard | {
"lang": "rust",
"repo": "EthWorks/phala-blockchain",
"path": "/crates/phactory/api/src/lib.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> &mut self,
block: &BlockHeaderWithChanges,
storage: &mut Storage,
) -> Result<()> {
self.sync_state
.feed_block(block, &mut self.state_roots, storage)
}
fn sync_parachain_header(
&mut self,
_he... | code_fim | hard | {
"lang": "rust",
"repo": "EthWorks/phala-blockchain",
"path": "/crates/phactory/api/src/lib.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>fn load_config(conf: &str) -> Config {
let mut cs = String::new();
let mut file = File::open(&conf).unwrap();
let _ = file.read_to_string(&mut cs);
serde_json::from_str(&cs).unwrap()
}
fn load_locale(localestr: &str) -> Locale {
let mut locale = Locale::new();
if localestr != "en"... | code_fim | hard | {
"lang": "rust",
"repo": "stpettersens/talkingclock",
"path": "/src/main.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: stpettersens/talkingclock path: /src/main.rs
/*
Talking clock
Command line application which says the time.
Copyright 2017 Sam Saint-Pettersen.
Released under the MIT License.
*/
mod config;
mod voice;
extern crate clioptions;
extern crate litepattern;
extern crate litelocale;
... | code_fim | hard | {
"lang": "rust",
"repo": "stpettersens/talkingclock",
"path": "/src/main.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: nimiq/core-rs-albatross path: /web-client/src/primitives/bls_key_pair.rs
use nimiq_keys::SecureGenerate;
use nimiq_serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::*;
use super::{bls_public_key::BLSPublicKey, bls_secret_key::BLSSecretKey};
/// A BLS keypair
/// It is used by validat... | code_fim | hard | {
"lang": "rust",
"repo": "nimiq/core-rs-albatross",
"path": "/web-client/src/primitives/bls_key_pair.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// Formats the keypair into a hex string.
#[wasm_bindgen(js_name = toHex)]
pub fn to_hex(&self) -> String {
hex::encode(self.serialize())
}
}
impl BLSKeyPair {
pub fn from_native(key_pair: nimiq_bls::KeyPair) -> BLSKeyPair {
BLSKeyPair { inner: key_pair }
}
p... | code_fim | hard | {
"lang": "rust",
"repo": "nimiq/core-rs-albatross",
"path": "/web-client/src/primitives/bls_key_pair.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Carlton-Perkins/aoc-2020 path: /day9-p2/src/main.rs
/*
--- Part Two ---
The final step in breaking the XMAS encryption relies on the invalid number you just found: you must find a contiguous set of at least two numbers in your list which sum to the invalid number from step 1.
Again consider the... | code_fim | hard | {
"lang": "rust",
"repo": "Carlton-Perkins/aoc-2020",
"path": "/day9-p2/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>fn main() {
input_to_fn_to_stdout(save_the_prisoner, InputType::Stdin);
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_save_the_prisoner() {
let pairs = [
(
"1\n\
5 2 1",
"2",
),
(
... | code_fim | hard | {
"lang": "rust",
"repo": "carbonizer/hackerrank-rust",
"path": "/save-the-prisoner/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: carbonizer/hackerrank-rust path: /save-the-prisoner/src/main.rs
pub fn save_the_prisoner<'a>(input: &str) -> Result<String, &'a str> {
use std::str::{FromStr};
if input.len() == 0 {
return Err("No input");
}
Ok(input.lines()
// Don't need to know how many lines... | code_fim | hard | {
"lang": "rust",
"repo": "carbonizer/hackerrank-rust",
"path": "/save-the-prisoner/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: romatthe/remoc path: /remoc/src/robj/mod.rs
//! Remote objects.
//!
//! This module provides functionality to access and transmit data<|fim_suffix|> or used as arguments or return types of [remote functions](crate::rfn) or in
//! [remote traits](crate::rtc).
//!
pub mod handle;
pub mod lazy;
pu... | code_fim | medium | {
"lang": "rust",
"repo": "romatthe/remoc",
"path": "/remoc/src/robj/mod.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>traits](crate::rtc).
//!
pub mod handle;
pub mod lazy;
pub mod lazy_blob;
pub mod rw_lock;<|fim_prefix|>// repo: romatthe/remoc path: /remoc/src/robj/mod.rs
//! Remote objects.
//!
//! This module provides functionality to access and transmit data<|fim_middle|> remotely.
//! All types presented here can... | code_fim | medium | {
"lang": "rust",
"repo": "romatthe/remoc",
"path": "/remoc/src/robj/mod.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> input.lines().for_each(|line| {
let mut line_string: String = line.to_string();
let cmd = line_string.remove(0);
let value = line_string.parse::<i32>().unwrap();
match cmd {
'F' => {
distance.0 += waypoint.0 * value;
... | code_fim | hard | {
"lang": "rust",
"repo": "hulsizer/advent_of_code_2020",
"path": "/src/day12/mod.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: hulsizer/advent_of_code_2020 path: /src/day12/mod.rs
pub fn run(input: std::string::String) {
pt2(input);
}
pub fn pt1(input: String) {
let mut north_south = 0;
let mut east_west = 0;
let mut direction = 'E';
input.lines().for_each(|line| {
let mut line_string: Stri... | code_fim | hard | {
"lang": "rust",
"repo": "hulsizer/advent_of_code_2020",
"path": "/src/day12/mod.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> match cmd {
'F' => {
distance.0 += waypoint.0 * value;
distance.1 += waypoint.1 * value;
}
'R' => {
let rotation = value / 90;
for _ in 0..rotation {
waypoint = (waypoint.1, -way... | code_fim | hard | {
"lang": "rust",
"repo": "hulsizer/advent_of_code_2020",
"path": "/src/day12/mod.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>/
/
/
}
/
/
/
/
/
/
fn
serialize_u128
(
self
v
:
u128
)
-
>
Result
<
Self
:
:
Ok
Self
:
:
Error
>
{
/
/
/
/
*
.
.
.
*
/
/
/
/
#
unimplemented
!
(
)
/
/
/
}
/
/
/
}
/
/
/
#
/
/
/
#
serde
:
:
__serialize_unimplemented
!
{
/
/
/
#
bool
i8
i16
i32
u8
u16
u32
u64
f32
f64
char
str
bytes
none
some
/
/
/
#
unit
u... | code_fim | hard | {
"lang": "rust",
"repo": "marco-c/gecko-dev-wordified",
"path": "/third_party/rust/serde/src/integer128.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified path: /third_party/rust/serde/src/integer128.rs
/
/
/
Conditional
compilation
depending
on
whether
Serde
is
built
with
support
for
/
/
/
128
-
bit
integers
.
/
/
/
/
/
/
Data
formats
that
wish
to
support
Rust
compiler
versions
older
than
1
.
26
/
/
/
(
or
targets
that... | code_fim | hard | {
"lang": "rust",
"repo": "marco-c/gecko-dev-wordified",
"path": "/third_party/rust/serde/src/integer128.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Leowbattle/clr_lite path: /clr_lite/src/metadata/tables/coded_index/mod.rs
pub mod type_def_or_ref;
pub use type_def_or_ref::*;
pub mod has_constant;
pub use has_constant::*;
pub mod has_custom_attribute;
pub use has_custom_attribute::*;
pub mod has_field_marshal;
pub use has_field_marshal::*... | code_fim | medium | {
"lang": "rust",
"repo": "Leowbattle/clr_lite",
"path": "/clr_lite/src/metadata/tables/coded_index/mod.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>pub mod has_decl_security;
pub use has_decl_security::*;
pub mod member_ref_parent;
pub use member_ref_parent::*;
pub mod has_semantics;
pub use has_semantics::*;
pub mod method_def_or_ref;
pub use method_def_or_ref::*;
pub mod member_forwarded;
pub use member_forwarded::*;
pub mod implementation;
pu... | code_fim | medium | {
"lang": "rust",
"repo": "Leowbattle/clr_lite",
"path": "/clr_lite/src/metadata/tables/coded_index/mod.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> // scan through in reverse
let mut last_hash: Option<Vec<u8>> = None;
for i in range(0, blocks.len()) {
let idx = blocks.len() - 1 - i;
let mut sha = Sha256::new();
sha.input(blocks[idx].as_slice());
match last_hash {
Some(h) => sha.input(h.as_slice(... | code_fim | hard | {
"lang": "rust",
"repo": "DouglasOrr/Snippets",
"path": "/crypto-013/pa3/src/main.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: DouglasOrr/Snippets path: /crypto-013/pa3/src/main.rs
extern crate rustc;
use std::os;
use std::io::{BufferedReader, File};
use std::vec::as_vec;
use rustc::util::sha2::{Digest, Sha256};
use std::clone::Clone;
<|fim_suffix|> // scan through in reverse
let mut last_hash: Option<Vec<u8>> ... | code_fim | hard | {
"lang": "rust",
"repo": "DouglasOrr/Snippets",
"path": "/crypto-013/pa3/src/main.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fn bar<T>() {
assert::<Mutex<T>>();
assert::<RwLock<T>>();
}
fn baz<T: UnwindSafe>() {
assert::<Box<T>>();
assert::<Vec<T>>();
assert::<RefCell<T>>();
assert::<AssertUnwindSafe<T>>();
assert::<&AssertUnwindSafe<T>>();
assert::<Rc<... | code_fim | medium | {
"lang": "rust",
"repo": "IThawk/rust-project",
"path": "/rust-master/src/test/ui/panics/panic-safe.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/panics/panic-safe.rs
// run-pass
#![allow(dead_code)]
use std::panic::{UnwindSafe, AssertUnwindSafe};
use std::cell::RefCell;
use std::sync::{Mutex, RwLock, Arc};
use std::rc::Rc;
struct Foo { a: i32 }
fn assert<T: UnwindSafe + ?Sized>() {}
... | code_fim | medium | {
"lang": "rust",
"repo": "IThawk/rust-project",
"path": "/rust-master/src/test/ui/panics/panic-safe.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.game = props.game;
self.on_found_word = props.on_found_word;
true
}
}
impl Renderable<Play> for Play {
fn view(&self) -> Html<Self> {
html! {
<div class="play",>
<div>
{ self.grid() }
<input... | code_fim | hard | {
"lang": "rust",
"repo": "panicbit/boggle",
"path": "/ui/src/model/play.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> // If the word is in the grid…
if self.game.words.contains(&word) {
// …and it is not found yet…
if let Err(index) = self.game.found_words.binary_search(&word) {
// …and signal that a new word was found
... | code_fim | hard | {
"lang": "rust",
"repo": "panicbit/boggle",
"path": "/ui/src/model/play.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: panicbit/boggle path: /ui/src/model/play.rs
use yew::prelude::*;
use boggle::Grid;
use super::Game;
pub struct Play {
game: Game,
word: String,
on_found_word: Option<Callback<(usize, String)>>,
}
impl Play {
fn grid_row(&self, y: usize) -> Html<Self> {
html! {{
... | code_fim | hard | {
"lang": "rust",
"repo": "panicbit/boggle",
"path": "/ui/src/model/play.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let _exists_etc_zsh_zshenv = exists("/etc/zsh");
let _exists_zdotdir_zshenv =
exists_if(&format!("{}/.zshenv", var_zdotdir), var_zdotdir_ok);
let _exists_etc_zsh_zprofile = exists("/etc/zsh/zprofile");
let _exists_etc_profile = exists("/etc/profile");
let _exists_zdotdir_zprofi... | code_fim | medium | {
"lang": "rust",
"repo": "alisianoi/jmp-rs",
"path": "/src/subcommand/install/zsh.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: alisianoi/jmp-rs path: /src/subcommand/install/zsh.rs
use crate::env::var_or_default;
use crate::file::copy_once;
use crate::path::{exists, exists_if};
use crate::shell::Shell;
use log::debug;
fn zdotdir() -> (String, bool) {
let (var_home, var_home_ok) = var_or_default("HOME");
let (va... | code_fim | medium | {
"lang": "rust",
"repo": "alisianoi/jmp-rs",
"path": "/src/subcommand/install/zsh.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>pub fn run() -> Result<(), Box<dyn std::error::Error>> {
let (var_zdotdir, var_zdotdir_ok) = zdotdir();
let _exists_etc_zsh_zshenv = exists("/etc/zsh");
let _exists_zdotdir_zshenv =
exists_if(&format!("{}/.zshenv", var_zdotdir), var_zdotdir_ok);
let _exists_etc_zsh_zprofile = exis... | code_fim | hard | {
"lang": "rust",
"repo": "alisianoi/jmp-rs",
"path": "/src/subcommand/install/zsh.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: jffjs/aoc_2019 path: /src/day3/mod.rs
use crate::util::read_input;
use std::collections::{HashMap, HashSet};
use std::io::{BufRead, BufReader};
type Coord = (i32, i32);
type Grid = HashMap<Coord, HashSet<usize>>;
#[derive(Debug)]
enum Segment {
U(i32),
D(i32),
L(i32),
R(i32),
}... | code_fim | hard | {
"lang": "rust",
"repo": "jffjs/aoc_2019",
"path": "/src/day3/mod.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut shortest_steps = 999_999;
for intersection in intersections.iter() {
let mut total_steps = 0;
for path in wire_paths.iter() {
let mut position: Coord = (0, 0);
let mut steps = 0;
for segment in path.iter() {
match segment ... | code_fim | hard | {
"lang": "rust",
"repo": "jffjs/aoc_2019",
"path": "/src/day3/mod.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: maidsafe-archive/safe_crypto path: /examples/determine_work_factor.rs
// Copyright 2018 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT
// https://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD
// https://opensou... | code_fim | hard | {
"lang": "rust",
"repo": "maidsafe-archive/safe_crypto",
"path": "/examples/determine_work_factor.rs",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for log_n in 0..=WORK_FACTOR_MAX {
let start = Instant::now();
for _ in 0..NUM_ITERATIONS {
let password = b"typicalpassword";
let salt = b"typicalsalt";
let mut output = [0; safe_crypto::SYMMETRIC_KEY_BYTES];
safe_crypto::derive_key_fr... | code_fim | hard | {
"lang": "rust",
"repo": "maidsafe-archive/safe_crypto",
"path": "/examples/determine_work_factor.rs",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: muzudho/kifuwarabe-shogi-entry-model path: /src/cosmic/square.rs
//! Square is shogi coordinate. file*10+rank.
//!
//! North
//! 91 81 71 61 51 41 31 21 11
//! 92 82 72 62 52 42 32 22 12
//! W 93 83 73 63 53 43 33 23 13 E
//! E 94 84 74 64 54 44 34 24 14 A
//! S 95 85 75 65 55 45 3... | code_fim | hard | {
"lang": "rust",
"repo": "muzudho/kifuwarabe-shogi-entry-model",
"path": "/src/cosmic/square.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// Arguments
/// ---------
/// * `r` - (Relative file, relative rank).
pub fn get_address(&self) -> isize {
10 * self.file + self.rank
}
/// Arguments
/// ---------
/// * `r` - (Relative file, relative rank).
pub fn rotate_180(&mut self) -> &mut Self {
... | code_fim | hard | {
"lang": "rust",
"repo": "muzudho/kifuwarabe-shogi-entry-model",
"path": "/src/cosmic/square.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[derive(Debug)]
pub enum Degree45Orthant {
/// 正第4象限と、正第1象限☆(^~^)
IVOrI,
/// コ第1象限と、コ第2象限☆(^~^)
CoIOrCoII,
/// 正第2象限と、正第3象限☆(^~^)
IIOrIII,
/// コ第3象限と、コ第4象限☆(^~^)
CoIIIOrCoIV,
}
impl Degree45Orthant {
/// Arguments
/// ---------
/// * `r` - (Relative file, relat... | code_fim | hard | {
"lang": "rust",
"repo": "muzudho/kifuwarabe-shogi-entry-model",
"path": "/src/cosmic/square.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: nestordemeure/gambit path: /gambit/src/result/pareto.rs
use crate::grammar::{Grammar, Formula};
use super::Result;
use linked_list::{LinkedList, Cursor};
use std::fmt;
//-------------------------------------------------------------------------------------------------
// TYPES
/// represents an... | code_fim | hard | {
"lang": "rust",
"repo": "nestordemeure/gambit",
"path": "/gambit/src/result/pareto.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>/// macro to display a result
impl<State: Grammar> fmt::Display for ParetoFront<State>
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result
{
writeln!(f, "{{").unwrap();
for element in self.front.iter()
{
writeln!(f, "\tscore:{}\tcost:{}\tformula:'{}'", element.score, el... | code_fim | hard | {
"lang": "rust",
"repo": "nestordemeure/gambit",
"path": "/gambit/src/result/pareto.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for p in &paths {
println!("{}", p.to_string_lossy());
}
let validator = AllRulesValidator::new(suppress, default_filter());
let mut errs = vec![];
for path in paths.into_iter() {
let path_str = path.to_string_lossy().to_owned();
let source_code = fs::read_to_... | code_fim | hard | {
"lang": "rust",
"repo": "doyoubi/mylint-rs",
"path": "/src/main.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #[structopt(short, long)]
suppress: Vec<String>,
}
struct LintErr {
filepath: String,
source_code: String,
err: ValidationError,
}
fn print_err_lines(errs: Vec<LintErr>) -> Result<(), String> {
let ps = SyntaxSet::load_defaults_newlines();
let ts = ThemeSet::load_defaults();
... | code_fim | hard | {
"lang": "rust",
"repo": "doyoubi/mylint-rs",
"path": "/src/main.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: doyoubi/mylint-rs path: /src/main.rs
extern crate env_logger;
use ansi_term::Colour::{Cyan, Green, Red};
use mylint::{default_filter, AllRulesValidator, SourceCode, ValidationError, Validator, RULES};
use scan_dir::ScanDir;
use std::fs;
use structopt::StructOpt;
use syntect::easy::HighlightLines... | code_fim | hard | {
"lang": "rust",
"repo": "doyoubi/mylint-rs",
"path": "/src/main.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
/// Get the value of the button register.
fn button_reg(&self) -> ButtonRegister;
/// Set the value of the button register.
fn set_button_reg(&mut self, buttons: ButtonRegister);
}
/// "update" rather than "tick" here because the input is not on a clock like the
/// other components and... | code_fim | hard | {
"lang": "rust",
"repo": "ciaran2/feo3boy",
"path": "/feo3boy/src/input.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ciaran2/feo3boy path: /feo3boy/src/input.rs
use bitflags::bitflags;
use crate::interrupts::{InterruptContext, InterruptFlags, Interrupts};
use crate::memdev::MemDevice;
bitflags! {
/// Lcd control status flags
#[derive(Default, Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub struct B... | code_fim | hard | {
"lang": "rust",
"repo": "ciaran2/feo3boy",
"path": "/feo3boy/src/input.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> subscriptions_handler(request, stream, rootNode, config).await
}
pub fn graphql_route(config: &mut ServiceConfig) {
config
.service(graphiql)
.service(graphql)
.service(subscriptions);
}<|fim_prefix|>// repo: heypoom/graphql-in-3ms path: /crusty-api/src/routes/graphql/con... | code_fim | hard | {
"lang": "rust",
"repo": "heypoom/graphql-in-3ms",
"path": "/crusty-api/src/routes/graphql/controller.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: heypoom/graphql-in-3ms path: /crusty-api/src/routes/graphql/controller.rs
#![feature(async_closure)]
use std::sync::Arc;
use actix_web::{Error, HttpResponse, web, get, post, Result, web::ServiceConfig, HttpRequest};
use juniper::http::GraphQLRequest;
use juniper::http::graphiql::graphiql_sour... | code_fim | hard | {
"lang": "rust",
"repo": "heypoom/graphql-in-3ms",
"path": "/crusty-api/src/routes/graphql/controller.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ozkar99/cm-telemetry path: /examples/f1_2022.rs
use cm_telemetry::f1::f1_2022::F1_2022;
use cm_telemetry::TelemetryServer;
fn main() {
let server =
TelemetryServer::<F1_2022>::new("127.0.0.1:20777").expect("failed to bind to address");
println!("listening on 127.0.0.1:20777...")... | code_fim | hard | {
"lang": "rust",
"repo": "ozkar99/cm-telemetry",
"path": "/examples/f1_2022.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> match event.unwrap() {
F1_2022::Motion(_data) => println!("Received Motion packet"),
F1_2022::Session(_data) => println!("Received Session packet"),
F1_2022::LapData(_data) => println!("Received Lap packet"),
F1_2022::Event(_data) => println!("Receiv... | code_fim | hard | {
"lang": "rust",
"repo": "ozkar99/cm-telemetry",
"path": "/examples/f1_2022.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: daily-boj/kiwiyou path: /P17413.rs
use std::io::{stdin, Read};
fn main() {
let mut buffer = [0u8; 100000];
let len = stdin().read(&mut buffer).unwrap();
let mut string = unsafe { std::str::from_utf8_unchecked(&buffer[..len]) };
while let Some(other_index) = string.find(|c: char|... | code_fim | hard | {
"lang": "rust",
"repo": "daily-boj/kiwiyou",
"path": "/P17413.rs",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> ");
string = &string[other_index + 1..];
}
_ => string = &string[other_index + 1..],
}
}
let reversed: String = string.chars().rev().collect();
println!("{}", reversed);
}<|fim_prefix|>// repo: daily-boj/kiwiyou path: /P17413.rs
use std::io::{s... | code_fim | hard | {
"lang": "rust",
"repo": "daily-boj/kiwiyou",
"path": "/P17413.rs",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: mapno/cses_solutions path: /towers/src/main.rs
use std::cmp::Ordering::Less;
use std::io::{BufRead, Write};
fn main() {
let stdout = std::io::stdout();
let mut stdout = std::io::BufWriter::new(stdout.lock());
let stdin = std::io::stdin();
let mut scanner = Scanner::new(stdin.loc... | code_fim | hard | {
"lang": "rust",
"repo": "mapno/cses_solutions",
"path": "/towers/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut size = s.len();
if size == 0 {
return 0;
}
let mut base = 0usize;
while size > 1 {
let half = size / 2;
let mid = base + half;
let cmp = (unsafe { s.get_unchecked(base) }).cmp(x);
base = if cmp == Less { mid } else { base };
size ... | code_fim | medium | {
"lang": "rust",
"repo": "mapno/cses_solutions",
"path": "/towers/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: juntyr/necsim-rust path: /necsim/core/src/lib.rs
#![deny(clippy::pedantic)]
#![no_std]
#![feature(const_trait_impl)]
#![feature(const_type_name)]
#![feature(const_mut_refs)]
#![feature(const_refs_to_cell)]
#![feature(control_flow_enum)]
#![feature(min_specialization)]
#[doc(hidden)]
pub extern ... | code_fim | easy | {
"lang": "rust",
"repo": "juntyr/necsim-rust",
"path": "/necsim/core/src/lib.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[macro_use]
extern crate contracts;
pub mod cogs;
pub mod event;
pub mod landscape;
pub mod lineage;
pub mod reporter;
pub mod simulation;<|fim_prefix|>// repo: juntyr/necsim-rust path: /necsim/core/src/lib.rs
#![deny(clippy::pedantic)]
#![no_std]
#![feature(const_trait_impl)]
#![feature(const_type_nam... | code_fim | easy | {
"lang": "rust",
"repo": "juntyr/necsim-rust",
"path": "/necsim/core/src/lib.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>fn main() {
let mut srv = Nickel::new();
srv.post("/multipart_upload/", handle_multipart);
// Start this example via:
//
// `cargo run --example nickel --features nickel`
//
// And - if you are in the root of this repository - do an example
// upload via:
/... | code_fim | hard | {
"lang": "rust",
"repo": "winksaville/fuchsia",
"path": "/third_party/rust_crates/vendor/multipart/examples/nickel.rs",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: winksaville/fuchsia path: /third_party/rust_crates/vendor/multipart/examples/nickel.rs
extern crate multipart;
extern crate nickel;
use std::io::{self, Write};
use nickel::{Action, HttpRouter, MiddlewareResult, Nickel, Request, Response};
use nickel::status::StatusCode;
use multipart::s... | code_fim | hard | {
"lang": "rust",
"repo": "winksaville/fuchsia",
"path": "/third_party/rust_crates/vendor/multipart/examples/nickel.rs",
"mode": "psm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut sector_infos: Vec<SectorOnChainInfo> = Vec::new();
for sector_number in sector_numbers.iter() {
let sector_on_chain = self
.amt
.get(sector_number as SectorNumber)
.map_err(|e| {
e.downcast_default(
... | code_fim | hard | {
"lang": "rust",
"repo": "vmx/forest",
"path": "/vm/actor/src/builtin/miner/sectors.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: vmx/forest path: /vm/actor/src/builtin/miner/sectors.rs
// Copyright 2020 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
use super::SectorOnChainInfo;
use crate::{actor_error, ActorDowncast, ActorError, ExitCode};
use cid::Cid;
use fil_types::{SectorNumber, MAX_SECTOR_NUMBER};
us... | code_fim | hard | {
"lang": "rust",
"repo": "vmx/forest",
"path": "/vm/actor/src/builtin/miner/sectors.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: eldruin/ads1x1x-rs path: /src/ic.rs
/// ICs
use crate::private;
pub struct Resolution12Bit(pub(crate) ());
pub struct Resolution16Bit(pub(crate) ());
<|fim_suffix|>tier2_features!(Ads1014);
tier2_features!(Ads1114);
tier2_features!(Ads1015);
tier2_features!(Ads1115);<|fim_middle|>macro_rules! ... | code_fim | hard | {
"lang": "rust",
"repo": "eldruin/ads1x1x-rs",
"path": "/src/ic.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>tier2_features!(Ads1014);
tier2_features!(Ads1114);
tier2_features!(Ads1015);
tier2_features!(Ads1115);<|fim_prefix|>// repo: eldruin/ads1x1x-rs path: /src/ic.rs
/// ICs
use crate::private;
pub struct Resolution12Bit(pub(crate) ());
pub struct Resolution16Bit(pub(crate) ());
macro_rules! ic_marker {
... | code_fim | medium | {
"lang": "rust",
"repo": "eldruin/ads1x1x-rs",
"path": "/src/ic.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ChenPufeng/xterm-js-rs path: /src/addons/fit.rs
use crate::{TerminalAddon, Terminal};
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
#[wasm_bindgen(module = "xterm-addon-fit")]
extern "C" {
#[wasm_bindgen(extends = TerminalAddon)]
pub type FitAddon;
#[wasm_bindgen(constru... | code_fim | medium | {
"lang": "rust",
"repo": "ChenPufeng/xterm-js-rs",
"path": "/src/addons/fit.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #[wasm_bindgen(method, method, js_name = "proposeDimensions")]
pub fn propose_dimensions(this: &FitAddon) -> TerminalDimensions;
// ========================================================================
#[wasm_bindgen(js_name = "ITerminalDimensions")]
pub type TerminalDimensions;
... | code_fim | hard | {
"lang": "rust",
"repo": "ChenPufeng/xterm-js-rs",
"path": "/src/addons/fit.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>fn main() {
let a = Colour::RGB(255, 123, 30);
let b = Colour::Hex(String::from("ff7b1e"));
let red = Colour::RGB(255, 0, 0);
print_colour(a);
print_colour(b);
print_colour(red);
}<|fim_prefix|>// repo: nsoroush/Rust-tutorial path: /Examples/Pattern/MatchingEnumValues.rs
enum Colo... | code_fim | hard | {
"lang": "rust",
"repo": "nsoroush/Rust-tutorial",
"path": "/Examples/Pattern/MatchingEnumValues.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: nsoroush/Rust-tutorial path: /Examples/Pattern/MatchingEnumValues.rs
enum Colour {
RGB(u16, u16, u16),
Hex(String)
}
fn print_colour(colour_value: Colour) {
<|fim_suffix|>fn main() {
let a = Colour::RGB(255, 123, 30);
let b = Colour::Hex(String::from("ff7b1e"));
let red = Co... | code_fim | hard | {
"lang": "rust",
"repo": "nsoroush/Rust-tutorial",
"path": "/Examples/Pattern/MatchingEnumValues.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let current_dir_path_result = env::current_dir();
let current_dir_path = match current_dir_path_result {
Ok(path_buf) => path_buf,
Err(_) => panic!("directory is not found"),
};
let youki_path = current_dir_path.join(PathBuf::from("youki"));
let status = Command::new(yo... | code_fim | medium | {
"lang": "rust",
"repo": "sasurau4/youki",
"path": "/tests/integration.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: sasurau4/youki path: /tests/integration.rs
use std::env;
use std::path::PathBuf;
use std::process::{Command, Stdio};
<|fim_suffix|> let current_dir_path_result = env::current_dir();
let current_dir_path = match current_dir_path_result {
Ok(path_buf) => path_buf,
Err(_) =>... | code_fim | medium | {
"lang": "rust",
"repo": "sasurau4/youki",
"path": "/tests/integration.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> }
},
Err(e) => {
println!("\t[!] CURRENT SERVER TIME : {:?} | STATUS : ✅ | AUTH MICROSERVICE SERVER STATUS : {:?}", chrono::Local::now().naive_local(), e);
Err(e)
... | code_fim | hard | {
"lang": "rust",
"repo": "wildonion/aravl",
"path": "/microservices/device/src/macros/authenticity.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: wildonion/aravl path: /microservices/device/src/macros/authenticity.rs
#[macro_export]
macro_rules! authenticity {
/*
the rules for api!("url" => "http://localhost:7366/avl/api/auth", "body" => "{}", "headers" => {}) is the following
$($($name:expr => $key:expr),*)
... | code_fim | hard | {
"lang": "rust",
"repo": "wildonion/aravl",
"path": "/microservices/device/src/macros/authenticity.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ln!("\t[+] CURRENT SERVER TIME : {:?} | STATUS : ✅ | RESPONSE DATA FROM THE AUTH MICROSERVICE SERVER : {:?}", chrono::Local::now().naive_local(), json);
Ok(json) //-- returning the GPS configurations structure
},
... | code_fim | hard | {
"lang": "rust",
"repo": "wildonion/aravl",
"path": "/microservices/device/src/macros/authenticity.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>mId
:
:
from_internal
(
self
.
inner
.
stream_id
(
)
)
}
}
/
/
=
=
=
=
=
impl
StreamId
=
=
=
=
=
impl
StreamId
{
pub
(
crate
)
fn
from_internal
(
id
:
crate
:
:
frame
:
:
StreamId
)
-
>
Self
{
StreamId
(
id
.
into
(
)
)
}
/
/
/
Returns
the
u32
corresponding
to
this
StreamId
/
/
/
/
/
/
#
Note
/
/
/
/
/
/
... | code_fim | hard | {
"lang": "rust",
"repo": "marco-c/gecko-dev-wordified",
"path": "/third_party/rust/h2/src/share.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified path: /third_party/rust/h2/src/share.rs
m
{
inner
:
FlowControl
}
/
/
/
A
handle
to
release
window
capacity
to
a
remote
stream
.
/
/
/
/
/
/
This
type
allows
the
caller
to
manage
inbound
data
[
flow
control
]
.
The
/
/
/
caller
is
expected
to
call
[
release_capacity
]... | code_fim | hard | {
"lang": "rust",
"repo": "marco-c/gecko-dev-wordified",
"path": "/third_party/rust/h2/src/share.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified path: /third_party/rust/h2/src/share.rs
pacity
is
assigned
to
a
stream
(
indicated
by
/
/
/
poll_capacity
returning
Ready
)
this
capacity
is
reserved
on
the
/
/
/
connection
and
will
*
*
not
*
*
be
assigned
to
any
other
stream
.
If
data
is
/
/
/
never
written
to
the
s... | code_fim | hard | {
"lang": "rust",
"repo": "marco-c/gecko-dev-wordified",
"path": "/third_party/rust/h2/src/share.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: jpmcruz/Rust_Tutorials path: /vectors_8/src/main.rs
use std::collections::HashMap;
fn main() {
let v = vec![1, 2, 3, 4, 5];
let third: &i32 = &v[2];
println!("The third element is {}", third);
match v.get(2) {
Some(third) => println!("The third element is {}", third),
... | code_fim | hard | {
"lang": "rust",
"repo": "jpmcruz/Rust_Tutorials",
"path": "/vectors_8/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.