text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: Aceeri/overseer-build path: /src/camera.rs use super::cgmath; use cgmath::prelude::{InnerSpace, SquareMatrix}; use cgmath::{Vector3, Matrix4}; #[derive(Debug)] pub struct Camera { pub view: Matrix4<f32>, pub perspective: Matrix4<f32>, pub fov: f32, pub near: f32, p...
code_fim
hard
{ "lang": "rust", "repo": "Aceeri/overseer-build", "path": "/src/camera.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sreinhardt/tiny_machine path: /src/registers/test.rs use registers::*; #[test] fn default(){ let reg = Registers::default(); assert_eq!{reg.get_ip(), 0}; assert_eq!{reg.get_li(), 0}; assert_eq!{reg.get_fr(), 0}; assert_eq!{reg.get_ac(), 0}; assert_eq!{reg.get_cf(), false}; assert_...
code_fim
hard
{ "lang": "rust", "repo": "sreinhardt/tiny_machine", "path": "/src/registers/test.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut reg = Registers::default(); let _ = reg.set_li(0xF); reg.inc_li(); assert_eq!{reg.get_li(), 0}; assert_eq!{reg.get_zf(), true}; } #[test] fn dec_underflow_li(){ let mut reg = Registers::default(); reg.dec_li(); assert_eq!{reg.get_li(), 0xF}; assert_eq!{reg.get_zf(), false}; } #[...
code_fim
hard
{ "lang": "rust", "repo": "sreinhardt/tiny_machine", "path": "/src/registers/test.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.i += 1; Some((Vec2(x, y), ch)) } } pub struct MapValuesIter<'a> { map: &'a Map, i: i32, end: i32, } impl<'a> Iterator for MapValuesIter<'a> { type Item = char; #[inline] fn next(&mut self) -> Option<Self::Item> { if self.i == se...
code_fim
hard
{ "lang": "rust", "repo": "JoNil/aoc2020", "path": "/src/map.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JoNil/aoc2020 path: /src/map.rs use crate::Vec2; use std::{fmt, iter::FromIterator, str}; #[derive(Clone, Default, Eq, PartialEq)] pub struct Map { pub width: i32, pub height: i32, data: Vec<u8>, } impl Map { #[inline] pub fn from_input(input: &str) -> Map { ...
code_fim
hard
{ "lang": "rust", "repo": "JoNil/aoc2020", "path": "/src/map.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>} impl TDUserPrivacySettingRule for UserPrivacySettingRuleRestrictChatMembers {} impl UserPrivacySettingRuleRestrictChatMembers { pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) } pub fn builder() -> RTDUserPrivacySettingRuleRestrictChatMembe...
code_fim
hard
{ "lang": "rust", "repo": "fewensa/rtdlib", "path": "/src/types/user_privacy_setting_rule.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fewensa/rtdlib path: /src/types/user_privacy_setting_rule.rs ict_chat_members<F: FnOnce(&UserPrivacySettingRuleRestrictChatMembers)>(&self, fnc: F) -> &Self { if let UserPrivacySettingRule::RestrictChatMembers(t) = self { fnc(t) }; self } pub fn on_restrict_contacts<F: FnOnce(&UserPrivacySetti...
code_fim
hard
{ "lang": "rust", "repo": "fewensa/rtdlib", "path": "/src/types/user_privacy_setting_rule.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl AsRef<UserPrivacySettingRuleRestrictChatMembers> for RTDUserPrivacySettingRuleRestrictChatMembersBuilder { fn as_ref(&self) -> &UserPrivacySettingRuleRestrictChatMembers { &self.inner } } /// A rule to restrict all contacts of a user from doing something #[derive(Debug, Clone, Default, Seria...
code_fim
hard
{ "lang": "rust", "repo": "fewensa/rtdlib", "path": "/src/types/user_privacy_setting_rule.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rabuf/advent-of-code path: /2021/rust/src/bin/day2021_06.rs use aoc::day06; <|fim_suffix|> println!("Hello AoC 2021!"); println!("Day 06 Part 01: {}", day06::part1()); println!("Day 06 Part 02: {}", day06::part2()); }<|fim_middle|>fn main() {
code_fim
easy
{ "lang": "rust", "repo": "rabuf/advent-of-code", "path": "/2021/rust/src/bin/day2021_06.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("Hello AoC 2021!"); println!("Day 06 Part 01: {}", day06::part1()); println!("Day 06 Part 02: {}", day06::part2()); }<|fim_prefix|>// repo: rabuf/advent-of-code path: /2021/rust/src/bin/day2021_06.rs use aoc::day06; <|fim_middle|>fn main() {
code_fim
easy
{ "lang": "rust", "repo": "rabuf/advent-of-code", "path": "/2021/rust/src/bin/day2021_06.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn to_ref_tuple4(l1: &Val) -> (&Val, &Val, &Val, &Val) { let (i1, l2) = take_ref(l1); let (i2, l3) = take_ref(&*l2); let (i3, l4) = take_ref(&*l3); let (i4, _) = take_ref(&*l4); (i1, i2, i3, i4) } pub fn head(l: Val) -> Val { match l { Val::Cons(head, _) => *head, ...
code_fim
hard
{ "lang": "rust", "repo": "mdg/leema", "path": "/src/leema/list.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> { let l = list::cons( Val::Bool(true), list::cons(Val::Bool(false), list::cons(Val::Bool(true), Val::Nil)), ); let not_l = list::map_ref(&l, |v| { if let &Val::Bool(b) = v { Val::Bool(!b) } else { ...
code_fim
hard
{ "lang": "rust", "repo": "mdg/leema", "path": "/src/leema/list.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mdg/leema path: /src/leema/list.rs /// internal List library /// /// TODO: Convert to local list object like: /// enum List /// { /// Cons(Val, Rc<List>), /// Nil, /// } /// Possibly make it generic to use for AstNode as well? /// use crate::leema::val::Val; use std::cmp::Eq; use std::c...
code_fim
hard
{ "lang": "rust", "repo": "mdg/leema", "path": "/src/leema/list.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// parses a single value out of the stream. If there are multiple /// values you can call this multiple times. fn parse(&mut self) -> ProtocolResult<Value> { match try!(self.read_byte()) { b'+' => self.parse_status(), b':' => self.parse_int(), b'$'...
code_fim
hard
{ "lang": "rust", "repo": "oldtree2008/floki", "path": "/src/protocol.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: oldtree2008/floki path: /src/protocol.rs use std::{mem, cmp, str, fmt}; use std::io::Write; use tendril; use queue_backend::Message; pub type ByteTendril = tendril::Tendril<tendril::fmt::Bytes, tendril::Atomic>; pub type StrTendril = tendril::Tendril<tendril::fmt::UTF8, tendril::Atomic>; #[der...
code_fim
hard
{ "lang": "rust", "repo": "oldtree2008/floki", "path": "/src/protocol.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let r = parse(b"*2\r\n$3\r\nfoo\r\n$4\r\nbarz\r\n"); assert!(r.is_ok(), "{:?} not ok", r.unwrap_err()); assert_eq_repr!( r.unwrap(), Value::Array(vec![ Value::Data(b"foo".as_ref().into()), Value::Data(b"barz".as_ref().into()) ...
code_fim
hard
{ "lang": "rust", "repo": "oldtree2008/floki", "path": "/src/protocol.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: japaric/linux-rtfm path: /linux-rt/examples/priorities.rs #![deny(rust_2018_compatibility)] #![deny(rust_2018_idioms)] #![deny(warnings)] #![feature(proc_macro_hygiene)] #![no_main] #![no_std] use core::{mem, ptr}; use cty::c_void; use linux_io::Stdout; use linux_sys::{sigaction, sighandler_t,...
code_fim
hard
{ "lang": "rust", "repo": "japaric/linux-rtfm", "path": "/linux-rt/examples/priorities.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>extern "C" fn p2(sig: i32, si: &mut siginfo_t, _: *mut c_void) { let mut stdout = LineBuffered::<_, consts::U100>::new(Ignore::new(Stdout)); let sp = &mut 0; uwriteln!( &mut stdout, "p2(sig={}, si={}, sp={:?})", sig, si.si_value, sp as *mut i32, ) ...
code_fim
hard
{ "lang": "rust", "repo": "japaric/linux-rtfm", "path": "/linux-rt/examples/priorities.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let input = include_str!("./inputs/function_simple.dan"); assert_json_snapshot!(parse_module(input)); } #[test] fn fixture_control_flow() { let input = include_str!("./inputs/control_flow.dan"); assert_json_snapshot!(parse_module(input)); } #[test] ...
code_fim
hard
{ "lang": "rust", "repo": "aweary/unnamed-web-lang", "path": "/parser/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aweary/unnamed-web-lang path: /parser/src/lib.rs #![warn(clippy::all, clippy::pedantic)] #![allow(clippy::must_use_candidate)] mod parser; pub use crate::parser::*; #[cfg(test)] mod tests { use crate::parser::Parser; use insta::assert_json_snapshot; use syntax::ast; <|fim_suffix|...
code_fim
medium
{ "lang": "rust", "repo": "aweary/unnamed-web-lang", "path": "/parser/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn parse_module(source: &str) -> ast::Module { let mut parser = Parser::new(source); parser.parse_module().unwrap() } #[test] fn fixture_function_simple() { let input = include_str!("./inputs/function_simple.dan"); assert_json_snapshot!(parse_module(input))...
code_fim
medium
{ "lang": "rust", "repo": "aweary/unnamed-web-lang", "path": "/parser/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gutrse3321/rusty-crabs path: /guessing_game/src/main.rs use std::io; //定义随机数生成器应事先的方法 trait use rand::Rng; use std::cmp::Ordering; fn main() { println!("Guess the number!"); //rand::thread_rng函数提供实际使用的随机数生成器,当前执行线程的本地环境中,并冲操作系统获取随机数种子 //获取指定的1和101来获取一个1到100之间的数 let secret_numbe...
code_fim
hard
{ "lang": "rust", "repo": "gutrse3321/rusty-crabs", "path": "/guessing_game/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> io::stdin() .read_line(&mut guess) //处理io::Result执行后可能存在的错误。go中的if err != nil { panic("Failed to read line") } .expect("Failed to read line"); //rust允许用一个新值来隐藏变量之前的值 (shadow) //这个功能常用在需要转换值类型之类的场景,他允许我们复用变量的名字,而不是被迫创建两个不同的变量 //将expect替换成...
code_fim
hard
{ "lang": "rust", "repo": "gutrse3321/rusty-crabs", "path": "/guessing_game/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> i_prot.read_struct_begin()?; let mut f_1: Option<media_s_d_k_data_types::RequestMsg> = None; let mut f_2: Option<bool> = None; loop { let field_ident = i_prot.read_field_begin()?; if field_ident.field_type == TType::Stop { break; } let field_id = field_id(&f...
code_fim
hard
{ "lang": "rust", "repo": "subor/sdk", "path": "/SDK.Gen.Rust/src/media_s_d_k_services.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub struct TMediaServiceProcessFunctions; impl TMediaServiceProcessFunctions { pub fn process_send_msg<H: MediaServiceSyncHandler>(handler: &H, incoming_sequence_number: i32, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> { let args = SendMsgArgs::read_from_in_prot...
code_fim
hard
{ "lang": "rust", "repo": "subor/sdk", "path": "/SDK.Gen.Rust/src/media_s_d_k_services.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: subor/sdk path: /SDK.Gen.Rust/src/media_s_d_k_services.rs // Autogenerated by Thrift Compiler (0.11.0) // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING #![allow(unused_imports)] #![allow(unused_extern_crates)] #![cfg_attr(feature = "cargo-clippy", allow(too_many_arguments, ty...
code_fim
hard
{ "lang": "rust", "repo": "subor/sdk", "path": "/SDK.Gen.Rust/src/media_s_d_k_services.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nordsoyv/rust-mono path: /maze-maker/src/app.rs use eframe::egui::{Color32, Context, Key, Sense, Ui, Vec2}; use eframe::{egui, Frame}; use std::process::Command; use crate::djikstra::Djikstra; use crate::generators::growing_tree::{GrowingTreeGenerator, Strategy}; use crate::generators::Generato...
code_fim
hard
{ "lang": "rust", "repo": "nordsoyv/rust-mono", "path": "/maze-maker/src/app.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let old_difficulty = self.options_window.difficulty; let old_grid = self.options_window.grid_type; self.options_window.draw(ctx, &self.maze); if should_generate_new_maze(&self.options_window, &self.maze, old_difficulty, old_grid) { let mut maze: Box<dyn Grid>; match self.option...
code_fim
hard
{ "lang": "rust", "repo": "nordsoyv/rust-mono", "path": "/maze-maker/src/app.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: robjtede/async-graphql path: /src/error.rs use crate::{Pos, QueryPathNode, Value}; use std::fmt::{Debug, Display}; use thiserror::Error; /// An error in the format of an input value. #[derive(Debug)] pub enum InputValueError { /// Custom input value parsing error. Custom(String), /...
code_fim
hard
{ "lang": "rust", "repo": "robjtede/async-graphql", "path": "/src/error.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Argument name arg_name: &'static str, /// Argument type arg_type: &'static str, }, /// An unknown directive name was encountered. #[error("Unknown directive \"{name}\".")] UnknownDirective { /// Directive name name: String, }, ...
code_fim
hard
{ "lang": "rust", "repo": "robjtede/async-graphql", "path": "/src/error.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ephemeris-rust/ephemeris path: /src/instant.rs use std::i64; use crate::constants::*; use crate::seconds_nanos::*; use crate::util::const_expect; #[cfg(test)] pub mod factories; /// An instantaneous point in time along the timeline. /// /// This is explicitly a TAI instant. /// This means tha...
code_fim
hard
{ "lang": "rust", "repo": "ephemeris-rust/ephemeris", "path": "/src/instant.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> const fn of_epoch_second_and_adjustment_checked( seconds: i64, nano_adjustment: i64, ) -> Option<Instant> { // TODO: switch back to map when constant is stable match of_seconds_and_adjustment_checked(seconds, nano_adjustment) { None => None, ...
code_fim
hard
{ "lang": "rust", "repo": "ephemeris-rust/ephemeris", "path": "/src/instant.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Canop/broot path: /src/verb/builtin.rs use { super::*, crate::{ app::SelectionType, }, crokey::*, }; fn build_internal( internal: Internal, bang: bool, ) -> Verb { let invocation = internal.invocation_pattern(); let execution = VerbExecution::Internal( ...
code_fim
hard
{ "lang": "rust", "repo": "Canop/broot", "path": "/src/verb/builtin.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // those two operations are mapped on ALT-ENTER, one // for directories and the other one for the other files internal(open_leave) // calls the system open .with_stype(SelectionType::File) .with_key(key!(alt-enter)) .with_shortcut("ol"), ...
code_fim
hard
{ "lang": "rust", "repo": "Canop/broot", "path": "/src/verb/builtin.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> MatrixTransformation::new(final_matrix, final_inverse_matrix) } pub fn create_translation_matrix(x: f64, y: f64, z: f64) -> Self { let matrix = [ [ 1.0, 0.0, 0.0, x ], [ 0.0, 1.0, 0.0, y ], [ 0.0, 0.0, 1.0, z ], [ 0.0, 0.0, 0.0, 1.0 ...
code_fim
hard
{ "lang": "rust", "repo": "claytonbrown/TinyRaytracerInRust", "path": "/src/raytracer/transformation.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Ray { point: self.reverse_transform_vector(ray.point), direction: self.reverse_transform_direction_vector(ray.direction), } } } impl MatrixTransformation { pub fn new(matrix: [[f64; 4]; 4], inverse_matrix: [[f64; 4]; 4]) -> Self { MatrixTransformati...
code_fim
hard
{ "lang": "rust", "repo": "claytonbrown/TinyRaytracerInRust", "path": "/src/raytracer/transformation.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: claytonbrown/TinyRaytracerInRust path: /src/raytracer/transformation.rs use super::math::{cos, sin}; use super::vector::{Vector, Ray}; // Just a normal stack, except that it knows how to multiply transformation // matrices. #[derive(Clone)] pub struct TransformationStack { stack: Vec<Matri...
code_fim
hard
{ "lang": "rust", "repo": "claytonbrown/TinyRaytracerInRust", "path": "/src/raytracer/transformation.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: delapuente/qasmsim path: /src/grammar/lexer.rs f BLANK: Regex = Regex::new(r"^[ \t]+").unwrap(); static ref GATE: Regex = Regex::new(r"^(CX|U)\b").unwrap(); static ref OPENQASM: Regex = Regex::new(r"^OPENQASM\b").unwrap(); static ref VERSION: Regex = Regex::ne...
code_fim
hard
{ "lang": "rust", "repo": "delapuente/qasmsim", "path": "/src/grammar/lexer.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: delapuente/qasmsim path: /src/grammar/lexer.rs elf.docstring.is_some() } fn try_pattern(&mut self, re: &Regex) -> Option<String> { match re.captures(&self.input[self.offset..]) { None => None, Some(captured) => { let matching = &captured.g...
code_fim
hard
{ "lang": "rust", "repo": "delapuente/qasmsim", "path": "/src/grammar/lexer.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> loop { let start = self.offset; // TODO: Should I include delayed actions as a general concept? // For instance, to emit more than one token at some point as // it happens when emitting `DocStr` and `Gate`. // #[mode(EmitDelayedToken)] ...
code_fim
hard
{ "lang": "rust", "repo": "delapuente/qasmsim", "path": "/src/grammar/lexer.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>pub struct Synthesizer<'a, E: IEngine> { pub inputs: Option<Vec<BigInt>>, pub output: &'a mut Option<Result<Vec<Option<BigInt>>, Error>>, pub bytecode: zinc_types::Circuit, pub _pd: PhantomData<E>, } impl<E> bellman::Circuit<E> for Synthesizer<'_, E> where E: IEngine, { fn synthe...
code_fim
medium
{ "lang": "rust", "repo": "prz23/zinc", "path": "/zinc-vm/src/core/circuit/synthesizer.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub _pd: PhantomData<E>, } impl<E> bellman::Circuit<E> for Synthesizer<'_, E> where E: IEngine, { fn synthesize<CS: ConstraintSystem<E>>(self, cs: &mut CS) -> Result<(), SynthesisError> { let mut circuit = State::new(DedupCS::new(LoggingCS::new(cs))); *self.output = Some(circu...
code_fim
medium
{ "lang": "rust", "repo": "prz23/zinc", "path": "/zinc-vm/src/core/circuit/synthesizer.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: prz23/zinc path: /zinc-vm/src/core/circuit/synthesizer.rs //! //! The virtual machine circuit synthesizer. //! use std::marker::PhantomData; use num::BigInt; <|fim_suffix|>use crate::constraint_systems::dedup::Dedup as DedupCS; use crate::constraint_systems::logging::Logging as LoggingCS; use...
code_fim
medium
{ "lang": "rust", "repo": "prz23/zinc", "path": "/zinc-vm/src/core/circuit/synthesizer.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>coding : : Component COMPONENT_INSTANCE_SECTION ) = > section ( reader len ComponentInstanceSectionReader : : new ComponentInstanceSection ) ( Encoding : : Component COMPONENT_ALIAS_SECTION ) = > { section ( reader len SectionLimited : : new ComponentAliasSection ) } ( Encoding : : Component COMPONENT_TYP...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified-and-comments-removed", "path": "/third_party/rust/wasmparser/src/parser.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>nt COMPONENT_START_SECTION ) = > { let ( start range ) = single_item ( reader len " component start " ) ? ; Ok ( ComponentStartSection { start range } ) } ( Encoding : : Component COMPONENT_IMPORT_SECTION ) = > section ( reader len ComponentImportSectionReader : : new ComponentImportSection ) ( Encoding :...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified-and-comments-removed", "path": "/third_party/rust/wasmparser/src/parser.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified-and-comments-removed path: /third_party/rust/wasmparser/src/parser.rs ' a > ) MemorySection ( MemorySectionReader < ' a > ) TagSection ( TagSectionReader < ' a > ) GlobalSection ( GlobalSectionReader < ' a > ) ExportSection ( ExportSectionReader < ' a > ) StartSection...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified-and-comments-removed", "path": "/third_party/rust/wasmparser/src/parser.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: storyfeet/gravity path: /src/play_edit/saver.rs use serde_derive::{Deserialize, Serialize}; use crate::ecs::ec_vec::ECVec; use crate::ecs::gen::GenManager; use super::grid::EdgeGrid; use super::rects::{Position, UP}; use super::state::{GravCp, PlayMode, State, Tile}; <|fim_suffix|>pub fn save...
code_fim
hard
{ "lang": "rust", "repo": "storyfeet/gravity", "path": "/src/play_edit/saver.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let cv = gens.compress(); tiles.compress(&cv); positions.compress(&cv); gravs.compress(&cv); s.last_save = Some(LevelSave { gens, tiles, positions, walls, gravs, }); } pub fn restore_level(s: &mut State) { if let Some(sv) = &mut s.last_s...
code_fim
hard
{ "lang": "rust", "repo": "storyfeet/gravity", "path": "/src/play_edit/saver.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jabley/advent-of-code path: /2020/src/bin/04.rs use std::{collections::HashMap, io}; fn main() -> io::Result<()> { let passports = include_str!("04.txt") .trim() .split("\n\n") .map(|p| create_passport_map(p)) .collect::<Vec<HashMap<&str, &str>>>(); let ...
code_fim
hard
{ "lang": "rust", "repo": "jabley/advent-of-code", "path": "/2020/src/bin/04.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(value) = passport.get("hgt") { let len = value.len(); let numeric_part = &value[0..(len - 2)]; match &value[(len - 2)..] { "cm" => { parse_range(numeric_part, 150, 193)?; return Ok(()); } "in" => { ...
code_fim
hard
{ "lang": "rust", "repo": "jabley/advent-of-code", "path": "/2020/src/bin/04.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn init_stats_if_necessary(conn: &Connection) { // if nothing, make them zeroes let amount_of_rows: i32 = conn .query_row("select count(*) from stats", [], |row| Ok(row.get(0)?)) .unwrap(); // get amount of rows // if there are zero rows, then create the row ...
code_fim
hard
{ "lang": "rust", "repo": "JustAnotherStrange/CafeBot", "path": "/src/tools/stats.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JustAnotherStrange/CafeBot path: /src/tools/stats.rs use crate::{ database::database::{gen_connection, get_lost}, money::blackjack::edit_embed, }; use rusqlite::Connection; use serenity::{ framework::standard::{macros::command, CommandResult}, model::prelude::*, prelude::*, }...
code_fim
hard
{ "lang": "rust", "repo": "JustAnotherStrange/CafeBot", "path": "/src/tools/stats.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Clone, Copy)] pub struct Clocks { coreclk: u32, oscextclk: u32, systemclk: u32, busclk: u32, flashclk: u32, } impl Clocks { pub fn coreclk(&self) -> u32 { self.coreclk } pub fn oscextclk(&self) -> u32 { self.oscextclk } pub fn systemclk(&...
code_fim
hard
{ "lang": "rust", "repo": "therealprof/mkw41z-hal", "path": "/src/clock.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: therealprof/mkw41z-hal path: /src/clock.rs extern crate cortex_m; use mkw41z::{MCG, RSIM, SIM}; pub fn clocks() -> Clocks { // Turn on clocks for the XCVR // Enable RF OSC in RSIM and wait for ready let rsim = unsafe { &(*RSIM::ptr()) }; rsim.control.modify(|_, ...
code_fim
hard
{ "lang": "rust", "repo": "therealprof/mkw41z-hal", "path": "/src/clock.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> // Wait for FLL stable time for _ in 0..30_000 { cortex_m::asm::nop(); } // Do we need to update FCRDIV? if mcg.sc.read().fcrdiv().bits() != 0 { /* If fast IRC is in use currently, change to slow IRC. */ let mcgs = mcg.s.read(); ...
code_fim
hard
{ "lang": "rust", "repo": "therealprof/mkw41z-hal", "path": "/src/clock.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> { Some(Box::new(x)) } } } test! { fn fun() -> Option<Box<i32>>; } fn main() { println!("{}", fun(0).unwrap()); }<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/macros/issue-25274.rs // run-pass macro_rules! test { ( fn fun() -> Option<Box<$t:ty...
code_fim
easy
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/macros/issue-25274.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/macros/issue-25274.rs // run-pass macro_rules! test { ( fn fun() -> Option<Box<$t:ty>>; ) => { fn fun(x: $t) -> Option<Box<$t>> <|fim_suffix|>fn main() { println!("{}", fun(0).unwrap()); }<|fim_middle|> { Some...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/macros/issue-25274.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn it_works() { assert_eq!(2 + 2, 4); } #[test] fn plus_one() { assert_eq!(add_one(5), 6); } }<|fim_prefix|>// repo: RedL0tus/rust-learn path: /chapter-14/14.2-publishing_a_crate_to_crates_io/src/lib.rs //! # Yet Another Example Crate //! //! `publishing_a...
code_fim
medium
{ "lang": "rust", "repo": "RedL0tus/rust-learn", "path": "/chapter-14/14.2-publishing_a_crate_to_crates_io/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: RedL0tus/rust-learn path: /chapter-14/14.2-publishing_a_crate_to_crates_io/src/lib.rs //! # Yet Another Example Crate //! //! `publishing_a_crate_to_crates_io` is a example crate from Rust book 2nd edition //! Here is a example of commenting contained items. <|fim_suffix|> assert_eq!(2...
code_fim
hard
{ "lang": "rust", "repo": "RedL0tus/rust-learn", "path": "/chapter-14/14.2-publishing_a_crate_to_crates_io/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> while !self.finished() { self.step()?; } Ok(()) } }<|fim_prefix|>// repo: jturner314/ndarray-solve-ivp path: /src/lib.rs pub mod rk; use ndarray::prelude::*; use std::error::Error; pub trait OdeIntegrate { /// Returns the number of elements in the state. ...
code_fim
hard
{ "lang": "rust", "repo": "jturner314/ndarray-solve-ivp", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jturner314/ndarray-solve-ivp path: /src/lib.rs pub mod rk; use ndarray::prelude::*; use std::error::Error; pub trait OdeIntegrate { /// Returns the number of elements in the state. fn len(&self) -> usize; /// Perform one step (adaptive step size). fn step(&mut self) -> Result<(...
code_fim
hard
{ "lang": "rust", "repo": "jturner314/ndarray-solve-ivp", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.time() == self.time_bound() } /// Integrate until reaching `time_bound`. fn run_to_bound(&mut self) -> Result<(), Box<dyn Error>> { while !self.finished() { self.step()?; } Ok(()) } }<|fim_prefix|>// repo: jturner314/ndarray-solve-ivp path:...
code_fim
hard
{ "lang": "rust", "repo": "jturner314/ndarray-solve-ivp", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let (send, recv) = mpsc::channel(); let show_file = matches.value_of("show").unwrap_or("show.toml"); let effect_pool = EffectPool::new_from_config(show_file); let cue_list = CueList::new_from_config(show_file); let installation = Installation::new_from_config(&effect_pool.installation...
code_fim
hard
{ "lang": "rust", "repo": "superlou/lightboard-rs", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("Started"); let (send, recv) = mpsc::channel(); let show_file = matches.value_of("show").unwrap_or("show.toml"); let effect_pool = EffectPool::new_from_config(show_file); let cue_list = CueList::new_from_config(show_file); let installation = Installation::new_from_config...
code_fim
hard
{ "lang": "rust", "repo": "superlou/lightboard-rs", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: superlou/lightboard-rs path: /src/main.rs #[macro_use(lazy_static)] extern crate lazy_static; mod dmx_control; mod gui; mod imgui_wrapper; mod installation; mod fixture; mod effect; mod cue; mod hitbox; mod pattern; mod light; mod installation_loader; mod show_loader; mod ggez_util; mod command...
code_fim
hard
{ "lang": "rust", "repo": "superlou/lightboard-rs", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /third_party/rust_crates/vendor/test-case-1.1.0/src/expected/ignore_case.rs use crate::expected::Case; use crate::utils::fmt_syn; use std::fmt; use syn::parse_quote; use syn::{Attribute, Expr}; #[cfg_attr(test, derive(Debug, PartialEq))] pub struct IgnoreCase { value:...
code_fim
medium
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/third_party/rust_crates/vendor/test-case-1.1.0/src/expected/ignore_case.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Some(parse_quote! { #[ignore] }) } } impl IgnoreCase { pub fn new(value: Box<Expr>) -> Self { Self { value } } }<|fim_prefix|>// repo: gnoliyil/fuchsia path: /third_party/rust_crates/vendor/test-case-1.1.0/src/expected/ignore_case.rs use crate::expected::Case; use crate::util...
code_fim
medium
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/third_party/rust_crates/vendor/test-case-1.1.0/src/expected/ignore_case.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>impl IgnoreCase { pub fn new(value: Box<Expr>) -> Self { Self { value } } }<|fim_prefix|>// repo: gnoliyil/fuchsia path: /third_party/rust_crates/vendor/test-case-1.1.0/src/expected/ignore_case.rs use crate::expected::Case; use crate::utils::fmt_syn; use std::fmt; use syn::parse_quote; us...
code_fim
medium
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/third_party/rust_crates/vendor/test-case-1.1.0/src/expected/ignore_case.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>impl SharedFilelistHandler { pub fn new(database: Arc<ShareDatabase>) -> SharedFilelistHandler { SharedFilelistHandler { database: database } } } impl Handler for SharedFilelistHandler { fn handle(&self, request: &mut Request) -> IronResult<Response> { let ...
code_fim
hard
{ "lang": "rust", "repo": "mcclellanmj/fileshare", "path": "/src/handlers/filelist.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mcclellanmj/fileshare path: /src/handlers/filelist.rs use std::sync::Arc; use iron; use iron::{Request, Response, IronResult}; use iron::middleware::Handler; use iron::headers::ContentType; use iron::status; use iron::modifiers::Header; use std::path::{Path, PathBuf}; use std::fs; use std::fs:...
code_fim
hard
{ "lang": "rust", "repo": "mcclellanmj/fileshare", "path": "/src/handlers/filelist.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if folder_to_view.is_dir() { let json = json_folder_listing(&folder_to_view); let headers = Header(ContentType::json()); Ok(Response::with((status::Ok, json, headers))) } else { Ok(Response::with((status::BadRequest, "Requested path is not a ...
code_fim
hard
{ "lang": "rust", "repo": "mcclellanmj/fileshare", "path": "/src/handlers/filelist.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SkamDart/advent-of-code-2020 path: /src/day2.rs use std::fs::File; use std::io::{self, BufRead}; use std::path::Path; fn main() { println!("{:?}", part1()); println!("{:?}", part2()); } fn part1() -> io::Result<u32> { let lines = read_lines("day2.txt")?; Ok(lines.into_iter().ma...
code_fim
hard
{ "lang": "rust", "repo": "SkamDart/advent-of-code-2020", "path": "/src/day2.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn is_valid_password(line: String) -> bool { match line.split(" ").collect::<Vec<&str>>().as_slice() { [range, ch, password] => { let ch = ch.chars().nth(0).unwrap(); let frequency = password.matches(ch).into_iter().count() as u32; match range.split("-").col...
code_fim
hard
{ "lang": "rust", "repo": "SkamDart/advent-of-code-2020", "path": "/src/day2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match line.split(" ").collect::<Vec<&str>>().as_slice() { [range, ch, password] => { let ch = ch.chars().nth(0).unwrap(); match range.split("-").collect::<Vec<&str>>().as_slice() { [min, max] => { let min_idx = min.parse::<usize>().un...
code_fim
hard
{ "lang": "rust", "repo": "SkamDart/advent-of-code-2020", "path": "/src/day2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[repr(C, packed(4))] struct P4C<T, S> { a: T, b: u8, c: S } macro_rules! check { ($t:ty, $align:expr, $size:expr) => ({ assert_eq!(mem::align_of::<$t>(), $align); assert_eq!(mem::size_of::<$t>(), $size); }); } pub fn main() { check!(P1::<u8, u8>, 1, 3); check...
code_fim
medium
{ "lang": "rust", "repo": "moshg/rust-std-ja", "path": "/src/test/run-pass/packed-struct-generic-size.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: moshg/rust-std-ja path: /src/test/run-pass/packed-struct-generic-size.rs // Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENS...
code_fim
hard
{ "lang": "rust", "repo": "moshg/rust-std-ja", "path": "/src/test/run-pass/packed-struct-generic-size.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn main() { check!(P1::<u8, u8>, 1, 3); check!(P1::<u64, u16>, 1, 11); check!(P2::<u8, u8>, 1, 3); check!(P2::<u64, u16>, 2, 12); check!(P4C::<u8, u8>, 1, 3); check!(P4C::<u16, u64>, 4, 12); }<|fim_prefix|>// repo: moshg/rust-std-ja path: /src/test/run-pass/packed-struct-gen...
code_fim
hard
{ "lang": "rust", "repo": "moshg/rust-std-ja", "path": "/src/test/run-pass/packed-struct-generic-size.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Tim-Zhang/rust-protobuf path: /protobuf/src/ext.rs //! Utilities to support "extension" fields. //! //! This is a stopgap implementation, it only allows to fetch basic singular values, //! and that's it. Anything similar to extension registry is not implemented yet. //! //! Extensions are [descr...
code_fim
hard
{ "lang": "rust", "repo": "Tim-Zhang/rust-protobuf", "path": "/protobuf/src/ext.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Repeated ext field /// /// This is initialized from generated code, do not instantiate directly. pub struct ExtFieldRepeated<M, V> { /// Extension field number #[allow(dead_code)] field_number: u32, /// Field type. #[allow(dead_code)] field_type: Type, /// Extension field n...
code_fim
hard
{ "lang": "rust", "repo": "Tim-Zhang/rust-protobuf", "path": "/protobuf/src/ext.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<M, V> ExtFieldRepeated<M, V> { /// Constructor. Called from generated code. pub const fn new(field_number: u32, field_type: Type) -> Self { ExtFieldRepeated { field_number, field_type, phantom: PhantomData, } } } impl<M: Message, V: Pro...
code_fim
hard
{ "lang": "rust", "repo": "Tim-Zhang/rust-protobuf", "path": "/protobuf/src/ext.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ZoeyR/wearte path: /wearte_derive/src/generator/visits.rs leading_vert, pats, guard, fat_arrow_token, body, comma, }: &'a syn::Arm, ) { visit_attrs!(self, attrs); if let Some(_) = leading_vert { ...
code_fim
hard
{ "lang": "rust", "repo": "ZoeyR/wearte", "path": "/wearte_derive/src/generator/visits.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> panic!("Not available in place in a template expression"); } fn visit_expr_index( &mut self, syn::ExprIndex { attrs, expr, index, .. }: &'a syn::ExprIndex, ) { visit_attrs!(self, attrs); self.visit_expr(expr); self.buf_t.writ...
code_fim
hard
{ "lang": "rust", "repo": "ZoeyR/wearte", "path": "/wearte_derive/src/generator/visits.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ZoeyR/wearte path: /wearte_derive/src/generator/visits.rs left, eq_token, right, }: &'a syn::ExprAssign, ) { visit_attrs!(self, attrs); self.buf_t.write(&quote!(#left #eq_token)); self.visit_expr(right); } fn visit_expr...
code_fim
hard
{ "lang": "rust", "repo": "ZoeyR/wearte", "path": "/wearte_derive/src/generator/visits.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn write_index(config: &Config, index: Index) -> usize { index.write(config) } #[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } }<|fim_prefix|>// repo: zmilan/stork path: /src/lib.rs pub mod config; pub mod index_analyzer; mod index_versions; pub mod s...
code_fim
hard
{ "lang": "rust", "repo": "zmilan/stork", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zmilan/stork path: /src/lib.rs pub mod config; pub mod index_analyzer; mod index_versions; pub mod searcher; use config::*; use std::collections::HashMap; use wasm_bindgen::prelude::*; <|fim_suffix|>pub fn build(config: &Config) -> Index { builder::build(config) } pub fn write_index(confi...
code_fim
hard
{ "lang": "rust", "repo": "zmilan/stork", "path": "/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(feature = "derive")] pub use rustacuda_derive::DeviceCopy;<|fim_prefix|>// repo: fossabot/necsim-rust path: /third-party/RustaCUDA/rustacuda_core/src/lib.rs //! RustaCUDA-core is a minimal subset of RustaCUDA which is intended to be used //! in device-side crates. //! //! It includes a small number...
code_fim
hard
{ "lang": "rust", "repo": "fossabot/necsim-rust", "path": "/third-party/RustaCUDA/rustacuda_core/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fossabot/necsim-rust path: /third-party/RustaCUDA/rustacuda_core/src/lib.rs //! RustaCUDA-core is a minimal subset of RustaCUDA which is intended to be used //! in device-side crates. //! //! It includes a small number of types needed when sharing types between the //! host and device. This is n...
code_fim
medium
{ "lang": "rust", "repo": "fossabot/necsim-rust", "path": "/third-party/RustaCUDA/rustacuda_core/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if pos.is_none() { return false } let row = pos.unwrap()[0]; let col = pos.unwrap()[1]; if !can_go(closed, pos.unwrap(), rows, cols) { return false } let point = Point { position: [row, col], g: weight_map[row as usize][col as usize], ...
code_fim
hard
{ "lang": "rust", "repo": "Awk34/euler-rust", "path": "/src/problems/problem_083.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Awk34/euler-rust path: /src/problems/problem_083.rs const MATRIX: [[u32; 5]; 5] = [ [131, 673, 234, 103, 18], [201, 96, 342, 965, 150], [630, 803, 746, 422, 111], [537, 699, 497, 121, 956], [805, 732, 524, 37, 331]]; // const SOLUTION_5X5_MAP: [[u32; 5]; 5] = [ // [ 1 , 0 , 1 , 1 , 1 ], // [ 1 ...
code_fim
hard
{ "lang": "rust", "repo": "Awk34/euler-rust", "path": "/src/problems/problem_083.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let x = u8::symbolic("x"); crucible_assert!(x + 1 > x); } #[crux::test] fn fail2() { let x = u8::symbolic("x"); if x == 0 { panic!("one") } } fn assert_zero(x: u8) { crucible_assert!(x == 0); } #[crux::test] fn fail3() { let x = u8::symbolic("x"); assert_zero(x);...
code_fim
easy
{ "lang": "rust", "repo": "GaloisInc/crucible", "path": "/crux-mir/test/symb_eval/crux/multi.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>#[crux::test] fn fail3() { let x = u8::symbolic("x"); assert_zero(x); }<|fim_prefix|>// repo: GaloisInc/crucible path: /crux-mir/test/symb_eval/crux/multi.rs extern crate crucible; use crucible::*; #[crux::test] fn fail1() { let x = u8::symbolic("x"); crucible_assert!(x + 1 > x); } #[c...
code_fim
easy
{ "lang": "rust", "repo": "GaloisInc/crucible", "path": "/crux-mir/test/symb_eval/crux/multi.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: GaloisInc/crucible path: /crux-mir/test/symb_eval/crux/multi.rs extern crate crucible; use crucible::*; #[crux::test] fn fail1() { let x = u8::symbolic("x"); crucible_assert!(x + 1 > x); } <|fim_suffix|>#[crux::test] fn fail3() { let x = u8::symbolic("x"); assert_zero(x); }<|f...
code_fim
medium
{ "lang": "rust", "repo": "GaloisInc/crucible", "path": "/crux-mir/test/symb_eval/crux/multi.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: herumi/mcl-rust path: /build.rs use std::process::Command; fn main() { let opt = if cfg!(target_arch = "x86_64") { "" } else { <|fim_suffix|>l -DMCL_STATIC_LIB=ON -DMCL_STANDALONE=ON {} && make -j", opt ); Command::new("sh") .args(["-c", &cmd]) ...
code_fim
medium
{ "lang": "rust", "repo": "herumi/mcl-rust", "path": "/build.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>-c", &cmd]) .output() .expect("fail"); println!("cargo:rustc-link-search=native=./build/lib"); }<|fim_prefix|>// repo: herumi/mcl-rust path: /build.rs use std::process::Command; fn main() { let opt = if cfg!(target_arch = "x86_64") { "" } else { "-DCMAKE_CXX_C...
code_fim
medium
{ "lang": "rust", "repo": "herumi/mcl-rust", "path": "/build.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>l -DMCL_STATIC_LIB=ON -DMCL_STANDALONE=ON {} && make -j", opt ); Command::new("sh") .args(["-c", &cmd]) .output() .expect("fail"); println!("cargo:rustc-link-search=native=./build/lib"); }<|fim_prefix|>// repo: herumi/mcl-rust path: /build.rs use std::process::...
code_fim
medium
{ "lang": "rust", "repo": "herumi/mcl-rust", "path": "/build.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> //overflow if overflow_flag { m = add_mod_n(RHO_N, m); } if m >= MODULO_N { m - MODULO_N } else { m } } pub fn sub_mod_n(x: U64x4, y: U64x4) -> U64x4 { add_mod_n(x, get_add_inv_mod_n(y)) } pub fn mul_mod_n(x: U64x4, y: U64x4) -> U64x4 { let x_bar ...
code_fim
hard
{ "lang": "rust", "repo": "volcano0dr/yogcrypt", "path": "/src/basic/field/field_n.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: volcano0dr/yogcrypt path: /src/basic/field/field_n.rs //! Field operations on the field of order `MODULO_N` //! //! The underlying struct is `U64x4`. use basic::cell::u64x4::*; pub const MODULO_N: U64x4 = U64x4 { value: [ 0x53BBF40939D54123, 0x7203DF6B21C6052B, 0xFFF...
code_fim
hard
{ "lang": "rust", "repo": "volcano0dr/yogcrypt", "path": "/src/basic/field/field_n.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<F: Fn() -> ()> Drop for Delay<F> { fn drop(&mut self) { (self.f)(); } }<|fim_prefix|>// repo: tatetian/ngo2 path: /src/libos/src/util/delay.rs /// Delay the execution of a closure until this wrapper object goes out of /// the scope. /// /// Delay is mainly used to trigger some kinds ...
code_fim
medium
{ "lang": "rust", "repo": "tatetian/ngo2", "path": "/src/libos/src/util/delay.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tatetian/ngo2 path: /src/libos/src/util/delay.rs /// Delay the execution of a closure until this wrapper object goes out of /// the scope. /// /// Delay is mainly used to trigger some kinds of clean-up logic automatically. pub struct Delay<F: Fn() -> ()> { f: F, } <|fim_suffix|>impl<F: Fn()...
code_fim
medium
{ "lang": "rust", "repo": "tatetian/ngo2", "path": "/src/libos/src/util/delay.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>pub mod prelude { pub use isahc::prelude::*; }<|fim_prefix|>// repo: nicholastmosher/k8-api path: /src/k8-client/src/native/mod.rs mod client; mod config; mod stream; mod wstream; <|fim_middle|>pub use client::K8Client; pub mod http { pub use isahc::http::*; }
code_fim
medium
{ "lang": "rust", "repo": "nicholastmosher/k8-api", "path": "/src/k8-client/src/native/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }