text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: mrnugget/dora path: /dora-parser/src/ast/visit.rs use crate::ast::*; use crate::ast::Expr::*; use crate::ast::Stmt::*; use crate::ast::Type::*; pub trait Visitor<'v>: Sized { fn visit_ast(&mut self, a: &'v Ast) { walk_ast(self, a); } fn visit_file(&mut self, a: &'v File) {...
code_fim
hard
{ "lang": "rust", "repo": "mrnugget/dora", "path": "/dora-parser/src/ast/visit.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> StmtFor(ref value) => { v.visit_expr(&value.expr); v.visit_stmt(&value.block); } StmtWhile(ref value) => { v.visit_expr(&value.cond); v.visit_stmt(&value.block); } StmtExpr(ref value) => { v.visit_expr(&v...
code_fim
hard
{ "lang": "rust", "repo": "mrnugget/dora", "path": "/dora-parser/src/ast/visit.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> StmtExpr(ref value) => { v.visit_expr(&value.expr); } StmtReturn(ref value) => { if let Some(ref e) = value.expr { v.visit_expr(e); } } StmtBreak(_) => {} StmtContinue(_) => {} } } pub fn walk_expr<'...
code_fim
hard
{ "lang": "rust", "repo": "mrnugget/dora", "path": "/dora-parser/src/ast/visit.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> macro_rules! bool3ary_150 { ($a:expr, $b:expr, $c:expr) => ($a ^ $b ^ $c) } // Parity, XOR, MD5H, SHA1P e = e.wrapping_add(a.rotate_left(5)) .wrapping_add(bool3ary_150!(b, c, d)) .wrapping_add(t); b = b.rotate_left(30); d = d.wrapping_add(e.rotate_left(5)) ...
code_fim
hard
{ "lang": "rust", "repo": "mesalock-linux/crates-sgx", "path": "/vendor/sha-1/src/utils.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> c = c.wrapping_add(d.rotate_left(5)) .wrapping_add(bool3ary_232!(e, a, b)) .wrapping_add(v); e = e.rotate_left(30); b = b.wrapping_add(c.rotate_left(5)) .wrapping_add(bool3ary_232!(d, e, a)) .wrapping_add(w); d = d.rotate_left(30); u32x4(b, c, d, e) } ...
code_fim
hard
{ "lang": "rust", "repo": "mesalock-linux/crates-sgx", "path": "/vendor/sha-1/src/utils.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mesalock-linux/crates-sgx path: /vendor/sha-1/src/utils.rs #![cfg_attr(feature = "cargo-clippy", allow(many_single_char_names))] use consts::{BLOCK_LEN, K0, K1, K2, K3}; use block_buffer::byteorder::{BE, ByteOrder}; use simd::u32x4; use digest::generic_array::GenericArray; use digest::generic_a...
code_fim
hard
{ "lang": "rust", "repo": "mesalock-linux/crates-sgx", "path": "/vendor/sha-1/src/utils.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wess/toffee path: /src/event.rs use sdl2; use terminal::Terminal; <|fim_suffix|>impl Events { pub fn new(terminal: &Terminal) -> Self { let event_pump = terminal.sdl_context.event_pump().unwrap(); Events { event_pump } } }<|fim_middle|>pub struct Events { pub event_...
code_fim
medium
{ "lang": "rust", "repo": "wess/toffee", "path": "/src/event.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Events { pub fn new(terminal: &Terminal) -> Self { let event_pump = terminal.sdl_context.event_pump().unwrap(); Events { event_pump } } }<|fim_prefix|>// repo: wess/toffee path: /src/event.rs use sdl2; use terminal::Terminal; <|fim_middle|>pub struct Events { pub event_...
code_fim
medium
{ "lang": "rust", "repo": "wess/toffee", "path": "/src/event.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match self.peek() { '\n' => self.line += 1, '"' if last == '\\' => { self.lexeme.pop(); } '"' => break, '\0' => return self.err("unterminated string"), _ => return self.err("unex...
code_fim
hard
{ "lang": "rust", "repo": "xdk78/rose", "path": "/src/scanner.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xdk78/rose path: /src/scanner.rs use result::{Error, Result}; use std::collections::{HashSet, VecDeque}; use std::ops::Index; use std::str::Chars; use token::reserved; use token::Literal; use token::{Token, TokenType}; pub struct Scanner<'a> { src: Chars<'a>, peeks: VecDeque<char>, ...
code_fim
hard
{ "lang": "rust", "repo": "xdk78/rose", "path": "/src/scanner.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: slicebuild/sb path: /impl/rust/src/lib.rs extern crate curl; extern crate rustc_serialize; extern crate semver; extern crate zip; pub use commands::{Command, FetchCommand, FindCommand, MakeCommand}; macro_rules! assert_not_empty { ($e:expr) => (assert!(!$e.is_empty(), "{} is empty", string...
code_fim
medium
{ "lang": "rust", "repo": "slicebuild/sb", "path": "/impl/rust/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub mod commands; pub mod options_parse; pub mod os; pub mod version; mod helper; mod slice; mod formatters; #[derive(Clone)] #[derive(Copy)] pub enum VersionMatchStrategy { Exact, ExactOrLesser, ExactOrGreater, } pub struct RequestedSlice { pub name: String, pub version: Version, pub versi...
code_fim
medium
{ "lang": "rust", "repo": "slicebuild/sb", "path": "/impl/rust/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// Variables const WORDLIST: [&'static str; 1259] = [ "Africa", "Alabama", "Alaska", "America", "Amsterdam", "April", "Arizona", "Asia", "Athens", "August", "Australia", "Austria", "Barbados", "Belfast", "Belgium", "Berlin", "Botswana", ...
code_fim
hard
{ "lang": "rust", "repo": "qtfkwk/xpg", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: qtfkwk/xpg path: /src/lib.rs } #[test] fn xpg_macro_can_return_five_words() { let re = Regex::new(r"^([A-Z][a-z]+){5}$").unwrap(); let result = xpg!(5); assert!(re.is_match(&result)); } #[test] #[should_panic] fn xpg_macro_cannot_return_zero_wo...
code_fim
hard
{ "lang": "rust", "repo": "qtfkwk/xpg", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: qtfkwk/xpg path: /src/lib.rs "Destroy", "Details", "Determine", "Developed", "Device", "Dictionary", "Died", "Difference", "Different", "Difficult", "Dinner", "Direct", "Direction", "Discover", "Discovered", "Dish", "Distance", ...
code_fim
hard
{ "lang": "rust", "repo": "qtfkwk/xpg", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mslynch/adventofcode2016 path: /src/day01.rs use std::cmp::Ordering; use std::collections::HashSet; use std::fs::File; use std::io::prelude::*; use std::iter; use crate::solution::Solution; /// Runs the problems for day 1. pub fn run(file: &mut File) -> Solution { let mut contents = String...
code_fim
hard
{ "lang": "rust", "repo": "mslynch/adventofcode2016", "path": "/src/day01.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; #[test] fn position_range_x_increasing() { let start = Position { x: 0, y: 0 }; let end = Position { x: 3, y: 0 }; let expected = vec![ Position { x: 1, y: 0 }, Position { x: 2, y: 0 }, Position...
code_fim
hard
{ "lang": "rust", "repo": "mslynch/adventofcode2016", "path": "/src/day01.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: swc-project/swc path: /crates/swc_plugin_runner/benches/ecma_invoke.rs #![cfg_attr(not(feature = "__rkyv"), allow(warnings))] extern crate swc_node_base; use std::{ env, path::{Path, PathBuf}, process::Command, sync::Arc, }; use criterion::{black_box, criterion_group, criterio...
code_fim
hard
{ "lang": "rust", "repo": "swc-project/swc", "path": "/crates/swc_plugin_runner/benches/ecma_invoke.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> let store = wasmer::Store::default(); let module = wasmer::Module::new(&store, raw_module_bytes).unwrap(); let plugin_module = swc_plugin_runner::plugin_module_bytes::CompiledPluginModuleBytes::new( path.as_os_str() .to_str() .expect("Should able to get path") ...
code_fim
hard
{ "lang": "rust", "repo": "swc-project/swc", "path": "/crates/swc_plugin_runner/benches/ecma_invoke.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> let program = VersionedSerializable::new(program); let program_ser = PluginSerializedBytes::try_serialize(&program).unwrap(); let mut transform_plugin_executor = swc_plugin_runner::create_plugin_transform_executor( &cm, &Mark::new(), ...
code_fim
hard
{ "lang": "rust", "repo": "swc-project/swc", "path": "/crates/swc_plugin_runner/benches/ecma_invoke.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Default)] struct Arguments { /// The module under which the kind and its inhabitants live/are scoped. scope: Option<Option<proc_macro::Ident>>, } impl Arguments { // we should probably use the syn::parse::Parse API fn parse(tokens: TokenStream) -> Result<Self, proc_macro::Span> {...
code_fim
hard
{ "lang": "rust", "repo": "fmease/tylift", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fmease/tylift path: /src/lib.rs #![warn(rust_2018_idioms, unused_must_use)] // never `forbid` for forward compatibility! //! This is a libary for making type-level programming more ergonomic. //! With the attribute `tylift`, one can lift variants of an `enum` to the type-level. //! //! ## `carg...
code_fim
hard
{ "lang": "rust", "repo": "fmease/tylift", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Arguments { // we should probably use the syn::parse::Parse API fn parse(tokens: TokenStream) -> Result<Self, proc_macro::Span> { let mut tokens = tokens.into_iter(); let mut arguments = Self::default(); if let Some(token) = tokens.next() { use proc_macro:...
code_fim
hard
{ "lang": "rust", "repo": "fmease/tylift", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ZerothLaw/mscoree-rs path: /mscoree_sys/examples/integration.rs use std::ptr; extern crate mscoree_sys_2; #[macro_use] extern crate winapi; use winapi::ctypes::c_void; use mscoree_sys_2::metahost::{CLRCreateInstance, CLSID_CLRMetaHost, ICLRMetaHost}; DEFINE_GUID!{IID_ICLRMETAHOST, 0xD332D...
code_fim
medium
{ "lang": "rust", "repo": "ZerothLaw/mscoree-rs", "path": "/mscoree_sys/examples/integration.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>use mscoree_sys_2::metahost::{CLRCreateInstance, CLSID_CLRMetaHost, ICLRMetaHost}; DEFINE_GUID!{IID_ICLRMETAHOST, 0xD332DB9E, 0xB9B3, 0x4125, 0x82, 0x07, 0xA1, 0x48, 0x84, 0xF5, 0x32, 0x16} fn main() { println!("A"); let mut ppv: *mut ICLRMetaHost = ptr::null_mut(); println!("B"); let ...
code_fim
medium
{ "lang": "rust", "repo": "ZerothLaw/mscoree-rs", "path": "/mscoree_sys/examples/integration.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub edit_todo_title : String, pub edit_todo_description : String, pub edit_todo_id : Option<String>, pub submit_button_label : String }<|fim_prefix|>// repo: nishiurahiroki/hello_rust_rocket path: /src/template_contents/add.rs use serde_derive::Serialize; #[derive(Serialize)] pub str...
code_fim
medium
{ "lang": "rust", "repo": "nishiurahiroki/hello_rust_rocket", "path": "/src/template_contents/add.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nishiurahiroki/hello_rust_rocket path: /src/template_contents/add.rs use serde_derive::Serialize; #[derive(Serialize)] pub struct TemplateCon<|fim_suffix|> pub edit_todo_title : String, pub edit_todo_description : String, pub edit_todo_id : Option<String>, pub submit_button_la...
code_fim
medium
{ "lang": "rust", "repo": "nishiurahiroki/hello_rust_rocket", "path": "/src/template_contents/add.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub edit_todo_id : Option<String>, pub submit_button_label : String }<|fim_prefix|>// repo: nishiurahiroki/hello_rust_rocket path: /src/template_contents/add.rs use serde_derive::Serialize; #[derive(Serialize)] pub struct TemplateCon<|fim_middle|>tent { pub page_title : String, pub r...
code_fim
medium
{ "lang": "rust", "repo": "nishiurahiroki/hello_rust_rocket", "path": "/src/template_contents/add.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> vial::run!(index, wiki, blog).unwrap(); }<|fim_prefix|>// repo: MoAlyousef/vial path: /examples/modules.rs use vial; mod mods; use mods::{blog, wiki}; mod index { vial::routes! { GET "/" => |_| "<h1>This is the index.</h1>"; } } <|fim_middle|>fn main() {
code_fim
easy
{ "lang": "rust", "repo": "MoAlyousef/vial", "path": "/examples/modules.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MoAlyousef/vial path: /examples/modules.rs use vial; mod mods; use mods::{blog, wiki}; mod index { vial::routes! { GET "/" => |_| "<h1>This is the index.</h1>"; } } <|fim_suffix|> vial::run!(index, wiki, blog).unwrap(); }<|fim_middle|>fn main() {
code_fim
easy
{ "lang": "rust", "repo": "MoAlyousef/vial", "path": "/examples/modules.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MoAlyousef/vial path: /examples/modules.rs use vial; mod mods; use mods::{blog, wiki}; <|fim_suffix|> vial::run!(index, wiki, blog).unwrap(); }<|fim_middle|>mod index { vial::routes! { GET "/" => |_| "<h1>This is the index.</h1>"; } } fn main() {
code_fim
medium
{ "lang": "rust", "repo": "MoAlyousef/vial", "path": "/examples/modules.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn borrow04() { let mut s = String::from("hello"); let r1 = &s; // no problem let r2 = &s; // no problem let r3 = &mut s; // BIG PROBLEM //println!("r1={}, r2={}, r3={}",r1, r2,r3); // mutable, immutable at the same time } fn dangle() -> &String { let s = String::from("hello"); ...
code_fim
hard
{ "lang": "rust", "repo": "pieceofr/rust_bigin_excercise", "path": "/ch4_8/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pieceofr/rust_bigin_excercise path: /ch4_8/src/main.rs fn main() { println!("Hello, world!"); //borrow01(); //borrow02(); //borrow03(); //borrow04(); let reference_to_nothing = dangle(); } /* fn borrow01() { <|fim_suffix|> let y: &i32; let x = 5; y = &x; pr...
code_fim
medium
{ "lang": "rust", "repo": "pieceofr/rust_bigin_excercise", "path": "/ch4_8/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut s = String::from("hello"); let r1 = &s; // no problem let r2 = &s; // no problem let r3 = &mut s; // BIG PROBLEM //println!("r1={}, r2={}, r3={}",r1, r2,r3); // mutable, immutable at the same time } fn dangle() -> &String { let s = String::from("hello"); &s }<|fim_pr...
code_fim
hard
{ "lang": "rust", "repo": "pieceofr/rust_bigin_excercise", "path": "/ch4_8/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: simonbuchan/lnk-rs path: /src/linktarget.rs #[allow(unused)] use log::{trace, debug, info, warn, error}; use byteorder::{ByteOrder, LE}; /// The LinkTargetIDList structure specifies the target of the link. The presence of this optional /// structure is specified by the HasLinkTargetIDList bit (...
code_fim
hard
{ "lang": "rust", "repo": "simonbuchan/lnk-rs", "path": "/src/linktarget.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Self { size: 0, data: String::new(), } } } impl From<&[u8]> for ItemID { fn from(data: &[u8]) -> Self { let mut id = Self::default(); id.size = LE::read_u16(data); id.data = String::from_utf8_lossy(&data[2..(id.size as usize)]).trim...
code_fim
hard
{ "lang": "rust", "repo": "simonbuchan/lnk-rs", "path": "/src/linktarget.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vitali2y/rust-u2f path: /linux/uhid-tokio/src/transport.rs use std::fmt; use std::io; use std::io::Write; use bytes::buf::FromBuf; use bytes::BytesMut; use futures::{Async, Poll, Stream}; use slog; use tokio_io::AsyncRead; /// Decoding of items in buffers. /// /// An implementation of `Decoder...
code_fim
hard
{ "lang": "rust", "repo": "vitali2y/rust-u2f", "path": "/linux/uhid-tokio/src/transport.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl<T: Write, E, D> Write for Transport<T, E, D> { fn write(&mut self, src: &[u8]) -> io::Result<usize> { self.inner.write(src) } fn flush(&mut self) -> io::Result<()> { self.inner.flush() } } impl<T, E, D> Stream for Transport<T, E, D> where T: AsyncRead, D: Dec...
code_fim
hard
{ "lang": "rust", "repo": "vitali2y/rust-u2f", "path": "/linux/uhid-tokio/src/transport.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matthiasbeyer/shiplift path: /src/lib.rs //! Shiplift is a multi-transport utility for maneuvering [docker](https://www.docker.com/) containers //! //! # examples //! //! ```no_run //! # async { //! let docker = shiplift::Docker::new(); //! //! match docker.images().list(&Default::default()).awa...
code_fim
hard
{ "lang": "rust", "repo": "matthiasbeyer/shiplift", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(feature = "chrono")] mod datetime; pub use hyper::Uri; pub use crate::{ container::{ Container, ContainerFilter, ContainerListOptions, ContainerOptions, Containers, LogsOptions, RmContainerOptions, }, docker::{Docker, EventsOptions}, errors::{Error, Result}, exe...
code_fim
hard
{ "lang": "rust", "repo": "matthiasbeyer/shiplift", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>mod tarball; #[cfg(feature = "chrono")] mod datetime; pub use hyper::Uri; pub use crate::{ container::{ Container, ContainerFilter, ContainerListOptions, ContainerOptions, Containers, LogsOptions, RmContainerOptions, }, docker::{Docker, EventsOptions}, errors::{Error, Re...
code_fim
hard
{ "lang": "rust", "repo": "matthiasbeyer/shiplift", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(solve_example("example3"), 18); } #[test] fn example_4() { assert_eq!(solve_example("example4"), 23); } #[test] fn example_5() { assert_eq!(solve_example("example5"), 31); } }<|fim_prefix|>// repo: BafDyce/adventofcode path: /2018/rust/day2...
code_fim
hard
{ "lang": "rust", "repo": "BafDyce/adventofcode", "path": "/2018/rust/day20/src/part1.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn example_3() { assert_eq!(solve_example("example3"), 18); } #[test] fn example_4() { assert_eq!(solve_example("example4"), 23); } #[test] fn example_5() { assert_eq!(solve_example("example5"), 31); } }<|fim_prefix|>// repo: BafDyce/ad...
code_fim
hard
{ "lang": "rust", "repo": "BafDyce/adventofcode", "path": "/2018/rust/day20/src/part1.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: BafDyce/adventofcode path: /2018/rust/day20/src/part1.rs use super::*; use std::collections::HashMap; pub type OutputType = usize; pub fn solve(input: &InputType, _config: &PuzzleConfig) -> OutputType { let start = Location2D::new(0, 0); let mut iter = input.chars(); // remove ^ ...
code_fim
hard
{ "lang": "rust", "repo": "BafDyce/adventofcode", "path": "/2018/rust/day20/src/part1.rs", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: icewind1991/esp8266-flash path: /examples/counter.rs //! Count how many times the device has been reset #![no_std] #![no_main] use xtensa_lx106_rt::entry; use core::fmt::Write; use core::panic::PanicInfo; use esp8266_flash::ESPFlash; use esp8266_hal::prelude::*; use esp8266_hal::target::Perip...
code_fim
medium
{ "lang": "rust", "repo": "icewind1991/esp8266-flash", "path": "/examples/counter.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> loop {} } /// Basic panic handler - just loops #[panic_handler] fn panic(_info: &PanicInfo) -> ! { loop {} }<|fim_prefix|>// repo: icewind1991/esp8266-flash path: /examples/counter.rs //! Count how many times the device has been reset #![no_std] #![no_main] use xtensa_lx106_rt::entry; use cor...
code_fim
hard
{ "lang": "rust", "repo": "icewind1991/esp8266-flash", "path": "/examples/counter.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> flash.erase_sectors(ADDR, 1).unwrap(); flash.write_bytes(ADDR, &mut buff).unwrap(); let _ = write!(&mut serial, "counter {}:\r\n", buff[0]); loop {} } /// Basic panic handler - just loops #[panic_handler] fn panic(_info: &PanicInfo) -> ! { loop {} }<|fim_prefix|>// repo: icewind199...
code_fim
medium
{ "lang": "rust", "repo": "icewind1991/esp8266-flash", "path": "/examples/counter.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl syntax::Syntax for Syntax { fn any(&self) -> Option<&std::any::Any> { Some(self) } fn any_mut(&mut self) -> Option<&mut std::any::Any> { Some(self) } }<|fim_prefix|>// repo: asgii/adze-lang2 path: /src/parse/syntax/block.rs use lex::{ Token, TokenKind }; use parse::{ syntax, TokenIter }; #[...
code_fim
hard
{ "lang": "rust", "repo": "asgii/adze-lang2", "path": "/src/parse/syntax/block.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: asgii/adze-lang2 path: /src/parse/syntax/block.rs use lex::{ Token, TokenKind }; use parse::{ syntax, TokenIter }; #[derive (Debug)] pub struct Syntax { statements: Vec<Box<syntax::Syntax>>, } <|fim_suffix|> Some(Syntax { statements, }) } } impl syntax::Synt...
code_fim
hard
{ "lang": "rust", "repo": "asgii/adze-lang2", "path": "/src/parse/syntax/block.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sozu-proxy/poule path: /src/mmap.rs use std::{ ops::{Deref, DerefMut, Drop}, ptr, slice, }; use libc::{ mmap, mprotect, munmap, MAP_ANON, MAP_FAILED, MAP_PRIVATE, PROT_NONE, PROT_READ, PROT_WRITE, }; /// Memory map backend for the pool /// /// This acts like a buffer that we can gr...
code_fim
hard
{ "lang": "rust", "repo": "sozu-proxy/poule", "path": "/src/mmap.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if unsafe { mprotect(self.ptr as _, size, PROT_READ | PROT_WRITE) != 0 } { return Err("could not change permissions on memory"); } self.size = size; Ok(()) } } impl Deref for GrowableMemoryMap { type Target = [u8]; fn deref(&self) -> &[u8] { ...
code_fim
hard
{ "lang": "rust", "repo": "sozu-proxy/poule", "path": "/src/mmap.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: BafDyce/adventofcode path: /2018/rust/day18/src/part2.rs use super::*; use std::collections::HashMap; type OutputType = super::part1::OutputType; pub fn solve(input: &InputType, _config: &PuzzleConfig) -> OutputType { let mut area = input.to_owned(); let mut lookup = HashMap::new(); ...
code_fim
hard
{ "lang": "rust", "repo": "BafDyce/adventofcode", "path": "/2018/rust/day18/src/part2.rs", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> fn solve_example(name: &str) -> OutputType { let (input, config) = parse_input(name, false); solve(&input, &config) } #[test] fn examples() { assert_eq!(solve_example("example1"), OutputType::default()); } }<|fim_prefix|>// repo: BafDyce/adventofcode path: /20...
code_fim
medium
{ "lang": "rust", "repo": "BafDyce/adventofcode", "path": "/2018/rust/day18/src/part2.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hugues31/coinnect path: /src/bittrex/utils.rs MC" => Some(Currency::EMC), "EMC2" => Some(Currency::EMC2), "ENRG" => Some(Currency::ENRG), "ERC" => Some(Currency::ERC), "ETC" => Some(Currency::ETC), "ETH" => Some(Currency::ETH), "EXCL" => Some(Curre...
code_fim
hard
{ "lang": "rust", "repo": "hugues31/coinnect", "path": "/src/bittrex/utils.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match error_message.as_ref() { "MIN_TRADE_REQUIREMENT_NOT_MET" => Err(ErrorKind::InsufficientOrderSize.into()), "INVALID_PERMISSION" => Err(ErrorKind::PermissionDenied.into()), _ => Err(ErrorKind::ExchangeSpecificError(error_message.to_string()).into()), ...
code_fim
hard
{ "lang": "rust", "repo": "hugues31/coinnect", "path": "/src/bittrex/utils.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hugues31/coinnect path: /src/bittrex/utils.rs m.insert(THC_BTC, "BTC-THC"); m.insert(TIME_BTC, "BTC-TIME"); m.insert(TIX_BTC, "BTC-TIX"); m.insert(TKN_BTC, "BTC-TKN"); m.insert(TKS_BTC, "BTC-TKS"); m.insert(TRIG_BTC, "BTC-TRIG"); m.insert(TRST_B...
code_fim
hard
{ "lang": "rust", "repo": "hugues31/coinnect", "path": "/src/bittrex/utils.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PtrMan/20NAR1 path: /src/NarseseParser.rs arseNarsese(&narsese); assert_eq!(parseResOpt.is_some(), true); let (term, tv, punct, _isEvent) = parseResOpt.unwrap(); assert_eq!(convTermToStr(&term), "<0 --> b>"); assert_eq!((tv.f - 1.0).abs() < 0.01, true); assert_eq!((tv.c ...
code_fim
hard
{ "lang": "rust", "repo": "PtrMan/20NAR1", "path": "/src/NarseseParser.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PtrMan/20NAR1 path: /src/NarseseParser.rs &narsese); assert_eq!(parseResOpt.is_some(), true); let (term, tv, punct, _isEvent) = parseResOpt.unwrap(); assert_eq!(convTermToStr(&term), "<a =/> b>"); assert_eq!((tv.f - 1.0).abs() < 0.01, true); assert_eq!((tv.c - 0.9).abs()...
code_fim
hard
{ "lang": "rust", "repo": "PtrMan/20NAR1", "path": "/src/NarseseParser.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let (term, tv, punct, _isEvent) = parseResOpt.unwrap(); assert_eq!(convTermToStr(&term), "<( a | c ) --> x>"); assert_eq!((tv.f - 1.0).abs() < 0.01, true); assert_eq!((tv.c - 0.9).abs() < 0.01, true); assert_eq!(punct, EnumPunctation::JUGEMENT); } #[test] pub fn extint2() { ...
code_fim
hard
{ "lang": "rust", "repo": "PtrMan/20NAR1", "path": "/src/NarseseParser.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: darayus/rust-plugin path: /examples/default_types.rs extern crate plugin; extern crate typemap; use plugin::{Extensible, PluginFor, GetCached, Phantom}; use typemap::{TypeMap, Assoc}; struct Struct { map: TypeMap } impl Extensible for Struct { fn extensions(&self) -> &TypeMap { ...
code_fim
medium
{ "lang": "rust", "repo": "darayus/rust-plugin", "path": "/examples/default_types.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &mut self.map } } #[deriving(Clone, Show)] struct Plugin { field: i32 } impl Assoc<Plugin> for Plugin {} impl PluginFor<Struct> for Plugin { fn eval(_: &mut Struct, _: Phantom<Plugin>) -> Option<Plugin> { Some(Plugin { field: 7i32 }) } } fn main() { let mut x = Struc...
code_fim
medium
{ "lang": "rust", "repo": "darayus/rust-plugin", "path": "/examples/default_types.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matthewharwood/bullet_hello path: /src/entities/mod.rs mod player; mod enemy; mod cloud; //mod level; mod backgroun<|fim_suffix|>er::init_player, cloud::init_cloud, background::init_background, shot::init_shot, // level::init_level };<|fim_middle|>d; mod shot; pub use self::{ ...
code_fim
medium
{ "lang": "rust", "repo": "matthewharwood/bullet_hello", "path": "/src/entities/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>_background, shot::init_shot, // level::init_level };<|fim_prefix|>// repo: matthewharwood/bullet_hello path: /src/entities/mod.rs mod player; mod enemy; mod cloud; //mod level; mod background; mod shot; pub use self::{ enemy::init_enemy, play<|fim_middle|>er::init_player, cloud::init_...
code_fim
medium
{ "lang": "rust", "repo": "matthewharwood/bullet_hello", "path": "/src/entities/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gharib85/toys path: /leetcode/202-happy-number.rs // 202. Happy Number // https://leetcode.com/problems/happy-number/ struct Solution { } <|fim_suffix|>fn main() { for i in &[19, 10, 61, 1122334387] { println!("{:?}", Solution::is_happy(*i)); } }<|fim_middle|>impl Solution { ...
code_fim
hard
{ "lang": "rust", "repo": "gharib85/toys", "path": "/leetcode/202-happy-number.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { for i in &[19, 10, 61, 1122334387] { println!("{:?}", Solution::is_happy(*i)); } }<|fim_prefix|>// repo: gharib85/toys path: /leetcode/202-happy-number.rs // 202. Happy Number // https://leetcode.com/problems/happy-number/ struct Solution { } impl Solution { pub fn is_ha...
code_fim
medium
{ "lang": "rust", "repo": "gharib85/toys", "path": "/leetcode/202-happy-number.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> &mut self.x[index] } } impl TryFrom<&[u64]> for State { type Error = (); fn try_from(value: &[u64]) -> Result<Self, Self::Error> { match value.len() { 5 => Ok(Self::new(value[0], value[1], value[2], value[3], value[4])), _ => Err(()), } } }...
code_fim
hard
{ "lang": "rust", "repo": "RustCrypto/sponges", "path": "/ascon/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: RustCrypto/sponges path: /ascon/src/lib.rs // Copyright 2021-2022 Sebastian Ramacher // SPDX-License-Identifier: Apache-2.0 OR MIT #![no_std] #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![doc = include_str!("../README.md")] #![doc( html_logo_url = "https://raw.githubusercontent.com/RustCry...
code_fim
hard
{ "lang": "rust", "repo": "RustCrypto/sponges", "path": "/ascon/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[inline(always)] fn index(&self, index: usize) -> &Self::Output { &self.x[index] } } impl core::ops::IndexMut<usize> for State { #[inline(always)] fn index_mut(&mut self, index: usize) -> &mut Self::Output { &mut self.x[index] } } impl TryFrom<&[u64]> for State {...
code_fim
hard
{ "lang": "rust", "repo": "RustCrypto/sponges", "path": "/ascon/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn from_str(s: &str) -> Result<Self, Self::Err> { match s { r#""cache""# => Ok(Self::Cache), r#""cookies""# => Ok(Self::Cookies), r#""storage""# => Ok(Self::Storage), r#""executionContexts""# => Ok(Self::ExecutionContexts), _ => todo!...
code_fim
hard
{ "lang": "rust", "repo": "sunfishcode/http-types", "path": "/src/cache/clear_site_data/directive.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> write!(f, "{}", self.as_str()) } } impl FromStr for ClearDirective { type Err = std::string::ParseError; fn from_str(s: &str) -> Result<Self, Self::Err> { match s { r#""cache""# => Ok(Self::Cache), r#""cookies""# => Ok(Self::Cookies), r#""s...
code_fim
medium
{ "lang": "rust", "repo": "sunfishcode/http-types", "path": "/src/cache/clear_site_data/directive.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sunfishcode/http-types path: /src/cache/clear_site_data/directive.rs use std::fmt::Display; use std::str::FromStr; /// An HTTP `Clear-Site-Data` directive. /// /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data#Directives) #[derive(Debug, Eq, Parti...
code_fim
medium
{ "lang": "rust", "repo": "sunfishcode/http-types", "path": "/src/cache/clear_site_data/directive.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mesalock-linux/crates-sgx path: /vendor/net2/src/tcp.rs // Copyright 2015 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 <LICENSE-APACHE or // ht...
code_fim
hard
{ "lang": "rust", "repo": "mesalock-linux/crates-sgx", "path": "/vendor/net2/src/tcp.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> where F: FnOnce(&Socket) -> io::Result<()> { match *self.socket.borrow() { Some(ref s) => f(s), None => Err(io::Error::new(io::ErrorKind::Other, "builder has already finished its socket")), } } } impl fmt::Debu...
code_fim
hard
{ "lang": "rust", "repo": "mesalock-linux/crates-sgx", "path": "/vendor/net2/src/tcp.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mmeyerho/rust-mozjs path: /linkhack.rs // Some crumminess to make sure we link correctly <|fim_suffix|>#[cfg(target_os = "macos")] #[link_args = "-L. -lstdc++"] #[nolink] native mod m { }<|fim_middle|>#[cfg(target_os = "linux")] #[nolink] native mod m { }
code_fim
easy
{ "lang": "rust", "repo": "mmeyerho/rust-mozjs", "path": "/linkhack.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(target_os = "macos")] #[link_args = "-L. -lstdc++"] #[nolink] native mod m { }<|fim_prefix|>// repo: mmeyerho/rust-mozjs path: /linkhack.rs // Some crumminess to make sure we link correctly <|fim_middle|>#[cfg(target_os = "linux")] #[nolink] native mod m { }
code_fim
easy
{ "lang": "rust", "repo": "mmeyerho/rust-mozjs", "path": "/linkhack.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn divide_by_zero() { let x = 0 / 0; }<|fim_prefix|>// repo: bkchr/codeclimate-rustfmt-src path: /tests/src/lib.rs use std::fs::File; use std::io::Write; fn write() <|fim_middle|>{ let mut file = File::open("nevercalled").unwrap(); let mystring = "longstring, seyhsdfa, string".to_string()...
code_fim
hard
{ "lang": "rust", "repo": "bkchr/codeclimate-rustfmt-src", "path": "/tests/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bkchr/codeclimate-rustfmt-src path: /tests/src/lib.rs use std::fs::File; use std::io::Write; fn write() { let mut file = File::open("nevercalled").unwrap(); let mystring = "longstring, seyhsdfa, string".to_string(); <|fim_suffix|>fn divide_by_zero() { let x = 0 / 0; }<|fim_middl...
code_fim
hard
{ "lang": "rust", "repo": "bkchr/codeclimate-rustfmt-src", "path": "/tests/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: delta62/aoc2019 path: /src/day3/wire.rs use std::str::FromStr; use super::cartesian::Direction; use super::errors::ParseError; pub struct WireDirection { pub direction: Direction, pub length: usize, } impl FromStr for WireDirection { type Err = ParseError; <|fim_suffix|> ...
code_fim
medium
{ "lang": "rust", "repo": "delta62/aoc2019", "path": "/src/day3/wire.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl FromStr for WireDirection { type Err = ParseError; fn from_str(s: &str) -> Result<Self, Self::Err> { let (direction, length) = s.split_at(1); let direction = direction.parse::<Direction>().expect("Unable to parse direction"); let length = length.parse::<usize>().expec...
code_fim
medium
{ "lang": "rust", "repo": "delta62/aoc2019", "path": "/src/day3/wire.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Rukenshia/bercon-rs path: /src/main.rs #![feature(integer_atomics)] extern crate regex; extern crate hyper; extern crate crossbeam; use std::sync::mpsc; use std::sync::Arc; mod becommand; use becommand::BECommand; mod bepackets; use bepackets::RemotePacket; mod packet; mod rcon_error; <|fim_su...
code_fim
hard
{ "lang": "rust", "repo": "Rukenshia/bercon-rs", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> crossbeam::scope(|scope| { { let client = client.clone(); scope.spawn(move || { client.start("bla", tx).unwrap(); }); } scope.spawn(move || { loop { match rx.recv().unwrap() { RemotePacket::Login(success) =...
code_fim
hard
{ "lang": "rust", "repo": "Rukenshia/bercon-rs", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub async fn exec(&self, context: &mut LowpanCtlContext) -> Result<(), Error> { let network_scan_marker = self.get_network_scan_params()?; let (_, device_extra, _) = context.get_default_device_proxies().await.context("Unable to get device instance")?; let (client_en...
code_fim
hard
{ "lang": "rust", "repo": "oshunter/fuchsia", "path": "/src/connectivity/lowpan/tools/lowpanctl/src/network_scan_command.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: oshunter/fuchsia path: /src/connectivity/lowpan/tools/lowpanctl/src/network_scan_command.rs // Copyright 2020 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use crate::context::LowpanCtlContext; u...
code_fim
hard
{ "lang": "rust", "repo": "oshunter/fuchsia", "path": "/src/connectivity/lowpan/tools/lowpanctl/src/network_scan_command.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> oscilloscope.value_list.push_front(0 as f32); } return oscilloscope; } fn draw_visualizer(&mut self, mut target: Frame, display: &Display){ //value_list zu Vec<f32> let value_slices = self.value_list.as_slices(); let mut valueVec = value_slice...
code_fim
hard
{ "lang": "rust", "repo": "Niwo1403/Rust-Audio-Visualizer", "path": "/src/oscilloscope.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Niwo1403/Rust-Audio-Visualizer path: /src/oscilloscope.rs use crate::line::Line; use std::collections::VecDeque; use std::sync::mpsc::Receiver; use glium::{Program, Display, Frame, Surface}; use glium::index::NoIndices; use crate::visualizer::Visualizer; use crate::drawable::Drawable; static N...
code_fim
hard
{ "lang": "rust", "repo": "Niwo1403/Rust-Audio-Visualizer", "path": "/src/oscilloscope.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut shapes = vec![]; for line in self.list_lines.iter_mut() { let mut line_shape = line.get_shape_outline(); shapes.append(&mut line_shape); i += 1; } let vertex_buffer = glium::VertexBuffer::new(display, &shapes).unwrap(); ...
code_fim
hard
{ "lang": "rust", "repo": "Niwo1403/Rust-Audio-Visualizer", "path": "/src/oscilloscope.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tock/tock path: /chips/imxrt10xx/src/lib.rs // Licensed under the Apache License, Version 2.0 or the MIT License. // SPDX-License-Identifier: Apache-2.0 OR MIT // Copyright Tock Contributors 2022. //! Peripheral implementations for the IMXRT1050 and IMXRT1060 MCUs. //! //! imxrt1050 chip: <http...
code_fim
hard
{ "lang": "rust", "repo": "tock/tock", "path": "/chips/imxrt10xx/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>R, // SPDIF (60) CortexM7::GENERIC_ISR, // PMU (61) CortexM7::GENERIC_ISR, // Reserved (62) CortexM7::GENERIC_ISR, // Temperature Monitor (63) CortexM7::GENERIC_ISR, // Temperature Monitor (64) CortexM7::GENERIC_ISR, // USB PHY (65) CortexM7::GENERIC_ISR, // USB PHY (66) Cortex...
code_fim
hard
{ "lang": "rust", "repo": "tock/tock", "path": "/chips/imxrt10xx/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// A trait defining application specific response data. /// /// The intention of this trait is that applications which are using this crate will be able to /// use their own concrete data types for returning response data from the storage layer when an /// entry is applied to the state machine as part of...
code_fim
hard
{ "lang": "rust", "repo": "async-raft/async-raft", "path": "/async-raft/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: async-raft/async-raft path: /async-raft/src/lib.rs #![cfg_attr(feature = "docinclude", feature(external_doc))] #![cfg_attr(feature = "docinclude", doc(include = "../README.md"))] pub mod config; mod core; pub mod error; pub mod metrics; pub mod network; pub mod raft; mod replication; pub mod st...
code_fim
medium
{ "lang": "rust", "repo": "async-raft/async-raft", "path": "/async-raft/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: liufoyang/rust_demo path: /concurrency/src/main.rs use std::sync::Arc; use std::time::Duration; use std::thread; fn main() { let list:Vec<i32> = Vec::new(); let list_arc = Arc::new(list); println!("Hello, world!"); let mut list_1 = list_arc.clone(); let thread_1 = thread::...
code_fim
medium
{ "lang": "rust", "repo": "liufoyang/rust_demo", "path": "/concurrency/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// let mut list_3 = list_arc.clone(); // list_3.push(2); thread_1.join(); thread_2.join(); }<|fim_prefix|>// repo: liufoyang/rust_demo path: /concurrency/src/main.rs use std::sync::Arc; use std::time::Duration; use std::thread; fn main() { let list:Vec<i32> = Vec::new(); let list_...
code_fim
hard
{ "lang": "rust", "repo": "liufoyang/rust_demo", "path": "/concurrency/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/wry path: /examples/fullscreen.rs use wry::{Application, Attributes, Result}; fn main() -> Result<()> { let mut app = Application::new()?; <|fim_suffix|>// Test Result: // CPU: i7 9750H || GPU: Intel(R) UHD Graphics 630 // Linux kernel 5.8.18-18-ibryza-standard-xin // Mesa Mesa 20.2....
code_fim
hard
{ "lang": "rust", "repo": "isgasho/wry", "path": "/examples/fullscreen.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> app.add_window(attributes)?; app.run(); Ok(()) } // Test Result: // CPU: i7 9750H || GPU: Intel(R) UHD Graphics 630 // Linux kernel 5.8.18-18-ibryza-standard-xin // Mesa Mesa 20.2.6 // ================================================ // Canvas score - Test 1: 542 - Test 2: 368 // WebGL score - Test...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/wry", "path": "/examples/fullscreen.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yuizho/atcoder path: /rust/src/arc/031/b.rs use std::io::Read; use std::process::exit; type Point = (usize, usize); fn main() { let mut buf = String::new(); // 標準入力から全部bufに読み込む std::io::stdin().read_to_string(&mut buf).unwrap(); // 行ごとのiterが取れる let mut iter = buf.split_wh...
code_fim
hard
{ "lang": "rust", "repo": "yuizho/atcoder", "path": "/rust/src/arc/031/b.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn push_reachable_point( current_point: &Point, maze: &Vec<Vec<(char, bool)>>, stack: &mut Vec<Point>, ) { let mut push = |x: i32, y: i32| { if x >= 0 && 10 > x && y >= 0 && 10 > y && maze[y as usize][x as usize].0 == 'o' ...
code_fim
hard
{ "lang": "rust", "repo": "yuizho/atcoder", "path": "/rust/src/arc/031/b.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bsobocki/BitwaOTortuge_UWR-ThirdYear path: /bitwa_o_tortuge/src/ship.rs #[derive(Debug, Clone)] pub struct Ship { score : u8, rev : bool, //informations that the ship revers side should be shown show : bool, //informations that the ship can be shown (it has been clicked at lea...
code_fim
medium
{ "lang": "rust", "repo": "bsobocki/BitwaOTortuge_UWR-ThirdYear", "path": "/bitwa_o_tortuge/src/ship.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn rev_src_l(&self) -> String { self.rev_src_l.clone() } pub fn rev_src_d(&self) -> String { self.rev_src_d.clone() } pub fn show(&self) -> bool { self.show } pub fn score(&self) -> u8 { self.score } pub fn is_pirate(&self) -> bool { self.is_pirate } }<|fim_prefix|>// repo: bsoboc...
code_fim
hard
{ "lang": "rust", "repo": "bsobocki/BitwaOTortuge_UWR-ThirdYear", "path": "/bitwa_o_tortuge/src/ship.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: michaelfaster/egui-stylist path: /egui-stylist/src/views/spacing.rs use egui::{Style, Ui}; /// Displays the Ui to help modify and cal<|fim_suffix|>g UI ui.heading("Spacing Settings"); style.spacing.ui(ui) }<|fim_middle|>culate the current spacing information. pub fn spacing_view(style: ...
code_fim
medium
{ "lang": "rust", "repo": "michaelfaster/egui-stylist", "path": "/egui-stylist/src/views/spacing.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>g UI ui.heading("Spacing Settings"); style.spacing.ui(ui) }<|fim_prefix|>// repo: michaelfaster/egui-stylist path: /egui-stylist/src/views/spacing.rs use egui::{Style, Ui}; /// Displays the Ui to help modify and calculate the current spacing information. pub fn spacing_view(style: <|fim_middle|>...
code_fim
medium
{ "lang": "rust", "repo": "michaelfaster/egui-stylist", "path": "/egui-stylist/src/views/spacing.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }