text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> // spi setup let mut gpioa = dp.GPIOA.split(&mut rcc.apb2); let sck = gpioa.pa5.into_alternate_push_pull(&mut gpioa.crl); let miso = gpioa.pa6; let mosi = gpioa.pa7.into_alternate_push_pull(&mut gpioa.crl); let mut cs_max7219 = gpioa.pa4.into_push_pull_output(&mut gpioa.crl); l...
code_fim
hard
{ "lang": "rust", "repo": "anriha/led-display-websocket-demo", "path": "/led-display-hardware-ssl/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// W5500 ethernet card with CS pin PA2 type W5500Physical = W5500<PA2<Output<PushPull>>>; // the CS output pin on stm32f1xx_hal is Infallible type W5500Error = w5500::Error<SpiError, Infallible>; #[panic_handler] fn panic(info: &core::panic::PanicInfo) -> ! { rprintln!("{}", info); loop { ...
code_fim
hard
{ "lang": "rust", "repo": "anriha/led-display-websocket-demo", "path": "/led-display-hardware-ssl/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: anriha/led-display-websocket-demo path: /led-display-hardware-ssl/src/main.rs #![no_std] #![no_main] //#![allow(warnings)] #[macro_use] extern crate rtt_target; mod bearssl; mod ssl; use core::{cell::RefCell, convert::Infallible}; use cortex_m::asm; use cortex_m_rt::entry; use display::{LedPa...
code_fim
hard
{ "lang": "rust", "repo": "anriha/led-display-websocket-demo", "path": "/led-display-hardware-ssl/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn direction(&self) -> Dir { self.b } pub fn time(&self) -> Float { self.time } pub fn point_at(&self, t: Float) -> Pos { self.a + t * self.b } }<|fim_prefix|>// repo: fredZen/path-tracer path: /src/ray.rs use crate::prelude::*; #[derive(Clone, Debug...
code_fim
easy
{ "lang": "rust", "repo": "fredZen/path-tracer", "path": "/src/ray.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fredZen/path-tracer path: /src/ray.rs use crate::prelude::*; #[derive(Clone, Debug, PartialEq)] pub struct Ray { a: Pos, b: Dir, time: Float, } <|fim_suffix|> pub fn time(&self) -> Float { self.time } pub fn point_at(&self, t: Float) -> Pos { self.a + t ...
code_fim
hard
{ "lang": "rust", "repo": "fredZen/path-tracer", "path": "/src/ray.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ng3rdstmadgke/midomoji-clone path: /src/util.rs use std::time::{Duration, Instant}; pub struct Timer { instant: Option<Instant>, duration: Duration } <|fim_suffix|> pub fn reset(&mut self) { self.instant = None; self.duration = Duration::new(0, 0); } pub fn ...
code_fim
hard
{ "lang": "rust", "repo": "ng3rdstmadgke/midomoji-clone", "path": "/src/util.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn reset(&mut self) { self.instant = None; self.duration = Duration::new(0, 0); } pub fn print(&self) { println!("{:?}", self.duration) } }<|fim_prefix|>// repo: ng3rdstmadgke/midomoji-clone path: /src/util.rs use std::time::{Duration, Instant}; pub struct Ti...
code_fim
hard
{ "lang": "rust", "repo": "ng3rdstmadgke/midomoji-clone", "path": "/src/util.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let packets: Vec<&[u8]> = data.chunks(chunk_size).collect(); for packet_id in 0..packets.len() { let has_more_packets = packet_id != packets.len() - 1; self.send_packet(packets[packet_id], packet_id, has_more_packets)?; if has_more_packets { ...
code_fim
hard
{ "lang": "rust", "repo": "slysherz/polar-send-training", "path": "/src/polar_watch/polar_usb.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: slysherz/polar-send-training path: /src/polar_watch/polar_usb.rs extern crate rusb; pub mod polar_error; pub type Device = rusb::Device<rusb::Context>; pub type DeviceHandle = rusb::DeviceHandle<rusb::Context>; #[allow(unused_imports)] use log::{debug, info}; use std::convert::TryFrom;...
code_fim
hard
{ "lang": "rust", "repo": "slysherz/polar-send-training", "path": "/src/polar_watch/polar_usb.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let res = match msg { OwnedMessage::Ping(p) => { tx.borrow_mut() .unbounded_send(ChatMessage::ToHost(OwnedMessage::Pong(p))) } OwnedMessage::Text(t) => { let cap = ROOM_MSG_RE.captures(&t[..]).unwrap(); ...
code_fim
hard
{ "lang": "rust", "repo": "rajasekharponakala/admichat", "path": "/src/main.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> let mux = write_fut.map(|_| ()).select(read_fut.map(|_| ())); mux.then(|_| Ok(())) }) .then(|_| Ok(())); handle.spawn(f); } fn run_server(conf: Settings) -> Result<(), Box<Error>> { let ws_addr = conf.server.ws_addr.clone();...
code_fim
hard
{ "lang": "rust", "repo": "rajasekharponakala/admichat", "path": "/src/main.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rajasekharponakala/admichat path: /src/main.rs extern crate config; extern crate websocket; extern crate futures; extern crate ex_futures; extern crate tokio_core; extern crate hyper; #[macro_use] extern crate lazy_static; extern crate regex; extern crate reqwest; use std::error::Error; use web...
code_fim
hard
{ "lang": "rust", "repo": "rajasekharponakala/admichat", "path": "/src/main.rs", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: XOSplicer/comment-strip path: /src/shell.rs use super::{CommentMatch, Start, End, find_comments_impl}; #[derive(Debug, Clone, Copy, PartialEq, Eq)] enum ParseState { Start, Normal, ShebangOrComment, Shebang, Comment, StringDoubleQuotes, StringDoubleQuotesEscaped, ...
code_fim
hard
{ "lang": "rust", "repo": "XOSplicer/comment-strip", "path": "/src/shell.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn multiple_comments() { let input = "yes # line comment\n# another comment with \"string\"\n yes no\n"; let expected = Ok(vec![ CommentMatch { from: 4, to: 18 }, CommentMatch { from: 19, to: 50 } ]); let actual = find_comments(input)...
code_fim
hard
{ "lang": "rust", "repo": "XOSplicer/comment-strip", "path": "/src/shell.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chaowlert/mirror-contracts path: /contracts/mirror_gov/src/migrate.rs use cosmwasm_std::{Order, StdError, StdResult, Storage}; use cosmwasm_storage::Bucket; use mirror_protocol::gov::PollStatus; use std::convert::TryInto; static PREFIX_POLL_INDEXER_OLD: &[u8] = b"poll_voter"; static PREFIX_PO...
code_fim
hard
{ "lang": "rust", "repo": "chaowlert/mirror-contracts", "path": "/contracts/mirror_gov/src/migrate.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!( poll_indexer_store(&mut deps.storage, &PollStatus::InProgress) .load(&1u64.to_be_bytes()) .unwrap(), true ); assert_eq!( poll_indexer_store(&mut deps.storage, &PollStatus::Executed) .lo...
code_fim
hard
{ "lang": "rust", "repo": "chaowlert/mirror-contracts", "path": "/contracts/mirror_gov/src/migrate.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut deps = mock_dependencies(20, &[]); poll_indexer_old_store(&mut deps.storage, &PollStatus::InProgress) .save(&1u64.to_be_bytes(), &true) .unwrap(); poll_indexer_old_store(&mut deps.storage, &PollStatus::Executed) .save(&2u64.to_be_bytes()...
code_fim
hard
{ "lang": "rust", "repo": "chaowlert/mirror-contracts", "path": "/contracts/mirror_gov/src/migrate.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ilya-epifanov/heim path: /heim-net/src/sys/windows/nic.rs use heim_common::prelude::*; use std::net::Ipv4Addr; use std::net::Ipv6Addr; use std::net::SocketAddrV4; use std::net::SocketAddrV6; use std::ffi::CStr; use widestring::UCStr; use winapi::shared::ifdef::IfOperStatusUp; use winapi::shar...
code_fim
hard
{ "lang": "rust", "repo": "ilya-epifanov/heim", "path": "/heim-net/src/sys/windows/nic.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn is_multicast(&self) -> bool { match self.address { Some(Address::Inet(sa)) => sa.ip().is_multicast(), Some(Address::Inet6(sa6)) => sa6.ip().is_multicast(), _ => false, } } } pub async fn nic() -> Result<impl Stream<Item = Result<Nic>> + S...
code_fim
hard
{ "lang": "rust", "repo": "ilya-epifanov/heim", "path": "/heim-net/src/sys/windows/nic.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _ => unreachable!() } } } _ => unreachable!() } } worker_handler.join().unwrap()?; println!("total_event_counter: {}, token_event_counter: {}", total_event_counter, token_event_counter); Ok(()) }<|...
code_fim
hard
{ "lang": "rust", "repo": "rarpainting/async-io-demo", "path": "/examples/spurious-events.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rarpainting/async-io-demo path: /examples/spurious-events.rs use mio::*; use std::time::Duration; use crossbeam_channel::unbounded; use std::io; use failure::Error; const TOKEN: Token = Token(0); fn main() -> Result<(), Error> { let poll = Poll::new()?; let (registration, set_readiness...
code_fim
hard
{ "lang": "rust", "repo": "rarpainting/async-io-demo", "path": "/examples/spurious-events.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-graphics/rust-graphics-android path: /src/glue.rs use { super::activity, super::config, super::input, super::looper, super::rect, super::window, crate::libc, std::os::raw::{c_int, c_void}, }; #[cfg(feature = "verbose-log")] use crate::log_i; <|fim_suffix|> ...
code_fim
hard
{ "lang": "rust", "repo": "rust-graphics/rust-graphics-android", "path": "/src/glue.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(feature = "verbose-log")] impl Drop for AndroidApp { fn drop(&mut self) { log_i!("AndroidApp droped."); } } #[repr(i32)] pub enum LooperId { Main = 1, Input = 2, User = 3, } #[repr(i32)] #[cfg_attr(feature = "debug-derive", derive(Debug))] pub enum AppCmd { InputCha...
code_fim
hard
{ "lang": "rust", "repo": "rust-graphics/rust-graphics-android", "path": "/src/glue.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[repr(i32)] pub enum LooperId { Main = 1, Input = 2, User = 3, } #[repr(i32)] #[cfg_attr(feature = "debug-derive", derive(Debug))] pub enum AppCmd { InputChanged, InitWindow, TermWindow, WindowResized, WindowRedrawNeeded, ContentRectChanged, GainedFocus, LostF...
code_fim
hard
{ "lang": "rust", "repo": "rust-graphics/rust-graphics-android", "path": "/src/glue.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: darobs/iotedge path: /edgelet/iotedge-diagnostics/src/main.rs // Copyright (c) Microsoft. All rights reserved. #![deny(rust_2018_idioms, warnings)] #![deny(clippy::all, clippy::pedantic)] #![allow(clippy::too_many_lines, clippy::use_self)] #[macro_use] extern crate clap; use std::net::{TcpStre...
code_fim
hard
{ "lang": "rust", "repo": "darobs/iotedge", "path": "/edgelet/iotedge-diagnostics/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let _ = TcpStream::connect_timeout(&iothub_host, std::time::Duration::from_secs(10)) .map_err(|err| format!("could not connect to IoT Hub: {}", err))?; } ("local-time", _) => { println!( "{}", std::time::SystemTime::n...
code_fim
hard
{ "lang": "rust", "repo": "darobs/iotedge", "path": "/edgelet/iotedge-diagnostics/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>in packybara that will return the // platforms installed for a given distribution at a given location // and we will need to add site into the GetDistPlatforms let results = match db.find_all_platforms().query() { Ok(dists) => dists, Err(...
code_fim
hard
{ "lang": "rust", "repo": "jlgerber/pbgui", "path": "/pbgui/src/messaging/thread/packages_tree.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jlgerber/pbgui path: /pbgui/src/messaging/thread/packages_tree.rs use super::*; // filter using is any fn is_not_any(item: &str) -> Option<&str> { if item == "any" { None } else { Some(item) } } /// perform a submatch against the OVpinDialog msg pub(crate) fn match_...
code_fim
hard
{ "lang": "rust", "repo": "jlgerber/pbgui", "path": "/pbgui/src/messaging/thread/packages_tree.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match pair.as_rule() { Rule::word => Token::from_word(pair.as_str().to_string()), Rule::alpha => Token::Alpha(pair.as_str().chars().next().unwrap()), Rule::digit => Token::Digit(pair.as_str().parse::<u8>().unwrap()), Rule::underscore => Token::Unders...
code_fim
hard
{ "lang": "rust", "repo": "pat2381/HEMTT", "path": "/hemtt-arma-config/src/preprocess/token/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pat2381/HEMTT path: /hemtt-arma-config/src/preprocess/token/mod.rs #[derive(Parser)] #[grammar = "preprocess/token/token.pest"] pub struct PreProcessParser; mod keyword; pub use keyword::Keyword; mod token_pos; pub use token_pos::TokenPos; mod whitespace; pub use whitespace::Whitespace; #[allo...
code_fim
hard
{ "lang": "rust", "repo": "pat2381/HEMTT", "path": "/hemtt-arma-config/src/preprocess/token/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>extern "C" { fn asm_execute_process(sp: *mut u8, regs: &mut [u32; 8]) -> *mut u8; } impl<'a> Process<'a> { pub fn create(entry: u32, sp: u32, regs: &'a mut [u32; 8]) -> Process { let base_frame_ptr = (sp - 0x20) as *mut u32; let base_frame = unsafe { from_raw_parts_mut(base_frame_...
code_fim
medium
{ "lang": "rust", "repo": "garasubo/erkos", "path": "/kernel/src/process.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: garasubo/erkos path: /kernel/src/process.rs use core::slice::from_raw_parts_mut; use util::linked_list::LinkedList; #[derive(PartialEq)] pub enum ProcessState { READY, RUNNING, WAITING, DORMANT, } pub struct Process<'a> { pub sp: *mut u8, pub regs: &'a mut [u32; 8], ...
code_fim
medium
{ "lang": "rust", "repo": "garasubo/erkos", "path": "/kernel/src/process.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Lapin0t/awari path: /src/awari.rs use std::ops::{Deref,DerefMut}; use std::iter::Iterator; use std::fmt; use std::cmp::min; use {SEEDS,START_SEEDS,PITS,FPITS}; use utils::{binom,divmod,n_boards,enc_min}; /// Representation of an awari board configuration. #[derive(Copy, Clone, Eq, PartialEq)]...
code_fim
hard
{ "lang": "rust", "repo": "Lapin0t/awari", "path": "/src/awari.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use test::{black_box,Bencher}; use rand::{Rng,thread_rng}; use quickcheck::{Arbitrary,Gen,StdGen}; use {FPITS,SEEDS,NBOARDS}; use super::Awari; impl Arbitrary for Awari { fn arbitrary<G: Gen>(g: &mut G) -> Awari { let mut b: Awari...
code_fim
hard
{ "lang": "rust", "repo": "Lapin0t/awari", "path": "/src/awari.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: qiongtubao/rust-redis path: /src/old6.rs //mio ={version = "0.6.21"} use mio::{Events, Poll, Token,Ready}; fn main() { let mut event_loop = EventLoop::new().unwrap(); let channel_sender = event_loop.channel(); thread::spawn(move || { while(true) { channel_sender.s...
code_fim
hard
{ "lang": "rust", "repo": "qiongtubao/rust-redis", "path": "/src/old6.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> } fn notify(&mut self, event_loop: &mut EventLoop<Self>, msg: Self::Message) { match msg { IoMessage::Notify => { println!("channel notify"); } IoMessage::End => { event_loop.shutdown(); } } } ...
code_fim
hard
{ "lang": "rust", "repo": "qiongtubao/rust-redis", "path": "/src/old6.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match msg { IoMessage::Notify => { println!("channel notify"); } IoMessage::End => { event_loop.shutdown(); } } } fn timeout(&mut self, event_loop: &mut EventLoop<Self>, timeout: Self::Timeout) { ...
code_fim
medium
{ "lang": "rust", "repo": "qiongtubao/rust-redis", "path": "/src/old6.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|><u32>, } #[doc = "Code memory page size"] pub mod codepagesize; #[doc = "Code memory size"] pub struct CODESIZE { register: ::vcell::VolatileCell<u32>, } #[doc = "Code memory size"] pub mod codesize; #[doc = "Device type"] pub struct DEVICETYPE { register: ::vcell::VolatileCell<u32>, } #[doc = "De...
code_fim
hard
{ "lang": "rust", "repo": "FrozenDroid/nrf91-rs", "path": "/src/ficr_s/info.rs", "mode": "spm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_prefix|>// repo: FrozenDroid/nrf91-rs path: /src/ficr_s/info.rs #[doc = "Description collection: Device identifier"] pub struct DEVICEID { register: ::vcell::VolatileCell<u32>, } #[doc = "Description collection: Device identifier"] pub mod deviceid; #[doc = "Part code"] pub struct PART { register: ::vcel...
code_fim
hard
{ "lang": "rust", "repo": "FrozenDroid/nrf91-rs", "path": "/src/ficr_s/info.rs", "mode": "psm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JosephCatrambone/CalorieCounter path: /src/lib.rs use bzip2::{Compression, read::{BzEncoder, BzDecoder}}; use hashbrown::HashMap; use serde::{Deserialize, Serialize}; use std::fs::File; use std::io::{BufReader, Read, Result, prelude::*}; mod food; mod meal; mod nutrition; mod search; pub use ...
code_fim
hard
{ "lang": "rust", "repo": "JosephCatrambone/CalorieCounter", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if food_ref.is_none() { return false; } let nutrition = food_ref.unwrap().get_nutrition(quantity); let mut meal_ref = self.get_meal_mut_from_id(meal); // If we can't find the food or meal, abort. if let Some(m) = meal_ref { m.nutrients.calories += nutrition.calories; m.nutrients.pr...
code_fim
hard
{ "lang": "rust", "repo": "JosephCatrambone/CalorieCounter", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut db = FoodDB::new(); let new_food_id = db.new_food(); //println!("New food id: {}", new_food_id); db.save("empty.fdb"); let db2 = FoodDB::open("empty.fdb").unwrap(); } #[test] fn make_single_entry_food_db() { let mut db = FoodDB::new(); { let mut food = db.new_food(); food.n...
code_fim
hard
{ "lang": "rust", "repo": "JosephCatrambone/CalorieCounter", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.bounding_sphere(m) } }<|fim_prefix|>// repo: mkubala/ncollide path: /ncollide_geometry/bounding_volume/bounding_sphere_shape.rs use bounding_volume::{HasBoundingVolume, BoundingSphere}; use math::{Point, Isometry}; use shape::Shape; <|fim_middle|> impl<P: Point, M: Isometry<P>> HasBound...
code_fim
medium
{ "lang": "rust", "repo": "mkubala/ncollide", "path": "/ncollide_geometry/bounding_volume/bounding_sphere_shape.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mkubala/ncollide path: /ncollide_geometry/bounding_volume/bounding_sphere_shape.rs use bounding_volume::{HasBoundingVolume, BoundingSphere}; use math::{Point, Isometry}; use shape::Shape; <|fim_suffix|> self.bounding_sphere(m) } }<|fim_middle|> impl<P: Point, M: Isometry<P>> HasBound...
code_fim
medium
{ "lang": "rust", "repo": "mkubala/ncollide", "path": "/ncollide_geometry/bounding_volume/bounding_sphere_shape.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Ralakus/beagle-lang path: /ir/src/type_signature.rs use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub enum TypeSignature { None, Untyped, Primitive(PrimitiveType), } impl TypeSignature { #[inline] pub fn is_integer(&self) -> bool { ...
code_fim
hard
{ "lang": "rust", "repo": "Ralakus/beagle-lang", "path": "/ir/src/type_signature.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl PrimitiveType { pub fn new(type_string: &str) -> Self { match type_string { "Int" => Self::Integer, "Float" => Self::Float, "Bool" => Self::Bool, &_ => Self::None, } } }<|fim_prefix|>// repo: Ralakus/beagle-lang path: /ir/src/ty...
code_fim
hard
{ "lang": "rust", "repo": "Ralakus/beagle-lang", "path": "/ir/src/type_signature.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MDGSF/JustCoding path: /rust-leetcode/leetcode_515/src/solution2.rs // Definition for a binary tree node. // #[derive(Debug, PartialEq, Eq)] // pub struct TreeNode { // pub val: i32, // pub left: Option<Rc<RefCell<TreeNode>>>, // pub right: Option<Rc<RefCell<TreeNode>>>, // } // // impl Tr...
code_fim
medium
{ "lang": "rust", "repo": "MDGSF/JustCoding", "path": "/rust-leetcode/leetcode_515/src/solution2.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// Definition for a binary tree node. #[derive(Debug, PartialEq, Eq)] pub struct TreeNode { pub val: i32, pub left: Option<Rc<RefCell<TreeNode>>>, pub right: Option<Rc<RefCell<TreeNode>>>, } impl TreeNode { #[inline] pub fn new(val: i32) -> Self { TreeNode { val, left: None, ...
code_fim
medium
{ "lang": "rust", "repo": "MDGSF/JustCoding", "path": "/rust-leetcode/leetcode_515/src/solution2.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mnts26/aws-sdk-rust path: /sdk/applicationautoscaling/src/operation_deser.rs ScalableTargetError::unhandled( generic, )) } }; let _error_message = generic.message().map(|msg| msg.to_owned()); Err(match error_code { "ConcurrentUpdateExcepti...
code_fim
hard
{ "lang": "rust", "repo": "mnts26/aws-sdk-rust", "path": "/sdk/applicationautoscaling/src/operation_deser.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mnts26/aws-sdk-rust path: /sdk/applicationautoscaling/src/operation_deser.rs urn Err(crate::error::DeleteScheduledActionError::unhandled(generic)), }; let _error_message = generic.message().map(|msg| msg.to_owned()); Err(match error_code { "ConcurrentUpdateException" => crat...
code_fim
hard
{ "lang": "rust", "repo": "mnts26/aws-sdk-rust", "path": "/sdk/applicationautoscaling/src/operation_deser.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: winterthediplomat/hrm-interpreter path: /src/operators/bump.rs use operators::Operator; use state::InternalState; use Value; use Location; enum Error { PointerCellContainsChar, NoValue{cell: Location}, BumpChar{value: char} } struct BumpOp {} impl BumpOp { fn explain_error(error: Error) -...
code_fim
hard
{ "lang": "rust", "repo": "winterthediplomat/hrm-interpreter", "path": "/src/operators/bump.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Operator for BumpMinusOp { fn changes_instruction_counter(&self) -> bool { false } fn apply_to(&self, s: &mut InternalState) -> Result<(), String> { let memory_position = match self.cell { Location::Cell(mempos) => Ok(mempos), Location::Address(mempos) => { let value_from_memory = s.me...
code_fim
hard
{ "lang": "rust", "repo": "winterthediplomat/hrm-interpreter", "path": "/src/operators/bump.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sile/miasht path: /examples/wss_srv.rs extern crate base64; extern crate clap; extern crate fibers; extern crate futures; extern crate handy_async; extern crate miasht; extern crate sha1; #[macro_use] extern crate trackable; use fibers::{Executor, Spawn, ThreadPoolExecutor}; use futures::{BoxFu...
code_fim
hard
{ "lang": "rust", "repo": "sile/miasht", "path": "/examples/wss_srv.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn handle_put(_: (), request: TcpRequest) -> Result<BoxFuture<(), ()>, TcpRequest> { if miasht::Method::Put != request.method() { return Err(request); } Ok(request .into_body_reader() .into_future() .and_then(|r| r.read_all_bytes()) .map_err(|e| { ...
code_fim
hard
{ "lang": "rust", "repo": "sile/miasht", "path": "/examples/wss_srv.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut builder = RouteBuilder::new(); builder.add_callback((), handle_get_file); builder.add_callback((), handle_put); builder.add_callback((), handle_upgrade); builder.add_callback((), handle_default); let router = builder.finish(); let mut executor = ThreadPoolExecutor::new...
code_fim
hard
{ "lang": "rust", "repo": "sile/miasht", "path": "/examples/wss_srv.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mpietrzak/cashlog path: /src/tmpl/common.rs use maud; use maud::html; use maud::Markup; use maud::PreEscaped; pub fn tmpl_base(title: &str, content: Markup) -> Markup { html! { (maud::DOCTYPE) html { (tmpl_head(title)) body { (tmpl_men...
code_fim
hard
{ "lang": "rust", "repo": "mpietrzak/cashlog", "path": "/src/tmpl/common.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> table.form > tbody > tr > td { padding: 1pt 2pt 1pt 0pt; } table.form > tbody > tr > td.error { font-size: 90%; color: red; }" )) } } } fn tmpl_head(title: ...
code_fim
hard
{ "lang": "rust", "repo": "mpietrzak/cashlog", "path": "/src/tmpl/common.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wangchao0502/rust-leetcode path: /src/p877_stone_game.rs #![allow(dead_code)] // use mods pub struct Solution {} // problem description // 亚历克斯和李用几堆石子在做游戏。偶数堆石子排成一行,每堆都有正整数颗石子 piles[i] 。 // 游戏以谁手中的石子最多来决出胜负。石子的总数是奇数,所以没有平局。 // 亚历克斯和李轮流进行,亚历克斯先开始。 每回合,玩家从行的开始或结束处取走整堆石头。 // 这种情况一直持续到没有更多的石子堆为止,...
code_fim
medium
{ "lang": "rust", "repo": "wangchao0502/rust-leetcode", "path": "/src/p877_stone_game.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i in (0..len - 1).rev() { for j in i + 1..len { dp[i][j] = (piles[i] - dp[i + 1][j]).max(piles[j] - dp[i][j - 1]); } } dp[0][len - 1] > 0 } } #[cfg(test)] mod tests { use super::*; #[test] fn p877_stone_game_t1() { ...
code_fim
hard
{ "lang": "rust", "repo": "wangchao0502/rust-leetcode", "path": "/src/p877_stone_game.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AKST/finite-repr path: /finite-repr-derive/src/codegen/field_codegen.rs use proc_macro2::{Ident, Span, TokenStream}; use quote::quote; use syn::{DataStruct, Fields, Type, Variant}; /** * Meta data associated with fieldset, along with codegen * methods for these types. */ pub enum FieldCodege...
code_fim
hard
{ "lang": "rust", "repo": "AKST/finite-repr", "path": "/finite-repr-derive/src/codegen/field_codegen.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match self { FieldCodegen::Fieldless => ( quote! {}, quote! {}, Some(quote! { #value == #generic_type::MIN }), ), FieldCodegen::Product(fields) => { let mut iter = fields.iter().enumerate().map(|(i, t)| { let name = anon_ident(i); (...
code_fim
hard
{ "lang": "rust", "repo": "AKST/finite-repr", "path": "/finite-repr-derive/src/codegen/field_codegen.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: popcorn-rs/popcorn path: /src/vault.rs //! Provides a synchronization primitive for a shared //! data structure which can be acquired and released at a later time. //! Unlike an `std::sync::RwLock`, the guard does not have //! an explicit lifetime associated with the locked data. This means //! ...
code_fim
hard
{ "lang": "rust", "repo": "popcorn-rs/popcorn", "path": "/src/vault.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut lock = self.inner.lock.lock(); if !lock.locked { lock.locked = true; Ok(VaultAcquired { inner: self.inner.clone() }.into()) } else { let task = task::park(); lock.waiting.push(task); Ok(Async::NotReady) } } } impl<T> Deref for VaultAc...
code_fim
hard
{ "lang": "rust", "repo": "popcorn-rs/popcorn", "path": "/src/vault.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut data: ErrorData = self.0; ErrorData::chain(&mut data, error_code.into(), $idx); Error(data, PhantomData) } } impl<C: ErrorCategory> ChainError<C, (marker::$t, marker::Concrete_t)> for C::$t { ...
code_fim
hard
{ "lang": "rust", "repo": "N3xed/embedded-error-chain", "path": "/src/error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>macro_rules! impl_chain_error { ($([$t:ident, $idx:literal]),*) => { $( impl<C: ErrorCategory> ChainError<C, (marker::$t, marker::Error_t)> for Error<C::$t> { #[inline(always)] fn chain(self, error_code: C) -> Error<C> { let mut d...
code_fim
hard
{ "lang": "rust", "repo": "N3xed/embedded-error-chain", "path": "/src/error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: N3xed/embedded-error-chain path: /src/error.rs use crate::{ error_category::{self, ErrorCodeFormatter}, error_data::ErrorDataChainIter, marker, DynError, ErrorCategory, ErrorCategoryHandle, ErrorCode, ErrorData, ERROR_CHAIN_LEN, }; use core::marker::PhantomData; use core::{ fmt::...
code_fim
hard
{ "lang": "rust", "repo": "N3xed/embedded-error-chain", "path": "/src/error.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Santhoshkumar-p/inc path: /rs/src/lang.rs isite for any program analysis. Each [String] in the source program is replaced with a fully qualified, globally unique [Ident] and the type change from [Expr]<[String]> to [Expr]<[Ident]> conveys the basic idea. * Top level definitions `(define pi 3.14...
code_fim
hard
{ "lang": "rust", "repo": "Santhoshkumar-p/inc", "path": "/rs/src/lang.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Santhoshkumar-p/inc path: /rs/src/lang.rs ::expr(s), |n| Expr::Identifier(n.clone())) } Let { bindings, body } => { let base = base.extend(format!("{{let {}}}", index)); // Collect all the names about to be bound for evaluating body let mut al...
code_fim
hard
{ "lang": "rust", "repo": "Santhoshkumar-p/inc", "path": "/rs/src/lang.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Define { name, val } => Define { name: Ident::new(name), val: box mock(*val) }, Vector(list) => Vector(list.into_iter().map(mock).collect()), // All literals and constants evaluate to itself Literal(v) => Literal(v), } } #[test] fn nes...
code_fim
hard
{ "lang": "rust", "repo": "Santhoshkumar-p/inc", "path": "/rs/src/lang.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: v1nam/antsim path: /src/main.rs use macroquad::prelude::*; use macroquad::rand::gen_range; use std::collections::{HashMap, HashSet}; fn window_conf() -> Conf { Conf { window_title: "Ant Simulation".to_owned(), window_width: 950, window_height: 650, ..Default:...
code_fim
hard
{ "lang": "rust", "repo": "v1nam/antsim", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[macroquad::main(window_conf)] async fn main() { let mut ants: Vec<Ant> = Vec::new(); let mut food_pos: HashSet<(u32, u32)> = HashSet::new(); let mut home_pheromones: HashMap<(u32, u32), f32> = HashMap::new(); let mut food_pheromones: HashMap<(u32, u32), f32> = HashMap::new(); let st...
code_fim
hard
{ "lang": "rust", "repo": "v1nam/antsim", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dominikrosser/m183_jwt_secure_user_management path: /api/src/routes.rs use crate::db::Conn as DbConn; use crate::models::{User, NewUser}; use crate::pw_hashing; use crate::jwt_impl; use ::rocket_contrib::json::Json; use ::rocket_contrib::json::JsonValue; use ::rocket::request::Form; use ::rocket...
code_fim
hard
{ "lang": "rust", "repo": "dominikrosser/m183_jwt_secure_user_management", "path": "/api/src/routes.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// } else { // // Deny access // json!({ // "status": 404, // "result": "[]" // }) // } // } // #[delete("/users/<id>")] // pub fn delete_user(id: i32, conn: DbConn, cookies: Cookies) -> JsonValue { // let has_access = jwt_impl::has_access(&cook...
code_fim
hard
{ "lang": "rust", "repo": "dominikrosser/m183_jwt_secure_user_management", "path": "/api/src/routes.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ringo-apo/rust_gtk-rs_SQLite path: /src/main.rs extern crate diesel; extern crate sample_proj; extern crate gio; extern crate gtk; use self::diesel::prelude::*; use self::sample_proj::*; use self::models::*; use gio::prelude::*; use gtk::prelude::*; use std::env::args; use std::rc::Rc; #[de...
code_fim
hard
{ "lang": "rust", "repo": "ringo-apo/rust_gtk-rs_SQLite", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for (d_idx, d) in data.iter().enumerate() { let values: [&dyn ToValue; 2] = [ &d.number, &d.severity, ]; store.set(&store.append(), &col_indices, &values); } store } fn add_columns(model: &Rc<gtk::ListStore>, treeview: &gtk::TreeView) { {...
code_fim
hard
{ "lang": "rust", "repo": "ringo-apo/rust_gtk-rs_SQLite", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mgeist/bevy-network-prototype path: /src/server.rs use bevy::prelude::*; use bevy_networking_turbulence::{NetworkEvent, NetworkResource}; use serde::{Deserialize, Serialize}; use crate::{client::ClientMessage, MOVEMENT_SPEED, SERVER_TIME_STEP}; use crate::{ControllingHandle, PlayerMovement}; #...
code_fim
hard
{ "lang": "rust", "repo": "mgeist/bevy-network-prototype", "path": "/src/server.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for (entity, movement, transform) in player_query.iter() { message .players .push((entity.id(), movement.0, transform.translation)) } net.broadcast_message(message); } pub fn compute_movement(mut player_query: Query<(&PlayerMovement, &mut Transform)>) { fo...
code_fim
hard
{ "lang": "rust", "repo": "mgeist/bevy-network-prototype", "path": "/src/server.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> lines_read = 0; parse_file(pagelinks_in_filename, |pagelink| { if let Some(id) = page_map.get(&pagelink.name) { let link = PageLink { from: pagelink.id, to: *id, }; pagelinks_wtr.serialize(link).unwrap(); } print_values_read_for_debug(&mut lines_read); }...
code_fim
hard
{ "lang": "rust", "repo": "jehna/wikigolf", "path": "/converter/rust-converter/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jehna/wikigolf path: /converter/rust-converter/src/main.rs extern crate nom; use csv::WriterBuilder; use nom::{ branch::alt, bytes::complete::{escaped_transform, is_not, tag, take_till}, character::complete::{anychar, char, digit1}, combinator::{map, map_res}, multi::{many1, many_till...
code_fim
hard
{ "lang": "rust", "repo": "jehna/wikigolf", "path": "/converter/rust-converter/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for line in reader.lines() { match line { Err(e) => { eprintln!("Error in line reading: {:?}", e); } Ok(single_line) => { let (_, results) = parse_sql_file(&*single_line).unwrap_or(("", Vec::new())); for result in results { if let Some(page) = res...
code_fim
hard
{ "lang": "rust", "repo": "jehna/wikigolf", "path": "/converter/rust-converter/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lfdominguez/elastic path: /src/queries/src/error.rs error_chain! { // foreign_links { // AddrParseError(::std::net::AddrParseError); // ParseIntError(::std::num::ParseIntError); // } <|fim_suffix|> UnknownOperator(v: String) { des...
code_fim
hard
{ "lang": "rust", "repo": "lfdominguez/elastic", "path": "/src/queries/src/error.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> UnknownOperator(v: String) { description("unknown operator"), // note the , display("unknown operator: '{}'", v), // trailing comma is allowed } } }<|fim_prefix|>// repo: lfdominguez/elastic path: /src/queries/src/error.rs error_chain!...
code_fim
hard
{ "lang": "rust", "repo": "lfdominguez/elastic", "path": "/src/queries/src/error.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[error("Output not found in transaction outputs.")] OutputNotFound, #[error("DbcId is not unique across all transaction outputs.")] DbcIdNotUniqueAcrossOutputs, #[error( "The number of SignedSpend ({current}) does not match the number of inputs ({expected})." )] Sign...
code_fim
hard
{ "lang": "rust", "repo": "maidsafe/sn_dbc", "path": "/src/error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: maidsafe/sn_dbc path: /src/error.rs // Copyright 2023 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under The General Public License (GPL), version 3. // Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed // under the GPL ...
code_fim
hard
{ "lang": "rust", "repo": "maidsafe/sn_dbc", "path": "/src/error.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>action { new_interaction($globals); use crate::section_1265::new_interaction; true } else { false }; use crate::section_0209::*; processed }}<|fim_prefix|>// repo: harpsword/tex-rs path: /src/tex_the_program/section_1264.rs //! ` ` // @<Assignments@>= pub(c...
code_fim
medium
{ "lang": "rust", "repo": "harpsword/tex-rs", "path": "/src/tex_the_program/section_1264.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> true } else { false }; use crate::section_0209::*; processed }}<|fim_prefix|>// repo: harpsword/tex-rs path: /src/tex_the_program/section_1264.rs //! ` ` // @<Assignments@>= pub(crate) macro Assignments_1264($globals:expr, $cur_cmd:expr, $a<|fim_middle|>:expr) {{ // se...
code_fim
medium
{ "lang": "rust", "repo": "harpsword/tex-rs", "path": "/src/tex_the_program/section_1264.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: harpsword/tex-rs path: /src/tex_the_program/section_1264.rs //! ` ` // @<Assignments@>= pub(crate) macro Assignments_1264($globals:expr, $cur_cmd:expr, $a:expr) {{ // set_interaction: new_interaction; let processed = if $cur_cmd == set_inter<|fim_suffix|> true } else { ...
code_fim
medium
{ "lang": "rust", "repo": "harpsword/tex-rs", "path": "/src/tex_the_program/section_1264.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: justgerd/megaton-hammer path: /megaton-ipc/src/nn/ns/detail/impl_i_develop_interface.rs use megaton_hammer::kernel::{FromKObject, KObject, Session}; use megaton_hammer::error::Result; use alloc::arc::Arc; #[derive(Debug)] pub struct IDevelopInterface(Session); impl IDevelopInterface { pub fn...
code_fim
medium
{ "lang": "rust", "repo": "justgerd/megaton-hammer", "path": "/megaton-ipc/src/nn/ns/detail/impl_i_develop_interface.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let req = Request::new(6) .args(()) ; let _res : Response<()> = self.0.send(req)?; Ok(()) } // fn set_event_state6(&self, UNKNOWN) -> Result<UNKNOWN>; // fn set_event_state(&self, UNKNOWN) -> Result<UNKNOWN>; } impl FromKObject for IDevelopInterface { unsafe fn from_kobject(obj: KObject)...
code_fim
hard
{ "lang": "rust", "repo": "justgerd/megaton-hammer", "path": "/megaton-ipc/src/nn/ns/detail/impl_i_develop_interface.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // https://programming-idioms.org/idiom/41/reverse-a-string/402/rust let train = train .chars() .rev() .collect::<String>(); println!("{}", train); }<|fim_prefix|>// repo: cybaj/study_rust path: /homework_1_2_reverse/src/main.rs ...
code_fim
medium
{ "lang": "rust", "repo": "cybaj/study_rust", "path": "/homework_1_2_reverse/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cybaj/study_rust path: /homework_1_2_reverse/src/main.rs use std::io; fn main() { let mut train = String::new(); <|fim_suffix|> // https://programming-idioms.org/idiom/41/reverse-a-string/402/rust let train = train .chars() .rev() ...
code_fim
medium
{ "lang": "rust", "repo": "cybaj/study_rust", "path": "/homework_1_2_reverse/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let node_ds = match datastore::node_load(file.to_string()) { Ok(ds) => { ds }, Err(e) => { return Err(e); } }; Ok(Node{ name: node_ds.name, description: node_ds.desc, gateway: node_ds.gateway, ...
code_fim
hard
{ "lang": "rust", "repo": "bosley/OPAS", "path": "/Rust/DC/nexus/src/node.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> //debug!("New receive started with id: {}", id); } fn bytes_received(&mut self, _id: &String, data: &Vec<u8>) { //debug!("Node receiver got : {} bytes for stream {} ", data.len(), id); self.aggregated_data.extend(data.clone()); } fn receive_complete(&mut self, _id...
code_fim
hard
{ "lang": "rust", "repo": "bosley/OPAS", "path": "/Rust/DC/nexus/src/node.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bosley/OPAS path: /Rust/DC/nexus/src/node.rs extern crate rna; use rna::tcplib::TcpReceiver; extern crate serde; use serde::{Deserialize, Serialize}; use crate::common; use crate::datastore; pub struct NodeReceiver { aggregated_data: Vec<u8> } fn new_node_receiver() -> NodeRe...
code_fim
hard
{ "lang": "rust", "repo": "bosley/OPAS", "path": "/Rust/DC/nexus/src/node.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Shock-1/teensy4-rs path: /imxrt1062-pac/imxrt1062-pxp/src/as_pitch.rs #[doc = "Reader of register AS_PITCH"] pub type R = crate::R<u32, super::AS_PITCH>; #[doc = "Writer for register AS_PITCH"] pub type W = crate::W<u32, super::AS_PITCH>; #[doc = "Register AS_PITCH `reset()`'s with value 0"] imp...
code_fim
hard
{ "lang": "rust", "repo": "Shock-1/teensy4-rs", "path": "/imxrt1062-pac/imxrt1062-pxp/src/as_pitch.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>2) & 0xffff); self.w } } #[doc = "Reader of field `RSVD`"] pub type RSVD_R = crate::R<u16, u16>; impl R { #[doc = "Bits 0:15 - Indicates the number of bytes in memory between two vertically adjacent pixels."] #[inline(always)] pub fn pitch(&self) -> PITCH_R { PITCH_R::new((...
code_fim
hard
{ "lang": "rust", "repo": "Shock-1/teensy4-rs", "path": "/imxrt1062-pac/imxrt1062-pxp/src/as_pitch.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>eserved, always set to zero."] #[inline(always)] pub fn rsvd(&self) -> RSVD_R { RSVD_R::new(((self.bits >> 16) & 0xffff) as u16) } } impl W { #[doc = "Bits 0:15 - Indicates the number of bytes in memory between two vertically adjacent pixels."] #[inline(always)] pub fn pitc...
code_fim
hard
{ "lang": "rust", "repo": "Shock-1/teensy4-rs", "path": "/imxrt1062-pac/imxrt1062-pxp/src/as_pitch.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>use crate::section_0004::TeXGlobals; use crate::section_0081::TeXResult; use crate::section_0113::halfword; use crate::section_0207::endv; use crate::section_0209::max_command; use crate::section_0210::call; use crate::section_0210::end_template; use crate::section_0222::frozen_endv; use crate::section_02...
code_fim
hard
{ "lang": "rust", "repo": "harpsword/tex-rs", "path": "/src/tex_the_program/section_0380.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: harpsword/tex-rs path: /src/tex_the_program/section_0380.rs //! @ Here is a recursive procedure that is \TeX's usual way to get the //! next token of input. It has been slightly optimized to take account of //! common cases. // @p procedure get_x_token; {sets |cur_cmd|, |cur_chr|, |cur_tok|, //...
code_fim
hard
{ "lang": "rust", "repo": "harpsword/tex-rs", "path": "/src/tex_the_program/section_0380.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ftilde/rust-x86asm path: /src/test/instruction_tests/instr_cvtsi2sd.rs use instruction_def::*; use test::run_test; use Operand::*; use Reg::*; use RegScale::*; use RegType::*; use {BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; #[test] fn cvtsi2sd_1()...
code_fim
hard
{ "lang": "rust", "repo": "ftilde/rust-x86asm", "path": "/src/test/instruction_tests/instr_cvtsi2sd.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }