text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> fn add(&self, _: &Self::A) -> Self::A; fn sub(&self, _: &Self::A) -> Self::A; fn mul(&self, _: &Self::A) -> Self::A; fn conjugate(&self) -> Self::A; fn abs(&self) -> Self::B; fn to_string(&self) -> String; } }<|fim_prefix|>// repo: kygkygkyg/mat...
code_fim
medium
{ "lang": "rust", "repo": "kygkygkyg/matrix_utils", "path": "/src/utils/traits.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn to_string(&self) -> String; } }<|fim_prefix|>// repo: kygkygkyg/matrix_utils path: /src/utils/traits.rs // define algebra for scalar, vector, array pub mod operators { pub trait Operators { /* 関連型といわれる; この記法を用いると、トレイとをさらに一般的に扱いたい場合に ジェネリクスのハードコードが避け...
code_fim
medium
{ "lang": "rust", "repo": "kygkygkyg/matrix_utils", "path": "/src/utils/traits.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kygkygkyg/matrix_utils path: /src/utils/traits.rs // define algebra for scalar, vector, array pub mod operators { pub trait Operators { /* 関連型といわれる; この記法を用いると、トレイとをさらに一般的に扱いたい場合に ジェネリクスのハードコードが避けられる*/ type A; type B; fn add(&self,...
code_fim
medium
{ "lang": "rust", "repo": "kygkygkyg/matrix_utils", "path": "/src/utils/traits.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: YushiOMOTE/redis-ac path: /src/pubsub.rs use futures::{prelude::*, try_ready}; use redis::{ aio::Connection, from_redis_value, ControlFlow, FromRedisValue, RedisError, RedisFuture, RedisResult, ToRedisArgs, Value, }; /// Represents a pubsub message. #[derive(Debug)] pub struct Msg { ...
code_fim
hard
{ "lang": "rust", "repo": "YushiOMOTE/redis-ac", "path": "/src/pubsub.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> loop { if self.fin.is_some() { // Unsubscribing from the pub-sub channel. let (con, value) = try_ready!(self.fin.as_mut().unwrap().poll()); return Ok(Async::Ready((con, Ok(value)))); } if self.recv.is_some() { ...
code_fim
hard
{ "lang": "rust", "repo": "YushiOMOTE/redis-ac", "path": "/src/pubsub.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>/// Debug is different #[allow(unused_macros)] #[macro_export] macro_rules! debug { ($lit:literal, $($arg:tt)+) => (log_crate::log!( target: $crate::log::DEBUG, log_crate::Level::Debug, $lit, $($arg)+) ); ($lit:literal) => (log_crate::log!( t...
code_fim
hard
{ "lang": "rust", "repo": "jparoz/huck", "path": "/src/log.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[allow(unused_macros)] #[macro_export] macro_rules! log_warn { ($target:expr, $($arg:tt)+) => (log_crate::log!(target: $target, log_crate::Level::Warn, $($arg)+)) } #[allow(unused_imports)] pub use log_warn as warn; #[allow(unused_macros)] #[macro_export] macro_rules! info { ($target:expr, $($ar...
code_fim
hard
{ "lang": "rust", "repo": "jparoz/huck", "path": "/src/log.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jparoz/huck path: /src/log.rs // @Todo @Cleanup: These should be more systematically named #[allow(dead_code)] #[rustfmt::skip] pub const DEBUG : &str = " debug"; #[rustfmt::skip] pub const METRICS : &str = " metrics"; #[rustfmt::skip] pub const FILE : &str = " file"; #[rus...
code_fim
hard
{ "lang": "rust", "repo": "jparoz/huck", "path": "/src/log.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/issues/issue-26802.rs // run-pass trait Foo<'a> { fn bar<'b>(&self, x: &'b u8) -> u8 where 'a: 'b { *x+7 } <|fim_suffix|> assert_eq!(test(FooBar).bar(&4), 11); }<|fim_middle|>} pub struct FooBar; impl Foo<'static> for FooBar {} fn test(f...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/issues/issue-26802.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(test(FooBar).bar(&4), 11); }<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/issues/issue-26802.rs // run-pass trait Foo<'a> { fn bar<'b>(&self, x: &'b u8) -> u8 where 'a: 'b { *x+7 } } pub struct FooBar; impl Foo<'static> for FooBar {} fn test(foobar: FooBar)...
code_fim
easy
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/issues/issue-26802.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Skirmisher/ramen path: /src/error.rs use std::{fmt, error}; #[derive(Debug)] pub enum Error { } <|fim_suffix|> write!(f, "TODO") // TODO: ! } }<|fim_middle|>impl error::Error for Error {} impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
code_fim
medium
{ "lang": "rust", "repo": "Skirmisher/ramen", "path": "/src/error.rs", "mode": "psm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_suffix|> write!(f, "TODO") // TODO: ! } }<|fim_prefix|>// repo: Skirmisher/ramen path: /src/error.rs use std::{fmt, error}; #[derive(Debug)] pub enum Error { <|fim_middle|>} impl error::Error for Error {} impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
code_fim
medium
{ "lang": "rust", "repo": "Skirmisher/ramen", "path": "/src/error.rs", "mode": "spm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Skirmisher/ramen path: /src/error.rs use std::{fmt, error}; <|fim_suffix|> write!(f, "TODO") // TODO: ! } }<|fim_middle|>#[derive(Debug)] pub enum Error { } impl error::Error for Error {} impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
code_fim
medium
{ "lang": "rust", "repo": "Skirmisher/ramen", "path": "/src/error.rs", "mode": "psm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_suffix|>PRESENT"] #[inline(always)] pub fn itm_present(&self) -> ITM_PRESENT_R { ITM_PRESENT_R::new((self.bits & 0x01) != 0) } }<|fim_prefix|>// repo: DanielMena399/cc1312take3 path: /cc1312/src/cpu_rom_table/itm.rs #[doc = "Reader of register ITM"] pub type R = crate::R<u32, super::ITM>; #[d...
code_fim
hard
{ "lang": "rust", "repo": "DanielMena399/cc1312take3", "path": "/cc1312/src/cpu_rom_table/itm.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DanielMena399/cc1312take3 path: /cc1312/src/cpu_rom_table/itm.rs #[doc = "Reader of register ITM"] pub type R = crate::R<u32, super::ITM>; #[doc = "Reader of field `ITM`"] pub type ITM_R = crate::R<u32, u<|fim_suffix|>PRESENT"] #[inline(always)] pub fn itm_present(&self) -> ITM_PRESENT_R...
code_fim
hard
{ "lang": "rust", "repo": "DanielMena399/cc1312take3", "path": "/cc1312/src/cpu_rom_table/itm.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: youngqqcn/RustNotes path: /rust-by-example/3-自定义类型/6-常量.rs // Author: yqq // Date: 2022-11-04 23:01:04 // Description: 常量 // Rust中有两种常量 const、static // 'static 生命周期的,可以是可变的变量 'static mut <|fim_suffix|>const COUNT: i32 = 100; static LANGUAGE: &'static str = "Rust"; const THRESHOLD: i32 = ...
code_fim
medium
{ "lang": "rust", "repo": "youngqqcn/RustNotes", "path": "/rust-by-example/3-自定义类型/6-常量.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let n = 16; // 在 main 函数(主函数)中访问常量 println!("This is {}", LANGUAGE); println!("The threshold is {}", THRESHOLD); println!("{} is {}", n, if is_big(n) { "big" } else { "small" }); // 报错!不能修改一个 `const` 常量。 // THRESHOLD = 5; // 改正 ^ 注释掉此行 }<|fim_prefix|>// repo: youngqqcn/Ru...
code_fim
medium
{ "lang": "rust", "repo": "youngqqcn/RustNotes", "path": "/rust-by-example/3-自定义类型/6-常量.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn is_summation_preserving(&self) -> bool { self.offset == 0 } fn is_order_preserving(&self) -> bool { true } fn is_positive_integer(&self) -> bool { true } fn decoded_type(&self) -> BasicType { BasicType::Integer } fn encoding_type(&self) -> EncodingType { T::t() } // TODO(clemens...
code_fim
hard
{ "lang": "rust", "repo": "dsnam/LocustDB", "path": "/src/mem_store/integers.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dsnam/LocustDB path: /src/mem_store/integers.rs use engine::*; use engine::typed_vec::AnyVec; use engine::types::*; use heapsize::HeapSizeOf; use ingest::raw_val::RawVal; use mem_store::*; use std::{u16, u32, u8}; use std::convert::From; use std::env; use std::fmt; use std::marker::PhantomData; ...
code_fim
hard
{ "lang": "rust", "repo": "dsnam/LocustDB", "path": "/src/mem_store/integers.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn encode_int(&self, val: i64) -> RawVal { RawVal::Int(val) } fn is_summation_preserving(&self) -> bool { true } fn is_order_preserving(&self) -> bool { true } fn is_positive_integer(&self) -> bool { true } fn decoded_type(&self) -> BasicType { BasicType::Integer } fn ...
code_fim
hard
{ "lang": "rust", "repo": "dsnam/LocustDB", "path": "/src/mem_store/integers.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/sloth path: /compiler/src/parse/input.rs #[derive(Clone, Debug, Eq, PartialEq)] pub struct Input<'a> { source: &'a str, braces: u64, } impl<'a> Input<'a> { pub fn new(source: &'a str, braces: u64) -> Self { Self { source, braces } } <|fim_suffix|> pub fn brac...
code_fim
medium
{ "lang": "rust", "repo": "isgasho/sloth", "path": "/compiler/src/parse/input.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn braces(&self) -> u64 { self.braces } }<|fim_prefix|>// repo: isgasho/sloth path: /compiler/src/parse/input.rs #[derive(Clone, Debug, Eq, PartialEq)] pub struct Input<'a> { source: &'a str, braces: u64, } impl<'a> Input<'a> { pub fn new(source: &'a str, braces: u64) -> ...
code_fim
medium
{ "lang": "rust", "repo": "isgasho/sloth", "path": "/compiler/src/parse/input.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for index in 0..device_count { devices.push( Device { board_id: Devices::extract_board_id(list, index), serial_number: Devices::extract_serial_number(list, index), device_index: index, } ...
code_fim
hard
{ "lang": "rust", "repo": "Ortuna/hackrf-rs", "path": "/src/devices.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn extract_serial_number(list: *mut ffi::hackrf_device_list, index: i32) -> char { unsafe { *(*list).serial_numbers as u8 as char} } fn extract_board_id(list: *mut ffi::hackrf_device_list, index: i32) -> ffi::hackrf_usb_board_id { let ptr = unsafe { (*list).usb_board_ids }; ...
code_fim
medium
{ "lang": "rust", "repo": "Ortuna/hackrf-rs", "path": "/src/devices.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Ortuna/hackrf-rs path: /src/devices.rs use std::ffi::{CString, CStr}; use std::ptr; use std::mem; use ffi; pub struct Device { pub board_id: ffi::hackrf_usb_board_id, pub serial_number: char, pub device_index: i32, } pub struct Devices{} impl Devices { pub fn fetch() -> Vec<D...
code_fim
medium
{ "lang": "rust", "repo": "Ortuna/hackrf-rs", "path": "/src/devices.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ntln!(" {}", CStr::from_ptr(cppmm_string_vector_get(&vec, i)).to_string_lossy().into_owned()); } } }<|fim_prefix|>// repo: bgyss/cppmm path: /test/containers/test-rust-sys/test.rs use crate::*; use std::ffi::CStr; #[test] fn it_works() { unsafe { let mut vec = containers_Contain...
code_fim
hard
{ "lang": "rust", "repo": "bgyss/cppmm", "path": "/test/containers/test-rust-sys/test.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ontainers_takes_const_vec_string_ref(&vec); for i in 0..cppmm_string_vector_size(&vec) { println!(" {}", CStr::from_ptr(cppmm_string_vector_get(&vec, i)).to_string_lossy().into_owned()); } } }<|fim_prefix|>// repo: bgyss/cppmm path: /test/containers/test-rust-sys/test.rs ...
code_fim
medium
{ "lang": "rust", "repo": "bgyss/cppmm", "path": "/test/containers/test-rust-sys/test.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bgyss/cppmm path: /test/containers/test-rust-sys/test.rs use crate::*; use std::ffi::CStr; #[test] fn it_works() { unsafe { let mut vec = containers_Containers_returns_vec_string(); containers_Containers_takes_mut_vec_string_ref(&mut vec); containers_C<|fim_suffix|>n...
code_fim
medium
{ "lang": "rust", "repo": "bgyss/cppmm", "path": "/test/containers/test-rust-sys/test.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: E-Neo/blog-server path: /src/views/page.rs use crate::error::ServiceError; use crate::models::page::Page; use crate::Pool; use actix_identity::Identity; use actix_web::{error::BlockingError, web, HttpRequest, HttpResponse}; use diesel::prelude::*; use serde::Deserialize; pub async fn get(req: H...
code_fim
medium
{ "lang": "rust", "repo": "E-Neo/blog-server", "path": "/src/views/page.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> use crate::schema::page::dsl::{page, pagename}; let conn = &pool.get().unwrap(); let mut items = page.filter(pagename.eq(page_name)).load::<Page>(conn)?; if let Some(p) = items.pop() { Ok(p) } else { Err(ServiceError::BadRequest(String::from(page_name))) } } fn que...
code_fim
hard
{ "lang": "rust", "repo": "E-Neo/blog-server", "path": "/src/views/page.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn update_exponent(&mut self, exponent: u8) { if self.prime_count == 0 { panic!("There is no prime factor to update the exponent of"); } self.factors[self.prime_count - 1].exponent = exponent; } } fn main() { let mut start_time = Instant::now(); for re...
code_fim
hard
{ "lang": "rust", "repo": "AndrewTweddle/CodingExercises", "path": "/project_euler/src/bin/problem39_v3.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AndrewTweddle/CodingExercises path: /project_euler/src/bin/problem39_v3.rs use std::time::Instant; // See https://en.wikipedia.org/wiki/Pythagorean_triple#Generating_a_triple. // Pythagorean triples (a, b, c) with integer a, b and c have the form: // (k(m^2-n^2), 2kmn, k(m^2+n^2)) // where k,m...
code_fim
hard
{ "lang": "rust", "repo": "AndrewTweddle/CodingExercises", "path": "/project_euler/src/bin/problem39_v3.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sinopiaolive/package-manager path: /lib/src/solver/path.rs use crate::package::PackageName; use crate::version::Version; use std::fmt; use std::ops::Index; use std::slice::Iter; use std::sync::Arc; /// A dependency chain of packages. pub struct Path(Arc<Vec<(Arc<PackageName>, Arc<Version>)>>); ...
code_fim
hard
{ "lang": "rust", "repo": "sinopiaolive/package-manager", "path": "/lib/src/solver/path.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn index(&self, index: usize) -> &Self::Output { self.0.index(index) } } impl fmt::Debug for Path { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { self.0.fmt(f) } } impl PartialEq<Path> for Path { fn eq(&self, other: &Path) -> bool { self.0....
code_fim
medium
{ "lang": "rust", "repo": "sinopiaolive/package-manager", "path": "/lib/src/solver/path.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>acing::East => 2, Facing::North => 3, } }<|fim_prefix|>// repo: peredwardsson/bevy_rpg path: /src/auxfcns.rs use crate::components::*; pub fn facing_to_row(facing: &Facing) -> i32 { match facing { Faci<|fim_middle|>ng::South => 0, Facing::West => 1, F
code_fim
easy
{ "lang": "rust", "repo": "peredwardsson/bevy_rpg", "path": "/src/auxfcns.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: peredwardsson/bevy_rpg path: /src/auxfcns.rs use crate::components::*; pub fn facing_to_row(facing: &Facing) -> i32 { match facing { Faci<|fim_suffix|>acing::East => 2, Facing::North => 3, } }<|fim_middle|>ng::South => 0, Facing::West => 1, F
code_fim
easy
{ "lang": "rust", "repo": "peredwardsson/bevy_rpg", "path": "/src/auxfcns.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ng::South => 0, Facing::West => 1, Facing::East => 2, Facing::North => 3, } }<|fim_prefix|>// repo: peredwardsson/bevy_rpg path: /src/auxfcns.rs use crate::components::*; pub fn facing_to_row(faci<|fim_middle|>ng: &Facing) -> i32 { match facing { Faci
code_fim
easy
{ "lang": "rust", "repo": "peredwardsson/bevy_rpg", "path": "/src/auxfcns.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[repr(C)] pub type CvScalar = [c_double, ..4]; #[repr(C)] pub struct CvSeq { pub flags: c_int, pub header_size: c_int, pub h_prev: *mut CvSeq, pub h_next: *mut CvSeq, pub v_prev: *mut CvSeq, pub v_next: *mut CvSeq, pub total: c_int, } #[repr(C)] pub struct CvSeqBlock; #[repr(C)] pub stru...
code_fim
hard
{ "lang": "rust", "repo": "woxtu/rust-opencv", "path": "/src/ffi/types.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: woxtu/rust-opencv path: /src/ffi/types.rs use libc::{c_double, c_int}; #[repr(C)] pub struct CvArr; #[repr(C)] pub struct CvBox2D; #[repr(C)] pub struct CvCapture; #[repr(C)] pub struct CvChain; #[repr(C)] pub struct CvChainPtReader; <|fim_suffix|>#[repr(C)] pub struct CvPoint2D32f; #[rep...
code_fim
hard
{ "lang": "rust", "repo": "woxtu/rust-opencv", "path": "/src/ffi/types.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[repr(C)] pub struct CvSlice; #[repr(C)] pub struct CvTermCriteria; #[repr(C)] pub struct CvVideoWriter; #[repr(C)] pub struct IplConvKernel; #[repr(C)] pub struct IplImage;<|fim_prefix|>// repo: woxtu/rust-opencv path: /src/ffi/types.rs use libc::{c_double, c_int}; #[repr(C)] pub struct CvArr; #[...
code_fim
hard
{ "lang": "rust", "repo": "woxtu/rust-opencv", "path": "/src/ffi/types.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, Clone, Copy, Serialize)] pub enum HookType { HealthCheck, Reconfigure, FileUpdated, Run, Init, SmokeTest, } impl fmt::Display for HookType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { HookType::Init => write!(f, "in...
code_fim
hard
{ "lang": "rust", "repo": "mfdii/habitat", "path": "/components/sup/src/manager/service/hooks.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Compile a hook into it's destination service directory. pub fn compile(&self, cfg: &ServiceConfig) -> Result<()> { let mut template = Template::new(); try!(template.register_template_file("hook", &self.template)); let toml = try!(cfg.to_toml()); let svc_data = u...
code_fim
hard
{ "lang": "rust", "repo": "mfdii/habitat", "path": "/components/sup/src/manager/service/hooks.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mfdii/habitat path: /components/sup/src/manager/service/hooks.rs // Copyright (c) 2016 Chef Software Inc. and/or applicable contributors // // 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 c...
code_fim
hard
{ "lang": "rust", "repo": "mfdii/habitat", "path": "/components/sup/src/manager/service/hooks.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> item! { #[test] fn [<test_conj_complex_mat_ $t>]() { let a = array![ [Complex::new(1 as $t, 2 as $t), Complex::new(4 as $t, -5 as $t)], [Complex::new(3 as $t, -5 as $t), Complex::new(8 as $t, 3 ...
code_fim
hard
{ "lang": "rust", "repo": "argmin-rs/argmin", "path": "/argmin-math/src/ndarray_m/conj.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: argmin-rs/argmin path: /argmin-math/src/ndarray_m/conj.rs // Copyright 2018-2022 argmin developers // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your...
code_fim
hard
{ "lang": "rust", "repo": "argmin-rs/argmin", "path": "/argmin-math/src/ndarray_m/conj.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(ParameterValue::Rational(data)) = output_stream.parameters.get("frame_rate") { (*codec_context).time_base = data.clone().invert().into(); } Ok(SubtitleEncoder { identifier, stream_index, codec_context, }) } } } impl Drop for Subti...
code_fim
hard
{ "lang": "rust", "repo": "nomalab/stainless-ffmpeg", "path": "/src/subtitle_encoder.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nomalab/stainless-ffmpeg path: /src/subtitle_encoder.rs use crate::{ order::{output::OutputStream, parameters::ParameterValue}, tools, }; use ffmpeg_sys_next::*; #[derive(Debug)] pub struct SubtitleEncoder { pub identifier: String, pub stream_index: isize, pub codec_context: *mut AVCo...
code_fim
hard
{ "lang": "rust", "repo": "nomalab/stainless-ffmpeg", "path": "/src/subtitle_encoder.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cheako/smithay path: /src/backend/egl/error.rs //! EGL error types error_chain! { errors { #[doc = "The requested OpenGL version is not supported"] OpenGlVersionNotSupported(version: (u8, u8)) { description("The requested OpenGL version is not supported."), ...
code_fim
hard
{ "lang": "rust", "repo": "cheako/smithay", "path": "/src/backend/egl/error.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[doc = "EGL was unable to obtain a valid EGL Display"] DisplayNotSupported { description("EGL was unable to obtain a valid EGL Display") } #[doc = "`eglInitialize` returned an error"] InitFailed { description("Failed to initialize EGL") ...
code_fim
hard
{ "lang": "rust", "repo": "cheako/smithay", "path": "/src/backend/egl/error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kimjy0126/rust-binary-tree path: /src/main.rs extern crate binary_tree; use binary_tree::Node; fn main() { <|fim_suffix|> println!("{:?}", root.search(&6)); // println!("{:?}", root); }<|fim_middle|> let mut root = Node::new(); for i in 1..11 { root.insert(i); }
code_fim
medium
{ "lang": "rust", "repo": "kimjy0126/rust-binary-tree", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("{:?}", root.search(&6)); // println!("{:?}", root); }<|fim_prefix|>// repo: kimjy0126/rust-binary-tree path: /src/main.rs extern crate binary_tree; use binary_tree::Node; fn main() { <|fim_middle|> let mut root = Node::new(); for i in 1..11 { root.insert(i); }
code_fim
medium
{ "lang": "rust", "repo": "kimjy0126/rust-binary-tree", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kimjy0126/rust-binary-tree path: /src/main.rs extern crate binary_tree; <|fim_suffix|> for i in 1..11 { root.insert(i); } println!("{:?}", root.search(&6)); // println!("{:?}", root); }<|fim_middle|>use binary_tree::Node; fn main() { let mut root = Node::new();
code_fim
medium
{ "lang": "rust", "repo": "kimjy0126/rust-binary-tree", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lomocc/p-clipboard path: /native/src/osx_clipboard.rs use neon::prelude::*; use neon::register_module; use objc_foundation::{INSArray, INSObject, INSString, NSArray, NSObject, NSString}; use objc_id::Id; // required to bring NSPasteboard into the path of the class-resolver #[link(name = "AppKi...
code_fim
hard
{ "lang": "rust", "repo": "lomocc/p-clipboard", "path": "/native/src/osx_clipboard.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let js_string = cx.string(file_path.as_str()); js_array.set(&mut cx, i, js_string).unwrap(); i = i + 1; } }; } } return Ok(js_array); } register_module!(mut m, { m.export_function("getFileList", get_fil...
code_fim
hard
{ "lang": "rust", "repo": "lomocc/p-clipboard", "path": "/native/src/osx_clipboard.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut i: u32 = 0; for item in item_list.object_enumerator() { // let types: Id<NSArray<NSString>> = unsafe { Id::from_ptr(msg_send![item, types]) }; // let item_type = types.first_object(); // println!("types = {:?}", types.to_vec()); unsaf...
code_fim
hard
{ "lang": "rust", "repo": "lomocc/p-clipboard", "path": "/native/src/osx_clipboard.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hessifer/Rust path: /MasteringRustSecondEdition/enums/src/main.rs /* Enums - used for modeling something of different kinds. Types are called 'variants' Variants can be defined with or without data. The data can be any primitive type, struct, tuple struct, or even an enum. Enums can also be crea...
code_fim
hard
{ "lang": "rust", "repo": "hessifer/Rust", "path": "/MasteringRustSecondEdition/enums/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: blmhemu/rustor path: /src/main.rs use std::fmt::Error; use tokio::fs::File; use warp::multipart::{FormData, FormOptions, Part}; use warp::{http::StatusCode, Filter, Rejection, Reply}; use crate::data::QueryOptions; use crate::handlers::{ get_dir, get_file, get_newdir_name, get_path, handle...
code_fim
hard
{ "lang": "rust", "repo": "blmhemu/rustor", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // These are web related. They can render stuff when opened in web browser. let web = warp::path("web"); let web_ls = web .and(warp::path("ls")) .and(warp::path::end()) .and(warp::get()) .and(get_dir()) .and_then(handlers::web_list); let web_delete =...
code_fim
hard
{ "lang": "rust", "repo": "blmhemu/rustor", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: justisGipson/systemdParser path: /src/lib.rs /// # Systemd Parser /// /// `systemd_parser` is a minimal parser for Systemd unit files. extern crate pest; #[macro_use] extern crate pest_derive; pub mod parser; pub use parser::parse; pub use parser::SystemdValue; #[cfg(test)] mod test { use s...
code_fim
hard
{ "lang": "rust", "repo": "justisGipson/systemdParser", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let dir = current_dir() .unwrap() .join("unit_files/cardano-node.service"); let filepath = dir.to_str().unwrap(); if let Ok(p) = parse(filepath) { let unit = p.get(&String::from("Unit")).unwrap(); let mut test_pairs = vec![ ( unit.get(&String::from("Description")).unwrap(), ...
code_fim
hard
{ "lang": "rust", "repo": "justisGipson/systemdParser", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ChangeCaps/phil-noire path: /src/editor.rs use crate::{ instance::Instance, labled, node::{drag3, drag_vec3, Node}, transform::Transform, world::World, }; use egui::*; use glam::Quat; use std::sync::Arc; use wgpu::util::DeviceExt; pub struct Editor { pub input: RawInput,...
code_fim
hard
{ "lang": "rust", "repo": "ChangeCaps/phil-noire", "path": "/src/editor.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> drag_vec3(ui, &mut node.transform.scale); ui.separator(); for (i, component) in node.components.iter_mut().enumerate() { ui.collapsing(component.name(), |ui| { ...
code_fim
hard
{ "lang": "rust", "repo": "ChangeCaps/phil-noire", "path": "/src/editor.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let (mut y, mut x, mut z) = node.transform.rotation.to_euler(glam::EulerRot::YXZ); x = x / std::f32::consts::PI * 180.0; y = y / std::f32::consts::PI * 180.0; ...
code_fim
hard
{ "lang": "rust", "repo": "ChangeCaps/phil-noire", "path": "/src/editor.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// The object to use for constant lookups when a constant is not available /// in the prototype hierarchy. pub outer_scope: Option<RcObject> } impl ObjectHeader { pub fn new() -> ObjectHeader { ObjectHeader { attributes: HashMap::new(), constants: HashMap:...
code_fim
hard
{ "lang": "rust", "repo": "pbnj-io/aeon", "path": "/vm/src/object_header.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pbnj-io/aeon path: /vm/src/object_header.rs //! Object Metadata //! //! The ObjectHeader struct stores metadata associated with an Object, such as //! the name, attributes, constants and methods. An ObjectHeader struct is only //! allocated when actually needed. use std::collections::HashMap; ...
code_fim
hard
{ "lang": "rust", "repo": "pbnj-io/aeon", "path": "/vm/src/object_header.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn connect(&self, addr: SocketAddr) -> io::Result<()> { self.sys.connect(addr) } pub fn set_broadcast(&self, on: bool) -> io::Result<()>...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-comments-removed", "path": "/third_party/rust/mio-0.6.23/src/net/udp.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-comments-removed path: /third_party/rust/mio-0.6.23/src/net/udp.rs use {io, sys, Ready, Poll, PollOpt, Token}; use event::Evented; use poll::SelectorId; use std::fmt; use std::net::{self, Ipv4Addr, Ipv6Addr, SocketAddr}; #[cfg(all(unix, not(target_os = "fuchsia")))] u...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-comments-removed", "path": "/third_party/rust/mio-0.6.23/src/net/udp.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mvertescher/psoc6-pac path: /src/flashc/fm_ctl/test_ctl.rs #[doc = "Reader of register TEST_CTL"] pub type R = crate::R<u32, super::TEST_CTL>; #[doc = "Writer for register TEST_CTL"] pub type W = crate::W<u32, super::TEST_CTL>; #[doc = "Register TEST_CTL `reset()`'s with value 0"] impl crate::Re...
code_fim
hard
{ "lang": "rust", "repo": "mvertescher/psoc6-pac", "path": "/src/flashc/fm_ctl/test_ctl.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>pe ENABLE_OSC_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ENABLE_OSC`"] pub struct ENABLE_OSC_W<'a> { w: &'a mut W, } impl<'a> ENABLE_OSC_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Cl...
code_fim
hard
{ "lang": "rust", "repo": "mvertescher/psoc6-pac", "path": "/src/flashc/fm_ctl/test_ctl.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>/// conversion from &str to QueryColumn to use with T:<Into<QueryColumn>> impl <'a> From<&'a str> for QueryColumn { fn from(s: &'a str) -> QueryColumn { QueryColumn::new(s.to_string()) } } /// conversion from String to QueryColumn to use with T:<Into<QueryColumn>> impl From<String> for Qu...
code_fim
medium
{ "lang": "rust", "repo": "phonkee/treasure", "path": "/src/query/builder/column.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: phonkee/treasure path: /src/query/builder/column.rs use std::str::FromStr; // QueryColumn #[derive(Debug,Clone)] pub struct QueryColumn { name: String, alias: String, } /// helper function to return new column pub fn c<T:Into<String>>(name:T) -> QueryColumn { QueryColumn::new(name.into()) }...
code_fim
medium
{ "lang": "rust", "repo": "phonkee/treasure", "path": "/src/query/builder/column.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>friction":0.2,"vertices":{"x":[-0.5,0.5],"y":[0,0]}}'); b.setPos( cursor() );<|fim_prefix|>// repo: Crasader/cal path: /rube/config/actionMenu/default/addBodyAtCursor_Edge.rs //Name: Add body (edge) //Tags: body, edge //Add a body with an edge fixture<|fim_middle|> at the cursor position body b = addBod...
code_fim
medium
{ "lang": "rust", "repo": "Crasader/cal", "path": "/rube/config/actionMenu/default/addBodyAtCursor_Edge.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Crasader/cal path: /rube/config/actionMenu/default/addBodyAtCursor_Edge.rs //Name: Add body (edge) //Tags: body, edge //Add a body with an edge fixture<|fim_suffix|>e}'); b.addFixture(-1, '{"density":1,"shapes":[{"radius":0,"type":"line"}],"friction":0.2,"vertices":{"x":[-0.5,0.5],"y":[0,0]}}');...
code_fim
medium
{ "lang": "rust", "repo": "Crasader/cal", "path": "/rube/config/actionMenu/default/addBodyAtCursor_Edge.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dbrgn/rn2xx3-rs path: /src/errors.rs //! Error types used in this driver. use core::str::Utf8Error; /// A collection of errors that can occur. #[derive(Debug, PartialEq, Eq)] pub enum Error<S> { /// Could not read from serial port. SerialRead(S), /// Could not write to serial port....
code_fim
hard
{ "lang": "rust", "repo": "dbrgn/rn2xx3-rs", "path": "/src/errors.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// Errors that can occur during the transmit procedure. #[derive(Debug, PartialEq, Eq)] pub enum TxError<S> { /// Invalid type, port or data. BadParameter, /// Network not joined. NotJoined, /// All channels are busy. NoFreeChannel, /// Device is in a Silent Immediately state....
code_fim
hard
{ "lang": "rust", "repo": "dbrgn/rn2xx3-rs", "path": "/src/errors.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if !initializer_account.is_signer { return Err(AppError::MustSigner.into()); } let data = Lottery::unpack(&lottery_account.data.borrow())?; if initializer_account.key.to_bytes() != data.initializer { ...
code_fim
hard
{ "lang": "rust", "repo": "rust-chainblock/lottery-sol", "path": "/program/src/processor.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let winner_index: usize = rand(data.participants.len().try_into().unwrap()); let winner = data.participants[winner_index]; let mut winner_account: Option<&AccountInfo> = None; loop { match next_account_info(accounts_iter...
code_fim
hard
{ "lang": "rust", "repo": "rust-chainblock/lottery-sol", "path": "/program/src/processor.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-chainblock/lottery-sol path: /program/src/processor.rs use std::convert::TryInto; use crate::instruction::AppInstruction; use crate::schema::lottery::MAX_PARTICIPANT; use crate::{error::AppError, schema::lottery::Lottery}; use solana_program::native_token::{sol_to_lamports, LAMPORTS_PER_SO...
code_fim
hard
{ "lang": "rust", "repo": "rust-chainblock/lottery-sol", "path": "/program/src/processor.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stepancheg/rust-http2 path: /httpbis/src/message.rs use bytes::BufMut; use bytes::Bytes; use bytes::BytesMut; use crate::data_or_headers::DataOrHeaders; use crate::data_or_headers_with_flag::DataOrHeadersWithFlag; use crate::solicit::header::*; use std::mem; /// Simple HTTP message is headers ...
code_fim
hard
{ "lang": "rust", "repo": "stepancheg/rust-http2", "path": "/httpbis/src/message.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Create 500 message. pub fn internal_error_500(message: &str) -> SimpleHttpMessage { SimpleHttpMessage { headers: Headers::internal_error_500(), body: Bytes::copy_from_slice(message.as_bytes()), } } /// Create 200 message. pub fn found_200_pl...
code_fim
hard
{ "lang": "rust", "repo": "stepancheg/rust-http2", "path": "/httpbis/src/message.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Modify the message. pub fn add(&mut self, part: DataOrHeaders) { match part { DataOrHeaders::Headers(headers) => { self.headers.extend(headers); } DataOrHeaders::Data(data) => { let mut body: BytesMut = ...
code_fim
hard
{ "lang": "rust", "repo": "stepancheg/rust-http2", "path": "/httpbis/src/message.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Clone, Debug, SerBin, DeBin, SerJson, DeJson)] pub enum StdinToHost{ ReadyToStart, DrawComplete } impl StdinToHost{ pub fn to_json(&self)->String{ let mut json = self.serialize_json(); json.push('\n'); json } } impl HostToStdin{ pub fn to_json(&self)-...
code_fim
hard
{ "lang": "rust", "repo": "makepad/makepad", "path": "/platform/src/os/cx_stdin.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: makepad/makepad path: /platform/src/os/cx_stdin.rs #![allow(dead_code)] use { std::cell::Cell, crate::{ cx::Cx, makepad_micro_serde::*, makepad_math::{dvec2}, window::CxWindowPool, area::Area, event::{ ScrollEvent, M...
code_fim
hard
{ "lang": "rust", "repo": "makepad/makepad", "path": "/platform/src/os/cx_stdin.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ComanAdrian/exercism path: /atbash-cipher/src/lib.rs use std::collections::HashMap; const PLAIN: [char; 26] = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', ]; const CIPHER: [char; 26] = [ 'z', 'y'...
code_fim
hard
{ "lang": "rust", "repo": "ComanAdrian/exercism", "path": "/atbash-cipher/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// "Decipher" with the Atbash cipher. pub fn decode(cipher: &str) -> String { let mut result: String = String::new(); let hashmap = create_letters_map(); for (_, c) in cipher.chars().enumerate() { if c.is_whitespace() { continue; } if c.is_alphabetic() { ...
code_fim
hard
{ "lang": "rust", "repo": "ComanAdrian/exercism", "path": "/atbash-cipher/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i in 0..rem { heights[i as usize] += 1; } let mut imag = self.origin.imag; let mut defs: Vec<SetDefinition> = Vec::with_capacity(count as usize); for i in 0..count { let origin = Complex::new(self.origin.real, imag); let heig...
code_fim
hard
{ "lang": "rust", "repo": "cjkent/mandelbrot", "path": "/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cjkent/mandelbrot path: /src/main.rs #[macro_use] extern crate log; extern crate env_logger; extern crate time; #[macro_use] extern crate bmp; extern crate threadpool; mod complex; mod colour; mod vector3d; use threadpool::ThreadPool; //use std::sync::mpsc::channel; use complex::Complex; use s...
code_fim
hard
{ "lang": "rust", "repo": "cjkent/mandelbrot", "path": "/src/main.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Isaac-Lozano/neural-net path: /src/neural_net.rs use matrix::{Matrix, Vector}; use rand::distributions::normal::StandardNormal; use rand; use std::f64; use std::marker::PhantomData; #[derive(Debug,Clone)] pub struct NeuralNetLayer { biases: Vector<f64>, weights: Matrix<f64>, } impl N...
code_fim
hard
{ "lang": "rust", "repo": "Isaac-Lozano/neural-net", "path": "/src/neural_net.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> nablas.push((nabla_b, nabla_w)); (nablas, delta) } } pub type StandardNeuralNet = NeuralNet<Sigmoid, MeanSquareError>; pub trait CostFunction { fn cost_gradient(output: &Vector<f64>, expected: &Vector<f64>) -> Vector<f64>; } pub struct MeanSquareError; impl CostFunction for Me...
code_fim
hard
{ "lang": "rust", "repo": "Isaac-Lozano/neural-net", "path": "/src/neural_net.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jes44bc/mio path: /src/sys/mod.rs //! Module with system specific types. //! //! `Event`: a type alias for the system specific event, e.g. //! `kevent` or `epoll_event`. //! `event`: a module with various helper functions for `Event`, see //! `crate::event::Event` for the requi...
code_fim
medium
{ "lang": "rust", "repo": "jes44bc/mio", "path": "/src/sys/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(windows)] pub use self::windows::{ event, Binding, Event, Events, Overlapped, Selector, TcpListener, TcpStream, UdpSocket, Waker, }; #[cfg(windows)] mod windows;<|fim_prefix|>// repo: jes44bc/mio path: /src/sys/mod.rs //! Module with system specific types. //! //! `Event`: a type alias for the...
code_fim
medium
{ "lang": "rust", "repo": "jes44bc/mio", "path": "/src/sys/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[repr(C)] #[derive(Debug)] pub struct FontInfo { pub font_style: crate::efi::hii::HiiFontStyle, pub font_size: u16, pub font_name: [r_efi::efi::Char16], }<|fim_prefix|>// repo: jyao1/rust-hypervisor-firmware path: /r-efi/src/protocols/hii_font.rs // Copyright © 2019 Intel Corporation // // L...
code_fim
medium
{ "lang": "rust", "repo": "jyao1/rust-hypervisor-firmware", "path": "/r-efi/src/protocols/hii_font.rs", "mode": "spm", "license": "LGPL-2.1-or-later", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jyao1/rust-hypervisor-firmware path: /r-efi/src/protocols/hii_font.rs // Copyright © 2019 Intel Corporation // // 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 // // ...
code_fim
medium
{ "lang": "rust", "repo": "jyao1/rust-hypervisor-firmware", "path": "/r-efi/src/protocols/hii_font.rs", "mode": "psm", "license": "LGPL-2.1-or-later", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hopv/rust-horn path: /esop2020/benchmarks/rust-horn/5-linger-dec/linger-dec-11-0.rs pub fn rand<T>() -> T { unimplemented!() } fn linger_dec_bound_three(n: i32, ma: &mut i32, mb: &mut i32, mc: &mut i32) { <|fim_suffix|> let n = rand(); let mut a = rand(); let mut b = rand(); let mut c = ...
code_fim
hard
{ "lang": "rust", "repo": "hopv/rust-horn", "path": "/esop2020/benchmarks/rust-horn/5-linger-dec/linger-dec-11-0.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let n = rand(); let mut a = rand(); let mut b = rand(); let mut c = rand(); let old_a = a; linger_dec_bound_three(n, &mut a, &mut b, &mut c); assert!(old_a >= a && old_a - a <= 3 * n); }<|fim_prefix|>// repo: hopv/rust-horn path: /esop2020/benchmarks/rust-horn/5-linger-dec/linger-dec-11-0.r...
code_fim
hard
{ "lang": "rust", "repo": "hopv/rust-horn", "path": "/esop2020/benchmarks/rust-horn/5-linger-dec/linger-dec-11-0.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kvark/vange-rs path: /bin/road/main.rs #![allow(irrefutable_let_patterns)] use log::info; #[path = "../boilerplate.rs"] mod boilerplate; mod game; mod physics; fn main() { use std::env; let (harness, settings) = boilerplate::Harness::init(boilerplate::HarnessOptions { title: ...
code_fim
hard
{ "lang": "rust", "repo": "kvark/vange-rs", "path": "/bin/road/main.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let matches = options.parse(&args[1..]).unwrap(); if matches.opt_present("h") || !matches.free.is_empty() { println!("Vangers game prototype"); let brief = format!("Usage: {} [options]", args[0]); println!("{}", options.usage(&brief)); return; } let game = ...
code_fim
hard
{ "lang": "rust", "repo": "kvark/vange-rs", "path": "/bin/road/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.primes .iter() .skip_while(|&&p| p < min) .take_while(|&&p| p < max) .cloned() .collect() } }<|fim_prefix|>// repo: jeremyBanks/pr path: /src/erato_one.rs use super::prelude::*; #[derive(Debug)] pub struct EratoOne { max_te...
code_fim
hard
{ "lang": "rust", "repo": "jeremyBanks/pr", "path": "/src/erato_one.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jeremyBanks/pr path: /src/erato_one.rs use super::prelude::*; #[derive(Debug)] pub struct EratoOne { max_tested: u64, primes: Vec<u64>, } impl Default for EratoOne { fn default() -> EratoOne { EratoOne { max_tested: 1, primes: Vec::default(), ...
code_fim
hard
{ "lang": "rust", "repo": "jeremyBanks/pr", "path": "/src/erato_one.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl PrimeGenerator for EratoOne { fn generate(&mut self, min: u64, max: u64) -> Vec<u64> { if max > self.max_tested { let candidates = (self.max_tested + 1)..=max; let mut max_factor = 1; let mut max_factor_until = 0; 'candidates: for candidate...
code_fim
hard
{ "lang": "rust", "repo": "jeremyBanks/pr", "path": "/src/erato_one.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }