text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>_VM_FLAG_SPECIFIC ; const SPECIFIC_OVERWRITE = sys : : ZX_VM_FLAG_SPECIFIC_OVERWRITE ; const CAN_MAP_SPECIFIC = sys : : ZX_VM_FLAG_CAN_MAP_SPECIFIC ; const CAN_MAP_READ = sys : : ZX_VM_FLAG_CAN_MAP_READ ; const CAN_MAP_WRITE = sys : : ZX_VM_FLAG_CAN_MAP_WRITE ; const CAN_MAP_EXECUTE = sys : : ZX_VM_FLAG_C...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/fuchsia-zircon/src/vmar.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified path: /third_party/rust/fuchsia-zircon/src/vmar.rs use sys ; bitflags ! { / / / Flags to VMAR routines # [ repr ( C ) ] pub struct VmarFlags : u32 { const PERM_READ = sys : : ZX_VM_FLAG_PERM_READ ; const PERM_WRIT<|fim_suffix|>_READ = sys : : ZX_VM_FLAG_CAN_MAP_READ ;...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/fuchsia-zircon/src/vmar.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> /// Create a new instance of Stdio with the given buffer sizes for stdin and stdout /// /// # Panics /// If either stdin_buffer_size == 0 or stdout_buffer_size == 0 pub fn new( stdin_buffer_size : usize, stdout_buffer_size : usize ) -> Self { Stdio { stdin_buffer_re...
code_fim
hard
{ "lang": "rust", "repo": "nathanjent/tokio-stdio", "path": "/src/stdio.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nathanjent/tokio-stdio path: /src/stdio.rs //! Implementation of tokio_core::io::Io for stdin/stdout streams use futures::{ Async, Future }; use futures_rb::rb; use std::{ io, thread }; use std::io::{ Read, Write }; use tokio_core::io::{ Io }; /// Type that implemen...
code_fim
hard
{ "lang": "rust", "repo": "nathanjent/tokio-stdio", "path": "/src/stdio.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok( ( ) ) } } impl Io for Stdio { fn poll_read( &mut self ) -> Async< ( ) > { self.stdin_buffer_receiver.poll_read( ) } fn poll_write( &mut self ) -> Async< ( ) > { self.stdout_buffer_sender.poll_write( ) } } impl Stdio { /// Create a new instance of S...
code_fim
hard
{ "lang": "rust", "repo": "nathanjent/tokio-stdio", "path": "/src/stdio.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ebfe/rust-capstone path: /src/lib.rs #![crate_name="capstone"] #![crate_type="rlib"] extern crate libc; #[macro_use] extern crate bitflags; use libc::{c_int, c_void, size_t}; use std::ffi::CStr; mod ll; #[cfg(test)] mod tests; #[derive(Clone, Copy, Debug)] pub enum Arch { Arm = 0, ...
code_fim
hard
{ "lang": "rust", "repo": "ebfe/rust-capstone", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn set_option(&self, option: Opt, value: usize) -> Result<(), Error> { unsafe { match ll::cs_option(self.handle, option as c_int, value as size_t) { 0 => Ok(()), e => Err(Error::new(e as usize)), } } } pub fn disasm(&...
code_fim
hard
{ "lang": "rust", "repo": "ebfe/rust-capstone", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn visit_value_seed<T>(&mut self, seed: T) -> Result<T::Value, self::Error> where T: de::DeserializeSeed, { seed.deserialize(&mut *self.de) } fn size_hint(&self) -> (usize, Option<usize>) { if self.map { (0, None) } else { (1, None) } }...
code_fim
hard
{ "lang": "rust", "repo": "TwiceCast/amf", "path": "/src/de.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TwiceCast/amf path: /src/de.rs extern crate byteorder; use std::io; use serde::de; use serde; use reader::{Read, SliceReader}; use error::Error; use self::byteorder::{BigEndian, ReadBytesExt}; use value::Marker; pub struct Deserializer<W> { pub reader: W, } impl<'a> Deserialize...
code_fim
hard
{ "lang": "rust", "repo": "TwiceCast/amf", "path": "/src/de.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fiatjaf/rustbyexample path: /examples/variables/variables.rs // In Rust, _variables_ are explicitly declared and used by // the compiler to e.g. check type-correctness of function // calls. fn main() { <|fim_suffix|> // Rust will infer the type of initialized variables. let d = true; ...
code_fim
hard
{ "lang": "rust", "repo": "fiatjaf/rustbyexample", "path": "/examples/variables/variables.rs", "mode": "psm", "license": "CC-BY-3.0", "source": "the-stack-v2" }
<|fim_suffix|> // You can explicitly declare the type of a variable if you // can't or don't want to allow Rust infer it. let f: u32 = 4; println!("{}", f); }<|fim_prefix|>// repo: fiatjaf/rustbyexample path: /examples/variables/variables.rs // In Rust, _variables_ are explicitly declared and used by //...
code_fim
medium
{ "lang": "rust", "repo": "fiatjaf/rustbyexample", "path": "/examples/variables/variables.rs", "mode": "spm", "license": "CC-BY-3.0", "source": "the-stack-v2" }
<|fim_suffix|> let sec_num = rand::thread_rng().gen_range(1, 101); loop { println!("Guess the number:"); let mut guess = String::new(); io::stdin() .read_line(&mut guess) .expect("Failed to read line"); println!("You guessed: {}", guess); let gue...
code_fim
medium
{ "lang": "rust", "repo": "sprajagopal/rusting", "path": "/guessing_improved/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sprajagopal/rusting path: /guessing_improved/src/main.rs use rand::Rng; use std::cmp::Ordering; use std::io; pub struct Guess { value : i32, } impl Guess { pub fn new(value : i32) -> Guess{ if value < 1 || value > 101 { panic!("Guess not within bounds"); } ...
code_fim
hard
{ "lang": "rust", "repo": "sprajagopal/rusting", "path": "/guessing_improved/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>2::R) reader structure"] impl crate::Readable for FMPRE2 {} #[doc = "`write(|w| ..)` method takes [fmpre2::W](fmpre2::W) writer structure"] impl crate::Writable for FMPRE2 {} #[doc = "Flash Memory Protection Read Enable 2"] pub mod fmpre2; #[doc = "Flash Memory Protection Read Enable 3\n\nThis register yo...
code_fim
hard
{ "lang": "rust", "repo": "m-labs/dslite2svd", "path": "/crates/tm4c129x/src/flash_ctrl.rs", "mode": "spm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_suffix|>pub type SSIZE = crate::Reg<u32, _SSIZE>; #[allow(missing_docs)] #[doc(hidden)] pub struct _SSIZE; #[doc = "`read()` method returns [ssize::R](ssize::R) reader structure"] impl crate::Readable for SSIZE {} #[doc = "SRAM Size"] pub mod ssize; #[doc = "Flash Configuration Register\n\nThis register you can [...
code_fim
hard
{ "lang": "rust", "repo": "m-labs/dslite2svd", "path": "/crates/tm4c129x/src/flash_ctrl.rs", "mode": "spm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_prefix|>// repo: m-labs/dslite2svd path: /crates/tm4c129x/src/flash_ctrl.rs doc = "`write(|w| ..)` method takes [userreg3::W](userreg3::W) writer structure"] impl crate::Writable for USERREG3 {} #[doc = "User Register 3"] pub mod userreg3; #[doc = "Flash Memory Protection Read Enable 0\n\nThis register you can [...
code_fim
hard
{ "lang": "rust", "repo": "m-labs/dslite2svd", "path": "/crates/tm4c129x/src/flash_ctrl.rs", "mode": "psm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_suffix|> match &bb.terminator().kind { TerminatorKind::Call { destination, .. } => { if let Some((dest_place, _dest_bb)) = destination { let dest_layout = fx.layout_of(fx.monomorphize(&dest_place.ty(&fx.mir.local_decls, fx.tcx).ty)); if !c...
code_fim
hard
{ "lang": "rust", "repo": "l4l/rustc_codegen_cranelift", "path": "/src/analyze.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: l4l/rustc_codegen_cranelift path: /src/analyze.rs use crate::prelude::*; use rustc_middle::mir::StatementKind::*; use rustc_index::vec::IndexVec; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub(crate) enum SsaKind { NotSsa, Ssa, } <|fim_suffix|> for bb in fx.mir.basic_blocks...
code_fim
hard
{ "lang": "rust", "repo": "l4l/rustc_codegen_cranelift", "path": "/src/analyze.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> println!( "{:?}", Solution::longest_common_prefix( Vec::from(["flower", "flow", "flight"]) .iter() .map(|elem| elem.to_string()) .collect() ) ); }<|fim_prefix|>// repo: abdullahwaqar/leetcode path: /14.Longest_Com...
code_fim
hard
{ "lang": "rust", "repo": "abdullahwaqar/leetcode", "path": "/14.Longest_Common_Prefix/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: abdullahwaqar/leetcode path: /14.Longest_Common_Prefix/src/main.rs use std::{collections::HashSet, ops::Add}; struct Solution {} impl Solution { pub fn longest_common_prefix(mut strs: Vec<String>) -> String { if strs.is_empty() { return "".to_string(); }; ...
code_fim
hard
{ "lang": "rust", "repo": "abdullahwaqar/leetcode", "path": "/14.Longest_Common_Prefix/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Get user email verification token route router.add_route_with_params(r"^/users/(\d+)/email_verify_token$", |params| { params .get(0) .and_then(|string_id| string_id.parse().ok()) .map(|user_id| Route::GetUserEmalVerifyToken { user_id }) }); /...
code_fim
hard
{ "lang": "rust", "repo": "SINHASantos/users", "path": "/src/controller/routes.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SINHASantos/users path: /src/controller/routes.rs use stq_router::RouteParser; use stq_types::{RoleId, UserId}; /// List of all routes with params for the app #[derive(Clone, Debug, PartialEq)] pub enum Route { Healthcheck, Users, User(UserId), UserDelete(UserId), UserBlock(...
code_fim
hard
{ "lang": "rust", "repo": "SINHASantos/users", "path": "/src/controller/routes.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dgrunwald/rust-cpython path: /python3-sys/src/structseq.rs use libc::{c_char, c_int}; use crate::object::{PyObject, PyTypeObject}; use crate::pyport::Py_ssize_t; #[repr(C)] #[derive(Copy)] pub struct PyStructSequence_Field { #[cfg(not(Py_3_7))] pub name: *mut c_char, #[cfg(Py_3_7)]...
code_fim
hard
{ "lang": "rust", "repo": "dgrunwald/rust-cpython", "path": "/python3-sys/src/structseq.rs", "mode": "psm", "license": "bzip2-1.0.6", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg_attr(windows, link(name = "pythonXY"))] extern "C" { pub fn PyStructSequence_NewType(desc: *mut PyStructSequence_Desc) -> *mut PyTypeObject; pub fn PyStructSequence_New(_type: *mut PyTypeObject) -> *mut PyObject; pub fn PyStructSequence_SetItem( arg1: *mut PyObject, arg2:...
code_fim
hard
{ "lang": "rust", "repo": "dgrunwald/rust-cpython", "path": "/python3-sys/src/structseq.rs", "mode": "spm", "license": "bzip2-1.0.6", "source": "the-stack-v2" }
<|fim_suffix|> result.add_fn("pop", |vm, args| match vm.get_args(args) { [List(l)] => match l.data_mut().pop() { Some(value) => Ok(value), None => Ok(Null), }, unexpected => type_error_with_slice("a List as argument", unexpected), }); result.add_fn("push", |vm...
code_fim
hard
{ "lang": "rust", "repo": "ales-tsurko/koto", "path": "/core/runtime/src/core/list.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ales-tsurko/koto path: /core/runtime/src/core/list.rs //! The `list` core library module use { super::iterator::collect_pair, crate::{ prelude::*, value_sort::{compare_values, sort_values}, }, std::{cmp::Ordering, ops::DerefMut}, }; /// Initializes the `list` co...
code_fim
hard
{ "lang": "rust", "repo": "ales-tsurko/koto", "path": "/core/runtime/src/core/list.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> result.add_fn("resize_with", |vm, args| match vm.get_args(args) { [List(l), Number(n), f] if *n >= 0.0 && f.is_callable() => { let new_size = usize::from(n); let len = l.len(); let l = l.clone(); let f = f.clone(); match len.cmp(&new...
code_fim
hard
{ "lang": "rust", "repo": "ales-tsurko/koto", "path": "/core/runtime/src/core/list.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>use std::path::{Path, PathBuf}; use std::thread; use rocket::response::NamedFile; #[macro_use] mod macro_utils; mod common; mod event; mod ws; mod game; #[get("/")] fn hello() -> Option<NamedFile> { static_file("index.html".into()) } #[get("/<path..>", rank = 5)] fn static_file(path: PathBuf) -> Op...
code_fim
hard
{ "lang": "rust", "repo": "chmnchiang/cssh_game", "path": "/server/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[get("/<path..>", rank = 5)] fn static_file(path: PathBuf) -> Option<NamedFile> { NamedFile::open(Path::new("../client/").join(path)).ok() } #[get("/pimg/<path..>", rank = 3)] fn pimg_file(path: PathBuf) -> Option<NamedFile> { NamedFile::open(Path::new("../problems/images/").join(path)).ok() } ...
code_fim
hard
{ "lang": "rust", "repo": "chmnchiang/cssh_game", "path": "/server/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chmnchiang/cssh_game path: /server/src/main.rs #![feature(plugin, custom_attribute)] #![plugin(rocket_codegen)] #![feature(conservative_impl_trait, type_ascription, fnbox, vec_remove_item)] #![allow(non_upper_case_globals)] #[macro_use] extern crate lazy_static; <|fim_suffix|>#[get("/<path..>"...
code_fim
hard
{ "lang": "rust", "repo": "chmnchiang/cssh_game", "path": "/server/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CarlEkerot/gameboy path: /src/operations/ld.rs use cpu::CPU; use instructions::Instruction; use definition::Operand; use errors::*; use constants::*; use operations::Execute; pub struct Load; impl Execute for Load { fn execute(instruction: &Instruction, cpu: &mut CPU) -> Result<()> { ...
code_fim
hard
{ "lang": "rust", "repo": "CarlEkerot/gameboy", "path": "/src/operations/ld.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut cpu = test_cpu(); cpu.reg[REG_A] = 0xab; execute_instruction(&mut cpu, 0xea, Some(0xff22)); assert_eq!(cpu.load_mem(0xff22), 0xab); } #[test] fn test_ld_c_addr_offset_to_a() { let mut cpu = test_cpu(); cpu.store_mem(0xff22, 0xab); ...
code_fim
hard
{ "lang": "rust", "repo": "CarlEkerot/gameboy", "path": "/src/operations/ld.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: longfangsong/rust_mysql_common path: /src/packets.rs != 0xfb { return Err(io::Error::new( io::ErrorKind::InvalidData, "Invalid LOCAL_INFILE packet header", )); } Ok(LocalInfilePacket { file_name: payload.into(),...
code_fim
hard
{ "lang": "rust", "repo": "longfangsong/rust_mysql_common", "path": "/src/packets.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: longfangsong/rust_mysql_common path: /src/packets.rs max(12, scramble_len as i8 - 9) as usize, "Invalid handshake packet" )?; payload.read_u8()?; (Some(scramble_2), payload) } else { (None, p...
code_fim
hard
{ "lang": "rust", "repo": "longfangsong/rust_mysql_common", "path": "/src/packets.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> const LIP: &[u8] = b"\xfbfile_name"; let lip = parse_local_infile_packet(LIP).unwrap(); assert_eq!(lip.file_name_str(), "file_name"); } #[test] fn should_parse_stmt_packet() { const SP: &[u8] = b"\x00\x01\x00\x00\x00\x01\x00\x02\x00\x00\x00\x00"; const...
code_fim
hard
{ "lang": "rust", "repo": "longfangsong/rust_mysql_common", "path": "/src/packets.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test_elapsed() { let mut c = Cooldown::new(1.0,); assert_eq!(c.is_elapsed(), false); c.update(1.1,); assert_eq!(c.is_elapsed(), true); c.restart(); assert_eq!(c.is_elapsed(), false); c.update(0.1,); assert_eq!(c.is_elapsed(), false); c.update(0.1,); asser...
code_fim
medium
{ "lang": "rust", "repo": "nordsoyv/rust_win32", "path": "/game-core/src/entities/cooldown.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nordsoyv/rust_win32 path: /game-core/src/entities/cooldown.rs pub struct Cooldown { current: f32, cool_down: f32, } impl Cooldown { pub fn new(time: f32) -> Cooldown { Cooldown { current: time, cool_down: time, } } pub fn set_cooldown...
code_fim
medium
{ "lang": "rust", "repo": "nordsoyv/rust_win32", "path": "/game-core/src/entities/cooldown.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn restart(&mut self) { self.current = self.cool_down; } } #[test] fn test_elapsed() { let mut c = Cooldown::new(1.0,); assert_eq!(c.is_elapsed(), false); c.update(1.1,); assert_eq!(c.is_elapsed(), true); c.restart(); assert_eq!(c.is_elapsed(), false); c.up...
code_fim
hard
{ "lang": "rust", "repo": "nordsoyv/rust_win32", "path": "/game-core/src/entities/cooldown.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: paritytech/wasm-utils path: /cli/build/source.rs //! Configuration of source binaries pub const UNKNOWN_TRIPLET: &str = "wasm32-unknown-unknown"; pub const EMSCRIPTEN_TRIPLET: &str = "wasm32-unknown-emscripten"; use pwasm_utils::SourceTarget; /// Configuration of previous build step (cargo co...
code_fim
medium
{ "lang": "rust", "repo": "paritytech/wasm-utils", "path": "/cli/build/source.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn unknown(mut self) -> Self { self.target = SourceTarget::Unknown; self } pub fn emscripten(mut self) -> Self { self.target = SourceTarget::Emscripten; self } pub fn with_final(mut self, final_name: &'a str) -> Self { self.final_name = final_name; self } pub fn target_dir(&self)...
code_fim
hard
{ "lang": "rust", "repo": "paritytech/wasm-utils", "path": "/cli/build/source.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// \return all the characters which fold to c's fold. /// This is a slow linear search across all ranges. pub fn unfold_char(c: char) -> Vec<char> { let mut res = vec![c]; let fc = fold(c); if fc != c { res.push(fc) } // TODO: optimize ASCII case. let fcp = fc as u32; ...
code_fim
hard
{ "lang": "rust", "repo": "HalidOdat/regress", "path": "/src/folds.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn apply(&self, cu: u32) -> u32 { debug_assert!(self.can_apply(cu), "Cannot apply to this code point"); let offset = cu - self.first(); if offset % (self.modulo as u32) != 0 { cu } else { self.add_delta(cu) } } } pub fn fold(c: char)...
code_fim
hard
{ "lang": "rust", "repo": "HalidOdat/regress", "path": "/src/folds.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HalidOdat/regress path: /src/folds.rs use crate::codepointset::{CodePointSet, Interval}; use crate::foldtable::{FoldRange, FOLDS}; use crate::util::SliceHelp; use std::cmp::Ordering; impl FoldRange { fn first(&self) -> u32 { self.start as u32 } fn last(&self) -> u32 { ...
code_fim
hard
{ "lang": "rust", "repo": "HalidOdat/regress", "path": "/src/folds.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> &mut self, layout: &B::PipelineLayout, first_set: usize, sets: &[&B::DescriptorSet], ); /// Execute a workgroup in the compute pipeline. /// /// # Errors /// /// This function does not return an error. Invalid usage of this function /// will res...
code_fim
hard
{ "lang": "rust", "repo": "scoopr/gfx", "path": "/src/hal/src/command/raw.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: scoopr/gfx path: /src/hal/src/command/raw.rs use std::ops::Range; use pso; use {Backend, IndexCount, InstanceCount, VertexCount, VertexOffset}; use buffer::IndexBufferView; use image::{ImageLayout, SubresourceRange}; use memory::Barrier; use super::{ ColorValue, StencilValue, Rect, Viewport...
code_fim
hard
{ "lang": "rust", "repo": "scoopr/gfx", "path": "/src/hal/src/command/raw.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// fn bind_graphics_descriptor_sets( &mut self, layout: &B::PipelineLayout, first_set: usize, sets: &[&B::DescriptorSet], ); /// Bind a compute pipeline. /// /// # Errors /// /// This function does not return an error. Invalid usage of this...
code_fim
hard
{ "lang": "rust", "repo": "scoopr/gfx", "path": "/src/hal/src/command/raw.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Acelya-9028/sprinkle path: /src/error.rs use block_modes::BlockModeError; use derive_more::Display; use failure::Backtrace; use failure::Fail; use std::io; use std::path::{Path, PathBuf}; use std::str::Utf8Error; use std::string::FromUtf8Error; use ini; use std::borrow::Cow; #[derive(Debug, Fai...
code_fim
hard
{ "lang": "rust", "repo": "Acelya-9028/sprinkle", "path": "/src/error.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl From<(usize, cmac::crypto_mac::MacError)> for Error { fn from((id, err): (usize, cmac::crypto_mac::MacError)) -> Error { Error::MacError(err, id, Backtrace::new()) } } impl From<Box<bincode::ErrorKind>> for Error { fn from(err: Box<bincode::ErrorKind>) -> Error { Error::B...
code_fim
hard
{ "lang": "rust", "repo": "Acelya-9028/sprinkle", "path": "/src/error.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Error::BincodeError(err, Backtrace::new()) } } impl From<rsa::errors::Error> for Error { fn from(err: rsa::errors::Error) -> Error { Error::RsaError(err, Backtrace::new()) } } impl From<pem::PemError> for Error { fn from(err: pem::PemError) -> Error { Error::PemEr...
code_fim
hard
{ "lang": "rust", "repo": "Acelya-9028/sprinkle", "path": "/src/error.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl Eq for Integer { } impl PartialOrd for Integer { fn partial_cmp(&self, rhs: &Integer) -> Option<Ordering> { Some( self.cmp( rhs)) } }<|fim_prefix|>// repo: PKAuth/rmp path: /src/rmp/ord.rs use std::cmp::{Ord, Ordering}; use super::{Integer}; impl Ord for Integer { fn cmp(&self, rhs: &Integer...
code_fim
hard
{ "lang": "rust", "repo": "PKAuth/rmp", "path": "/src/rmp/ord.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PKAuth/rmp path: /src/rmp/ord.rs use std::cmp::{Ord, Ordering}; use super::{Integer}; impl Ord for Integer { fn cmp(&self, rhs: &Integer) -> Ordering { fn helper( a : &Integer, b : &Integer) -> Ordering { let a_s = a.size(); let b_s = b.size(); if a_s > b_s { return Ordering::G...
code_fim
hard
{ "lang": "rust", "repo": "PKAuth/rmp", "path": "/src/rmp/ord.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl PartialEq for Integer { fn eq(&self, rhs : &Integer) -> bool { self.cmp( rhs) == Ordering::Equal } } impl Eq for Integer { } impl PartialOrd for Integer { fn partial_cmp(&self, rhs: &Integer) -> Option<Ordering> { Some( self.cmp( rhs)) } }<|fim_prefix|>// repo: PKAuth/rmp path: /src/rmp/or...
code_fim
hard
{ "lang": "rust", "repo": "PKAuth/rmp", "path": "/src/rmp/ord.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut pre: Option<Box<ListNode>> = None; for _ in 0..k { let header = head.clone(); result.push(header); let temp = if rem > 0 { ave + 1 } else { ave }; for _ in 0..temp { let mut headle = head.take(); match pre.take() { Some(node) => { ...
code_fim
hard
{ "lang": "rust", "repo": "iKurum/leet_code", "path": "/rust/src/medium/c725.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iKurum/leet_code path: /rust/src/medium/c725.rs // Definition for singly-linked list. #[derive(PartialEq, Eq, Clone, Debug)] pub struct ListNode { pub val: i32, pub next: Option<Box<ListNode>>, } impl ListNode { #[inline] fn new(val: i32) -> Self { ListNode { next: None, val } } }...
code_fim
hard
{ "lang": "rust", "repo": "iKurum/leet_code", "path": "/rust/src/medium/c725.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(node) = node.next { Solution::push(node, val); } else { node.next = Some(Box::new(ListNode { val, next: None })); } } } pub fn test(head: Option<Box<ListNode>>, k: i32) -> Vec<Option<Box<ListNode>>> { Solution::split_list_to_parts(head, k) }<|fim_prefix|>// repo: i...
code_fim
hard
{ "lang": "rust", "repo": "iKurum/leet_code", "path": "/rust/src/medium/c725.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mystor/dist-xprs-example path: /bt/nsIDOMFontFace.rs // // DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl/nsIDOMFontFace.idl // {static D: &'static [Interface] = &[ Interface { name: "nsIDOMFontFace", base: Some("nsISupports"), methods:...
code_fim
hard
{ "lang": "rust", "repo": "mystor/dist-xprs-example", "path": "/bt/nsIDOMFontFace.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /* readonly attribute long srcIndex; */ Method { name: "get_srcIndex", abi: "C", params: &[Param { name: "aSrcIndex", ty: "*mut libc::int32_t" }], ret: "nsresult", ...
code_fim
hard
{ "lang": "rust", "repo": "mystor/dist-xprs-example", "path": "/bt/nsIDOMFontFace.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zgrannan/tendermint-prusti path: /tendermint/src/hash.rs /// Hash digests pub const SHA256_HASH_SIZE: usize = 32;<|fim_suffix|>, Ord)] pub enum Hash { /// SHA-256 hashes Sha256([u8; SHA256_HASH_SIZE]), /// Empty hash None, }<|fim_middle|> // #[derive(Copy, Clone, Hash, Eq, Partia...
code_fim
easy
{ "lang": "rust", "repo": "zgrannan/tendermint-prusti", "path": "/tendermint/src/hash.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>6([u8; SHA256_HASH_SIZE]), /// Empty hash None, }<|fim_prefix|>// repo: zgrannan/tendermint-prusti path: /tendermint/src/hash.rs /// Hash digests pub const SHA256_HASH_SIZE: usize = 32;<|fim_middle|> // #[derive(Copy, Clone, Hash, Eq, PartialEq, PartialOrd, Ord)] pub enum Hash { /// SHA-256 h...
code_fim
medium
{ "lang": "rust", "repo": "zgrannan/tendermint-prusti", "path": "/tendermint/src/hash.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // note that there are a number of downsides to this approach, the comments // below detail how to improve the portability of these commands. let mut cmd = Command::new("cargo"); cmd.current_dir(&frontend_dir); cmd.args(&["web", "deploy"]); if Ok("release".into()) == env::var("PROF...
code_fim
medium
{ "lang": "rust", "repo": "zipper97412/rustfullstack", "path": "/build.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zipper97412/rustfullstack path: /build.rs use std::process::Command; use std::env; use std::path::PathBuf; fn main() { <|fim_suffix|> // note that there are a number of downsides to this approach, the comments // below detail how to improve the portability of these commands. let mut ...
code_fim
medium
{ "lang": "rust", "repo": "zipper97412/rustfullstack", "path": "/build.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: subspace/subspace path: /domains/test/primitives/src/lib.rs #![cfg_attr(not(feature = "std"), no_std)] //! Test primitive crates that expose necessary extensions that are used in tests. use codec::{Decode, Encode}; use sp_messenger::messages::{ChainId, ChannelId}; use subspace_runtime_primitive...
code_fim
hard
{ "lang": "rust", "repo": "subspace/subspace", "path": "/domains/test/primitives/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Returns the last open channel for a given domain. fn get_open_channel_for_chain(dst_chain_id: ChainId) -> Option<ChannelId>; } }<|fim_prefix|>// repo: subspace/subspace path: /domains/test/primitives/src/lib.rs #![cfg_attr(not(feature = "std"), no_std)] //! Test primitive crates ...
code_fim
hard
{ "lang": "rust", "repo": "subspace/subspace", "path": "/domains/test/primitives/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[macro_use] mod macros; mod model; mod schema; mod dbconfig; mod dto; mod base_card; mod player; mod player_card; mod utils; #[actix_web::main] async fn main() -> std::io::Result<()> { std::env::set_var("RUST_LOG", "info"); env_logger::init(); HttpServer::new(|| { App::new() ...
code_fim
medium
{ "lang": "rust", "repo": "fabioqmarsiaj/sakata-api", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fabioqmarsiaj/sakata-api path: /src/main.rs #[macro_use] extern crate diesel; use actix_cors::Cors; use actix_web::{App, HttpServer}; use actix_web::middleware::Logger; use crate::dbconfig::connect; #[macro_use] mod macros; mod model; mod schema; mod dbconfig; mod dto; mod base_card; mod play...
code_fim
medium
{ "lang": "rust", "repo": "fabioqmarsiaj/sakata-api", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match session::Session::start() { Err(session::SessionError::MissingEnvVar) => { error!("No fd specified, stopping."); } Err(session::SessionError::BadFdValue(fd_s)) => { error!("{} can't be used as a file descriptor, stopping", fd_s); } ...
code_fim
hard
{ "lang": "rust", "repo": "10allday-kai/api-daemon", "path": "/child-test-daemon/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: 10allday-kai/api-daemon path: /child-test-daemon/src/main.rs use common::expose_remote_service; use log::{error, info}; use std::io::Write; #[cfg(target_os = "android")] fn init_logger(verbose: bool) { use android_logger::Filter; use log::Level; <|fim_suffix|> init_logger(true); ...
code_fim
hard
{ "lang": "rust", "repo": "10allday-kai/api-daemon", "path": "/child-test-daemon/src/main.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> info!("Starting child-test-daemon"); match session::Session::start() { Err(session::SessionError::MissingEnvVar) => { error!("No fd specified, stopping."); } Err(session::SessionError::BadFdValue(fd_s)) => { error!("{} can't be used as a file descri...
code_fim
hard
{ "lang": "rust", "repo": "10allday-kai/api-daemon", "path": "/child-test-daemon/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>fn digits_to_u64(digits: &[u64]) -> u64 { digits .iter() .fold(0, |number, digit| number * 10 + digit) }<|fim_prefix|>// repo: asafigan/rust-project-euler path: /problem24/src/main.rs fn main() { println!("{}", nth_lexicographic_permutation(1_000_000)); } #[cfg(test)] mod tests { use...
code_fim
hard
{ "lang": "rust", "repo": "asafigan/rust-project-euler", "path": "/problem24/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: asafigan/rust-project-euler path: /problem24/src/main.rs fn main() { println!("{}", nth_lexicographic_permutation(1_000_000)); } #[cfg(test)] mod tests { use super::*; #[test] fn case_1() { assert_eq!(nth_lexicographic_permutation(1), 123456789); } #[test] f...
code_fim
hard
{ "lang": "rust", "repo": "asafigan/rust-project-euler", "path": "/problem24/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kateinoigakukun/wasminspect path: /crates/debugger-server/src/lib.rs mod debugger_proxy; mod rpc; mod serialization; mod socket; use hyper::{ service::{make_service_fn, service_fn}, Method, Request, StatusCode, }; use hyper::{Body, Response, Server}; use std::net::SocketAddr; <|fim_su...
code_fim
hard
{ "lang": "rust", "repo": "kateinoigakukun/wasminspect", "path": "/crates/debugger-server/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> println!("Listening on http://{}", server.local_addr()); let graceful = server.with_graceful_shutdown(shutdown_signal()); if let Err(e) = graceful.await { eprintln!("server error: {}", e); } }<|fim_prefix|>// repo: kateinoigakukun/wasminspect path: /crates/debugger-server/src/lib...
code_fim
medium
{ "lang": "rust", "repo": "kateinoigakukun/wasminspect", "path": "/crates/debugger-server/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stm32-rs/stm32-rs-nightlies path: /stm32wb/src/stm32wb55/dma1/ccr4.rs #[doc = "Register `CCR4` reader"] pub type R = crate::R<CCR4_SPEC>; #[doc = "Register `CCR4` writer"] pub type W = crate::W<CCR4_SPEC>; #[doc = "Field `EN` reader - Channel enable"] pub type EN_R = crate::BitReader; #[doc = "F...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32wb/src/stm32wb55/dma1/ccr4.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>crement mode"] #[inline(always)] #[must_use] pub fn minc(&mut self) -> MINC_W<CCR4_SPEC, 7> { MINC_W::new(self) } #[doc = "Bits 8:9 - Peripheral size"] #[inline(always)] #[must_use] pub fn psize(&mut self) -> PSIZE_W<CCR4_SPEC, 8> { PSIZE_W::new(self) } ...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32wb/src/stm32wb55/dma1/ccr4.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nickmachnik/fasta-rs path: /src/pieces.rs //! Structs that represent specific pieces of information //! found in FASTA files. Useful for extracting and storing //! these parts. use crate::errors; use crate::helpers::seq_id_from_description; use crate::read::FastaReader; use serde::{Deserialize...
code_fim
hard
{ "lang": "rust", "repo": "nickmachnik/fasta-rs", "path": "/src/pieces.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Writes the accessions to json. pub fn to_json(&self, outpath: &Path) -> Result<(), io::Error> { let mut file = BufWriter::new(File::create(&outpath)?); serde_json::to_writer(&mut file, &self.accessions)?; Ok(()) } /// Writes the accessions to a txt file, one pe...
code_fim
hard
{ "lang": "rust", "repo": "nickmachnik/fasta-rs", "path": "/src/pieces.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn accessions_from_fasta_short() { assert_eq!( FastaAccessions::from_fasta(Path::new("./resources/test_short_descr.fasta"), "|", 1) .accessions, vec!["Q2HZH0", "P93158", "H0VS30"] ) } #[test] fn accessions_from_fasta_long...
code_fim
hard
{ "lang": "rust", "repo": "nickmachnik/fasta-rs", "path": "/src/pieces.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> app.add_event::<SpawnPowerup>() .insert_resource(PowerupSpawner { timer: Timer::new(Duration::from_secs_f32(10.0), true), }) .add_system_set( SystemSet::on_update(GameState::Game) .with_system(spawn_powerups.sy...
code_fim
medium
{ "lang": "rust", "repo": "mthom26/missile-command", "path": "/src/powerups/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mthom26/missile-command path: /src/powerups/mod.rs use bevy::{prelude::*, utils::Duration}; mod powerup_spawner; mod powerups; pub use self::{ powerup_spawner::{run_powerup_spawner, spawn_powerups, PowerupSpawner, SpawnPowerup}, powerups::{check_offscreen_powerups, despawn_powerups}, }...
code_fim
medium
{ "lang": "rust", "repo": "mthom26/missile-command", "path": "/src/powerups/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kunicmarko20/helpable path: /helpable/src/config.rs use config::Config as InnerConfig; use config::*; use std::collections::HashMap; use std::fs::{create_dir_all, File as StdFile, OpenOptions}; use std::io::Write; use std::path::PathBuf; pub struct Config { config: InnerConfig, config_p...
code_fim
hard
{ "lang": "rust", "repo": "kunicmarko20/helpable", "path": "/helpable/src/config.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> value } pub fn set<T>(&mut self, key: &str, value: T) where T: Into<Value>, { self.config .set(key, value) .unwrap_or_else(|_| panic!("Unable to set {}.", key)); } pub fn save(&mut self) { if let Ok(mut file) = OpenOptions::...
code_fim
hard
{ "lang": "rust", "repo": "kunicmarko20/helpable", "path": "/helpable/src/config.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> }).unwrap(); } Ok(()) } async fn handle_message( payload: Arc<Vec<u8>>, state: Arc<State>, start_timestamp: DateTime<Utc>, ) -> Result<Vec<Box<dyn Publishable>>, Error> { use endpoint::{handle_event, handle_request, handle_unknown_method}; let envelope = serde_json::...
code_fim
hard
{ "lang": "rust", "repo": "dzianis-pirshtuk/conference", "path": "/src/app/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dzianis-pirshtuk/conference path: /src/app/mod.rs t::mqtt::{ compat, AgentBuilder, ConnectionMode, Notification, Publishable, QoS, SubscriptionTopic, }; use svc_agent::{AgentId, Authenticable, SharedGroup, Subscription}; use svc_authn::{jose::Algorithm, token::jws_compact}; use crate::db::C...
code_fim
hard
{ "lang": "rust", "repo": "dzianis-pirshtuk/conference", "path": "/src/app/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn target_features() { let f_1_0 = RustFeatures::from(RustTarget::Stable_1_0); assert!( !f_1_0.static_lifetime_elision && !f_1_0.core_ffi_c_void && !f_1_0.untagged_union && !f_1_0.associated_const && ...
code_fim
hard
{ "lang": "rust", "repo": "ric2b/Vivaldi-browser", "path": "/chromium/third_party/rust/autocxx_bindgen/v0_60/crate/src/features.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ric2b/Vivaldi-browser path: /chromium/third_party/rust/autocxx_bindgen/v0_60/crate/src/features.rs //! Contains code for selecting features #![deny(missing_docs)] #![deny(unused_extern_crates)] use std::io; use std::str::FromStr; /// Define RustTarget struct definition, Default impl, and conv...
code_fim
hard
{ "lang": "rust", "repo": "ric2b/Vivaldi-browser", "path": "/chromium/third_party/rust/autocxx_bindgen/v0_60/crate/src/features.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TheMushrr00m/lumen path: /lumen_runtime/src/otp/erlang/apply_2/test/with_function.rs mod with_empty_list_arguments; mod with_non_empty_proper_list_arguments; use super::*; use crate::test::strategy::module_function_arity; #[test] fn without_proper_list_arguments_errors_badarg() { with_pro...
code_fim
hard
{ "lang": "rust", "repo": "TheMushrr00m/lumen", "path": "/lumen_runtime/src/otp/erlang/apply_2/test/with_function.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> prop_assert_eq!(result, Err(badarg!().into())); mem::drop(child_arc_process); Ok(()) }, ) .unwrap(); }); }<|fim_prefix|>// repo: TheMushrr00m/lumen path: /lumen_runtime/src/otp/erlang/apply_2/test/wi...
code_fim
hard
{ "lang": "rust", "repo": "TheMushrr00m/lumen", "path": "/lumen_runtime/src/otp/erlang/apply_2/test/with_function.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> place_frame_with_arguments( child_process, Placement::Push, child_function, child_arguments, ) ...
code_fim
hard
{ "lang": "rust", "repo": "TheMushrr00m/lumen", "path": "/lumen_runtime/src/otp/erlang/apply_2/test/with_function.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: haimgel/display-switch path: /src/input_source.rs // // Copyright © 2020 Haim Gelfenbeyn // This code is licensed under MIT license (see LICENSE.txt for details) // use paste::paste; use serde::de::Error; use serde::{Deserialize, Deserializer}; use std::convert::TryFrom; use std::fmt; macro_ru...
code_fim
hard
{ "lang": "rust", "repo": "haimgel/display-switch", "path": "/src/input_source.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<'de> Deserialize<'de> for InputSource { fn deserialize<D>(deserializer: D) -> Result<InputSource, D::Error> where D: Deserializer<'de>, { let str = String::deserialize(deserializer)?.trim().to_lowercase(); let val = SymbolicInputSource::try_from(str.as_str()); ...
code_fim
hard
{ "lang": "rust", "repo": "haimgel/display-switch", "path": "/src/input_source.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CyanoFresh/KPI-Labs path: /Rust/lab1/src/ti-81_lab_02_var_17_SolomakhaOO.rs // Solomakha Oleksandr TI-81 | Variant 17 /* 692 e Дана действительная квадратная матрица порядка n. Найти наибольшее из значений элементов, расположенных в заштрихованной части матрицы: _____ |\ /| |/ \| ^^^^^ 1 0 1...
code_fim
hard
{ "lang": "rust", "repo": "CyanoFresh/KPI-Labs", "path": "/Rust/lab1/src/ti-81_lab_02_var_17_SolomakhaOO.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(9., result); } #[test] fn matrix4x4() { let a = vec![ vec![1., 2., 3., 4.], vec![5., 6., 7., 8.], vec![9., 10., 11., 12.], vec![13., 14., 15., 16.], ]; let result = task692e(&a); assert_eq!(16...
code_fim
hard
{ "lang": "rust", "repo": "CyanoFresh/KPI-Labs", "path": "/Rust/lab1/src/ti-81_lab_02_var_17_SolomakhaOO.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: J0sh0nat0r/lib-resp.rs path: /src/parser.rs use super::Value; use std::str::FromStr; use nom::{crlf, digit, not_line_ending}; /// Core parser implementation. pub struct Parser; impl Parser { /// Parses RESP from a byte buffer. pub fn parse(data: &[u8]) -> Result<(&[u8], Value), ::nom::...
code_fim
hard
{ "lang": "rust", "repo": "J0sh0nat0r/lib-resp.rs", "path": "/src/parser.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parse_resp(data) } /// Parses a RESP encoded string. /// /// # Examples /// /// ``` /// # use lib_resp::Parser; /// let age = Parser::parse_str(":-3").unwrap(); /// /// println!("{:?}", age); /// ``` pub fn parse_str(resp: &str) -> Result<Option<Val...
code_fim
hard
{ "lang": "rust", "repo": "J0sh0nat0r/lib-resp.rs", "path": "/src/parser.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hellokitty5000/ethan_ws path: /website/src/apps/history/vocabulary_model.rs use std::collections::{HashSet, HashMap}; use std::fs::{read_to_string, File, OpenOptions}; use crate::{GOD_SET_PATH, VOCABULARY_LOG_PATH}; use rand::{thread_rng, Rng}; use rand::seq::SliceRandom; use std::io::{self, Wri...
code_fim
hard
{ "lang": "rust", "repo": "hellokitty5000/ethan_ws", "path": "/website/src/apps/history/vocabulary_model.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn correct_term_id(&self) -> TermId { self.options[self.correct_index] } pub fn is_correct(&self, answer: usize) -> bool { self.correct_index == answer } } #[derive(Debug)] pub struct Query { start: (u8, u8), end: (u8, u8), in_range: Vec<TermId>, exhausted...
code_fim
hard
{ "lang": "rust", "repo": "hellokitty5000/ethan_ws", "path": "/website/src/apps/history/vocabulary_model.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let _ = writeln!(self.file, "{}\t{}", right.inner(), wrong.inner()); *self.map.entry((wrong, right)).or_insert(0) += 1; } fn confusions_for(&self, right: TermId, wrong: TermId) -> usize { self.map.get(&(right, wrong)).copied().unwrap_or(0) } } fn distance(a: &[u8], b:...
code_fim
hard
{ "lang": "rust", "repo": "hellokitty5000/ethan_ws", "path": "/website/src/apps/history/vocabulary_model.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: almondtools/stubbornrust path: /src/transfer_items/referencing_traits.rs use std::collections::VecDeque; #[derive(Copy, Clone)] pub struct TransferItem { data:u64 } pub trait Source { fn read(&mut self) -> Option<TransferItem>; } pub trait Sink { fn write(&mut self, item:TransferItem); ...
code_fim
hard
{ "lang": "rust", "repo": "almondtools/stubbornrust", "path": "/src/transfer_items/referencing_traits.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let to = Vec::new(); let from = [1u64,2u64,3u64,4u64].iter().map(|&d| TransferItem { data:d }).collect::<VecDeque<_>>(); let mut transfer = Transfer { from, to }; let mut iterator = transfer.start(2u64); let e1 = iterator.next().unwrap(); assert_eq!(e1.da...
code_fim
hard
{ "lang": "rust", "repo": "almondtools/stubbornrust", "path": "/src/transfer_items/referencing_traits.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chronium/aatbe-lang path: /comp-be/src/codegen/expr/compare.rs use crate::codegen::{AatbeModule, ValueTypePair}; use parser::ast::PrimitiveType; use llvm_sys_wrapper::LLVMValueRef; pub fn codegen_compare_float( module: &AatbeModule, op: &String, lhs: LLVMValueRef, rhs: LLVMValu...
code_fim
hard
{ "lang": "rust", "repo": "chronium/aatbe-lang", "path": "/comp-be/src/codegen/expr/compare.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }