text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> pub fn invalidate(&mut self, name: &GlyphName) { let cache = Arc::make_mut(&mut self.beziers); for glyph in self.components.glyphs_containing_component(name).iter() { self.pre_cache.remove(glyph); cache.remove(glyph); } } pub fn rebuild<'a, F>(&...
code_fim
hard
{ "lang": "rust", "repo": "linebender/runebender", "path": "/runebender-lib/src/bez_cache.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> } } impl R { #[doc = "Bit 31 - 31:31\\] If this bit is cleared to 0, the DMA operation involves only data. If this bit is set, the DMA operation includes a TAG (Authentication Result / Digest). For SHA-256 operation, a DMA must be set up for both input data and TAG. For any other selected module,...
code_fim
hard
{ "lang": "rust", "repo": "pipex/cc2538", "path": "/src/aes/ctrl_alg_sel.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pipex/cc2538 path: /src/aes/ctrl_alg_sel.rs #[doc = "Reader of register CTRL_ALG_SEL"] pub type R = crate::R<u32, super::CTRL_ALG_SEL>; #[doc = "Writer for register CTRL_ALG_SEL"] pub type W = crate::W<u32, super::CTRL_ALG_SEL>; #[doc = "Register CTRL_ALG_SEL `reset()`'s with value 0"] impl crat...
code_fim
hard
{ "lang": "rust", "repo": "pipex/cc2538", "path": "/src/aes/ctrl_alg_sel.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bmc-msft/command-group path: /src/stdlib/unix.rs use std::{ io::{Error, Result}, os::unix::process::CommandExt, process::Command, }; <|fim_suffix|> self.spawn().map(GroupChild::new) } }<|fim_middle|>use crate::{CommandGroup, GroupChild}; use nix::unistd::setsid; impl CommandGroup for Comm...
code_fim
hard
{ "lang": "rust", "repo": "bmc-msft/command-group", "path": "/src/stdlib/unix.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.spawn().map(GroupChild::new) } }<|fim_prefix|>// repo: bmc-msft/command-group path: /src/stdlib/unix.rs use std::{ io::{Error, Result}, os::unix::process::CommandExt, process::Command, }; <|fim_middle|>use crate::{CommandGroup, GroupChild}; use nix::unistd::setsid; impl CommandGroup for Comm...
code_fim
hard
{ "lang": "rust", "repo": "bmc-msft/command-group", "path": "/src/stdlib/unix.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub fn topic_filter( db: SqlitePool, ) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { warp::path!("topic" / i32) .and(with_db(db)) .and_then(topic_handler) } async fn topic_handler(topic_id: i32, pool: SqlitePool) -> Result<impl Reply, Rejection> { let topic...
code_fim
hard
{ "lang": "rust", "repo": "collective-ps/upsb_v3", "path": "/src/filters.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: collective-ps/upsb_v3 path: /src/filters.rs use std::time::{Duration, SystemTime}; use warp::http::{Response, StatusCode}; use warp::{Filter, Rejection, Reply}; use crate::models; use crate::templates::{self, statics::StaticFile, RenderRucte}; use crate::SqlitePool; /// Home page handler; just...
code_fim
hard
{ "lang": "rust", "repo": "collective-ps/upsb_v3", "path": "/src/filters.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>async fn member_handler(member_id: i32, pool: SqlitePool) -> Result<impl Reply, Rejection> { let member = models::members::get(&pool, member_id) .await .map_err(|_| warp::reject::not_found())?; Response::builder().html(|o| templates::member(o, &member)) } pub fn topic_filter( ...
code_fim
hard
{ "lang": "rust", "repo": "collective-ps/upsb_v3", "path": "/src/filters.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: prz23/zinc path: /zinc-const/src/size.rs //! //! The Zinc size in bytes constants. //! <|fim_suffix|>/// The ETH private key size. pub const ETH_PRIVATE_KEY: usize = 32;<|fim_middle|>/// The `sha256` hash size. pub const SHA256_HASH: usize = 32; /// The ETH address size. pub const ETH_ADDRESS:...
code_fim
medium
{ "lang": "rust", "repo": "prz23/zinc", "path": "/zinc-const/src/size.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// The ETH public key size. pub const ETH_PUBLIC_KEY: usize = 64; /// The ETH private key size. pub const ETH_PRIVATE_KEY: usize = 32;<|fim_prefix|>// repo: prz23/zinc path: /zinc-const/src/size.rs //! //! The Zinc size in bytes constants. //! <|fim_middle|>/// The `sha256` hash size. pub const SHA256...
code_fim
medium
{ "lang": "rust", "repo": "prz23/zinc", "path": "/zinc-const/src/size.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> &self.params } } pub struct Select<M> { m: std::marker::PhantomData<M>, } impl<M> Query for Select<M> { type ReturnType = M; type QueryMarker = Incomplete; type Parameters = (); fn parameters(&self) -> &() { &() } } pub fn select<M>() -> Select<M> { Sele...
code_fim
hard
{ "lang": "rust", "repo": "skade/tbd-again", "path": "/tbd-core/src/query.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: skade/tbd-again path: /tbd-core/src/query.rs use crate::types::*; use crate::types; use futures::prelude::*; pub struct Limit<Q> { max: usize, inner: Q, } pub struct FindParameters<PK> { pub id: PK } pub struct Find<PK, Q> { params: FindParameters<PK>, query: Limit<Q>, } ...
code_fim
hard
{ "lang": "rust", "repo": "skade/tbd-again", "path": "/tbd-core/src/query.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> type FutureType = <<Repos as Repository>::Gateway as ExecuteAll<ReturnType>>::Stream; default fn execute(&self, repos: &Repos) -> Self::FutureType where Repos: Stores<R> { types::ExecuteAll::execute_query(repos.gateway(), &self) } } impl<Repos, R, ReturnType, PK> Execute<Repo...
code_fim
hard
{ "lang": "rust", "repo": "skade/tbd-again", "path": "/tbd-core/src/query.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match pattern.as_str() { "01" => day01::run(), "02" => day02::run(), "03" => day03::run(), "04" => day04::run(), "05" => day05::run(), "06" => day06::run(), _ => { day01::run(); day02::run(); day03::run(); day04::run(); day05::run(); day06::run(); }, } }<|f...
code_fim
medium
{ "lang": "rust", "repo": "mawir157/AOC-2020", "path": "/Rust/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mawir157/AOC-2020 path: /Rust/src/main.rs mod advent_helper; mod day01; mod day02; mod day03; mod day04; mod day05; mod day06; <|fim_suffix|> match pattern.as_str() { "01" => day01::run(), "02" => day02::run(), "03" => day03::run(), "04" => day04::run(), "05" => day05::run(), ...
code_fim
medium
{ "lang": "rust", "repo": "mawir157/AOC-2020", "path": "/Rust/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[aoc(day10, part2)] fn part2(input: &[usize]) -> u64 { let goal = input.last().unwrap(); let mut cache = HashMap::new(); for &i in input { cache.insert(i, 0); if i <= 3 { cache.entry(i).and_modify(|v| *v += 1); } let end = i.min(3); let t...
code_fim
hard
{ "lang": "rust", "repo": "jtdowney/advent-2020", "path": "/src/day10.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jtdowney/advent-2020 path: /src/day10.rs use std::collections::HashMap; use itertools::Itertools; #[aoc_generator(day10)] fn generator(input: &str) -> Vec<usize> { input .lines() .map(str::parse) .map(Result::unwrap) .sorted() .collect() } #[aoc(day...
code_fim
medium
{ "lang": "rust", "repo": "jtdowney/advent-2020", "path": "/src/day10.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let end = i.min(3); let total = (1..=end) .filter_map(|n| { let index = i - n; cache.get(&index) }) .sum::<u64>(); cache.entry(i).and_modify(|v| *v += total); } cache[goal] }<|fim_prefix|>// repo: jtdowney...
code_fim
hard
{ "lang": "rust", "repo": "jtdowney/advent-2020", "path": "/src/day10.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<T, F> std::future::Future for PollFn<F> where F: FnMut(&mut Context<'_>) -> Poll<T>, { type Output = T; fn poll(mut self: std::pin::Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<T> { (&mut self.f)(cx) } }<|fim_prefix|>// repo: Icelk/async-chunked-transfer path: /src/lib.rs /...
code_fim
medium
{ "lang": "rust", "repo": "Icelk/async-chunked-transfer", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Icelk/async-chunked-transfer path: /src/lib.rs // Copyright 2015 The tiny-http Contributors // Copyright 2015 The rust-chunked-transfer Contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You ma...
code_fim
hard
{ "lang": "rust", "repo": "Icelk/async-chunked-transfer", "path": "/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: maekawatoshiki/rucc path: /src/lib.rs pub mod common; pub mod error; pub mod lexer; pub mod node; pub mod parser; pub mod codegen; pub mod types; <|fim_suffix|>use std::sync::Mutex; use std::marker::Send; unsafe impl Send for codegen::Codegen {} lazy_static! { static ref CODEGEN: Mutex<co...
code_fim
medium
{ "lang": "rust", "repo": "maekawatoshiki/rucc", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>lazy_static! { static ref CODEGEN: Mutex<codegen::Codegen> = { unsafe { Mutex::new(codegen::Codegen::new("rucc")) } }; }<|fim_prefix|>// repo: maekawatoshiki/rucc path: /src/lib.rs pub mod common; pub mod error; pub mod lexer; pub mod node; pub mod parser; pub mod code...
code_fim
medium
{ "lang": "rust", "repo": "maekawatoshiki/rucc", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub(crate) fn datebox<MSG>( v: String, attributes: impl IntoIterator<Item = Attribute<MSG>>, ) -> Node<MSG> { input([r#type("date"), class("datebox"), value(v)], []).with_attributes(attributes) } /// accepts the checked, container attributes and the actual checkbox attributes pub(crate) fn ch...
code_fim
hard
{ "lang": "rust", "repo": "ivanceras/sauron", "path": "/examples/data-viewer/src/widgets.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ivanceras/sauron path: /examples/data-viewer/src/widgets.rs use sauron::{ html::{attributes::*, units::px, *}, Attribute, Node, }; use search_widget::SearchWidget; mod search_widget; pub(crate) fn textbox<MSG, V: ToString>( v: V, attributes: impl IntoIterator<Item = Attribute<M...
code_fim
hard
{ "lang": "rust", "repo": "ivanceras/sauron", "path": "/examples/data-viewer/src/widgets.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// accepts the checked, container attributes and the actual checkbox attributes pub(crate) fn checkbox<MSG>( checked: bool, container_attributes: impl IntoIterator<Item = Attribute<MSG>>, attributes: impl IntoIterator<Item = Attribute<MSG>>, ) -> Node<MSG> { div( [class("checkbox"...
code_fim
hard
{ "lang": "rust", "repo": "ivanceras/sauron", "path": "/examples/data-viewer/src/widgets.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match self { $($name::$variant => String::from(stringify!($variant))),* } } } }; }<|fim_prefix|>// repo: Rexagon/eravpn-updater path: /src/messages_enum.rs #[macro_export] macro_rules! messages_enum { ($visibility:vis enum $n...
code_fim
hard
{ "lang": "rust", "repo": "Rexagon/eravpn-updater", "path": "/src/messages_enum.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Rexagon/eravpn-updater path: /src/messages_enum.rs #[macro_export] macro_rules! messages_enum { ($visibility:vis enum $name:ident { $($variant:ident),*, }) => { $visibility enum $name { $($variant),* } <|fim_suffix|> match self { ...
code_fim
hard
{ "lang": "rust", "repo": "Rexagon/eravpn-updater", "path": "/src/messages_enum.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>f val > min { if val < max { val } else { max } } else { min } }<|fim_prefix|>// repo: maxcohn/ray-tracing-one-weekend-rs path: /src/util.rs #[inline] /// Clamp the given value between the upper and lower <|fim_middle|>bounds pub fn clamp(va...
code_fim
medium
{ "lang": "rust", "repo": "maxcohn/ray-tracing-one-weekend-rs", "path": "/src/util.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: maxcohn/ray-tracing-one-weekend-rs path: /src/util.rs #[inline] /// Clamp the given value between the upper and lower <|fim_suffix|>lse { max } } else { min } }<|fim_middle|>bounds pub fn clamp(val: f64, min: f64, max: f64) -> f64 { if val > min { ...
code_fim
medium
{ "lang": "rust", "repo": "maxcohn/ray-tracing-one-weekend-rs", "path": "/src/util.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>lse { max } } else { min } }<|fim_prefix|>// repo: maxcohn/ray-tracing-one-weekend-rs path: /src/util.rs #[inline] /// Clamp the given value between the upper and lower bounds pub fn clamp(val: f64, min: f64, max: f64) -> f64 { i<|fim_middle|>f val > min { ...
code_fim
medium
{ "lang": "rust", "repo": "maxcohn/ray-tracing-one-weekend-rs", "path": "/src/util.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: John2143/aoc2020 path: /src/p9.rs use regex::Regex; #[derive(Debug)] struct BagList { amount: usize, id: usize, } #[derive(Debug)] struct Bag<'a> { name: &'a str, id: usize, contents: Option<Vec<BagList>>, } impl Bag<'_> { fn can_contain_gold(&self, rules: &RuleList) -...
code_fim
hard
{ "lang": "rust", "repo": "John2143/aoc2020", "path": "/src/p9.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn get_bag_by_name_mut(&mut self, name: &'_ str) -> Option<&mut Bag<'bag>> { self.1.iter_mut().find(|x| x.name == name) } fn get_bag_by_name(&self, name: &'_ str) -> Option<&Bag<'bag>> { self.1.iter().find(|x| x.name == name) } fn get_bag(&self, id: usize) -> &Bag<'_>...
code_fim
hard
{ "lang": "rust", "repo": "John2143/aoc2020", "path": "/src/p9.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn should_remove_thing_from_trie_hash_map() { let key = get_expected_key_of_thing_in_trie_hash_map(); let trie_hash_map = get_new_trie_hash_map().unwrap(); let updated_trie_hash_map = put_thing_in_trie_hash_map(trie_hash_map, key, get_thing_to_put_in_tri...
code_fim
hard
{ "lang": "rust", "repo": "provable-things/ptokens-core", "path": "/src/chains/evm/get_trie_hash_map.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: provable-things/ptokens-core path: /src/chains/evm/get_trie_hash_map.rs use ethereum_types::H256; use crate::{ chains::evm::eth_types::TrieHashMap, types::{Bytes, Result}, }; pub fn get_new_trie_hash_map() -> Result<TrieHashMap> { Ok(std::collections::HashMap::new()) } pub fn put_...
code_fim
hard
{ "lang": "rust", "repo": "provable-things/ptokens-core", "path": "/src/chains/evm/get_trie_hash_map.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn fail_on_non_iterator() { let actual = nu!(cwd: ".", pipeline("1 | reverse")); assert!(actual.err.contains("only_supports_this_input_type")); }<|fim_prefix|>// repo: JosephTLyons/nushell path: /crates/nu-command/tests/commands/reverse.rs use nu_test_support::{nu, pipeline}; #[test] fn...
code_fim
medium
{ "lang": "rust", "repo": "JosephTLyons/nushell", "path": "/crates/nu-command/tests/commands/reverse.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JosephTLyons/nushell path: /crates/nu-command/tests/commands/reverse.rs use nu_test_support::{nu, pipeline}; #[test] fn can_get_reverse_first() { <|fim_suffix|> assert_eq!(actual.out, "utf16.ini"); } #[test] fn fail_on_non_iterator() { let actual = nu!(cwd: ".", pipeline("1 | reverse"))...
code_fim
medium
{ "lang": "rust", "repo": "JosephTLyons/nushell", "path": "/crates/nu-command/tests/commands/reverse.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let center = self.center(ray.time()); let oc = ray.origin() - center; let a = ray.direction().squared_norm(); let b = oc.dot(ray.direction()); let c = oc.squared_norm() - self.radius * self.radius; let discriminant = b * b - a * c; if discriminant > ...
code_fim
hard
{ "lang": "rust", "repo": "rgcottrell/raytracer-rs", "path": "/src/surface/moving_sphere.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rgcottrell/raytracer-rs path: /src/surface/moving_sphere.rs use crate::hit_record::HitRecord; use crate::material::Material; use crate::ray::Ray; use crate::surface::Surface; use crate::vector::Vector3; #[derive(Debug)] pub struct MovingSphere { center0: Vector3, center1: Vector3, t...
code_fim
medium
{ "lang": "rust", "repo": "rgcottrell/raytracer-rs", "path": "/src/surface/moving_sphere.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.center0 + ((time - self.time0) / (self.time1 - self.time0)) * (self.center1 - self.center0) } } impl Surface for MovingSphere { fn hit(&self, ray: &Ray, tmin: f32, tmax: f32) -> Option<HitRecord> { let center = self.center(ray.time()); let oc = ray.origin(...
code_fim
hard
{ "lang": "rust", "repo": "rgcottrell/raytracer-rs", "path": "/src/surface/moving_sphere.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut line = String::new(); input.read_line(&mut line).ok().unwrap(); let test_cases = line.trim().parse().unwrap(); for _ in 0..test_cases { line.clear(); input.read_line(&mut line).ok().unwrap(); let n: u64 = line.trim().parse().unwrap(); println!("{}", solve(n)); } } fn m...
code_fim
medium
{ "lang": "rust", "repo": "kdar/challenges", "path": "/hackerrank/contests/project_euler/rust/src/bin/p0005_smallest_multiple.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn lcm(a: u64, b: u64) -> u64 { a * b / gcd(a, b) } fn solve(n: u64) -> u64 { let mut a = 1u64; for i in 1..n+1 { a = lcm(a, i); } a } fn setup(input: &mut BufRead) { let mut line = String::new(); input.read_line(&mut line).ok().unwrap(); let test_cases = line.trim().parse().unwrap()...
code_fim
medium
{ "lang": "rust", "repo": "kdar/challenges", "path": "/hackerrank/contests/project_euler/rust/src/bin/p0005_smallest_multiple.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kdar/challenges path: /hackerrank/contests/project_euler/rust/src/bin/p0005_smallest_multiple.rs use std::io::{BufReader, BufRead}; use std::env; #[allow(dead_code)] static TEST: &'static str = "2 3 10"; fn gcd(mut a: u64, mut b: u64) -> u64 { if a < b { let t = b; b = a; a = t; ...
code_fim
hard
{ "lang": "rust", "repo": "kdar/challenges", "path": "/hackerrank/contests/project_euler/rust/src/bin/p0005_smallest_multiple.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: prisma/prisma-engines path: /quaint/src/ast/cte.rs use std::borrow::Cow; use super::SelectQuery; /// A builder for a common table expression (CTE) statement, to be used in the /// `WITH` block of a `SELECT` statement. /// /// See [`Select#with`] for usage. /// /// [`Select#with`]: struct.Selec...
code_fim
hard
{ "lang": "rust", "repo": "prisma/prisma-engines", "path": "/quaint/src/ast/cte.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> where Self: Into<SelectQuery<'a>>, { CommonTableExpression { identifier: identifier.into(), columns: Vec::new(), selection: self.into(), } } }<|fim_prefix|>// repo: prisma/prisma-engines path: /quaint/src/ast/cte.rs use std::borrow::...
code_fim
hard
{ "lang": "rust", "repo": "prisma/prisma-engines", "path": "/quaint/src/ast/cte.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: baitcenter/mori path: /functional_rbt/src/lib.rs #[derive(Debug, Copy, Clone, PartialEq)] pub enum Color { Red, Black, } #[derive(Debug)] pub enum Tree<T> { Empty, NonEmpty(Box<Node<T>>), } #[derive(Debug)] pub struct Node<T> { color: Color, element: T, left: Tree<T...
code_fim
hard
{ "lang": "rust", "repo": "baitcenter/mori", "path": "/functional_rbt/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn insert(self, element: T) -> Tree<T> { let tree = self.ins(element); match tree { Tree::NonEmpty(node) => { Tree::new( Color::Black, node.element, node.left, node.right, ...
code_fim
hard
{ "lang": "rust", "repo": "baitcenter/mori", "path": "/functional_rbt/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nuta/archives path: /resea-old-rust-kernel/kernel/arch/x64/poweroff.rs use super::asm; pub unsafe fn poweroff() -> ! { // Bochs asm::outw(0xb004, 0x2000); <|fim_suffix|> panic!("failed to power off"); }<|fim_middle|> // QEMU asm::outb(0xf4, 0x00);
code_fim
easy
{ "lang": "rust", "repo": "nuta/archives", "path": "/resea-old-rust-kernel/kernel/arch/x64/poweroff.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> panic!("failed to power off"); }<|fim_prefix|>// repo: nuta/archives path: /resea-old-rust-kernel/kernel/arch/x64/poweroff.rs use super::asm; pub unsafe fn poweroff() -> ! { // Bochs asm::outw(0xb004, 0x2000); <|fim_middle|> // QEMU asm::outb(0xf4, 0x00);
code_fim
easy
{ "lang": "rust", "repo": "nuta/archives", "path": "/resea-old-rust-kernel/kernel/arch/x64/poweroff.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match op{ Command::Set(k, v) => { match engine.set(k, v){ Err(_) => { Response::Error(ServerError::OtherError) }, Ok(_) => { Response::Null } ...
code_fim
hard
{ "lang": "rust", "repo": "Dizans/kvs", "path": "/src/bin/kvs-server.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Dizans/kvs path: /src/bin/kvs-server.rs use std::net::{ SocketAddr, TcpListener, TcpStream }; use std::io::{ Write, prelude::*, }; use std::path::PathBuf; use log::{info, error}; use clap::{crate_authors, crate_description, crate_name, crate_version}; use clap::{App, Arg, Ap...
code_fim
hard
{ "lang": "rust", "repo": "Dizans/kvs", "path": "/src/bin/kvs-server.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chaoshengt/string2path path: /src/rust/src/builder.rs use lyon::math::point; pub struct LyonPathBuilder { // It's not very elegant to store the glyph ID (not the `glyphId` ttf-parser // uses, but the glyph count) and path ID in attributes, but it seems the // attribute is the only t...
code_fim
hard
{ "lang": "rust", "repo": "chaoshengt/string2path", "path": "/src/rust/src/builder.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl ttf_parser::OutlineBuilder for LyonPathBuilder { fn move_to(&mut self, x: f32, y: f32) { self.builder.begin(self.point(x, y), &self.ids()); } fn line_to(&mut self, x: f32, y: f32) { self.builder.line_to(self.point(x, y), &self.ids()); } fn quad_to(&mut self, x1: ...
code_fim
medium
{ "lang": "rust", "repo": "chaoshengt/string2path", "path": "/src/rust/src/builder.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Editor { pub fn state(&mut self) -> State { let formatter = EmptyWrapper::new(Short::with_accuracy(Accuracy::Hundredths)); let icon_change = self.run .game_icon() .check_for_change(&mut self.game_icon_id) .map(str::to_owned); let game =...
code_fim
hard
{ "lang": "rust", "repo": "Kigoli/livesplit-core", "path": "/src/run/editor/state.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Kigoli/livesplit-core path: /src/run/editor/state.rs use super::{Editor, SegmentRow, TimingMethod}; use comparison::personal_best; use time::formatter::{Accuracy, Short, TimeFormatter}; use time::formatter::none_wrapper::EmptyWrapper; use serde_json::{to_writer, Result as JsonResult}; use std::i...
code_fim
hard
{ "lang": "rust", "repo": "Kigoli/livesplit-core", "path": "/src/run/editor/state.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let buttons = Buttons { can_remove: self.can_remove_segments(), can_move_up: self.can_move_segments_up(), can_move_down: self.can_move_segments_down(), }; let mut segments = Vec::with_capacity(self.run.len()); self.segment_icon_ids.resiz...
code_fim
hard
{ "lang": "rust", "repo": "Kigoli/livesplit-core", "path": "/src/run/editor/state.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let _ = try_join!(a, b).unwrap(); }<|fim_prefix|>// repo: kc5nra/srt-rs path: /tests/rendezvous.rs use srt::SrtSocketBuilder; use futures::try_join; <|fim_middle|>#[tokio::test] async fn rendezvous() { let a = SrtSocketBuilder::new_rendezvous("127.0.0.1:5000") .local_port(5001) ...
code_fim
hard
{ "lang": "rust", "repo": "kc5nra/srt-rs", "path": "/tests/rendezvous.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kc5nra/srt-rs path: /tests/rendezvous.rs use srt::SrtSocketBuilder; use futures::try_join; <|fim_suffix|> let _ = try_join!(a, b).unwrap(); }<|fim_middle|>#[tokio::test] async fn rendezvous() { let a = SrtSocketBuilder::new_rendezvous("127.0.0.1:5000") .local_port(5001) ...
code_fim
hard
{ "lang": "rust", "repo": "kc5nra/srt-rs", "path": "/tests/rendezvous.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>the Zulip API to be unstable; it is used only for UI elements for administering bots and is likely to change. #[serde(rename = "services", skip_serializing_if = "Option::is_none")] pub services: Option<Vec<crate::models::OneOfobjectobject>>, } impl BasicBotBase { pub fn new() -> BasicBotBase...
code_fim
hard
{ "lang": "rust", "repo": "MSurfer20/test2", "path": "/rust/src/models/basic_bot_base.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>erde(rename = "default_all_public_streams", skip_serializing_if = "Option::is_none")] pub default_all_public_streams: Option<bool>, /// The URL of the bot's avatar. #[serde(rename = "avatar_url", skip_serializing_if = "Option::is_none")] pub avatar_url: Option<String>, /// The user id...
code_fim
hard
{ "lang": "rust", "repo": "MSurfer20/test2", "path": "/rust/src/models/basic_bot_base.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MSurfer20/test2 path: /rust/src/models/basic_bot_base.rs /* * Zulip REST API * * Powerful open source group chat * * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ...
code_fim
hard
{ "lang": "rust", "repo": "MSurfer20/test2", "path": "/rust/src/models/basic_bot_base.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Daniel-Worrall/miri path: /tests/compile-fail/unaligned_pointers/unaligned_ptr_zst.rs // This should fail even without validation // compile-flags: -Zmiri-disable-validation <|fim_suffix|> let x = &2u16; let x = x as *const _ as *const [u32; 0]; // This must fail because alignment is...
code_fim
easy
{ "lang": "rust", "repo": "Daniel-Worrall/miri", "path": "/tests/compile-fail/unaligned_pointers/unaligned_ptr_zst.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let x = &2u16; let x = x as *const _ as *const [u32; 0]; // This must fail because alignment is violated. Test specifically for loading ZST. let _x = unsafe { *x }; //~^ ERROR memory with alignment 2, but alignment 4 is required }<|fim_prefix|>// repo: Daniel-Worrall/miri path: /tests...
code_fim
easy
{ "lang": "rust", "repo": "Daniel-Worrall/miri", "path": "/tests/compile-fail/unaligned_pointers/unaligned_ptr_zst.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Yamaguchi/tapyrus-signer path: /src/signer_node/mod.rs Ok(_) => ControlFlow::Continue, Err(error) => { log::warn!("Happened error!: {:?}", error); ControlFlow::Break(()) } }; let id = self.para...
code_fim
hard
{ "lang": "rust", "repo": "Yamaguchi/tapyrus-signer", "path": "/src/signer_node/mod.rs", "mode": "psm", "license": "GPL-1.0-or-later", "source": "the-stack-v2" }
<|fim_suffix|> // This signer is not member of the federation. let public_key = PublicKey::from_str( "023cb7d6326e33332d04d026be1a04cdaf084703d8dc75322182d8fb314a03a877", ) .unwrap(); let result = node.is_federation_member(&SignerID::new(public_key)); assert!(!...
code_fim
hard
{ "lang": "rust", "repo": "Yamaguchi/tapyrus-signer", "path": "/src/signer_node/mod.rs", "mode": "spm", "license": "GPL-1.0-or-later", "source": "the-stack-v2" }
<|fim_suffix|> let public_key = TEST_KEYS.pubkeys()[4]; let arc_block = safety(get_block(0)); let rpc = MockRpc { return_block: arc_block.clone(), }; let node = create_node( NodeState::Member { block_key: None, block_shared_k...
code_fim
hard
{ "lang": "rust", "repo": "Yamaguchi/tapyrus-signer", "path": "/src/signer_node/mod.rs", "mode": "spm", "license": "GPL-1.0-or-later", "source": "the-stack-v2" }
<|fim_suffix|> let h = self.hour(); let m = self.minute(); return write!(f, "{:>02}:{:>02}", h, m); } } impl PartialEq for Timer { fn eq(&self, another: &Timer) -> bool { return self.hour() == another.hour() && self.minute() == another.minute(); } } impl Debug for Timer { ...
code_fim
medium
{ "lang": "rust", "repo": "hsmtkk/cuddly-guacamole", "path": "/src/clock.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hsmtkk/cuddly-guacamole path: /src/clock.rs use std::fmt::Debug; use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Result; pub struct Timer { minute: i64, } impl Timer { pub fn new() -> Timer { return Timer { minute: 0 }; } pub fn hour(&self) -> i64 { ...
code_fim
hard
{ "lang": "rust", "repo": "hsmtkk/cuddly-guacamole", "path": "/src/clock.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Devolutions/devolutions-gateway path: /devolutions-gateway/src/api/jmux.rs use std::net::SocketAddr; use axum::extract::ws::WebSocket; use axum::extract::{ConnectInfo, State, WebSocketUpgrade}; use axum::response::Response; use tracing::Instrument as _; use crate::extract::JmuxToken; use crate...
code_fim
hard
{ "lang": "rust", "repo": "Devolutions/devolutions-gateway", "path": "/devolutions-gateway/src/api/jmux.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let result = crate::jmux::handle(stream, claims, sessions, subscriber_tx) .instrument(info_span!("jmux", client = %source_addr)) .await; if let Err(error) = result { error!(client = %source_addr, error = format!("{error:#}"), "JMUX failure"); } }<|fim_prefix|>// repo: ...
code_fim
hard
{ "lang": "rust", "repo": "Devolutions/devolutions-gateway", "path": "/devolutions-gateway/src/api/jmux.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ftilde/rust-x86asm path: /src/test/instruction_tests/instr_vpmovusdw.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 vpmovusdw_1...
code_fim
hard
{ "lang": "rust", "repo": "ftilde/rust-x86asm", "path": "/src/test/instruction_tests/instr_vpmovusdw.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn vpmovusdw_9() { run_test( &Instruction { mnemonic: Mnemonic::VPMOVUSDW, operand1: Some(Direct(YMM4)), operand2: Some(Direct(ZMM6)), operand3: None, operand4: None, lock: false, rounding_mode: None, ...
code_fim
hard
{ "lang": "rust", "repo": "ftilde/rust-x86asm", "path": "/src/test/instruction_tests/instr_vpmovusdw.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // TODO: follow arch_init procedure panic!("Nothing left to do."); }<|fim_prefix|>// repo: kludge-cs/elysian-os path: /src/main.rs #![feature(asm)] #![no_main] #![no_std] #![feature(custom_test_frameworks)] #![test_runner(test::test_runner)] #![reexport_test_harness_main = "test_main"] <|fim_middle|>...
code_fim
medium
{ "lang": "rust", "repo": "kludge-cs/elysian-os", "path": "/src/main.rs", "mode": "spm", "license": "LicenseRef-scancode-other-permissive", "source": "the-stack-v2" }
<|fim_suffix|>#[no_mangle] pub extern "C" fn _start() -> ! { #[cfg(test)] test_main(); // TODO: follow arch_init procedure panic!("Nothing left to do."); }<|fim_prefix|>// repo: kludge-cs/elysian-os path: /src/main.rs #![feature(asm)] #![no_main] #![no_std] #![feature(custom_test_frameworks)] #![test_runner(test...
code_fim
medium
{ "lang": "rust", "repo": "kludge-cs/elysian-os", "path": "/src/main.rs", "mode": "spm", "license": "LicenseRef-scancode-other-permissive", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kludge-cs/elysian-os path: /src/main.rs #![feature(asm)] #![no_main] #![no_std] #![feature(custom_test_frameworks)] #![test_runner(test::test_runner)] #![reexport_test_harness_main = "test_main"] <|fim_suffix|>#[no_mangle] pub extern "C" fn _start() -> ! { #[cfg(test)] test_main(); // TODO:...
code_fim
medium
{ "lang": "rust", "repo": "kludge-cs/elysian-os", "path": "/src/main.rs", "mode": "psm", "license": "LicenseRef-scancode-other-permissive", "source": "the-stack-v2" }
<|fim_suffix|> match s { Ok(v) => { if handler.has_errors() { Err(()) } else { Ok(v) } } Err(err) => panic!("Error: {:?}", err), } }) }<|fim_prefix|>// repo: vjpr/swc-wallaby p...
code_fim
hard
{ "lang": "rust", "repo": "vjpr/swc-wallaby", "path": "/tests/ranges.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vjpr/swc-wallaby path: /tests/ranges.rs use anyhow::{Context as _, Error}; use std::path::PathBuf; use std::sync::Arc; use swc::common::FileName; use swc::config::{Options, SourceMapsConfig}; use swc::{Compiler, TransformOutput}; use swc_ecmascript::ast::Program; use swc_wallaby::transform::{ ...
code_fim
hard
{ "lang": "rust", "repo": "vjpr/swc-wallaby", "path": "/tests/ranges.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn is_comment(&self) -> bool { match self { Self::ConcreteLineToken(clt) => clt.is_comment(), _ => false, } } pub fn into_ruby(self) -> String { match self { Self::BreakableEntry(be) => be .into_tokens(ConvertType...
code_fim
hard
{ "lang": "rust", "repo": "tadast/rubyfmt", "path": "/librubyfmt/src/line_tokens.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tadast/rubyfmt path: /librubyfmt/src/line_tokens.rs use crate::render_targets::{AbstractTokenTarget, BreakableEntry, ConvertType}; // represents something that will actually end up as a ruby token, as opposed to // something that has to be transformd to become a ruby token #[derive(Debug, Clone...
code_fim
hard
{ "lang": "rust", "repo": "tadast/rubyfmt", "path": "/librubyfmt/src/line_tokens.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dmolokanov/appinsights-rs path: /appinsights/src/telemetry/metric/stats.rs /// Stores statistics for aggregated metric. #[derive(Debug, PartialEq, Default)] pub struct Stats { /// Sampled value. pub(crate) value: f64, /// Minimum value of the aggregated metric. pub(crate) min: f...
code_fim
hard
{ "lang": "rust", "repo": "dmolokanov/appinsights-rs", "path": "/appinsights/src/telemetry/metric/stats.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use test_case::test_case; use super::*; #[test_case(&[], 0.0, 0.0, 0.0 ; "for empty collection")] #[test_case(&[0.0], 0.0, 0.0, 0.0 ; "for single zero value")] #[test_case(&[50.0], ...
code_fim
hard
{ "lang": "rust", "repo": "dmolokanov/appinsights-rs", "path": "/appinsights/src/telemetry/metric/stats.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sciyoshi/euler path: /src/problem95.rs use primal::Sieve; #[derive(Copy, Clone, Debug, PartialEq)] enum Aliquot { Unknown, Known, Cyclic(u16), Escapes(u16), EventuallyCyclic(u16, u16) } fn find_cycle(sieve: &Sieve, graph: &mut Vec<(usize, Aliquot)>, el: usize, stack: &mut Vec<usize>, limi...
code_fim
hard
{ "lang": "rust", "repo": "sciyoshi/euler", "path": "/src/problem95.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for prime in sieve.primes_from(2) { let mut sum = 1; let mut power = prime; while power < limit { nums[power] = (sum, Aliquot::Known); sum += power; power *= prime; } } for start in 2..limit { find_cycle(&sieve, &mut nums, start, &mut vec![], limit); } let result = (2..limit).re...
code_fim
hard
{ "lang": "rust", "repo": "sciyoshi/euler", "path": "/src/problem95.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Perlmint/xaml-island-rs-example path: /winrt-gen/build.rs fn main() { winrt::build!( windows::ui::xaml::controls::{Button, Page, StackPanel, TextBlock, TextBox, ListView} windows::ui::xaml::hosting:<|fim_suffix|>:XamlReader windows::ui::xaml::data::ICustomProper...
code_fim
medium
{ "lang": "rust", "repo": "Perlmint/xaml-island-rs-example", "path": "/winrt-gen/build.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>:XamlReader windows::ui::xaml::data::ICustomPropertyProvider ); }<|fim_prefix|>// repo: Perlmint/xaml-island-rs-example path: /winrt-gen/build.rs fn main() { winrt::build!( windows::ui::xaml::controls::{Button, Page, StackPanel, TextBlock, TextBox, ListView} window...
code_fim
medium
{ "lang": "rust", "repo": "Perlmint/xaml-island-rs-example", "path": "/winrt-gen/build.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: catplayer233/rust-train path: /smart-pointer-train/src/reference_cycle_explorer.rs use std::cell::RefCell; use std::rc::Rc; use crate::reference_cycle_explorer::List::Cons; use crate::reference_cycle_explorer::List::Nil; <|fim_suffix|>impl List { pub fn tail(&self) -> Option<&RefCell<Rc<Li...
code_fim
medium
{ "lang": "rust", "repo": "catplayer233/rust-train", "path": "/smart-pointer-train/src/reference_cycle_explorer.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl List { pub fn tail(&self) -> Option<&RefCell<Rc<List>>> { match self { Cons(item) => Some(item), Nil => None, } } }<|fim_prefix|>// repo: catplayer233/rust-train path: /smart-pointer-train/src/reference_cycle_explorer.rs use std::cell::RefCell; use std...
code_fim
medium
{ "lang": "rust", "repo": "catplayer233/rust-train", "path": "/smart-pointer-train/src/reference_cycle_explorer.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ftsell/pixelflut path: /rust/benches/pixmap_benchmark.rs use criterion::{black_box, criterion_group, criterion_main, Criterion}; use pixelflut::pixmap::{Color, FileBackedPixmap, InMemoryPixmap, Pixmap}; use std::time::Duration; use tempfile::tempdir; static COLOR: Color = Color(42, 42, 42); fn...
code_fim
hard
{ "lang": "rust", "repo": "ftsell/pixelflut", "path": "/rust/benches/pixmap_benchmark.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> group.bench_function("InMemoryPixmap", |b| { let pixmap = InMemoryPixmap::default(); pixmap.put_raw_data(&vec![COLOR; 42]).unwrap(); b.iter(|| pixmap.get_raw_data()) }); group.bench_function("FileBackedPixmap", |b| { let dir = tempdir().unwrap(); let pa...
code_fim
hard
{ "lang": "rust", "repo": "ftsell/pixelflut", "path": "/rust/benches/pixmap_benchmark.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Insert test let created_reorders = conn.create_multiple(&reorders).await?; assert_eq!(created_reorders, reorders); println!("Insert succeeded"); // Query test let queried_reorders = conn .query_multiple::<Reorder>("SELECT * FROM reorder WHERE prod_id IN (1,2,3,4,5)", &[...
code_fim
hard
{ "lang": "rust", "repo": "dutchmartin/sprattus", "path": "/sprattus-test/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dutchmartin/sprattus path: /sprattus-test/src/main.rs use crate::keywords::test_if_keywords_are_escaped; use chrono::*; use sprattus::*; mod keywords; #[derive(FromSql, ToSql, Eq, PartialEq, Debug)] #[sql(table = "reorder")] struct Reorder { #[sql(primary_key)] #[sql(name = "prod_id")]...
code_fim
hard
{ "lang": "rust", "repo": "dutchmartin/sprattus", "path": "/sprattus-test/src/main.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return p; } void operator delete(void *p, std::size_t) { std::free(p); } class MyClass: public QObject { W_OBJECT(MyClass) public: void cppSlot(const QString &msg) { const int8_t *s = reinterpret_cast<const int8_t *>(msg.toUtf8().constData()); rust![(s: *const i8) {...
code_fim
hard
{ "lang": "rust", "repo": "kdar/rustcxxqml", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kdar/rustcxxqml path: /src/main.rs #![feature(plugin)] #![plugin(rustcxx_plugin)] #[link(name = "Qt5Core")] #[link(name = "Qt5Gui")] #[link(name = "Qt5Widgets")] #[link(name = "Qt5Quick")] #[link(name = "Qt5Qml")] extern "C" {} <|fim_suffix|> void operator delete(void *p, std::size_t) { s...
code_fim
hard
{ "lang": "rust", "repo": "kdar/rustcxxqml", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let matches = App::new("ruma") .version(env!("CARGO_PKG_VERSION")) .about("A Matrix homeserver") .setting(AppSettings::GlobalVersion) .setting(AppSettings::SubcommandRequiredElseHelp) .subcommand( SubCommand::with_name("start") .about...
code_fim
medium
{ "lang": "rust", "repo": "rschulman/ruma", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rschulman/ruma path: /src/main.rs extern crate clap; extern crate hyper; extern crate iron; extern crate router; mod api { pub mod registration; } mod server; use clap::{App, AppSettings, SubCommand}; use server::Server; <|fim_suffix|> match matches.subcommand() { ("start", So...
code_fim
hard
{ "lang": "rust", "repo": "rschulman/ruma", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { let matches = App::new("ruma") .version(env!("CARGO_PKG_VERSION")) .about("A Matrix homeserver") .setting(AppSettings::GlobalVersion) .setting(AppSettings::SubcommandRequiredElseHelp) .subcommand( SubCommand::with_name("start") ...
code_fim
medium
{ "lang": "rust", "repo": "rschulman/ruma", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>orm(platform); v8::V8::initialize(); }<|fim_prefix|>// repo: isgasho/jstime path: /src/bootstrap.rs use rusty_v8 as v8; pub fn init () { let platform = v8::new_default_platform<|fim_middle|>().unwrap(); v8::V8::initialize_platf
code_fim
easy
{ "lang": "rust", "repo": "isgasho/jstime", "path": "/src/bootstrap.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/jstime path: /src/bootstrap.rs use rusty_v8 as v8; pub fn init () { <|fim_suffix|>().unwrap(); v8::V8::initialize_platform(platform); v8::V8::initialize(); }<|fim_middle|> let platform = v8::new_default_platform
code_fim
easy
{ "lang": "rust", "repo": "isgasho/jstime", "path": "/src/bootstrap.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub(crate) type SignedFixedPoint<T> = <T as vault_registry::Config>::SignedFixedPoint; pub(crate) type SignedInner<T> = <<T as vault_registry::Config>::SignedFixedPoint as FixedPointNumber>::Inner;<|fim_prefix|>// repo: datastark/interbtc path: /crates/nomination/src/types.rs use sp_arithmetic::FixedPoi...
code_fim
medium
{ "lang": "rust", "repo": "datastark/interbtc", "path": "/crates/nomination/src/types.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub(crate) type UnsignedFixedPoint<T> = <T as vault_registry::Config>::UnsignedFixedPoint; pub(crate) type SignedFixedPoint<T> = <T as vault_registry::Config>::SignedFixedPoint; pub(crate) type SignedInner<T> = <<T as vault_registry::Config>::SignedFixedPoint as FixedPointNumber>::Inner;<|fim_prefix|>//...
code_fim
easy
{ "lang": "rust", "repo": "datastark/interbtc", "path": "/crates/nomination/src/types.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: datastark/interbtc path: /crates/nomination/src/types.rs use sp_arithmetic::FixedPointNumber; pub(crate) type BalanceOf<T> = <T as vault_registry::Config>::Balance; <|fim_suffix|>pub(crate) type SignedInner<T> = <<T as vault_registry::Config>::SignedFixedPoint as FixedPointNumber>::Inner;<|fim...
code_fim
hard
{ "lang": "rust", "repo": "datastark/interbtc", "path": "/crates/nomination/src/types.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }