text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> Partitioning::UnknownPartitioning(1) } fn required_child_distribution(&self) -> Distribution { Distribution::SinglePartition } fn with_new_children( &self, children: Vec<Arc<dyn ExecutionPlan>>, ) -> Result<Arc<dyn ExecutionPlan>> { match child...
code_fim
hard
{ "lang": "rust", "repo": "kszucs/arrow-datafusion", "path": "/datafusion/src/physical_plan/windows.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> BoundingSphere::new(center, radius) } }<|fim_prefix|>// repo: tinco/ncollide path: /ncollide_entities/bounding_volume/bounding_sphere_plane.rs use na::Bounded; use na; use bounding_volume::{HasBoundingSphere, BoundingSphere}; use shape::Plane; use math::{Scalar, Point, Vect}; <|fim_middle|>...
code_fim
hard
{ "lang": "rust", "repo": "tinco/ncollide", "path": "/ncollide_entities/bounding_volume/bounding_sphere_plane.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tinco/ncollide path: /ncollide_entities/bounding_volume/bounding_sphere_plane.rs use na::Bounded; use na; use bounding_volume::{HasBoundingSphere, BoundingSphere}; use shape::Plane; use math::{Scalar, Point, Vect}; <|fim_suffix|> let center = na::orig(); let radius = Bounded::ma...
code_fim
hard
{ "lang": "rust", "repo": "tinco/ncollide", "path": "/ncollide_entities/bounding_volume/bounding_sphere_plane.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>NTEN_R { TXDONEINTEN_R::new(((self.bits >> 7) & 0x01) != 0) } #[doc = "Bit 12 - Enable for interrupt triggered by the SoftInt bit in the IntStatus register, caused by software writing a 1 to the SoftIntSet bit in the IntSet register."] #[inline(always)] pub fn softinten(&self) -> S...
code_fim
hard
{ "lang": "rust", "repo": "fuchsch1234/lpc178x_7x", "path": "/src/ethernet/intenable.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fuchsch1234/lpc178x_7x path: /src/ethernet/intenable.rs #[doc = "Reader of register INTENABLE"] pub type R = crate::R<u32, super::INTENABLE>; #[doc = "Writer for register INTENABLE"] pub type W = crate::W<u32, super::INTENABLE>; #[doc = "Register INTENABLE `reset()`'s with value 0"] impl crate::...
code_fim
hard
{ "lang": "rust", "repo": "fuchsch1234/lpc178x_7x", "path": "/src/ethernet/intenable.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> /// Log message timestamp method #[clap( long = "log-timestamps", value_enum, default_value = "utc", env = "PAJBOT_LOG_TIMESTAMPS" )] pub log_timestamps: LogTimestamps, } #[derive(Clone, Debug, Deserialize, Serialize, Parser)] pub struct Config { #[serd...
code_fim
hard
{ "lang": "rust", "repo": "pajbot/tweet-provider", "path": "/src/config.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pajbot/tweet-provider path: /src/config.rs use clap::{Parser, ValueEnum}; use egg_mode::{self as twitter}; use serde::{Deserialize, Serialize}; use std::{ net::SocketAddr, path::{Path, PathBuf}, }; #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, ValueEnum)] pub enum LogTime...
code_fim
hard
{ "lang": "rust", "repo": "pajbot/tweet-provider", "path": "/src/config.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub async fn from_toml<P>(path: P) -> anyhow::Result<Self> where P: AsRef<Path> + Send, { Ok(toml::from_str(&tokio::fs::read_to_string(path).await?)?) } } impl WebSocket { pub fn default_listen_addr() -> SocketAddr { "127.0.0.1:2356".parse().unwrap() } ...
code_fim
hard
{ "lang": "rust", "repo": "pajbot/tweet-provider", "path": "/src/config.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl MulAssign<f64> for Vec3 { fn mul_assign(&mut self, rhs: f64) { self.x *= rhs; self.y *= rhs; self.z *= rhs; } } impl DivAssign<f64> for Vec3 { fn div_assign(&mut self, rhs: f64) { self.x /= rhs; self.y /= rhs; self.z /= rhs; ...
code_fim
hard
{ "lang": "rust", "repo": "fifty-six/this.Parallel", "path": "/openmp/raytracing/raytracing-rs/src/vec3.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fifty-six/this.Parallel path: /openmp/raytracing/raytracing-rs/src/vec3.rs use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign}; #[derive(Debug, Clone, Copy)] pub struct Vec3 { pub x: f64, pub y: f64, pub z: f64, } impl Vec3 { pub fn new(x: f...
code_fim
hard
{ "lang": "rust", "repo": "fifty-six/this.Parallel", "path": "/openmp/raytracing/raytracing-rs/src/vec3.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl AddAssign<Vec3> for Vec3 { fn add_assign(&mut self, rhs: Vec3) { self.x += rhs.x; self.y += rhs.y; self.z += rhs.z; } } impl SubAssign<Vec3> for Vec3 { fn sub_assign(&mut self, rhs: Vec3) { self.x -= rhs.x; self.y -= rhs.y; self...
code_fim
hard
{ "lang": "rust", "repo": "fifty-six/this.Parallel", "path": "/openmp/raytracing/raytracing-rs/src/vec3.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Krakaw/mac-monitor path: /src/utils/network/arp.rs extern crate ipnetwork; extern crate pnet; extern crate tokio; use std::net::{IpAddr, Ipv4Addr}; use std::sync::mpsc::{self, Receiver, Sender}; use std::thread; use std::time::Duration; use ipnetwork::IpNetwork; use pnet::datalink::{self, Chan...
code_fim
hard
{ "lang": "rust", "repo": "Krakaw/mac-monitor", "path": "/src/utils/network/arp.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ethernet_packet.set_payload(arp_packet.packet_mut()); tx.send_to(ethernet_packet.packet(), Some(interface.clone())); } fn recv_arp_packets( interface: NetworkInterface, tx: Sender<(Ipv4Addr, MacAddr)>) { thread::spawn(move || { let (_, mut rx) = match datalink::channel(&inter...
code_fim
hard
{ "lang": "rust", "repo": "Krakaw/mac-monitor", "path": "/src/utils/network/arp.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Options for the `direnv` subcommand. #[derive(StructOpt, Debug)] pub struct DirenvOptions { /// The .nix file in the current directory to use #[structopt(long = "shell-file", parse(from_os_str), default_value = "shell.nix")] pub nix_file: PathBuf, } /// Options for the `info` subcommand. ...
code_fim
hard
{ "lang": "rust", "repo": "evanjs/lorri", "path": "/src/cli.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: evanjs/lorri path: /src/cli.rs //! Defines the CLI interface using structopt. // # Command line interface style guide // // Do not use short options unless they are extremely common and expected. A long option takes a // bit more typing, but the long name makes the intent much more obvious. The...
code_fim
hard
{ "lang": "rust", "repo": "evanjs/lorri", "path": "/src/cli.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: koshilife/atcoder.jp path: /abc202/b_rust/src/main.rs use proconio::input; fn main() { input! { s: String, } let mut ans_chars:Vec<char> = Vec::new(); for c in s.chars().rev() { if c == '6' { ans_chars.push('9');<|fim_suffix|>.push(c); } }...
code_fim
medium
{ "lang": "rust", "repo": "koshilife/atcoder.jp", "path": "/abc202/b_rust/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>.push(c); } } let ans: String = ans_chars.iter().collect(); println!("{}", ans); }<|fim_prefix|>// repo: koshilife/atcoder.jp path: /abc202/b_rust/src/main.rs use proconio::input; fn main() { input! { s: String, } let mut ans_chars:Vec<cha<|fim_middle|>r> = Vec::n...
code_fim
hard
{ "lang": "rust", "repo": "koshilife/atcoder.jp", "path": "/abc202/b_rust/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: anonymousGiga/oasis-sdk path: /runtime-sdk/src/modules/rewards/types.rs //! Rewards module types. use std::collections::BTreeMap; use thiserror::Error; use crate::{ core::consensus::beacon, types::{address::Address, token}, }; /// One of the time periods in the reward schedule. #[deri...
code_fim
hard
{ "lang": "rust", "repo": "anonymousGiga/oasis-sdk", "path": "/runtime-sdk/src/modules/rewards/types.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl cbor::Encode for RewardAction { fn into_cbor_value(self) -> cbor::Value { match self { Self::Reward(r) => cbor::Value::Unsigned(r), Self::NoReward => cbor::Value::Simple(cbor::SimpleValue::NullValue), } } } impl cbor::Decode for RewardAction { fn t...
code_fim
hard
{ "lang": "rust", "repo": "anonymousGiga/oasis-sdk", "path": "/runtime-sdk/src/modules/rewards/types.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> println!("{}", addition!(5, 6, 57 ,56, 1)); }<|fim_prefix|>// repo: robertmmarek/rust-practice path: /chapter_11/task_1/src/main.rs macro_rules! addition { ($( $x:expr ),*) => { { let mut sum = 0; $( sum += $x; )* sum ...
code_fim
easy
{ "lang": "rust", "repo": "robertmmarek/rust-practice", "path": "/chapter_11/task_1/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: robertmmarek/rust-practice path: /chapter_11/task_1/src/main.rs macro_rules! addition { ($( $x:expr ),*) => { { let mut sum = 0; $( sum += $x; )* sum } }; } <|fim_suffix|> println!("{}", addition!(5, 6, 5...
code_fim
easy
{ "lang": "rust", "repo": "robertmmarek/rust-practice", "path": "/chapter_11/task_1/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Yamakaky/dcpu path: /server/src/msg.rs use dcpu::emulator::device::keyboard::mpsc_backend::KeyboardEvent; use dcpu::emulator::device::lem1802::generic_backend::ScreenCommand; <|fim_suffix|>#[derive(Debug, Serialize, Deserialize)] pub enum DeviceType { Lem1802, Keyboard, Clock, }<|fi...
code_fim
hard
{ "lang": "rust", "repo": "Yamakaky/dcpu", "path": "/server/src/msg.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl ClientMessage { pub fn device_id(&self) -> Option<u16> { match *self { ClientMessage::CreateCpu(..) => None, ClientMessage::Keyboard(id, _) => Some(id), } } } #[derive(Debug, Serialize, Deserialize)] pub enum DeviceType { Lem1802, Keyboard, ...
code_fim
medium
{ "lang": "rust", "repo": "Yamakaky/dcpu", "path": "/server/src/msg.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Rust setup, called by start. Uses the extern "C" calling convention so that /// the assembly in start knows how to call it (the Rust ABI is not defined). /// Sets up the data segment (including relocations) and the heap (if enabled), /// then calls into the rustc-generated main(). This cannot use muta...
code_fim
hard
{ "lang": "rust", "repo": "isabella232/design-explorations", "path": "/size_comparison/futures-noinline/src/entry_point.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isabella232/design-explorations path: /size_comparison/futures-noinline/src/entry_point.rs /// Tock OS runtime library. Sets up the stack and data regions before calling /// into main(). // start and rust_start are the first two procedures executed when a Tock // application starts. start is in...
code_fim
hard
{ "lang": "rust", "repo": "isabella232/design-explorations", "path": "/size_comparison/futures-noinline/src/entry_point.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iqlusioninc/crates path: /subtle-encoding/src/hex.rs //! Hex encoding/decoding with data-independent constant time(-ish) operation. //! //! Adapted from this C++ implementation: //! //! <https://github.com/Sc00bz/ConstTimeEncoding/blob/master/hex.cpp> //! //! Copyright (c) 2014 Steve "Sc00bz" Th...
code_fim
hard
{ "lang": "rust", "repo": "iqlusioninc/crates", "path": "/subtle-encoding/src/hex.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(vector.hex, &out[..out_len]); } } #[test] fn decode_test_vectors() { for vector in HEX_TEST_VECTORS { // 5 is the size of the largest decoded test vector let mut out = [0u8; 5]; let out_len = Hex::lower_case() ...
code_fim
hard
{ "lang": "rust", "repo": "iqlusioninc/crates", "path": "/subtle-encoding/src/hex.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: warfighter-engaged/game-with-your-brain path: /src/eeg/mod.rs //! This module handles connecting to and reading from a Neurosky EEG headset //! using a UART connection. //! //! Code adapted from <https://github.com/redpaperheart/ArduinoMindwave> //! //! When the Mindwave struct goes out of scope...
code_fim
hard
{ "lang": "rust", "repo": "warfighter-engaged/game-with-your-brain", "path": "/src/eeg/mod.rs", "mode": "psm", "license": "MS-PL", "source": "the-stack-v2" }
<|fim_suffix|> // Set the UART to read in non-blocking mode (0 minimum length, 0 timeout) self.uart.set_read_mode(0, Duration::default())?; let mut buffer = [0u8; 1]; if self.uart.read(&mut buffer)? > 0 { Ok(buffer[0]) } else { Ok(0) } } /...
code_fim
hard
{ "lang": "rust", "repo": "warfighter-engaged/game-with-your-brain", "path": "/src/eeg/mod.rs", "mode": "spm", "license": "MS-PL", "source": "the-stack-v2" }
<|fim_suffix|>impl<T: Sequential + Clone> Iterator for Sequence<T> { type Item = T; fn next(&mut self) -> Option<T> { if self.first_call { self.first_call = false; } else { self.current = self.current.clone().and_then(|v| v.consequent()); } self.current.c...
code_fim
medium
{ "lang": "rust", "repo": "subdir/pkb", "path": "/src/util/sequential.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: subdir/pkb path: /src/util/sequential.rs pub trait LowBound { fn lowest() -> Self; } pub trait Sequential { fn consequent(&self) -> Option<Self> where Self: Sized; fn sequence(&self) -> Sequence<Self> where Self: Clone { Sequence::new(self.clone()) } } pub struct Sequ...
code_fim
medium
{ "lang": "rust", "repo": "subdir/pkb", "path": "/src/util/sequential.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>_mac, "blake2s/mac", blake2::Blake2s);<|fim_prefix|>// repo: benma/bitbox02-firmware path: /src/rust/vendor/blake2/tests/mac.rs #![no_std] use crypto_mac::new_test; new_test!(blake2b_mac, "blake2b/mac"<|fim_middle|>, blake2::Blake2b); new_test!(blake2s
code_fim
easy
{ "lang": "rust", "repo": "benma/bitbox02-firmware", "path": "/src/rust/vendor/blake2/tests/mac.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>, blake2::Blake2b); new_test!(blake2s_mac, "blake2s/mac", blake2::Blake2s);<|fim_prefix|>// repo: benma/bitbox02-firmware path: /src/rust/vendor/blake2/tests/mac.rs #![no_std] use crypto_mac::new_test;<|fim_middle|> new_test!(blake2b_mac, "blake2b/mac"
code_fim
easy
{ "lang": "rust", "repo": "benma/bitbox02-firmware", "path": "/src/rust/vendor/blake2/tests/mac.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: benma/bitbox02-firmware path: /src/rust/vendor/blake2/tests/mac.rs #![no_std] use crypto_mac::new_test; new_test!(blake2b_mac, "blake2b/mac"<|fim_suffix|>_mac, "blake2s/mac", blake2::Blake2s);<|fim_middle|>, blake2::Blake2b); new_test!(blake2s
code_fim
easy
{ "lang": "rust", "repo": "benma/bitbox02-firmware", "path": "/src/rust/vendor/blake2/tests/mac.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jkilpatr/web30 path: /src/lib.rs #![warn(clippy::all)] #![allow(clippy::pedantic)] <|fim_suffix|>pub mod client; pub mod jsonrpc; pub mod types;<|fim_middle|>extern crate serde; extern crate serde_json; #[macro_use] extern crate serde_derive; extern crate clarity; extern crate futures; extern c...
code_fim
hard
{ "lang": "rust", "repo": "jkilpatr/web30", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub mod client; pub mod jsonrpc; pub mod types;<|fim_prefix|>// repo: jkilpatr/web30 path: /src/lib.rs #![warn(clippy::all)] #![allow(clippy::pedantic)] <|fim_middle|>extern crate serde; extern crate serde_json; #[macro_use] extern crate serde_derive; extern crate clarity; extern crate futures; extern c...
code_fim
hard
{ "lang": "rust", "repo": "jkilpatr/web30", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub struct SerializeMe; // Special component that exists to help serialize the game data #[derive(Component, Serialize, Deserialize, Clone)] pub struct SerializationHelper { pub map : super::map::Map } // // Wrapper for Equipped // #[derive(Clone, Deserialize, Serialize)] // pub struct EquippedData<...
code_fim
hard
{ "lang": "rust", "repo": "Elzair/rust-roguelike-tutorial", "path": "/src/components.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Elzair/rust-roguelike-tutorial path: /src/components.rs use serde::{Deserialize, Serialize}; use specs::prelude::*; use specs::error::NoError; use specs::saveload::{ConvertSaveload, Marker}; use rltk::RGB; #[derive(Clone, Component, ConvertSaveload, Debug)] pub struct AreaOfEffect { pub rad...
code_fim
hard
{ "lang": "rust", "repo": "Elzair/rust-roguelike-tutorial", "path": "/src/components.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ntln!("Vector occupies {} bytes", mem::size_of_val(&numbers)); //Get slice let slice: &[i32] = &numbers[0..2]; println!("Slice: {:?}", slice); //Loop through vector values for x in numbers.iter() { println!("Numbers: {}", x); } //Loop and mutate for x in numbers.iter_mut() { *x *= 2; } ...
code_fim
medium
{ "lang": "rust", "repo": "samsalgado/Working-With-Rust", "path": "/vectors.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: samsalgado/Working-With-Rust path: /vectors.rs //Resizable arrays use std::mem; pub fn run() { let mut numbers: Vec<i32> = vec![1,2,22,3,4]; numbers[2] = 20; //Add on to vector numbers.push(5); numbers.push(6); nu<|fim_suffix|>s for x in numbers.iter() { println!("Numbers: {}", x);...
code_fim
hard
{ "lang": "rust", "repo": "samsalgado/Working-With-Rust", "path": "/vectors.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; if !output.status.success() { return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); } let stdout = str::from_utf8(&output.stdout)?; let mut words = stdout.trim().split_whitespace(); ...
code_fim
hard
{ "lang": "rust", "repo": "sdroege/gstreamer-sys", "path": "/gstreamer-pbutils-sys/tests/abi.rs", "mode": "spm", "license": "LGPL-2.1-only", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sdroege/gstreamer-sys path: /gstreamer-pbutils-sys/tests/abi.rs // This file was generated by gir (https://github.com/gtk-rs/gir @ ad40c01) // from gir-files (https://github.com/gtk-rs/gir-files @ 18c9a37) // DO NOT EDIT extern crate gstreamer_pbutils_sys; extern crate shell_words; extern crate...
code_fim
hard
{ "lang": "rust", "repo": "sdroege/gstreamer-sys", "path": "/gstreamer-pbutils-sys/tests/abi.rs", "mode": "psm", "license": "LGPL-2.1-only", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Slowyn/rust-tracer path: /src/physics/material.rs use crate::hittables::HitRecord; use crate::math::Vec3; use crate::physics::Ray; <|fim_suffix|> &self, r: &Ray, record: &HitRecord, attenuation: &mut Vec3, scattered: &mut Ray, ) -> bool; fn emitte...
code_fim
easy
{ "lang": "rust", "repo": "Slowyn/rust-tracer", "path": "/src/physics/material.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Vec3::new(0.0, 0.0, 0.0) } }<|fim_prefix|>// repo: Slowyn/rust-tracer path: /src/physics/material.rs use crate::hittables::HitRecord; use crate::math::Vec3; use crate::physics::Ray; pub trait Material: Sync { fn scatter( <|fim_middle|> &self, r: &Ray, record: &HitR...
code_fim
medium
{ "lang": "rust", "repo": "Slowyn/rust-tracer", "path": "/src/physics/material.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: NivenT/REnforce path: /src/util/mod.rs //! Utilities Module pub mod table; pub mod chooser; pub mod approx; pub mod feature; pub mod graddesc; mod metric; use std::fmt::Debug; use num::Num; use num::Float; use environment::Space; // Is there a clean way to reduce the number of traits? // A...
code_fim
hard
{ "lang": "rust", "repo": "NivenT/REnforce", "path": "/src/util/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// A real-valued feature of elements of some state space pub trait Feature<S: Space, F: Float> : Debug { /// Extracts some real-valued feature from a given state fn extract(&self, state: &S::Element) -> F; /// Creates a cloned trait object of self fn box_clone(&self) -> Box<Feature<S, F>>; } impl<F:...
code_fim
hard
{ "lang": "rust", "repo": "NivenT/REnforce", "path": "/src/util/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: elsuizo/tock path: /chips/lpc43xx/src/eeprom.rs use kernel::common::StaticRef; use kernel::common::registers::{self, ReadOnly, ReadWrite, WriteOnly, register_bitfields}; /// EEPROM #[repr(C)] struct EepromRegisters { /// EEPROM command register cmd: ReadWrite<u32>, _reserved0: [u8; 4], /// ...
code_fim
hard
{ "lang": "rust", "repo": "elsuizo/tock", "path": "/chips/lpc43xx/src/eeprom.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> The number of system clock periods to PHASE2 OFFSET(8) NUMBITS(8) [], /// Wait states for phase 1 (minus 1 encoded). The number of system clock periods to PHASE1 OFFSET(16) NUMBITS(8) [], /// Lock timing parameters for write, erase and program operation 0 = WSTATE and CL LCK_PARWEP O...
code_fim
hard
{ "lang": "rust", "repo": "elsuizo/tock", "path": "/chips/lpc43xx/src/eeprom.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return !wild[j]; } fn main() { let mut s1 = String::new(); io::stdin() .read_line(&mut s1) .ok() .expect("read error"); let mut s2 = String::new(); io::stdin() .read_line(&mut s2) .ok() .expect("read error"); }<|fim_prefix|>// repo: vic...
code_fim
medium
{ "lang": "rust", "repo": "victor-zapselsky/algorithms-and-data-structures", "path": "/Rust/7/PatternMatching.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: victor-zapselsky/algorithms-and-data-structures path: /Rust/7/PatternMatching.rs use std::io; fn wildcmp(wild: &str, string: &str) { let mut cp : i32; let mut mp : i32; let mut i = 0; let mut j = 0; while i != string.len() && wild[j] != '*' { if (wild[j] != string[i]...
code_fim
medium
{ "lang": "rust", "repo": "victor-zapselsky/algorithms-and-data-structures", "path": "/Rust/7/PatternMatching.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>mod b { pub fn f() -> u32 { ::inlined() + ::normal() } } #[start] fn start(_: isize, _: *const *const u8) -> isize { a::f(); b::f(); 0 }<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/run-make-fulldeps/sepcomp-inlining/foo.rs #![feature(start)] #[inli...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/run-make-fulldeps/sepcomp-inlining/foo.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/run-make-fulldeps/sepcomp-inlining/foo.rs #![feature(start)] #[inline] fn inlined() -> u32 { 1234 } fn normal() -> u32 { 2345 } <|fim_suffix|>#[start] fn start(_: isize, _: *const *const u8) -> isize { a::f(); b::f(); 0 }<|f...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/run-make-fulldeps/sepcomp-inlining/foo.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[start] fn start(_: isize, _: *const *const u8) -> isize { a::f(); b::f(); 0 }<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/run-make-fulldeps/sepcomp-inlining/foo.rs #![feature(start)] #[inline] fn inlined() -> u32 { 1234 } fn normal() -> u32 { <|fim_middle|> ...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/run-make-fulldeps/sepcomp-inlining/foo.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut map = BTreeMap::new(); map.insert(XY::zero(), Square::Origin); RepairDroid { program, map, search_path: vec!(XY::zero()) } } fn display_map(&self) -> String { let (xmin, xmax, ymin, ymax) = self.map.iter().fold((0,0,0,0), |(xmin, xmax, ymin, ymax), (xy, _)|...
code_fim
hard
{ "lang": "rust", "repo": "SmedbergM/AdventOfCode2019", "path": "/day15/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SmedbergM/AdventOfCode2019 path: /day15/src/main.rs use std::collections::BTreeMap; use std::fmt; use intcode::{Program, State}; #[derive(PartialOrd, Ord, PartialEq, Eq, Clone)] struct XY { x: i32, y: i32 } impl XY { fn zero() -> XY { XY { x: 0, y: 0 } } fn step(&...
code_fim
hard
{ "lang": "rust", "repo": "SmedbergM/AdventOfCode2019", "path": "/day15/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> } } fn reoxygenate(&mut self) -> usize { let mut steps = 0; loop { let xys: Vec<XY> = self.map.iter().flat_map(|(xy, square)| { match square { Square::Open => { Direction::all().iter().filter(|d| { ...
code_fim
hard
{ "lang": "rust", "repo": "SmedbergM/AdventOfCode2019", "path": "/day15/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // shadow s. We can't borrow a immutable variable with a mutable reference, which makes sense let mut s = String::from("hello"); let muta_ref1 = &mut s; // let muta_ref2 = &mut s; this will generate a compiler error } fn custom_scopes_for_references() { let mut s = String::from("hello...
code_fim
hard
{ "lang": "rust", "repo": "ilumar589/generic_rust_concepts", "path": "/Rust/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ilumar589/generic_rust_concepts path: /Rust/src/main.rs extern crate rand; mod lifetime_test; mod functional_test; mod iterators; mod smart_pointers; mod a_dir; mod thread_examples; mod object_oriented_examples; mod patterns_and_matching; mod advanced_features; use std::io; use std::cmp::Orde...
code_fim
hard
{ "lang": "rust", "repo": "ilumar589/generic_rust_concepts", "path": "/Rust/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>trait Summary { fn summarize(&self) -> String; } struct NewsArticle { headline: String, location: String, author: String, content: String } struct Tweet { username: String, content: String, reply: bool, retweet: bool } impl Summary for NewsArticle { fn summarize...
code_fim
hard
{ "lang": "rust", "repo": "ilumar589/generic_rust_concepts", "path": "/Rust/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Robzz/RustRaytracer path: /src/material/mod.rs mod material; mod simple; mod phong; mod lig<|fim_suffix|>::Phong; pub use self::light::LightMaterial;<|fim_middle|>ht; pub use self::material::Material; pub use self::simple::Simple; pub use self::phong
code_fim
medium
{ "lang": "rust", "repo": "Robzz/RustRaytracer", "path": "/src/material/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>::Phong; pub use self::light::LightMaterial;<|fim_prefix|>// repo: Robzz/RustRaytracer path: /src/material/mod.rs mod material; mod simple; mod phong; mod lig<|fim_middle|>ht; pub use self::material::Material; pub use self::simple::Simple; pub use self::phong
code_fim
medium
{ "lang": "rust", "repo": "Robzz/RustRaytracer", "path": "/src/material/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let ascii_space: u8 = 32; let split: Vec<Vec<u8>> = split_like_string(&decoded_contents, ascii_space); let format_string = match split.first() { Some(v) => str::from_utf8(&v).unwrap(), None => return Err(ObjectError::MalformedObject) }; retu...
code_fim
hard
{ "lang": "rust", "repo": "sgbasaraner/mgit", "path": "/src/object.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Object { pub fn read(repo: &Repository, sha: Vec<char>) -> Result<Object, ObjectError> { let (dir, file_name) = sha.split_at(2); if dir.len() != 2 || file_name.is_empty() { return Err(ObjectError::MalformedSha) } let mut path_strings = vec![String::from("objects")]; ...
code_fim
medium
{ "lang": "rust", "repo": "sgbasaraner/mgit", "path": "/src/object.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sgbasaraner/mgit path: /src/object.rs use flate2::read::ZlibDecoder; use crate::repository::Repository; use crate::repository::repo_path; use std::error::Error; use std::fmt; use std::fs::File; use std::io::Read; use std::iter::FromIterator; use std::str; #[derive(Debug)] pub enum Object { ...
code_fim
hard
{ "lang": "rust", "repo": "sgbasaraner/mgit", "path": "/src/object.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AlterionX/seren path: /lib/src/game/guard.rs use crate::game::state::KeyedStore; use serde::{Deserialize, Serialize}; <|fim_suffix|>#[derive(Serialize, Deserialize, Debug)] #[serde(bound = "")] pub enum Guard<T: KeyedStore> { Value(KeyedGuard<T>), Not(Box<Guard<T>>), And(Vec<Guard...
code_fim
hard
{ "lang": "rust", "repo": "AlterionX/seren", "path": "/lib/src/game/guard.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Serialize, Deserialize, Debug)] #[serde(bound = "")] pub enum Guard<T: KeyedStore> { Value(KeyedGuard<T>), Not(Box<Guard<T>>), And(Vec<Guard<T>>), Or(Vec<Guard<T>>), }<|fim_prefix|>// repo: AlterionX/seren path: /lib/src/game/guard.rs use crate::game::state::KeyedStore; use ser...
code_fim
hard
{ "lang": "rust", "repo": "AlterionX/seren", "path": "/lib/src/game/guard.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.symmetric .decrypt_and_hash(data, out) .map_err(|_| Error::decryption()) } /// Similar to [`read_message`](HandshakeState::read_message), but returns /// result as a [`Vec`]. /// /// In addition to possible errors from /// [`read_messa...
code_fim
hard
{ "lang": "rust", "repo": "digitalbitbox/bitbox02-firmware", "path": "/src/rust/vendor/noise-protocol/src/handshakestate.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: digitalbitbox/bitbox02-firmware path: /src/rust/vendor/noise-protocol/src/handshakestate.rs f().unwrap().as_slice()); } else { symmetric.mix_hash(D::pubkey(s.as_ref().unwrap()).as_slice()); } } T...
code_fim
hard
{ "lang": "rust", "repo": "digitalbitbox/bitbox02-firmware", "path": "/src/rust/vendor/noise-protocol/src/handshakestate.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: digitalbitbox/bitbox02-firmware path: /src/rust/vendor/noise-protocol/src/handshakestate.rs symmetric.mix_hash(D::pubkey(s.as_ref().unwrap()).as_slice()); } } Token::E => { if is_initiator { ...
code_fim
hard
{ "lang": "rust", "repo": "digitalbitbox/bitbox02-firmware", "path": "/src/rust/vendor/noise-protocol/src/handshakestate.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Serialize, Deserialize, Task)] #[task_name = "batch::SayHello"] #[task_routing_key = "hello-world"] struct SayHello { to: String, } fn main() { env_logger::init(); println!("Starting RabbitMQ client example"); let exchanges = vec![exchange("batch.example")]; let queues = vec!...
code_fim
medium
{ "lang": "rust", "repo": "ponyloop/batch-rs", "path": "/batch/examples/simple-client.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ponyloop/batch-rs path: /batch/examples/simple-client.rs #[macro_use] extern crate batch; extern crate env_logger; extern crate futures; extern crate serde; #[macro_use] extern crate serde_derive; extern crate tokio; <|fim_suffix|> env_logger::init(); println!("Starting RabbitMQ client e...
code_fim
hard
{ "lang": "rust", "repo": "ponyloop/batch-rs", "path": "/batch/examples/simple-client.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jfornoff/rust-socket-playground path: /src/main.rs extern crate nix; extern crate net2; use std::net::{TcpListener, TcpStream}; use std::os::unix::io::{AsRawFd, RawFd}; use nix::sys::socket; use net2::TcpBuilder; fn main() { let unbound_socket = TcpBuilder::new_v4().unwrap(); println!( ...
code_fim
hard
{ "lang": "rust", "repo": "jfornoff/rust-socket-playground", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!( "### TCP Info:\n {:#?}", socket::getsockopt(stream.as_raw_fd(), socket::sockopt::TcpInfo).unwrap() ); println!( "### MPTCP Enabled:\n {:#?}", socket::getsockopt(stream.as_raw_fd(), socket::sockopt::MptcpEnabled).unwrap() ); }<|fim_prefix|>// repo:...
code_fim
hard
{ "lang": "rust", "repo": "jfornoff/rust-socket-playground", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stv0g/k66 path: /src/enet/eir.rs f.bits } #[doc = r" Returns `true` if the bit is clear (0)"] #[inline] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r" Returns `true` if the bit is set (1)"] #[inline] pub fn bit_is_set(&self) -> bool { ...
code_fim
hard
{ "lang": "rust", "repo": "stv0g/k66", "path": "/src/enet/eir.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>((value & MASK) as u32) << OFFSET; self.w } } #[doc = r" Proxy"] pub struct _MIIW<'a> { w: &'a mut W, } impl<'a> _MIIW<'a> { #[doc = r" Sets the field bit"] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r" Clears the field bit"] pub fn clear_bit(s...
code_fim
hard
{ "lang": "rust", "repo": "stv0g/k66", "path": "/src/enet/eir.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stv0g/k66 path: /src/enet/eir.rs e of the field as raw bits"] #[inline] pub fn bit(&self) -> bool { self.bits } #[doc = r" Returns `true` if the bit is clear (0)"] #[inline] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r" Returns `tru...
code_fim
hard
{ "lang": "rust", "repo": "stv0g/k66", "path": "/src/enet/eir.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Drop for TaskHandle { fn drop(&mut self) { self.cancel(); } }<|fim_prefix|>// repo: matrix-org/matrix-rust-sdk path: /bindings/matrix-sdk-ffi/src/task_handle.rs use tokio::task::JoinHandle; use tracing::debug; /// A task handle is a way to keep the handle a task running by itself in...
code_fim
medium
{ "lang": "rust", "repo": "matrix-org/matrix-rust-sdk", "path": "/bindings/matrix-sdk-ffi/src/task_handle.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matrix-org/matrix-rust-sdk path: /bindings/matrix-sdk-ffi/src/task_handle.rs use tokio::task::JoinHandle; use tracing::debug; /// A task handle is a way to keep the handle a task running by itself in /// detached mode. /// /// It's a thin wrapper around [`JoinHandle`]. #[derive(uniffi::Object)]...
code_fim
medium
{ "lang": "rust", "repo": "matrix-org/matrix-rust-sdk", "path": "/bindings/matrix-sdk-ffi/src/task_handle.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> passport .trim() .split(&['\n', ' '][..]) .filter(|&x| { let mut s = x.split(':'); validate_field(s.next().unwrap(), s.next().unwrap()).unwrap_or(false) }) .count() == 7 // All 7 required fields are valid } fn validate_field(key:...
code_fim
hard
{ "lang": "rust", "repo": "jakoberzar/advent-of-code-2020", "path": "/day-04-rust/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jakoberzar/advent-of-code-2020 path: /day-04-rust/src/main.rs #[allow(dead_code)] const SIMPLE_INPUT: &str = include_str!("./../../inputs/simple/day-04.txt"); #[allow(dead_code)] const INPUT: &str = include_str!("./../../inputs/day-04.txt"); fn main() { // Star 1 let valid = star1(INPUT...
code_fim
hard
{ "lang": "rust", "repo": "jakoberzar/advent-of-code-2020", "path": "/day-04-rust/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: XPredictMarket/ws_client path: /src/pallets/proposals.rs use std::marker::PhantomData; use codec::{Decode, Encode}; use subxt::{module, system::System, Call, Event, Store}; use super::{Balance, CurrencyId, Moment, ProposalId, ProposalStatus, VersionId}; #[module] pub trait Proposals: System {...
code_fim
hard
{ "lang": "rust", "repo": "XPredictMarket/ws_client", "path": "/src/pallets/proposals.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Clone, Debug, Eq, PartialEq, Store, Encode)] pub struct ProposalVoteStakeStore<'a, T: Proposals> { #[store(returns = Option<(Balance, bool)>)] pub proposal_id: ProposalId, pub account: &'a T::AccountId, } #[derive(Clone, Debug, Eq, PartialEq, Store, Encode)] pub struct ProposalCountVoteStore<...
code_fim
hard
{ "lang": "rust", "repo": "XPredictMarket/ws_client", "path": "/src/pallets/proposals.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Hyumin/AdventOfCode2020 path: /src/day_5.rs use std::io; use std::vec; //Reads the lines from the terminal and return after entering done identifier fn get_input( done_iden : &String) -> String { let mut inputStrings = String::new(); let doneIdentifier = String::from(done_iden); ...
code_fim
hard
{ "lang": "rust", "repo": "Hyumin/AdventOfCode2020", "path": "/src/day_5.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>{ let mut result = 0; for line in arg.lines() { let mut row_min = 0; let mut row_max =127; let mut row = 0; let mut col = 0; let mut col_min= 0; let mut col_max = 7; for c in line.chars() { // println!("Row m...
code_fim
hard
{ "lang": "rust", "repo": "Hyumin/AdventOfCode2020", "path": "/src/day_5.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for x in 0..127 { for y in 0..7 { let i = x*8 + y; let mut found = false; for j in 0..ids.len() { if i == ids[j] { found = true; } } if !found { let mut hmm = 0; ...
code_fim
hard
{ "lang": "rust", "repo": "Hyumin/AdventOfCode2020", "path": "/src/day_5.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if board[y - 1][x] == '|' { dir = Dir::Up; y -= 1; steps += 1; } else if board[y + 1][x] == '|' { dir = Dir::Down; y += 1; steps += 1; } ...
code_fim
hard
{ "lang": "rust", "repo": "darksv/AdventOfCode2017", "path": "/19/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: darksv/AdventOfCode2017 path: /19/src/main.rs fn main() { let board = read_board(); let (steps, letters) = follow(&board); println!("1: {}", letters.iter().collect::<String>()); println!("2: {}", steps); } fn read_board() -> Vec<Vec<char>> { use std::io::BufRead; let mut...
code_fim
hard
{ "lang": "rust", "repo": "darksv/AdventOfCode2017", "path": "/19/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: grantslatton/quasirandom path: /src/lib.rs and /// the magic numbers emitted in the loop are that the inverse of that root /// exponentiated by increasing integers. See the following blog post by /// Martin Roberts for a full explanation: /// http://extremelearning.com.au/unreasonable-effective...
code_fim
hard
{ "lang": "rust", "repo": "grantslatton/quasirandom", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Test that the QRNG covers a variety of ranges more effectively than a CPRNG #[test] fn coverage() { for &n in &[100, 1_000, 100_000] { let mut qrng = Qrng::<f64>::new(0.0); let mut qrng_set = HashSet::new(); let mut rng = ChaChaRng::seed_from_u64(...
code_fim
hard
{ "lang": "rust", "repo": "grantslatton/quasirandom", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> () => {} } define_from_uniform!(T31 T30 T29 T28 T27 T26 T25 T24 T23 T22 T21 T20 T19 T18 T17 T16 T15 T14 T13 T12 T11 T10 T9 T8 T7 T6 T5 T4 T3 T2 T1 T0); /// The binary search finds the unique positive root of x^(d+1) = x + 1, and /// the magic numbers emitted in the loop are that the inverse of that ...
code_fim
hard
{ "lang": "rust", "repo": "grantslatton/quasirandom", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl AsRef<web_sys::HtmlTitleElement> for HtmlTitleElement { fn as_ref(&self) -> &web_sys::HtmlTitleElement { &self.inner } } impl_html_element_traits!(HtmlTitleElement); impl_try_from_element!(HtmlTitleElement); impl_known_element!(HtmlTitleElement, "TITLE"); impl_extendable_element!(Htm...
code_fim
hard
{ "lang": "rust", "repo": "RSSchermer/ARWA", "path": "/arwa/src/html/html_title_element.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl From<web_sys::HtmlTitleElement> for HtmlTitleElement { fn from(inner: web_sys::HtmlTitleElement) -> Self { HtmlTitleElement { inner } } } impl AsRef<web_sys::HtmlTitleElement> for HtmlTitleElement { fn as_ref(&self) -> &web_sys::HtmlTitleElement { &self.inner } } imp...
code_fim
medium
{ "lang": "rust", "repo": "RSSchermer/ARWA", "path": "/arwa/src/html/html_title_element.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: RSSchermer/ARWA path: /arwa/src/html/html_title_element.rs use wasm_bindgen::UnwrapThrowExt; use crate::dom::impl_try_from_element; use crate::html::{impl_extendable_element, impl_html_element_traits, impl_known_element}; #[derive(Clone)] pub struct HtmlTitleElement { inner: web_sys::HtmlT...
code_fim
hard
{ "lang": "rust", "repo": "RSSchermer/ARWA", "path": "/arwa/src/html/html_title_element.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: voidstar0/wasm-remapper-web path: /wasm-remapper/src/lib.rs mod utils; use wasm_bindgen::prelude::*; use wasm_remapper::*; // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global // allocator. #[cfg(feature = "wee_alloc")] #[global_allocator] static ALLOC: wee_alloc::WeeAlloc...
code_fim
hard
{ "lang": "rust", "repo": "voidstar0/wasm-remapper-web", "path": "/wasm-remapper/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>tion_locals(requireExactFunctionLocals) .build() .map_err(|error| JsValue::from_str(&error.to_string()))? .remap() .map(|output| output.output) .map_err(|error| JsValue::from_str(&error.to_string())) }<|fim_prefix|>// repo: voidstar0/wasm-remapper-web path: /wasm-r...
code_fim
hard
{ "lang": "rust", "repo": "voidstar0/wasm-remapper-web", "path": "/wasm-remapper/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aschaeffer/rust-ecs-poc path: /src/tests/reactive/arithmetic_gate_test.rs use std::sync::Arc; use serde_json::json; use crate::api::{PropertyInstanceGetter, PropertyInstanceSetter}; use crate::behaviour::{AddGate, ArithmeticGateBehaviour, ConnectorBehaviour, DefaultConnector, EntityBehaviour};...
code_fim
hard
{ "lang": "rust", "repo": "aschaeffer/rust-ecs-poc", "path": "/src/tests/reactive/arithmetic_gate_test.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> add_1.set(LHS.as_ref(), json!(1)); assert_eq!(1, add_1.as_i64(RESULT.to_string()).unwrap()); assert_eq!(0, add_2.as_i64(RESULT.to_string()).unwrap()); assert_eq!(1, add_3.as_i64(RESULT.to_string()).unwrap()); add_1.set(RHS.to_string(), json!(1)); assert_eq!(2, add_1.as_i64(RESULT....
code_fim
hard
{ "lang": "rust", "repo": "aschaeffer/rust-ecs-poc", "path": "/src/tests/reactive/arithmetic_gate_test.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: niuez/cp-rust-library path: /src/data_structures.rs pub mod segment_tree; pub mod containers; pub <|fim_suffix|>od set; pub mod mo; pub mod convex_hull_trick;<|fim_middle|>mod heap; pub mod tree; pub mod avl_tree; pub mod implicit_avl_tree; pub mod union_find; pub m
code_fim
medium
{ "lang": "rust", "repo": "niuez/cp-rust-library", "path": "/src/data_structures.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>od set; pub mod mo; pub mod convex_hull_trick;<|fim_prefix|>// repo: niuez/cp-rust-library path: /src/data_structures.rs pub mod segment_tree; pub mod containers; pub <|fim_middle|>mod heap; pub mod tree; pub mod avl_tree; pub mod implicit_avl_tree; pub mod union_find; pub m
code_fim
medium
{ "lang": "rust", "repo": "niuez/cp-rust-library", "path": "/src/data_structures.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>od implicit_avl_tree; pub mod union_find; pub mod set; pub mod mo; pub mod convex_hull_trick;<|fim_prefix|>// repo: niuez/cp-rust-library path: /src/data_structures.rs pub mod segment_tree; pub mod containers; pub <|fim_middle|>mod heap; pub mod tree; pub mod avl_tree; pub m
code_fim
easy
{ "lang": "rust", "repo": "niuez/cp-rust-library", "path": "/src/data_structures.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }