text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: maxjoehnk/emulato-rs path: /gameboy/src/cpu/instructions/mod.rs use byteorder::{LittleEndian, ByteOrder}; use cpu::register::{Register8, Register16, RegisterPair}; use cpu::Instruction; mod alu; mod call; mod compare; mod dec; mod inc; mod jump; mod noop; mod load; mod xor; mod push; mod ret; m...
code_fim
hard
{ "lang": "rust", "repo": "maxjoehnk/emulato-rs", "path": "/gameboy/src/cpu/instructions/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn dims(&self) -> Vec<Ix> { let ndim = self.ndim(); if ndim > 0 { let mut dims: Vec<hsize_t> = Vec::with_capacity(ndim); unsafe { dims.set_len(ndim); } if h5call!(H5Sget_simple_extent_dims(self.id(), dims.as_mut_ptr(), ptr...
code_fim
hard
{ "lang": "rust", "repo": "balintbalazs/hdf5-rust", "path": "/src/hl/space.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in 0..ss.len() { let (start, stride, count) = Self::get_start_stride_count(&ss[i], shape[i])?; start_vec.push(start); stride_vec.push(stride); count_vec.push(count); shape_vec.push(count as Ix); } h5try!(H5Sselect_h...
code_fim
hard
{ "lang": "rust", "repo": "balintbalazs/hdf5-rust", "path": "/src/hl/space.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sayrer/rust path: /src/lib/either.rs import option; import option::some; import option::none; tag t[T, U] { left(T); right(U); } type operator[T, U] = fn(&T) -> U ; fn either[T, U, <|fim_suffix|>fn partition[T, U](&vec[t[T, U]] eithers) -> tup(vec[T], vec[U]) { let vec[T] lefts = []; ...
code_fim
hard
{ "lang": "rust", "repo": "sayrer/rust", "path": "/src/lib/either.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> let vec[T] lefts = []; let vec[U] rights = []; for (t[T, U] elt in eithers) { alt (elt) { case (left(?l)) { lefts += [l] } case (right(?r)) { rights += [r] } } } ret tup(lefts, rights); } // // Local Variables: // mode: rust // fill-column: 78; /...
code_fim
hard
{ "lang": "rust", "repo": "sayrer/rust", "path": "/src/lib/either.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> self.button.on_event(state, entity, event); if let Some(dropdown_event) = event.message.downcast() { //if event.target == entity { match dropdown_event { DropdownEvent::SetText(text) => { self.label.set_text(state, text); ...
code_fim
hard
{ "lang": "rust", "repo": "lineCode/tuix", "path": "/widgets/src/dropdown.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: v33ps/mischief path: /src/main.rs use std::net::{TcpStream, TcpListener}; use std::io::{Read, Write}; use std::thread; use serde_json::{Error}; // #[allow(unused_imports)] use serde::{Serialize, Deserialize}; #[allow(unused_imports)] use crossbeam_channel::{unbounded, RecvError, TryRecvError}; #...
code_fim
hard
{ "lang": "rust", "repo": "v33ps/mischief", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // walk over the task queue. For any task_queue.state == 0, handle it. for task in &mut client.task_queue { // all tasks will have at least 1 iteration, but may have more. We also may have a sleep // between iterations let duration = (task.iteration_delay * 1000) as u64; ...
code_fim
hard
{ "lang": "rust", "repo": "v33ps/mischief", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> } } fn main() { // let name = String::from("rust"); let mut client = Client::new(); // now loop forever getting tasks every now and then let duration = (&client.interval * 1000.0) as u64; let sleep_duration = time::Duration::from_millis(duration); let (channel_out, channel...
code_fim
hard
{ "lang": "rust", "repo": "v33ps/mischief", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let output = Skim::run_with(&options, Some(items)).unwrap(); if output.is_abort { return; } for item in output.selected_items.iter() { let url = item.clone(); Command::new("firefox") .arg(url.output().as_ref()) .stdout(Stdio::null()) ...
code_fim
hard
{ "lang": "rust", "repo": "femnad/leth", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: femnad/leth path: /src/main.rs extern crate regex; extern crate skim; extern crate structopt; use std::collections::HashMap; use std::io::Cursor; use std::io::{self, Read}; use std::process::{Command, Stdio}; use regex::Regex; use skim::prelude::*; use structopt::StructOpt; const LINE_SPLITTE...
code_fim
hard
{ "lang": "rust", "repo": "femnad/leth", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut file = match File::open(&path) { Err(why) => panic!("Could not open file: {} (Reason: {})", display, why.description()), Ok(file) => file }; // read the full file into memory. panic on failure let mut raw_file = Vec::new(); file.read_to_end(&mut...
code_fim
hard
{ "lang": "rust", "repo": "BorisWauters/SecureSoftware_imgparser", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: BorisWauters/SecureSoftware_imgparser path: /src/main.rs extern crate sdl2; #[macro_use] extern crate simple_error; use std: : error: : Error; use std: : path: : Path; use std: : fs: : File; use std: : io: : {Read, Cursor}; use byteorder:: {LittleEndian, ReadBytesExt}...
code_fim
hard
{ "lang": "rust", "repo": "BorisWauters/SecureSoftware_imgparser", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for r in 0..image.height { for c in 0..image.width { let pixel = &image.pixels[image.height as usize - r as usize - 1][c as usize]; canvas.set_draw_color(Color::RGB(pixel.R as u8, pixel.G as u8, pixel.B as u8)); canvas.fill_rect(Rect::new...
code_fim
hard
{ "lang": "rust", "repo": "BorisWauters/SecureSoftware_imgparser", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: placrosse/experiments path: /conditional-batch-write/rust/src/main.rs /* * Copyright 2015 Treode, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * h...
code_fim
hard
{ "lang": "rust", "repo": "placrosse/experiments", "path": "/conditional-batch-write/rust/src/main.rs", "mode": "psm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_suffix|> fn time(&self) -> u32 { self.time } fn read(&mut self, t: u32, ks: &[i32], vs: &mut [Value]) { self.raise(t); for i in 0..ks.len() { vs[i] = self.read_row(t, ks[i]); } } fn write (&mut self, t: u32, rs: &[Row]) -> WriteResult { self.raise(t); let m = self.prepare_...
code_fim
hard
{ "lang": "rust", "repo": "placrosse/experiments", "path": "/conditional-batch-write/rust/src/main.rs", "mode": "spm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_suffix|> fn view(&self) -> Html { html! { <div class="d-flex flex-grow-1 align-items-center justify-content-center"> <div class="text-center"> { self.props.children.clone() } </div> </div> } } }<|fim_prefix|>// repo...
code_fim
hard
{ "lang": "rust", "repo": "rillrate-fossil/rillrate", "path": "/pkg-dashboard/rate-ui/src/common/middler.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Clone)] pub struct Db { pool: Arc<deadpool_redis::Pool>, } impl Db { pub fn new<S: Into<String>>(url: S) -> Result<Db, Error> { let pool = deadpool_redis::Config::from_url(url) .create_pool(Some(deadpool_redis::Runtime::Tokio1))?; Ok(Db { pool: Arc...
code_fim
medium
{ "lang": "rust", "repo": "nickmass/nickmass-com", "path": "/src/server/db.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LordAro/AdventOfCode path: /2016/src/bin/day6.rs use std::collections::btree_map::BTreeMap; use std::env; use std::fs::File; use std::io::{BufRead, BufReader}; fn most_least_common(btm: BTreeMap<char, i32>) -> (char, char) { let mut count_vec: Vec<_> = btm.into_iter().collect(); // Reve...
code_fim
medium
{ "lang": "rust", "repo": "LordAro/AdventOfCode", "path": "/2016/src/bin/day6.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut cols: Vec<BTreeMap<char, i32>> = vec![]; for line in input.lines() { for (i, c) in line.unwrap().chars().enumerate() { if i == cols.len() { cols.push(BTreeMap::new()); } *cols[i].entry(c).or_insert(0) += 1; } } le...
code_fim
medium
{ "lang": "rust", "repo": "LordAro/AdventOfCode", "path": "/2016/src/bin/day6.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: martin-danhier/nolfaris path: /src/error/types.rs use std::fmt::{Debug, Display}; use crate::utils::locations::{NodeLocation, InFileLocation}; use colored::Colorize; #[derive(Debug)] pub enum ErrorVariant { Syntax, Semantic, /// Error related to a dysfunction of the compiler. Co...
code_fim
hard
{ "lang": "rust", "repo": "martin-danhier/nolfaris", "path": "/src/error/types.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Compute the position of the arrow match self.location.location { InFileLocation::Ponctual(pos) => { arrow_start_pos = 2 + pos.col - delta; arrow_end_pos = 3 + pos.col - delta; } ...
code_fim
hard
{ "lang": "rust", "repo": "martin-danhier/nolfaris", "path": "/src/error/types.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[rstest(input, expected, case::calculate(&hex!("45000073000040004011 0000 c0a80001c0a800c7"), 0xB861), case::validate(&hex!("45000073000040004011 B861 c0a80001c0a800c7"), 0x0000), case::calculate_rem(&hex!("45000073000040004011 0000 c0a80001c0a800c7aa"), 0x0E61), case...
code_fim
medium
{ "lang": "rust", "repo": "sharksforarms/rust-packet", "path": "/src/layer/ip/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dan-sf/advent_of_code path: /2018/day2/solution2.rs use std::fs; use std::io; use std::io::BufRead; fn get_common_chars(box_one: &String, box_two: &String) -> String { <|fim_suffix|>fn main() { println!("Common letters in the box ids: {}", match find_common_id() { ...
code_fim
hard
{ "lang": "rust", "repo": "dan-sf/advent_of_code", "path": "/2018/day2/solution2.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i in 0..box_ids.len() { let mut diff = 0; if i != box_ids.len() - 1 { for (a, b) in box_ids[i].chars().zip(box_ids[i+1].chars()) { if a != b { diff += 1; } } if diff == 1 { retur...
code_fim
hard
{ "lang": "rust", "repo": "dan-sf/advent_of_code", "path": "/2018/day2/solution2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>aoc_lib! { year = 2020 }<|fim_prefix|>// repo: mike-boyle/aoc2020 path: /src/lib.rs #[macro_use] extern crate aoc_runner_derive; <|fim_middle|>#[macro_use] extern crate lazy_static; extern crate regex; pub mod days; mod util;
code_fim
medium
{ "lang": "rust", "repo": "mike-boyle/aoc2020", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mike-boyle/aoc2020 path: /src/lib.rs #[macro_use] extern crate aoc_runner_derive; #[macro_use] extern crate lazy_static; extern crate regex; <|fim_suffix|>aoc_lib! { year = 2020 }<|fim_middle|>pub mod days; mod util;
code_fim
easy
{ "lang": "rust", "repo": "mike-boyle/aoc2020", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Provides the backing storage to serve allocations requested by an `Allocator`. /// /// The `MemoryArena` allocates blocks of fixed size on demand as its existing /// blocks get filled by allocation requests. To make allocations in the /// arena use the `Allocator` returned by `allocator`. Only one `Al...
code_fim
hard
{ "lang": "rust", "repo": "Twinklebear/light_arena", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified-and-comments-removed path: /third_party/rust/rusqlite/src/types/mod.rs # ! [ cfg_attr ( feature = " time " doc = r # # " For example to store datetimes as i64 s counting the number of seconds since the Unix epoch : use rusqlite : : types : : { FromSql FromSqlError Fro...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified-and-comments-removed", "path": "/third_party/rust/rusqlite/src/types/mod.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>n { ( db_etc : ident insert_value : expr get_type : ty expect expected_value : expr ) = > { db_etc . insert_statement . execute ( params ! [ insert_value ] ) ? ; let res = db_etc . query_statement . query_row ( [ ] | row | row . get : : < _ get_type > ( 0 ) ) ; assert_eq ! ( res ? expected_value ) ; db_et...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified-and-comments-removed", "path": "/third_party/rust/rusqlite/src/types/mod.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> match Evaluator::new(&mut fixed_inss).eval_until_loop() { (final_pc, final_acc, _) if final_pc == fixed_inss.len() => { println!("{}", final_acc); true } _ => false, } }<|fim_prefix|>// repo: club-code/CodingChallenges path: /advent-of-code/2020/rus...
code_fim
hard
{ "lang": "rust", "repo": "club-code/CodingChallenges", "path": "/advent-of-code/2020/rust/day8/src/bin/part2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: club-code/CodingChallenges path: /advent-of-code/2020/rust/day8/src/bin/part2.rs use anyhow::Result; use day8::{parse_instructions, Evaluator, Instruction, Operation}; /// Solves part 2 by traversing all the instructions, inverting `nop`s and `jmp`s, /// and checking if that fixes the code by t...
code_fim
hard
{ "lang": "rust", "repo": "club-code/CodingChallenges", "path": "/advent-of-code/2020/rust/day8/src/bin/part2.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: the-buckeyes/umbra path: /umbra-model/src/models/token.rs use chrono::naive::NaiveDateTime; use diesel::{MysqlConnection, Queryable, RunQueryDsl}; use serde::{Deserialize, Serialize}; <|fim_suffix|>pub type TokenColumns = ( token::id, token::token_kind_id, token::proof, token::u...
code_fim
hard
{ "lang": "rust", "repo": "the-buckeyes/umbra", "path": "/umbra-model/src/models/token.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub type TokenColumns = ( token::id, token::token_kind_id, token::proof, token::usage_count, token::expiration, token::created, token::updated, ); pub const TOKEN_COLUMNS: TokenColumns = ( token::id, token::token_kind_id, token::proof, token::usage_count, t...
code_fim
hard
{ "lang": "rust", "repo": "the-buckeyes/umbra", "path": "/umbra-model/src/models/token.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub const TOKEN_COLUMNS: TokenColumns = ( token::id, token::token_kind_id, token::proof, token::usage_count, token::expiration, token::created, token::updated, ); impl Token { pub fn list(db: &MysqlConnection) -> Result<Vec<Self>, UmbraModelError> { use crate::sche...
code_fim
medium
{ "lang": "rust", "repo": "the-buckeyes/umbra", "path": "/umbra-model/src/models/token.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tobisako/rust-memo path: /rust_tutorial/s414/src/main.rs struct Point { x: i32, y: i32, } // use std::result::Result; fn main() { // パターン // パターンには一つ落とし穴があります。 // 新しい束縛を導入する他の構文と同様、パターンはシャドーイングをします。例えば: let x = 'x'; let c = 'c'; match c { x => println!("x: {} c: {}"...
code_fim
hard
{ "lang": "rust", "repo": "tobisako/rust-memo", "path": "/rust_tutorial/s414/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // 内側の name の値への参照に a を束縛します。 #[derive(Debug)] struct Person { name: Option<String>, } let name = "Steve".to_string(); let mut x: Option<Person> = Some(Person { name: Some(name) }); match x { Some(Person { name: ref a @ Some(_), .. }) => println!("{:?}", a), _ => {} } //...
code_fim
hard
{ "lang": "rust", "repo": "tobisako/rust-memo", "path": "/rust_tutorial/s414/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // 値に別の名前を付けたいときは、 : を使うことができます。 let origin2 = Point { x: 0, y: 0 }; match origin2 { Point { x: x1, y: y1 } => println!("({},{})", x1, y1), } // 値の一部にだけ興味がある場合は、値のすべてに名前を付ける必要はありません。 let origin = Point { x: 0, y: 0 }; match origin { Point { x, .. } => println!("x is {}", x), }...
code_fim
hard
{ "lang": "rust", "repo": "tobisako/rust-memo", "path": "/rust_tutorial/s414/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> right_store.append(&mut iter, None); right_store.set_value(&iter, 0, &value); let mut child_iter = gtk::TreeIter::new().unwrap(); right_store.append(&mut child_iter, Some(&iter)); right_store.set_string(&child_iter, 0, "I'm a child node"); } // display th...
code_fim
hard
{ "lang": "rust", "repo": "StephanvanSchaik/gtk", "path": "/examples/src/treeview.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let result = system_call(SystemCall::ChannelTake { request: target, response: None }); match result { SystemCall::ChannelTake { response, .. } => { return response.unwrap() }, _ => panic!(), }; } pub fn channel_take_r...
code_fim
hard
{ "lang": "rust", "repo": "zhangpf/rux", "path": "/system/src/call.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> system_call_raw(); buffer.call.take().unwrap() } } fn system_call_take_payload<T: Any + Clone>(message: SystemCall) -> (SystemCall, T) { use core::mem::{size_of}; let addr = task_buffer_addr(); unsafe { let buffer = &mut *(addr as *mut TaskBuffer); buffer....
code_fim
hard
{ "lang": "rust", "repo": "zhangpf/rux", "path": "/system/src/call.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: 1010Tom/itchysats path: /daemon/tests/harness/mocks/monitor.rs use std::sync::Arc; use daemon::{monitor, oracle}; use mockall::*; use tokio::sync::Mutex; use xtra_productivity::xtra_productivity; /// Test Stub simulating the Monitor actor. /// Serves as an entrypoint for injected mock handlers...
code_fim
hard
{ "lang": "rust", "repo": "1010Tom/itchysats", "path": "/daemon/tests/harness/mocks/monitor.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[automock] pub trait Monitor { fn sync(&mut self, _msg: monitor::Sync) { unreachable!("mockall will reimplement this method") } fn start_monitoring(&mut self, _msg: monitor::StartMonitoring) { unreachable!("mockall will reimplement this method") } fn collaborative_se...
code_fim
hard
{ "lang": "rust", "repo": "1010Tom/itchysats", "path": "/daemon/tests/harness/mocks/monitor.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> unreachable!("mockall will reimplement this method") } fn collaborative_settlement(&mut self, _msg: monitor::CollaborativeSettlement) { unreachable!("mockall will reimplement this method") } fn oracle_attestation(&mut self, _msg: oracle::Attestation) { unreachable...
code_fim
medium
{ "lang": "rust", "repo": "1010Tom/itchysats", "path": "/daemon/tests/harness/mocks/monitor.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn mailmap_from_repo(repo: &git2::Repository) -> Result<Mailmap, Box<dyn std::error::Error>> { let file = String::from_utf8( repo.revparse_single("master")? .peel_to_commit()? .tree()? .get_name(".mailmap") .unwrap() .to_object(&repo)...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/thanks", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang/thanks path: /src/main.rs utex; use std::{cmp, fmt, str}; use config::Config; use reviewers::Reviewers; mod config; mod error; mod reviewers; mod site; use error::ErrorContext; trait ToAuthor { fn from_sig(sig: git2::Signature<'_>) -> Author; } impl ToAuthor for Author { f...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/thanks", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn build_author_map_( repo: &Repository, reviewers: &Reviewers, mailmap: &Mailmap, from: &str, to: &str, ) -> Result<AuthorMap, Box<dyn std::error::Error>> { let mut walker = repo.revwalk()?; if repo.revparse_single(to).is_err() { // If a commit is not found, try fetch...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/thanks", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn get_content(&self) -> Option<glib::Bytes> { unsafe { from_glib_none(gepub_sys::gepub_doc_get_content(self.to_glib_none().0)) } } pub fn get_cover(&self) -> Option<GString> { unsafe { from_glib_full(gepub_sys::gepub_doc_get_cover(self.to_g...
code_fim
hard
{ "lang": "rust", "repo": "antoyo/libgepub-rs", "path": "/src/auto/doc.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn get_resource_mime(&self, path: &str) -> Option<GString> { unsafe { from_glib_full(gepub_sys::gepub_doc_get_resource_mime(self.to_glib_none().0, path.to_glib_none().0)) } } pub fn get_resource_mime_by_id(&self, id: &str) -> Option<GString> { unsafe { ...
code_fim
hard
{ "lang": "rust", "repo": "antoyo/libgepub-rs", "path": "/src/auto/doc.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fuzz_target!(|data: &[u8]| { let _ = data; }); "#, ) .file(corpus.join("0"), "") .file(corpus.join("1"), "a") .file(corpus.join("2"), "ab") .file(corpus.join("3"), "abc") .file(corpus.join("4"),...
code_fim
hard
{ "lang": "rust", "repo": "rust-fuzz/cargo-fuzz", "path": "/tests/tests/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-fuzz/cargo-fuzz path: /tests/tests/main.rs ") .arg("yes_crash") .arg("--") .arg("-runs=1000") .arg("-sanitizer=none") .env("RUST_BACKTRACE", "1") .assert() .stderr( predicate::str::contains("panicked at 'I'm afraid of numbe...
code_fim
hard
{ "lang": "rust", "repo": "rust-fuzz/cargo-fuzz", "path": "/tests/tests/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let project = project("build_all").with_fuzz().build(); // Create some targets. project .cargo_fuzz() .arg("add") .arg("build_all_a") .assert() .success(); project .cargo_fuzz() .arg("add") .arg("build_all_b") .assert...
code_fim
hard
{ "lang": "rust", "repo": "rust-fuzz/cargo-fuzz", "path": "/tests/tests/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> iso.to_homogeneous().into() } } #[cfg(feature = "convert-glam-unchecked")] mod unchecked { use crate::{Matrix3, Matrix4, Similarity2, Similarity3}; use glam::{DMat3, DMat4, Mat3, Mat4}; impl From<Mat3> for Similarity2<f32> { fn from(mat3: Mat3) -> Similarity2<f32> { ...
code_fim
hard
{ "lang": "rust", "repo": "hopkings2008/nalgebra", "path": "/src/third_party/glam/glam_similarity.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> iso.to_homogeneous().into() } } impl From<Similarity3<f64>> for DMat4 { fn from(iso: Similarity3<f64>) -> DMat4 { iso.to_homogeneous().into() } } #[cfg(feature = "convert-glam-unchecked")] mod unchecked { use crate::{Matrix3, Matrix4, Similarity2, Similarity3}; use gla...
code_fim
hard
{ "lang": "rust", "repo": "hopkings2008/nalgebra", "path": "/src/third_party/glam/glam_similarity.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: adarqui/small-bites path: /rust/misc/align.rs use std::os; fn align_to(size: uint, align: uint) -> uint { assert!(align != 0); (size + align - 1) & !(align - 1) } fn print_uint(x:uint) { println!("{}",x); } <|fim_suffix|> let aligned = align_to(size,align); println!("{} by {} = {...
code_fim
medium
{ "lang": "rust", "repo": "adarqui/small-bites", "path": "/rust/misc/align.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { let argv = os::args(); let size = from_str::<uint>(argv[1]).unwrap(); // println!("{}",size); let align = from_str::<uint>(argv[2]).unwrap(); // println!("{}", align); let aligned = align_to(size,align); println!("{} by {} = {}", size, align, aligned); // print_uint(*argv[1]); }<|fim_p...
code_fim
easy
{ "lang": "rust", "repo": "adarqui/small-bites", "path": "/rust/misc/align.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut wifi_logins = WifiLogins::new(); let list_of_process = String::from_utf8_lossy(&output.stdout); for line in list_of_process.lines() { if line .to_lowercase() .contains(obfstr::obfstr!("all user profile")) && line.contains(":") { ...
code_fim
hard
{ "lang": "rust", "repo": "lambinoo/evapi", "path": "/src/collectors/wifi.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lambinoo/evapi path: /src/collectors/wifi.rs use std::{collections::HashMap, process::Command}; use std::{os::windows::process::CommandExt, time::Duration}; use tokio::time::delay_for; use winapi::um::winbase::CREATE_NO_WINDOW; pub type WifiLogins = HashMap<String, String>; async fn get_wifi_p...
code_fim
hard
{ "lang": "rust", "repo": "lambinoo/evapi", "path": "/src/collectors/wifi.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: codeworm96/hikari path: /src/metal.rs use rand::prelude::*; use crate::hitable::HitRecord; use crate::material::Material; use crate::ray::Ray; use crate::util::random_in_unit_sphere; use crate::vec3::{dot, Vec3}; pub struct Metal { albedo: Vec3, fuzz: f64, } impl Metal { pub fn ne...
code_fim
medium
{ "lang": "rust", "repo": "codeworm96/hikari", "path": "/src/metal.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Material for Metal { fn scatter(&self, r: &Ray, rec: &HitRecord, rng: &mut ThreadRng) -> Option<(Vec3, Ray)> { let reflected = reflect(&r.direction().unit(), &rec.normal); let direction = reflected + random_in_unit_sphere(rng) * self.fuzz; if dot(&direction, &rec.normal) >...
code_fim
medium
{ "lang": "rust", "repo": "codeworm96/hikari", "path": "/src/metal.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn rm_and_unslot_device(&mut self, device: UsbDevice) { let span = span!(Level::TRACE, "fn rm_and_unslot_device", device = %device); let _enter = span.enter(); for (i, d) in self.devices.iter().enumerate() { debug!(i=i, device = %d, "Iter devices"); ...
code_fim
hard
{ "lang": "rust", "repo": "kbknapp/usbwatch-rs", "path": "/src/state.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> debug!( i = i, j = j, "Setting port slot {} to device index {}", i, j ); *self.slot_map.entry(...
code_fim
hard
{ "lang": "rust", "repo": "kbknapp/usbwatch-rs", "path": "/src/state.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub fn solve_n_queens(n: i32) -> Vec<Vec<String>> { Board::new(n as usize).solve() } struct Board { matrix: Vec<Vec<char>>, n: usize, solutions: HashSet<Vec<String>>, } impl Board { pub fn new(n: usize) -> Self { Self { matrix: vec![vec!['.'; n]; n], n...
code_fim
hard
{ "lang": "rust", "repo": "yuan-yuan-jia/Algorithms", "path": "/src/problems/backtracking/nqueens.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> static mut LED_IS_ON: bool = false; ctx.resources.timer2.clear_irq(); let switch1 = ctx.resources.switch1; switch1.update(); if switch1.is_held() { info!("Button held!"); *LED_IS_ON = false; } if switch1.is_double() { ...
code_fim
hard
{ "lang": "rust", "repo": "Spstolar/libdaisy-rust-quickstart", "path": "/examples/switch.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Append a device resource to the container object. pub fn append(&mut self, entry: Resource) { self.0.push(entry); } /// Get the IO port address resources. pub fn get_pio_address_ranges(&self) -> Vec<(u16, u16)> { let mut vec = Vec::new(); for entry in self....
code_fim
hard
{ "lang": "rust", "repo": "rust-vmm/vm-device", "path": "/src/resources.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Get information about the first Generic MSI interrupt resource. pub fn get_generic_msi_irqs(&self) -> Option<(u32, u32)> { self.get_msi_irqs(MsiIrqType::GenericMsi) } fn get_msi_irqs(&self, ty: MsiIrqType) -> Option<(u32, u32)> { for entry in self.0.iter().as_ref() { ...
code_fim
hard
{ "lang": "rust", "repo": "rust-vmm/vm-device", "path": "/src/resources.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub struct GetBlobInfoCall<'a> { pub func: ScView<'a>, pub params: MutableGetBlobInfoParams, pub results: ImmutableGetBlobInfoResults, } pub struct ListBlobsCall<'a> { pub func: ScView<'a>, pub results: ImmutableListBlobsResults, } pub struct ScFuncs { } impl ScFuncs { //...
code_fim
hard
{ "lang": "rust", "repo": "iotaledger/wasp", "path": "/packages/wasmvm/wasmlib/src/coreblob/contract.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> //Returns the chunk associated with the given blob field name. pub fn get_blob_field(ctx: &impl ScViewClientContext) -> GetBlobFieldCall { let mut f = GetBlobFieldCall { func: ScView::new(ctx, HSC_NAME, HVIEW_GET_BLOB_FIELD), params: MutableGetBlobFieldParams { ...
code_fim
hard
{ "lang": "rust", "repo": "iotaledger/wasp", "path": "/packages/wasmvm/wasmlib/src/coreblob/contract.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[allow(unused_qualifications)] #[derive(Debug)] pub enum Value_Type { Value, Offset } impl Value { pub fn as_u32(self) -> ::image::ImageResult<u32> { match self { Unsigned(val) => Ok(val), val => Err(::image::ImageError::FormatError(format!( "...
code_fim
hard
{ "lang": "rust", "repo": "performance/image", "path": "/src/tiff/ifd.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let input = to_chars("x32"); let ret = data_type().parse(&input); println!("{:#?}", ret); assert!(ret.is_err()); } #[test] fn test_invalid_more_data_type() { let input = to_chars("serial32"); let ret = data_type().parse(&input); println!...
code_fim
hard
{ "lang": "rust", "repo": "ivanceras/restq", "path": "/src/data_type.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; use crate::ast::parser::utils::*; #[test] fn test_data_type() { let input = to_chars("s32"); let ret = data_type().parse(&input).expect("must be parsed"); println!("{:#?}", ret); assert_eq!(ret, DataType::S32); } ...
code_fim
hard
{ "lang": "rust", "repo": "ivanceras/restq", "path": "/src/data_type.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>struct Game { span: web_sys::Element, counter: u32, } impl Game { pub fn new() -> Self { let window = web_sys::window().unwrap(); let document = window.document().unwrap(); let body = document.body().unwrap(); let span = document.create_element("span").unwrap()...
code_fim
medium
{ "lang": "rust", "repo": "tuzz/game-loop", "path": "/examples/using_wasm/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> body.append_child(&span).unwrap(); Self { span, counter: 0 } } pub fn your_update_function(&mut self) { self.counter += 1; } pub fn your_render_function(&self) { self.span.set_inner_html(&format!("Counter: {}", self.counter)); } }<|fim_prefix|>// repo...
code_fim
hard
{ "lang": "rust", "repo": "tuzz/game-loop", "path": "/examples/using_wasm/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Given a struct, return the corresponding IR type. #[salsa::invoke(crate::ir::ty::struct_ty_query)] fn struct_ty(&self, s: hir::Struct) -> StructType; /// Given a `hir::FileId` generate code that is shared among the group of files. /// TODO: Currently, a group always consists of a...
code_fim
hard
{ "lang": "rust", "repo": "parasyte/mun", "path": "/crates/mun_codegen/src/db.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rusty-ecma/resast path: /src/pat.rs use crate::expr::{Expr, Prop}; use crate::{Ident, IntoAllocated}; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; /// All of the different ways you can declare an identifier /// and/or value #[derive(Debug, Clone, PartialEq)] #[cfg_attr(featur...
code_fim
hard
{ "lang": "rust", "repo": "rusty-ecma/resast", "path": "/src/pat.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn into_allocated(self) -> Self::Allocated { match self { ObjPatPart::Assign(inner) => ObjPatPart::Assign(inner.into_allocated()), ObjPatPart::Rest(inner) => ObjPatPart::Rest(inner.into_allocated()), } } } /// An assignment as a pattern #[derive(Debug, Clon...
code_fim
hard
{ "lang": "rust", "repo": "rusty-ecma/resast", "path": "/src/pat.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// An assignment as a pattern #[derive(Debug, Clone, PartialEq)] #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] pub struct AssignPat<T> { pub left: Box<Pat<T>>, pub right: Box<Expr<T>>, } impl<T> IntoAllocated for AssignPat<T> where T: ToString, { type Allocated = AssignP...
code_fim
hard
{ "lang": "rust", "repo": "rusty-ecma/resast", "path": "/src/pat.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>} /// Default implementation of `FieldType`. impl Default for FieldV4 { fn default() -> Self { Self { name: String::from("new_field"), field_type: FieldTypeV4::StringU8, is_key: false, default_value: None, is_filename: false, ...
code_fim
hard
{ "lang": "rust", "repo": "Frodo45127/rpfm", "path": "/rpfm_lib/src/schema/v4.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async fn cleanup(&self, mut database: &Database) -> Result<(), MetricCleanupError> { let min_timestamp = Utc::now() - get_max_metrics_age(); sqlx::query!("delete from metric_docker_containers where timestamp < $1 returning 1 as result", min_timestamp) .fetch_one(&mut datab...
code_fim
hard
{ "lang": "rust", "repo": "nikitavbv/simple-monitoring-agent", "path": "/src/docker/metric.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nikitavbv/simple-monitoring-agent path: /src/docker/metric.rs use chrono::{Utc, DateTime, Duration}; use custom_error::custom_error; use futures::future::{join_all, try_join_all}; use log::warn; use async_trait::async_trait; use serde::Serialize; use crate::database::Database; use crate::docke...
code_fim
hard
{ "lang": "rust", "repo": "nikitavbv/simple-monitoring-agent", "path": "/src/docker/metric.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> async fn encode(&self) -> Result<String, MetricEncodingError> { if let Some(metric) = &self.metric { let v = serde_json::to_string(metric)?; return Ok(v); } Err(MetricEncodingError::NoRecord) } async fn cleanup(&self, mut database: &Database) -...
code_fim
hard
{ "lang": "rust", "repo": "nikitavbv/simple-monitoring-agent", "path": "/src/docker/metric.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Envoie 3 messages d'initialisation aux servomoteurs : /// * Reboot /// * Toujours renvoyer des ack (pour le debug) /// * Activer le couple fn init_servo(robot: &mut Robot) { let servos = ServoManager::new(); let m2 = servos[0xFE].reboot(); for b in m2 { block!(robot.servo_tx.writ...
code_fim
hard
{ "lang": "rust", "repo": "ClubRobotInsat/elec", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Jakub-S-K/ClipboardManager path: /build.rs fn main() { std::process:<|fim_suffix|>) .output().expect("no i ciul"); }<|fim_middle|>:Command::new("packfolder.exe").args(&["src/frontend", "dupa.rc", "-binary"]
code_fim
medium
{ "lang": "rust", "repo": "Jakub-S-K/ClipboardManager", "path": "/build.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Jakub-S-K/ClipboardManager path: /build.rs fn main() { std::process::Command::new("packfolder.exe").args(&<|fim_suffix|>) .output().expect("no i ciul"); }<|fim_middle|>["src/frontend", "dupa.rc", "-binary"]
code_fim
easy
{ "lang": "rust", "repo": "Jakub-S-K/ClipboardManager", "path": "/build.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>) .output().expect("no i ciul"); }<|fim_prefix|>// repo: Jakub-S-K/ClipboardManager path: /build.rs fn main() { std::process::Command::new("packfolder.exe").args(&<|fim_middle|>["src/frontend", "dupa.rc", "-binary"]
code_fim
easy
{ "lang": "rust", "repo": "Jakub-S-K/ClipboardManager", "path": "/build.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /* If an error symbol is set in the config, use symbols to indicate success/failure, in addition to color */ let symbol = if use_symbol && !exit_success { module.new_segment("error_symbol", FAILURE_CHAR) } else { module.new_segment("symbol", SUCCESS_CHAR) }; if exi...
code_fim
hard
{ "lang": "rust", "repo": "baitcenter/starship", "path": "/src/modules/character.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AlphaModder/detours-sys path: /src/lib.rs #![allow(non_camel_case_types)] #[cfg(test)] mod tests; use winapi::{ shared::{ minwindef::{BOOL, HMODULE, LPCVOID, PDWORD, DWORD, LPVOID, HINSTANCE}, windef::HWND, ntdef::{LONG, PVOID, HANDLE, LPCSTR, ULONG, VOID, LPSTR, LP...
code_fim
hard
{ "lang": "rust", "repo": "AlphaModder/detours-sys", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn DetourEnumerateImportsEx( hModule: HMODULE, pContext: PVOID, pfImportFile: PF_DETOUR_IMPORT_FILE_CALLBACK, pfImportFuncEx: PF_DETOUR_IMPORT_FUNC_CALLBACK_EX, ) -> BOOL; pub fn DetourFindPayload( hModule: HMODULE, rguid: REFGUID, p...
code_fim
hard
{ "lang": "rust", "repo": "AlphaModder/detours-sys", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn DetourBinaryDeletePayload( pBinary: PDETOUR_BINARY, rguid: REFGUID ) -> BOOL; pub fn DetourBinaryPurgePayloads( pBinary: PDETOUR_BINARY, ) -> BOOL; pub fn DetourBinaryResetImports( pBinary: PDETOUR_BINARY, ) -> BOOL; pub fn DetourBinary...
code_fim
hard
{ "lang": "rust", "repo": "AlphaModder/detours-sys", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<Mac: SupportMachine> Syscalls<Mac> for OutOfCyclesSyscall { fn initialize(&mut self, _machine: &mut Mac) -> Result<(), Error> { Ok(()) } fn ecall(&mut self, machine: &mut Mac) -> Result<bool, Error> { let code = &machine.registers()[A7]; if code.to_i32() != 1111 {...
code_fim
hard
{ "lang": "rust", "repo": "libraries/ckb-vm", "path": "/tests/test_misc.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<Mac: SupportMachine> Debugger<Mac> for CustomDebugger { fn initialize(&mut self, _machine: &mut Mac) -> Result<(), Error> { self.value.store(1, Ordering::Relaxed); Ok(()) } fn ebreak(&mut self, _machine: &mut Mac) -> Result<(), Error> { self.value.store(2, Orderin...
code_fim
hard
{ "lang": "rust", "repo": "libraries/ckb-vm", "path": "/tests/test_misc.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn on_response(&self, _: &Request, resp: &mut Response) { resp.set_header(Header::new("X-Frame-Options", "DENY")); resp.set_header(Header::new("X-XSS-Protection", "1; mode=block")); resp.set_header(Header::new("X-Content-Type-Options", "nosniff")); resp.set_header(Header::new("Referrer-P...
code_fim
medium
{ "lang": "rust", "repo": "lol768/paste", "path": "/webserver/src/routes/web/fairings/security_headers.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> FileLogger { enabled: false, path: String::from("default.log"), } } fn logger(&self, message: &str) { let mut file = OpenOptions::new() .write(true) .append(true) .open(&self.path) .unwrap(); ...
code_fim
hard
{ "lang": "rust", "repo": "ycd/soda", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(Ordering::Equal, 42u8.cmp_distance(&13, &13)); assert_eq!(Ordering::Less, 42u8.cmp_distance(&44, &45)); assert_eq!(Ordering::Greater, 42u8.cmp_distance(&45, &44)); } #[test] fn cmp_distance_array() { assert_eq!( Ordering::Equal, ...
code_fim
hard
{ "lang": "rust", "repo": "madadam/xor-name", "path": "/src/xorable.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>impl vk::StaticFn { pub fn load_checked<F>(mut _f: F) -> Result<Self, MissingEntryPoint> where F: FnMut(&::std::ffi::CStr) -> *const c_void, { // TODO: Make this a &'static CStr once CStr::from_bytes_with_nul_unchecked is const static ENTRY_POINT: &[u8] = b"vkGetInstanc...
code_fim
hard
{ "lang": "rust", "repo": "dev-chee/ash", "path": "/ash/src/entry.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let xdg_data_home = "data_home"; set_var("XDG_DATA_HOME", xdg_data_home); let xdg_data_directories = vec!["data_dir1", "data_dir2"]; let xdg_data_dirs = format!("{}:{}", xdg_data_directories[0], xdg_data_directories[1]); set_var("XDG_DATA_DIRS", xdg_data_dirs); ...
code_fim
hard
{ "lang": "rust", "repo": "mejk/grafen", "path": "/src/bin/main.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>1)/dist; last_h = v; } ans } }<|fim_prefix|>// repo: mudream4869/leetcode-rust path: /problems/1936-add-minimum-number-of-rungs/main.rs impl Solution { pub fn add_rungs(rungs: Vec<i32>, dist: i<|fim_middle|>32) -> i32 { let mut last_h = 0; let mut ans =...
code_fim
medium
{ "lang": "rust", "repo": "mudream4869/leetcode-rust", "path": "/problems/1936-add-minimum-number-of-rungs/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mudream4869/leetcode-rust path: /problems/1936-add-minimum-number-of-rungs/main.rs impl Solution { pub fn add_rungs(rungs: Vec<i32>, dist: i32) -> i32 { let mut last_h = 0; let mut ans =<|fim_suffix|>1)/dist; last_h = v; } ans } }<|fim_middle|>...
code_fim
medium
{ "lang": "rust", "repo": "mudream4869/leetcode-rust", "path": "/problems/1936-add-minimum-number-of-rungs/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let index = de_l(raw.index, even); let begins_at = raw.begins_at; let width = raw.width; let height = raw.height; res.states = raw .states .into_iter() .enumerate() .map(|(i, b)| de_board(b, begins_at + i as isize, index, width, height)) .collec...
code_fim
hard
{ "lang": "rust", "repo": "arbanhossain/5dchess-tools", "path": "/lib/parse.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> resource_container .texture_views .insert(String::from(stringify!(albedo_view)), albedo_view); resource_container .texture_views .insert(String::from(stringify!(normal_view)), normal_view); resource_container .texture_vi...
code_fim
hard
{ "lang": "rust", "repo": "happydpc/Horizon", "path": "/src/renderer/bindgroups/gbuffer.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }