text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: minioin/rustastic-smtp path: /src/common/transaction.rs // Copyright 2014 The Rustastic SMTP Developers // // 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 // // h...
code_fim
hard
{ "lang": "rust", "repo": "minioin/rustastic-smtp", "path": "/src/common/transaction.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stm32-rs/stm32-rs-nightlies path: /stm32wl/src/stm32wl5x_cm0p/adc/isr.rs #[doc = "Register `ISR` reader"] pub type R = crate::R<ISR_SPEC>; #[doc = "Register `ISR` writer"] pub type W = crate::W<ISR_SPEC>; #[doc = "Field `ADRDY` reader - ADRDY"] pub type ADRDY_R = crate::BitReader; #[doc = "Field...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32wl/src/stm32wl5x_cm0p/adc/isr.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>D3_R { AWD3_R::new(((self.bits >> 9) & 1) != 0) } #[doc = "Bit 11 - EOCAL"] #[inline(always)] pub fn eocal(&self) -> EOCAL_R { EOCAL_R::new(((self.bits >> 11) & 1) != 0) } #[doc = "Bit 13 - CCRDY"] #[inline(always)] pub fn ccrdy(&self) -> CCRDY_R { C...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32wl/src/stm32wl5x_cm0p/adc/isr.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>AWD3_W<ISR_SPEC, 9> { AWD3_W::new(self) } #[doc = "Bit 11 - EOCAL"] #[inline(always)] #[must_use] pub fn eocal(&mut self) -> EOCAL_W<ISR_SPEC, 11> { EOCAL_W::new(self) } #[doc = "Bit 13 - CCRDY"] #[inline(always)] #[must_use] pub fn ccrdy(&mut self) ...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32wl/src/stm32wl5x_cm0p/adc/isr.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let new_path_for_current_executable = format!( "{}/{}-{}", local_data_path.to_str().unwrap(), Asset::EXECUTABLE_NAME, env!("CARGO_PKG_VERSION"), ); let mut file_content = std::fs::File::create(&new_path_for_current_executable).expect...
code_fim
hard
{ "lang": "rust", "repo": "kunicmarko20/ghnotifier-rs", "path": "/src/ui/cli/command/install.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kunicmarko20/ghnotifier-rs path: /src/ui/cli/command/install.rs use super::Command; use super::Output; use std::path::PathBuf; use std::fs::OpenOptions; use structopt::StructOpt; use std::io::Write; use std::os::unix::fs; use std::os::unix::fs::PermissionsExt; use crate::ui::asset::Asset; use cr...
code_fim
hard
{ "lang": "rust", "repo": "kunicmarko20/ghnotifier-rs", "path": "/src/ui/cli/command/install.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn copy_current_executable_to_executable_directory(mut local_data_path: PathBuf) { local_data_path.push(Asset::EXECUTABLE_DIRECTORY); let new_path_for_current_executable = format!( "{}/{}-{}", local_data_path.to_str().unwrap(), Asset::EXECUTABLE_NAM...
code_fim
hard
{ "lang": "rust", "repo": "kunicmarko20/ghnotifier-rs", "path": "/src/ui/cli/command/install.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gurry/efi path: /src/net/dns/rdata/ptr.rs use super::super::Name; //#[derive(Debug)] #[derive(Clone, Copy)] pub struct Record<'a>(pub Name<'a>); // impl<'a> ToString for Record<'a> { // #[inline] // fn to_string(&self) -> String { // self.0.to_string() // } // } impl<'a> s...
code_fim
hard
{ "lang": "rust", "repo": "gurry/efi", "path": "/src/net/dns/rdata/ptr.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let response = b"\x53\xd6\x81\x80\x00\x01\x00\x01\x00\x00\x00\x00\ \x0269\x0293\x0275\x0272\x07in-addr\x04arpa\x00\ \x00\x0c\x00\x01\ \xc0\x0c\x00\x0c\x00\x01\x00\x01\x51\x80\x00\x1e\ \x10po...
code_fim
hard
{ "lang": "rust", "repo": "gurry/efi", "path": "/src/net/dns/rdata/ptr.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { println!("{}", Solution::min_falling_path_sum(vec![vec![0; 5]; 5])); }<|fim_prefix|>// repo: redsnapper2006/leetcode-cn path: /M/931-minimum-falling-path-sum/main.rs struct Solution {} impl Solution { pub fn min_falling_path_sum(a: Vec<Vec<i32>>) -> i32 { let mut buf: Vec<Vec<i32>> =...
code_fim
medium
{ "lang": "rust", "repo": "redsnapper2006/leetcode-cn", "path": "/M/931-minimum-falling-path-sum/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: redsnapper2006/leetcode-cn path: /M/931-minimum-falling-path-sum/main.rs struct Solution {} impl Solution { pub fn min_falling_path_sum(a: Vec<Vec<i32>>) -> i32 { let mut buf: Vec<Vec<i32>> = vec![vec![0; a[0].len()]; a.len()]; for i in 0..a[0].len() { buf[0][i] = a[0][i]; }...
code_fim
medium
{ "lang": "rust", "repo": "redsnapper2006/leetcode-cn", "path": "/M/931-minimum-falling-path-sum/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn create_right_leds(&self, leds: &mut Vec<Led>) { let steph = (self.ptbrh - self.pttrh) as f32 / self.ledsright as f32; let stepv = (self.ptbrv - self.pttrv - (2. * self.edgevgap)) / self.ledsright as f32; leds.reserve(self.ledsright as _); for i in 0..self.ledsright ...
code_fim
hard
{ "lang": "rust", "repo": "vtavernier/hyperion.rs", "path": "/src/models/layouts.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vtavernier/hyperion.rs path: /src/models/layouts.rs use super::{ClassicLedConfig, Led, Leds}; /// Trait for converting a LED configuration to LEDs pub trait ToLeds { fn to_leds(&self) -> Leds; } struct ClassicLedParams { ledstop: u32, ledsbottom: u32, ledsleft: u32, ledsrig...
code_fim
hard
{ "lang": "rust", "repo": "vtavernier/hyperion.rs", "path": "/src/models/layouts.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> leds.reserve(self.ledsleft as _); for i in 0..self.ledsleft { let i = i as f32; let hmin = self.pttlh + (steph * i); let hmax = hmin + self.ledsvdepth; let vmin = self.ovl_minus(self.pttlv + (stepv * i) + self.edgevgap); let vmax ...
code_fim
hard
{ "lang": "rust", "repo": "vtavernier/hyperion.rs", "path": "/src/models/layouts.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn source_information(&self) -> &Rc<SourceInformation> { &self.source_information } }<|fim_prefix|>// repo: fossabot/sloth path: /compiler/src/ast/variable.rs use crate::debug::SourceInformation; use std::rc::Rc; #[derive(Clone, Debug, PartialEq)] pub struct Variable { name: Stri...
code_fim
medium
{ "lang": "rust", "repo": "fossabot/sloth", "path": "/compiler/src/ast/variable.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fossabot/sloth path: /compiler/src/ast/variable.rs use crate::debug::SourceInformation; use std::rc::Rc; #[derive(Clone, Debug, PartialEq)] pub struct Variable { name: String, source_information: Rc<SourceInformation>, } <|fim_suffix|> pub fn source_information(&self) -> &Rc<SourceI...
code_fim
hard
{ "lang": "rust", "repo": "fossabot/sloth", "path": "/compiler/src/ast/variable.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>) => {} Err(_) => panic!("Stack is not large enough"), } } else { match stack.pop() { Some(out) => print!("{} ", out), None => println!("Stack empty"), } } } println!("{} left on stack", stack.size(...
code_fim
medium
{ "lang": "rust", "repo": "sbeckeriv/rust-algorithms", "path": "/chapter-1/3/max_stack/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sbeckeriv/rust-algorithms path: /chapter-1/3/max_stack/src/main.rs use std::io; mod stackable; // I skipped page 133 and just did the generic version fn main() { let mut string = String::new(); io::stdin().read_line(&mut string).unwrap(); let mut stack = stackable::MaxStack::<&str>::...
code_fim
medium
{ "lang": "rust", "repo": "sbeckeriv/rust-algorithms", "path": "/chapter-1/3/max_stack/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> None => println!("Stack empty"), } } } println!("{} left on stack", stack.size()); for i in &stack{ println!("{}", i); } }<|fim_prefix|>// repo: sbeckeriv/rust-algorithms path: /chapter-1/3/max_stack/src/main.rs use std::io; mod stackable; // I...
code_fim
medium
{ "lang": "rust", "repo": "sbeckeriv/rust-algorithms", "path": "/chapter-1/3/max_stack/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn write_uvarint<W: Write>(writer: &mut W, x: u32) -> io::Result<usize> { let mut bytes_written = 0; let mut x = x; while x >= 0x80 { try!(writer.write(&mut [((x & 0xff) as u8) | 0x80])); x >>= 7; bytes_written += 1; } try!(writer.write(&mut [(x & 0xff) as u...
code_fim
hard
{ "lang": "rust", "repo": "vernonrj/codesearch-rs", "path": "/src/libvarint/src/lib.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vernonrj/codesearch-rs path: /src/libvarint/src/lib.rs // Ported from Go's binary.varint lib. // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file./ <|fim_suffix|>pub fn read_uvarint(b: &[u...
code_fim
medium
{ "lang": "rust", "repo": "vernonrj/codesearch-rs", "path": "/src/libvarint/src/lib.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: qryxip/atcoder path: /abc160/src/bin/d.rs use proconio::input; #[allow(unused_imports)] use proconio::marker::*; #[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; #[allow(unused_imports)] use std::f64::consts::*; #[allow(unused)] const INF: usize = std:...
code_fim
medium
{ "lang": "rust", "repo": "qryxip/atcoder", "path": "/abc160/src/bin/d.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Kurble/amethyst_voxel path: /src/voxel.rs use std::iter::FromIterator; use std::ops::{Deref, DerefMut}; use std::sync::Arc; use nalgebra_glm::Vec3; use crate::ambient_occlusion::SharedVertexData; use crate::context::Context; use crate::material::AtlasMaterialHandle; use crate::side::Side; use ...
code_fim
hard
{ "lang": "rust", "repo": "Kurble/amethyst_voxel", "path": "/src/voxel.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn skin(&self) -> Option<u8> { None } fn is_detail(&self) -> bool { false } fn triangulate<'a, S: Side, C: Context<Self>>( &self, mesh: &mut Triangulation, ao: &SharedVertexData, _: &C, origin: Vec3, scale: f32, ) { ...
code_fim
hard
{ "lang": "rust", "repo": "Kurble/amethyst_voxel", "path": "/src/voxel.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if let Self::Detail { .. } = self { true } else { false } } fn triangulate<'a, S: Side, C: Context<Self>>( &self, mesh: &mut Triangulation, shared: &SharedVertexData, context: &C, origin: Vec3, scale: ...
code_fim
hard
{ "lang": "rust", "repo": "Kurble/amethyst_voxel", "path": "/src/voxel.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[no_mangle] pub fn generate_pickup() { let state = unsafe { STATE.as_mut().unwrap() }; state.generator = Generator::new(Sample::pickup(Some(state.rng.gen()))); } #[no_mangle] pub fn generate_laser() { let state = unsafe { STATE.as_mut().unwrap() }; state.generator = Generator::new(Sample:...
code_fim
hard
{ "lang": "rust", "repo": "bzar/sfxr-web", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bzar/sfxr-web path: /src/lib.rs extern crate sfxr; extern crate hound; extern crate rand; use sfxr::{Sample, Generator, WaveType}; use rand::{Rng, SeedableRng, rngs::SmallRng}; const BUFFER_SIZE: usize = 44_100; struct State { generator: Generator, buffer: [f32; BUFFER_SIZE], wav_...
code_fim
hard
{ "lang": "rust", "repo": "bzar/sfxr-web", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>macro_rules! getter_setter { ($value_type:ty, $field:ident, $setter:ident) => { #[no_mangle] pub fn $field() -> $value_type { let state = unsafe { STATE.as_ref().unwrap() }; state.generator.sample.$field } #[no_mangle] pub fn $setter(valu...
code_fim
hard
{ "lang": "rust", "repo": "bzar/sfxr-web", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nlopes/avro-schema-registry path: /src/api/mod.rs pub use self::compatibility::*; pub use self::configs::*; pub use self::schemas::*; pub use self::sub<|fim_suffix|>errors; mod schemas; mod subjects; pub mod version;<|fim_middle|>jects::*; mod compatibility; mod configs; pub mod
code_fim
easy
{ "lang": "rust", "repo": "nlopes/avro-schema-registry", "path": "/src/api/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>errors; mod schemas; mod subjects; pub mod version;<|fim_prefix|>// repo: nlopes/avro-schema-registry path: /src/api/mod.rs pub use self::compatibility::*; pub use self::configs::*; pub use self::schemas::*; pub use self::sub<|fim_middle|>jects::*; mod compatibility; mod configs; pub mod
code_fim
easy
{ "lang": "rust", "repo": "nlopes/avro-schema-registry", "path": "/src/api/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>jects::*; mod compatibility; mod configs; pub mod errors; mod schemas; mod subjects; pub mod version;<|fim_prefix|>// repo: nlopes/avro-schema-registry path: /src/api/mod.rs pub use self::compatibility::*; pub use self::conf<|fim_middle|>igs::*; pub use self::schemas::*; pub use self::sub
code_fim
easy
{ "lang": "rust", "repo": "nlopes/avro-schema-registry", "path": "/src/api/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: quark-zju/outagefs path: /src/vendor.rs #[path = "../vendor/fuse/src/lib.rs"] pub mod fuse; <|fim_suffix|>#[path = "../vendor/fuse/fuse-sys/src/lib.rs"] pub mod fuse_sys;<|fim_middle|>#[path = "../vendor/fuse/fuse-abi/src/lib.rs"] pub mod fuse_abi;
code_fim
medium
{ "lang": "rust", "repo": "quark-zju/outagefs", "path": "/src/vendor.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[path = "../vendor/fuse/fuse-sys/src/lib.rs"] pub mod fuse_sys;<|fim_prefix|>// repo: quark-zju/outagefs path: /src/vendor.rs #[path = "../vendor/fuse/src/lib.rs"] pub mod fuse; <|fim_middle|>#[path = "../vendor/fuse/fuse-abi/src/lib.rs"] pub mod fuse_abi;
code_fim
medium
{ "lang": "rust", "repo": "quark-zju/outagefs", "path": "/src/vendor.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Freaky/elite_shield_tester path: /src/combinations.rs /* A Rust port of `xuniqueSelectionsFromPairs` - originally an algorithm by Rutger Janssen, optimized and enhanced to work off filtered pairs by Jamie "Entity" van den Berge - https://github.com/ntt Ported to Rust by Thomas Hurst - https://g...
code_fim
hard
{ "lang": "rust", "repo": "Freaky/elite_shield_tester", "path": "/src/combinations.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut item_count = vec![0; items.len()]; // individual item count in current solution let mut depth = 0; // current solution depth n -= 1; // n is now the deepest allowed depth // track allowed items at each depth. root level items always allow all items let mut allowed_mask = vec!...
code_fim
hard
{ "lang": "rust", "repo": "Freaky/elite_shield_tester", "path": "/src/combinations.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // newline means we start a new paragraph if line.unwrap().is_empty() { prev_newline = true; } else { prev_newline = false; } content.push('\n'); let caps = INDENTED.captures(line.unwrap()).unwrap(); ...
code_fim
hard
{ "lang": "rust", "repo": "johannhof/markdown.rs", "path": "/src/parser/block/unordered_list.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> None } #[cfg(test)] mod test { use super::parse_unordered_list; use parser::Block::UnorderedList; #[test] fn finds_list() { match parse_unordered_list(&vec!["* A list", "* is good"]) { Some((UnorderedList(_), 2)) => (), x => panic!("Found {:?}", x), ...
code_fim
hard
{ "lang": "rust", "repo": "johannhof/markdown.rs", "path": "/src/parser/block/unordered_list.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: johannhof/markdown.rs path: /src/parser/block/unordered_list.rs use parser::block::parse_blocks; use parser::Block; use parser::Block::{Paragraph, UnorderedList}; use parser::ListItem; use regex::Regex; pub fn parse_unordered_list(lines: &[&str]) -> Option<(Block, usize)> { lazy_static! { ...
code_fim
hard
{ "lang": "rust", "repo": "johannhof/markdown.rs", "path": "/src/parser/block/unordered_list.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: greenMT/daly path: /src/bytecode.rs #[derive(Debug, Clone, Copy)] pub enum Comp { Eq, Lt, Le, Gt, Ge, } #[derive(Debug, Clone)] pub enum Instruction { Call(String), Return, Add, Cmp(Comp), Jump(usize), JumpIfTrue(usize), JumpIfFalse(usize), ...
code_fim
medium
{ "lang": "rust", "repo": "greenMT/daly", "path": "/src/bytecode.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Load(usize), Store(usize), Const(usize), Array(usize), ArrayGet, Push, Loop, Break, // intrinsics Len, Print, Clone, }<|fim_prefix|>// repo: greenMT/daly path: /src/bytecode.rs #[derive(Debug, Clone, Copy)] pub enum Comp { Eq, Lt, Le, G...
code_fim
medium
{ "lang": "rust", "repo": "greenMT/daly", "path": "/src/bytecode.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: qiangchangjin/tikv path: /tests/raftstore/test_region_heartbeat.rs use std::thread::sleep; use std::sync::mpsc; use std::time::{Instant, Duration}; use rand::random; use kvproto::pdpb; use tikv::util::HandyRwLock; use super::node::new_node_cluster; use super::server::new_server_cluster; use su...
code_fim
hard
{ "lang": "rust", "repo": "qiangchangjin/tikv", "path": "/tests/raftstore/test_region_heartbeat.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut tried_times = 0; loop { tried_times += 1; if tried_times > 100 { panic!("can't get pending peer after {} tries.", tried_times); } let pending_peers = cluster.pd_client.get_pending_peers(); if pending_peers.is_empty() { sleep(D...
code_fim
hard
{ "lang": "rust", "repo": "qiangchangjin/tikv", "path": "/tests/raftstore/test_region_heartbeat.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: 2garryn/eft2json path: /src/parser/elem_compose.rs pub trait ElemCompose { fn open(&mut self, name: &str); <|fim_suffix|> fn push_char(&mut self, elem: char); fn close(&mut self); }<|fim_middle|> fn push_str<T: AsRef<str>>(&mut self, elem: T);
code_fim
easy
{ "lang": "rust", "repo": "2garryn/eft2json", "path": "/src/parser/elem_compose.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn push_char(&mut self, elem: char); fn close(&mut self); }<|fim_prefix|>// repo: 2garryn/eft2json path: /src/parser/elem_compose.rs pub trait ElemCompose { fn open(&mut self, name: &str); <|fim_middle|> fn push_str<T: AsRef<str>>(&mut self, elem: T);
code_fim
easy
{ "lang": "rust", "repo": "2garryn/eft2json", "path": "/src/parser/elem_compose.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn close(&mut self); }<|fim_prefix|>// repo: 2garryn/eft2json path: /src/parser/elem_compose.rs pub trait ElemCompose { fn open(&mut self, name: &str); <|fim_middle|> fn push_str<T: AsRef<str>>(&mut self, elem: T); fn push_char(&mut self, elem: char);
code_fim
medium
{ "lang": "rust", "repo": "2garryn/eft2json", "path": "/src/parser/elem_compose.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let array = self.builder.as_arc(); DFPrimitiveArray::<T>::from_arrow_array(array.as_ref()) } } impl<T> PrimitiveArrayBuilder<T> where T: DFPrimitiveType { pub fn with_capacity(capacity: usize) -> Self { PrimitiveArrayBuilder { builder: MutablePrimitiveArray::<T...
code_fim
hard
{ "lang": "rust", "repo": "r-asou/databend", "path": "/common/datavalues/src/arrays/primitive/builder.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl<T> PrimitiveArrayBuilder<T> where T: DFPrimitiveType { pub fn with_capacity(capacity: usize) -> Self { PrimitiveArrayBuilder { builder: MutablePrimitiveArray::<T>::with_capacity(capacity), } } } impl<T> NewDataArray<T> for DFPrimitiveArray<T> where T: DFPrimitiveT...
code_fim
hard
{ "lang": "rust", "repo": "r-asou/databend", "path": "/common/datavalues/src/arrays/primitive/builder.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: r-asou/databend path: /common/datavalues/src/arrays/primitive/builder.rs // Copyright 2020 Datafuse Labs. // // 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
hard
{ "lang": "rust", "repo": "r-asou/databend", "path": "/common/datavalues/src/arrays/primitive/builder.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lubosvesely/gooddata-fs path: /src/object/metadata/report.rs #[derive(RustcDecodable, RustcEncodable, Debug, Clone)] pub struct ReportContent { pub domains: Option<Vec<String>>, pub definitions: Option<Vec<String>>, } <|fim_suffix|>#[derive(RustcDecodable, RustcEncodable, Debug, Clone)]...
code_fim
medium
{ "lang": "rust", "repo": "lubosvesely/gooddata-fs", "path": "/src/object/metadata/report.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(RustcDecodable, RustcEncodable, Debug, Clone)] pub struct Report { pub report: ReportBody, } #[derive(RustcDecodable, RustcEncodable, Debug, Clone)] pub struct ObjectsReportBody { pub paging: super::MetadataPaging, pub items: Vec<Report>, } #[derive(RustcDecodable, RustcEncodable, D...
code_fim
medium
{ "lang": "rust", "repo": "lubosvesely/gooddata-fs", "path": "/src/object/metadata/report.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: niko-rs/niko path: /src/collections/slot_list.rs #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub struct Key { index: usize, generation: usize, } impl Key { fn new(index: usize, generation: usize) -> Self { Self { index, generation, } ...
code_fim
hard
{ "lang": "rust", "repo": "niko-rs/niko", "path": "/src/collections/slot_list.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(item) = &self.items[key.index] { Some(item) } else { None } } /// Returns a mutable reference to an item from this SlotList if an item is still stored in it for the given key, otherwise returns None. pub fn get_mut(&mut self, key: Ke...
code_fim
hard
{ "lang": "rust", "repo": "niko-rs/niko", "path": "/src/collections/slot_list.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: BlackHoleFox/ockam path: /implementations/rust/ockam/ockam_executor/src/time.rs use core::future::Future; pub use core::time::Duration; use pin_project_lite::pin_project; pin_project! { #[derive(Debug)] pub struct Timeout<F> { #[pin] duration: Duration, #[pin] ...
code_fim
hard
{ "lang": "rust", "repo": "BlackHoleFox/ockam", "path": "/implementations/rust/ockam/ockam_executor/src/time.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub struct Sleep; pub async fn sleep(_duration: Duration) -> Sleep { unimplemented!(); } pub mod error { use core::fmt; use ockam_core::compat::{error, io}; #[derive(Debug, PartialEq)] pub struct Elapsed(()); impl Elapsed { #![allow(dead_code)] pub(crate) fn new...
code_fim
hard
{ "lang": "rust", "repo": "BlackHoleFox/ockam", "path": "/implementations/rust/ockam/ockam_executor/src/time.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pipex/cc2538 path: /src/rfcore_xreg/frmfilt1.rs #[doc = "Reader of register FRMFILT1"] pub type R = crate::R<u32, super::FRMFILT1>; #[doc = "Writer for register FRMFILT1"] pub type W = crate::W<u32, super::FRMFILT1>; #[doc = "Register FRMFILT1 `reset()`'s with value 0"] impl crate::ResetValue fo...
code_fim
hard
{ "lang": "rust", "repo": "pipex/cc2538", "path": "/src/rfcore_xreg/frmfilt1.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit...
code_fim
hard
{ "lang": "rust", "repo": "pipex/cc2538", "path": "/src/rfcore_xreg/frmfilt1.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let off = u16::from(self.offset()); u16::from(seq) % off == u16::from(self.sn_base_low_bits()) % off } } impl<'buf> fmt::Debug for FecHeader<'buf> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { f.debug_struct("FecHeader") .field("sn_bas...
code_fim
hard
{ "lang": "rust", "repo": "dholroyd/smpte2022-1-packet", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dholroyd/smpte2022-1-packet path: /src/lib.rs //! Zero-copy access to the header fields of packets formatted according to //! [SMPTE 2022-1](https://en.wikipedia.org/wiki/SMPTE_2022), also know as 'Pro MPEG FEC' or '1D/2D //! parity FEC'. //! //! Note this does **not implement FEC encoding or de...
code_fim
hard
{ "lang": "rust", "repo": "dholroyd/smpte2022-1-packet", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let data = hex!("6ce40524a10000000a91778f00140500471fff16dc0d01fe70bc61a31668cbbaf9c45ec52e4ce3c8c977c99d7fad0459b40e647f07b7e3fa7140027ea859ebddc28a1c20f94ed52d171e4cecfda81bb56eb9cb73d928f4b95b82399cae25998bd362c699bac4603b80a354f927b95af806fe003c0cf132cda74495456915bdbe27bcc40aa98c111db2403de50...
code_fim
hard
{ "lang": "rust", "repo": "dholroyd/smpte2022-1-packet", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jnqnfe/gong path: /lib/src/options.rs // Copyright 2017 Lyndon Brown // // This file is part of the `gong` command-line argument processing library. // // Licensed under the MIT license or the Apache license (version 2.0), at your option. You may not // copy, modify, or distribute this file exce...
code_fim
hard
{ "lang": "rust", "repo": "jnqnfe/gong", "path": "/lib/src/options.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn find_duplicates_long<'r, 'a: 'r>(set: &OptionSet<'r, 'a>, flaws: &mut Vec<OptionFlaw<'a>>, detail: bool, found: &mut bool) { let opts = set.long; let mut checked: Vec<&'a str> = Vec::with_capacity(opts.len()); let mut duplicates = Vec::new(); for long in...
code_fim
hard
{ "lang": "rust", "repo": "jnqnfe/gong", "path": "/lib/src/options.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> output.to_lowercase() }) }) .with_function("reuse iter", move |b, txt| { let mut output = String::with_capacity(txt.len()); b.iter(|| { output.clear(); output.extend(txt.chars().flat_map(fold_char_to_ascii)); ...
code_fim
hard
{ "lang": "rust", "repo": "Clikengo/asciifolding", "path": "/benches/bench.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Clikengo/asciifolding path: /benches/bench.rs use criterion::black_box; use criterion::Criterion; use criterion::ParameterizedBenchmark as PB; use criterion::Throughput; use criterion::{criterion_group, criterion_main}; use asciifolding::{fold_char_to_ascii, fold_to_ascii, fold_to_ascii_buffer}...
code_fim
hard
{ "lang": "rust", "repo": "Clikengo/asciifolding", "path": "/benches/bench.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[cfg(feature = "std")] impl<T: Config> Default for GenesisConfig<T> { fn default() -> Self { GenesisConfig { locked_price: vec![], _phantom: PhantomData, } } } #[pallet::genesis_build] impl<T: Config> GenesisBuild<T> for GenesisConfig<T> { fn build(&self) { self.locked_price ...
code_fim
hard
{ "lang": "rust", "repo": "minterest-finance/minterest-chain-node", "path": "/pallets/prices/src/lib.rs", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> GenesisConfig { locked_price: vec![], _phantom: PhantomData, } } } #[pallet::genesis_build] impl<T: Config> GenesisBuild<T> for GenesisConfig<T> { fn build(&self) { self.locked_price .iter() .for_each(|(currency_id, price)| LockedPriceStorage::<T>::insert(currency_id, pric...
code_fim
hard
{ "lang": "rust", "repo": "minterest-finance/minterest-chain-node", "path": "/pallets/prices/src/lib.rs", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|>// repo: minterest-finance/minterest-chain-node path: /pallets/prices/src/lib.rs //! # Prices Module //! //! ## Overview //! //! The data from Oracle cannot be used in business, prices module will do some //! process and feed prices for Minterest. Process include: //! - specify a fixed price for stable...
code_fim
hard
{ "lang": "rust", "repo": "minterest-finance/minterest-chain-node", "path": "/pallets/prices/src/lib.rs", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|>// repo: darnuria/esgi-rust path: /exo_revision/03-addition.rs // ----------------------------------------------------------------------------- // Atelier Rust Journée du Logiciel Libre // 2019-04-06 - 13h -> 13h45 // Animateur: Axel Viala (darnuria) // // addition.rs // // Dans ce programme on va découv...
code_fim
hard
{ "lang": "rust", "repo": "darnuria/esgi-rust", "path": "/exo_revision/03-addition.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // indice: rustc addition.rs /* error[E0369]: binary operation `+` cannot be applied to type `char` --> 03-addition.rs:32:17 | 32 | let somme = '3' + 3; | ^^^^^^^ | = note: an implementation of `std::ops::Add` might be missing for `char` error: aborting due to...
code_fim
hard
{ "lang": "rust", "repo": "darnuria/esgi-rust", "path": "/exo_revision/03-addition.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> &self.0 } } #[doc = "Field `gain_ctrl10_gc_rbb1` writer - "] pub struct GAIN_CTRL10_GC_RBB1_W<'a> { w: &'a mut W, } impl<'a> GAIN_CTRL10_GC_RBB1_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w....
code_fim
hard
{ "lang": "rust", "repo": "username223/bl602-pac", "path": "/src/rf/rbb_gain_index3.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: username223/bl602-pac path: /src/rf/rbb_gain_index3.rs #[doc = "Register `rbb_gain_index3` reader"] pub struct R(crate::R<RBB_GAIN_INDEX3_SPEC>); impl core::ops::Deref for R { type Target = crate::R<RBB_GAIN_INDEX3_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &...
code_fim
hard
{ "lang": "rust", "repo": "username223/bl602-pac", "path": "/src/rf/rbb_gain_index3.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> &self.0 } } #[doc = "Field `gain_ctrl8_gc_rbb2` writer - "] pub struct GAIN_CTRL8_GC_RBB2_W<'a> { w: &'a mut W, } impl<'a> GAIN_CTRL8_GC_RBB2_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bit...
code_fim
hard
{ "lang": "rust", "repo": "username223/bl602-pac", "path": "/src/rf/rbb_gain_index3.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> let mut settings: SerialPortSettings = Default::default(); settings.baud_rate = baud_rate.into(); let mut port = serialport::open_with_settings(&port_name, &settings)?; let actual_baud_rate = port.baud_rate()?; if actual_baud_rate != baud_rate { panic!("Unable to achieve speci...
code_fim
medium
{ "lang": "rust", "repo": "iCodeIN/xenowing", "path": "/mimas_a7/test/ddr3/misc/ddr3-check/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iCodeIN/xenowing path: /mimas_a7/test/ddr3/misc/ddr3-check/src/main.rs use serialport::prelude::*; use std::env; use std::io; #[derive(Debug)] enum Error { SerialPort(serialport::Error), Io(io::Error), } impl From<serialport::Error> for Error { fn from(error: serialport::Error) ->...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/xenowing", "path": "/mimas_a7/test/ddr3/misc/ddr3-check/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut port = serialport::open_with_settings(&port_name, &settings)?; let actual_baud_rate = port.baud_rate()?; if actual_baud_rate != baud_rate { panic!("Unable to achieve specified baud rate: got {}, expected {}", actual_baud_rate, baud_rate); } loop { let write_cyc...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/xenowing", "path": "/mimas_a7/test/ddr3/misc/ddr3-check/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ebfe/rust-rosetta path: /src/fibonacci_word.rs // Implements http://rosettacode.org/wiki/Fibonacci_word extern crate collections; #[cfg(not(test))] use entropy::shannon_entropy; #[cfg(not(test))] use std::iter::range_inclusive; #[cfg(not(test))] mod entropy; // Returns "amount" fibonacci words...
code_fim
hard
{ "lang": "rust", "repo": "ebfe/rust-rosetta", "path": "/src/fibonacci_word.rs", "mode": "psm", "license": "LicenseRef-scancode-public-domain", "source": "the-stack-v2" }
<|fim_suffix|> // The rest of the words for _ in range_inclusive(3, amount) { let temp = next.clone(); next.push_str(previous.as_slice()); previous = temp; data.push((next.len(), shannon_entropy(next.as_slice()))); } data } #[cfg(not(test))] fn main() { println!("Cal...
code_fim
hard
{ "lang": "rust", "repo": "ebfe/rust-rosetta", "path": "/src/fibonacci_word.rs", "mode": "spm", "license": "LicenseRef-scancode-public-domain", "source": "the-stack-v2" }
<|fim_prefix|>// repo: taraka/epaperdisplay path: /src/epd/paint.rs use ::bresenham; use crate::epd::paint::DotPixel::*; use crate::epd::paint::DotStyle::*; use crate::epd::font::*; #[derive(PartialEq)] pub struct Image { pub(crate) image: ImageData, width: u16, height: u16, width_memory: u16, he...
code_fim
hard
{ "lang": "rust", "repo": "taraka/epaperdisplay", "path": "/src/epd/paint.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut offset = (c as u16 - ' ' as u16) * font.height * (font.width / 8 + (if font.width % 8 != 0 { 1 } else { 0 })); for page in 0..font.height { for column in 0..font.width { let data = match font.table.get(offset as usize) { Some(d) => ...
code_fim
hard
{ "lang": "rust", "repo": "taraka/epaperdisplay", "path": "/src/epd/paint.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return s; } #[cfg(test)] mod parse_tests { use super::*; use SExpr::*; /*---------------- parse tests ----------------*/ #[test] fn parses_int() { assert_eq!(parse("3"), vec![SInt(3)]); assert_eq!(parse("193755"), vec![SInt(193755)]); assert_eq!(parse("-...
code_fim
hard
{ "lang": "rust", "repo": "thomascastleman/s-parse", "path": "/src/parse.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: thomascastleman/s-parse path: /src/parse.rs use regex::Regex; #[derive(Debug)] #[derive(PartialEq)] pub enum SExpr<'a> { SInt(i32), SFloat(f32), SSym(&'a str), SStr(&'a str), SList(Vec<SExpr<'a>>) } #[derive(Debug)] #[derive(PartialEq)] struct ParseResult<'a> { parsed: ...
code_fim
hard
{ "lang": "rust", "repo": "thomascastleman/s-parse", "path": "/src/parse.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: thequux/qaraoke path: /ogk/examples/dump_ogg.rs extern crate ogk; use std::io::prelude::*; use std::io; fn hexdump(buf: &[u8]) -> String { buf.iter() .map(|x| format!("{:02x}", x)) .collect::<Vec<String>>() .join(" ") } struct DumpingBitstream(u32); impl ogk::ogg:...
code_fim
medium
{ "lang": "rust", "repo": "thequux/qaraoke", "path": "/ogk/examples/dump_ogg.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn process_packet(&mut self, header: &[u8], last_granule: u64) -> u64 { println!("{}@{}: {}", self.0, last_granule, hexdump(header)); last_granule + 1 } fn notice_gap(&mut self) { println!("{}@gap", self.0); } fn finish(&mut self) { println!("{}@end", s...
code_fim
medium
{ "lang": "rust", "repo": "thequux/qaraoke", "path": "/ogk/examples/dump_ogg.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: doytsujin/yew path: /tools/changelog/src/cli.rs use anyhow::{bail, Result}; use clap::Parser; use semver::Version; use crate::create_log_lines::create_log_lines; use crate::get_latest_version::get_latest_version; use crate::new_version_level::NewVersionLevel; use crate::stdout_tag_description_c...
code_fim
hard
{ "lang": "rust", "repo": "doytsujin/yew", "path": "/tools/changelog/src/cli.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Skip getting the next version #[clap(short = 'b', long)] pub skip_get_bump_version: bool, /// Github token #[clap(short = 't', long)] pub token: Option<String>, } impl Cli { pub fn run(self) -> Result<()> { let Cli { package, from, ...
code_fim
hard
{ "lang": "rust", "repo": "doytsujin/yew", "path": "/tools/changelog/src/cli.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> async fn interaction_create(&self, ctx: Context, interaction: Interaction) { let token = interaction.token.clone(); let id = interaction.id.0; let guild_id = interaction.guild_id.0; let response_url = format!( "https://discord.com/api/v8/interactions/{}/{}/c...
code_fim
hard
{ "lang": "rust", "repo": "deadshot465/torahiko", "path": "/src/event_handler/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async fn ready(&self, ctx: Context, data_about_bot: Ready) { log::info!( "{}#{} is now online.", &data_about_bot.user.name, data_about_bot.user.discriminator ); let presences = PRESENCES.get_or_init(|| { let raw_data = ...
code_fim
hard
{ "lang": "rust", "repo": "deadshot465/torahiko", "path": "/src/event_handler/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: deadshot465/torahiko path: /src/event_handler/mod.rs use crate::commands::*; use once_cell::sync::OnceCell; use rand::prelude::*; use serenity::model::prelude::{Activity, Interaction, Message, Ready}; use serenity::{async_trait, prelude::*}; use tokio::time::Duration; const PRESENCES_PATH: &str...
code_fim
hard
{ "lang": "rust", "repo": "deadshot465/torahiko", "path": "/src/event_handler/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn drop(&self, database_name: &str, collection_name: &str) -> Result<(), RepositoryError> { let client = self.connection_factory.get()?; client .db(database_name) .collection(collection_name) .drop()?; Ok(()) } }<|fim_prefix|>// repo: not...
code_fim
hard
{ "lang": "rust", "repo": "notomo/vimonga", "path": "/src/datastore/collection.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: notomo/vimonga path: /src/datastore/collection.rs use crate::domain::repository::{CollectionRepository, RepositoryError}; use super::connection::ConnectionFactory; <|fim_suffix|>impl<'a> CollectionRepository for CollectionRepositoryImpl<'a> { fn get_names(&self, database_name: &str) -> Res...
code_fim
medium
{ "lang": "rust", "repo": "notomo/vimonga", "path": "/src/datastore/collection.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fcard/AllStatTabs path: /gui/src/gui/view/settings.rs use crate::gui::*; use crate::gui::view::*; impl<'a, F: TextInputMsgFn, G: SliderMsgFn> ByteSettingRow<'a, F, G> { pub fn into_row(self) -> Row<'a, ASTMessage> { Row::new() .spacing(20) .push( Text::new(self.text) ....
code_fim
hard
{ "lang": "rust", "repo": "fcard/AllStatTabs", "path": "/gui/src/gui/view/settings.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn tab_checkbox_settings<'a>(settings: HackSettings) -> Column<'a, ASTMessage> { Column::new() .spacing(10) .padding(20) .align_items(Align::Center) .push( Row::new() .spacing(30) .push( settings_checkbox( "Better Tabs", settings.tabs.better_tabs, AS...
code_fim
hard
{ "lang": "rust", "repo": "fcard/AllStatTabs", "path": "/gui/src/gui/view/settings.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(target_os = "none")] #[no_mangle] pub unsafe extern "C" fn __aeabi_unwind_cpp_pr1() -> ! { loop {} } #[cfg(target_os = "none")] #[no_mangle] pub unsafe extern "C" fn __aeabi_memclr4(dest: *mut u32, n: usize) { let mut n = n; let mut dest = dest; while n != 0 { *dest = 0; ...
code_fim
medium
{ "lang": "rust", "repo": "kvark/bkernel", "path": "/stm32f4/lang_items.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(target_os = "none")] #[no_mangle] pub unsafe extern "C" fn memcmp(mut str1: *const u8, mut str2: *const u8, mut size: usize) -> i32 { while size != 0 { if *str1 < *str2 { return -1; } else if *str1 > *str2 { return 1; } str1 = str1.offset(...
code_fim
hard
{ "lang": "rust", "repo": "kvark/bkernel", "path": "/stm32f4/lang_items.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kvark/bkernel path: /stm32f4/lang_items.rs //! lang_items and functions needed to start Rust on bare metal. #[cfg(target_os = "none")] #[lang = "eh_personality"] extern fn eh_personality() {} <|fim_suffix|>#[cfg(target_os = "none")] #[no_mangle] pub unsafe extern "C" fn __aeabi_memclr4(dest: *...
code_fim
hard
{ "lang": "rust", "repo": "kvark/bkernel", "path": "/stm32f4/lang_items.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let input = parse_input(Cursor::new(DATA)).unwrap(); let result = part1(&input); assert_eq!(result, 24000); } #[test] fn test_part2() { let mut input = parse_input(Cursor::new(DATA)).unwrap(); println!("input: {:?}", input); let result = part2(&...
code_fim
hard
{ "lang": "rust", "repo": "opcode0x90/adventofcode", "path": "/2022-01/opcode0x90/src/main.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: opcode0x90/adventofcode path: /2022-01/opcode0x90/src/main.rs use std::collections::BinaryHeap; use std::error::Error; use std::io::{self, BufRead, BufReader, Read}; fn part1(input: &BinaryHeap<u32>) -> u32 { // input is always sorted in descending order *input.peek().unwrap() } fn par...
code_fim
hard
{ "lang": "rust", "repo": "opcode0x90/adventofcode", "path": "/2022-01/opcode0x90/src/main.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use std::io::Cursor; use super::*; const DATA: &str = r#"1000 2000 3000 4000 5000 6000 7000 8000 9000 10000"#; #[test] fn test_part1() { let input = parse_input(Cursor::new(DATA)).unwrap(); let result = part1(&input); assert_eq!(r...
code_fim
hard
{ "lang": "rust", "repo": "opcode0x90/adventofcode", "path": "/2022-01/opcode0x90/src/main.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>/* {"HANDLE_ERRORS", #if ENABLE_DEBUG_DATA "bt,freeze", #else "bt", #endif "Error handling mode. A combination of: 'bt' (print backtrace),\n" "'freeze' (freeze and wait for a debugger), 'debug' (attach debugger)", ucs_offsetof(ucs_global_opts_t, handle_errors), UCS_CONFIG_TYPE_BITMAP(ucs_hand...
code_fim
hard
{ "lang": "rust", "repo": "cnutshell/rust-ucx", "path": "/workspace/ucx/src/configuration/configuration_settings/ConfigurationSetting.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cnutshell/rust-ucx path: /workspace/ucx/src/configuration/configuration_settings/ConfigurationSetting.rs // This file is part of ucx. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/...
code_fim
hard
{ "lang": "rust", "repo": "cnutshell/rust-ucx", "path": "/workspace/ucx/src/configuration/configuration_settings/ConfigurationSetting.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// Trait collections::fmt::Binary pub static TRAIT_SNIPPET: &'static str = r##" <section id="main" class="content trait"> <h1 class="fqn"> <span class="in-band">Trait <a href="../index.html">collections</a>::<wbr><a href="index-2.html">fmt</a>::<wbr><a class="trait" href="#">Binary</a></span> ...
code_fim
hard
{ "lang": "rust", "repo": "jaysonsantos/rsdocs2docset", "path": "/src/dom/fixtures.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }