text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>impl Secret { fn from_raw(raw: SecretRaw) -> Result<(String, Self)> { Ok(( raw.name, Secret { sha256: Digest::from_slice( &hex::decode(&raw.sha256).ok().context("Non-hex sha256")?, ) .context("Invalid S...
code_fim
hard
{ "lang": "rust", "repo": "sk3w/amber", "path": "/src/config.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let subscription = ton_client::net::subscribe_collection( context.clone(), ton_client::net::ParamsOfSubscribeCollection { collection: "transactions".to_owned(), filter: None, result: "id account_addr".to_owned(), }, |result| async { ...
code_fim
hard
{ "lang": "rust", "repo": "NoamDev/TON-SDK", "path": "/examples/rust/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // transaction subscription let subscription = ton_client::net::subscribe_collection( context.clone(), ton_client::net::ParamsOfSubscribeCollection { collection: "transactions".to_owned(), filter: None, result: "id account_addr".to_owned(), ...
code_fim
hard
{ "lang": "rust", "repo": "NoamDev/TON-SDK", "path": "/examples/rust/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: NoamDev/TON-SDK path: /examples/rust/src/main.rs use std::sync::Arc; #[tokio::main] async fn main() { let context = Arc::new( ton_client::ClientContext::new(ton_client::ClientConfig { network: ton_client::net::NetworkConfig { //server_address: "http://loc...
code_fim
hard
{ "lang": "rust", "repo": "NoamDev/TON-SDK", "path": "/examples/rust/src/main.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Origen-SDK/o2 path: /rust/origen/src/testers/vector_based/pattern_renderer.rs use crate::core::dut::Dut; use crate::core::file_handler::File; use crate::core::model::pins::StateTracker; use crate::generator::PAT; use crate::STATUS; use crate::{Overlay, Result, DUT}; use origen_metal::ast::{Node,...
code_fim
hard
{ "lang": "rust", "repo": "Origen-SDK/o2", "path": "/rust/origen/src/testers/vector_based/pattern_renderer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn render_states(&self) -> Result<String> { let dut = DUT.lock().unwrap(); let t = &dut.timesets[self.current_timeset_id.unwrap()]; let mut ppin_overrides: HashMap<usize, String> = HashMap::new(); for (ppin, symbol) in self.capturing.iter() { if ppin.is_...
code_fim
hard
{ "lang": "rust", "repo": "Origen-SDK/o2", "path": "/rust/origen/src/testers/vector_based/pattern_renderer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a> Processor<PAT> for Renderer<'a> { fn on_node(&mut self, node: &Node<PAT>) -> Result<Return<PAT>> { match self.tester.override_node(self, &node) { Some(retn) => return retn, None => {} } match &node.attrs { PAT::Test(name) => { ...
code_fim
hard
{ "lang": "rust", "repo": "Origen-SDK/o2", "path": "/rust/origen/src/testers/vector_based/pattern_renderer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> HttpServer::new(move || { App::new() .route("/api/hello", web::get().to(greet)) .service(Files::new("/", "dist").index_file("index.html").use_last_modified(true)) .data(pool.clone()) }) .bind(env::var("BIND_ADDR").expect("BIND_ADDR must be set"))...
code_fim
hard
{ "lang": "rust", "repo": "sartor/good-bad-state", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sartor/good-bad-state path: /src/main.rs use actix_web::{App, HttpServer, Responder, web}; use actix_web::web::Data; use actix_files::Files; use dotenv::dotenv; use sqlx::{postgres::{PgPool, PgPoolOptions}, query_as}; use std::env; mod requests; mod models; <|fim_suffix|> sqlx::migrate!("./...
code_fim
hard
{ "lang": "rust", "repo": "sartor/good-bad-state", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// This struct, when pushed, will be serialized as a `FlexBufferType::IndirectInt`. /// /// It is a signed integer stored by reference in the flexbuffer. This can reduce the /// size of vectors and maps containing the `IndirectInt`. #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub struct IndirectInt(pub ...
code_fim
hard
{ "lang": "rust", "repo": "google/flatbuffers", "path": "/rust/flexbuffers/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// Deserialize a type from a flexbuffer. pub fn from_buffer<'de, T: Deserialize<'de>, B: Buffer>( buf: &'de B, ) -> Result<T, DeserializationError> { let r = Reader::get_root(buf as &'de [u8])?; T::deserialize(r) } /// This struct, when pushed will be serialized as a `FlexBufferType::Blob`. ...
code_fim
hard
{ "lang": "rust", "repo": "google/flatbuffers", "path": "/rust/flexbuffers/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: google/flatbuffers path: /rust/flexbuffers/src/lib.rs // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org...
code_fim
hard
{ "lang": "rust", "repo": "google/flatbuffers", "path": "/rust/flexbuffers/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// AWS Lambda event definitions for codebuild. #[cfg(feature = "codebuild")] pub use event::codebuild; /// AWS Lambda event definitions for codedeploy. #[cfg(feature = "codedeploy")] pub use event::codedeploy; /// AWS Lambda event definitions for codepipeline_cloudwatch. #[cfg(feature = "codepipeline_c...
code_fim
hard
{ "lang": "rust", "repo": "awslabs/aws-lambda-rust-runtime", "path": "/lambda-events/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// AWS Lambda event definitions for iot. #[cfg(feature = "iot")] pub use event::iot; /// AWS Lambda event definitions for iot_1_click. #[cfg(feature = "iot_1_click")] pub use event::iot_1_click; /// AWS Lambda event definitions for iot_button. #[cfg(feature = "iot_button")] pub use event::iot_button; ...
code_fim
hard
{ "lang": "rust", "repo": "awslabs/aws-lambda-rust-runtime", "path": "/lambda-events/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: awslabs/aws-lambda-rust-runtime path: /lambda-events/src/lib.rs #![deny(rust_2018_idioms)] #[cfg(feature = "http")] pub use http; #[cfg(feature = "query_map")] pub use query_map; mod custom_serde; /// Encodings used in AWS Lambda json event values. pub mod encodings; #[cfg(feature = "chrono")] ...
code_fim
hard
{ "lang": "rust", "repo": "awslabs/aws-lambda-rust-runtime", "path": "/lambda-events/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: theodoreleebrant/graphs-in-rust path: /src/graph.rs use crate::types::*; pub type Range<'a, T> = Box<dyn Iterator<Item = T> + 'a>; pub trait CSRGraph<V, E> { fn op_add_vertex(&self, v: NodeId); fn op_add_edge(&self, v: NodeId, e: NodeId); <|fim_suffix|> fn out_neigh(&self, v: NodeId...
code_fim
hard
{ "lang": "rust", "repo": "theodoreleebrant/graphs-in-rust", "path": "/src/graph.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn print_stats(&self); fn vertices(&self) -> Range<V>; fn old_bfs(&self, v: NodeId); fn replace_out_edges(&self, v: NodeId, edges: Vec<E>); fn replace_in_edges(&self, v: NodeId, edges: Vec<E>); }<|fim_prefix|>// repo: theodoreleebrant/graphs-in-rust path: /src/graph.rs use crate::t...
code_fim
hard
{ "lang": "rust", "repo": "theodoreleebrant/graphs-in-rust", "path": "/src/graph.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Jekshmek/podcore path: /src/mediators/podcast_reingester.rs use error_helpers; use errors::*; use http_requester::HttpRequesterPassThrough; use mediators::common; use mediators::podcast_updater; use time_helpers; use chan; use chan::{Receiver, Sender}; use diesel; use diesel::pg::PgConnection; ...
code_fim
hard
{ "lang": "rust", "repo": "Jekshmek/podcore", "path": "/src/mediators/podcast_reingester.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// Private constants // const PAGE_SIZE: i64 = 100; // Private types // // Exists because `sql_query` doesn't support querying into a tuple, only a // struct. #[derive(Clone, Debug, QueryableByName)] #[table_name = "podcast"] struct PodcastTuple { #[sql_type = "BigInt"] id: i64, #[sql_type...
code_fim
hard
{ "lang": "rust", "repo": "Jekshmek/podcore", "path": "/src/mediators/podcast_reingester.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Insert lots of data to be reingested let num_podcasts = (test_helpers::MAX_NUM_CONNECTIONS as i64) * 10; for _i in 0..num_podcasts { test_data::podcast::insert(&bootstrap.log, &*bootstrap.conn); } debug!(&bootstrap.log, "Finished setup (starting the ...
code_fim
hard
{ "lang": "rust", "repo": "Jekshmek/podcore", "path": "/src/mediators/podcast_reingester.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Gep(val, indices) => { let mut v = Vec::new(); v.push(val); v.extend(indices); v } Ret(None) => vec![], Ret(Some(val)) => vec![val], Br(_) => vec![], CondBr(cond, _, _) ...
code_fim
hard
{ "lang": "rust", "repo": "project-ela/siderow", "path": "/src/ssa/instruction.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: project-ela/siderow path: /src/ssa/instruction.rs use std::collections::HashSet; use id_arena::Id; use super::{BlockId, FunctionId, Type, Value}; pub type InstructionId = Id<Instruction>; #[derive(Debug)] pub struct Instruction { pub kind: InstructionKind, pub users: HashSet<Instruc...
code_fim
hard
{ "lang": "rust", "repo": "project-ela/siderow", "path": "/src/ssa/instruction.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kaifastromai/rust path: /rt/src/csglm.rs pub mod vector { use num_traits::Float; use std::ops; #[derive(Debug, Clone, Copy)] pub struct Vec3<T> { pub x: T, pub y: T, pub z: T, } impl<T> Vec3<T> where T: Float + std::ops::Mul + std::ops:...
code_fim
hard
{ "lang": "rust", "repo": "kaifastromai/rust", "path": "/rt/src/csglm.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> *self = Self { x: self.x * rhs, y: self.y * rhs, z: self.z * rhs, } } } impl<T> ops::Div<T> for Vec3<T> where T: std::ops::Div<T, Output = T> + Copy + Float, { type Output = Self; fn div...
code_fim
hard
{ "lang": "rust", "repo": "kaifastromai/rust", "path": "/rt/src/csglm.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rodolf0/tox path: /lox/src/main.rs #![deny(warnings)] use std::env; use std::fs::File; use std::io::{self, Read, Write}; mod lox_scanner; mod lox_parser; mod lox_interpreter; mod lox_environment; mod lox_native; mod lox_resolver; use crate::lox_scanner::LoxScanner; use crate::lox_parser::LoxP...
code_fim
medium
{ "lang": "rust", "repo": "rodolf0/tox", "path": "/lox/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut interpreter = LoxInterpreter::new(); if env::args().len() == 2 { let sourcefile = env::args().nth(1).unwrap(); if let Ok(mut f) = File::open(&sourcefile) { let mut source = String::new(); if f.read_to_string(&mut source).is_ok() { ret...
code_fim
hard
{ "lang": "rust", "repo": "rodolf0/tox", "path": "/lox/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(payload, orig_payload); assert!(message.uid() > 0); assert!(message.gid() > 0); println!("{:?}", message); }<|fim_prefix|>// repo: dansondergaard/rs-munge path: /examples/roundtrip.rs extern crate rs_munge; use rs_munge::{encode, decode}; <|fim_middle|>fn main() { let or...
code_fim
medium
{ "lang": "rust", "repo": "dansondergaard/rs-munge", "path": "/examples/roundtrip.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dansondergaard/rs-munge path: /examples/roundtrip.rs extern crate rs_munge; use rs_munge::{encode, decode}; <|fim_suffix|> assert_eq!(payload, orig_payload); assert!(message.uid() > 0); assert!(message.gid() > 0); println!("{:?}", message); }<|fim_middle|>fn main() { let or...
code_fim
medium
{ "lang": "rust", "repo": "dansondergaard/rs-munge", "path": "/examples/roundtrip.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: embed-rs/embedded_stm32f7 path: /src/iwdg.rs // autogenerated use volatile; use bit_field::BitField; # [ doc = "Independent watchdog" ] # [ repr ( C ) ] pub struct Iwdg { # [ doc = "0x00 - Key register" ] pub kr: volatile::WriteOnly<Kr>, # [ doc = "0x04 - Prescaler register" ] ...
code_fim
hard
{ "lang": "rust", "repo": "embed-rs/embedded_stm32f7", "path": "/src/iwdg.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Default for Rlr { # [ doc = r" Reset value" ] fn default() -> Self { Rlr { bits: 4095u32 } } } impl Rlr { # [ doc = "Bits 0:11 - Watchdog counter reload value" ] pub fn set_rl(&mut self, value: u16) { self.bits.set_range(0u8..12u8, value as u32); } } # [ deri...
code_fim
hard
{ "lang": "rust", "repo": "embed-rs/embedded_stm32f7", "path": "/src/iwdg.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Sr { # [ doc = "Bit 1 - Watchdog counter reload value update" ] pub fn rvu(&self) -> bool { self.bits.get_bit(1u8) } # [ doc = "Bit 0 - Watchdog prescaler value update" ] pub fn pvu(&self) -> bool { self.bits.get_bit(0u8) } } impl Default for Sr { # [ doc ...
code_fim
hard
{ "lang": "rust", "repo": "embed-rs/embedded_stm32f7", "path": "/src/iwdg.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn equal_ish(a: u64, b:u64) -> bool { a & 0xFFFF == b & 0xFFFF } #[test] fn test_equal_ish() { assert!(!equal_ish(1092455, 430625591)); assert!(equal_ish(245556042, 1431495498)); } fn count_equal_ish(a: &mut Generator, b: &mut Generator, n_iters: usize) -> usize { a.take(n_iters) .zip(b.take(n_ite...
code_fim
hard
{ "lang": "rust", "repo": "sgravrock/adventofcode", "path": "/2017/rust/day15-2/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test_equal_ish() { assert!(!equal_ish(1092455, 430625591)); assert!(equal_ish(245556042, 1431495498)); } fn count_equal_ish(a: &mut Generator, b: &mut Generator, n_iters: usize) -> usize { a.take(n_iters) .zip(b.take(n_iters)) .filter(|&(x, y)| equal_ish(x, y)) .count() } #[test] fn ...
code_fim
hard
{ "lang": "rust", "repo": "sgravrock/adventofcode", "path": "/2017/rust/day15-2/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sgravrock/adventofcode path: /2017/rust/day15-2/src/main.rs fn main() { let mut a = Generator::new(703, 16807, 4); let mut b = Generator::new(516, 48271, 8); println!("{}\n", count_equal_ish(&mut a, &mut b, 5000000)); } struct Generator { prev_value: u64, factor: u64, criterion: u64, } i...
code_fim
hard
{ "lang": "rust", "repo": "sgravrock/adventofcode", "path": "/2017/rust/day15-2/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> { // propagates from first block let mut vec = setup((Block::hdr_csize() + MIN_PAYLOAD_SIZE) * 2 * Block::alignment()); let b0 = first_block(vec.as_mut_slice()); b0.size = (MIN_PAYLOAD_SIZE as u16) | FLAG_ALLOCATED; let b1 = b0.next().unwrap(); ...
code_fim
hard
{ "lang": "rust", "repo": "silica-rs/silica-core-allocator", "path": "/src/block.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn check_init(v: &mut Vec<u8>, load_size: usize, expect_err: Option<BlockError>) { v.resize(load_size, 0); let alignment_items = load_size / Block::alignment(); let max_block_size = Block::hdr_csize() + MAX_PAYLOAD_SIZE; let mut count = alignment_items / max_block_size;...
code_fim
hard
{ "lang": "rust", "repo": "silica-rs/silica-core-allocator", "path": "/src/block.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: silica-rs/silica-core-allocator path: /src/block.rs emory with Block headers. /// Returns the number of block initialized or a `BlockError`. pub fn init<'a>(heap: *mut u8, size: usize) -> Result<(usize, &'a mut Block), BlockError> { let mut heap_size = size >> Block::alignment()....
code_fim
hard
{ "lang": "rust", "repo": "silica-rs/silica-core-allocator", "path": "/src/block.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut input = Vec::new(); for variable in reflected_input_variables.iter() { let builtin = if let Some(type_description) = &variable.type_description { BuiltinAttribute::from_str(&type_description.type_name) } else { None }; input.push(Att...
code_fim
hard
{ "lang": "rust", "repo": "Vengarioth/rust-vulkan-renderer", "path": "/rvrc/src/builder/shader/reflect.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Vengarioth/rust-vulkan-renderer path: /rvrc/src/builder/shader/reflect.rs use crate::{ Error, builder::shader::*, }; use rvr_assets::{ Format, shader::{DescriptorType, ShaderStageFlags, VertexAttribute}, }; use spirv_reflect::{ ShaderModule, types::{ ReflectDescri...
code_fim
hard
{ "lang": "rust", "repo": "Vengarioth/rust-vulkan-renderer", "path": "/rvrc/src/builder/shader/reflect.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for reflected_descriptor_set in reflected_descriptor_sets { let mut descriptor_set = DescriptorSet::new(reflected_descriptor_set.set); for reflected_binding in &reflected_descriptor_set.bindings { let binding = DescriptorBinding::new( reflected_binding.bind...
code_fim
hard
{ "lang": "rust", "repo": "Vengarioth/rust-vulkan-renderer", "path": "/rvrc/src/builder/shader/reflect.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: XuShaohua/nc path: /src/calls/sigwaitinfo.rs /// Wait for queued signals (REALTIME) pub unsafe fn sigwaitinfo(set: &sigs<|fim_suffix|> *const sigset_t as usize; let info_ptr = info as *mut siginfo_t as usize; syscall2(SYS_SIGWAITINFO, set_ptr, info_ptr).map(|val| val as i32) }<|fim_middl...
code_fim
medium
{ "lang": "rust", "repo": "XuShaohua/nc", "path": "/src/calls/sigwaitinfo.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> *const sigset_t as usize; let info_ptr = info as *mut siginfo_t as usize; syscall2(SYS_SIGWAITINFO, set_ptr, info_ptr).map(|val| val as i32) }<|fim_prefix|>// repo: XuShaohua/nc path: /src/calls/sigwaitinfo.rs /// Wait for queued signals (REALTIME) pub unsafe fn sigwaitinfo(set: &sigs<|fim_middl...
code_fim
medium
{ "lang": "rust", "repo": "XuShaohua/nc", "path": "/src/calls/sigwaitinfo.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ze; syscall2(SYS_SIGWAITINFO, set_ptr, info_ptr).map(|val| val as i32) }<|fim_prefix|>// repo: XuShaohua/nc path: /src/calls/sigwaitinfo.rs /// Wait for queued signals (REALTIME) pub unsafe fn sigwaitinfo(set: &sigs<|fim_middle|>et_t, info: &mut siginfo_t) -> Result<i32, Errno> { let set_ptr = se...
code_fim
medium
{ "lang": "rust", "repo": "XuShaohua/nc", "path": "/src/calls/sigwaitinfo.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // Array of Brainfuck symbols let bf_syntax:[char;8] = ['<', '>', '+', '-', '[', ']', ',', '.']; // Store only the recognized symbols in the vector for x in code.chars(){ if bf_syntax.contains(&x){ syms.push(x); } } // Return the vector of symbols ...
code_fim
medium
{ "lang": "rust", "repo": "ahmedwadod/BrainRust", "path": "/src/bf_parser.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Store only the recognized symbols in the vector for x in code.chars(){ if bf_syntax.contains(&x){ syms.push(x); } } // Return the vector of symbols syms }<|fim_prefix|>// repo: ahmedwadod/BrainRust path: /src/bf_parser.rs // BrainRust parser // Takes th...
code_fim
medium
{ "lang": "rust", "repo": "ahmedwadod/BrainRust", "path": "/src/bf_parser.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ahmedwadod/BrainRust path: /src/bf_parser.rs // BrainRust parser // Takes the Brainfuck symbols out of the code text pub fn parse_bf(code: String) -> Vec<char>{ // Vector to store the symbols let mut syms: Vec<char> = vec![]; <|fim_suffix|> // Store only the recognized symbols in th...
code_fim
medium
{ "lang": "rust", "repo": "ahmedwadod/BrainRust", "path": "/src/bf_parser.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Computes the maximal depth of the given sub-diagram. /// /// Intuitively this will compute the longest possible path from **term** to a leaf-node (i.e., ⊥ or ⊤). #[allow(dead_code)] // max depth may be used in future heuristics pub fn max_depth(&self, term: Term) -> usize { ...
code_fim
hard
{ "lang": "rust", "repo": "ellmau/adf-obdd", "path": "/lib/src/obdd.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[allow(dead_code)] // dead code due to more efficient ad-hoc building, still used for a couple of tests /// Computes the number of counter-models, models, and variables for a given roBDD fn modelcount_naive(&self, term: Term) -> CountNode { if term == Term::TOP { (ModelCou...
code_fim
hard
{ "lang": "rust", "repo": "ellmau/adf-obdd", "path": "/lib/src/obdd.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ellmau/adf-obdd path: /lib/src/obdd.rs nterpretation. /// **goal** is a boolean [variable][Var], which defines whether the models or counter-models are of interest. pub fn interpretations( &self, tree: Term, goal: bool, goal_var: Var, negative: &[V...
code_fim
hard
{ "lang": "rust", "repo": "ellmau/adf-obdd", "path": "/lib/src/obdd.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Wilfred/hhvm path: /hphp/hack/src/hackc/hhbc/hhas_body.rs // Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use ffi::{Maybe, Pair, Slice, Str}; use hhas_param::Hha...
code_fim
hard
{ "lang": "rust", "repo": "Wilfred/hhvm", "path": "/hphp/hack/src/hackc/hhbc/hhas_body.rs", "mode": "psm", "license": "PHP-3.01", "source": "the-stack-v2" }
<|fim_suffix|>pub fn default_with_body_instrs<'arena>(body_instrs: InstrSeq<'arena>) -> HhasBody<'arena> { HhasBody { body_instrs, decl_vars: Slice::<'arena, Str<'arena>>::default(), num_iters: usize::default(), num_closures: u32::default(), is_memoize_wrapper: bool::default(...
code_fim
hard
{ "lang": "rust", "repo": "Wilfred/hhvm", "path": "/hphp/hack/src/hackc/hhbc/hhas_body.rs", "mode": "spm", "license": "PHP-3.01", "source": "the-stack-v2" }
<|fim_suffix|> pub struct DebugMatchExpr { pub pat: String, } impl Transform for DebugMatchExpr { fn transform(&self, krate: &mut Crate, st: &CommandState, cx: &RefactorCtxt) { let mut init_mcx = MatchCtxt::new(st, cx); init_mcx.debug = true; let pat = init_mcx.parse_expr(&self.pat); ...
code_fim
hard
{ "lang": "rust", "repo": "immunant/c2rust", "path": "/c2rust-refactor/src/transform/rewrite.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: immunant/c2rust path: /c2rust-refactor/src/transform/rewrite.rs use syntax::ast::Crate; use syntax::symbol::Symbol; use crate::command::{CommandState, Registry}; use crate::contains_mark::contains_mark; use crate::driver::Phase; use crate::matcher::{MatchCtxt, Subst, mut_visit_match_with}; use ...
code_fim
hard
{ "lang": "rust", "repo": "immunant/c2rust", "path": "/c2rust-refactor/src/transform/rewrite.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> that is used to implement the division is not and will be initialized by HW to '0' when transitioning from DeepSleep to Active power mode."] #[inline(always)] pub fn slow_int_div(&mut self) -> SLOW_INT_DIV_W { SLOW_INT_DIV_W { w: self } } #[doc = "Bits 24:31 - Specifies the periph...
code_fim
hard
{ "lang": "rust", "repo": "mvertescher/psoc6-pac", "path": "/src/cpuss/cm0_clock_ctl.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mvertescher/psoc6-pac path: /src/cpuss/cm0_clock_ctl.rs #[doc = "Reader of register CM0_CLOCK_CTL"] pub type R = crate::R<u32, super::CM0_CLOCK_CTL>; #[doc = "Writer for register CM0_CLOCK_CTL"] pub type W = crate::W<u32, super::CM0_CLOCK_CTL>; #[doc = "Register CM0_CLOCK_CTL `reset()`'s with va...
code_fim
hard
{ "lang": "rust", "repo": "mvertescher/psoc6-pac", "path": "/src/cpuss/cm0_clock_ctl.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Tenjin0/rust-leetcode path: /perfect_square/src/main.rs use perfect_square; <|fim_suffix|> let result = perfect_square::is_perfect_square(num); println!("{}", result) }<|fim_middle|> fn main() { // 104976 let num = 808201;
code_fim
medium
{ "lang": "rust", "repo": "Tenjin0/rust-leetcode", "path": "/perfect_square/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // 104976 let num = 808201; let result = perfect_square::is_perfect_square(num); println!("{}", result) }<|fim_prefix|>// repo: Tenjin0/rust-leetcode path: /perfect_square/src/main.rs use perfect_square; <|fim_middle|> fn main() {
code_fim
easy
{ "lang": "rust", "repo": "Tenjin0/rust-leetcode", "path": "/perfect_square/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Tenjin0/rust-leetcode path: /perfect_square/src/main.rs use perfect_square; fn main() { <|fim_suffix|> let result = perfect_square::is_perfect_square(num); println!("{}", result) }<|fim_middle|> // 104976 let num = 808201;
code_fim
easy
{ "lang": "rust", "repo": "Tenjin0/rust-leetcode", "path": "/perfect_square/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: 3pointer/tikv path: /src/storage/raw/raw_mvcc.rs // Copyright 2022 TiKV Project Authors. Licensed under Apache-2.0. use crate::storage::kv::{Error, ErrorInner, Iterator, Result, Snapshot}; use engine_traits::{CfName, DATA_KEY_PREFIX_LEN}; use engine_traits::{IterOptions, ReadOptions}; use txn_...
code_fim
hard
{ "lang": "rust", "repo": "3pointer/tikv", "path": "/src/storage/raw/raw_mvcc.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(ref mut key) = self.cur_key { key.clear(); key.extend_from_slice(self.inner.key()); if key.capacity() > key.len() * 2 && key.capacity() > VEC_SHRINK_THRESHOLD { key.shrink_to_fit(); } } else { self.cur_...
code_fim
hard
{ "lang": "rust", "repo": "3pointer/tikv", "path": "/src/storage/raw/raw_mvcc.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LaurentMazare/tch-rs path: /tests/autocast.rs #[cfg(test)] #[cfg(feature = "cuda-tests")] mod tests { use tch::{autocast, Device, Kind, Tensor}; #[test] fn autocast_narrows_type() { let device = Device::Cuda(0); <|fim_suffix|> autocast(true, || { let outp...
code_fim
medium
{ "lang": "rust", "repo": "LaurentMazare/tch-rs", "path": "/tests/autocast.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> autocast(true, || { let output1 = autocast(false, || linear.matmul(&input)); assert_eq!(output1.kind(), Kind::Float); let output2 = linear.matmul(&output1); assert_eq!(output2.kind(), Kind::Half); let output3 = autocast(false, || linear.m...
code_fim
medium
{ "lang": "rust", "repo": "LaurentMazare/tch-rs", "path": "/tests/autocast.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: strega-nil/garnet path: /garnet-core/src/lib.rs #![allow(unused)] #[macro_use] pub mod macros; <|fim_suffix|>#[doc(hidden)] pub extern crate fluent; // for purposes of macros, this needs to be public<|fim_middle|>pub mod gemini; pub mod localize; pub mod prelude;
code_fim
easy
{ "lang": "rust", "repo": "strega-nil/garnet", "path": "/garnet-core/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[doc(hidden)] pub extern crate fluent; // for purposes of macros, this needs to be public<|fim_prefix|>// repo: strega-nil/garnet path: /garnet-core/src/lib.rs #![allow(unused)] #[macro_use] pub mod macros; <|fim_middle|>pub mod gemini; pub mod localize; pub mod prelude;
code_fim
easy
{ "lang": "rust", "repo": "strega-nil/garnet", "path": "/garnet-core/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ddboline/sync_app_rust path: /sync_app_lib/src/s3_instance.rs use anyhow::{format_err, Error}; use futures::stream::{StreamExt, TryStreamExt}; use lazy_static::lazy_static; use parking_lot::{Mutex, MutexGuard}; use rusoto_core::Region; use rusoto_s3::{ Bucket, CopyObjectRequest, CreateBucket...
code_fim
hard
{ "lang": "rust", "repo": "ddboline/sync_app_rust", "path": "/sync_app_lib/src/s3_instance.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// # Errors /// Return error if db query fails pub async fn upload( &self, fname: &str, bucket_name: &str, key_name: &str, ) -> Result<(), Error> { if !Path::new(fname).exists() { return Err(format_err!("File doesn't exist {fname}")); ...
code_fim
hard
{ "lang": "rust", "repo": "ddboline/sync_app_rust", "path": "/sync_app_lib/src/s3_instance.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // change plane-albedo to a lighter gray for (entity, piece_info) in (&entities, &piece_infos).join() { if piece_info.x == index_x as i16 && piece_info.z == index_z as i16 { if self.current_hover != Some(entity) { i...
code_fim
hard
{ "lang": "rust", "repo": "Septias/minions", "path": "/src/systems/hover_system.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Septias/minions path: /src/systems/hover_system.rs use amethyst::{ assets::Handle, core::{ math::{Point2, Vector2}, Transform, geometry::Plane }, ecs::{Entity, Entities, Join, ReadStorage, System, SystemData, Read, WriteStorage, ReadExpect}, input::InputHandler, derive::...
code_fim
hard
{ "lang": "rust", "repo": "Septias/minions", "path": "/src/systems/hover_system.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AtsukiTak/atomcc path: /src/generator/subroutine.rs use super::get_unique_num; use crate::{ asm::{arbitrary, instructions::*, Addr, AsmBuf, Reg64::*, Reg8::*}, parser::ast::*, }; /// サブルーチンのコードを生成するジェネレータ pub struct SubroutineGen { /// `call` によって積まれるreturn addressも **含めた** スタックの長さ....
code_fim
hard
{ "lang": "rust", "repo": "AtsukiTak/atomcc", "path": "/src/generator/subroutine.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Stmt::While(StmtWhile { cond, block, .. }) => { // ループの戻る場所を示す let label_num = get_unique_num(); let begin_label = format!("L_loop_begin_{}", label_num); *buf += arbitrary(format!("{}:", begin_label)); // ループ判定の式を...
code_fim
hard
{ "lang": "rust", "repo": "AtsukiTak/atomcc", "path": "/src/generator/subroutine.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: flattiverse/connector-rust path: /src/events/removed_unit_event.rs use crate::controllable::ControllableId; use crate::players::PlayerId; use serde_derive::{Deserialize, Serialize}; /// This event inform<|fim_suffix|>e pub player: Option<PlayerId>, /// The controllable of the player, if...
code_fim
hard
{ "lang": "rust", "repo": "flattiverse/connector-rust", "path": "/src/events/removed_unit_event.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>e pub player: Option<PlayerId>, /// The controllable of the player, if applicable pub controllable: Option<ControllableId>, }<|fim_prefix|>// repo: flattiverse/connector-rust path: /src/events/removed_unit_event.rs use crate::controllable::ControllableId; use crate::players::PlayerId; use ser...
code_fim
medium
{ "lang": "rust", "repo": "flattiverse/connector-rust", "path": "/src/events/removed_unit_event.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jzarnett/ece459 path: /lectures/flipped/L17/inline/main.rs // try this on https://godbolt.org with `-C overflow-checks=n -C opt-level=1` <|fim_suffix|>#[inline(never)] // ^ try change this to `#[inline(always)]` pub fn f(x: i32) -> i32 { x * x }<|fim_middle|>pub fn try_inline(x: i32) -> i32...
code_fim
easy
{ "lang": "rust", "repo": "jzarnett/ece459", "path": "/lectures/flipped/L17/inline/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[inline(never)] // ^ try change this to `#[inline(always)]` pub fn f(x: i32) -> i32 { x * x }<|fim_prefix|>// repo: jzarnett/ece459 path: /lectures/flipped/L17/inline/main.rs // try this on https://godbolt.org with `-C overflow-checks=n -C opt-level=1` <|fim_middle|>pub fn try_inline(x: i32) -> i32...
code_fim
easy
{ "lang": "rust", "repo": "jzarnett/ece459", "path": "/lectures/flipped/L17/inline/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // TODO: This can be done properly let perceived_oddsketch = peer_ego_guard.get_perceived_oddsketch(); let perceived_minisketch = peer_ego_guard.get_perceived_minisketch(); // Only respond to reconciliation target match ...
code_fim
hard
{ "lang": "rust", "repo": "pombredanne/cauchy", "path": "/cauchy-core/src/daemon.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pombredanne/cauchy path: /cauchy-core/src/daemon.rs use std::net::SocketAddr; use std::sync::{Arc, Mutex}; use failure::Error; use futures::{sync::mpsc, Future}; use log::{error, info, warn}; use tokio::codec::Framed; use tokio::net::{TcpListener, TcpStream}; use tokio::prelude::*; u...
code_fim
hard
{ "lang": "rust", "repo": "pombredanne/cauchy", "path": "/cauchy-core/src/daemon.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: joaofnds/exercism path: /rust/magazine-cutout/src/lib.rs use std::collections::HashMap; pub fn can_construct_note(magazine: &[&str], note: &[&str]) -> bool { let mut magazine_words = HashMap::new(); <|fim_suffix|> magazine_words.values().all(|&x| x >= 0) }<|fim_middle|> for word in m...
code_fim
medium
{ "lang": "rust", "repo": "joaofnds/exercism", "path": "/rust/magazine-cutout/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> magazine_words.values().all(|&x| x >= 0) }<|fim_prefix|>// repo: joaofnds/exercism path: /rust/magazine-cutout/src/lib.rs use std::collections::HashMap; pub fn can_construct_note(magazine: &[&str], note: &[&str]) -> bool { let mut magazine_words = HashMap::new(); <|fim_middle|> for word in m...
code_fim
medium
{ "lang": "rust", "repo": "joaofnds/exercism", "path": "/rust/magazine-cutout/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for word in note { *magazine_words.entry(word).or_insert(0) -= 1; } magazine_words.values().all(|&x| x >= 0) }<|fim_prefix|>// repo: joaofnds/exercism path: /rust/magazine-cutout/src/lib.rs use std::collections::HashMap; pub fn can_construct_note(magazine: &[&str], note: &[&str]) ->...
code_fim
medium
{ "lang": "rust", "repo": "joaofnds/exercism", "path": "/rust/magazine-cutout/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: justin1dennison/rust-exercism path: /space-age/src/lib.rs const EARTH_SECONDS_PER_YEAR: u64 = 31_557_600; #[derive(Debug)] pub struct Duration{ seconds: u64 } impl From<u64> for Duration { fn from(s: u64) -> Self { <|fim_suffix|>pub struct Mercury; pub struct Venus; pub struct Earth; pu...
code_fim
hard
{ "lang": "rust", "repo": "justin1dennison/rust-exercism", "path": "/space-age/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> } } pub struct Mercury; pub struct Venus; pub struct Earth; pub struct Mars; pub struct Jupiter; pub struct Saturn; pub struct Uranus; pub struct Neptune; planet!(Mercury, 0.2408467); planet!(Venus, 0.61519726); planet!(Earth, 1.0); planet!(Mars, 1.8808158); planet!(Jupiter, 11.862615); planet!(Satu...
code_fim
hard
{ "lang": "rust", "repo": "justin1dennison/rust-exercism", "path": "/space-age/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: icefoxen/axiom path: /src/actors.rs ad local actor system not set!") .clone() }) } /// Triggers a shutdown but doesn't wait for threads to stop. pub fn trigger_shutdown(&self) { self.data.shutdown_triggered.store(true, Ordering::Relaxed); } /...
code_fim
hard
{ "lang": "rust", "repo": "icefoxen/axiom", "path": "/src/actors.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Stops an actor by shutting down its channels and removing it from the actors list and /// telling the actor id to not allow messages to be sent to the actor since the receiving /// side of the actor is gone. /// /// This is something that should rarely be called from the outside as...
code_fim
hard
{ "lang": "rust", "repo": "icefoxen/axiom", "path": "/src/actors.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> match actor.receiver.peek() { Result::Err(err) => { // This happening should be very rare but it would mean that the thread pool // tried to process a message for an actor and was beaten to it by another // thread. In this case we will ju...
code_fim
hard
{ "lang": "rust", "repo": "icefoxen/axiom", "path": "/src/actors.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl Default for MDNSServiceDiscoveryConfig { fn default() -> Self { let local_service_addr = SocketAddr::from(([127, 0, 0, 1], CONST_INFECTION_PORT)); Self { reply_ttl: Duration::from_secs(120), local_service_addr, } } }<|fim_prefix|>// repo: basti...
code_fim
medium
{ "lang": "rust", "repo": "bastion-rs/artillery", "path": "/artillery-core/src/service_discovery/mdns/discovery_config.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bastion-rs/artillery path: /artillery-core/src/service_discovery/mdns/discovery_config.rs use crate::constants::*; use std::net::SocketAddr; use std::time::Duration; <|fim_suffix|>impl Default for MDNSServiceDiscoveryConfig { fn default() -> Self { let local_service_addr = SocketAdd...
code_fim
medium
{ "lang": "rust", "repo": "bastion-rs/artillery", "path": "/artillery-core/src/service_discovery/mdns/discovery_config.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lunacookies/aoc-old path: /src/bin/naughty_or_nice_strings.rs use aoc::naughty_or_nice_strings::{Judgement, Ruleset}; const INPUT: &str = include_str!("naughty_or_nice_strings_input"); fn main() { <|fim_suffix|> lines .filter(|line| Judgement::of(line, ruleset) == Judgement::Nice) ...
code_fim
hard
{ "lang": "rust", "repo": "lunacookies/aoc-old", "path": "/src/bin/naughty_or_nice_strings.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> println!( "With new ruleset: {}", num_nice_lines(INPUT.trim().lines(), Ruleset::New), ); } fn num_nice_lines<'a>(lines: impl Iterator<Item = &'a str>, ruleset: Ruleset) -> usize { lines .filter(|line| Judgement::of(line, ruleset) == Judgement::Nice) .count() }<...
code_fim
medium
{ "lang": "rust", "repo": "lunacookies/aoc-old", "path": "/src/bin/naughty_or_nice_strings.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> lines .filter(|line| Judgement::of(line, ruleset) == Judgement::Nice) .count() }<|fim_prefix|>// repo: lunacookies/aoc-old path: /src/bin/naughty_or_nice_strings.rs use aoc::naughty_or_nice_strings::{Judgement, Ruleset}; const INPUT: &str = include_str!("naughty_or_nice_strings_input...
code_fim
hard
{ "lang": "rust", "repo": "lunacookies/aoc-old", "path": "/src/bin/naughty_or_nice_strings.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lemonrock/nvml path: /workspace/nvml/src/errors/LastErrorMessageOnThisThreadIsInvalidError.rs // This file is part of dpdk. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/dpdk/maste...
code_fim
hard
{ "lang": "rust", "repo": "lemonrock/nvml", "path": "/workspace/nvml/src/errors/LastErrorMessageOnThisThreadIsInvalidError.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let pointer = unsafe { error_function() }; if pointer.is_null() { return Err(Null) } let thread_safe_c_string_pointer = unsafe { CStr::from_ptr(pointer) }; let x: CString = thread_safe_c_string_pointer.into(); match x.into_string() { Ok(value) => Ok(value), Err(_) => Err(Invali...
code_fim
hard
{ "lang": "rust", "repo": "lemonrock/nvml", "path": "/workspace/nvml/src/errors/LastErrorMessageOnThisThreadIsInvalidError.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> InvalidUtf8 { description("Error message is not valid ASCII NUL terminated UTF-8") } } } impl LastErrorMessageOnThisThreadIsInvalidError { #[inline(always)] pub(crate) fn last_error_message_on_this_thread(error_function: ErrorFunction) -> Result<String, LastErrorMessageOnThisThreadIsInvalidEr...
code_fim
hard
{ "lang": "rust", "repo": "lemonrock/nvml", "path": "/workspace/nvml/src/errors/LastErrorMessageOnThisThreadIsInvalidError.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aristotle9/qt_generator-output path: /qt_3d_render/src/cull_face.rs /// C++ type: <span style='color: green;'>```Qt3DRender::QCullFace```</span> #[repr(C)] pub struct CullFace(u8); impl CullFace { /// C++ method: <span style='color: green;'>```virtual const QMetaObject* Qt3DRender::QCullFace:...
code_fim
hard
{ "lang": "rust", "repo": "aristotle9/qt_generator-output", "path": "/qt_3d_render/src/cull_face.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let ffi_result = unsafe { ::ffi::qt_3d_render_c_QCullFace_G_static_cast_QObject_ptr(self as *mut ::cull_face::CullFace) }; unsafe { ffi_result.as_mut() }.expect("Attempted to convert null pointer to reference") } fn static_cast(&self) -> &::qt_core::object::Object { let ffi_result =...
code_fim
hard
{ "lang": "rust", "repo": "aristotle9/qt_generator-output", "path": "/qt_3d_render/src/cull_face.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>n("")) .collect::<Vec<_>>() .join(" ") }<|fim_prefix|>// repo: suchov/codewars-1 path: /(7 kyu) Jaden Casing Strings/(7 kyu) Jaden Casing Strings.rs fn to_jaden_case(str: &str) -> String { str.split_w<|fim_middle|>hitespace() .collect::<Vec<_>>() .iter() .map(|...
code_fim
medium
{ "lang": "rust", "repo": "suchov/codewars-1", "path": "/(7 kyu) Jaden Casing Strings/(7 kyu) Jaden Casing Strings.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: suchov/codewars-1 path: /(7 kyu) Jaden Casing Strings/(7 kyu) Jaden Casing Strings.rs fn to_jaden_case(str: &str) -> String { str.split_w<|fim_suffix|>n("")) .collect::<Vec<_>>() .join(" ") }<|fim_middle|>hitespace() .collect::<Vec<_>>() .iter() .map(|...
code_fim
medium
{ "lang": "rust", "repo": "suchov/codewars-1", "path": "/(7 kyu) Jaden Casing Strings/(7 kyu) Jaden Casing Strings.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: arielhenryson/cheetah path: /cheetah_lib/src/parser/parse.rs use super::parser::{ Parser, ParseResult }; use super::error::ParseError; use crate::types::tokens::Token; use crate::types::expression::DebugInfo; impl Parser { pub fn parse(&mut self) -> ParseResult { if self.pos == self...
code_fim
hard
{ "lang": "rust", "repo": "arielhenryson/cheetah", "path": "/cheetah_lib/src/parser/parse.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Token::KeywordReturn => self.return_expression()?, Token::Number => self.number_expression(token.value)?, Token::DeclarationFunction => self.function_expression()?, Token::Identifier => self.identifie...
code_fim
hard
{ "lang": "rust", "repo": "arielhenryson/cheetah", "path": "/cheetah_lib/src/parser/parse.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>mod cache; pub use cache::PublicKeyCache; mod batch; pub use batch::Batch;<|fim_prefix|>// repo: gustavorobertux/celo-bls-snark-rs path: /crates/bls-crypto/src/bls/mod.rs //! Implements BLS signatures as specified in https://crypto.stanford.edu/~dabo/pubs/papers/BLSmultisig.html. <|fim_middle|>mod secr...
code_fim
medium
{ "lang": "rust", "repo": "gustavorobertux/celo-bls-snark-rs", "path": "/crates/bls-crypto/src/bls/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gustavorobertux/celo-bls-snark-rs path: /crates/bls-crypto/src/bls/mod.rs //! Implements BLS signatures as specified in https://crypto.stanford.edu/~dabo/pubs/papers/BLSmultisig.html. <|fim_suffix|>mod public; pub use public::PublicKey; mod signature; pub use signature::Signature; mod cache; ...
code_fim
easy
{ "lang": "rust", "repo": "gustavorobertux/celo-bls-snark-rs", "path": "/crates/bls-crypto/src/bls/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }