text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|>// repo: olkuksa/datanymizer path: /datanymizer_engine/src/transformers/token.rs
use crate::transformer::{TransformContext, TransformResult, TransformResultHelper, Transformer};
use rand::distributions::{Distribution, Uniform};
use serde::{Deserialize, Serialize};
const DEFAULT_LENGTH: usize = 32;
const... | code_fim | hard | {
"lang": "rust",
"repo": "olkuksa/datanymizer",
"path": "/datanymizer_engine/src/transformers/token.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert_eq!(member.name, "default");
}<|fim_prefix|>// repo: uplol/rust-etcd path: /tests/members_test.rs
use etcd::members;
use crate::test::TestClient;
mod test;
<|fim_middle|>#[tokio::test]
async fn list() {
let client = TestClient::no_destructor();
let members = members::list(&client).a... | code_fim | medium | {
"lang": "rust",
"repo": "uplol/rust-etcd",
"path": "/tests/members_test.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: uplol/rust-etcd path: /tests/members_test.rs
use etcd::members;
use crate::test::TestClient;
mod test;
<|fim_suffix|> assert_eq!(member.name, "default");
}<|fim_middle|>#[tokio::test]
async fn list() {
let client = TestClient::no_destructor();
let members = members::list(&client).a... | code_fim | medium | {
"lang": "rust",
"repo": "uplol/rust-etcd",
"path": "/tests/members_test.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>The following options allow the line number display to be customized:
--line-numbers-left-format: Change the contents of the left column
--line-numbers-right-format: Change the contents of the right column
--line-numbers-left-style: Change the style applied to the left column
--line-numbers-right-styl... | code_fim | hard | {
"lang": "rust",
"repo": "dandavison/delta",
"path": "/src/cli.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #[arg(
long = "hunk-header-decoration-style",
default_value = "blue box",
value_name = "STYLE"
)]
/// Style string for the hunk-header decoration.
///
/// See STYLES section. The style string should contain one of the special attributes 'box',
/// 'ul' (unde... | code_fim | hard | {
"lang": "rust",
"repo": "dandavison/delta",
"path": "/src/cli.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: dandavison/delta path: /src/cli.rs
ture\"]
syntax-theme = Dracula
plus-style = bold syntax \"#002800\"
To activate those options, you would use:
delta --features my-delta-feature
A feature name may not contain whitespace. You can activate multiple features:
[delta]
features = my-... | code_fim | hard | {
"lang": "rust",
"repo": "dandavison/delta",
"path": "/src/cli.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: DennisVanEe/rust_prism path: /rust_prism/src/scene.rs
use crate::bvh::{BVHObject, BVH};
use crate::geometry::Geometry;
use crate::interaction::{GeomIntr, Interaction};
use crate::light::Light;
use crate::shading::material::Material;
use crate::transform::Transf;
use pmath::bbox::BBox3;
use pmath... | code_fim | hard | {
"lang": "rust",
"repo": "DennisVanEe/rust_prism",
"path": "/rust_prism/src/scene.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl ScenePrim for SceneBVH {
fn get_transf(&self) -> Transf {
self.transf
}
fn get_light(&self) -> Option<Arc<dyn Light>> {
None
}
fn num_prims(&self) -> usize {
self.bvh.get_objects().len()
}
fn get_prim_at(&self, i: usize) -> &dyn ScenePrim {
... | code_fim | hard | {
"lang": "rust",
"repo": "DennisVanEe/rust_prism",
"path": "/rust_prism/src/scene.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: BreD1810/rust-search-sort path: /src/main.rs
use glutin_window::GlutinWindow as Window;
use opengl_graphics::{GlGraphics, OpenGL};
use piston::event_loop::{EventSettings, Events};
use piston::input::RenderEvent;
use piston::window::WindowSettings;
mod app;
mod array;
mod cli;
mod algorithms;
u... | code_fim | hard | {
"lang": "rust",
"repo": "BreD1810/rust-search-sort",
"path": "/src/main.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// The primary location of this diagnostic.
location: Location,
/// Related diagnostic information, such as other definitions in the case of
/// a duplicate definition error.
related_information: Vec<DiagnosticRelatedInformation>,
}
/// Secondary locations attached to a diagnostic.
... | code_fim | hard | {
"lang": "rust",
"repo": "poteto/relay",
"path": "/compiler/crates/common/src/diagnostic.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: poteto/relay path: /compiler/crates/common/src/diagnostic.rs
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
use crate::{Location, SourceLocationKey};
use ... | code_fim | hard | {
"lang": "rust",
"repo": "poteto/relay",
"path": "/compiler/crates/common/src/diagnostic.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>/// Secondary locations attached to a diagnostic.
#[derive(fmt::Debug)]
pub struct DiagnosticRelatedInformation {
/// The message of this related diagnostic information.
pub message: Box<dyn DiagnosticDisplay>,
/// The location of this related diagnostic information.
pub location: Locatio... | code_fim | hard | {
"lang": "rust",
"repo": "poteto/relay",
"path": "/compiler/crates/common/src/diagnostic.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let app = App {};
shapr_glium::run_app(app);
}<|fim_prefix|>// repo: RustigeMan/shapr_glium path: /examples/window.rs
extern crate shapr;
extern crate shapr_glium;
use shapr::Shp;
use shapr_glium::{AppConfig, ShaprGliumApp};
use std::time::Duration;
struct App {}
impl ShaprGliumApp for App {... | code_fim | medium | {
"lang": "rust",
"repo": "RustigeMan/shapr_glium",
"path": "/examples/window.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Shp::nil()
}
}
fn main() {
let app = App {};
shapr_glium::run_app(app);
}<|fim_prefix|>// repo: RustigeMan/shapr_glium path: /examples/window.rs
extern crate shapr;
extern crate shapr_glium;
use shapr::Shp;
use shapr_glium::{AppConfig, ShaprGliumApp};
<|fim_middle|>use std::time::... | code_fim | hard | {
"lang": "rust",
"repo": "RustigeMan/shapr_glium",
"path": "/examples/window.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: RustigeMan/shapr_glium path: /examples/window.rs
extern crate shapr;
extern crate shapr_glium;
<|fim_suffix|>fn main() {
let app = App {};
shapr_glium::run_app(app);
}<|fim_middle|>use shapr::Shp;
use shapr_glium::{AppConfig, ShaprGliumApp};
use std::time::Duration;
struct App {}
im... | code_fim | hard | {
"lang": "rust",
"repo": "RustigeMan/shapr_glium",
"path": "/examples/window.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut tbl = SymbolTable::toplevel();
let _ = tbl.define("a");
let _ = tbl.define("b");
let mut tbl = SymbolTable::enclose(tbl);
let _ = tbl.define("c");
let _ = tbl.define("d");
let a0 = Symbol {
name: "a".to_string(),
sco... | code_fim | hard | {
"lang": "rust",
"repo": "pacellie/monkey_lang",
"path": "/src/compiler/symbol.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut snd_local = SymbolTable::enclose(fst_local);
let _ = snd_local.define("e");
let _ = snd_local.define("f");
let a0 = Symbol {
name: "a".to_string(),
scope: Scope::Global,
index: 0,
};
let b0 = Symbol {
... | code_fim | hard | {
"lang": "rust",
"repo": "pacellie/monkey_lang",
"path": "/src/compiler/symbol.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: pacellie/monkey_lang path: /src/compiler/symbol.rs
use crate::builtin::Builtin;
use std::collections::HashMap;
use std::fmt;
use itertools::*;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Scope {
Global,
Local,
Free,
Builtin,
Function,
}
#[derive(Debug, Clone, Pa... | code_fim | hard | {
"lang": "rust",
"repo": "pacellie/monkey_lang",
"path": "/src/compiler/symbol.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: C14L/termpong path: /src/main.rs
// TODO: Fix angle calculation
// TODO: Change ball angle when ball hits corner of player
// TODO: Change ball angle when player moves while hitting the ball
// TODO: Allow players to move forwards and backwards
use std::str;
use rand::Rng;
use std::io::{stdout,... | code_fim | hard | {
"lang": "rust",
"repo": "C14L/termpong",
"path": "/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if event == Event::Key(KeyCode::Char('p').into()) {
is_paused = !is_paused;
}
if event == Event::Key(KeyCode::Char(' ').into()) {
if init_ball {
init_ball = false;
ball = Thing::new(XMAX / 2, YMAX ... | code_fim | hard | {
"lang": "rust",
"repo": "C14L/termpong",
"path": "/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Ok(Self {
http_version: Version::try_from(version)
.map_err(|_| MessageError::InvalidResponse(ResponseError::InvalidResponse))?, //todo fix with invalid_http_version
status_code: StatusCode::try_from(code)?,
status_message: message,
})
... | code_fim | hard | {
"lang": "rust",
"repo": "georgepisaltu/licenta",
"path": "/micro_http/src/response.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> (b"", b"", b"")
}
pub fn try_from(status_line: &[u8]) -> Result<Self, MessageError> {
let (version, code, message) = Self::parse_status_line(status_line);
let message = if message == b"" {
None
} else {
Some(
String::from_utf... | code_fim | hard | {
"lang": "rust",
"repo": "georgepisaltu/licenta",
"path": "/micro_http/src/response.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: georgepisaltu/licenta path: /micro_http/src/response.rs
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use std::io::{Error as WriteError, Read, Write};
use ascii::{CR, CRLF_LEN, LF, SP};
use common::message::Message;
pub use co... | code_fim | hard | {
"lang": "rust",
"repo": "georgepisaltu/licenta",
"path": "/micro_http/src/response.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: sfackler/foreign-types path: /foreign-types-macros/src/lib.rs
extern crate proc_macro;
use proc_macro::TokenStream;
use syn::parse_macro_input;
use crate::parse::Input;
<|fim_suffix|>#[proc_macro]
pub fn foreign_type_impl(input: TokenStream) -> TokenStream {
let input = parse_macro_input!... | code_fim | easy | {
"lang": "rust",
"repo": "sfackler/foreign-types",
"path": "/foreign-types-macros/src/lib.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[proc_macro]
pub fn foreign_type_impl(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as Input);
build::build(input).into()
}<|fim_prefix|>// repo: sfackler/foreign-types path: /foreign-types-macros/src/lib.rs
extern crate proc_macro;
use proc_macro::TokenStream;
use s... | code_fim | easy | {
"lang": "rust",
"repo": "sfackler/foreign-types",
"path": "/foreign-types-macros/src/lib.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: vindvaki/advent-of-code-2017 path: /src/bin/day_19.rs
extern crate aoc2017;
use aoc2017::read_fixture;
type Board = Vec<Vec<char>>;
fn main() {
let input = read_fixture();
println!("part_1: {}", part_1(input.as_str()));
println!("part_2: {}", part_2(input.as_str()));
}
fn new_boar... | code_fim | hard | {
"lang": "rust",
"repo": "vindvaki/advent-of-code-2017",
"path": "/src/bin/day_19.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> use part_1;
let input =[
" | ",
" | +--+ ",
" A | C ",
" F---|----E|--+ ",
" | | | D ",
" +B-+ +--+ ",
].join("\n");
assert_eq!(part_1(input.as_str()), "ABCDEF"... | code_fim | hard | {
"lang": "rust",
"repo": "vindvaki/advent-of-code-2017",
"path": "/src/bin/day_19.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: EFanZh/LeetCode path: /src/problem_0673_number_of_longest_increasing_subsequence/mod.rs
pub mod dynamic_programming;
pub trait Solution {
fn find_number_of_lis(nums: Vec<i32>) -> i32;
<|fim_suffix|> for (nums, expected) in test_cases {
assert_eq!(S::find_number_of_lis(num... | code_fim | hard | {
"lang": "rust",
"repo": "EFanZh/LeetCode",
"path": "/src/problem_0673_number_of_longest_increasing_subsequence/mod.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn run<S: Solution>() {
let test_cases = [
(&[1, 3, 5, 4, 7] as &[_], 2),
(&[2, 2, 2, 2, 2], 5),
(&[1, 2, 4, 3, 5, 4, 7, 2], 3),
(&[1, 2, 3, 1, 2, 3, 1, 2, 3], 10),
];
for (nums, expected) in test_cases {
assert_e... | code_fim | medium | {
"lang": "rust",
"repo": "EFanZh/LeetCode",
"path": "/src/problem_0673_number_of_longest_increasing_subsequence/mod.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> SqliteConnection::establish(&database_url)
.expect(&format!("Error connecting to {}", database_url))
}<|fim_prefix|>// repo: juliencrn/rusty-journal path: /src/lib.rs
#[macro_use]
extern crate diesel;
extern crate dotenv;
use diesel::prelude::*;
use dotenv::dotenv;
use std::env;
pub mod cli... | code_fim | hard | {
"lang": "rust",
"repo": "juliencrn/rusty-journal",
"path": "/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: juliencrn/rusty-journal path: /src/lib.rs
#[macro_use]
extern crate diesel;
extern crate dotenv;
use diesel::prelude::*;
use dotenv::dotenv;
use std::env;
pub mod cli;
pub mod models;
pub mod schema;
use cli::{Action::*, CommandLineArgs};
pub fn run(cli_args: CommandLineArgs) -> anyhow::Resu... | code_fim | hard | {
"lang": "rust",
"repo": "juliencrn/rusty-journal",
"path": "/src/lib.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: charlescerisier/tempest path: /tempest/src/topology.rs
d"], msg_count as isize);
}
// What's our current backoff
self.metrics.gauge(vec!["backoff"], self.backoff as isize);
// reschedule poll again if we aren't in shutdown mode
if !self.shutdown {
... | code_fim | hard | {
"lang": "rust",
"repo": "charlescerisier/tempest",
"path": "/tempest/src/topology.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut ack_source = false;
for name in descendants.iter() {
// take the aggregate holding msgs
// wrap them in TaskMsg and move them to the holding
// q... | code_fim | hard | {
"lang": "rust",
"repo": "charlescerisier/tempest",
"path": "/tempest/src/topology.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// Handle `TaskRequest` sent from a connected `TopologySession`
fn handle(&mut self, msg: TaskRequest, _ctx: &mut Context<Self>) {
match &msg {
TaskRequest::GetAvailable(_, _, _) => {
// forward this to pipeline actor
let pipeline = PipelineActo... | code_fim | hard | {
"lang": "rust",
"repo": "charlescerisier/tempest",
"path": "/tempest/src/topology.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: programLyrique/audio-adaptive-scheduling path: /src/audiograph_exec.rs
//! Execute an audiograph file and report stats about it.
extern crate audio_adaptive;
extern crate clap;
extern crate crossbeam_channel;
extern crate portaudio;
extern crate rand;
extern crate time;
use crossbeam_channel::... | code_fim | hard | {
"lang": "rust",
"repo": "programLyrique/audio-adaptive-scheduling",
"path": "/src/audiograph_exec.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> try!(stream.stop());
try!(stream.close());
Ok(())
}
fn bounce_run<'a>(
mut audio_graph: AudioGraph,
graph_name: String,
audio_input: Option<&'a str>,
cycles: u32,
monitor: bool,
) -> Result<(), &'a str> {
let nb_frames = FRAMES_PER_BUFFER;
//audio_graph.update_sc... | code_fim | hard | {
"lang": "rust",
"repo": "programLyrique/audio-adaptive-scheduling",
"path": "/src/audiograph_exec.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn new(width: i32, height: i32,pixel_size: f64, max_i: i32, centre_coords_x: f64, centre_coords_y: f64, julia_point_x: f64, julia_point_y: f64, fractal_type: FractalType, start_color: Color, end_color: Color) -> Mandelbrot {
utils::set_panic_hook();
let centre_coords = (centre_coords_x, cent... | code_fim | hard | {
"lang": "rust",
"repo": "freddiejbawden/mandelbrotmaps",
"path": "/wasm/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: freddiejbawden/mandelbrotmaps path: /wasm/src/lib.rs
mod utils;
mod fractal_type;
mod coloring_options;
use coloring_options::ColorOptions;
use fractal_type::FractalType;
use wasm_bindgen::prelude::*;
use utils::interpolate;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the gl... | code_fim | hard | {
"lang": "rust",
"repo": "freddiejbawden/mandelbrotmaps",
"path": "/wasm/src/lib.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #[wasm_bindgen(method)]
fn getR(this: &Color) -> u8;
#[wasm_bindgen(method)]
fn getG(this: &Color) -> u8;
#[wasm_bindgen(method)]
fn getB(this: &Color) -> u8;
}
#[wasm_bindgen]
pub struct Mandelbrot {
width: i32,
height: i32,
fractal_limit_x: f64,
fractal_limit_y: f64,
pixel_size... | code_fim | hard | {
"lang": "rust",
"repo": "freddiejbawden/mandelbrotmaps",
"path": "/wasm/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: johanlindblad/advent-of-code-2018 path: /src/day14.rs
#[aoc_generator(day14)]
pub fn input_generator(input: &str) -> usize {
input.parse::<usize>().unwrap()
}
#[aoc(day14, part1)]
pub fn solve_part1(input: &usize) -> String {
let after: usize = *input;
let mut scoreboard: Vec<usize... | code_fim | hard | {
"lang": "rust",
"repo": "johanlindblad/advent-of-code-2018",
"path": "/src/day14.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[aoc(day14, part2)]
pub fn solve_part2(input: &usize) -> usize {
let after: usize = *input;
let after_len = format!("{}", after).len();
let mut scoreboard: Vec<usize> = vec![3, 7];
let mut positions = (0, 1);
let mut sum = 37;
let modulo = (10 as isize).pow(after_len as u32);
... | code_fim | hard | {
"lang": "rust",
"repo": "johanlindblad/advent-of-code-2018",
"path": "/src/day14.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: noboruma/spin-the-wheel path: /src/main.rs
mod entry;
use crate::entry::{*, Error, print_entries};
use std::{io::{stdout, Write}, iter::{Cycle, Enumerate}, thread::sleep, time::Duration};
use rand::Rng;
use clap::{App, load_yaml};
use crossterm::{cursor::{Hide, Show}, execute, style::Color};
... | code_fim | hard | {
"lang": "rust",
"repo": "noboruma/spin-the-wheel",
"path": "/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let (total_time_sec, args_input) = get_args()?;
let entries = create_entries(args_input);
let total_time_ns : u64 = total_time_sec * 1_000_000_000;
let mut selected_entry_it = entries.iter().enumerate().cycle();
let mut rng = rand::thread_rng();
let _cursor = CursorVisibility::n... | code_fim | hard | {
"lang": "rust",
"repo": "noboruma/spin-the-wheel",
"path": "/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl Drop for CursorVisibility {
fn drop(&mut self) {
match execute!(stdout(), Show) {
Ok(()) => (),
Err(_) => println!("Failed to set cursor back"),
};
}
}
fn get_args() -> Result<(u64, Vec<String>)> {
let yaml = load_yaml!("cli.yaml");
let matches... | code_fim | hard | {
"lang": "rust",
"repo": "noboruma/spin-the-wheel",
"path": "/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> test!(1i + 1, 0i + 10, "a" == "b");
let f1 = Butt(1i);
let f2 = Butt("braap!");
let f3: Fart<Option<u8>> = Turd;
let f4 = Butt(12i);
let f5 = Butt(12i);
test!(f1, f2, f3);
test!(f1 == f4, f4 == f5);
}<|fim_prefix|>// repo: wilsoniya/rust_experimentation path: /macros/src... | code_fim | medium | {
"lang": "rust",
"repo": "wilsoniya/rust_experimentation",
"path": "/macros/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: wilsoniya/rust_experimentation path: /macros/src/main.rs
#![feature(macro_rules)]
#[deriving(Show, PartialEq)]
enum Fart<T> {
Butt(T),
Turd,
}
<|fim_suffix|> let f1 = Butt(1i);
let f2 = Butt("braap!");
let f3: Fart<Option<u8>> = Turd;
let f4 = Butt(12i);
let f5 = But... | code_fim | hard | {
"lang": "rust",
"repo": "wilsoniya/rust_experimentation",
"path": "/macros/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: niurenyige/conceal path: /conceal-core/src/lib.rs
// use bytes::{BufMut, BytesMut};
use snow::{Builder, TransportState};
use std::path::Path;
use tokio::{
fs::{self, File},
io::{AsyncReadExt, AsyncWriteExt},
};
pub mod error;
pub mod protos;
pub use error::ConcealError;
pub use protos:... | code_fim | hard | {
"lang": "rust",
"repo": "niurenyige/conceal",
"path": "/conceal-core/src/lib.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #[tokio::test]
async fn aes_blake2s() -> Result<(), ConcealError> {
let result = param_combination(
CipherMode::Aesgcm,
HashMode::Blake2s,
true,
vec![256, NOISE_MESSAGE_MAX_SIZE + 1, 256 * 1024],
)
.await?;
assert_eq!(... | code_fim | hard | {
"lang": "rust",
"repo": "niurenyige/conceal",
"path": "/conceal-core/src/lib.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: valarauca/errors path: /src/lib.rs
extern crate serde;
extern crate serde_json;
use serde::ser::SerializeStruct;
use serde::{Serialize, Serializer};
use std::error;
use std::fmt;
mod kv;
use self::kv::KeyValue;
pub use self::kv::{BasicType};
mod debugdisplay;
pub use self::debugdisplay::{Messa... | code_fim | hard | {
"lang": "rust",
"repo": "valarauca/errors",
"path": "/src/lib.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// appends kv data to an existing error
pub fn note<A>(&self, key: &'static str, value: A) -> Self
where
BasicType: From<A>,
{
let item = self.clone();
{
let mut s = item.inner.as_ref().lock().unwrap();
s.key_value.insert(key, value);
... | code_fim | hard | {
"lang": "rust",
"repo": "valarauca/errors",
"path": "/src/lib.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let elf = self.inner.as_ref().lock().unwrap();
let mut info = f.debug_struct("Error");
info.field("message", &elf.message);
if let Option::Some(ref root_cause) = elf.root_cause {
info.field("existing_error", root_cause);
}
if elf.key_value.len()... | code_fim | hard | {
"lang": "rust",
"repo": "valarauca/errors",
"path": "/src/lib.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl DefaultJoinHandler {
pub fn new() -> Self {
Self {}
}
}
impl JoinHandler for DefaultJoinHandler {}
impl Default for DefaultJoinHandler {
fn default() -> Self {
Self::new()
}
}<|fim_prefix|>// repo: roy-ganz/toql path: /crates/core/src/join_handler.rs
//! A [JoinHand... | code_fim | hard | {
"lang": "rust",
"repo": "roy-ganz/toql",
"path": "/crates/core/src/join_handler.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>/// Handles the standart filters as documented in the guide.
/// Returns [FilterInvalid](../sql_builder/enum.SqlBuilderError.html) for any attempt to use FN filters.
#[derive(Debug, Clone)]
pub struct DefaultJoinHandler {}
impl DefaultJoinHandler {
pub fn new() -> Self {
Self {}
}
}
impl... | code_fim | hard | {
"lang": "rust",
"repo": "roy-ganz/toql",
"path": "/crates/core/src/join_handler.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: roy-ganz/toql path: /crates/core/src/join_handler.rs
//! A [JoinHandler] may modify an ON condition in a join clause.
/// Use it to create or build an ON condition.
/// To disable a join, just return `false`.
///
/// TODO proper example
/// Notice that aux_params may not only come from context o... | code_fim | medium | {
"lang": "rust",
"repo": "roy-ganz/toql",
"path": "/crates/core/src/join_handler.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Orca-bit/DataStructureAndAlgorithm path: /src/other/_56_merge_intervals.rs
struct Solution;
impl Solution {
pub fn merge(mut intervals: Vec<Vec<i32>>) -> Vec<Vec<i32>> {
if intervals.len() < 2 {
return intervals;
}
let mut res = vec![];
intervals.... | code_fim | medium | {
"lang": "rust",
"repo": "Orca-bit/DataStructureAndAlgorithm",
"path": "/src/other/_56_merge_intervals.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let intervals: Vec<Vec<i32>> = vec_vec_i32_1![[1, 3], [2, 6], [8, 10], [15, 18]];
let res: Vec<Vec<i32>> = vec_vec_i32_1![[1, 6], [8, 10], [15, 18]];
assert_eq!(Solution::merge(intervals), res);
let intervals: Vec<Vec<i32>> = vec_vec_i32_1![[1, 4], [4, 5]];
let res: Vec<Vec<i32>> = vec... | code_fim | medium | {
"lang": "rust",
"repo": "Orca-bit/DataStructureAndAlgorithm",
"path": "/src/other/_56_merge_intervals.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: rust-embedded/cortex-m path: /cortex-m-rt/tests/compile-fail/entry-soundness.rs
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
<|fim_suffix|>#[exception]
fn SysTick() {
// If this was allowed it would lead to a data race as `SysTick` can preempt `foo`
foo(); ... | code_fim | hard | {
"lang": "rust",
"repo": "rust-embedded/cortex-m",
"path": "/cortex-m-rt/tests/compile-fail/entry-soundness.rs",
"mode": "psm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|> // If this was allowed it would lead to a data race as `SysTick` can preempt `foo`
foo(); //~ ERROR cannot find function `foo` in this scope
}<|fim_prefix|>// repo: rust-embedded/cortex-m path: /cortex-m-rt/tests/compile-fail/entry-soundness.rs
#![no_main]
#![no_std]
extern crate cortex_m_rt;
ex... | code_fim | medium | {
"lang": "rust",
"repo": "rust-embedded/cortex-m",
"path": "/cortex-m-rt/tests/compile-fail/entry-soundness.rs",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl<LocalCall> system::offchain::CreateSignedTransaction<LocalCall> for Test
where
Call<>: From<LocalCall>,
{
fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
call: Call<>,
_public: <Signature as Verify>::Signer,
_account: <Test as system::Config>::Accou... | code_fim | hard | {
"lang": "rust",
"repo": "realtakahashi/faucet_pallet",
"path": "/src/mock.rs",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: realtakahashi/faucet_pallet path: /src/mock.rs
use crate as faucet_pallet;
use sp_core::{H256, sr25519::Signature, sr25519 };
use frame_support::parameter_types;
use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup, Verify}, testing::{Header, TestXt},
};
use frame_system as system;
use pallet... | code_fim | hard | {
"lang": "rust",
"repo": "realtakahashi/faucet_pallet",
"path": "/src/mock.rs",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: orlp/slotmap path: /examples/rand_meld_heap.rs
// Randomized meldable heap.
// https://en.wikipedia.org/wiki/Randomized_meldable_heap
use slotmap::{new_key_type, Key, SlotMap};
new_key_type! {
struct HeapKey;
}
#[derive(Copy, Clone)]
struct NodeHandle(HeapKey);
#[derive(Copy, Clone)]
str... | code_fim | hard | {
"lang": "rust",
"repo": "orlp/slotmap",
"path": "/examples/rand_meld_heap.rs",
"mode": "psm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn update_key(&mut self, node: NodeHandle, value: T) {
let node = node.0;
// Unlink and re-insert.
self.unlink_node(node);
self.sm[node] = Node {
value,
children: [HeapKey::null(), HeapKey::null()],
parent: HeapKey::null(),
... | code_fim | hard | {
"lang": "rust",
"repo": "orlp/slotmap",
"path": "/examples/rand_meld_heap.rs",
"mode": "spm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: isavegas/aoc_2019 path: /src/main.rs
use aoc_core::AoCProject;
pub fn main() {
let proje<|fim_suffix|>string(), None, "isavegas".to_string(), None);
project.run(&aoc_2019::get_days(), &aoc_2019::get_inputs());
}<|fim_middle|>ct = AoCProject::new(2019, env!("CARGO_PKG_VERSION").to_ | code_fim | easy | {
"lang": "rust",
"repo": "isavegas/aoc_2019",
"path": "/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>string(), None, "isavegas".to_string(), None);
project.run(&aoc_2019::get_days(), &aoc_2019::get_inputs());
}<|fim_prefix|>// repo: isavegas/aoc_2019 path: /src/main.rs
use aoc_core::AoCProject;
pub fn main() {
let proje<|fim_middle|>ct = AoCProject::new(2019, env!("CARGO_PKG_VERSION").to_ | code_fim | easy | {
"lang": "rust",
"repo": "isavegas/aoc_2019",
"path": "/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: gahag/MayaStor path: /mayastor/src/spdklog.rs
//! Logger implementation for standard rust log module piping all log messages
//! to spdk logger. Some code here has been borrowed from stderr rust logger.
use log::{Level, LevelFilter, Log, Metadata, Record};
use std::ffi::CString;
fn is_submodul... | code_fim | hard | {
"lang": "rust",
"repo": "gahag/MayaStor",
"path": "/mayastor/src/spdklog.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> // If modules is empty, include all module paths
if self.modules.is_empty() {
return true;
}
// if a prefix of module_path is in `self.modules`, it must be
// located at the first location before where module_path would be.
match self
... | code_fim | hard | {
"lang": "rust",
"repo": "gahag/MayaStor",
"path": "/mayastor/src/spdklog.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> fn includes_module(&self, module_path: &str) -> bool {
// If modules is empty, include all module paths
if self.modules.is_empty() {
return true;
}
// if a prefix of module_path is in `self.modules`, it must be
// located at the first location befor... | code_fim | hard | {
"lang": "rust",
"repo": "gahag/MayaStor",
"path": "/mayastor/src/spdklog.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> String::from("<Error: name contains invalid unicode data>")
});
println!("[{}] {}", entry_type, entry_name);
}
Ok(())
}<|fim_prefix|>// repo: ranjak/rust-ls path: /src/rust_ls/mod.rs
use std::path;
pub fn list_directory_entries(dir: &path::Path) -> std::io::Result<()> {
for entry in dir.read... | code_fim | medium | {
"lang": "rust",
"repo": "ranjak/rust-ls",
"path": "/src/rust_ls/mod.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ranjak/rust-ls path: /src/rust_ls/mod.rs
use std::path;
pub fn list_directory_entries(dir: &path::Path) -> std::io::Result<()> {
for entry in dir.read_dir()? {
let en<|fim_suffix|> if t.is_symlink() => "Symlink",
_ => "Unknown"
};
let entry_name = entry.file_name().into_string().unwra... | code_fim | medium | {
"lang": "rust",
"repo": "ranjak/rust-ls",
"path": "/src/rust_ls/mod.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>unsafe impl<T: RemoveFront> IntoMesh for T
where
T::Remaining: IntoMesh,
T::Front: IntoMesh,
<T::Front as IntoMesh>::Args: RemoveFront<Remaining = ()>,
<T::Remaining as IntoMesh>::Args:
AttachFront<<<T::Front as IntoMesh>::Args as RemoveFront>::Front>,
<<T::Remaining as IntoMes... | code_fim | hard | {
"lang": "rust",
"repo": "JackStade/Rust-Draw",
"path": "/src/opengl/mesh.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl ArrayDrawer {
pub fn draw_all(&self) {
unsafe {
gl::with_current(|gl| gl.DrawArrays(self.mode, 0, self.num_indices as i32));
}
}
pub fn draw_arrays(&self, start: u32, count: u32) {
if cfg!(feature = "draw_call_bounds_checks") {
if (start + ... | code_fim | hard | {
"lang": "rust",
"repo": "JackStade/Rust-Draw",
"path": "/src/opengl/mesh.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: JackStade/Rust-Draw path: /src/opengl/mesh.rs
size as usize) / stride as usize) + 1)
* binding.instance_divisor as usize,
);
}
if sizes.0 > std::u32::MAX as usize {
sizes.0 = std::u32::MAX as usize;
}
if sizes.1 > std::... | code_fim | hard | {
"lang": "rust",
"repo": "JackStade/Rust-Draw",
"path": "/src/opengl/mesh.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: jolestar/libra path: /storage/backup/backup-cli/src/storage/mod.rs
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
pub mod local_fs;
use anyhow::Result;
use async_trait::async_trait;
use tokio::io::{AsyncRead, AsyncWrite};
<|fim_suffix|>#[async_trait]
pub t... | code_fim | medium | {
"lang": "rust",
"repo": "jolestar/libra",
"path": "/storage/backup/backup-cli/src/storage/mod.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[async_trait]
pub trait BackupStorage {
/// Hint that a bunch of files are gonna be created related to a backup identified by `name`,
/// which is unique to the content of the backup, i.e. it won't be the same name unless you are
/// backing up exactly the same thing.
/// Storage can choo... | code_fim | medium | {
"lang": "rust",
"repo": "jolestar/libra",
"path": "/storage/backup/backup-cli/src/storage/mod.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> let connected = ui.watchdog.is_alive();
let label = if connected { "Connected".to_string() } else { "Disconnected".to_string() };
Button::new()
.w_h(105.0 * application_theme.ui_scale, 35.0 * application_theme.ui_scale)
.down_from(TITLE, 7.0 * application_theme.ui_scale)
... | code_fim | hard | {
"lang": "rust",
"repo": "TilBlechschmidt-ProjectGraveyard/bit-dmx",
"path": "/src/frontend/tmp/header.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: TilBlechschmidt-ProjectGraveyard/bit-dmx path: /src/frontend/tmp/header.rs
use std::sync::{Arc, Mutex};
use conrod::{
Colorable,
Frameable,
Positionable,
Text,
Widget,
Button,
Labelable,
Sizeable,
};
use ui::UI;
use window::*;
use theme::Theme;
#[allow(dead_code... | code_fim | hard | {
"lang": "rust",
"repo": "TilBlechschmidt-ProjectGraveyard/bit-dmx",
"path": "/src/frontend/tmp/header.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> acc + difference
})
}
#[test]
fn example_1() {
let input = "5 1 9 5\n7 5 3\n2 4 6 8";
assert_eq!(18, find_checksum(input));
}
#[test]
fn find_sum_solution() {
let input = super::file::read_to_string("day2-1.txt");
assert_eq!(36766, find_checksum(input.as_str().trim()));
}<|fim_pref... | code_fim | hard | {
"lang": "rust",
"repo": "chrisbutcher/advent-2017",
"path": "/src/day2.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: chrisbutcher/advent-2017 path: /src/day2.rs
pub fn find_checksum(input: &str) -> u32 {
let lines = input.split("\n");
lines.fold(0, |acc, line| {
let numbers: Vec<_> = line.split_whitespace().map( |n| n.parse::<u32>().unwrap() ).collect();
let min = numbers.iter().min().unwrap();
... | code_fim | medium | {
"lang": "rust",
"repo": "chrisbutcher/advent-2017",
"path": "/src/day2.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>position_force::NodeArgument {
group: groups[&u],
strength: 0.1,
},
|_, g| force::group_position_force::GroupArgument {
x: group_pos[&g].x,
y: group_pos[&g].y,
},
)),
// Box::new(force::Grou... | code_fim | hard | {
"lang": "rust",
"repo": "likr/egraph-rs",
"path": "/crates/layout/grouped-force/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: likr/egraph-rs path: /crates/layout/grouped-force/src/lib.rs
pub mod force;
pub mod grouping;
use crate::force::group_many_body_force::GroupManyBodyForceArgument;
use petgraph::graph::{Graph, IndexType, NodeIndex};
use petgraph::EdgeType;
use petgraph_layout_force::link_force::LinkArgument;
use... | code_fim | hard | {
"lang": "rust",
"repo": "likr/egraph-rs",
"path": "/crates/layout/grouped-force/src/lib.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: antonyr/stats path: /src/main.rs
mod engine;
fn main() {
let repo = String::from("kubernetes/kubernetes");
let stat = engine::stats::Stats::new(repo);
le<|fim_suffix|>ive_day_commits(commits.unwrap());
println!("{:#?}", result);
}<|fim_middle|>t commits = stat.fetch();
let r... | code_fim | medium | {
"lang": "rust",
"repo": "antonyr/stats",
"path": "/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ive_day_commits(commits.unwrap());
println!("{:#?}", result);
}<|fim_prefix|>// repo: antonyr/stats path: /src/main.rs
mod engine;
fn main() {
let repo = String::from("kubernetes/k<|fim_middle|>ubernetes");
let stat = engine::stats::Stats::new(repo);
let commits = stat.fetch();
let r... | code_fim | medium | {
"lang": "rust",
"repo": "antonyr/stats",
"path": "/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ing all data in RAM at once so you can store more data than you have RAM.
//!
pub mod logical_tree;
pub mod serde_interface;
pub mod storage;<|fim_prefix|>// repo: aptend/dbdb-rust path: /src/lib.rs
#![allow(dead_code)]
//! This project is inspired by [500lines/dbdb](https://www.aosabook.org/en/500L/dbd... | code_fim | hard | {
"lang": "rust",
"repo": "aptend/dbdb-rust",
"path": "/src/lib.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: aptend/dbdb-rust path: /src/lib.rs
#![allow(dead_code)]
//! This project is inspired by [500lines/dbdb](https://www.aosabook.org/en/500L/dbdb-dog-bed-database.html)
//!
//! DBDB (Dog Bed Database) is a library that implements a simple key/value database. It lets you associate a key with a value,... | code_fim | medium | {
"lang": "rust",
"repo": "aptend/dbdb-rust",
"path": "/src/lib.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn has_type(&self, t: &FilmOutput) -> bool { self.types.contains(t) }
pub fn get_type(&self, index: usize) -> Option<&FilmOutput> { self.types.get(index) }
pub fn get_name(&self, index: usize) -> Option<&String> { self.names.get(index) }
pub fn get_properties(&self, index: usize) ->... | code_fim | hard | {
"lang": "rust",
"repo": "ReflectiveIO/mirror",
"path": "/src/slg/film/outputs.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ReflectiveIO/mirror path: /src/slg/film/outputs.rs
use strum::EnumString;
use crate::rays::Properties;
/// FilmOutputs
pub struct FilmOutputs {
types: Vec<FilmOutput>,
names: Vec<String>,
props: Vec<Properties>,
safe_save: bool,
}
impl FilmOutputs {
pub fn new() -> Self {
... | code_fim | hard | {
"lang": "rust",
"repo": "ReflectiveIO/mirror",
"path": "/src/slg/film/outputs.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> match prop {
Some(p) => {
self.props.push(p);
},
None => {
self.props.push(Properties::new());
},
}
}
pub fn use_safe_save(&self) -> bool { self.safe_save }
pub fn set_safe_save(&mut self, v: bool... | code_fim | hard | {
"lang": "rust",
"repo": "ReflectiveIO/mirror",
"path": "/src/slg/film/outputs.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ble feature.
pub const MAX: u8 = 126;
pub const MIN: u8 = 33;<|fim_prefix|>// repo: null-char/rustrot13 path: /src/rot/constants.rs
// These constants may be set during runtime at a later date<|fim_middle|>. Something like a config argument
// for specifying the range of ASCII characters to encrypt / dec... | code_fim | medium | {
"lang": "rust",
"repo": "null-char/rustrot13",
"path": "/src/rot/constants.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>e of ASCII characters to encrypt / decrypt would be a desirable feature.
pub const MAX: u8 = 126;
pub const MIN: u8 = 33;<|fim_prefix|>// repo: null-char/rustrot13 path: /src/rot/constants.rs
// These constants may be set during runtime at a later date<|fim_middle|>. Something like a config argument
// f... | code_fim | medium | {
"lang": "rust",
"repo": "null-char/rustrot13",
"path": "/src/rot/constants.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: null-char/rustrot13 path: /src/rot/constants.rs
// These constants may be set during runtime at a later date<|fim_suffix|>e of ASCII characters to encrypt / decrypt would be a desirable feature.
pub const MAX: u8 = 126;
pub const MIN: u8 = 33;<|fim_middle|>. Something like a config argument
// f... | code_fim | medium | {
"lang": "rust",
"repo": "null-char/rustrot13",
"path": "/src/rot/constants.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: dylanmckay/ib-rs path: /src/models/calendar_request_filters.rs
/*
* Client Portal Web API
*
* Client Poral Web API
*
* OpenAPI spec version: 1.0.0
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, ... | code_fim | hard | {
"lang": "rust",
"repo": "dylanmckay/ib-rs",
"path": "/src/models/calendar_request_filters.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn set_recently_held(&mut self, recently_held: String) {
self.recently_held = Some(recently_held);
}
pub fn with_recently_held(mut self, recently_held: String) -> CalendarRequestFilters {
self.recently_held = Some(recently_held);
self
}
pub fn recently_held(&self) -> Option<&St... | code_fim | hard | {
"lang": "rust",
"repo": "dylanmckay/ib-rs",
"path": "/src/models/calendar_request_filters.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.0.partial_cmp(&other.0)
}
}
impl Ord for ClosedOpenUnitF64 {
fn cmp(&self, other: &Self) -> Ordering {
self.0.total_cmp(&other.0)
}
}
impl Hash for ClosedOpenUnitF64 {
fn hash<H: Hasher>(&self, state: &mut H) {
self.0.to_bits().hash(state);
}
}
impl Part... | code_fim | hard | {
"lang": "rust",
"repo": "juntyr/necsim-rust",
"path": "/necsim/core/bond/src/closed_open_unit_f64.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: juntyr/necsim-rust path: /necsim/core/bond/src/closed_open_unit_f64.rs
use core::{
cmp::Ordering,
convert::TryFrom,
fmt,
hash::{Hash, Hasher},
};
use serde::{Deserialize, Serialize};
use crate::ClosedUnitF64;
#[derive(Debug)]
#[allow(clippy::module_name_repetitions)]
pub struc... | code_fim | hard | {
"lang": "rust",
"repo": "juntyr/necsim-rust",
"path": "/necsim/core/bond/src/closed_open_unit_f64.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: tribe-health/wallet.rs path: /wallet/bindings/wasm/src/lib.rs
// Copyright 2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
#![forbid(unsafe_code)]
pub mod message_handler;
<|fim_suffix|>/// The Wasm bindings do not support internal logging yet.
///
/// Calling this is a no-op, only ... | code_fim | hard | {
"lang": "rust",
"repo": "tribe-health/wallet.rs",
"path": "/wallet/bindings/wasm/src/lib.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>/// The Wasm bindings do not support internal logging yet.
///
/// Calling this is a no-op, only included for compatibility with the Neon Node.js bindings TypeScript definitions.
#[wasm_bindgen(js_name = initLogger)]
pub async fn init_logger(config: String) -> Result<(), JsValue> {
message_handler::in... | code_fim | medium | {
"lang": "rust",
"repo": "tribe-health/wallet.rs",
"path": "/wallet/bindings/wasm/src/lib.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> (1..=size_u)
.rev()
.enumerate()
.flat_map(|(i, steps)| {
let times = match i {
0 => 1,
_ => 2,
};
iter::repeat(steps).take(times).collect::<Vec<usize>>()
})
.flat_map(|times| {
iter... | code_fim | hard | {
"lang": "rust",
"repo": "iThinkyouknow/exercism",
"path": "/spiral-matrix/src/lib.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut directions_iter = [
Direction::Right,
Direction::Down,
Direction::Left,
Direction::Up,
].into_iter()
.cycle();
(1..=size_u)
.rev()
.enumerate()
.flat_map(|(i, steps)| {
let times = match i {
0 ... | code_fim | hard | {
"lang": "rust",
"repo": "iThinkyouknow/exercism",
"path": "/spiral-matrix/src/lib.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: iThinkyouknow/exercism path: /spiral-matrix/src/lib.rs
use std::iter;
#[derive(Debug, Clone)]
enum Direction {
Left,
Down,
Right,
Up,
}
pub fn spiral_matrix(size: u32) -> Vec<Vec<u32>> {
// let size_u = size as usize;
// let mut nums = (1..=(size.pow(2))).peekable();
... | code_fim | hard | {
"lang": "rust",
"repo": "iThinkyouknow/exercism",
"path": "/spiral-matrix/src/lib.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: brianp/muxed path: /load/src/project/parser.rs
.into(),
);
};
}
}
}
}
Yaml::String(ref s) => {
command... | code_fim | hard | {
"lang": "rust",
"repo": "brianp/muxed",
"path": "/load/src/project/parser.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.