text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>e to the standard input of the other, using the pipe() system call */ fn main() { }<|fim_prefix|>// repo: epequeno/homework path: /3_easy_pieces/ch05/src/bin/08.rs /* Write a program that creates two childre<|fim_middle|>n, and connects the standard output of on
code_fim
easy
{ "lang": "rust", "repo": "epequeno/homework", "path": "/3_easy_pieces/ch05/src/bin/08.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: epequeno/homework path: /3_easy_pieces/ch05/src/bin/08.rs /* Write a program that creates two children, and connects the standard output of on<|fim_suffix|>the pipe() system call */ fn main() { }<|fim_middle|>e to the standard input of the other, using
code_fim
easy
{ "lang": "rust", "repo": "epequeno/homework", "path": "/3_easy_pieces/ch05/src/bin/08.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>the pipe() system call */ fn main() { }<|fim_prefix|>// repo: epequeno/homework path: /3_easy_pieces/ch05/src/bin/08.rs /* Write a program that creates two childre<|fim_middle|>n, and connects the standard output of one to the standard input of the other, using
code_fim
medium
{ "lang": "rust", "repo": "epequeno/homework", "path": "/3_easy_pieces/ch05/src/bin/08.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pimdh/gpu-monitor path: /src/main.rs extern crate regex; extern crate csv; #[macro_use] extern crate lazy_static; #[macro_use] extern crate serde_derive; #[macro_use] extern crate prettytable; mod cli_table; mod fetch; <|fim_suffix|>fn main() { let args: Vec<String> = env::args().skip(1).c...
code_fim
medium
{ "lang": "rust", "repo": "pimdh/gpu-monitor", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { let args: Vec<String> = env::args().skip(1).collect(); let records = fetch_hosts(args); host_records_table(&records).printstd(); }<|fim_prefix|>// repo: pimdh/gpu-monitor path: /src/main.rs extern crate regex; extern crate csv; #[macro_use] extern crate lazy_static; #[macro_use] e...
code_fim
medium
{ "lang": "rust", "repo": "pimdh/gpu-monitor", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Ventmere/jet path: /src/error.rs use thiserror::Error; use reqwest::StatusCode; #[derive(Debug, Error)] pub enum Error { #[error("get token request error: status = '{status}', body = '{body}'")] Ge<|fim_suffix|>ring, status: StatusCode, body: String }, #[error("invalid bearer ...
code_fim
medium
{ "lang": "rust", "repo": "Ventmere/jet", "path": "/src/error.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[error("http: {0}")] Http(#[from] reqwest::Error), #[error("io: {0}")] Io(#[from] std::io::Error), } pub type Result<T, E = Error> = std::result::Result<T, E>;<|fim_prefix|>// repo: Ventmere/jet path: /src/error.rs use thiserror::Error; use reqwest::StatusCode; #[derive(Debug, Error)] pub enu...
code_fim
medium
{ "lang": "rust", "repo": "Ventmere/jet", "path": "/src/error.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fragment_cert: &Transaction<PoolRegistration>, explorer_cert: &BlockByIdBlockTransactionsEdgesNodeCertificateOnPoolRegistration, ) { let pool_cert = fragment_cert.as_slice().payload().into_payload(); assert_eq!(pool_cert.to_id().to_string(), explorer_cert.pool.id); ...
code_fim
hard
{ "lang": "rust", "repo": "input-output-hk/jormungandr", "path": "/testing/jormungandr-automation/src/jormungandr/explorer/verifiers/block_by_id_verifier.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let full_name = MessageDescriptor::compute_full_name( file_descriptor_proto.get_package(), &path_to_package, &proto, ); let fields: Vec<_> = fields .into_iter() .map(|f| { let proto = *field_proto_by_name.g...
code_fim
hard
{ "lang": "rust", "repo": "wking/cincinnati", "path": "/vendor/protobuf/src/reflect/message.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wking/cincinnati path: /vendor/protobuf/src/reflect/message.rs use crate::descriptor::DescriptorProto; use crate::descriptor::FileDescriptorProto; use crate::descriptorx::find_message_by_rust_name; use crate::reflect::acc::FieldAccessor; use crate::reflect::find_message_or_enum::find_message_or_...
code_fim
hard
{ "lang": "rust", "repo": "wking/cincinnati", "path": "/vendor/protobuf/src/reflect/message.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut full_name = file.get_package().to_string(); if full_name.len() > 0 { full_name.push('.'); } full_name.push_str(proto.message.get_name()); let fields: Vec<_> = fields .into_iter() .map(|f| { let proto = *fi...
code_fim
hard
{ "lang": "rust", "repo": "wking/cincinnati", "path": "/vendor/protobuf/src/reflect/message.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: raum-dellamorte/raumEn-rs path: /src/bak/ecs_s_position.rs terrain::{ Platform, TerrainNodes, }, }, // s::{ // }, }, flags::*, util::{ Vector3f, modulo, }, }; const GRAVITY: f32 = 5.0; // pub struct MovePlayer; // impl<'a> System...
code_fim
hard
{ "lang": "rust", "repo": "raum-dellamorte/raumEn-rs", "path": "/src/bak/ecs_s_position.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: raum-dellamorte/raumEn-rs path: /src/bak/ecs_s_position.rs *, MovementType::*, }, terrain::{ Platform, TerrainNodes, }, }, // s::{ // }, }, flags::*, util::{ Vector3f, modulo, }, }; const GRAVITY: f32 = 5.0; //...
code_fim
hard
{ "lang": "rust", "repo": "raum-dellamorte/raumEn-rs", "path": "/src/bak/ecs_s_position.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let (handler, _nodes, ents, mut pos, dvel, mut vel, mut padj, mut falling, pform, player) = data; let delta = handler.timer.delta; // if delta < 0.0 || delta > 0.04 { return } for (e, p, dv, v, pa, _) in (&ents, &mut pos, &dvel, &mut vel, &mut padj, &player).join() { let fpos = &mut...
code_fim
hard
{ "lang": "rust", "repo": "raum-dellamorte/raumEn-rs", "path": "/src/bak/ecs_s_position.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kalkspace/drawtool-collab path: /src/main.rs use futures::TryStreamExt; use http::StatusCode; use pin_project::pin_project; use serde::Deserialize; use std::{ collections::HashMap, fmt::{self, Display}, net::Ipv6Addr, sync::{Arc, Mutex}, time::Instant, }; use tokio::sync::bro...
code_fim
hard
{ "lang": "rust", "repo": "kalkspace/drawtool-collab", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[tokio::main] async fn main() { let state = Arc::new(State::default()); let rooms = path("rooms").and(path::param()); let state_join = Arc::clone(&state); let join = rooms .and(path::end()) .and(warp::post()) .and(warp::body::json()) .map(move |room, Iden...
code_fim
hard
{ "lang": "rust", "repo": "kalkspace/drawtool-collab", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: harrykim14/first_rust_programming path: /collections/src/main.rs fn main() { vector_example(); different_types_vector(); string_example(); hashmap_example(); } fn vector_example() { // Vec<T> 타입은 어떤 타입이든 저장할 수 있다 let _v1: Vec<i32> = Vec::new(); // 값을 포함하는 벡터를 생성하는 매크...
code_fim
hard
{ "lang": "rust", "repo": "harrykim14/first_rust_programming", "path": "/collections/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for (key, value) in &hash_scores { println!("{}, {}", key, value); } // 해시맵 수정하기 let mut new_scores = HashMap::new(); new_scores.insert(String::from("블루"), 10); new_scores.insert(String::from("블루"), 25); // 값을 덮어씌움 println!("{:?}", new_scores); // {"블루":25} // or...
code_fim
hard
{ "lang": "rust", "repo": "harrykim14/first_rust_programming", "path": "/collections/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>stRef, GuestRefMut, GuestString, GuestStringRef, }; pub use region::Region;<|fim_prefix|>// repo: alexcrichton/wiggle path: /crates/runtime/src/lib.rs mod borrow; mod error; mod guest_type; mod memory; mod region; pub use error:<|fim_middle|>:GuestError; pub use guest_type::{GuestErrorType, GuestTyp...
code_fim
medium
{ "lang": "rust", "repo": "alexcrichton/wiggle", "path": "/crates/runtime/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alexcrichton/wiggle path: /crates/runtime/src/lib.rs mod borrow; mod error; mod guest_type; mod memory; mod region; pub use error:<|fim_suffix|>stRef, GuestRefMut, GuestString, GuestStringRef, }; pub use region::Region;<|fim_middle|>:GuestError; pub use guest_type::{GuestErrorType, GuestTyp...
code_fim
medium
{ "lang": "rust", "repo": "alexcrichton/wiggle", "path": "/crates/runtime/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JakubGrobelny/University path: /2019-2020/zima/Rust/lista2/summy.rs fn summy(s: &str) -> i32 { s.split(" ").map(|x| x.parse::<i32>().unwrap_or(0)).sum() } #[test] fn test0() { assert_eq!(summy(""), 0) } #[test] fn test1() { assert_eq!(summy("1 1 2"), 4) } #[test] fn test2() { ...
code_fim
medium
{ "lang": "rust", "repo": "JakubGrobelny/University", "path": "/2019-2020/zima/Rust/lista2/summy.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test4() { assert_eq!(summy("0 135 0 0"), 135) } #[test] fn test5() { assert_eq!(summy("-2"), -2) } #[test] fn test6() { assert_eq!(summy("-2 -2 4"), 0) } #[test] fn test7() { assert_eq!(summy("-2 -2"), -4) } #[test] fn test8() { assert_eq!(summy("-1 0 1"),...
code_fim
medium
{ "lang": "rust", "repo": "JakubGrobelny/University", "path": "/2019-2020/zima/Rust/lista2/summy.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut prover_time = std::time::Duration::new(0, 0); let mut verifier_time = std::time::Duration::new(0, 0); let t = std::time::Instant::now(); let mut p = Prover::new(&mut rng, &ckt, &inp, Some(0..shared_size)); prover_time += t.elapsed(); println!("Prover setup time: {:?}", t.e...
code_fim
medium
{ "lang": "rust", "repo": "GaloisInc/swanky", "path": "/humidor/examples/random_circuit_once.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: GaloisInc/swanky path: /humidor/examples/random_circuit_once.rs use humidor::ligero::noninteractive; use rand::SeedableRng; use scuttlebutt::AesRng; use simple_arith_circuit::Circuit; type Hash = sha2::Sha256; type Field = scuttlebutt::field::F2e19x3e26; type Prover = noninteractive::Prover<Fie...
code_fim
hard
{ "lang": "rust", "repo": "GaloisInc/swanky", "path": "/humidor/examples/random_circuit_once.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Kingdread/digital_composer path: /src/markov.rs extern crate rand; use std::collections::HashMap; use std::hash::Hash; use rand::distributions::{IndependentSample, Range}; pub struct MarkovChain<T, U> { chain: HashMap<T, HashMap<U, u32>>, } impl<T, U> MarkovChain<T, U> where T: Copy + Eq +...
code_fim
hard
{ "lang": "rust", "repo": "Kingdread/digital_composer", "path": "/src/markov.rs", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> pub fn mark(&mut self, prec: T, succ: U) { if !self.chain.contains_key(&prec) { self.chain.insert(prec, HashMap::new()); }; let mut inner_map = self.chain.get_mut(&prec).unwrap(); let old_value = match inner_map.get(&succ) { Some(n) => *n, ...
code_fim
medium
{ "lang": "rust", "repo": "Kingdread/digital_composer", "path": "/src/markov.rs", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test_prefix(){ let faker = Faker::new("en"); let name = faker.name.prefix(); let matched = regex!(r"^[A-Z][a-z]+\.?$").is_match(name.as_slice()); assert!(matched); } #[test] fn test_suffix(){ let faker = Faker::new("en"); let name = faker.name.suffix(); let matched = regex!(r"^[A-Z][A-Z...
code_fim
medium
{ "lang": "rust", "repo": "sethpollack/faker", "path": "/tests/name.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let faker = Faker::new("en"); let name = faker.name.last_name(); let matched = regex!(r"^\w+").is_match(name.as_slice()); assert!(matched); } #[test] fn test_name(){ let faker = Faker::new("en"); let name = faker.name.full_name(); let matched = regex!(r"^(\w+\.? ?){2,3}$").is_match(name.as_slice()...
code_fim
medium
{ "lang": "rust", "repo": "sethpollack/faker", "path": "/tests/name.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sethpollack/faker path: /tests/name.rs #![feature(phase)] extern crate regex; #[phase(plugin)] extern crate regex_macros; extern crate faker; use faker::Faker; #[test] fn test_first_name(){ let faker = Faker::new("en"); let name = faker.name.first_name(); let matched = regex!(r"^\w+").is_m...
code_fim
medium
{ "lang": "rust", "repo": "sethpollack/faker", "path": "/tests/name.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MichaelRawson/lazycop path: /src/util/range.rs use crate::prelude::*; pub(crate) struct Range<T> { start: Id<T>, stop: Id<T>, } impl<T> Range<T> { pub(crate) fn new(start: Id<T>, stop: Id<T>) -> Self { Self { start, stop } } pub(crate) fn new_with_len(start: Id<T>,...
code_fim
hard
{ "lang": "rust", "repo": "MichaelRawson/lazycop", "path": "/src/util/range.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.start == self.stop { return None; } let result = Some(self.start); self.start = self.start + Offset::new(1); result } fn size_hint(&self) -> (usize, Option<usize>) { let size = (self.stop.index() - self.start.index()) as usize; ...
code_fim
hard
{ "lang": "rust", "repo": "MichaelRawson/lazycop", "path": "/src/util/range.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[serde(rename = "$unflatten=dhSaiEnt")] #[serde(skip_serializing_if = "Option::is_none")] #[serde(serialize_with = "serialize_horario_op")] pub o_horario: Option<DateTime<Utc>>, #[serde(rename = "$unflatten=tpNF")] pub o_tipo: TipoOperacao, #[serde(rename = "$unflatten=idDest"...
code_fim
hard
{ "lang": "rust", "repo": "fernandobatels/fiscal-rs", "path": "/nfe/src/base/ide/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fernandobatels/fiscal-rs path: /nfe/src/base/ide/mod.rs //! Identificação da NF-e use super::Error; use chrono::prelude::*; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde_repr::{Deserialize_repr, Serialize_repr}; use std::str::FromStr; mod emissao; mod operacao; pub ...
code_fim
hard
{ "lang": "rust", "repo": "fernandobatels/fiscal-rs", "path": "/nfe/src/base/ide/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>enum Request<P, I> { Input { player: NetId, input: I }, PlayerJoin { player_info: P }, } enum Response<J, U> { Update { raw: Vec<u8> }, } impl<P, J, I, U> ClientSession<P, J, I, U> { pub async fn new(addr: std::net::SocketAddr) -> eyre::Result<Self> { let socket = tokio::net::Udp...
code_fim
hard
{ "lang": "rust", "repo": "EvoTeamDevelop/arcana", "path": "/src/session.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: EvoTeamDevelop/arcana path: /src/session.rs //! Game session module. use std::borrow::Borrow; use eyre::Context; use { crate::{ clocks::{TimeSpan, TimeStamp}, system::DEFAULT_TICK_SPAN, }, eyre::WrapErr as _, std::{ collections::VecDeque, future...
code_fim
hard
{ "lang": "rust", "repo": "EvoTeamDevelop/arcana", "path": "/src/session.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // TODO figure out how to do this without parens assert_eq!(npn!(/ bar (baz())), 6); // TODO figure out how to do this without parens assert_eq!(npn!(+ foo (-3)), 0); } } #[macro_export] macro_rules! rpn { // base cases [() -> ()] => {}; [() -> ($stack:tt)...
code_fim
hard
{ "lang": "rust", "repo": "benbariteau/polish_notation", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: benbariteau/polish_notation path: /src/lib.rs #[macro_export] macro_rules! npn { // base cases [() -> ()] => {}; [() -> ($stack:tt)] => {$stack}; // whenever there is an operator as the next token, always push it onto the stack [(+ $($tail:tt)*) -> ($($stack:tt)*)] => { npn!...
code_fim
hard
{ "lang": "rust", "repo": "benbariteau/polish_notation", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn basic_subtract() { assert_eq!(rpn!(1 2 -), -1); } #[test] fn double_subtract() { assert_eq!(rpn!(5 2 - 4 -), -1); } #[test] fn basic_multiply() { assert_eq!(rpn!(3 2 *), 6); } #[test] fn double_multiply() { assert_eq!(rpn!(3 2 * 3 *), 18); } #[test] fn...
code_fim
hard
{ "lang": "rust", "repo": "benbariteau/polish_notation", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: azriel91/autexousious path: /crate/map_model/src/play/map_boundary_event.rs use crate::play::MapBoundaryEventData; /// Indicates an entity has entered or exited the playable area. #[derive(Clone, Copy, Debug, PartialEq)] pub enum MapBou<|fim_suffix|>Data), /// Entity exited the playable are...
code_fim
medium
{ "lang": "rust", "repo": "azriel91/autexousious", "path": "/crate/map_model/src/play/map_boundary_event.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ndaryEvent { /// Entity entered the playable area. Enter(MapBoundaryEventData), /// Entity exited the playable area. Exit(MapBoundaryEventData), }<|fim_prefix|>// repo: azriel91/autexousious path: /crate/map_model/src/play/map_boundary_event.rs use crate::play::MapBoundaryEventData; /// ...
code_fim
medium
{ "lang": "rust", "repo": "azriel91/autexousious", "path": "/crate/map_model/src/play/map_boundary_event.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Data), /// Entity exited the playable area. Exit(MapBoundaryEventData), }<|fim_prefix|>// repo: azriel91/autexousious path: /crate/map_model/src/play/map_boundary_event.rs use crate::play::MapBoundaryEventData; /// Indicates an entity has entered or exited the playable area. #[derive(Clone, Copy...
code_fim
medium
{ "lang": "rust", "repo": "azriel91/autexousious", "path": "/crate/map_model/src/play/map_boundary_event.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: susu/ssh2-rs path: /tests/all/knownhosts.rs use ssh2::{Session, KnownHostFileKind}; #[test] fn smoke() { let sess = Session::new().unwrap(); let hosts = sess.known_hosts().unwrap(); assert_eq!(hosts.iter().count(), 0); } <|fim_suffix|> let encoded = "\ |1|VXwDpq2cv4j3QtmrGiY+Hnt...
code_fim
medium
{ "lang": "rust", "repo": "susu/ssh2-rs", "path": "/tests/all/knownhosts.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let encoded = "\ |1|VXwDpq2cv4j3QtmrGiY+HntJc+Q=|80E+wqnFDhkxBDxRBOIPJPAVE6Y= \ ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9I\ DSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVD\ BfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eF\ zLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhH...
code_fim
medium
{ "lang": "rust", "repo": "susu/ssh2-rs", "path": "/tests/all/knownhosts.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: K0R0VA/portal-chat path: /src/graphql/loaders/rooms_loader.rs use deadpool_postgres::{Pool, Client}; use async_graphql::dataloader::Loader; use std::collections::HashMap; use itertools::join; use crate::graphql::models::room::Room; use crate::graphql::models::user::ParticipantId; use crate::gra...
code_fim
hard
{ "lang": "rust", "repo": "K0R0VA/portal-chat", "path": "/src/graphql/loaders/rooms_loader.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> async fn load(&self, keys: &[ParticipantId]) -> Result<HashMap<ParticipantId, Self::Value>, Self::Error> { let result: LoadResult<ParticipantId, Self::Value> = try { let pool = &self.0; let client: Client = pool.get().await?; let stmt = client.prepare(&*form...
code_fim
hard
{ "lang": "rust", "repo": "K0R0VA/portal-chat", "path": "/src/graphql/loaders/rooms_loader.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let semesters = client.get(BASE_URL) .headers(headers) .send()? .json() .map(|response: Vec<SemesterPlan>| response)?; Ok(semesters) } }<|fim_prefix|>// repo: kiliankoe/htwdresden-rs path: /src/semester.rs use Error; use Year; use reqwe...
code_fim
hard
{ "lang": "rust", "repo": "kiliankoe/htwdresden-rs", "path": "/src/semester.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kiliankoe/htwdresden-rs path: /src/semester.rs use Error; use Year; use reqwest; #[derive(Debug, Deserialize)] pub struct SemesterPlan { pub year: Year, #[serde(rename = "type")] pub semester_type: String, pub period: Period, #[serde(rename = "freeDays")] pub holidays: ...
code_fim
medium
{ "lang": "rust", "repo": "kiliankoe/htwdresden-rs", "path": "/src/semester.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let config = r2d2::Config::default(); let manager = r2d2_sqlite::SqliteConnectionManager::new("./db.sqlite3"); let pool = r2d2::Pool::new(config, manager).unwrap(); DatabaseConnection::new(&pool).setup_database().unwrap(); let mut middleware = Chain::new(router); middleware.link_b...
code_fim
hard
{ "lang": "rust", "repo": "mxhold/pastebin_rs", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mxhold/pastebin_rs path: /src/main.rs extern crate iron; extern crate persistent; extern crate router; extern crate r2d2; extern crate r2d2_sqlite; extern crate rusqlite; extern crate uuid; use iron::prelude::*; use iron::status; use std::io::Read; pub struct ConnectionPool; impl iron::typemap...
code_fim
hard
{ "lang": "rust", "repo": "mxhold/pastebin_rs", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut router = router::Router::new(); router.post("/", post_pastebin, "post_pastebin"); router.get("/:id", get_pastebin, "get_pastebin"); let config = r2d2::Config::default(); let manager = r2d2_sqlite::SqliteConnectionManager::new("./db.sqlite3"); let pool = r2d2::Pool::new(con...
code_fim
hard
{ "lang": "rust", "repo": "mxhold/pastebin_rs", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Kh4n/svgtess path: /src/lib.rs extern crate cgmath; use cgmath::prelude::*; use std::f32; pub enum JointType { Miter, Bevel, Round, } #[derive(PartialEq)] enum Direction { Left, Right, } pub fn is_to_right(v1: cgmath::Vector2<f32>, v2: cgmath::Vector2<f32>) -> bool { ...
code_fim
hard
{ "lang": "rust", "repo": "Kh4n/svgtess", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> //ij: innerjoint, oj: outerjoint, ojf: outeranchor first, ojs: outeranchor second let ij = intersection(&pb0, &pb1, &pd0, &pd1); let oaf = (perpendicular1 * thickness) + ij; let oas = (perpendicular2 * thickness) + ij; vertices.push(oaf); vertices.push(ij); ...
code_fim
hard
{ "lang": "rust", "repo": "Kh4n/svgtess", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: agatan/nsh path: /src/builtins/complete.rs use crate::builtins::InternalCommandContext; use crate::exec::ExitStatus; use crate::completion::CompSpecBuilder; use structopt::StructOpt; use std::io::Write; #[derive(Debug, StructOpt)] #[structopt(name = "complete", about = "Compgen command.")] stru...
code_fim
hard
{ "lang": "rust", "repo": "agatan/nsh", "path": "/src/builtins/complete.rs", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> let compspec = compspec.build(); for command in opts.commands { ctx.isolate.set_compspec(&command, compspec.clone()); } ExitStatus::ExitedWith(0) }, Err(err) => { writeln!(ctx.stderr, "nsh: complete: {}", err).ok(...
code_fim
hard
{ "lang": "rust", "repo": "agatan/nsh", "path": "/src/builtins/complete.rs", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> ExitStatus::ExitedWith(0) }, Err(err) => { writeln!(ctx.stderr, "nsh: complete: {}", err).ok(); ExitStatus::ExitedWith(1) } } }<|fim_prefix|>// repo: agatan/nsh path: /src/builtins/complete.rs use crate::builtins::InternalCommandContext; use...
code_fim
hard
{ "lang": "rust", "repo": "agatan/nsh", "path": "/src/builtins/complete.rs", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jungle-bits/pdf path: /src/content/stream.rs use crate::{ error::{ParseError, PdfResult}, filter::decode_stream, objects::{Object, ObjectType}, resolve::Resolve, stream::Stream, }; #[derive(Debug, Clone)] pub(crate) struct ContentStream { pub combined_buffer: Vec<u8>, } ...
code_fim
hard
{ "lang": "rust", "repo": "jungle-bits/pdf", "path": "/src/content/stream.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let combined_buffer = streams .into_iter() .try_fold(Vec::new(), |mut init, stream| -> PdfResult<Vec<u8>> { init.extend( decode_stream(&stream.stream, &stream.dict, resolver)? .iter(...
code_fim
hard
{ "lang": "rust", "repo": "jungle-bits/pdf", "path": "/src/content/stream.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jpdvi/wave-racer path: /src/common/mod.rs pub trait Compile { fn compile(&mut self) -> &mut Self; } #[derive(Clone)] pub enum ByteOrder { Big = 0, Little = 1, } <|fim_suffix|>impl Chunk { pub fn new (byte_count: Option<u8>, offset : Option<u8>, name: &str, ...
code_fim
hard
{ "lang": "rust", "repo": "jpdvi/wave-racer", "path": "/src/common/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Chunk { pub fn new (byte_count: Option<u8>, offset : Option<u8>, name: &str, byte_order: ByteOrder, data : Option<String>, bytes : Option<Vec<u8>>) -> Chunk { Self { offset : offset, name : name.to_string(), by...
code_fim
hard
{ "lang": "rust", "repo": "jpdvi/wave-racer", "path": "/src/common/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: typed-io/cryptoxide path: /src/lib.rs // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distri...
code_fim
hard
{ "lang": "rust", "repo": "typed-io/cryptoxide", "path": "/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(feature = "blake2")] pub mod blake2b; #[cfg(feature = "blake2")] pub mod blake2s; #[cfg(feature = "chacha")] pub mod chacha; #[cfg(feature = "chacha")] pub mod chacha20; #[cfg(all(feature = "chacha", feature = "poly1305"))] pub mod chacha20poly1305; #[cfg(feature = "curve25519")] pub mod curve2...
code_fim
hard
{ "lang": "rust", "repo": "typed-io/cryptoxide", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(all(feature = "chacha", feature = "poly1305"))] pub mod chacha20poly1305; #[cfg(feature = "curve25519")] pub mod curve25519; #[cfg(feature = "x25519")] pub mod x25519; #[cfg(feature = "digest")] pub mod digest; pub mod hashing; pub mod drg; #[cfg(feature = "ed25519")] pub mod ed25519; #[cfg(fe...
code_fim
hard
{ "lang": "rust", "repo": "typed-io/cryptoxide", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl X3dhNewKeyExchanger { /// Create a new XXNewKeyExchanger pub fn new( vault_initiator: Arc<Mutex<dyn X3dhVault>>, vault_responder: Arc<Mutex<dyn X3dhVault>>, ) -> Self { Self { vault_initiator, vault_responder, } } } impl NewKeyE...
code_fim
hard
{ "lang": "rust", "repo": "kbeaulieu/ockam", "path": "/implementations/rust/ockam/ockam_key_exchange_x3dh/src/new_key_exchanger.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kbeaulieu/ockam path: /implementations/rust/ockam/ockam_key_exchange_x3dh/src/new_key_exchanger.rs use crate::{Initiator, Responder, X3dhVault}; use ockam_key_exchange_core::NewKeyExchanger; use std::sync::{Arc, Mutex}; /// Represents an XX NewKeyExchanger pub struct X3dhNewKeyExchanger { v...
code_fim
hard
{ "lang": "rust", "repo": "kbeaulieu/ockam", "path": "/implementations/rust/ockam/ockam_key_exchange_x3dh/src/new_key_exchanger.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: amrx101/mqttwrk path: /src/console/mod.rs use crate::link::{Link, Status}; use crate::ConsoleConfig; use rumqttc::{qos, Event, Outgoing}; use rustyline::error::ReadlineError; use rustyline::Editor; use std::collections::VecDeque; use std::io; use structopt::StructOpt; struct Console { link...
code_fim
hard
{ "lang": "rust", "repo": "amrx101/mqttwrk", "path": "/src/console/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, StructOpt)] enum Command { Publish(Publish), Subscribe(Subscribe), } #[derive(Debug, StructOpt)] struct Publish { /// topic to publish to #[structopt(short = "t", long = "topic")] topic: String, /// payload #[structopt(short = "p", long = "payload")] payloa...
code_fim
hard
{ "lang": "rust", "repo": "amrx101/mqttwrk", "path": "/src/console/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: saibatizoku/neuras path: /src/utils.rs //! Helpful utilities. use std::io; use std::thread; /// Function for spawing child-threads, ret<|fim_suffix|>+ 'static, { thread::Builder::new() .name(name.to_string()) .spawn(callback) }<|fim_middle|>urning the `thread::JoinHandle`. p...
code_fim
medium
{ "lang": "rust", "repo": "saibatizoku/neuras", "path": "/src/utils.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>thread::JoinHandle<T>, io::Error> where F: FnOnce() -> T, F: Send + 'static, T: Send + 'static, { thread::Builder::new() .name(name.to_string()) .spawn(callback) }<|fim_prefix|>// repo: saibatizoku/neuras path: /src/utils.rs //! Helpful utilities. use std::io; use std::thr...
code_fim
medium
{ "lang": "rust", "repo": "saibatizoku/neuras", "path": "/src/utils.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let num = str_num.parse::<i32>().expect("couldn't parse"); parsed_numbers.push(num); } parsed_numbers.sort(); if parsed_numbers[0] + parsed_numbers[1] > parsed_numbers[2] { count_good += 1; } } println!("Day 3 Part 1: {}", count_good); }<|fim_prefix|>// repo: boarder2/adventofcode2016 ...
code_fim
medium
{ "lang": "rust", "repo": "boarder2/adventofcode2016", "path": "/src/day3/part1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: boarder2/adventofcode2016 path: /src/day3/part1.rs use day3::input; pub fn run() { let input = input::get_input(); let lines = input.lines(); let mut count_good = 0; for line in lines { let str_numbers = line.split_whitespace(); let mut parsed_numbers = Vec::new(); for str_num in str...
code_fim
medium
{ "lang": "rust", "repo": "boarder2/adventofcode2016", "path": "/src/day3/part1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ed_numbers[0] + parsed_numbers[1] > parsed_numbers[2] { count_good += 1; } } println!("Day 3 Part 1: {}", count_good); }<|fim_prefix|>// repo: boarder2/adventofcode2016 path: /src/day3/part1.rs use day3::input; pub fn run() { let input = input::get_input(); let lines = input.lines(); let mut...
code_fim
medium
{ "lang": "rust", "repo": "boarder2/adventofcode2016", "path": "/src/day3/part1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { if cfg!(target_feature = "x") {} if cfg!(not(target_feature = "x")) {} }<|fim_prefix|>// repo: ebroto/cargo-minver path: /tests/lang_files/cfg_target_feature.rs #![allow(unused)] #[cfg(target_feature = "x")] fn fun() {} <|fim_middle|> #[cfg(not(target_feature = "x"))] fn not_fun() {}...
code_fim
easy
{ "lang": "rust", "repo": "ebroto/cargo-minver", "path": "/tests/lang_files/cfg_target_feature.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ebroto/cargo-minver path: /tests/lang_files/cfg_target_feature.rs #![allow(unused)] #[cfg(target_feature = "x")] fn fun() {} <|fim_suffix|> if cfg!(target_feature = "x") {} if cfg!(not(target_feature = "x")) {} }<|fim_middle|>#[cfg(not(target_feature = "x"))] fn not_fun() {} fn main() ...
code_fim
medium
{ "lang": "rust", "repo": "ebroto/cargo-minver", "path": "/tests/lang_files/cfg_target_feature.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lineCode/libsimpleservo path: /src/lib.rs extern crate servo; extern crate core_foundation; use std::ffi::CString; use servo::gl; use servo::BrowserId; use servo::Servo; use servo::servo_config::resource_files::set_resources_path; use servo::servo_config::opts; use servo::compositing::composit...
code_fim
hard
{ "lang": "rust", "repo": "lineCode/libsimpleservo", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn allow_navigation(&self, _id: BrowserId, _url: ServoUrl, chan: ipc::IpcSender<bool>) { chan.send(true).ok(); } fn set_inner_size(&self, _id: BrowserId, _size: Size2D<u32>) {} fn set_position(&self, _id: BrowserId, _point: Point2D<i32>) {} fn set_fullscreen_state(&self, _id: BrowserId, _s...
code_fim
hard
{ "lang": "rust", "repo": "lineCode/libsimpleservo", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl EventLoopWaker for SimpleEventLoopWaker { fn clone(&self) -> Box<EventLoopWaker + Send> { Box::new(SimpleEventLoopWaker(self.0)) } fn wake(&self) { (self.0)(); } } struct Callbacks { waker: Box<EventLoopWaker>, gl: Rc<gl::Gl>, flush_cb: extern fn(), si...
code_fim
hard
{ "lang": "rust", "repo": "lineCode/libsimpleservo", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: redstrike/fastcgi-client-rs path: /src/error.rs use crate::meta::{ProtocolStatus, RequestType}; pub type ClientResult<T> = Result<T, ClientError>; #[derive(Debug, thiserror::Error)] pub enum ClientError { /// Wapper of `tokio::io::Error` #[error(transparent)] Io(#[from] tokio::io::...
code_fim
hard
{ "lang": "rust", "repo": "redstrike/fastcgi-client-rs", "path": "/src/error.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Response not complete, first is protocol status and second is app status, see fastcgi protocol. #[error("New request rejected; too busy [OVERLOADED]; AppStatus: {app_status}")] EndRequestOverloaded { app_status: u32 }, /// Response not complete, first is protocol status and second is ...
code_fim
hard
{ "lang": "rust", "repo": "redstrike/fastcgi-client-rs", "path": "/src/error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl ClientError { pub(crate) fn new_end_request_with_protocol_status( protocol_status: ProtocolStatus, app_status: u32, ) -> Self { match protocol_status { ProtocolStatus::CantMpxConn => ClientError::EndRequestCantMpxConn { app_status }, ProtocolSta...
code_fim
hard
{ "lang": "rust", "repo": "redstrike/fastcgi-client-rs", "path": "/src/error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_assigned_slot() { let div: HtmlElement = Node::from_html("<div><span></span></div>") .unwrap() .try_into() .unwrap(); let span = div.query_selector("span").unwrap().unwrap(); let tpl: TemplateElement = Node::from_html("<te...
code_fim
hard
{ "lang": "rust", "repo": "mesalock-linux/crates-io", "path": "/vendor/stdweb/src/webapi/slotable.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mesalock-linux/crates-io path: /vendor/stdweb/src/webapi/slotable.rs use webcore::reference_type::ReferenceType; use webapi::html_elements::SlotElement; /// The Slotable mixin defines features that allow nodes to become the contents of /// a `<slot>` element — the following features are include...
code_fim
hard
{ "lang": "rust", "repo": "mesalock-linux/crates-io", "path": "/vendor/stdweb/src/webapi/slotable.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; use crate::impl_message_tests; fn make_deserialized_channel_endpoint_changed() -> ChannelEndpointChanged { ChannelEndpointChanged::new(5u32).unwrap() } fn make_serialized_channel_endpoint_changed() -> Vec<u8> { return vec![0x05, ...
code_fim
hard
{ "lang": "rust", "repo": "mason0510/rust-stratum-v2", "path": "/stratumv2/src/common/channel_endpoint_changed.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mason0510/rust-stratum-v2 path: /stratumv2/src/common/channel_endpoint_changed.rs use crate::{ codec::{ByteParser, Deserializable, Frameable, Serializable}, error::Result, impl_message, types::MessageType, }; use std::io; impl_message!( /// When a channel’s upstream or downs...
code_fim
hard
{ "lang": "rust", "repo": "mason0510/rust-stratum-v2", "path": "/stratumv2/src/common/channel_endpoint_changed.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AliveEngine/naga path: /src/front/glsl/lex.rs use super::parser::Token; use super::{preprocess::LinePreProcessor, token::TokenMetadata, types::parse_type}; use std::{iter::Enumerate, str::Lines}; fn _consume_str<'a>(input: &'a str, what: &str) -> Option<&'a str> { if input.starts_with(what)...
code_fim
hard
{ "lang": "rust", "repo": "AliveEngine/naga", "path": "/src/front/glsl/lex.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn new(input: &'a str) -> Self { let mut lexer = Lexer { lines: input.lines().enumerate(), input: "".to_string(), line: 0, offset: 0, inside_comment: false, pp: LinePreProcessor::new(), }; lexer.next_li...
code_fim
hard
{ "lang": "rust", "repo": "AliveEngine/naga", "path": "/src/front/glsl/lex.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> //TODO: preprocessor // if chars.next() == Some(cur) { // (Token::TokenPasting, chars.as_str(), start, start + 2) // } else { // (Token::Preprocessor, input, start, start + 1) // } } els...
code_fim
hard
{ "lang": "rust", "repo": "AliveEngine/naga", "path": "/src/front/glsl/lex.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ultimate-research/code-mod-framework-rs path: /src/saltynx/mod.rs use std::ffi::{CStr, CString}; use libc::{c_void, c_char}; use std::num::NonZeroU64; pub mod core; pub mod ipc; pub mod dynamic; pub use self::core::*; pub use self::ipc::*; pub use self::dynamic::*; pub type SwitchResult = u64...
code_fim
hard
{ "lang": "rust", "repo": "ultimate-research/code-mod-framework-rs", "path": "/src/saltynx/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.into_cstring().as_ptr() } } impl<T: AsRef<str>> IntoCString for T { fn into_cstring(&self) -> CString { CString::new(self.as_ref()).unwrap() } } impl IntoCString for CStr { fn into_cstring(&self) -> CString { CString::new(self.to_bytes()).unwrap() } }<|fi...
code_fim
hard
{ "lang": "rust", "repo": "ultimate-research/code-mod-framework-rs", "path": "/src/saltynx/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let file = OpenOptions::new() .read(true) .append(true) .create(true) .open(&path.join("engine_store")) .unwrap(); Ok(EngineStore { file }) } pub fn set(&mut self, engine: &str) { self.file.set_len(0).unwrap(); ...
code_fim
hard
{ "lang": "rust", "repo": "lromeo/rust_kvs", "path": "/src/bin/kvs-server.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lromeo/rust_kvs path: /src/bin/kvs-server.rs extern crate clap; use clap::{App, Arg}; use kvs::{Command, KvStore, KvsEngine, Logger, Response, Result, SledKvStore}; use std::fs::{File, OpenOptions}; use std::io::{Read, Write}; use std::net::TcpListener; use std::path::PathBuf; use std::str; #[...
code_fim
hard
{ "lang": "rust", "repo": "lromeo/rust_kvs", "path": "/src/bin/kvs-server.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if self.isContextual("await") && (self.inAsync() || (!self.inFunction() && self.options.allowAwaitOutsideFunction)) { expr = self.parseAwait(); sawUnary = true; } else if self.r#type.prefix { let node = self.startNode(); let update = self.r#type == tokentype::Toke...
code_fim
hard
{ "lang": "rust", "repo": "ryzokuken/cap", "path": "/src/expression.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ryzokuken/cap path: /src/expression.rs // A recursive descent parser operates by defining functions for all // syntactic elements, and recursively calling those, each function // advancing the input stream and returning an AST node. Precedence // of constructs (for example, the fact that `!x[1]`...
code_fim
hard
{ "lang": "rust", "repo": "ryzokuken/cap", "path": "/src/expression.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self, noIn: Option<bool>, refDestructuringErrors: Option<parseutil::DestructuringErrors>, ) -> node::Node { let startPos = self.start; let startLoc = self.startLoc; let expr = self.parseMaybeUnary(refDestructuringErrors, false); if self.checkExpressionErrors(refDestructuringE...
code_fim
hard
{ "lang": "rust", "repo": "ryzokuken/cap", "path": "/src/expression.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test_lowest_gap() { let ranges = vec![Range { from: 4, to: 6 }, Range { from: 5, to: 6 }, Range { from: 5, to: 8 }, Range { from: 16, to: 18 }, Range { from: 10, to: 16 }]; let rangeset = RangeSet::...
code_fim
hard
{ "lang": "rust", "repo": "mathw/adventofcode", "path": "/2016/aoc/src/day20/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let src2 = "5"; assert_eq!(Range::from_str(src2), Err("Not a valid range")); } #[test] fn test_rangeset_add_to_empty() { let mut rangeset = RangeSet::new(); let range = Range { from: 4, to: 6 }; rangeset.add_range(range); assert_eq!(rangeset.ranges.get(&4), Some(&range)); } #[t...
code_fim
hard
{ "lang": "rust", "repo": "mathw/adventofcode", "path": "/2016/aoc/src/day20/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mathw/adventofcode path: /2016/aoc/src/day20/mod.rs use std::str::FromStr; use std::collections::HashMap; use std::cmp::Ordering; pub fn do_day20(input: &str) { let ranges = input.lines() .map(|l| Range::from_str(l).unwrap()) .collect::<Vec<Range>>(); let rangeset = Rang...
code_fim
hard
{ "lang": "rust", "repo": "mathw/adventofcode", "path": "/2016/aoc/src/day20/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: phaylon/absorb path: /src/parser/structure.rs t value. /// /// Takes two sub-parsers and one combination function. On a successful parse, the combinator /// function receives both sub-parsers result values and must return a new result value. /// /// # Examples /// /// ```rust /// use absorb as a...
code_fim
hard
{ "lang": "rust", "repo": "phaylon/absorb", "path": "/src/parser/structure.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> test!( super::any( super::any( ::str_exact("foo"), ::str_exact("bar"), ), ::infer_void_parsed(::fail(::State::Complete, 23)), ), "foo" => (ok: "foo", ""), "bar" =...
code_fim
hard
{ "lang": "rust", "repo": "phaylon/absorb", "path": "/src/parser/structure.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: phaylon/absorb path: /src/parser/structure.rs parser = ab::combine( /// ab::char_any(), /// ab::char_any(), /// |a, b| (a, b), /// ); /// /// assert_eq!( /// ab::get("ab", &parser), /// Ok(( /// ('a', 'b'), /// ab::State::Complete, /// "", /// )) /...
code_fim
hard
{ "lang": "rust", "repo": "phaylon/absorb", "path": "/src/parser/structure.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>rate::core::pattern::pattern::{Gain, Pattern, Points}; use crate::core::events::triggers::{Destination, Source, TGTEvent, TGTEventData, TGTEventType, TransportEvent}; use crate::core::chuck::{ChucK, ChucKOps}; use crate::core::backends::busses::Busses; use crate::core::settings::{CurrentTheme, Interpolati...
code_fim
hard
{ "lang": "rust", "repo": "adamnemecek/tgtracker", "path": "/specs/src/frontend/editor/song_editor.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }