text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>,74,68,67,83,74,79,72,75,85,80,87,83,95,91,107,111,99,106,109,115,107,125,120,119,115,120,124,134,123,99,119,116,119,121,121,136,136,129,122,119,119,111,133,116,118,110,117,123,120,124,116,126,124,116,118,127,134,113,115,115,109,141,131,107,117,107,110,119,115,112,106,94,109,108,112,91,108,92,106,99,101,9...
code_fim
hard
{ "lang": "rust", "repo": "Jekahome/Robart", "path": "/sound/src/parse_sound.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>,242,4,11,28,47,52,52,53,59,63,63,54,60,55,57,43,43,27,11,251,245,238,215,210,204,198,177,175,148,138,131,112,98,92,70,52,44,35,28,16,3,0,0,0,0,0,0,0,0,0,0,0,3,7,10,7,27,41,47,53,72,74,84,97,114,119,133,133,143,151,161,170,173,179,187,186,192,201,196,189,195,192,195,193,188,183,180,184,180,173,170,167,159...
code_fim
hard
{ "lang": "rust", "repo": "Jekahome/Robart", "path": "/sound/src/parse_sound.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MaxOhn/rosu-pp-newer path: /src/osu_xexxar/skill.rs use super::{DifficultyObject, SkillKind}; use std::cmp::Ordering; use std::collections::VecDeque; const STAR_RATING_CONSTANT: f32 = 0.08265; const AIM_SNAP_STARS_PER_DOUBLE: f32 = 1.1; const AIM_FLOW_STARS_PER_DOUBLE: f32 = 1.1; const AIM_CO...
code_fim
hard
{ "lang": "rust", "repo": "MaxOhn/rosu-pp-newer", "path": "/src/osu_xexxar/skill.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.combine_star_rating( flow_star_rating, snap_star_rating, AIM_COMBINED_STARS_PER_DOUBLE, ) } SkillKind::Tap { strains, .. } => { calculate_difficulty_value(strains, TAP_S...
code_fim
hard
{ "lang": "rust", "repo": "MaxOhn/rosu-pp-newer", "path": "/src/osu_xexxar/skill.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Byteron/vital-investments-rs path: /src/game/mod.rs use std::time::Duration; use bevy::{prelude::*, utils::HashMap}; use cursor::Cursor; use date::{Date, DateTickEvent, DateTimer}; use map::{GridSize, TileSize, Tiles}; use crate::AppState; pub mod bob; pub mod building; pub mod camera; pub m...
code_fim
hard
{ "lang": "rust", "repo": "Byteron/vital-investments-rs", "path": "/src/game/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub struct Budget(pub i32); pub struct GamePlugin; impl Plugin for GamePlugin { fn build(&self, app: &mut AppBuilder) { app.add_event::<DateTickEvent>() .insert_resource(Budget(35000)) .insert_resource(Date(0)) .insert_resource(DateTimer(Timer::new(Duratio...
code_fim
hard
{ "lang": "rust", "repo": "Byteron/vital-investments-rs", "path": "/src/game/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> BaseCellRotation::new(105, 3), ], // j 2 ], [ // i 1 [ BaseCellRotation::new(51, 0), BaseCellRotation::new(69, 3), BaseCellRotation::new(84, 3), ], // j 0 [ ...
code_fim
hard
{ "lang": "rust", "repo": "aeshirey/h3rs", "path": "/src/basecellrotation.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aeshirey/h3rs path: /src/basecellrotation.rs BaseCellRotation::new(25, 0), ], // j 2 ], ], [ // face 7 [ // i 0 [ BaseCellRotation::new(36, 0), BaseCellRotation::new(20, 0), Base...
code_fim
hard
{ "lang": "rust", "repo": "aeshirey/h3rs", "path": "/src/basecellrotation.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aeshirey/h3rs path: /src/basecellrotation.rs BaseCellRotation::new(6, 1), BaseCellRotation::new(9, 0), BaseCellRotation::new(19, 0), ], // j 2 ], [ // i 2 [ BaseCellRotation::new(4, 2), ...
code_fim
hard
{ "lang": "rust", "repo": "aeshirey/h3rs", "path": "/src/basecellrotation.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test() { let mut board = vec![ vec!['X', 'X', 'X', 'X'], vec!['X', 'O', 'O', 'X'], vec!['X', 'X', 'O', 'X'], vec!['X', 'O', 'X', 'X'], ]; Solution::solve(&mut board); assert_eq!( board, vec![ vec!['X', 'X', 'X', 'X'], ...
code_fim
hard
{ "lang": "rust", "repo": "MrHuxu/leetcode150", "path": "/rust/src/question_130.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if i > 0 && !visited[i - 1][j] { Self::dfs(board, i - 1, j, visited); } if i < board.len() - 1 && !visited[i + 1][j] { Self::dfs(board, i + 1, j, visited); } if j > 0 && !visited[i][j - 1] { Self::dfs(board, i, j - 1, visited) ...
code_fim
hard
{ "lang": "rust", "repo": "MrHuxu/leetcode150", "path": "/rust/src/question_130.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MrHuxu/leetcode150 path: /rust/src/question_130.rs struct Solution; impl Solution { pub fn solve(board: &mut Vec<Vec<char>>) { let mut visited = vec![vec![false; board[0].len()]; board.len()]; for j in 0..board[0].len() { Self::dfs(board, 0, j, &mut visited); ...
code_fim
hard
{ "lang": "rust", "repo": "MrHuxu/leetcode150", "path": "/rust/src/question_130.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> WalletError::TransactionSignError(e) => AccountServiceError::AccountError(e), // WalletError::DecryptPrivateKeyError(e) => AccountServiceError::AccountError(e), WalletError::AccountPrivateKeyMissing(a) => AccountServiceError::AccountError( format_err!("n...
code_fim
hard
{ "lang": "rust", "repo": "hustfisher/starcoin", "path": "/wallet/api/src/error.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hustfisher/starcoin path: /wallet/api/src/error.rs use anyhow::format_err; use starcoin_types::account_address::AccountAddress; use thiserror::Error; #[derive(Error, Debug)] pub enum AccountServiceError { // param error #[error("account with address {0} not exists")] AccountNotExist(...
code_fim
hard
{ "lang": "rust", "repo": "hustfisher/starcoin", "path": "/wallet/api/src/error.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[error("invalid password, cannot decrypt account {0}")] InvalidPassword(AccountAddress), #[error("invalid private key")] InvalidPrivateKey, // logic error #[error("transaction sign error, {0:?}")] TransactionSignError(anyhow::Error), // #[error("decrypt private key error,...
code_fim
hard
{ "lang": "rust", "repo": "hustfisher/starcoin", "path": "/wallet/api/src/error.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn get_var(&mut self) -> String { let name = self.vars.pop().unwrap(); // Just panic for now, probably not going to use an adt with 52 fields anyway self.used.push(name.clone()); name } pub fn generate_function_from_type(&mut self, ltype: &LType) -> Result<Stmt, Inter...
code_fim
hard
{ "lang": "rust", "repo": "andyyu2004/l-language", "path": "/src/generation/function_generation.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn generate_function_from_type(&mut self, ltype: &LType) -> Result<Stmt, InterpreterError> { if let TArrow(left, right) = ltype { match **right { TArrow(_, _) => Ok(FnCurried { name: if self.is_first_iter { Some(self.fn_name.clone()) } else {...
code_fim
hard
{ "lang": "rust", "repo": "andyyu2004/l-language", "path": "/src/generation/function_generation.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: andyyu2004/l-language path: /src/generation/function_generation.rs use crate::interpreting::InterpreterError; use crate::types::LType; use crate::types::l_types::LType::TArrow; use crate::parsing::{Stmt, Expr}; use crate::parsing::stmt::Stmt::*; use crate::lexing::{Token}; use crate::types::l_ty...
code_fim
hard
{ "lang": "rust", "repo": "andyyu2004/l-language", "path": "/src/generation/function_generation.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> //Create a line segment between the ray origin and the center of the sphere let l: Vector3 = self.center - ray.origin; //Use l as a hypotenuse and find the length of the adjacent side let adj2 = l.dot(&ray.direction); //Find the length-squared of the opposite side ...
code_fim
medium
{ "lang": "rust", "repo": "NickWilsonDev/Raytracer-Rust", "path": "/src/rendering.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: NickWilsonDev/Raytracer-Rust path: /src/rendering.rs // rendering.rs pub struct Ray { pub origin: Point, pub direction: Vector3, } impl Ray { pub fn create_prime(x: u32, y: u32, scene: &Scene) -> Ray { assert!(scene.width > scene.height); let fov_adjustment = (scene...
code_fim
medium
{ "lang": "rust", "repo": "NickWilsonDev/Raytracer-Rust", "path": "/src/rendering.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: awsdocs/aws-doc-sdk-examples path: /rust_dev_preview/examples/globalaccelerator/src/bin/globalaccelerator-helloworld.rs /* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #![allow(clippy::result_large_err)] use aws_config::meta:...
code_fim
hard
{ "lang": "rust", "repo": "awsdocs/aws-doc-sdk-examples", "path": "/rust_dev_preview/examples/globalaccelerator/src/bin/globalaccelerator-helloworld.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // Global Accelerator is a global service with its API in us-west-2 let region_provider = RegionProviderChain::first_try(Region::new("us-west-2")); println!(); if verbose { println!("globalaccelerator client version: {}", PKG_VERSION); println!( "Region: ...
code_fim
hard
{ "lang": "rust", "repo": "awsdocs/aws-doc-sdk-examples", "path": "/rust_dev_preview/examples/globalaccelerator/src/bin/globalaccelerator-helloworld.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: unnsa/rust path: /src/test/ui/impl-trait/issue-52128.rs // Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // ht...
code_fim
medium
{ "lang": "rust", "repo": "unnsa/rust", "path": "/src/test/ui/impl-trait/issue-52128.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.map.range(Range..Range) } pub fn iter<'a>(&'a self) -> impl Iterator<Item = &'a u8> + 'a { self.iter_with_range().map(|(_, data)| data) } } fn main() {}<|fim_prefix|>// repo: unnsa/rust path: /src/test/ui/impl-trait/issue-52128.rs // Copyright 2018 The Rust Project Dev...
code_fim
hard
{ "lang": "rust", "repo": "unnsa/rust", "path": "/src/test/ui/impl-trait/issue-52128.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn result_part1() { assert_eq!(part1(&parse_input(&raw_input())), 3267740); } #[test] fn result_part2() { assert_eq!(part2(&parse_input(&raw_input())), 7870); } }<|fim_prefix|>// repo: dhedegaard/adventofcode2019 path: /aoc2019/src/day02/mod.rs #[path = "../intcode/mod.rs"] m...
code_fim
hard
{ "lang": "rust", "repo": "dhedegaard/adventofcode2019", "path": "/aoc2019/src/day02/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dhedegaard/adventofcode2019 path: /aoc2019/src/day02/mod.rs #[path = "../intcode/mod.rs"] mod intcode; pub fn run_intcode(insts: &[i64]) -> Vec<i64> { let mut program = intcode::Intcode::new(insts, &[]); program.run(); program.insts } pub fn raw_input() -> String { include_str!("input....
code_fim
hard
{ "lang": "rust", "repo": "dhedegaard/adventofcode2019", "path": "/aoc2019/src/day02/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let val = insts[pc + param]; let mask = (operation as u32) / (10_u32.pow(param as u32 + 1)) % 10; assert!(!addr || mask == 0); if !addr && mask == 0 { insts[val as usize] } else { val } } pub fn part1(input: &[i64]) -> i64 { let mut insts = input.to_vec(); insts[1] = 12; insts[2...
code_fim
hard
{ "lang": "rust", "repo": "dhedegaard/adventofcode2019", "path": "/aoc2019/src/day02/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cetusDownfall/exercises path: /procrasti/hexapwn/src/main.rs extern crate hexapwn; use std::io; use hexapwn::*; fn main() { let mut board = Board::new(); let mut is_over = false; let mut next_move: String; while !is_over { next_move = String::from(""); println!("{...
code_fim
hard
{ "lang": "rust", "repo": "cetusDownfall/exercises", "path": "/procrasti/hexapwn/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> }, Err(em) => println!("{}", em), } } else { match board.advance(cos[1], cos[0]) { Ok(b) => { is_over = b; board.switch_side(); }, ...
code_fim
hard
{ "lang": "rust", "repo": "cetusDownfall/exercises", "path": "/procrasti/hexapwn/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match board.capture(cos[1], cos[0], match next_move.chars().skip(2).next().unwrap() { 'l' => Direction::Left, 'r' => Direction::Right, _ => Direction::Left, }) { Ok(b) => ...
code_fim
hard
{ "lang": "rust", "repo": "cetusDownfall/exercises", "path": "/procrasti/hexapwn/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yackmckee/Prime_image_generator path: /src/main.rs extern crate num_bigint; extern crate random_fast_rng; mod fastmod; use num_bigint::BigUint; use std::thread; use std::sync::Arc; use std::str::FromStr; use random_fast_rng::{Random,local_rng}; use fastmod::{precompute_bignum_u32,precompute_big...
code_fim
hard
{ "lang": "rust", "repo": "yackmckee/Prime_image_generator", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> //first: use the seive of erasthones to generate the first 100 primes and their //precomputations let mut primes_inner: Vec<(u32,Vec<u32>)> = Vec::new(); let mut seive: Vec<u32> = (3..104732).collect(); for i in 0..104729 { let p = seive[i]; if p != 0 { let ...
code_fim
hard
{ "lang": "rust", "repo": "yackmckee/Prime_image_generator", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>target_os = "linux"))] mod test_epoll; #[cfg(target_os = "linux")] mod test_inotify; mod test_pthread; #[cfg(any( target_os = "android", target_os = "dragonfly", target_os = "freebsd", target_os = "linux", target_os = "macos", target_os = "netbsd", target_os = "openbsd" ))] mod...
code_fim
hard
{ "lang": "rust", "repo": "nix-rust/nix", "path": "/test/sys/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nix-rust/nix path: /test/sys/mod.rs mod test_signal; // NOTE: DragonFly lacks a kernel-level implementation of Posix AIO as of // this writing. There is an user-level implementation, but whether aio // works or not heavily depends on which pthread implementation is chosen // by the user at link...
code_fim
hard
{ "lang": "rust", "repo": "nix-rust/nix", "path": "/test/sys/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/prototty path: /web/src/lib.rs pub use prototty_input; pub use prototty_input::{Input, MouseInput}; use prototty_input::{MouseButton, ScrollDirection}; pub use prototty_render; use prototty_render::{Buffer, Rgb24, ViewContext}; use prototty_storage::*; use std::cell::RefCell; use std::rc...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/prototty", "path": "/web/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Storage for LocalStorage { fn exists<K>(&self, key: K) -> bool where K: AsRef<str>, { self.local_storage.get_item(key.as_ref()).unwrap().is_some() } fn clear(&mut self) { self.local_storage.clear().unwrap() } fn remove<K>(&mut self, key: K) -> Res...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/prototty", "path": "/web/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/prototty path: /web/src/lib.rs ty_render::{Buffer, Rgb24, ViewContext}; use prototty_storage::*; use std::cell::RefCell; use std::rc::Rc; pub use std::time::Duration; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use web_sys::{Element, HtmlElement, KeyboardEvent, MouseEvent, No...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/prototty", "path": "/web/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rami3l/rusk path: /src/run.rs use crate::eval_apply::eval; use crate::parser::InPort; use crate::types::{Env, RcRefCell}; use std::rc::Rc; pub fn repl( inport: &mut impl InPort, outport: &mut impl std::io::Write, env: &RcRefCell<Env>, ) -> Result<(), std::io::Error> { <|fim_suffi...
code_fim
hard
{ "lang": "rust", "repo": "rami3l/rusk", "path": "/src/run.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>{ let val = eval(exp, Rc::clone(&global_env)); match val { Ok(exp) => writeln!(outport, "=> {}", exp)?, Err(e) => writeln!(outport, "Error: {:?}", e)?, } // writeln!(outport, "=>...
code_fim
hard
{ "lang": "rust", "repo": "rami3l/rusk", "path": "/src/run.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> } // writeln!(outport, "=> {:?}", val)?; } Err(e) => writeln!(outport, "Error: {:?}", e)?, }, Err(e) => break eprintln!("Readline Error: {:?}", e), } } Ok(()) }<|fim_prefix|>// repo: rami3l/rusk path: /src/run...
code_fim
hard
{ "lang": "rust", "repo": "rami3l/rusk", "path": "/src/run.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> use crate::{Cmd, Leaky, Ticker}; #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_leaky_basic() { env_logger::try_init().ok(); let leaky = Leaky::new_with_params(50, 20, 1); for i in 1..=50 { let res = leaky.start_one(); ...
code_fim
hard
{ "lang": "rust", "repo": "ZachMyers3/audioserve", "path": "/crates/leaky-cauldron/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> macro_rules! tst { () => { for _i in 1..=10 { assert!(leaky.start_one().is_ok()); } //should be full now assert!(leaky.start_one().is_err()); sleep(Duration::from_millis(150)).await; ...
code_fim
hard
{ "lang": "rust", "repo": "ZachMyers3/audioserve", "path": "/crates/leaky-cauldron/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ZachMyers3/audioserve path: /crates/leaky-cauldron/src/lib.rs use std::{ future::Future, pin::Pin, sync::{ atomic::{AtomicUsize, Ordering}, Arc, }, task::{Context, Poll}, time::Duration, }; use futures::{future::poll_fn, ready}; use log::{error, trace, wa...
code_fim
hard
{ "lang": "rust", "repo": "ZachMyers3/audioserve", "path": "/crates/leaky-cauldron/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[throws(NifpgaError)] fn write_fifo(session: u32, fifo: u32, data: &[Self], timeout: u32) -> usize { let mut empty_elements_remaining = 0; unsafe { nifpga_sys::write_fifo_f32( session, fifo, data.as_ptr(), ...
code_fim
hard
{ "lang": "rust", "repo": "WiresmithTech/nifpga-rs", "path": "/nifpga/src/datatype.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[throws(NifpgaError)] fn read_fifo( session: u32, fifo: u32, data: &mut [Self], timeout: u32, ) -> usize { let mut elements_remaining = 0; unsafe { nifpga_sys::read_fifo_f32( session, fifo, ...
code_fim
hard
{ "lang": "rust", "repo": "WiresmithTech/nifpga-rs", "path": "/nifpga/src/datatype.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: WiresmithTech/nifpga-rs path: /nifpga/src/datatype.rs use crate::error; use error::{NifpgaError, ToResult}; use fehler::throws; use nifpga_type_macro::datatype; pub trait Type: Sized { fn read(session: u32, indicator: u32) -> Result<Self, NifpgaError>; fn write(session: u32, control: ...
code_fim
hard
{ "lang": "rust", "repo": "WiresmithTech/nifpga-rs", "path": "/nifpga/src/datatype.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mutex = ReentrantMutex::new(vec![0u8, 10]); assert_eq!(format!("{:?}", mutex), "ReentrantMutex { data: [0, 10] }"); } #[cfg(feature = "serde")] #[test] fn test_serde() { let contents: Vec<u8> = vec![0, 1, 2]; let mutex = ReentrantMutex::new(contents.cl...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-comments-removed", "path": "/third_party/rust/parking_lot/src/remutex.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-comments-removed path: /third_party/rust/parking_lot/src/remutex.rs use crate::raw_mutex::RawMutex; use core::num::NonZeroUsize; use lock_api::{self, GetThreadId}; pub struct RawThreadId; unsafe impl GetThreadId for RawThreadId { const INIT: RawThreadId = RawThrea...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-comments-removed", "path": "/third_party/rust/parking_lot/src/remutex.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> pub type MappedReentrantMutexGuard<'a, T> = lock_api::MappedReentrantMutexGuard<'a, RawMutex, RawThreadId, T>; #[cfg(test)] mod tests { use crate::ReentrantMutex; use std::cell::RefCell; use std::sync::Arc; use std::thread; #[cfg(feature = "serde")] use bincode::{deserial...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-comments-removed", "path": "/third_party/rust/parking_lot/src/remutex.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MathiasKoch/aoc-2020 path: /src/day8.rs use aoc_runner_derive::{aoc, aoc_generator}; use std::{collections::HashMap, num::ParseIntError}; use std::{collections::HashSet, str::FromStr}; #[derive(Debug, Clone)] pub enum Instruction { Jump(isize), Acc(isize), Nop(isize), } impl FromSt...
code_fim
hard
{ "lang": "rust", "repo": "MathiasKoch/aoc-2020", "path": "/src/day8.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[aoc(day8, part2)] pub fn part2(program: &HashMap<usize, Instruction>) -> isize { let mut patcher = Patcher::new(); loop { let mut executor = Execution::new(); if let Some(ref patched_program) = patcher.patch_program(program) { if executor.run(patched_program) { ...
code_fim
hard
{ "lang": "rust", "repo": "MathiasKoch/aoc-2020", "path": "/src/day8.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ccqpein/Arithmetic-Exercises path: /Count-Collisions-on-a-Road/CCoaR.rs pub fn count_collisions(directions: String) -> i32 { let directions = directions.chars().collect::<Vec<char>>(); let (mut left, mut right) = (0, directions.len() - 1); <|fim_suffix|> dbg!(left); dbg!(right); ...
code_fim
hard
{ "lang": "rust", "repo": "ccqpein/Arithmetic-Exercises", "path": "/Count-Collisions-on-a-Road/CCoaR.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> while right > 0 && directions[right] == 'R' { right -= 1; } dbg!(left); dbg!(right); directions[left..=right] .iter() .filter(|c| **c != 'S') .count() as i32 } fn main() { dbg!(count_collisions(String::from("RLRSLL"))); dbg!(count_collisions(S...
code_fim
medium
{ "lang": "rust", "repo": "ccqpein/Arithmetic-Exercises", "path": "/Count-Collisions-on-a-Road/CCoaR.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Merlotec/space_render path: /src/cosmos/pass.rs use std::ops::Range; use amethyst::{ core::ecs::{ DispatcherBuilder, World, }, error::Error, renderer::{ bundle::{RenderOrder, RenderPlan, RenderPlugin, Target}, pipeline::{PipelineDescBuilder, PipelinesBuil...
code_fim
hard
{ "lang": "rust", "repo": "Merlotec/space_render", "path": "/src/cosmos/pass.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl CosmosRender { pub fn new(cosmos: Option<Cosmos>) -> Self { Self { cosmos } } } impl<B: Backend> RenderPlugin<B> for CosmosRender { fn on_build<'a, 'b>( &mut self, world: &mut World, _builder: &mut DispatcherBuilder<'a, 'b>, ) -> Result<(), Error> { ...
code_fim
hard
{ "lang": "rust", "repo": "Merlotec/space_render", "path": "/src/cosmos/pass.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: udoprog/OxidizeBot path: /crates/oxidize-api/src/youtube.rs //! Twitch API helpers. use anyhow::{bail, Result}; use common::models::youtube::{SearchResults, Video, Videos}; use reqwest::{Client, Method, Url}; use serde::{Deserialize, Serialize}; use crate::base::RequestBuilder; use crate::toke...
code_fim
hard
{ "lang": "rust", "repo": "udoprog/OxidizeBot", "path": "/crates/oxidize-api/src/youtube.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok(req .execute() .await? .not_found() .json::<Videos>()? .and_then(|v| v.items.into_iter().next())) } /// Search YouTube. pub async fn search(&self, q: &str) -> Result<SearchResults> { let mut req = self.v3(Method::G...
code_fim
hard
{ "lang": "rust", "repo": "udoprog/OxidizeBot", "path": "/crates/oxidize-api/src/youtube.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-comments-removed path: /third_party/rust/darling_core/src/derive.rs use proc_macro2::TokenStream; use quote::ToTokens; use syn::DeriveInput; use crate::options; macro_rules! emit_impl_or_error { ($e:expr) => { match $e { Ok(val) => val.into_token_...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-comments-removed", "path": "/third_party/rust/darling_core/src/derive.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>pub fn from_type_param(input: &DeriveInput) -> TokenStream { emit_impl_or_error!(options::FromTypeParamOptions::new(input)) } pub fn from_variant(input: &DeriveInput) -> TokenStream { emit_impl_or_error!(options::FromVariantOptions::new(input)) }<|fim_prefix|>// repo: marco-c/gecko-dev-comment...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-comments-removed", "path": "/third_party/rust/darling_core/src/derive.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pizzamig/myrello path: /src/op/mod.rs use serde::{Deserialize, Serialize}; use serde_json::Error as JsonError; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Task { pub id: u32, pub descr: String, pub priority: String, pub status: String, pub storypoints: u32, } ...
code_fim
hard
{ "lang": "rust", "repo": "pizzamig/myrello", "path": "/src/op/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl JsonReply<'_> for ShowOneTaskReply {} #[cfg(test)] mod op_test { use super::*; #[test] fn test_jsoncommand() { let uut = ShowOneTask { name: "ShowOneTask".to_string(), id: 10, }; let output: ShowOneTask = serde_json::from_slice(&uut.as_byt...
code_fim
medium
{ "lang": "rust", "repo": "pizzamig/myrello", "path": "/src/op/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if items_in_self - moving_items == 0 { Ok(None) } else { self.set_count(items_in_self - moving_items).unwrap(); Ok(Some(self)) } } /// Damages the item by the specified amount. /// If this function returns `true`, then the item is br...
code_fim
hard
{ "lang": "rust", "repo": "feather-rs/feather", "path": "/libcraft/items/src/item_stack.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl Display for ItemStackError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{:?}", self) } } impl Error for ItemStackError {} impl ItemStackMeta { #[must_use] pub fn new(item: Item) -> Self { Self { title: item.display_name().to_own...
code_fim
hard
{ "lang": "rust", "repo": "feather-rs/feather", "path": "/libcraft/items/src/item_stack.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: feather-rs/feather path: /libcraft/items/src/item_stack.rs Error; use std::fmt; use std::num::NonZeroU32; /// Represents an item stack. /// /// An item stack includes an item type, an amount and a bunch of properties (enchantments, etc.) #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserial...
code_fim
hard
{ "lang": "rust", "repo": "feather-rs/feather", "path": "/libcraft/items/src/item_stack.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if res.status().is_success() { // do nothing } else if res.status().is_server_error() { return Err(eyre::anyhow!("server error!")); } else { let status = res.status(); let error_message = match res.text().await { Ok(ms...
code_fim
medium
{ "lang": "rust", "repo": "dgageot/dagger", "path": "/sdk/rust/crates/dagger-sdk/src/core/session.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn start(&self, _cfg: &Config, conn: &ConnectParams) -> eyre::Result<RequestBuilder> { let client = Client::builder() .user_agent("graphql-rust/0.10.0") .connection_verbose(true) //.danger_accept_invalid_certs(true) .build()?; let re...
code_fim
medium
{ "lang": "rust", "repo": "dgageot/dagger", "path": "/sdk/rust/crates/dagger-sdk/src/core/session.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dgageot/dagger path: /sdk/rust/crates/dagger-sdk/src/core/session.rs use graphql_client::GraphQLQuery; use reqwest::{ header::{HeaderMap, HeaderValue, ACCEPT, CONTENT_TYPE}, Client, RequestBuilder, }; use crate::core::{ config::Config, connect_params::ConnectParams, introspection::I...
code_fim
hard
{ "lang": "rust", "repo": "dgageot/dagger", "path": "/sdk/rust/crates/dagger-sdk/src/core/session.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let (b, w, winner) = super::score_sums(&board, komi as u32); if white != ptr::null_mut() { unsafe { *white = w as c_uint; } } if black != ptr::null_mut() { unsafe { *black = b as c_uint; } } match winner { Color::White => 1, Color::Black => 0, }...
code_fim
hard
{ "lang": "rust", "repo": "porglezomp/libgoscore", "path": "/src/ffi.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: porglezomp/libgoscore path: /src/ffi.rs use libc::{c_char, size_t, c_uint, c_int}; use std::{slice, ptr}; use super::{Board, Stone, Color}; /// Provide a guess for which stones on the board are dead. #[no_mangle] pub extern fn guess_dead_stones(data: *mut c_char, width: size_t, height: size_t) ...
code_fim
hard
{ "lang": "rust", "repo": "porglezomp/libgoscore", "path": "/src/ffi.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: autarch/edgedb-rust path: /edgedb-client/src/pool/implementation.rs use async_std::channel::unbounded; use async_std::task; use async_std::sync::{Arc, Mutex, MutexGuard}; use bytes::Bytes; use edgedb_protocol::QueryResult; use edgedb_protocol::client_message::{IoFormat, Cardinality}; use edged...
code_fim
hard
{ "lang": "rust", "repo": "autarch/edgedb-rust", "path": "/edgedb-client/src/pool/implementation.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Execute a query returning a single result /// /// Most of the times you have to specify return type for the query: /// /// ```rust,ignore /// let greeting = pool.query::<String, _>("SELECT 'hello'", &()); /// // or /// let greeting: String = pool.query("SELECT 'hello'",...
code_fim
hard
{ "lang": "rust", "repo": "autarch/edgedb-rust", "path": "/edgedb-client/src/pool/implementation.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AljoschaMeyer/lazy-sequence-rs path: /src/lib.rs #![no_std] use core::num::NonZeroUsize; use loaf::Loaf; trait SequenceManipulator { type Item; type In; } trait Next: SequenceManipulator { fn next(&mut self) -> Result<(), Self::In>; fn next_many1(&mut self, _amount: NonZeroUs...
code_fim
hard
{ "lang": "rust", "repo": "AljoschaMeyer/lazy-sequence-rs", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>} trait SlurpPrev: SequenceManipulator { fn slurp_prev(&self) -> Result<(), Self::In>; } trait SlurpNext: SequenceManipulator { fn slurp_next(&self) -> Result<(), Self::In>; } trait WriteRefInLongMany1: WriteRefInLong { fn write_ref_in_long_many1<'s, 'i: 's>(&'s mut self, items: &'i Loaf<Se...
code_fim
hard
{ "lang": "rust", "repo": "AljoschaMeyer/lazy-sequence-rs", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl NMSettingWireless { pub fn get_ssid(&self) -> Vec<u8> { unsafe { let stash = self.to_glib_none(); glib::Bytes::from_glib_none(libnm_sys::nm_setting_wireless_get_ssid(stash.0)).to_vec() } } }<|fim_prefix|>// repo: AndreasOlofsson/libnm path: /src/nm_set...
code_fim
medium
{ "lang": "rust", "repo": "AndreasOlofsson/libnm", "path": "/src/nm_setting_wireless.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AndreasOlofsson/libnm path: /src/nm_setting_wireless.rs use crate::*; use glib::translate::*; glib::glib_wrapper!( pub struct NMSettingWireless(Object<libnm_sys::NMSettingWireless, libnm_sys::NMSettingWirelessClass, NMSettingWirelessClass>) @extends NMSetting; <|fim_suffix|>impl NM...
code_fim
medium
{ "lang": "rust", "repo": "AndreasOlofsson/libnm", "path": "/src/nm_setting_wireless.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let ConstDecl { value, .. } = self; value.into() } } #[test] fn const_decl_nil() { let (_, res) = const_decl("K1 = nil\0").unwrap(); assert_eq!( res, ConstDecl { id: Ref::Const(1), value: ConstValue::Nil } ); } #[test] fn con...
code_fim
hard
{ "lang": "rust", "repo": "xfoxfu/luaasm", "path": "/luaasm/src/parser/constdecl.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xfoxfu/luaasm path: /luaasm/src/parser/constdecl.rs #![allow(dead_code)] use super::ParseResult; use super::{const_val, ref_constant, AstCheck, ConstValue, Ref}; use nom::bytes::complete::*; use nom::character::complete::*; use nom::sequence::*; use serde_derive::Serialize; #[derive(Serialize,...
code_fim
hard
{ "lang": "rust", "repo": "xfoxfu/luaasm", "path": "/luaasm/src/parser/constdecl.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aprimadi/thordb path: /src/storage/partial_row.rs /// A partial row represents a row with only partial columns data. struct PartialRow { size: usize, // TODO: Use real bitmap implementation null_b<|fim_suffix|>rtialRow { /// Return struct size fn size() -> usize { 0 ...
code_fim
medium
{ "lang": "rust", "repo": "aprimadi/thordb", "path": "/src/storage/partial_row.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>rtialRow { /// Return struct size fn size() -> usize { 0 } }<|fim_prefix|>// repo: aprimadi/thordb path: /src/storage/partial_row.rs /// A partial row represents a row with only partial columns data. struct PartialRow { size: usize, // TODO: Use real bitmap implementation ...
code_fim
medium
{ "lang": "rust", "repo": "aprimadi/thordb", "path": "/src/storage/partial_row.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>itmap: Vec<u8>, columns: Vec<ColumnId>, values: Vec<String>, } impl PartialRow { /// Return struct size fn size() -> usize { 0 } }<|fim_prefix|>// repo: aprimadi/thordb path: /src/storage/partial_row.rs /// A partial row represents a row with only partial columns data. struc...
code_fim
medium
{ "lang": "rust", "repo": "aprimadi/thordb", "path": "/src/storage/partial_row.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dowlandaiello/wavelet path: /testdata/contract_call.rs use std::error::Error; use smart_contract::payload::Parameters; use smart_contract::transaction::{Transaction, Transfer}; use smart_contract_macros::smart_contract; <|fim_suffix|> // Create and send transaction. Transfer { ...
code_fim
hard
{ "lang": "rust", "repo": "dowlandaiello/wavelet", "path": "/testdata/contract_call.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn on_money_received(&mut self, params: &mut Parameters) -> Result<(), Box<dyn Error>> { // Create and send transaction. Transfer { destination: params.sender, amount: (params.amount + 1) / 2, func_name: vec![], func_params: vec![], ...
code_fim
medium
{ "lang": "rust", "repo": "dowlandaiello/wavelet", "path": "/testdata/contract_call.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>type Array = [u32; { let mut x = 2; let y = &mut x; //~^ ERROR references in constants may only refer to immutable values *y = 42; //~^ ERROR constant contains unimplemented expression type *y }]; fn main() { assert_eq!(FOO.state, 3); }<|fim_prefix|>// repo: IThawk/rust-project path:...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/consts/const_let_assign3.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/consts/const_let_assign3.rs #![feature(const_fn)] struct S { state: u32, } impl S { const fn foo(&mut self, x: u32) { self.state = x; //~^ contains unimplemented expression } } <|fim_suffix|>type Array = [u32; { ...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/consts/const_let_assign3.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ("careful; see exercise 27.2 in The TeXbook."); // @:TeXbook}{\sl The \TeX book@> // if cur_cs=0 then back_input; // cur_tok:=cs_token_flag+frozen_protection; ins_error; goto restart; // end; } // end; crate::ok_nojump!() } use crate::section_0004::TeXG...
code_fim
hard
{ "lang": "rust", "repo": "harpsword/tex-rs", "path": "/src/tex_the_program/section_1215.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>e!("cur_cs = {}", globals.cur_cs); todo!(); // begin print_err("Missing control sequence inserted"); // @.Missing control...@> // help5("Please don't say `\def cs{...}', say `\def\cs{...}'.")@/ // ("I've inserted an inaccessible control sequence so that your")...
code_fim
hard
{ "lang": "rust", "repo": "harpsword/tex-rs", "path": "/src/tex_the_program/section_1215.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: harpsword/tex-rs path: /src/tex_the_program/section_1215.rs //! @ When a control sequence is to be defined, by \.{\\def} or \.{\\let} or //! something similar, the |get_r_token| routine will substitute a special //! control sequence for a token that is not redefinable. // // @<Declare subprocedu...
code_fim
hard
{ "lang": "rust", "repo": "harpsword/tex-rs", "path": "/src/tex_the_program/section_1215.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ncharlton02/cannon path: /examples/input2.rs extern crate winapi; extern crate cannon; use cannon::{Console}; use cannon::input; use std::thread; use std::sync::mpsc::channel; <|fim_suffix|> if let Some(key) = key_opt{ tx.send(key); } ...
code_fim
hard
{ "lang": "rust", "repo": "ncharlton02/cannon", "path": "/examples/input2.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(key) = key_opt{ tx.send(key); } } } }); loop { println!("{:?}", rx.recv().unwrap()); console.set_cursor_position(0,0); } } fn key_event(event: [u32;4]) -> Option<input::Key>{ //We don't car...
code_fim
hard
{ "lang": "rust", "repo": "ncharlton02/cannon", "path": "/examples/input2.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[allow(unsafe_code)] unsafe impl JSTraceable for XmlTokenizer<XmlTreeBuilder<Dom<Node>, Sink>> { unsafe fn trace(&self, trc: *mut JSTracer) { struct Tracer(*mut JSTracer); let tracer = Tracer(trc); impl XmlTracer for Tracer { type Handle = Dom<Node>; #...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rustc-perf", "path": "/collector/compile-benchmarks/style-servo/components/script/dom/servoparser/xml.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn url(&self) -> &ServoUrl { &self.inner.sink.sink.base_url } } #[allow(unsafe_code)] unsafe impl JSTraceable for XmlTokenizer<XmlTreeBuilder<Dom<Node>, Sink>> { unsafe fn trace(&self, trc: *mut JSTracer) { struct Tracer(*mut JSTracer); let tracer = Tracer(trc); ...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rustc-perf", "path": "/collector/compile-benchmarks/style-servo/components/script/dom/servoparser/xml.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sshyran/imx8-rust path: /imx8mm/src/gpc/cpu_pgc_sw_pup_req.rs #[doc = r" Value read from the register"] pub struct R { bits: u32, } #[doc = r" Value to write to the register"] pub struct W { bits: u32, } impl super::CPU_PGC_SW_PUP_REQ { #[doc = r" Modifies the contents of the registe...
code_fim
hard
{ "lang": "rust", "repo": "sshyran/imx8-rust", "path": "/imx8mm/src/gpc/cpu_pgc_sw_pup_req.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>e; const OFFSET: u8 = 1; ((self.bits >> OFFSET) & MASK as u32) != 0 }; CORE1_A53_SW_PUP_REQR { bits } } #[doc = "Bit 2 - Software power up trigger for Core2 A53"] #[inline] pub fn core2_a53_sw_pup_req(&self) -> CORE2_A53_SW_PUP_REQR { let bit...
code_fim
hard
{ "lang": "rust", "repo": "sshyran/imx8-rust", "path": "/imx8mm/src/gpc/cpu_pgc_sw_pup_req.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<P: SharedOwnership> GlyphCache<P> { pub fn new() -> Self { Default::default() } #[cfg(feature = "font-loading")] pub fn clear(&mut self) { self.glyphs.clear(); } pub fn lookup_or_insert( &mut self, font: &Font<'_>, glyph: u32, ...
code_fim
hard
{ "lang": "rust", "repo": "yang-dong-dong/livesplit-core", "path": "/src/rendering/font/glyph_cache.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<P> Default for GlyphCache<P> { fn default() -> Self { Self { glyphs: Default::default(), } } } impl<P: SharedOwnership> GlyphCache<P> { pub fn new() -> Self { Default::default() } #[cfg(feature = "font-loading")] pub fn clear(&mut self) { ...
code_fim
hard
{ "lang": "rust", "repo": "yang-dong-dong/livesplit-core", "path": "/src/rendering/font/glyph_cache.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yang-dong-dong/livesplit-core path: /src/rendering/font/glyph_cache.rs use std::marker::PhantomData; use crate::{ rendering::resource::{Handle, Handles, PathBuilder, ResourceAllocator, SharedOwnership}, settings::Color, }; use super::{color_font::iter_colored_glyphs, Font}; use hashbro...
code_fim
medium
{ "lang": "rust", "repo": "yang-dong-dong/livesplit-core", "path": "/src/rendering/font/glyph_cache.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[async_trait] impl Overwritable for VagabondItem { async fn overwrite(&self, game: &str, conn: &mut PgConnection) -> sqlx::Result<()> { query!( " INSERT INTO vagabond_items (game, item, faction, exhausted, damaged) VALUES ($1, $2, $3, $4, $5) ON...
code_fim
hard
{ "lang": "rust", "repo": "foxfriends/root", "path": "/src/models/vagabond_item.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: foxfriends/root path: /src/models/vagabond_item.rs use super::*; use sqlx::{postgres::PgConnection, query, query_as}; #[derive(Clone, serde::Serialize, serde::Deserialize)] #[serde(rename = "vagabond_item")] pub struct VagabondItem { item: i16, faction: FactionId, exhausted: bool, ...
code_fim
hard
{ "lang": "rust", "repo": "foxfriends/root", "path": "/src/models/vagabond_item.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let handler = (BasicAuth::new("jacob", "7r1ll1um"), "ok"); assert_status!( get("/") .with_request_header( "Authorization", format!("Basic {}", base64::encode("jacob:")) ) .on(&handler), 401 ); assert_statu...
code_fim
hard
{ "lang": "rust", "repo": "vijfhoek/trillium", "path": "/basic-auth/tests/tests.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vijfhoek/trillium path: /basic-auth/tests/tests.rs use trillium_basic_auth::*; use trillium_testing::prelude::*; #[test] fn correct_auth() { let handler = (BasicAuth::new("jacob", "7r1ll1um"), "ok"); assert_ok!( get("/") .with_request_header( "Authori...
code_fim
hard
{ "lang": "rust", "repo": "vijfhoek/trillium", "path": "/basic-auth/tests/tests.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }