text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: N1ghtStorm/avtankeeper path: /src/main.rs use actix_web::{get, web, App, HttpResponse, HttpServer, Responder}; mod configuration; mod api; mod relations; mod configuration_tests; #[actix_web::main] async fn main() -> std::io::Result<()> { let url = "0.0.0.0:18086"; let app_state = web...
code_fim
hard
{ "lang": "rust", "repo": "N1ghtStorm/avtankeeper", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> relations::EdgeMap::new() } fn initialize_vertexes() -> relations::VertexMap { relations::VertexMap::new() } } /// Healthcheck endpoint #[get("/avtan")] async fn hi() -> impl Responder { HttpResponse::Ok().body(" ~-. ,,,; ...
code_fim
hard
{ "lang": "rust", "repo": "N1ghtStorm/avtankeeper", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn inkwell_working() { println!("Testing LLVM codegen..."); let context = Context::create(); let module = context.create_module("sum"); let builder = context.create_builder(); let execution_engine = module .create_jit_execution_engine(Op...
code_fim
hard
{ "lang": "rust", "repo": "CoreRC/rtsam", "path": "/src/codegen/mod.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CoreRC/rtsam path: /src/codegen/mod.rs #[cfg(all(codegen,test))] mod tests { // use super::*; use inkwell; use inkwell::builder::Builder; use inkwell::context::Context; use inkwell::execution_engine::{ExecutionEngine, JitFunction}; use inkwell::module::Module; use in...
code_fim
hard
{ "lang": "rust", "repo": "CoreRC/rtsam", "path": "/src/codegen/mod.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> println!("Hello, transport1!"); pretty_env_logger::init(); lib::example("transport1"); }<|fim_prefix|>// repo: paul-lysak/2019-10-rust-excercises path: /logging1/src/transport1.rs extern crate pretty_env_logger; //#[macro_use] extern crate log; <|fim_middle|>fn main() {
code_fim
easy
{ "lang": "rust", "repo": "paul-lysak/2019-10-rust-excercises", "path": "/logging1/src/transport1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: paul-lysak/2019-10-rust-excercises path: /logging1/src/transport1.rs extern crate pretty_env_logger; //#[macro_use] extern crate log; <|fim_suffix|> println!("Hello, transport1!"); pretty_env_logger::init(); lib::example("transport1"); }<|fim_middle|>fn main() {
code_fim
easy
{ "lang": "rust", "repo": "paul-lysak/2019-10-rust-excercises", "path": "/logging1/src/transport1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let handle = thread::spawn(move || { // ^^ may outlive borrowed value `v` // (if move not specified) println!("Here's a vector: {:?}", v); }); handle.join().unwrap(); }<|fim_prefix|>// repo: mboogerd/hello-rust path: /ch16/src/...
code_fim
medium
{ "lang": "rust", "repo": "mboogerd/hello-rust", "path": "/ch16/src/threads.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mboogerd/hello-rust path: /ch16/src/threads.rs use std::thread; use std::time::Duration; fn main() { let handle = thread::spawn(|| { for i in 1..10 { println!("hi number {} from the spawned thread", i); thread::sleep(Duration::from_millis(1)); } }...
code_fim
medium
{ "lang": "rust", "repo": "mboogerd/hello-rust", "path": "/ch16/src/threads.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AndrewMendezLacambra/rust-programming-contest-solutions path: /atcoder/arc094_d.rs use std::collections::BTreeSet; const MOD: usize = 998244353; fn main() { let s = std::io::stdin(); let mut sc = Scanner { stdin: s.lock() }; let s = sc .chars() .into_iter() ...
code_fim
hard
{ "lang": "rust", "repo": "AndrewMendezLacambra/rust-programming-contest-solutions", "path": "/atcoder/arc094_d.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut set = BTreeSet::new(); let n = s.len(); set.insert(s); loop { let mut next = BTreeSet::new(); for s in set.iter() { for i in 1..n { if s[i - 1] != s[i] { let mut s = s.clone(); let replace = match s...
code_fim
hard
{ "lang": "rust", "repo": "AndrewMendezLacambra/rust-programming-contest-solutions", "path": "/atcoder/arc094_d.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/run-pass/self/move-self.rs // run-pass struct S { x: String } <|fim_suffix|> pub fn bar(self) { println!("{}", self.x); } } pub fn main() { let x = S { x: "Hello!".to_string() }; x.foo(); }<|fim_middle|>impl S { pub...
code_fim
easy
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/run-pass/self/move-self.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn main() { let x = S { x: "Hello!".to_string() }; x.foo(); }<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/run-pass/self/move-self.rs // run-pass struct S { x: String } impl S { pub fn foo(self) { self.bar(); } <|fim_middle|> pub fn bar(self) ...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/run-pass/self/move-self.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>days * 60 * 24) as f64, state.as_mut(), false)?; println!(" r = {:?} km", prediction.position); println!(" ṙ = {:?} km.s⁻¹", prediction.velocity); } Ok(()) }<|fim_prefix|>// repo: mateder/sgp4 path: /examples/advanced.rs fn main() -> sgp4::Result<()> { let elements = sg...
code_fim
medium
{ "lang": "rust", "repo": "mateder/sgp4", "path": "/examples/advanced.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mateder/sgp4 path: /examples/advanced.rs fn main() -> sgp4::Result<()> { let elements = sgp4::Elements::from_tle( Some("MOLNIYA 1-36".to_owned()), "1 08195U 75081A 06176.33215444 .00000099 00000-0 11873-3 0 813".as_bytes(), "2 08195 64.1586 279.0717 6877146 26...
code_fim
medium
{ "lang": "rust", "repo": "mateder/sgp4", "path": "/examples/advanced.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut index = 0; for v in self.0.drain(..) { index = LuaWrapperValue(v).push_to_lua(lua); } index } } pub struct LuaWrapperTableValue(pub Vec<Value>); impl LuaPush for LuaWrapperTableValue { fn push_to_lua(mut self, lua: *mut lua_State) -> i32 { ...
code_fim
hard
{ "lang": "rust", "repo": "yunshangcao26/tdengine-1", "path": "/src/rp_wrapper.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub struct LuaWrapperVecValue(pub Vec<Value>); impl LuaPush for LuaWrapperVecValue { fn push_to_lua(mut self, lua: *mut lua_State) -> i32 { let mut index = 0; for v in self.0.drain(..) { index = LuaWrapperValue(v).push_to_lua(lua); } index } } pub stru...
code_fim
hard
{ "lang": "rust", "repo": "yunshangcao26/tdengine-1", "path": "/src/rp_wrapper.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yunshangcao26/tdengine-1 path: /src/rp_wrapper.rs use std::collections::HashMap; use libc; use std::hash::Hash; use tunm_proto::Value; use td_rlua::{self, LuaPush, lua_State}; /// the wrapper for push to lua #[derive(PartialEq, Clone)] pub struct LuaWrapperValue(pub Value); impl Eq for LuaWrap...
code_fim
hard
{ "lang": "rust", "repo": "yunshangcao26/tdengine-1", "path": "/src/rp_wrapper.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] pub struct EntryInfo { pub id: u32, pub schema_id: u32, pub data: serde_json::Value, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct EntryInfoWrapper { pub entry: EntryInfo, } #[derive(Clone, Debug, Deserialize, Seri...
code_fim
hard
{ "lang": "rust", "repo": "justinrubek/reform", "path": "/site/src/types.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: justinrubek/reform path: /site/src/types.rs use std::collections::HashMap; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] pub struct SchemaInfo { pub id: u32, pub data: serde_json::Value, pub name: String, } #[derive(Clone, Debug,...
code_fim
hard
{ "lang": "rust", "repo": "justinrubek/reform", "path": "/site/src/types.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] pub struct FormInfo { pub id: u32, pub name: String, pub fields: serde_json::Value, pub mappings: serde_json::Value, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct FormCreateInfo { pub name: String, pub field...
code_fim
hard
{ "lang": "rust", "repo": "justinrubek/reform", "path": "/site/src/types.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ForgottenMaster/aoc-2019 path: /aoc05.rs /// The value of the program input. const INPUT: i32 = 5; /// The initial state of the memory layout for the program. const INITIAL_MEMORY_LAYOUT: &'static [i32] = &[ 3,225,1,225,6,6,1100,1,238,225,104,0,1102,68,5,225,1101,71,12,225,1,117,166,224,10...
code_fim
hard
{ "lang": "rust", "repo": "ForgottenMaster/aoc-2019", "path": "/aoc05.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match input { 0 => Self::Position, 1 => Self::Immediate, _ => panic!("Parameter mode is not valid") } } } /// Represents a single parameter in an operation. A parameter will contain a mode /// along with a value. #[derive(Debug)] struct P...
code_fim
hard
{ "lang": "rust", "repo": "ForgottenMaster/aoc-2019", "path": "/aoc05.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Component for PointLight { type Storage = HashMapStorage<Self>; }<|fim_prefix|>// repo: msiglreith/hati path: /src/scene/light.rs use specs::prelude::*; use winapi::shared::minwindef::UINT; use winapi::um::d3d12::*; use wio::com::ComPtr; pub struct LightDataBuffer { pub point_buffer: ComPtr...
code_fim
easy
{ "lang": "rust", "repo": "msiglreith/hati", "path": "/src/scene/light.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: msiglreith/hati path: /src/scene/light.rs use specs::prelude::*; use winapi::shared::minwindef::UINT; use winapi::um::d3d12::*; use wio::com::ComPtr; <|fim_suffix|>pub struct PointLight { pub intensity: f32, } impl Component for PointLight { type Storage = HashMapStorage<Self>; }<|fim_...
code_fim
medium
{ "lang": "rust", "repo": "msiglreith/hati", "path": "/src/scene/light.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub struct PointLight { pub intensity: f32, } impl Component for PointLight { type Storage = HashMapStorage<Self>; }<|fim_prefix|>// repo: msiglreith/hati path: /src/scene/light.rs use specs::prelude::*; use winapi::shared::minwindef::UINT; use winapi::um::d3d12::*; use wio::com::ComPtr; <|fim_...
code_fim
medium
{ "lang": "rust", "repo": "msiglreith/hati", "path": "/src/scene/light.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match &self.outbound_rx { Some(rx) => match rx.lock() { Ok(l) => { while l.len() > 0 { match l.try_recv() { Ok(msg) => match s.write(&msg.to_bytes()) { ...
code_fim
hard
{ "lang": "rust", "repo": "capital-prawn/interactive-broke-rs", "path": "/src/socket.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn send_raw(&mut self, message: &[u8]) -> Result<(), Error> { match &mut self.stream { Some(ref mut s) => { let b = s.write(&message)?; debug!("Wrote {} bytes", b); Ok(()) } None => Err(anyhow!("No stream t...
code_fim
hard
{ "lang": "rust", "repo": "capital-prawn/interactive-broke-rs", "path": "/src/socket.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: capital-prawn/interactive-broke-rs path: /src/socket.rs use crate::message::{InboundMessage, Message}; use anyhow::Error; use anyhow::*; use crossbeam_channel::{unbounded, Receiver, Sender}; use log::{debug, error, info}; use std::net::TcpStream; use std::{ io::Write, sync::{Arc, Mutex},...
code_fim
hard
{ "lang": "rust", "repo": "capital-prawn/interactive-broke-rs", "path": "/src/socket.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn slash_object(self, object: impl AsRef<str>) -> Result<Self> { Ok(self .join_segment("o")? .join_segment(&encode::slash(object))?) } }<|fim_prefix|>// repo: NathanHowell/google-cloud-storage-rs path: /src/urls.rs use crate::encode; use crate::Result; use url::Url...
code_fim
hard
{ "lang": "rust", "repo": "NathanHowell/google-cloud-storage-rs", "path": "/src/urls.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn bucket(self, bucket: impl AsRef<str>) -> Result<Self> { Ok(self .join_segment("b")? .join_segment(&encode::normal(bucket))?) } fn object(self, object: impl AsRef<str>) -> Result<Self> { Ok(self .join_segment("o")? .join_segmen...
code_fim
hard
{ "lang": "rust", "repo": "NathanHowell/google-cloud-storage-rs", "path": "/src/urls.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: NathanHowell/google-cloud-storage-rs path: /src/urls.rs use crate::encode; use crate::Result; use url::Url; pub(crate) trait Urls: Sized { fn join_segment(self, segment: impl AsRef<str>) -> crate::Result<Self>; fn bucket(self, bucket: impl AsRef<str>) -> Result<Self>; fn object(self...
code_fim
hard
{ "lang": "rust", "repo": "NathanHowell/google-cloud-storage-rs", "path": "/src/urls.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let res = StoreEvalResult::from_json(&json); assert!(res.is_ok()); let result_b = res.unwrap(); assert_eq!(result_a, result_b); } #[test] fn test_eval_result_serialize_bytes() { let result_a = StoreEvalResult::default(); let res = result_a.to_bytes(); assert!(res.is_ok()...
code_fim
hard
{ "lang": "rust", "repo": "rust-chainblock/mitrid-core", "path": "/tests/io/store/eval/eval_result.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let result_a = StoreEvalResult::default(); let res = result_a.to_json(); assert!(res.is_ok()); let json = res.unwrap(); let res = StoreEvalResult::from_json(&json); assert!(res.is_ok()); let result_b = res.unwrap(); assert_eq!(result_a, result_b); } #[test] fn test_...
code_fim
hard
{ "lang": "rust", "repo": "rust-chainblock/mitrid-core", "path": "/tests/io/store/eval/eval_result.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-chainblock/mitrid-core path: /tests/io/store/eval/eval_result.rs use mitrid_core::base::Sizable; use mitrid_core::base::Checkable; use mitrid_core::base::Serializable; use fixture::io::Session; use fixture::io::store::{StoreEvalResult, DumpSessions, DumpItems, DumpAll}; #[test] fn test_ev...
code_fim
hard
{ "lang": "rust", "repo": "rust-chainblock/mitrid-core", "path": "/tests/io/store/eval/eval_result.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: RUSTools/hypergraph path: /tests/common/mod.rs #![deny(unsafe_code, nonstandard_style)] <|fim_suffix|>impl<'a> Display for Vertex<'a> { fn fmt(&self, f: &mut Formatter<'_>) -> Result { write!(f, "{}", self) } }<|fim_middle|>use std::fmt::{Display, Formatter, Result}; #[derive(D...
code_fim
hard
{ "lang": "rust", "repo": "RUSTools/hypergraph", "path": "/tests/common/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: RUSTools/hypergraph path: /tests/common/mod.rs #![deny(unsafe_code, nonstandard_style)] use std::fmt::{Display, Formatter, Result}; <|fim_suffix|>impl<'a> Vertex<'a> { pub fn new(name: &'a str) -> Self { Vertex { name } } } impl<'a> Display for Vertex<'a> { fn fmt(&self, f...
code_fim
medium
{ "lang": "rust", "repo": "RUSTools/hypergraph", "path": "/tests/common/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a> Display for Vertex<'a> { fn fmt(&self, f: &mut Formatter<'_>) -> Result { write!(f, "{}", self) } }<|fim_prefix|>// repo: RUSTools/hypergraph path: /tests/common/mod.rs #![deny(unsafe_code, nonstandard_style)] <|fim_middle|>use std::fmt::{Display, Formatter, Result}; #[derive(D...
code_fim
hard
{ "lang": "rust", "repo": "RUSTools/hypergraph", "path": "/tests/common/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CasterLumos/SecretNumber path: /src/main.rs use std::io; use rand::Rng; use std::cmp::Ordering; fn main() { println!("Adivinhe o número!"); let numero_secreto = rand::thread_rng().gen_range(1..101); //gera um inteiro entre 1 e 100, pode usar 1..=100 <|fim_suffix|> ...
code_fim
hard
{ "lang": "rust", "repo": "CasterLumos/SecretNumber", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let chute: u32 = match chute.trim().parse(){ Ok(num) => num, Err(_) => { println!("Você deve digital um número!"); continue; } }; println!("O seu chute foi: {}", chute); match chute.cmp(&numero_secreto) ...
code_fim
hard
{ "lang": "rust", "repo": "CasterLumos/SecretNumber", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> io::stdin() // sem o importação com o use std::io; podemos utilizar std::io::stdin() .read_line(&mut chute) // receber a entrada do usuario e inserir na string chute .expect("Não foi possível ler a linha"); // fará com que o programa trave e exiba "Failed to read line" ...
code_fim
hard
{ "lang": "rust", "repo": "CasterLumos/SecretNumber", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: doitian/ckb path: /util/types/src/core/tx_pool.rs //! Tx-pool shared type define. use crate::core::{ error::{OutPointError, TransactionError}, Capacity, Cycle, FeeRate, }; use crate::packed::Byte32; use crate::{core, H256}; use ckb_error::{ impl_error_conversion_with_kind, prelude::*...
code_fim
hard
{ "lang": "rust", "repo": "doitian/ckb", "path": "/util/types/src/core/tx_pool.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Expired #[error("Expiry transaction, timestamp {0}")] Expiry(u64), } fn is_malformed_from_verification(error: &Error) -> bool { match error.kind() { ErrorKind::Transaction => error .downcast_ref::<TransactionError>() .expect("error kind checked") ...
code_fim
hard
{ "lang": "rust", "repo": "doitian/ckb", "path": "/util/types/src/core/tx_pool.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ikysil/rust99 path: /arithmetic/P39/src/lib.rs use P35::PrimeIterator; pub fn list_primes_in_range(lower: u32, upper: u32) -> Vec<u32> { PrimeIterator::new() .skip_while(|&p| p < lower) .take_while(|&p| p <= upper) .collect() } <|fim_suffix|> assert_eq!( ...
code_fim
medium
{ "lang": "rust", "repo": "ikysil/rust99", "path": "/arithmetic/P39/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!( list_primes_in_range(7, 31), vec![7, 11, 13, 17, 19, 23, 29, 31] ); } }<|fim_prefix|>// repo: ikysil/rust99 path: /arithmetic/P39/src/lib.rs use P35::PrimeIterator; pub fn list_primes_in_range(lower: u32, upper: u32) -> Vec<u32> { PrimeIterator...
code_fim
medium
{ "lang": "rust", "repo": "ikysil/rust99", "path": "/arithmetic/P39/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jakubbaron/advent_of_code path: /2015/day-04/src/main.rs use std::io::{self}; fn md5_starts_with(line: &str, starts_with: &str) -> usize { let mut number = 1; loop { let digest = md5::compute(format!("{}{}", line, number)); let md5_str = format!("{:x}", digest); ...
code_fim
medium
{ "lang": "rust", "repo": "jakubbaron/advent_of_code", "path": "/2015/day-04/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let files_results = vec![ ("test.txt", 609043, 6742839), ("test2.txt", 1048970, 5714438), ("input.txt", 346386, 9958218), ]; for (f, result_1, result_2) in files_results.into_iter() { println!("File: {}", f); let file_content: Vec<String> = std::fs::read...
code_fim
medium
{ "lang": "rust", "repo": "jakubbaron/advent_of_code", "path": "/2015/day-04/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let response = server .oauth2_introspection(&client, request) .await .map_err(HttpError::bad_request)?; server.response_json_untyped(response.serialize_json()) }) }<|fim_prefix|>// repo: mojzu/sso path: /sso/http_server/route_oauth2/introspect.rs u...
code_fim
hard
{ "lang": "rust", "repo": "mojzu/sso", "path": "/sso/http_server/route_oauth2/introspect.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mojzu/sso path: /sso/http_server/route_oauth2/introspect.rs use crate::http_server::internal::*; #[api_v2_operation(summary = "OAuth2 token introspection endpoint")] pub(crate) async fn post_form( server: Data<HttpServer>, req: HttpRequest, auth: BasicAuth, body: Form<RequestOau...
code_fim
hard
{ "lang": "rust", "repo": "mojzu/sso", "path": "/sso/http_server/route_oauth2/introspect.rs", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: osa1/flow path: /src/test_utils.rs use std::fs; use std::io::Read; pub fn is_lua_file(s : &str) -> bool { let len = s.len(); len > 4 && &s[ len - 4 .. ] == ".lua" } <|fim_suffix|> for file_ in fs::read_dir(&bench_files_dir).unwrap() { let file = file_.unwrap(); let f...
code_fim
medium
{ "lang": "rust", "repo": "osa1/flow", "path": "/src/test_utils.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for file_ in fs::read_dir(&bench_files_dir).unwrap() { let file = file_.unwrap(); let fname_os = file.file_name(); let fname = fname_os.to_str().unwrap(); if is_lua_file(fname) { let mut path = bench_files_dir.clone(); path.push_str(fname); ...
code_fim
medium
{ "lang": "rust", "repo": "osa1/flow", "path": "/src/test_utils.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Santhoshkumar-p/inc path: /rs/src/main.rs extern crate getopts; extern crate inc; use getopts::Options; use inc::{ cli::{run, Action::*}, core::Config, }; use std::{ env, io::{self, Read}, process::exit, }; fn main() { let args: Vec<String> = env::args().collect(); ...
code_fim
hard
{ "lang": "rust", "repo": "Santhoshkumar-p/inc", "path": "/rs/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut program = String::new(); io::stdin().read_to_string(&mut program).expect("Expected a program in stdin"); let config = Config { program, output }; let action = if parse { Parse } else if asm { GenASM } else { Run }; // Run the entire CLI wi...
code_fim
hard
{ "lang": "rust", "repo": "Santhoshkumar-p/inc", "path": "/rs/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let action = if parse { Parse } else if asm { GenASM } else { Run }; // Run the entire CLI with config match run(&config, action) { Err(e) => { println!("{}", e); exit(1) } Ok(Some(out)) => println!("{}", out)...
code_fim
hard
{ "lang": "rust", "repo": "Santhoshkumar-p/inc", "path": "/rs/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shepmaster/snafu path: /src/futures/mod.rs //! Additions to the [`TryFuture`] and [`TryStream`] traits. //! //! This module is only available when the `futures` [feature flag] is //! enabled. //! //! [`TryFuture`]: futures_core_crate::TryFuture //! [`TryStream`]: futures_core_crate::TryStream //...
code_fim
easy
{ "lang": "rust", "repo": "shepmaster/snafu", "path": "/src/futures/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[doc(inline)] pub use self::try_future::TryFutureExt; #[doc(inline)] pub use self::try_stream::TryStreamExt;<|fim_prefix|>// repo: shepmaster/snafu path: /src/futures/mod.rs //! Additions to the [`TryFuture`] and [`TryStream`] traits. //! //! This module is only available when the `futures` [feature fla...
code_fim
easy
{ "lang": "rust", "repo": "shepmaster/snafu", "path": "/src/futures/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>nchanged() { println!("Creating file chunk.{}.{}.{}.cf", p, q, r); let mut cf = File::create(format!("chunk.{}.{}.{}.cf", p, q, r)).unwrap(); println!("Writing chunk ({}, {}, {})", p, q, r); chunk.write_to(&mut cf).unwrap(); t...
code_fim
hard
{ "lang": "rust", "repo": "min4builder/craft-server", "path": "/src/world/map.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: min4builder/craft-server path: /src/world/map.rs use byteorder::{ReadBytesExt, WriteBytesExt, NetworkEndian}; use super::block::Block; use super::chunk::Chunk; use super::coords::Coords; use super::worldgen::Worldgen; use std::collections::HashMap; use std::fs::File; use std::io::BufReader; pub...
code_fim
hard
{ "lang": "rust", "repo": "min4builder/craft-server", "path": "/src/world/map.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-comments-removed path: /third_party/rust/tokio/src/runtime/queue.rs use crate::loom::cell::UnsafeCell; use crate::loom::sync::atomic::{AtomicU16, AtomicU32}; use crate::loom::sync::Arc; use crate::runtime::task::{self, Inject}; use crate::runtime::MetricsBatch; use std::mem:...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-comments-removed", "path": "/third_party/rust/tokio/src/runtime/queue.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> let task = self.0.buffer[src_idx].with(|ptr| unsafe { ptr::read((*ptr).as_ptr()) }); dst.inner.buffer[dst_idx] .with_mut(|ptr| unsafe { ptr::write((*ptr).as_mut_ptr(), task) }); } let mut prev_pac...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-comments-removed", "path": "/third_party/rust/tokio/src/runtime/queue.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> for (id, filename) in &self.images_associations { write!(associations_writer, "{}={}\n", id, filename).unwrap(); } for image_descriptor in &self.images_base { image_descriptor.to_file(&mut base_writer); } associations_writer = match self...
code_fim
hard
{ "lang": "rust", "repo": "kloumpt/sri_rs", "path": "/src/includes/context_types.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kloumpt/sri_rs path: /src/includes/context_types.rs static MIN_WORD_SIZE: &'static str = "0"; static MAX_WORD_PER_TEXT: &'static str = "100000"; pub struct ContextObject { max_doc_id: u64, config: HashMap<String, String>, images_associations: HashMap<String, String>, sounds_asso...
code_fim
hard
{ "lang": "rust", "repo": "kloumpt/sri_rs", "path": "/src/includes/context_types.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> } } None => panic!("Can't find parameter 'images_associations_filename' in config"), }; let mut file_reader = match self.get_param("images_base_filename") { Some(value) => { match File::open(format!("{}/{}", index_path, v...
code_fim
hard
{ "lang": "rust", "repo": "kloumpt/sri_rs", "path": "/src/includes/context_types.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>6f4f32f9ec90", (32, 2, [0xeb1befc2, 0x27a2fd0c], [0xb67535bd, 0x54d401d4]), "5073e696de27a6b0ad79ccc891dbf522d4a115910e08aadadd08a810b408a315" ), ( // Len = 624 "986bf1de16aa152e1564600e4cf0fea085f5e66733aa957bec6f3835cfc201632def3e40994f6eafb4cfb9fdbcb89d3daa83a5dd29365811a68c47724e44d178340cb9...
code_fim
hard
{ "lang": "rust", "repo": "glatan/ghash", "path": "/crate/hash/blake2/tests/blake2s/short_msg_kat_key.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: glatan/ghash path: /crate/hash/blake2/tests/blake2s/short_msg_kat_key.rs f1de1131e451a5888e67efeeb34286e0197afc25f0195edef0acc7769e14aa90f3b8bdd709625c93c94782798505569f7b4ec56b68244654d00eca6a2371f61229b4e62f123ec2d885414d0b46a3a7c1f26c2d568c73a7587d6ebf9cdbb6ab0166913175cfef4d51319b59773b00382...
code_fim
hard
{ "lang": "rust", "repo": "glatan/ghash", "path": "/crate/hash/blake2/tests/blake2s/short_msg_kat_key.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>69126ee11d85c143cfccad7485ac436e7a628f3c45be1449dd549810a335fcdc185b8d25e14e2960dad6951072a87eed0b0de9107bfd1a4911b269b4a81640b061dd9602dbcf73a695d8b71870f5b53bb35e4c3f5b26487cd861e18077f1f0a98f96bc6b65efc1bbb84", (32, 25, [0xccf96b6a, 0x0c06506f], [0x8d4de94d, 0x028a3d09]), "44d34b5ea4877b58a9b52cc67...
code_fim
hard
{ "lang": "rust", "repo": "glatan/ghash", "path": "/crate/hash/blake2/tests/blake2s/short_msg_kat_key.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub use ncollide2d as collide;<|fim_prefix|>// repo: kofmatsugen/aabb path: /src/lib.rs pub mod bundle; mod components; #[cfg(feature = "debug")] pub mod debug; pub mod event; pub(crate) mod system; pub mod traits; pub mod types; <|fim_middle|>#[cfg(feature = "debug")] pub(crate) use components::collisi...
code_fim
medium
{ "lang": "rust", "repo": "kofmatsugen/aabb", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kofmatsugen/aabb path: /src/lib.rs pub mod bundle; mod components; #[cfg(feature = "debug")] pub mod debug; pub mod event; pub(crate) mod system; pub mod traits; pub mod types; <|fim_suffix|>pub use ncollide2d as collide;<|fim_middle|>#[cfg(feature = "debug")] pub(crate) use components::collisi...
code_fim
medium
{ "lang": "rust", "repo": "kofmatsugen/aabb", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ju6ge/atsame70q21 path: /src/pwm0/pwm_etrg2.rs #[doc = "Reader of register PWM_ETRG2"] pub type R = crate::R<u32, super::PWM_ETRG2>; #[doc = "Writer for register PWM_ETRG2"] pub type W = crate::W<u32, super::PWM_ETRG2>; #[doc = "Register PWM_ETRG2 `reset()`'s with value 0"] impl crate::ResetValu...
code_fim
hard
{ "lang": "rust", "repo": "ju6ge/atsame70q21", "path": "/src/pwm0/pwm_etrg2.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match variant { TRGEDGE_A::FALLING_ZERO => false, TRGEDGE_A::RISING_ONE => true, } } } #[doc = "Reader of field `TRGEDGE`"] pub type TRGEDGE_R = crate::R<bool, TRGEDGE_A>; impl TRGEDGE_R { #[doc = r"Get enumerated values variant"] #[inline(always)] p...
code_fim
hard
{ "lang": "rust", "repo": "ju6ge/atsame70q21", "path": "/src/pwm0/pwm_etrg2.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // For body for stmt in body { Self::desugar(stmt, &mut new_body); } let top = DExpression::Block(new_body, Box::new(DExpression::None)); let top = DStatement::Expression(top); buf.push(top); } pub fn desugar(stmt: &Statement, buf: &mut...
code_fim
hard
{ "lang": "rust", "repo": "bwhetherington/rscript", "path": "/src/parser/desugar.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let top = DExpression::Block(new_body, Box::new(DExpression::None)); let top = DStatement::Expression(top); buf.push(top); } pub fn desugar(stmt: &Statement, buf: &mut Vec<DStatement>) { match stmt { Statement::Reassignment { location, value } => { ...
code_fim
hard
{ "lang": "rust", "repo": "bwhetherington/rscript", "path": "/src/parser/desugar.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bwhetherington/rscript path: /src/parser/desugar.rs #![allow(unused)] use crate::parser::{BinaryOp, Expression, Statement, UnaryOp, Visibility}; use std::rc::Rc; type Str = Rc<str>; #[derive(Clone, Debug)] pub enum DExpression { Number(f64), Boolean(bool), Identifier(Str), Pat...
code_fim
hard
{ "lang": "rust", "repo": "bwhetherington/rscript", "path": "/src/parser/desugar.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let input = read_input_as_string(2022, 2).unwrap(); println!("{}", total_score_part1(&input)); println!("{}", total_score_part2(&input)); } #[cfg(test)] mod test { use super::{total_score_part1, total_score_part2}; const SAMPLE: &str = "A Y\nB X\nC Z"; #[test] fn test() { ...
code_fim
hard
{ "lang": "rust", "repo": "carodewig/advent-of-code", "path": "/advent-rs/2022/src/bin/day_02.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: carodewig/advent-of-code path: /advent-rs/2022/src/bin/day_02.rs /// day 2: rock paper scissors use common::read_input_as_string; #[derive(Clone, Copy, Hash, PartialEq, Eq)] enum Shape { Rock, Paper, Scissors, } impl Shape { fn from_str(s: &str) -> Self { match s { ...
code_fim
hard
{ "lang": "rust", "repo": "carodewig/advent-of-code", "path": "/advent-rs/2022/src/bin/day_02.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> input .split('\n') .map(|line| { let mut elems = line.split(' '); let opponent = Shape::from_str(elems.next().unwrap()); let target_result = GameResult::from_str(elems.next().unwrap()); let play = Shape::play_vs_other_for_result(opponent,...
code_fim
hard
{ "lang": "rust", "repo": "carodewig/advent-of-code", "path": "/advent-rs/2022/src/bin/day_02.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn inner_perft(board: &mut Board, depth: u16) -> u64 { let moves: MoveList = board.generate_moves(); if depth == 1 { return moves.len() as u64; } let mut count: u64 = 0; for mov in moves { board.apply_move(mov); count += inner_perft(board, depth - 1); ...
code_fim
hard
{ "lang": "rust", "repo": "laldon/Pleco", "path": "/pleco/src/board/perft.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: laldon/Pleco path: /pleco/src/board/perft.rs //! perft, or Performance Test, Move Path Enumeration, tests the correctness of move-generation. //! //! Use these functions on a `Board` to test that the correct amount of leaf nodes are created. use super::{Board,MoveList}; /// Holds all informati...
code_fim
hard
{ "lang": "rust", "repo": "laldon/Pleco", "path": "/pleco/src/board/perft.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn start_pos_perft_all() { let b: Board = Board::default(); check_perft(perft_all(&b,3), 8902, 34, 0, 0, 12, 0); check_perft(perft_all(&b,4), 197_281, 1576, 0, 0, 469, 8); check_perft(perft_all(&b,5), ...
code_fim
hard
{ "lang": "rust", "repo": "laldon/Pleco", "path": "/pleco/src/board/perft.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stravid/plaintext-gtd-rust path: /src/store.rs use crate::task::State; use crate::task::Task; use crate::uuid::Uuid; pub struct Store { connection: sqlite::Connection, } impl Store { pub fn default(connection: sqlite::Connection) -> Self { Self::migrate(&connection); S...
code_fim
hard
{ "lang": "rust", "repo": "stravid/plaintext-gtd-rust", "path": "/src/store.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> statement.bind(1, task.uuid).unwrap(); statement.bind(2, &task.text[..]).unwrap(); statement.bind(3, task.state.clone()).unwrap(); statement.bind(4, &task.text[..]).unwrap(); statement.bind(5, task.state).unwrap(); statement.next().unwrap(); } fn m...
code_fim
hard
{ "lang": "rust", "repo": "stravid/plaintext-gtd-rust", "path": "/src/store.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn c<'a>(x: &'a u32) -> &'a u32 { // OK: used twice &22 } fn main() { }<|fim_prefix|>// repo: unnsa/rust path: /src/test/ui/single-use-lifetime/two-uses-in-fn-argument-and-return.rs // Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distributi...
code_fim
medium
{ "lang": "rust", "repo": "unnsa/rust", "path": "/src/test/ui/single-use-lifetime/two-uses-in-fn-argument-and-return.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: unnsa/rust path: /src/test/ui/single-use-lifetime/two-uses-in-fn-argument-and-return.rs // Copyright 2016 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, Vers...
code_fim
medium
{ "lang": "rust", "repo": "unnsa/rust", "path": "/src/test/ui/single-use-lifetime/two-uses-in-fn-argument-and-return.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Jordan-Rowland/rust-sandbox path: /numbers/src/lib.rs pub fn print_nums(limit: u8) { let nums = generate_sequence(limit); // let nums = [1, 2, 3, 4, 5]; output_sequence(&nums) } fn output_sequence(numbers: &[u8]) { for number in numbers { println!("{}", number) } } ...
code_fim
easy
{ "lang": "rust", "repo": "Jordan-Rowland/rust-sandbox", "path": "/numbers/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> (1..=limit).collect(); } #[test] fn generate_sequence_should_work() { let result = generate_sequence(3); assert_eq!(result, &[1, 2, 3]); }<|fim_prefix|>// repo: Jordan-Rowland/rust-sandbox path: /numbers/src/lib.rs pub fn print_nums(limit: u8) { let nums = generate_sequence(limit); /...
code_fim
medium
{ "lang": "rust", "repo": "Jordan-Rowland/rust-sandbox", "path": "/numbers/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Should print "Retry-After: ..." println!("{}", headers); } fn main() { retry_after_delay(); retry_after_datetime(); }<|fim_prefix|>// repo: pimeys/retry-after path: /examples/build_header.rs extern crate chrono; extern crate hyper; extern crate retry_after; use chrono::{Duration, UTC...
code_fim
hard
{ "lang": "rust", "repo": "pimeys/retry-after", "path": "/examples/build_header.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pimeys/retry-after path: /examples/build_header.rs extern crate chrono; extern crate hyper; extern crate retry_after; <|fim_suffix|>fn retry_after_delay() { let mut headers = Headers::new(); headers.set(RetryAfter::Delay(Duration::seconds(300))); // Should print "Retry-After: 300" ...
code_fim
medium
{ "lang": "rust", "repo": "pimeys/retry-after", "path": "/examples/build_header.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: filippixavier/AoC2019 path: /src/days/day15.rs use std::error::Error; use std::fs; use std::path::Path; use std::collections::HashMap; use super::intcode; #[derive(Debug, Clone, Copy, PartialEq)] enum Tile { Empty(usize), Wall, Oxygen(usize), Unknown, Start, } type Coordi...
code_fim
hard
{ "lang": "rust", "repo": "filippixavier/AoC2019", "path": "/src/days/day15.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn second_star() -> Result<(), Box<dyn Error + 'static>> { use Tile::*; let (mut area, _, position) = explore_map(intcode::Intcode::new_with_path(fs::read_to_string( Path::new("./data/day15.txt"), )?)); area.insert(position, Oxygen(0)); let mut to_explore = vec![position]...
code_fim
hard
{ "lang": "rust", "repo": "filippixavier/AoC2019", "path": "/src/days/day15.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> use Tile::*; let mut min_x: Option<i32> = None; let mut min_y: Option<i32> = None; let mut max_x: Option<i32> = None; let mut max_y: Option<i32> = None; for (x, y) in area.keys() { min_x = if let Some(min_x) = min_x { Some(std::cmp::min(*x, min_x)) } els...
code_fim
hard
{ "lang": "rust", "repo": "filippixavier/AoC2019", "path": "/src/days/day15.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ht32-rs/ht32-rs-nightlies path: /ht32f5xxxx/src/ht32f52231_41/exti/wakupcr.rs #[doc = "Register `WAKUPCR` reader"] pub struct R(crate::R<WAKUPCR_SPEC>); impl core::ops::Deref for R { type Target = crate::R<WAKUPCR_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &s...
code_fim
hard
{ "lang": "rust", "repo": "ht32-rs/ht32-rs-nightlies", "path": "/ht32f5xxxx/src/ht32f52231_41/exti/wakupcr.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> EXTI6WEN_R::new(((self.bits >> 6) & 1) != 0) } #[doc = "Bit 7 - EXTI7WEN"] #[inline(always)] pub fn exti7wen(&self) -> EXTI7WEN_R { EXTI7WEN_R::new(((self.bits >> 7) & 1) != 0) } #[doc = "Bit 8 - EXTI8WEN"] #[inline(always)] pub fn exti8wen(&self) -> EXTI8WEN_R...
code_fim
hard
{ "lang": "rust", "repo": "ht32-rs/ht32-rs-nightlies", "path": "/ht32f5xxxx/src/ht32f52231_41/exti/wakupcr.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: foxfriends/game-engine path: /rust/src/visuals/system/mod.rs //! The actual implementation of the [`Visuals`] system use std::collections::HashMap; use std::thread; use std::path::PathBuf; use std::sync::{Arc, RwLock}; use std::sync::mpsc::{channel, Sender}; use specs::prelude::*; use sdl2::ren...
code_fim
hard
{ "lang": "rust", "repo": "foxfriends/game-engine", "path": "/rust/src/visuals/system/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn render_tile_grid_to_file<'a>(path: &PathBuf, tile_size: Dimen, size: Dimen, tiles: impl Iterator<Item = &'a Option<Tile>>) -> crate::Result<()> { let mut surface = Surface::new( size.width * tile_size.width, size.height * tile_size.height, PixelFormatEnum::RGBA8888, )?; ...
code_fim
hard
{ "lang": "rust", "repo": "foxfriends/game-engine", "path": "/rust/src/visuals/system/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl PartialEq for Box<dyn Pattern> { fn eq(&self, other: &Box<dyn Pattern>) -> bool { self.pattern_eq(other.as_any()) } }<|fim_prefix|>// repo: y2k4life/rustic_ray path: /src/ray_tracing/patterns/pattern.rs use crate::{shapes::Shape, Color, Matrix, Point}; use std::any::Any; use std::fmt...
code_fim
hard
{ "lang": "rust", "repo": "y2k4life/rustic_ray", "path": "/src/ray_tracing/patterns/pattern.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: y2k4life/rustic_ray path: /src/ray_tracing/patterns/pattern.rs use crate::{shapes::Shape, Color, Matrix, Point}; use std::any::Any; use std::fmt; pub trait Pattern: Send + Any + fmt::Debug { fn pattern_eq(&self, other: &dyn Any) -> bool; fn as_any(&self) -> &dyn Any; <|fim_suffix|> ...
code_fim
medium
{ "lang": "rust", "repo": "y2k4life/rustic_ray", "path": "/src/ray_tracing/patterns/pattern.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn pattern_at(&self, point: Point) -> Color; fn pattern_at_object(&self, object: &dyn Shape, word_point: Point) -> Color { let object_point = object.transform().inverse() * word_point; let pattern_point = self.transform().inverse() * object_point; self.pattern_at(pattern_...
code_fim
medium
{ "lang": "rust", "repo": "y2k4life/rustic_ray", "path": "/src/ray_tracing/patterns/pattern.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let o = Order::read("F", "OWLBAT", "-123", "87.125", 99).unwrap(); assert_eq!("F", o.participant); assert_eq!("OWLBAT", o.instrument); assert_eq!(123, o.quantity); assert_eq!(123, o.remaining); assert_eq!(87.125, o.price); assert_eq!(false, o.is_buy)...
code_fim
medium
{ "lang": "rust", "repo": "GaryHughes/Exchange", "path": "/part_1/rust_solution/src/order.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: GaryHughes/Exchange path: /part_1/rust_solution/src/order.rs use std::error::Error; #[derive(Debug, PartialEq)] pub struct Order { pub gen: usize, pub participant: String, pub instrument: String, pub quantity: i64, pub remaining: i64, pub price: f32, pub is_buy: bool...
code_fim
medium
{ "lang": "rust", "repo": "GaryHughes/Exchange", "path": "/part_1/rust_solution/src/order.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// 5xx: Permanent Negative Completion Reply pub const BAD_COMMAND: u32 = 500; pub const BAD_ARGUMENTS: u32 = 501; pub const NOT_IMPLEMENTED: u32 = 502; pub const BAD_SEQUENCE: u32 = 503; pub const NOT_IMPLEMENTED_PARAMETER: u32 = 504; pub const NOT_LOGGED_IN: u32 = 530; pub const STORING_NEED_ACCOUNT: u32...
code_fim
hard
{ "lang": "rust", "repo": "carlberger/rust-ftp", "path": "/src/status.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// 4xx: Transient Negative Completion Reply pub const NOT_AVAILABLE: u32 = 421; pub const CANNOT_OPEN_DATA_CONNECTION: u32 = 425; pub const TRANSER_ABORTED: u32 = 426; pub const INVALID_CREDENTIALS: u32 = 430; pub const HOST_UNAVAILABLE: u32 = 434; pub const REQUEST_FILE_ACTION_IGNORED: u32 = 450; pub con...
code_fim
hard
{ "lang": "rust", "repo": "carlberger/rust-ftp", "path": "/src/status.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }