text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> pub const generate_getter_field: crate::ext::ExtFieldOptional<crate::descriptor::FieldOptions, crate::reflect::types::ProtobufTypeBool> = crate::ext::ExtFieldOptional { field_number: 17005, phantom: ::std::marker::PhantomData }; pub const carllerche_bytes_for_bytes_field: crate::ext::ExtFieldOpti...
code_fim
hard
{ "lang": "rust", "repo": "Elrendio/rust-protobuf", "path": "/protobuf/src/rustproto.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Elrendio/rust-protobuf path: /protobuf/src/rustproto.rs st expose_fields_all: crate::ext::ExtFieldOptional<crate::descriptor::FileOptions, crate::reflect::types::ProtobufTypeBool> = crate::ext::ExtFieldOptional { field_number: 17003, phantom: ::std::marker::PhantomData }; pub const generate...
code_fim
hard
{ "lang": "rust", "repo": "Elrendio/rust-protobuf", "path": "/protobuf/src/rustproto.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>` is a An Argumant to be taken // / ``` // / This is a an Example // / let a = factorial(5); // 120 // / ``` pub fn factorial(n: u32) -> u32 { if n > 1 { n * factorial(n - 1) } else { n } }<|fim_prefix|>// repo: UsairimIsani/rust-algo-prac path: /recursion/src/factorial.rs //...
code_fim
medium
{ "lang": "rust", "repo": "UsairimIsani/rust-algo-prac", "path": "/recursion/src/factorial.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: UsairimIsani/rust-algo-prac path: /recursion/src/factorial.rs // /# Factorial Is A Function That calculates what it says // / Do Understan Factorial We must first understand the Meaning iof factorial and Decide // / So it is required by all people to discover factorial // / * `n<|fim_suffix|> pu...
code_fim
medium
{ "lang": "rust", "repo": "UsairimIsani/rust-algo-prac", "path": "/recursion/src/factorial.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chenqin/sparrow path: /src/booster/learner.rs f.root_rho_gamma; debug!("reset-all, {}", self.rho_gamma); } /// Reset the statistics of the speicified candidate weak rules /// Trigger when the gamma is changed and new node is added fn reset_trackers(&mut self) { f...
code_fim
hard
{ "lang": "rust", "repo": "chenqin/sparrow", "path": "/src/booster/learner.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut ret = None; if tree_node.is_some() { let tree_node = tree_node.unwrap(); tree_node.write_log(); if validate_set1.len() > 0 { let (mart1, weight1): (f32, f32) = { validate_set1.par_iter().zip( ...
code_fim
hard
{ "lang": "rust", "repo": "chenqin/sparrow", "path": "/src/booster/learner.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chenqin/sparrow path: /src/booster/learner.rs .self.num_candid { self.sum_weights[index] = 0.0; self.counts[index] = 0; } self.total_count = 0; self.total_weight = 0.0; } fn setup(&mut self, index: usize) { let mut is_cleared = fal...
code_fim
hard
{ "lang": "rust", "repo": "chenqin/sparrow", "path": "/src/booster/learner.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> log(E) = (1-rho_e)*log(e_ss)+rho_e*log(E{-1})+sig_e*EE; A = LAMB*C^(1/gam)*(C^((gam-1)/gam)+E^(1/gam)*(M/P)^((gam-1)/gam)); eta = LAMB*W/P*(1-H); E*C = M/P*(1-1/R)^gam; LAMB = beta*R*LAMB{+1}*P/P{+1}; LAMB*(1/X+phi_k/g*(K/(g*K{-1})-1)) = beta*LAMB{+1}*(Q{+1}/P{+1}+(1-delta)/X{+1}) - beta*phi_...
code_fim
hard
{ "lang": "rust", "repo": "hollander03/RISE_toolbox", "path": "/examples/VariousModels/PeterIreland/Endogenous_JME2003/emosp_ns.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hollander03/RISE_toolbox path: /examples/VariousModels/PeterIreland/Endogenous_JME2003/emosp_ns.rs endogenous Y C I H N M W Q D P R K LAMB XI A E Z X V YGT PAI MU log_vars Y C I H N M W Q D P R K LAMB XI A E Z X V YGT PAI MU exogenous EA EE TREND EZ EV EX parameters delta rho_x sig_x phi_k_tr...
code_fim
hard
{ "lang": "rust", "repo": "hollander03/RISE_toolbox", "path": "/examples/VariousModels/PeterIreland/Endogenous_JME2003/emosp_ns.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> D/P = Y -(W*H+Q*K{-1})/P-phi_p/2*(P/(steady_state(PAI)*P{-1})-1)^2*Y; Y = K{-1}^alpha*(g^TREND*Z*H)^(1-alpha); LAMB*W/P*H = (1-alpha)^XI*Y; LAMB*Q/P*K{-1} = alpha*XI*Y; phi_p*LAMB*(P/(steady_state(PAI)*P{-1})-1)*P/(steady_state(PAI)*P{-1}) = (1-theta)*LAMB+ theta*XI + beta*phi_p*LAMB{+1}*(P{+1}...
code_fim
hard
{ "lang": "rust", "repo": "hollander03/RISE_toolbox", "path": "/examples/VariousModels/PeterIreland/Endogenous_JME2003/emosp_ns.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>impl Hashable for Content { fn hash(&self) -> H256 { // TODO: we are hashing in a merkle tree. why do we need so? let merkle_tree = MerkleTree::new(&self.votes); let mut bytes = [0u8; 66]; bytes[..2].copy_from_slice(&self.chain_number.to_be_bytes()); bytes[2..34...
code_fim
medium
{ "lang": "rust", "repo": "ShuoWangNSL/prism-rust", "path": "/src/block/voter.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ShuoWangNSL/prism-rust path: /src/block/voter.rs use super::Block; use super::Content as BlockContent; use crate::config::*; use crate::crypto::hash::{Hashable, H256}; use crate::crypto::merkle::MerkleTree; use crate::experiment::performance_counter::PayloadSize; /// The content of a voter bloc...
code_fim
medium
{ "lang": "rust", "repo": "ShuoWangNSL/prism-rust", "path": "/src/block/voter.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Generate the genesis block of the voter chain with the given chain ID. pub fn genesis(chain_num: u16) -> Block { let all_zero: [u8; 32] = [0; 32]; let content = Content { chain_number: chain_num, voter_parent: all_zero.into(), votes: vec![], }; // TODO: this blo...
code_fim
hard
{ "lang": "rust", "repo": "ShuoWangNSL/prism-rust", "path": "/src/block/voter.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nayato/azure_cosmos_sdk path: /src/list_documents.rs use ConsistencyLevel; use azure_core_sdk::incompletevector::ContinuationToken; #[derive(Debug, Clone)] pub struct ListDocumentsOptions<'a> { pub max_item_count: Option<u64>, pub continuation_token: Option<&'a ContinuationToken>, p...
code_fim
medium
{ "lang": "rust", "repo": "nayato/azure_cosmos_sdk", "path": "/src/list_documents.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> LIST_DOCUMENTS_OPTIONS_DEFAULT.clone() } } pub const LIST_DOCUMENTS_OPTIONS_DEFAULT: ListDocumentsOptions = ListDocumentsOptions { max_item_count: None, continuation_token: None, consistency_level_override: None, session_token: None, incremental_feed: false, if_none_ma...
code_fim
medium
{ "lang": "rust", "repo": "nayato/azure_cosmos_sdk", "path": "/src/list_documents.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: purpleposeidon/rust-x86asm path: /src/test/instruction_tests/instr_vaddpd.rs use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; use ::test::run_test; #[t...
code_fim
hard
{ "lang": "rust", "repo": "purpleposeidon/rust-x86asm", "path": "/src/test/instruction_tests/instr_vaddpd.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> run_test(&Instruction { mnemonic: Mnemonic::VADDPD, operand1: Some(Direct(ZMM8)), operand2: Some(Direct(ZMM11)), operand3: Some(Direct(ZMM16)), operand4: None, lock: false, rounding_mode: Some(RoundingMode::Zero), merge_mode: Some(MergeMode::Zero), sae: false, mask: Some(MaskReg::K5), broadcast: None ...
code_fim
hard
{ "lang": "rust", "repo": "purpleposeidon/rust-x86asm", "path": "/src/test/instruction_tests/instr_vaddpd.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> run_test(&Instruction { mnemonic: Mnemonic::VADDPD, operand1: Some(Direct(ZMM7)), operand2: Some(Direct(ZMM5)), operand3: Some(IndirectScaledIndexed(ESI, ESI, Eight, Some(OperandSize::Qword), None)), operand4: None, lock: false, rounding_mode: None, merge_mode: Some(MergeMode::Zero), sae: false, mask:...
code_fim
hard
{ "lang": "rust", "repo": "purpleposeidon/rust-x86asm", "path": "/src/test/instruction_tests/instr_vaddpd.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Znapi/llvm-rs path: /src/lib.rs //! A safe Rust API to LLVM. #![feature(const_fn)] #![feature(const_transmute)] extern crate libc; extern crate llvm_sys; use std::borrow::Borrow; // needed for Str // TODO: pub(crate) only /// Trait denoting types that wrap an LLVM*Ref. pub trait LLVMRef { ...
code_fim
hard
{ "lang": "rust", "repo": "Znapi/llvm-rs", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Convenience type pub type Result<T> = std::result::Result<T, String>; // Import all of llvm_sys. All (direct) submodules can simply import `super::*` // to be able to use anything from llvm_sys. use llvm_sys::prelude::*; use llvm_sys::*; use llvm_sys::core::*; use llvm_sys::execution_engine::*; use l...
code_fim
hard
{ "lang": "rust", "repo": "Znapi/llvm-rs", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let var_ident = format_ident!("_{}", field_index); let tokens = match &field.ty { Type::Array(array) => { derive_array_field(&var_ident, array) .ok_or(field_error)? } Type::Path(path) => { ...
code_fim
hard
{ "lang": "rust", "repo": "HeekonKim/pcd-rs", "path": "/pcd-rs-derive/src/derive_de.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let DerivedTokens { read_spec_tokens: read_spec, bin_read_tokens: bin_read, text_read_tokens: text_read, } = make_rw_expr(type_ident)?; let read_spec_tokens = quote! { #read_spec, Some(1) }; let bin_read_tokens = quote! { let #var_ident = { #bin_read }; ...
code_fim
hard
{ "lang": "rust", "repo": "HeekonKim/pcd-rs", "path": "/pcd-rs-derive/src/derive_de.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HeekonKim/pcd-rs path: /pcd-rs-derive/src/derive_de.rs input.span(), "Canont derive PcdDeserialize for struct with generics", )); } let data = match &input.data { Data::Struct(data) => data, Data::Enum(_) => { return Err(SynError::...
code_fim
hard
{ "lang": "rust", "repo": "HeekonKim/pcd-rs", "path": "/pcd-rs-derive/src/derive_de.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mehcode/wadatsumi path: /src/opcode.rs use std::fmt::{self, Display, Formatter}; #[derive(Debug, Copy, Clone)] pub struct Opcode { hi: u8, lo: u8, } <|fim_suffix|>impl Display for Opcode { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "{:02X}{:02X}", self....
code_fim
hard
{ "lang": "rust", "repo": "mehcode/wadatsumi", "path": "/src/opcode.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl Display for Opcode { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "{:02X}{:02X}", self.hi, self.lo) } }<|fim_prefix|>// repo: mehcode/wadatsumi path: /src/opcode.rs use std::fmt::{self, Display, Formatter}; #[derive(Debug, Copy, Clone)] pub struct Opcode { hi:...
code_fim
hard
{ "lang": "rust", "repo": "mehcode/wadatsumi", "path": "/src/opcode.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>fn check_consistent_sizes(tree: &Tree, input: &Vec<u8>) { fn check(node: Node, line_offsets: &Vec<usize>) { let start_byte = node.start_byte(); let end_byte = node.end_byte(); let start_point = node.start_position(); let end_point = node.end_position(); assert!...
code_fim
hard
{ "lang": "rust", "repo": "tree-sitter/tree-sitter", "path": "/cli/src/tests/corpus_test.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tree-sitter/tree-sitter path: /cli/src/tests/corpus_test.rs s"); let error_corpus_dir = fixtures_dir().join("error_corpus"); let template_corpus_dir = fixtures_dir().join("template_corpus"); let mut corpus_dir = grammars_dir.join(language_name).join("corpus"); if !corpus_dir.is_d...
code_fim
hard
{ "lang": "rust", "repo": "tree-sitter/tree-sitter", "path": "/cli/src/tests/corpus_test.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> set_included_ranges(&mut parser, &input, test.template_delimiters); let mut tree2 = parser.parse(&input, Some(&tree)).unwrap(); // Check that the new tree is consistent. check_consistent_sizes(&tree2, &input); if let Err(mess...
code_fim
hard
{ "lang": "rust", "repo": "tree-sitter/tree-sitter", "path": "/cli/src/tests/corpus_test.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Self { format: "%Y-%m-%d %H:%M:%S".into(), timezone: Timezone::Local, } } }<|fim_prefix|>// repo: foldu/statusbar path: /src/widget/datetime.rs use chrono::{Local, Utc}; use serde_derive::{Deserialize, Serialize}; use crate::{output::Output, widget}; pub stru...
code_fim
hard
{ "lang": "rust", "repo": "foldu/statusbar", "path": "/src/widget/datetime.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: foldu/statusbar path: /src/widget/datetime.rs use chrono::{Local, Utc}; use serde_derive::{Deserialize, Serialize}; use crate::{output::Output, widget}; <|fim_suffix|> let fmt = match self.cfg.timezone { Timezone::Local => Local::now().format(&self.cfg.format), T...
code_fim
hard
{ "lang": "rust", "repo": "foldu/statusbar", "path": "/src/widget/datetime.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Default for Cfg { fn default() -> Self { Self { format: "%Y-%m-%d %H:%M:%S".into(), timezone: Timezone::Local, } } }<|fim_prefix|>// repo: foldu/statusbar path: /src/widget/datetime.rs use chrono::{Local, Utc}; use serde_derive::{Deserialize, Serialize...
code_fim
hard
{ "lang": "rust", "repo": "foldu/statusbar", "path": "/src/widget/datetime.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ulrichji/approximate-euclidean-tsp-solver path: /src/euclidean_distance_graph.rs use kdtree::KdTree; #[derive(Debug, Copy, Clone)] pub struct Point<T, const N: usize> { pub dims: [T; N] } <|fim_suffix|>impl<T, const N: usize> EuclideanPointDistanceGraph<T, N> { pub fn new(point_list: V...
code_fim
medium
{ "lang": "rust", "repo": "ulrichji/approximate-euclidean-tsp-solver", "path": "/src/euclidean_distance_graph.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> EuclideanPointDistanceGraph { point_list, kd_tree, edge_counts } } }<|fim_prefix|>// repo: ulrichji/approximate-euclidean-tsp-solver path: /src/euclidean_distance_graph.rs use kdtree::KdTree; #[derive(Debug, Copy, Clone)] pub struct Point<T, const ...
code_fim
hard
{ "lang": "rust", "repo": "ulrichji/approximate-euclidean-tsp-solver", "path": "/src/euclidean_distance_graph.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>fn main() -> Result<(), ExitError> { let args: Vec<String> = env::args().collect(); if args.len() < 2 { return Err(ExitError("Must input leetcode url".to_string())); } // normalize input let input_url = args.get(1).unwrap().trim(); let problem = parse_problem_name(input_ur...
code_fim
hard
{ "lang": "rust", "repo": "vanhtuan0409/rust-leetcode", "path": "/src/generate/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // generate problem source code let template_path = Path::new(env!("CARGO_MANIFEST_DIR")).join("templates/problem.rs"); let template_str = fs::read_to_string(template_path) .map_err(|e| ExitError(format!("Cannot read problem template. Err: {}", e)))?; let source = template_str ...
code_fim
hard
{ "lang": "rust", "repo": "vanhtuan0409/rust-leetcode", "path": "/src/generate/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vanhtuan0409/rust-leetcode path: /src/generate/main.rs use regex::Regex; use std::{ env, fs, io::{Read, Write}, path::Path, }; #[macro_use] extern crate lazy_static; lazy_static! { static ref LC_PATTERN: Regex = Regex::new(r"(?m)(?:https?://)?leetcode\.com/problems/([^/...
code_fim
hard
{ "lang": "rust", "repo": "vanhtuan0409/rust-leetcode", "path": "/src/generate/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ZippeyKeys12/seta path: /src/cst/pratt.rs use crate::{ cst::Parser, lexer::{Lexer, Token}, }; use std::iter::Peekable; pub const MAX_PRECEDENCE: u8 = u8::max_value(); pub trait PrattParser { type Op: PrattOp; fn get_prefix(&self, lexer: &mut Peekable<Lexer>) -> Option<Self::Op...
code_fim
hard
{ "lang": "rust", "repo": "ZippeyKeys12/seta", "path": "/src/cst/pratt.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.get_prefix(lexer).is_some() } fn is_mixfix(&self, lexer: &mut Peekable<Lexer>) -> bool { self.get_mixfix(lexer).is_some() } fn get_precedence(&self, lexer: &mut Peekable<Lexer>) -> u8 { let op = self.get_mixfix(lexer); if let Some(op) = op { ...
code_fim
hard
{ "lang": "rust", "repo": "ZippeyKeys12/seta", "path": "/src/cst/pratt.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(_) = op { parser.push(); while precedence < pratt.get_precedence(&mut parser.lexer) { let mop = pratt.get_mixfix(&mut parser.lexer).unwrap(); parser.push(); parser.start_node_at(checkpoint, Token::BinaryOp); mop.parse(parser...
code_fim
hard
{ "lang": "rust", "repo": "ZippeyKeys12/seta", "path": "/src/cst/pratt.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// TODO: use custom request which can also hold timeout config, etc. // #[derive(Clone, Debug)] // pub struct Request { // pub method: Method, // pub headers: http::HeaderMap, // } pub type Request = http::Request<Body>; pub type Response = http::Response<Body>; #[derive(Debug)] pub struct Body(...
code_fim
hard
{ "lang": "rust", "repo": "wasmerio/wasmer", "path": "/lib/wasix-http-client/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wasmerio/wasmer path: /lib/wasix-http-client/src/lib.rs // Auto-generated sys bindings. #[allow(dead_code, clippy::all)] mod wasix_http_client_v1; use anyhow::bail; use crate::wasix_http_client_v1 as sys; pub use http::{header, Method, StatusCode}; #[derive(Clone)] pub struct HttpClient { ...
code_fim
hard
{ "lang": "rust", "repo": "wasmerio/wasmer", "path": "/lib/wasix-http-client/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: llogiq/koto path: /src/runtime/src/core/thread.rs use { crate::{runtime_error, ExternalValue, RuntimeError, Value, ValueMap}, std::{fmt, thread, thread::JoinHandle, time::Duration}, }; #[cfg(not(target_arch = "wasm32"))] use crate::get_external_instance; pub fn make_module() -> ValueMa...
code_fim
hard
{ "lang": "rust", "repo": "llogiq/koto", "path": "/src/runtime/src/core/thread.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> result.insert( Value::ExternalDataId.into(), Value::make_external_value(Self { join_handle: Some(join_handle), }), ); Value::Map(result) } } impl ExternalValue for Thread { fn value_type(&self) -> String { "Threa...
code_fim
hard
{ "lang": "rust", "repo": "llogiq/koto", "path": "/src/runtime/src/core/thread.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> result } #[derive(Debug)] struct Thread { join_handle: Option<JoinHandle<Result<Value, RuntimeError>>>, } impl Thread { #[cfg(not(target_arch = "wasm32"))] fn make_thread_map(join_handle: JoinHandle<Result<Value, RuntimeError>>) -> Value { let mut result = ValueMap::new(); ...
code_fim
hard
{ "lang": "rust", "repo": "llogiq/koto", "path": "/src/runtime/src/core/thread.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> break; } else { println!("Only numbers are allowed."); continue; } } } fn has_won(state: &[char]) -> bool { for tmp in 0..3 { if state[tmp] == state[tmp + 3] && state[tmp] == state[tmp + 6] { return true; } l...
code_fim
hard
{ "lang": "rust", "repo": "aj07/tictactoe-web3", "path": "/buidlin/tictactoe/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aj07/tictactoe-web3 path: /buidlin/tictactoe/src/main.rs extern crate termcolor; use std::io::Write; use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; fn greeting() { println!( "\nRust TicTacToe" ) } fn print_player(player: &char) { let mut stdout...
code_fim
hard
{ "lang": "rust", "repo": "aj07/tictactoe-web3", "path": "/buidlin/tictactoe/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>The replacement must be in place and use only constant extra memory. Example 1: Input: nums = [1,2,3] Output: [1,3,2] Example 2: Input: nums = [3,2,1] Output: [1,2,3] Example 3: Input: nums = [1,1,5] Output: [1,5,1] Constraints: 1 <= nums.length <= 100 0 <= nums[i] <= 100 */ fn main() {} struct Sol...
code_fim
hard
{ "lang": "rust", "repo": "pvva/leetcode-rust", "path": "/problems_0001_0100/examples/31_next_premutation.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pvva/leetcode-rust path: /problems_0001_0100/examples/31_next_premutation.rs /* A permutation of an array of integers is an arrangement of its members into a sequence or linear order. For example, for arr = [1,2,3], the following are all the permutations of arr: [1,2,3], [1,3,2], [2, 1, 3], [2,...
code_fim
hard
{ "lang": "rust", "repo": "pvva/leetcode-rust", "path": "/problems_0001_0100/examples/31_next_premutation.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nanne007/naive_p2p path: /src/config.rs use std::collections::HashMap; use serde::{Deserialize, Serialize}; use crate::types::{PeerAddr, PeerId}; use std::fmt::Debug; <|fim_suffix|>impl Default for NodeConfig { fn default() -> Self { NodeConfig { p2p_addr: "localhost:1...
code_fim
hard
{ "lang": "rust", "repo": "nanne007/naive_p2p", "path": "/src/config.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Default for NodeConfig { fn default() -> Self { NodeConfig { p2p_addr: "localhost:18080".to_string(), http_addr: "localhost:8080".to_string(), local_peer_id: "0".to_string(), bootnodes: HashMap::default(), } } }<|fim_prefix|>// r...
code_fim
hard
{ "lang": "rust", "repo": "nanne007/naive_p2p", "path": "/src/config.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: THeK3nger/advent-of-code-2020 path: /day04/src/main.rs use common::Result; use regex::Regex; /** --- Day 4: Passport Processing --- You arrive at the airport only to realize that you grabbed your North Pole Credentials instead of your passport. While these documents are extremely similar, North ...
code_fim
hard
{ "lang": "rust", "repo": "THeK3nger/advent-of-code-2020", "path": "/day04/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kaanaslanyuksek/priv-ic path: /backend/libraries/types/src/verification_code.rs use candid::CandidType; use serde::Deserialize; <|fim_suffix|>#[derive(CandidType, Clone, Deserialize, Debug)] pub enum VerificationCodeTarget { Phone(String), Email(String), // Address(PostalAddress), }...
code_fim
medium
{ "lang": "rust", "repo": "kaanaslanyuksek/priv-ic", "path": "/backend/libraries/types/src/verification_code.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(CandidType, Clone, Deserialize, Debug)] pub enum VerificationCodeTarget { Phone(String), Email(String), // Address(PostalAddress), }<|fim_prefix|>// repo: kaanaslanyuksek/priv-ic path: /backend/libraries/types/src/verification_code.rs use candid::CandidType; use serde::Deserialize; ...
code_fim
medium
{ "lang": "rust", "repo": "kaanaslanyuksek/priv-ic", "path": "/backend/libraries/types/src/verification_code.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub struct Cpu { regs: Registers, pub total_cycles: u32, pub is_running: bool, trace_file: Option<File>, } impl Cpu { pub fn new() -> Cpu { let mut cpu: Cpu = Cpu { regs: Default::default(), total_cycles: 0, is_running: true, tr...
code_fim
hard
{ "lang": "rust", "repo": "gb-archive/rustboy", "path": "/src/cpu/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Increment PC self.regs.pc += 1; // Execute instruction let cycles = instructions::exec(op, &mut self.regs, mem) * 4; if INSTR_DEBUG { let pc_diff = self.regs.pc as i32 - pc_before as i32; let addr_and_instr = match pc_di...
code_fim
hard
{ "lang": "rust", "repo": "gb-archive/rustboy", "path": "/src/cpu/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gb-archive/rustboy path: /src/cpu/mod.rs // // Central Processing Unit // #![allow(dead_code)] pub mod instructions; use std::str; use std::fmt; use std::io::prelude::*; use std::fs::{OpenOptions, File}; use colored::*; use mmu::Memory; // CPU Clock speed // TODO: Disable if log level...
code_fim
hard
{ "lang": "rust", "repo": "gb-archive/rustboy", "path": "/src/cpu/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.value.as_slice() } /// Returns the string representation. fn to_str(&self) -> String { format!("offset {:?} data :{:?}", self.offset_in_segment, self.value) } } /// /// This represents a Stream reader for a given Stream. /// Note: A python object of StreamReader canno...
code_fim
hard
{ "lang": "rust", "repo": "sarlaccpit/pravega-client-rust", "path": "/python_binding/src/stream_reader.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// /// Refer https://docs.python.org/3/reference/datamodel.html#basic-customization /// This function will be called by the repr() built-in function to compute the “official” string /// representation of an Python object. /// #[cfg(feature = "python_binding")] #[pyproto] impl PyObjectProtocol for StreamR...
code_fim
hard
{ "lang": "rust", "repo": "sarlaccpit/pravega-client-rust", "path": "/python_binding/src/stream_reader.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sarlaccpit/pravega-client-rust path: /python_binding/src/stream_reader.rs // // Copyright (c) Dell Inc., or its subsidiaries. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may ...
code_fim
hard
{ "lang": "rust", "repo": "sarlaccpit/pravega-client-rust", "path": "/python_binding/src/stream_reader.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: crisptrutski/aws-sdk-rust path: /sdk/mq/src/client.rs ring::String>, ) -> Self { self.inner = self.inner.set_engine_version(input); self } /// <p>Required. The broker's instance type.</p> pub fn host_instance_type(mut self, input: impl Into...
code_fim
hard
{ "lang": "rust", "repo": "crisptrutski/aws-sdk-rust", "path": "/sdk/mq/src/client.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn publicly_accessible(mut self, input: bool) -> Self { self.inner = self.inner.publicly_accessible(input); self } pub fn set_publicly_accessible(mut self, input: std::option::Option<bool>) -> Self { self.inner = self.inner.set_publicly_accessible(input...
code_fim
hard
{ "lang": "rust", "repo": "crisptrutski/aws-sdk-rust", "path": "/sdk/mq/src/client.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: joncatlin/poc-dc path: /ui-services/src/db/category.rs use crate::{app_errors::MyError, models::{Category}}; use deadpool_postgres::Client; use tokio_pg_mapper::FromTokioPostgresRow; // ***************************** Categorys **************************************** pub async fn get_categories(...
code_fim
hard
{ "lang": "rust", "repo": "joncatlin/poc-dc", "path": "/ui-services/src/db/category.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Create the delete statement let _delete_stmt = include_str!("../../sql/category/delete_category.sql"); let delete_stmt = client.prepare(&_delete_stmt).await.unwrap(); // TODO. Fix this if possible. Not sure how to do a bulk delete with this framework so // iterate through individu...
code_fim
hard
{ "lang": "rust", "repo": "joncatlin/poc-dc", "path": "/ui-services/src/db/category.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // TODO. Fix this if possible. Not sure how to do a bulk upsert with this framework so // iterate through individual inserts for item in upsert_list { if item.category_id == -1 { client.query(&insert_stmt, &[&item.category_name,]).await.unwrap(); } else { ...
code_fim
hard
{ "lang": "rust", "repo": "joncatlin/poc-dc", "path": "/ui-services/src/db/category.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: evernym/indy-sdk path: /experimental/plugins/postgres_storage/src/lib.rs as_ptr(), joined_value.as_ptr(), joined_value.len(), tags.as_ptr()); assert_match!(ErrorCode::WalletItemAlreadyExists, ...
code_fim
hard
{ "lang": "rust", "repo": "evernym/indy-sdk", "path": "/experimental/plugins/postgres_storage/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> _close_and_delete_wallet(handle); } /* TODO unit test for wallet search #[test] fn postgres_wallet_search_records_works() { _cleanup(); let handle = _create_and_open_wallet(); let type1_ = _type1(); let id1 = _id1(); let value1_ = _value1(...
code_fim
hard
{ "lang": "rust", "repo": "evernym/indy-sdk", "path": "/experimental/plugins/postgres_storage/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: evernym/indy-sdk path: /experimental/plugins/postgres_storage/src/lib.rs mmonInvalidState; } let wallet_context = handles.get(&xhandle).unwrap(); let wallet_box = &wallet_context.phandle; let storage = &*wallet_box; let res = storage.get(&type_.as_bytes(...
code_fim
hard
{ "lang": "rust", "repo": "evernym/indy-sdk", "path": "/experimental/plugins/postgres_storage/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vspecky/ai-assignments path: /Uninformed_Search/uninformed_search.rs /** * Name: Shashank ******* * Branch: TY B.Tech Comp * Roll No: 015 * * AI Lab Assignment: Application of Uninformed Search * * Problem Chosen: N-Queens Problem * * Algorithms Used: * - DFS * - DFS with Prunin...
code_fim
hard
{ "lang": "rust", "repo": "vspecky/ai-assignments", "path": "/Uninformed_Search/uninformed_search.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for x in 0..n { let mut child_queens = self.queens.clone(); child_queens.insert((x, y)); res.push(Self::new(child_queens)); } res } pub fn check_valid(&self, n: i8) -> bool { let n_u = n as usize; let mut xs = HashSet:...
code_fim
hard
{ "lang": "rust", "repo": "vspecky/ai-assignments", "path": "/Uninformed_Search/uninformed_search.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub struct Solver { n: i8, stack: Vec<State>, prune: bool, add_fn: fn(&State, i8) -> Vec<State>, } impl Solver { pub fn new(n: i8, mode: Modes) -> Self { let n_u = n as usize; let (add_fn, prune): (fn(&State, i8) -> Vec<State>, bool) = match mode { Modes::B...
code_fim
hard
{ "lang": "rust", "repo": "vspecky/ai-assignments", "path": "/Uninformed_Search/uninformed_search.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>eq ! ( out [ 0x42 0x80 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f ] ) ; let mut buf = EagerBuffer : : < U24 > : : new ( & [ 0x42 ] ) ; let mut out = Vec : : < u8 > : : new ( ) ; let len = 0x0001_0203...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/block-buffer/tests/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified path: /third_party/rust/block-buffer/tests/mod.rs use block_buffer : : { generic_array : : typenum : : { U10 U16 U24 U4 U8 } Block EagerBuffer LazyBuffer } ; # [ test ] fn test_eager_digest_pad ( ) { let mut buf = EagerBuffer : : < U4 > : : default ( ) ; let inputs = ...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/block-buffer/tests/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> args.insert(0, format!("vagga {}", cmd)); let result = match &cmd[..] { "_build_shell" => Ok(debug::run_interactive_build_shell(&wrapper)), "_check_overlayfs_support" => Ok(debug::check_overlayfs(&wrapper)), "_build" => build::build_container_cmd(&wrapper, args), "...
code_fim
hard
{ "lang": "rust", "repo": "brabadu/vagga", "path": "/src/wrapper/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: brabadu/vagga path: /src/wrapper/mod.rs use std::env::{current_dir}; use std::io::{stderr, Write}; use std::path::Path; use std::process::exit; use argparse::{ArgumentParser, Store, StoreOption, List}; use super::config::{find_config, Config, Settings}; use super::config::command::MainCommand:...
code_fim
hard
{ "lang": "rust", "repo": "brabadu/vagga", "path": "/src/wrapper/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DoooReyn/csml-engine path: /csml_interpreter/src/data/data.rs use crate::data::context::Context; use crate::data::Event; use crate::data::{ast::*, Literal}; use std::collections::HashMap; //////////////////////////////////////////////////////////////////////////////// // DATA STRUCTURES //////...
code_fim
medium
{ "lang": "rust", "repo": "DoooReyn/csml-engine", "path": "/csml_interpreter/src/data/data.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LyricZhao/plant path: /isl-rs/src/map_type.rs asicSet, user: *mut c_void) -> Option<BasicSet>, user: *mut c_void) -> Option<BasicSetList>; pub fn isl_basic_set_list_sort(list: BasicSetList, cmp: unsafe extern "C" fn(a: BasicSetRef, b: BasicSetRef, user: *mut c_void) -> c_int, user: *mut c_void...
code_fim
hard
{ "lang": "rust", "repo": "LyricZhao/plant", "path": "/isl-rs/src/map_type.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LyricZhao/plant path: /isl-rs/src/map_type.rs > Option<BasicSetList>; pub fn isl_basic_set_list_foreach_scc(list: BasicSetListRef, follows: unsafe extern "C" fn(a: BasicSetRef, b: BasicSetRef, user: *mut c_void) -> Bool, follows_user: *mut c_void, fn_: unsafe extern "C" fn(scc: BasicSetList, u...
code_fim
hard
{ "lang": "rust", "repo": "LyricZhao/plant", "path": "/isl-rs/src/map_type.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>} impl Deref for SetList { type Target = SetListRef; #[inline(always)] fn deref(&self) -> &SetListRef { self.as_ref() } } impl To<Option<SetList>> for *mut c_void { #[inline(always)] unsafe fn to(self) -> Option<SetList> { NonNull::new(self).map(SetList) } } impl BasicSet { #[inline(always)...
code_fim
hard
{ "lang": "rust", "repo": "LyricZhao/plant", "path": "/isl-rs/src/map_type.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: maximeborges/svd2rust_efm32gg990 path: /src/prs/ch3_ctrl.rs 55 => SOURCESELR::BURTC, 57 => SOURCESELR::LESENSEL, 58 => SOURCESELR::LESENSEH, 59 => SOURCESELR::LESENSED, i => SOURCESELR::_Reserved(i), } } #[doc = "Checks if the val...
code_fim
hard
{ "lang": "rust", "repo": "maximeborges/svd2rust_efm32gg990", "path": "/src/prs/ch3_ctrl.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: maximeborges/svd2rust_efm32gg990 path: /src/prs/ch3_ctrl.rs MER1 => 0x1d, SOURCESELR::TIMER2 => 0x1e, SOURCESELR::TIMER3 => 0x1f, SOURCESELR::USB => 0x24, SOURCESELR::RTC => 0x28, SOURCESELR::UART0 => 0x29, SOURCESELR::UART1...
code_fim
hard
{ "lang": "rust", "repo": "maximeborges/svd2rust_efm32gg990", "path": "/src/prs/ch3_ctrl.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>3) } #[doc = "Universal Serial Bus Interface"] #[inline] pub fn usb(self) -> &'a mut W { self.variant(SOURCESELW::USB) } #[doc = "Real-Time Counter"] #[inline] pub fn rtc(self) -> &'a mut W { self.variant(SOURCESELW::RTC) } #[doc = "Universal Asynchr...
code_fim
hard
{ "lang": "rust", "repo": "maximeborges/svd2rust_efm32gg990", "path": "/src/prs/ch3_ctrl.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut account_address: u32 = rng.gen(); account_address %= tree.capacity(); let amount: u128 = 500; let fee: u128 = 100; let token: u32 = 2; let ethereum_key = Fr::from_str("124").unwrap(); let sender_balance_before: u128 = 2000; let send...
code_fim
hard
{ "lang": "rust", "repo": "Dipper-Labs/zksync", "path": "/core/circuit/src/witness/withdraw.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let sender_leaf_initial = CircuitAccount::<Bn256> { subtree: sender_balance_tree, nonce: Fr::zero(), pub_key_hash: sender_pub_key_hash, }; tree.insert(account_address, sender_leaf_initial); let withdraw_witness = apply_withdraw( ...
code_fim
hard
{ "lang": "rust", "repo": "Dipper-Labs/zksync", "path": "/core/circuit/src/witness/withdraw.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Dipper-Labs/zksync path: /core/circuit/src/witness/withdraw.rs ed_width( &mut pubdata_bits, &self.args.fee.unwrap(), franklin_constants::FEE_MANTISSA_BIT_WIDTH + franklin_constants::FEE_EXPONENT_BIT_WIDTH, ); append_be_fixed_width( ...
code_fim
hard
{ "lang": "rust", "repo": "Dipper-Labs/zksync", "path": "/core/circuit/src/witness/withdraw.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: benoitrazet/sawtooth-sabre path: /contracts/sawtooth-pike/sp_executor_sdk/src/smart_permission_module.rs // Copyright 2018 Cargill Incorporated // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obt...
code_fim
hard
{ "lang": "rust", "repo": "benoitrazet/sawtooth-sabre", "path": "/contracts/sawtooth-pike/sp_executor_sdk/src/smart_permission_module.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let instance = ModuleInstance::new(&self.module, &ImportsBuilder::new().with_resolver("env", &env))? .assert_no_start(); info!("Writing arguments to memory"); let write_results: Vec<Result<u32, ExternalsError>> = args .iter() .map(|i| env.write...
code_fim
hard
{ "lang": "rust", "repo": "benoitrazet/sawtooth-sabre", "path": "/contracts/sawtooth-pike/sp_executor_sdk/src/smart_permission_module.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Retrieve the next result from the cursor. /// The session provided must be the same session used to create the cursor. /// /// Use this method when the session needs to be used again between iterations or when the added /// functionality of `Iterator` is not needed. /// ///...
code_fim
hard
{ "lang": "rust", "repo": "mongodb/mongo-rust-driver", "path": "/src/sync/cursor.rs", "mode": "spm", "license": "OpenSSL", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mongodb/mongo-rust-driver path: /src/sync/cursor.rs use futures_util::stream::StreamExt; use serde::de::{Deserialize, DeserializeOwned}; use super::ClientSession; use crate::{ bson::{Document, RawDocument}, error::Result, runtime, Cursor as AsyncCursor, SessionCursor as Asyn...
code_fim
hard
{ "lang": "rust", "repo": "mongodb/mongo-rust-driver", "path": "/src/sync/cursor.rs", "mode": "psm", "license": "OpenSSL", "source": "the-stack-v2" }
<|fim_suffix|>impl<T> SessionCursor<T> { pub(crate) fn new(async_cursor: AsyncSessionCursor<T>) -> Self { Self { async_cursor } } /// Move the cursor forward, potentially triggering requests to the database for more results /// if the local buffer has been exhausted. /// /// This will k...
code_fim
hard
{ "lang": "rust", "repo": "mongodb/mongo-rust-driver", "path": "/src/sync/cursor.rs", "mode": "spm", "license": "OpenSSL", "source": "the-stack-v2" }
<|fim_suffix|>hile ix < n && xs[ix] + t < y { ix += 1; } if ix == n || y < xs[ix] { println!("no"); return; } ix += 1; } println!("yes"); }<|fim_prefix|>// repo: itchyny/atcoder path: /abc005/src/bin/c.rs use std::io::{self, Read as _}; fn ma...
code_fim
medium
{ "lang": "rust", "repo": "itchyny/atcoder", "path": "/abc005/src/bin/c.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ); let t = read!(u64); let n = read!(usize); let xs = read!([u64; n]); let m = read!(usize); let ys = read!([u64; m]); let mut ix = 0; for &y in ys.iter() { while ix < n && xs[ix] + t < y { ix += 1; } if ix == n || y < xs[ix] { ...
code_fim
medium
{ "lang": "rust", "repo": "itchyny/atcoder", "path": "/abc005/src/bin/c.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: itchyny/atcoder path: /abc005/src/bin/c.rs use std::io::{self, Read as _}; fn main() { let mut input = String::new(); io::stdin().read_to_string(&mut input).unwrap(); let mut input = input.split_whitespace(); macro_rules! read<|fim_suffix|> ); let t = read!(u64); le...
code_fim
medium
{ "lang": "rust", "repo": "itchyny/atcoder", "path": "/abc005/src/bin/c.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(t) = self.task.take() { if t.alive.get() { t.local_clear(); } } } } debug_assert!(self.alive.get()); let arc_self = ManuallyDrop::new(unsafe { Arc::from_raw(self) }); // no refcount let waker = futures_util::task::waker_ref(&arc_self); let mut cx = Context...
code_fim
hard
{ "lang": "rust", "repo": "stbuehler/rust-fumio", "path": "/fumio-pool/src/pool/task.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[allow(clippy::mut_from_ref)] // unsafe anyway unsafe fn local_future(&self) -> &mut Option<LocalFutureObj<'static, ()>> { debug_assert_eq!(thread::current().id(), self.task_list().local_thread); &mut *self.future.get() } fn local_poll(&self) { struct ClearOnPanic<'a> { task: Option<&'a Tas...
code_fim
hard
{ "lang": "rust", "repo": "stbuehler/rust-fumio", "path": "/fumio-pool/src/pool/task.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stbuehler/rust-fumio path: /fumio-pool/src/pool/task.rs use futures_core::future::{Future, LocalFutureObj}; use futures_util::task::AtomicWaker; use std::cell::{Cell, UnsafeCell}; use std::marker::PhantomData; use std::mem::ManuallyDrop; use std::pin::Pin; use std::sync::Arc; use std::sync::atom...
code_fim
hard
{ "lang": "rust", "repo": "stbuehler/rust-fumio", "path": "/fumio-pool/src/pool/task.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>use crate::check::RustupToolchainCheck; use crate::context::ReleaseSource; use crate::error::{CargoMSRVError, TResult}; use crate::reporter::event::{Meta, SubcommandInit}; use crate::reporter::{Event, Reporter}; use rust_releases::semver; pub mod check; pub mod cli; pub mod error; pub mod exit_code; pub ...
code_fim
hard
{ "lang": "rust", "repo": "foresterre/cargo-msrv", "path": "/src/lib.rs", "mode": "spm", "license": "Unicode-DFS-2016", "source": "the-stack-v2" }
<|fim_prefix|>// repo: foresterre/cargo-msrv path: /src/lib.rs //! Documentation can be found on the project [README](https://github.com/foresterre/cargo-msrv/blob/main/README.md) page //! and in the cargo-msrv [book](https://foresterre.github.io/cargo-msrv/). If you can't find an answer on your question, //! feel fre...
code_fim
hard
{ "lang": "rust", "repo": "foresterre/cargo-msrv", "path": "/src/lib.rs", "mode": "psm", "license": "Unicode-DFS-2016", "source": "the-stack-v2" }
<|fim_suffix|>et_data_read_cipher(ef: *mut Eet_File, edd: *mut Eet_Data_Descriptor, name: *const c_char, cipher_key: *const c_char) -> *mut c_void; pub fn eet_data_read_cipher_buffer(ef: *mut Eet_File, ...
code_fim
hard
{ "lang": "rust", "repo": "ntan15/rust-efl", "path": "/efl-sys/eet-sys/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ntan15/rust-efl path: /efl-sys/eet-sys/src/lib.rs int; pub fn eet_data_image_colorspace_get(ef: *mut Eet_File, name: *const c_char, cipher_key: *const c_char, cspaces: *...
code_fim
hard
{ "lang": "rust", "repo": "ntan15/rust-efl", "path": "/efl-sys/eet-sys/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>onst c_char, _type: c_int, group_type: c_int, offset: c_int, count: c_int, counter_name: ...
code_fim
hard
{ "lang": "rust", "repo": "ntan15/rust-efl", "path": "/efl-sys/eet-sys/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }