text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>fn main() { input! { n: usize, a: [Usize1; n], b: [Usize1; n], c: [Usize1; n], } let mut count = vec![0; n]; for x in c { count[b[x]] += 1; } // into_iter は 参照ではなく値のコレクションを返却する // Trait std::iter::Sum https://doc.rust-lang.org/std/iter/tr...
code_fim
medium
{ "lang": "rust", "repo": "koshilife/atcoder.jp", "path": "/abc202/c_rust/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: koshilife/atcoder.jp path: /abc202/c_rust/src/main.rs // https://atcoder.jp/contests/abc200/tasks/abc202_c // refs: https://atcoder.jp/contests/abc202/editorial/1859 // 公式解説のコードを元に勉強 <|fim_suffix|>fn main() { input! { n: usize, a: [Usize1; n], b: [Usize1; n], ...
code_fim
medium
{ "lang": "rust", "repo": "koshilife/atcoder.jp", "path": "/abc202/c_rust/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // This will output the completions in the target/release or target/debug directories. outdir.pop(); outdir.pop(); outdir.pop(); app.gen_completions("fozzie", Shell::Bash, &outdir); app.gen_completions("fozzie", Shell::Fish, &outdir); app.gen_completions("fozzie", Shell::Zsh, ...
code_fim
medium
{ "lang": "rust", "repo": "npezza93/fozzie", "path": "/build.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: npezza93/fozzie path: /build.rs #[macro_use] extern crate clap; use clap::Shell; use std::env; use std::path::PathBuf; <|fim_suffix|> app.gen_completions("fozzie", Shell::Bash, &outdir); app.gen_completions("fozzie", Shell::Fish, &outdir); app.gen_completions("fozzie", Shell::Zsh, o...
code_fim
hard
{ "lang": "rust", "repo": "npezza93/fozzie", "path": "/build.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> app.gen_completions("fozzie", Shell::Bash, &outdir); app.gen_completions("fozzie", Shell::Fish, &outdir); app.gen_completions("fozzie", Shell::Zsh, outdir); }<|fim_prefix|>// repo: npezza93/fozzie path: /build.rs #[macro_use] extern crate clap; use clap::Shell; use std::env; use std::path::P...
code_fim
hard
{ "lang": "rust", "repo": "npezza93/fozzie", "path": "/build.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self as u8 } #[inline(always)] fn lowest_u16(self) -> u16 { self as u16 } #[inline(always)] fn lowest_u32(self) -> u32 { self as u32 } #[inline(always)] fn lowest_u64(self) -> u64 { self as u64 } #[inline(alway...
code_fim
hard
{ "lang": "rust", "repo": "DnailZ/PipeGraph", "path": "/src/utils/prim_unsigned.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[inline(always)] fn lowest_u16(self) -> u16 { self as u16 } #[inline(always)] fn lowest_u32(self) -> u32 { self as u32 } #[inline(always)] fn lowest_u64(self) -> u64 { self as u64 } #[inline(always)] fn lowest_u128(self) -...
code_fim
hard
{ "lang": "rust", "repo": "DnailZ/PipeGraph", "path": "/src/utils/prim_unsigned.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DnailZ/PipeGraph path: /src/utils/prim_unsigned.rs use std::u32; use int::UInt; pub trait PrimUnsigned : UInt { fn lowest_u8(self) -> u8; fn lowest_u16(self) -> u16; fn lowest_u32(self) -> u32; fn lowest_u64(self) -> u64; fn lowest_u128(self) -> u128; } impl PrimUnsigned ...
code_fim
hard
{ "lang": "rust", "repo": "DnailZ/PipeGraph", "path": "/src/utils/prim_unsigned.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jaysonsantos/cli-utils-rs path: /delete-line/src/utils.rs use std::ops::RangeInclusive; use std::str::FromStr; use color_eyre::eyre::{eyre, WrapErr}; #[cfg(target_os = "windows")] pub static LINE_ENDING: &[u8; 2] = b"\r\n"; #[cfg(not(target_os = "windows"))] pub static LINE_ENDING: &[u8; 1] =...
code_fim
hard
{ "lang": "rust", "repo": "jaysonsantos/cli-utils-rs", "path": "/delete-line/src/utils.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let r = "1".parse::<Range>().unwrap().into_inner(); assert_eq!(r, (1..=1)); let r = "1-10".parse::<Range>().unwrap().into_inner(); assert_eq!(r, (1..=10)); assert!("1-".parse::<Range>().is_err()); } }<|fim_prefix|>// repo: jaysonsantos/cli-utils-rs path: /del...
code_fim
medium
{ "lang": "rust", "repo": "jaysonsantos/cli-utils-rs", "path": "/delete-line/src/utils.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Telixia/leetcode-2 path: /src/_011.rs use std::cmp::{max, min}; pub struct Solution; impl Solution { pub fn max_area(height: Vec<i32>) -> i32 { let mut left = 0; let mut right = height.len() - 1; let mut result: i32 = 0; while left < right { let ...
code_fim
medium
{ "lang": "rust", "repo": "Telixia/leetcode-2", "path": "/src/_011.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let arrays = [1,2,3,4,5,6,7,8,9]; for i in arrays.iter(){ println!("{}",i) } } fn another_function(x: i32) { println!( "This is from another function and prints this number {}.", x ); } fn test_tuple(tup: (i32, i32)) -> i32 { let (x, y) = tup; println!(...
code_fim
medium
{ "lang": "rust", "repo": "Gjarg/Rust-Book", "path": "/Chapter_3/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Gjarg/Rust-Book path: /Chapter_3/src/main.rs const X: i32 = 5; fn main() { let x = 5; println!("Here is x: {}", x); let x = 6; println!("Here is x: {}{}", X, x); let spaces = " "; let spaces = spaces.len(); println!("Here is the number of spaces in spaces {} ", ...
code_fim
hard
{ "lang": "rust", "repo": "Gjarg/Rust-Book", "path": "/Chapter_3/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn binary(op: ::BinaryOperator, left: Expr, right: Expr) -> Expr { Expr::Binary(op, Box::new(left), Box::new(right)) } pub fn bool(bool: bool) -> Expr { Expr::Bool(bool) } pub fn call<I: IntoIterator<Item = Expr>>(f: Expr, args: I) -> Expr { Expr::Call(Box::new(f), args.into_iter().colle...
code_fim
hard
{ "lang": "rust", "repo": "utkarshkukreti/escodegen.rs", "path": "/src/g.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn call<I: IntoIterator<Item = Expr>>(f: Expr, args: I) -> Expr { Expr::Call(Box::new(f), args.into_iter().collect()) } pub fn function<I: IntoIterator<Item = S>, S: Into<String>>(params: I, stmts: Vec<Stmt>) -> Expr { Expr::Function(params.into_iter().map(Into::into).collect(), stmts) } pub...
code_fim
hard
{ "lang": "rust", "repo": "utkarshkukreti/escodegen.rs", "path": "/src/g.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: utkarshkukreti/escodegen.rs path: /src/g.rs pub use {Expr, Stmt}; pub use BinaryOperator::{self, *}; pub use UnaryOperator::{self, *}; pub fn block<I: IntoIterator<Item = Stmt>>(i: I) -> Stmt { Stmt::Block(i.into_iter().collect()) } pub fn expr(expr: Expr) -> Stmt { Stmt::Expr(expr) }...
code_fim
hard
{ "lang": "rust", "repo": "utkarshkukreti/escodegen.rs", "path": "/src/g.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn write(&self, path: &str) -> std::io::Result<()> { use std::fs::File; use std::io::BufWriter; use png::HasParameters; let file = File::create(path)?; let mut w = BufWriter::new(file); let mut encoder = png::Encoder::new(&mut w, self.w, self.h); encoder.set(png::ColorTy...
code_fim
hard
{ "lang": "rust", "repo": "MashPlant/computational_graphics_2019", "path": "/ray_tracer/src/pic.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let file = File::create(path)?; let mut w = BufWriter::new(file); let mut encoder = png::Encoder::new(&mut w, self.w, self.h); encoder.set(png::ColorType::RGB).set(png::BitDepth::Eight); let mut writer = encoder.write_header().unwrap(); writer.write_image_data(&self.data).unwrap();...
code_fim
hard
{ "lang": "rust", "repo": "MashPlant/computational_graphics_2019", "path": "/ray_tracer/src/pic.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MashPlant/computational_graphics_2019 path: /ray_tracer/src/pic.rs use super::util::*; use super::vec::*; pub struct PPM(String); fn compress_256(x: f32) -> u8 { (clamp(x).powf(1.0 / 2.2) * 255.0 + 0.5) as u8 } impl PPM { pub fn new(data: &Vec<Vec3>, w: u32, h: u32) -> PPM { let mut p...
code_fim
medium
{ "lang": "rust", "repo": "MashPlant/computational_graphics_2019", "path": "/ray_tracer/src/pic.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub trait NCat<T, U>: ICat<T, U> where T: NucleicAcid, U: IPolymer<T>, { fn gc_content(u: U) -> (u64, u64); }<|fim_prefix|>// repo: krhoda/etre path: /category/src/lib.rs use monomer::{IMono, Mono, NucleicAcid}; use polymer::{IPolymer, Polymer}; <|fim_middle|>pub trait Cat<T, U> where T:...
code_fim
hard
{ "lang": "rust", "repo": "krhoda/etre", "path": "/category/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: krhoda/etre path: /category/src/lib.rs use monomer::{IMono, Mono, NucleicAcid}; use polymer::{IPolymer, Polymer}; <|fim_suffix|> fn inverse_p(&self, u: &U) -> U; } pub trait NCat<T, U>: ICat<T, U> where T: NucleicAcid, U: IPolymer<T>, { fn gc_content(u: U) -> (u64, u64); }<|fim_...
code_fim
hard
{ "lang": "rust", "repo": "krhoda/etre", "path": "/category/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: NetBSD/pkgsrc path: /x11/rterm/patches/patch-src_win.rs $NetBSD: patch-src_win.rs,v 1.1 2023/05/25 13:50:05 he Exp $ Avoid cast to u64, because 32-bit ports may not implement u64 * u32 in rust. Also, change the cast type of 'ofs' to match the function parameter it's used for. <|fim_suffix|>- ...
code_fim
medium
{ "lang": "rust", "repo": "NetBSD/pkgsrc", "path": "/x11/rterm/patches/patch-src_win.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>- let len = (nitems * (format as u64) / 8) as usize; + let len = ((nitems * (format as u32)) / 8) as usize; let buf = unsafe { slice::from_raw_parts(data, len) }; self.term_write(term, pty, buf); x11::XFree(data as *mut _); @@ -683,7 +683,7 @@ i...
code_fim
medium
{ "lang": "rust", "repo": "NetBSD/pkgsrc", "path": "/x11/rterm/patches/patch-src_win.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug)] pub struct AstNodeSrc { pub documentation: Vec<String>, pub name: String, // pub traits: Vec<String>, pub fields: Vec<Field>, } #[derive(Debug, Eq, PartialEq)] pub enum TokenKind { Single(String), Many(Vec<String>), } #[derive(Debug, Eq, PartialEq)] pub enum Fiel...
code_fim
hard
{ "lang": "rust", "repo": "rome/tools", "path": "/xtask/codegen/src/kinds_src.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rome/tools path: /xtask/codegen/src/kinds_src.rs ", "default", "delete", "do", "else", "enum", "export", "extends", "false", "finally", "for", "function", "if", "in", "instanceof", ...
code_fim
hard
{ "lang": "rust", "repo": "rome/tools", "path": "/xtask/codegen/src/kinds_src.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rome/tools path: /xtask/codegen/src/kinds_src.rs ASH", // # "TEMPLATE_CHUNK", "DOLLAR_CURLY", // ${ "ERROR_TOKEN", "IDENT", "JSX_IDENT", "NEWLINE", "WHITESPACE", "COMMENT", "MULTILINE_COMMENT", "JS_SHEBANG", ], ...
code_fim
hard
{ "lang": "rust", "repo": "rome/tools", "path": "/xtask/codegen/src/kinds_src.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl_array_index_by_type!(i8); impl_array_index_by_type!(u8); impl_array_index_by_type!(i16); impl_array_index_by_type!(u16); impl_array_index_by_type!(i32); impl_array_index_by_type!(u32); impl_array_index_by_type!(isize); impl_array_index_by_type!(usize); // TODO .. all the other accessors..<|fim_prefi...
code_fim
hard
{ "lang": "rust", "repo": "dobkeratops/rust_arrays_with_generic_index", "path": "/src/fixed.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dobkeratops/rust_arrays_with_generic_index path: /src/fixed.rs use super::*; #[derive(Copy,Clone,Debug)] pub struct Array1<T>{pub elems:[T;1]} // could be generated.. #[derive(Copy,Clone,Debug)] pub struct Array2<T>{pub elems:[T;2]} #[derive(Copy,Clone,Debug)] pub struct Array3<T>{pub elems:[T;...
code_fim
hard
{ "lang": "rust", "repo": "dobkeratops/rust_arrays_with_generic_index", "path": "/src/fixed.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<'r> Decode<'r, Any> for f64 { fn decode(value: <Any as HasValueRef<'r>>::ValueRef) -> Result<Self, BoxDynError> { match value.kind { // Widening is safe AnyValueKind::Real(r) => Ok(r as f64), AnyValueKind::Double(d) => Ok(d), other => other....
code_fim
medium
{ "lang": "rust", "repo": "launchbadge/sqlx", "path": "/sqlx-core/src/any/types/float.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<'q> Encode<'q, Any> for f32 { fn encode_by_ref(&self, buf: &mut AnyArgumentBuffer<'q>) -> IsNull { buf.0.push(AnyValueKind::Real(*self)); IsNull::No } } impl<'r> Decode<'r, Any> for f32 { fn decode(value: AnyValueRef<'r>) -> Result<Self, BoxDynError> { match value...
code_fim
medium
{ "lang": "rust", "repo": "launchbadge/sqlx", "path": "/sqlx-core/src/any/types/float.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: launchbadge/sqlx path: /sqlx-core/src/any/types/float.rs use crate::any::{Any, AnyArgumentBuffer, AnyTypeInfo, AnyTypeInfoKind, AnyValueKind, AnyValueRef}; use crate::database::{HasArguments, HasValueRef}; use crate::decode::Decode; use crate::encode::{Encode, IsNull}; use crate::error::BoxDynEr...
code_fim
hard
{ "lang": "rust", "repo": "launchbadge/sqlx", "path": "/sqlx-core/src/any/types/float.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: edoren/DevCalc path: /src/operator.rs use std::any; use std::fmt; use crate::number::Number; use crate::token::Token; ////////////////////////////////////////////////////////////////////// /// Operator ////////////////////////////////////////////////////////////////////// #[derive(Copy, Clone...
code_fim
hard
{ "lang": "rust", "repo": "edoren/DevCalc", "path": "/src/operator.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Token for Operator { fn to_string(&self) -> String { match self { Self::SUM => String::from("+"), Self::SUB => String::from("-"), Self::MUL => String::from("*"), Self::DIV => String::from("/"), Self::AND => String::from("&"), ...
code_fim
hard
{ "lang": "rust", "repo": "edoren/DevCalc", "path": "/src/operator.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: imp/pager-rs path: /src/utils.rs use std::env; use std::ffi::{CString, OsString}; use std::os::unix::ffi::OsStringExt; use std::ptr; use errno; use libc; fn osstring2cstring(s: OsString) -> CString { unsafe { CString::from_vec_unchecked(s.into_vec()) } } fn split_string(s: &OsString) -> V...
code_fim
hard
{ "lang": "rust", "repo": "imp/pager-rs", "path": "/src/utils.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn usr_bin_more_default_pager() { assert_eq!(find_pager("__RANDOM_NAME"), Some(OsString::from(MORE))); } #[test] fn nopager() { env::set_var("NOPAGER", ""); assert!(find_pager("more").is_none()); env::remove_var("NOPAGER"); } }<|fim_prefix|>...
code_fim
hard
{ "lang": "rust", "repo": "imp/pager-rs", "path": "/src/utils.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mcmilnick/rusty_elma path: /tests/basic_manager_tests.rs #[cfg(test)] extern crate elma_builder; extern crate colored; use colored::*; use std::time::{SystemTime, Duration}; use std::collections::{VecDeque}; use elma_builder::process; use elma_builder::channel::Channel; use elma_builder::reciev...
code_fim
hard
{ "lang": "rust", "repo": "mcmilnick/rusty_elma", "path": "/tests/basic_manager_tests.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /////////////////////// declare manager //////////////////// let mut elma = Manager { _processes : std::vec::Vec::new(), _channels : std::vec::Vec::new(), _start_time : zero_time, _elapsed : zero_time, }; //schedule each process elma.schedule(&mut sender, one_msec); elma.schedule(&...
code_fim
hard
{ "lang": "rust", "repo": "mcmilnick/rusty_elma", "path": "/tests/basic_manager_tests.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> //package the processes let mut procVec : Vec<Box<process::Process>> = Vec::new(); procVec.push(Box::new(pProc)); procVec.push(Box::new(qProc)); /////////////////////// declare manager //////////////////// let mut elma = Manager { _processes : procVec, _channels : Vec::new(), _start_time...
code_fim
hard
{ "lang": "rust", "repo": "mcmilnick/rusty_elma", "path": "/tests/basic_manager_tests.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a> Children<'a, Expression2<'a>> for Expression2<'a> { fn children(&'a self) -> Vec<&'a Expression2<'a>> { use Expression2Type::*; match self.is { Call { callee, ref args, .. } => { let mut result: Vec<&'a Expression2<'a>> = args.clone() ...
code_fim
hard
{ "lang": "rust", "repo": "RussellSprouts/6502-language-rust", "path": "/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: RussellSprouts/6502-language-rust path: /main.rs te typed_arena; #[macro_use] extern crate im; use std::fs::File; use std::io::prelude::*; use std::vec::Vec; use std::cell::Cell; use typed_arena::Arena; use std::iter::FromIterator; use im::HashMap as ImmHashMap; use std::collections::HashMap; ...
code_fim
hard
{ "lang": "rust", "repo": "RussellSprouts/6502-language-rust", "path": "/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> use Expression2Type::*; match self.is { Call { callee, ref args, .. } => { let mut result: Vec<&'a Expression2<'a>> = args.clone() .into_iter() .map(|a| { a.1 }) .collect(); result.push(...
code_fim
hard
{ "lang": "rust", "repo": "RussellSprouts/6502-language-rust", "path": "/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn create_program( display: &Display, vertex_shader: String, fragment_shader: String, ) -> Result<Program, ProgramCreationError> { Program::from_source( display, vertex_shader.as_ref(), fragment_shader.as_ref(), None, ) }<|fim_prefix|>// repo: andrew...
code_fim
medium
{ "lang": "rust", "repo": "andrew-d-jackson/CUBECUBECUBECUBECUBECUBE", "path": "/src/shader.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: andrew-d-jackson/CUBECUBECUBECUBECUBECUBE path: /src/shader.rs use glium::{Display, Program, ProgramCreationError}; use std::fs::File; use std::io::Read; <|fim_suffix|>pub fn create_program( display: &Display, vertex_shader: String, fragment_shader: String, ) -> Result<Program, Prog...
code_fim
medium
{ "lang": "rust", "repo": "andrew-d-jackson/CUBECUBECUBECUBECUBECUBE", "path": "/src/shader.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: BenBergman/euler path: /rust/0011.rs #[cfg(not(test))] fn main() { } fn find_largest_product_in_matrix() -> u64 { let m = vec![ vec![08,02,22,97,38,15,00,40,00,75,04,05,07,78,52,12,50,77,91,08], vec![49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48,04,56,62,00], vec!...
code_fim
hard
{ "lang": "rust", "repo": "BenBergman/euler", "path": "/rust/0011.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>1][y], m[x-2][y], m[x-3][y], products.last().unwrap()); } if y >= 3 { products.push(m[x][y] * m[x][y-1] * m[x][y-2] * m[x][y-3]); } if x >= 3 && y >= 3 { products.push(m[x][y] * m[x-1][y-1] * m[x-2][y-2] * m[x-3][y-3]); ...
code_fim
hard
{ "lang": "rust", "repo": "BenBergman/euler", "path": "/rust/0011.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DukeFerdinand/recipes-wasm path: /src/components/sidebar.rs use yew::{html, Callback, Component, ComponentLink, Html, Properties, ShouldRender}; pub struct Sidebar { is_open: bool, props: Props, } #[derive(Properties)] pub struct Props { #[props(required)] pub sidebar_open: bool, #[p...
code_fim
medium
{ "lang": "rust", "repo": "DukeFerdinand/recipes-wasm", "path": "/src/components/sidebar.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match msg { Msg::ToggleMenu => { self.props.toggle_sidebar.emit(()); true } } } fn change(&mut self, props: Self::Properties) -> ShouldRender { self.is_open = props.sidebar_open; true } fn view(&self) -> Html<Self> { html! { <div class={if self...
code_fim
hard
{ "lang": "rust", "repo": "DukeFerdinand/recipes-wasm", "path": "/src/components/sidebar.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Component for Sidebar { type Message = Msg; type Properties = Props; fn create(props: Self::Properties, _: ComponentLink<Self>) -> Self { Self { is_open: props.sidebar_open, props, } } fn update(&mut self, msg: Self::Message) -> ShouldRender { match msg { Msg::...
code_fim
medium
{ "lang": "rust", "repo": "DukeFerdinand/recipes-wasm", "path": "/src/components/sidebar.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn destroy(self) -> ApiResult<()> { self.modal.destroy() } /// Reset the editor state to "empty" (the "New Column X" title is dependent /// on the number of expressions stored in the current `Session`). pub fn reset_empty_expr(&self) { self.modal.send_message(Expre...
code_fim
hard
{ "lang": "rust", "repo": "zemeolotu/perspective", "path": "/rust/perspective-viewer/src/rust/custom_elements/expression_editor.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>use crate::components::expression_editor::*; use crate::custom_elements::modal::*; use crate::session::Session; use crate::utils::*; use crate::*; #[wasm_bindgen] #[derive(Clone)] pub struct ExpressionEditorElement { modal: ModalElement<ExpressionEditor>, } impl ExpressionEditorElement { pub fn ...
code_fim
hard
{ "lang": "rust", "repo": "zemeolotu/perspective", "path": "/rust/perspective-viewer/src/rust/custom_elements/expression_editor.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zemeolotu/perspective path: /rust/perspective-viewer/src/rust/custom_elements/expression_editor.rs //////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2018, the Perspective Authors. // // This file is part of the Perspective library, distributed u...
code_fim
hard
{ "lang": "rust", "repo": "zemeolotu/perspective", "path": "/rust/perspective-viewer/src/rust/custom_elements/expression_editor.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lpc-rs/lpc-pac path: /lpc11uxx/src/gpio_pin_int/ienr.rs the rising edge or level interrupt for each pin interrupt. Bit n configures the pin interrupt selected in PINTSELn. 0 = Disable rising edge or level interrupt. 1 = Enable rising edge or level interrupt."] pub struct ENRL0_R(crate::FieldRead...
code_fim
hard
{ "lang": "rust", "repo": "lpc-rs/lpc-pac", "path": "/lpc11uxx/src/gpio_pin_int/ienr.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> &self.0 } } #[doc = "Field `ENRL7` writer - Enables the rising edge or level interrupt for each pin interrupt. Bit n configures the pin interrupt selected in PINTSELn. 0 = Disable rising edge or level interrupt. 1 = Enable rising edge or level interrupt."] pub struct ENRL7_W<'a> { w: &'a m...
code_fim
hard
{ "lang": "rust", "repo": "lpc-rs/lpc-pac", "path": "/lpc11uxx/src/gpio_pin_int/ienr.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lpc-rs/lpc-pac path: /lpc11uxx/src/gpio_pin_int/ienr.rs nline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl core::ops::DerefMut for W { #[inline(always)] fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } impl From<crate::W<IENR_SPEC...
code_fim
hard
{ "lang": "rust", "repo": "lpc-rs/lpc-pac", "path": "/lpc11uxx/src/gpio_pin_int/ienr.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: maxtnuk/onnx_latex path: /onnx/src/ops/ml/category_mapper.rs use crate::model::{OnnxOpRegister, ParsingContext}; use crate::pb::*; use tract_hir::internal::*; use tract_hir::utils::MathGen; use tract_onnx_opl::ml::*; pub fn register_all_ops(reg: &mut OnnxOpRegister) { reg.insert("CategoryMa...
code_fim
hard
{ "lang": "rust", "repo": "maxtnuk/onnx_latex", "path": "/onnx/src/ops/ml/category_mapper.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn category_mapper( _ctx: &ParsingContext, node: &NodeProto, ) -> TractResult<(Box<dyn InferenceOp>, Vec<String>)> { let ints: Vec<i64> = node.get_attr_vec("cats_int64s")?; let strings: Vec<String> = node.get_attr_vec("cats_strings")?; let default_int: Option<i64> = node.get_attr_opt("...
code_fim
hard
{ "lang": "rust", "repo": "maxtnuk/onnx_latex", "path": "/onnx/src/ops/ml/category_mapper.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &["onnx-ml"] } fn rules<'r, 'p: 'r, 's: 'r>( &'s self, s: &mut Solver<'r>, inputs: &'p [TensorProxy], outputs: &'p [TensorProxy], ) -> InferenceResult { check_input_arity(&inputs, 1)?; check_output_arity(&outputs, 1)?; s.equals(&...
code_fim
hard
{ "lang": "rust", "repo": "maxtnuk/onnx_latex", "path": "/onnx/src/ops/ml/category_mapper.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>where G: Scope, G: ScopeParent<Timestamp = AltNeu<T>>, T: Lattice + ExchangeData + Timestamp, { let value = value.to_owned(); let value: &'static [u32] = value.leak(); // TODO: use Box::leak and attach a destructor to the dataflow to free the allocation property.add( class ...
code_fim
hard
{ "lang": "rust", "repo": "riccardotommasini/differential-reasoner", "path": "/src/owl2rl/class_rules.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/* T(?x, owl:maxCardinality, "1"^^xsd:nonNegativeInteger) T(?x, owl:onProperty, ?p) T(?u, ?p, ?y1) T(?u, ?p, ?y2) T(?u, rdf:type, ?x) => T(?y1, owl:sameAs, ?y2) */ fn cls_maxc2<G, T>(property: &Property<G, T>, class: &Class<G, T>, same_as: &mut SameAs<G, T>) where G: Scope, G: ScopeParent<Timesta...
code_fim
hard
{ "lang": "rust", "repo": "riccardotommasini/differential-reasoner", "path": "/src/owl2rl/class_rules.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: riccardotommasini/differential-reasoner path: /src/owl2rl/class_rules.rs use std::cmp::Ordering::{Equal, Greater, Less}; use differential_dataflow::{collection::concatenate, lattice::Lattice, ExchangeData}; use dogsdogsdogs::{ altneu::AltNeu, PrefixExtender, ProposeExtensionMethod, Validate...
code_fim
hard
{ "lang": "rust", "repo": "riccardotommasini/differential-reasoner", "path": "/src/owl2rl/class_rules.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Emurgo/react-native-chain-libs path: /rust/src/android/balance.rs use super::primitive::ToPrimitiveObject; use super::ptr_j::*; use super::result::ToJniResult; use crate::panic::handle_exception_result; use crate::ptr::RPtrRepresentable; use jni::objects::JObject; use jni::sys::{jboolean, jobjec...
code_fim
hard
{ "lang": "rust", "repo": "Emurgo/react-native-chain-libs", "path": "/rust/src/android/balance.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[allow(non_snake_case)] #[no_mangle] pub unsafe extern "C" fn Java_io_emurgo_chainlibs_Native_balanceIsNegative( env: JNIEnv, _: JObject, balance: JRPtr ) -> jobject { handle_exception_result(|| { let balance = balance.rptr(&env)?; balance .typed_ref::<Balance>() .and_then(|balanc...
code_fim
hard
{ "lang": "rust", "repo": "Emurgo/react-native-chain-libs", "path": "/rust/src/android/balance.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>println!("{:?}", (12, true, "hello")); // math expression println!("5 * 20 = {}", 5 * 20); }<|fim_prefix|>// repo: charleslukes/learn-rust path: /src/print.rs pub fn run() { println!("Heloo world from print.rs file"); println!("{} the bad guy", "Charles"); // positional params pri...
code_fim
medium
{ "lang": "rust", "repo": "charleslukes/learn-rust", "path": "/src/print.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: charleslukes/learn-rust path: /src/print.rs pub fn run() { println!("Heloo world from print.rs file"); println!("{} the bad guy", "Charl<|fim_suffix|>println!("{:?}", (12, true, "hello")); // math expression println!("5 * 20 = {}", 5 * 20); }<|fim_middle|>es"); // positional ...
code_fim
medium
{ "lang": "rust", "repo": "charleslukes/learn-rust", "path": "/src/print.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>alizeError { body })?; list_built_in::DefaultResponse { status_code, value: rsp_value, } .fail() } } } pub mod list_built_in { use crate::{models, models::*}; use reqwest::St...
code_fim
hard
{ "lang": "rust", "repo": "extrawurst/azure-sdk-for-rust", "path": "/services/mgmt/resources/src/package_pure_policy_2017_06/operations.rs", "mode": "spm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_suffix|>ration_config.api_version)]); if let Some(filter) = filter { req_builder = req_builder.query(&[("$filter", filter)]); } let req = req_builder.build().context(list_for_resource_group::BuildRequestError)?; let rsp = client.execute(req).await.context(list_for_resou...
code_fim
hard
{ "lang": "rust", "repo": "extrawurst/azure-sdk-for-rust", "path": "/services/mgmt/resources/src/package_pure_policy_2017_06/operations.rs", "mode": "spm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_prefix|>// repo: extrawurst/azure-sdk-for-rust path: /services/mgmt/resources/src/package_pure_policy_2017_06/operations.rs teRequestError)?; match rsp.status() { StatusCode::OK => { let body: bytes::Bytes = rsp.bytes().await.context(get::ResponseBytesError)?; ...
code_fim
hard
{ "lang": "rust", "repo": "extrawurst/azure-sdk-for-rust", "path": "/services/mgmt/resources/src/package_pure_policy_2017_06/operations.rs", "mode": "psm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TheBlueMatt/rust-lightning path: /lightning/src/ln/monitor_tests.rs sed_event!(nodes[1], 1, ClosureReason::CooperativeClosure); } fn sorted_vec<T: Ord>(mut v: Vec<T>) -> Vec<T> { v.sort_unstable(); v } fn do_test_claim_value_force_close(prev_commitment_tx: bool) { // Tests `get_claimable_ba...
code_fim
hard
{ "lang": "rust", "repo": "TheBlueMatt/rust-lightning", "path": "/lightning/src/ln/monitor_tests.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TheBlueMatt/rust-lightning path: /lightning/src/ln/monitor_tests.rs e, None, None]); let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs); create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known()); let (update_a, _, chan_id_2, _) = create_announ...
code_fim
hard
{ "lang": "rust", "repo": "TheBlueMatt/rust-lightning", "path": "/lightning/src/ln/monitor_tests.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let node_0_closing_signed = get_event_msg!(nodes[0], MessageSendEvent::SendClosingSigned, nodes[1].node.get_our_node_id()); nodes[1].node.handle_closing_signed(&nodes[0].node.get_our_node_id(), &node_0_closing_signed); let node_1_closing_signed = get_event_msg!(nodes[1], MessageSendEvent::SendClosingSi...
code_fim
hard
{ "lang": "rust", "repo": "TheBlueMatt/rust-lightning", "path": "/lightning/src/ln/monitor_tests.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Jellonator/chum_world_old path: /src/plugin/mod.rs use gtk::{Widget, Label}; use gtk::prelude::*; use gui::page::{Page, ArchiveFile}; use std::rc::Rc; use std::cell::RefCell; use std::io::{self, Read, Write}; use ::CResult; use std::collections::HashMap; pub mod text; /// A plugin that can be ...
code_fim
hard
{ "lang": "rust", "repo": "Jellonator/chum_world_old", "path": "/src/plugin/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Import a file pub fn import<'a>(&self, typestr: &str, input: &mut Read, output: &mut Write) -> CResult<()> { if let Some(plugin) = self.ftypes.get(typestr).and_then(|fstring| { self.plugins.get(fstring) }) { let mut data = Vec::new(); plugin....
code_fim
hard
{ "lang": "rust", "repo": "Jellonator/chum_world_old", "path": "/src/plugin/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> R(reader) } } #[doc = "Field `DATA_COMP_RESULT` reader - The result of a comparison between the flash macro data output and the content of the high voltage page latches. The comparison result for a given column 'Column_Number' is updated in this register field on a read to address: 0x100+4*Col...
code_fim
medium
{ "lang": "rust", "repo": "psoc-rs/psoc6-pac", "path": "/src/flashc/fm_ctl/tm_cmpr.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: psoc-rs/psoc6-pac path: /src/flashc/fm_ctl/tm_cmpr.rs #[doc = "Register `TM_CMPR[%s]` reader"] pub struct R(crate::R<TM_CMPR_SPEC>); impl core::ops::Deref for R { type Target = crate::R<TM_CMPR_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { <|fim_suffix|> R(reader...
code_fim
medium
{ "lang": "rust", "repo": "psoc-rs/psoc6-pac", "path": "/src/flashc/fm_ctl/tm_cmpr.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: christheblog/graph-commands path: /command/src/graph_utils.rs //! Collection of useful functions for command-line tools use gc_core::graph::VertexId; use gc_core::graph_command::GraphCommand; use gc_core::graph_command::GraphCommand::AddEdge; use gc_core::graph_command::GraphCommand::AddVertex;...
code_fim
hard
{ "lang": "rust", "repo": "christheblog/graph-commands", "path": "/command/src/graph_utils.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn command_path(root_dir: &str) -> Box<path::Path> { path::Path::new(root_dir) .join(GRAPH_ROOT_DIR) .join(COMMANDS_FILE) .into_boxed_path() } // Applies a GraphCommand on the file, making sure the lock is acquired and released fn apply_graph_commands(root_dir: &str, commands:...
code_fim
hard
{ "lang": "rust", "repo": "christheblog/graph-commands", "path": "/command/src/graph_utils.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl MessageStore for MessageFileStore { /// The size of the file. fn size(&self) -> usize { self.buffer.capacity() } /// Gets the maximum length of a message we can store in the file. fn max_message_size(&self) -> usize { self.buffer.max_message_size() } /// ...
code_fim
hard
{ "lang": "rust", "repo": "Hoyt-Systems-Texas/HoytSys.Rust_Common", "path": "/a19_data_persist/src/file/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fence(Ordering::Acquire); if pos > self.size() - ALIGNMENT { Err(Error::PositionOutOfRange(pos)) } else if pos + length > self.size() { Err(Error::PositionOutOfRange(pos)) } else { Ok(self.buffer.get_bytes(pos, length)) } } ...
code_fim
hard
{ "lang": "rust", "repo": "Hoyt-Systems-Texas/HoytSys.Rust_Common", "path": "/a19_data_persist/src/file/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Hoyt-Systems-Texas/HoytSys.Rust_Common path: /a19_data_persist/src/file/mod.rs f the section to get. pub fn read_section<'a>(&'a self, pos: usize, length: usize) -> Result<&'a [u8]> { let store = unsafe { &mut *self.store.get() }; store.read_section(pos, length) } pu...
code_fim
hard
{ "lang": "rust", "repo": "Hoyt-Systems-Texas/HoytSys.Rust_Common", "path": "/a19_data_persist/src/file/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AshTS/LLVMCompiler path: /src/irgen/errors.rs use crate::cli::Error; use crate::parser::ParseTreeNode; use crate::tokenizer::FileLocation; <|fim_suffix|>/// Expected, got style error for IR code gen pub fn expected_got_error<T>(expected: &str, got: ParseTreeNode) -> Result<T, Error> { let r...
code_fim
medium
{ "lang": "rust", "repo": "AshTS/LLVMCompiler", "path": "/src/irgen/errors.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Display the location if the location is known pub fn compiler_error_loc<T>(text: String, loc: &Option<FileLocation>) -> Result<T, Error> { match loc { None => Err(Error::error(&format!("Compilation Error: {}", text))), Some(l) => Err(Error::error(&format!("Compilation Error: {}...
code_fim
hard
{ "lang": "rust", "repo": "AshTS/LLVMCompiler", "path": "/src/irgen/errors.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Ok(Self { sources: sources.into_inner(), spv: out.as_binary().into(), }) } } #[proc_macro_hack] pub fn include_glsl(tokens: TokenStream) -> TokenStream { let IncludeGlsl { sources, spv } = parse_macro_input!(tokens as IncludeGlsl); let expanded = quote!...
code_fim
hard
{ "lang": "rust", "repo": "HexyWitch/vk-shader-macros", "path": "/impl/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HexyWitch/vk-shader-macros path: /impl/src/lib.rs extern crate proc_macro; use std::cell::RefCell; use std::path::Path; use std::{env, fs, mem, str}; use proc_macro::TokenStream; use proc_macro_hack::proc_macro_hack; use quote::quote; use syn::parse::{Parse, ParseStream, Result}; use syn::{par...
code_fim
hard
{ "lang": "rust", "repo": "HexyWitch/vk-shader-macros", "path": "/impl/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut target_version = 1 << 22; while !input.is_empty() { input.parse::<Token![,]>()?; let key = input.parse::<Ident>()?; match &key.to_string()[..] { "kind" => { input.parse::<Token![:]>()?; let...
code_fim
hard
{ "lang": "rust", "repo": "HexyWitch/vk-shader-macros", "path": "/impl/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Arbitrary for Player { fn arbitrary<G: Gen>(g: &mut G) -> Self { g.gen::<Player>() } }<|fim_prefix|>// repo: xpe/rs-uttt path: /src/tests/arbitrary.rs /// Implementations of the Arbitrary trait. Used by quickcheck tests. use data::*; use quickcheck::{Arbitrary, Gen}; impl Arbitrary...
code_fim
medium
{ "lang": "rust", "repo": "xpe/rs-uttt", "path": "/src/tests/arbitrary.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Arbitrary for BI { fn arbitrary<G: Gen>(g: &mut G) -> Self { g.gen::<BI>() } } impl Arbitrary for SBI { fn arbitrary<G: Gen>(g: &mut G) -> Self { g.gen::<SBI>() } } impl Arbitrary for SRI { fn arbitrary<G: Gen>(g: &mut G) -> Self { g.gen::<SRI>() } } ...
code_fim
hard
{ "lang": "rust", "repo": "xpe/rs-uttt", "path": "/src/tests/arbitrary.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xpe/rs-uttt path: /src/tests/arbitrary.rs /// Implementations of the Arbitrary trait. Used by quickcheck tests. use data::*; use quickcheck::{Arbitrary, Gen}; impl Arbitrary for Game { fn arbitrary<G: Gen>(g: &mut G) -> Self { g.gen::<Game>() } } <|fim_suffix|>impl Arbitrary f...
code_fim
hard
{ "lang": "rust", "repo": "xpe/rs-uttt", "path": "/src/tests/arbitrary.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>include!(concat!(env!("OUT_DIR"), "/inchi_api.rs"));<|fim_prefix|>// repo: mustafa-guler/libinchi-sys path: /src/lib.rs #![doc = include_str!("../README.md")] <|fim_middle|>#![allow( clippy::all, unused, non_upper_case_globals, non_camel_case_types, non_snake_case, deref_nullptr ...
code_fim
medium
{ "lang": "rust", "repo": "mustafa-guler/libinchi-sys", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mustafa-guler/libinchi-sys path: /src/lib.rs #![doc = include_str!("../README.md")] <|fim_suffix|>include!(concat!(env!("OUT_DIR"), "/inchi_api.rs"));<|fim_middle|>#![allow( clippy::all, unused, non_upper_case_globals, non_camel_case_types, non_snake_case, deref_nullptr ...
code_fim
medium
{ "lang": "rust", "repo": "mustafa-guler/libinchi-sys", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[derive(Debug, Default)] pub struct Message { br: Vec<u8>, } impl Message { /*------------------------------------------- Primary interface */ pub fn new(sz:usize) -> Self { Self { br: vec![0; sz], } } /*-- load existing heap array with zeros --...
code_fim
hard
{ "lang": "rust", "repo": "JimFawcett/RustByteRecord", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JimFawcett/RustByteRecord path: /src/lib.rs ///////////////////////////////////////////////////////////// // rust_byte_record::main.rs - manage byte arrays // // // // Jim Fawcett, https://JimFawcett.github.io, 05 Sep 2020 // ////...
code_fim
hard
{ "lang": "rust", "repo": "JimFawcett/RustByteRecord", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Command for Version { fn execute(&self, _: &mut Context, msg: &Message, _: Args) -> Result<(), Error> { let cargo: Cargo = toml::from_str( include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/Cargo.toml")))?; msg.reply(&format!("Version {}", cargo.package.version))?; ...
code_fim
medium
{ "lang": "rust", "repo": "TragicSolitude/VoidBot", "path": "/src/commands/version.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub struct Version; impl Command for Version { fn execute(&self, _: &mut Context, msg: &Message, _: Args) -> Result<(), Error> { let cargo: Cargo = toml::from_str( include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/Cargo.toml")))?; msg.reply(&format!("Version {}", cargo.pa...
code_fim
medium
{ "lang": "rust", "repo": "TragicSolitude/VoidBot", "path": "/src/commands/version.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TragicSolitude/VoidBot path: /src/commands/version.rs use serenity::prelude::*; use serenity::framework::standard::Command; use serenity::framework::standard::Args; use serenity::framework::standard::CommandError as Error; use serenity::model::channel::Message; #[derive(Deserialize)] struct Car...
code_fim
medium
{ "lang": "rust", "repo": "TragicSolitude/VoidBot", "path": "/src/commands/version.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl ClientOptions { pub async fn build(self) -> mongodb::Database { let database = self.database.as_ref().unwrap().to_string(); // TODO: // let o: Box< // dyn Future<Output = mongodb::error::Result<mongodb::options::ClientOptions>> + Unpin, // > = self.into...
code_fim
hard
{ "lang": "rust", "repo": "divinerapier/manggis", "path": "/manggis/src/middleware/mongo.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: divinerapier/manggis path: /manggis/src/middleware/mongo.rs // use futures::Future; use mongodb::options::{Credential, CredentialBuilder}; use tokio::runtime::Handle; pub struct ClientOptions { pub uri: Option<String>, pub database: Option<String>, pub collection: Option<String>, } ...
code_fim
hard
{ "lang": "rust", "repo": "divinerapier/manggis", "path": "/manggis/src/middleware/mongo.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut list = vec![1, 2, 3, 4]; let greater_than_one = |x: i32| x > 1; assert_eq!( find(greater_than_one, list.into_iter()), Some(2) ); } }<|fim_prefix|>// repo: addityasingh/sknife path: /src/collection/find.rs #![crate_name = "sknife"] /// ...
code_fim
hard
{ "lang": "rust", "repo": "addityasingh/sknife", "path": "/src/collection/find.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: addityasingh/sknife path: /src/collection/find.rs #![crate_name = "sknife"] /// Find first element of list that satisfies a predicate /// /// # Arguments /// /// * `predicate` - The predicate function /// * `list` - A list of elements to find in /// /// # Example /// /// ``` /// use sknife::col...
code_fim
medium
{ "lang": "rust", "repo": "addityasingh/sknife", "path": "/src/collection/find.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn find_empty_list() { let mut list = vec![]; let greater_than_one = |x: i32| x > 1; assert_eq!( find(greater_than_one, list.into_iter()), None ); } #[test] fn find_in_list() { let mut list = vec![1, 2, 3, 4]; ...
code_fim
medium
{ "lang": "rust", "repo": "addityasingh/sknife", "path": "/src/collection/find.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>_use] pub fn btb(&mut self) -> BTB_W<ETH_MACMDIOAR_SPEC, 26> { BTB_W::new(self) } #[doc = "Bit 27 - PSE"] #[inline(always)] #[must_use] pub fn pse(&mut self) -> PSE_W<ETH_MACMDIOAR_SPEC, 27> { PSE_W::new(self) } #[doc = "Writes raw bits to the register."] ...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32mp1/src/stm32mp157/eth_mac_mmc/eth_macmdioar.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }