text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> fn index(&self, index: usize) -> &Self::Output { &self.transitions[index] } } impl IndexMut<usize> for Row { fn index_mut(&mut self, index: usize) -> &mut Self::Output { &mut self.transitions[index] } } impl FromStr for Row { type Err = (); fn from_str(input: &st...
code_fim
hard
{ "lang": "rust", "repo": "fisherdarling/nfamatch-rs", "path": "/dfa-optimizer/src/row.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /** * Updates encrypted tabs for envelope. * * This function performs a `PUT` to the `/v2.1/accounts/{accountId}/envelopes/{envelopeId}/tabs_blob` endpoint. * * * * **Parameters:** * * * `account_id: &str` -- The brand that envelope recipients see when a br...
code_fim
hard
{ "lang": "rust", "repo": "vaibhavantil2/third-party-api-clients", "path": "/docusign/src/tabs_blob.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vaibhavantil2/third-party-api-clients path: /docusign/src/tabs_blob.rs use anyhow::Result; use crate::Client; pub struct TabsBlob { pub client: Client, } impl TabsBlob { #[doc(hidden)] pub fn new(client: Client) -> Self { TabsBlob { client } } /** * Gets encr...
code_fim
medium
{ "lang": "rust", "repo": "vaibhavantil2/third-party-api-clients", "path": "/docusign/src/tabs_blob.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: performantp/aoc2019 path: /day03/src/main.rs use std::borrow::BorrowMut; use std::cmp::min; use std::fs::File; use std::io::{self, BufReader, prelude::*}; use std::str::FromStr; type Grid2 = Vec<Vec<Vec<i32>>>; struct Grid { points: Vec<(i32, i32)> } struct Direction { orientation: ch...
code_fim
hard
{ "lang": "rust", "repo": "performantp/aoc2019", "path": "/day03/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let grid: Grid = Grid { points: vec![(1, 1), (2, 2)] }; assert_eq!(contains_point(grid.points.as_ref(), (0, 0)), false); assert_eq!(contains_point(grid.points.as_ref(), (2, 2)), true); } #[test] fn test_intersect_vert() { assert_eq!(does_int...
code_fim
hard
{ "lang": "rust", "repo": "performantp/aoc2019", "path": "/day03/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> server::start(data); //tmc::startRDS(); } fn perform_parse() -> data::State { let default_file = OsString::from("/home/zsdn/baden-wuerttemberg-latest.osm.pbf".to_string()); //let default_file = OsString::from("/home/zsdn/germany-latest.osm.pbf".to_string()); let args: Vec<OsString> = std::env::arg...
code_fim
hard
{ "lang": "rust", "repo": "JanStrauss/fapra_osm", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JanStrauss/fapra_osm path: /src/main.rs extern crate osmpbfreader; extern crate time; #[macro_use] extern crate iron; extern crate staticfile; extern crate mount; extern crate rustc_serialize; extern crate flate2; extern crate bincode; extern crate urlencoded; extern crate ordered_float; use st...
code_fim
hard
{ "lang": "rust", "repo": "JanStrauss/fapra_osm", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>const STATE_FILE_NAME: &'static str = "state.bin.gz"; fn main() { let data = match fs::metadata(STATE_FILE_NAME) { Ok(metadata) => { if metadata.is_file() { read_from_disk() } else { perform_parse() } }, Err(_) => perform_parse(), }; server::start(data); //tmc::startRDS(); } ...
code_fim
medium
{ "lang": "rust", "repo": "JanStrauss/fapra_osm", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl ServiceBuilder { pub fn new() -> ServiceBuilder { ServiceBuilder {} } pub fn build_wxauth(&self) -> WxAuthService { Self::sinner().wxauth.clone() } pub fn build_sms(&self) -> SmsService { Self::sinner().sms.clone() } pub fn build_pay(&self) -> WxPa...
code_fim
hard
{ "lang": "rust", "repo": "armersong/service-starter-rs", "path": "/service-starter/src/service/builder.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: armersong/service-starter-rs path: /service-starter/src/service/builder.rs use crate::service::admin::AdminService; use crate::service::sms::SmsService; use crate::service::wxauth::WxAuthService; use crate::service::wxpay::WxPayService; use crate::Result; pub struct ServiceBuilder {} <|fim_suf...
code_fim
hard
{ "lang": "rust", "repo": "armersong/service-starter-rs", "path": "/service-starter/src/service/builder.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl_singleton!(ServiceBuilder, ServiceInstances); impl ServiceBuilder { pub fn new() -> ServiceBuilder { ServiceBuilder {} } pub fn build_wxauth(&self) -> WxAuthService { Self::sinner().wxauth.clone() } pub fn build_sms(&self) -> SmsService { Self::sinner().s...
code_fim
medium
{ "lang": "rust", "repo": "armersong/service-starter-rs", "path": "/service-starter/src/service/builder.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>o; use self::runtime::BrowserFetcherRuntime; use self::zip::ZipArchive; mod fetcher; mod options; mod revision_info; mod runtime; mod zip;<|fim_prefix|>// repo: mattsse/chromiumoxide path: /chromiumoxide_fetcher/src/browser/mod.rs pub use self::fetcher::BrowserFetcher; pub use self::options::Browser<|fi...
code_fim
medium
{ "lang": "rust", "repo": "mattsse/chromiumoxide", "path": "/chromiumoxide_fetcher/src/browser/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mattsse/chromiumoxide path: /chromiumoxide_fetcher/src/browser/mod.rs pub use self::fetcher::BrowserFetcher; pub use self::options::Browser<|fim_suffix|>o; use self::runtime::BrowserFetcherRuntime; use self::zip::ZipArchive; mod fetcher; mod options; mod revision_info; mod runtime; mod zip;<|fi...
code_fim
medium
{ "lang": "rust", "repo": "mattsse/chromiumoxide", "path": "/chromiumoxide_fetcher/src/browser/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ldicocco/rsl10-pac path: /src/adc/adc_batmon_cfg.rs #[doc = "Reader of register ADC_BATMON_CFG"] pub type R = crate::R<u32, super::ADC_BATMON_CFG>; #[doc = "Writer for register ADC_BATMON_CFG"] pub type W = crate::W<u32, super::ADC_BATMON_CFG>; #[doc = "Register ADC_BATMON_CFG `reset()`'s with v...
code_fim
hard
{ "lang": "rust", "repo": "ldicocco/rsl10-pac", "path": "/src/adc/adc_batmon_cfg.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> variant as u8 != 0 } } #[doc = "Reader of field `SUPPLY_SRC`"] pub type SUPPLY_SRC_R = crate::R<bool, SUPPLY_SRC_A>; impl SUPPLY_SRC_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> SUPPLY_SRC_A { match self.bits { false =...
code_fim
hard
{ "lang": "rust", "repo": "ldicocco/rsl10-pac", "path": "/src/adc/adc_batmon_cfg.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: letubert/orion path: /fuzz/fuzz_targets/hchacha20.rs #![no_main] #[macro_use] extern crate libfuzzer_sys; extern crate orion; pub mod util; <|fim_suffix|>fuzz_target!(|data: &[u8]| { let (key, nonce) = chacha_key_nonce_setup(16, data); let orion_key = chacha20::SecretKey::from_slice(&key).unw...
code_fim
medium
{ "lang": "rust", "repo": "letubert/orion", "path": "/fuzz/fuzz_targets/hchacha20.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fuzz_target!(|data: &[u8]| { let (key, nonce) = chacha_key_nonce_setup(16, data); let orion_key = chacha20::SecretKey::from_slice(&key).unwrap(); chacha20::hchacha20(&orion_key, &nonce).unwrap(); });<|fim_prefix|>// repo: letubert/orion path: /fuzz/fuzz_targets/hchacha20.rs #![no_main] #[macro_use] ex...
code_fim
medium
{ "lang": "rust", "repo": "letubert/orion", "path": "/fuzz/fuzz_targets/hchacha20.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: classicalliu/godwoken-scripts path: /contracts/state-validator/src/verifications/submit_block.rs let sudt_script_hash: H256 = raw.sudt_script_hash().unpack(); let amount: u128 = raw.amount().unpack(); let capacity: u64 = raw.capacity().unpack(); account_s...
code_fim
hard
{ "lang": "rust", "repo": "classicalliu/godwoken-scripts", "path": "/contracts/state-validator/src/verifications/submit_block.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok((context, kv_state)) } fn verify_block_producer( config: &RollupConfig, context: &BlockContext, block: &L2BlockReader, ) -> Result<(), Error> { let raw_block = block.raw(); let owner_lock_hash = raw_block.stake_cell_owner_lock_hash(); // make sure we have one stake cell in ...
code_fim
hard
{ "lang": "rust", "repo": "classicalliu/godwoken-scripts", "path": "/contracts/state-validator/src/verifications/submit_block.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn check_input_custodian_cells( config: &RollupConfig, context: &BlockContext, output_withdrawal_cells: Vec<WithdrawalCell>, ) -> Result<BTreeMap<H256, u128>, Error> { // collect input custodian cells let (finalized_custodian_cells, unfinalized_custodian_cells): (Vec<_>, Vec<_>) = ...
code_fim
hard
{ "lang": "rust", "repo": "classicalliu/godwoken-scripts", "path": "/contracts/state-validator/src/verifications/submit_block.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jane/challenges path: /red-squiggles/tom/src/main.rs use std::io::Read; use std::fs::File; use std::collections::HashMap; struct Trie { children: HashMap<char, Trie>, value: char, } impl Trie { pub fn insert(&mut self, new_val: &char) -> &Trie { let p = match self.children.get(new_va...
code_fim
hard
{ "lang": "rust", "repo": "jane/challenges", "path": "/red-squiggles/tom/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// let mut input: String = String::new(); // io::stdin().read_line(&mut input) // .expect("failed to read line"); // let input = input.trim(); // // let mut output: String = String::new(); // // for word in input.split_whitespace() { // let _word = word.to_lowercase(); // let _word ...
code_fim
hard
{ "lang": "rust", "repo": "jane/challenges", "path": "/red-squiggles/tom/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut out = Isometry3::identity(); out.append_translation_mut(&Translation3::new(0.0, 0.0, self.diff_offset)); out.append_rotation_mut(&UnitQuaternion::from_axis_angle(&Vector3::x_axis(), state.far_diff)); out.append_rotation_mut(&UnitQuaternion::from_axis_angle(&Vector3:...
code_fim
hard
{ "lang": "rust", "repo": "mabruckner/mod", "path": "/server/src/rec_main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mabruckner/mod path: /server/src/rec_main.rs extern crate nalgebra; use nalgebra::*; use std::f32::consts; struct Control { port: serial::SystemPort, a: i32, b: i32 } impl Control { fn open(path: &str) -> Result<Control, serial::Error> { let mut port = serial::open(pa...
code_fim
hard
{ "lang": "rust", "repo": "mabruckner/mod", "path": "/server/src/rec_main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn sym_2mod_a(mut pos: Cyl, config: ModuleConfig, phi: f32) -> Option<(ModuleState, ModuleState)> { pos.z -= config.diff_offset; // phi == 0 means that the end effector is pointing in the same direction as the r-axis pos.z -= phi.sin() * config.diff_offset; pos.r -= phi.cos() * config.diff...
code_fim
hard
{ "lang": "rust", "repo": "mabruckner/mod", "path": "/server/src/rec_main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: doytsujin/googapis path: /googapis/genproto/google.spanner.v1.rs .table] to be returned for each row matching /// this request. #[prost(string, repeated, tag = "5")] pub columns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, /// Required. `key_set` identifies the rows...
code_fim
hard
{ "lang": "rust", "repo": "doytsujin/googapis", "path": "/googapis/genproto/google.spanner.v1.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: doytsujin/googapis path: /googapis/genproto/google.spanner.v1.rs set. These can be requested by setting /// [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] and are sent /// only once with the last response in the stream. /// This field will also be pre...
code_fim
hard
{ "lang": "rust", "repo": "doytsujin/googapis", "path": "/googapis/genproto/google.spanner.v1.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>smaller per-partition transactions hold locks for less time. /// /// That said, Partitioned DML is not a drop-in replacement for standard DML used /// in ReadWrite transactions. /// /// - The DML statement must be fully-partitionable. Specifically, the statement /// must be expressible as the union of...
code_fim
hard
{ "lang": "rust", "repo": "doytsujin/googapis", "path": "/googapis/genproto/google.spanner.v1.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[inline] pub unsafe fn mkdirat(dfd : i32, pathname : *const u8, mode : u16) -> i64 { let _fs = ProtFs::prot(); user::mkdirat(dfd, pathname, mode) } #[inline] pub unsafe fn linkat(olddfd : i32, oldname : *const u8, newdfd : i32, newname : *const u8, flags : i32) -> i64...
code_fim
hard
{ "lang": "rust", "repo": "DnailZ/rvisor-kernel", "path": "/linux-kernel-module-rust/src/syscall/orig.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DnailZ/rvisor-kernel path: /linux-kernel-module-rust/src/syscall/orig.rs k(brk : u64) -> i64; pub fn orig_mmap(arg1 : u64, arg2 : u64, arg3 : u64, arg4 : u64, arg5 : u64, arg6 : u64) -> i64; pub fn orig_mprotect(start : u64, len : usize, prot : u64) -> i64; pub fn orig...
code_fim
hard
{ "lang": "rust", "repo": "DnailZ/rvisor-kernel", "path": "/linux-kernel-module-rust/src/syscall/orig.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DnailZ/rvisor-kernel path: /linux-kernel-module-rust/src/syscall/orig.rs i64; pub fn orig_linkat(olddfd : i32, oldname : *const u8, newdfd : i32, newname : *const u8, flags : i32) -> i64; pub fn orig_unlinkat(dfd : i32, pathname : *const u8, flag : i32) -> i64; pub fn...
code_fim
hard
{ "lang": "rust", "repo": "DnailZ/rvisor-kernel", "path": "/linux-kernel-module-rust/src/syscall/orig.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Creates the component for a projection onto the axis-aligned horizontal /// plane specified by the given [`PlaneMeshComp`], scaling the projection /// so that the texture will repeat the given numbers of times along the U /// and V texture coordinate directions. The U-axis will be alig...
code_fim
hard
{ "lang": "rust", "repo": "lars-frogner/Impact", "path": "/src/scene/texture_projection/components.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lars-frogner/Impact path: /src/scene/texture_projection/components.rs //! [`Component`](impact_ecs::component::Component)s related to texture projections. use crate::{geometry::PlanarTextureProjection, rendering::fre, scene::PlaneMeshComp}; use bytemuck::{Pod, Zeroable}; use impact_ecs::Compone...
code_fim
hard
{ "lang": "rust", "repo": "lars-frogner/Impact", "path": "/src/scene/texture_projection/components.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: neumoxx/bee-p path: /bee-protocol/src/worker/tps.rs // Copyright 2020 IOTA Stiftung // // 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 // // http://www.apache.org/li...
code_fim
hard
{ "lang": "rust", "repo": "neumoxx/bee-p", "path": "/bee-protocol/src/worker/tps.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>use async_trait::async_trait; use futures::{stream::Fuse, StreamExt}; use log::info; use tokio::time::{interval, Instant, Interval}; use std::{sync::Arc, time::Duration}; #[derive(Default)] pub(crate) struct TpsWorker { incoming: u64, new: u64, known: u64, stale: u64, invalid: u64, ...
code_fim
hard
{ "lang": "rust", "repo": "neumoxx/bee-p", "path": "/bee-protocol/src/worker/tps.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: QuestofIranon/godot-rust path: /core/src/init.rs e endpoints are automatically invoked by the engine during startup and shutdown: //! //! - [`godot_gdnative_init`](macro.godot_gdnative_init.html), //! - [`godot_nativescript_init`](macro.godot_nativescript_init.html), //! - [`godot_gdnative_termi...
code_fim
hard
{ "lang": "rust", "repo": "QuestofIranon/godot-rust", "path": "/core/src/init.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl PropertyUsage { pub fn to_sys(&self) -> sys::godot_property_usage_flags { unsafe { mem::transmute(*self) } } } pub struct Property<'l, T, S, G> { pub name: &'l str, pub setter: S, pub getter: G, pub default: T, pub hint: PropertyHint<'l>, pub usage: PropertyUs...
code_fim
hard
{ "lang": "rust", "repo": "QuestofIranon/godot-rust", "path": "/core/src/init.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: QuestofIranon/godot-rust path: /core/src/init.rs ically invoked by the engine during startup and shutdown: //! //! - [`godot_gdnative_init`](macro.godot_gdnative_init.html), //! - [`godot_nativescript_init`](macro.godot_nativescript_init.html), //! - [`godot_gdnative_terminate`](macro.godot_gdna...
code_fim
hard
{ "lang": "rust", "repo": "QuestofIranon/godot-rust", "path": "/core/src/init.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pot-hot/myopic path: /board/src/implementation/positions.rs use crate::parse::patterns; use anyhow::{anyhow, Error, Result}; use myopic_core::*; use std::str::FromStr; #[derive(Debug, Clone, PartialEq, PartialOrd, Eq)] pub struct Positions { boards: [BitBoard; 12], hash: u64, whites...
code_fim
hard
{ "lang": "rust", "repo": "pot-hot/myopic", "path": "/board/src/implementation/positions.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn side_locations(&self, side: Side) -> BitBoard { match side { Side::White => self.whites(), Side::Black => self.blacks(), } } pub fn king_location(&self, side: Side) -> Square { self.locs(Piece::king(side)).into_iter().next().unwrap() ...
code_fim
hard
{ "lang": "rust", "repo": "pot-hot/myopic", "path": "/board/src/implementation/positions.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn list_selected<'a>(&'a self) -> &'a HashSet<usize, RandomState>; fn list_selected_mut<'a>(&'a mut self) -> &'a mut HashSet<usize, RandomState>; fn apply_closure(&self, usize) -> Self::BorderableBorderedWidget; fn card_index(&self, usize) -> usize; }<|fim_prefix|>// repo: alanpoon/cardgam...
code_fim
medium
{ "lang": "rust", "repo": "alanpoon/cardgame_widgets", "path": "/src/custom_widget/image_panels/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alanpoon/cardgame_widgets path: /src/custom_widget/image_panels/mod.rs use conrod_core::{Borderable, image, Widget}; use std::collections::HashSet; use std::collections::hash_map::RandomState; pub mod item_history; pub mod panel; pub mod list_select; pub use custom_widget::image_panels::item_his...
code_fim
hard
{ "lang": "rust", "repo": "alanpoon/cardgame_widgets", "path": "/src/custom_widget/image_panels/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: anp/c2rust path: /tests/arrays.rs #[macro_use] extern crate build_support; extern crate libc; use libc::{c_int, c_uint}; import_test_fns! { arrays, "arrays", arrays: { fn entry(c_uint, *mut c_int); }, incomplete_arrays: { fn test_sized_array() -> c_uint; ...
code_fim
hard
{ "lang": "rust", "repo": "anp/c2rust", "path": "/tests/arrays.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> test_fn!(incomplete_arrays, |check_some_ints| { let res = check_some_ints(); assert!(res); res }); test_fn!(arrays, vec![0; 49], |entry, buffer| { let expected_buffer = vec![ 97, 98, 99, 0, 100, 101, 102, 1, 0, 97, 98, 99, 0, 97, 98, 99, 100, 97, 98...
code_fim
hard
{ "lang": "rust", "repo": "anp/c2rust", "path": "/tests/arrays.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> test_fn!(incomplete_arrays, [0, 0], |entry2, buffer| { let expected_buffer = [1, 1]; entry2(buffer.len() as u32, buffer.as_mut_ptr()); assert_eq!(expected_buffer, buffer); buffer }); test_fn!(variable_arrays, vec![0; 88], |variable_arrays, buffer| { let...
code_fim
medium
{ "lang": "rust", "repo": "anp/c2rust", "path": "/tests/arrays.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rusch95/SpaceFort path: /src/io/tiles.rs use std::collections::HashSet; use piston::window::WindowSettings; use piston::input::*; use graphics::*; use glutin_window::GlutinWindow as Window; use opengl_graphics::GlGraphics; use io::base::*; use io::constants::*; use io::textures::*; use io::uti...
code_fim
hard
{ "lang": "rust", "repo": "rusch95/SpaceFort", "path": "/src/io/tiles.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Draw team color outline or selection let outline_color = if sel_ents_set.contains(&ent.id) { WHITE } else { team_color(ent.team_id) }; rectangle(outline_color, outer_square, outer_transform, gl); // Draw color of ent ...
code_fim
hard
{ "lang": "rust", "repo": "rusch95/SpaceFort", "path": "/src/io/tiles.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ajith-herga/vec_impl path: /examples/ansv.rs /* All nearest (from the left) smaller values. */ extern crate vec_impl; use std::slice; /* * For a given number, nearest smaller is either immediately to the left or in the stored previous * results. When none are found print none. */ /* A wrap s...
code_fim
hard
{ "lang": "rust", "repo": "ajith-herga/vec_impl", "path": "/examples/ansv.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl std::fmt::Display for SmallerClose { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { if let Some(value) = self.0 { write!(f, "{}", value) } else { write!(f, "-") } } } fn computeansv(iterator: slice::Iter<i32>) { /* * S...
code_fim
medium
{ "lang": "rust", "repo": "ajith-herga/vec_impl", "path": "/examples/ansv.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TriedWorks/fructose path: /src/operators/normal.rs use std::ops::{ Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Rem, RemAssign, Sub, SubAssign, }; pub trait Operator: Copy {} #[derive(Copy, Clone)] pub struct Additive {} #[derive(Copy, Clone)] pub struct Multiplicative {} impl Op...
code_fim
medium
{ "lang": "rust", "repo": "TriedWorks/fructose", "path": "/src/operators/normal.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl<T, Rhs> ClosedAdd<Rhs> for T where T: Add<Rhs, Output = T> + AddAssign<Rhs> {} impl<T, Rhs> ClosedSub<Rhs> for T where T: Sub<Rhs, Output = T> + SubAssign<Rhs> {} impl<T, Rhs> ClosedMul<Rhs> for T where T: Mul<Rhs, Output = T> + MulAssign<Rhs> {} impl<T, Rhs> ClosedDiv<Rhs> for T where T: Div<Rhs, Ou...
code_fim
hard
{ "lang": "rust", "repo": "TriedWorks/fructose", "path": "/src/operators/normal.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl Operator for Multiplicative {} pub trait ClosedAdd<Rhs = Self>: Add<Rhs, Output = Self> + AddAssign<Rhs> {} pub trait ClosedSub<Rhs = Self>: Sub<Rhs, Output = Self> + SubAssign<Rhs> {} pub trait ClosedMul<Rhs = Self>: Mul<Rhs, Output = Self> + MulAssign<Rhs> {} pub trait ClosedDiv<Rhs = Self>: Div<R...
code_fim
medium
{ "lang": "rust", "repo": "TriedWorks/fructose", "path": "/src/operators/normal.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Clone, Debug)] pub enum DeserializerType { Json } #[derive(Clone)] pub struct ServiceInfo { pub name: String, pub debug: bool, pub host: String, pub protocol: Protocol, pub deserializer: DeserializerType } #[derive(Clone)] pub struct Protocol { pub name: String, ...
code_fim
medium
{ "lang": "rust", "repo": "fstakem/rusty_edge", "path": "/lib/edge_core/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fstakem/rusty_edge path: /lib/edge_core/src/lib.rs use chrono::prelude::*; // Data types // ------------------------------------------------------------------------------------------------- #[derive(Clone, Debug)] pub struct Event { pub timestamp: DateTime<Utc> } #[derive(Clone, Debug)] pu...
code_fim
hard
{ "lang": "rust", "repo": "fstakem/rusty_edge", "path": "/lib/edge_core/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> outputs_amounts.insert( new_address.clone(), Amount::from_sat(sw.recv_amount).to_rpc(), ); outputs_assets.insert(new_address.clone(), sw.recv_asset.clone()); ...
code_fim
hard
{ "lang": "rust", "repo": "MobileTallent/liquidswap_flutter", "path": "/rust/sideswap_dealer_example/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MobileTallent/liquidswap_flutter path: /rust/sideswap_dealer_example/src/main.rs onf.try_into().expect("invalid config"); log4rs::init_file(&settings.log_settings, Default::default()).expect("can't open log settings"); let (msg_tx, msg_rx) = std::sync::mpsc::channel::<Msg>(); let e...
code_fim
hard
{ "lang": "rust", "repo": "MobileTallent/liquidswap_flutter", "path": "/rust/sideswap_dealer_example/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let psbt = rpc::make_rpc_call::<String>( &rpc_http_client, &settings.rpc, &rpc::convert_to_psbt(&raw_tx), ) .expect("convertin...
code_fim
hard
{ "lang": "rust", "repo": "MobileTallent/liquidswap_flutter", "path": "/rust/sideswap_dealer_example/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: anowell/quasar path: /examples/reverser.rs extern crate quasar; extern crate mustache; extern crate rustc_serialize; use quasar::{compile_str, Component, EventType, Queryable, HasBind}; <|fim_suffix|>fn main() { let app = quasar::init(); let my_widget = Component { data: Rever...
code_fim
medium
{ "lang": "rust", "repo": "anowell/quasar", "path": "/examples/reverser.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // TODO: this example makes less sense with how things are evolving. let view = app.bind("Reverser", my_widget); view.on(EventType::Click, |mut evt| { println!("on click called"); let mut data = evt.binding.data_mut(); data.message = data.message.chars().rev().collect::...
code_fim
hard
{ "lang": "rust", "repo": "anowell/quasar", "path": "/examples/reverser.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let (executor, spawner) = new_executor_and_spawner(); spawner.spawn(async { println!("Waiting for the future timer..."); TimerFuture::new(Duration::from_secs(3)).await; println!("Tick!, done"); }); drop(spawner); executor.run(); }<|fim_prefix|>// repo: Thaddeus...
code_fim
easy
{ "lang": "rust", "repo": "Thaddeus19/rust-programming", "path": "/future-executor/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Thaddeus19/rust-programming path: /future-executor/src/main.rs #![feature(async_await)] use future_executor::{futures::TimerFuture, executor::new_executor_and_spawner}; use std::time::Duration; <|fim_suffix|> let (executor, spawner) = new_executor_and_spawner(); spawner.spawn(async { ...
code_fim
easy
{ "lang": "rust", "repo": "Thaddeus19/rust-programming", "path": "/future-executor/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ericrobolson/Archived_Tremor path: /v1/networking/src/rollback.rs pub type PlayerId = u8; pub mod prelude { pub use super::{ FrameId, GameInput, PlayerId, RollbackEvent, RollbackGameState, RollbackNetcode, RollbackNetcodeModes, }; } pub enum RollbackEvent { Disconne...
code_fim
hard
{ "lang": "rust", "repo": "ericrobolson/Archived_Tremor", "path": "/v1/networking/src/rollback.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Tick the game. pub fn tick(&mut self) -> Vec<RollbackEvent> { for rollback_mode in &self.rollback_modes { match rollback_mode { RollbackNetcodeModes::SyncTest => { unimplemented!("TODO: need to figure out sync test."); } ...
code_fim
hard
{ "lang": "rust", "repo": "ericrobolson/Archived_Tremor", "path": "/v1/networking/src/rollback.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CreativeWolfies/patpat.rs path: /src/parser/construct/mod.rs use super::super::{ ast, ast::{ASTKind, ASTNode, AST}, }; use super::{token, Token, TokenTree}; use crate::Location; use std::rc::Rc; pub mod block; pub mod expr; pub mod functions; pub mod ident; pub mod r#struct; pub mod tup...
code_fim
hard
{ "lang": "rust", "repo": "CreativeWolfies/patpat.rs", "path": "/src/parser/construct/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> functions::construct_pattern_declaration(tree.clone(), offset) .or_else(|| functions::construct_pattern_call(tree.clone(), offset)) .or_else(|| functions::construct_standalone_function(tree.clone(), offset)) .or_else(|| functions::construct_standalone_pattern(tree.clone(), offs...
code_fim
hard
{ "lang": "rust", "repo": "CreativeWolfies/patpat.rs", "path": "/src/parser/construct/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn construct_non_expression<'a>( tree: Rc<TokenTree<'a>>, offset: &mut usize, ) -> Option<(ASTNode<'a>, Location<'a>)> { /*! Same as construct, it is separated to allow `construct_expression` to parse its terms */ functions::construct_pattern_declaration(tree.clone(), offset) ...
code_fim
hard
{ "lang": "rust", "repo": "CreativeWolfies/patpat.rs", "path": "/src/parser/construct/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Bottom let _ = ui.add_element(UiElement::Image(UiImage { widget: WINDOW_BOTTOM, widget_pin_rect: Rect { rectx: RectX::LeftWidth(inner_left, border_width), recty: RectY::BottomHeight(outer_bottom, border_height) }, ...
code_fim
hard
{ "lang": "rust", "repo": "SiegeEngine/siege-example-client", "path": "/src/ui/window/decorate.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SiegeEngine/siege-example-client path: /src/ui/window/decorate.rs use super::UiWindow; use ui::{Ui, Coord, Dim, Rect, RectX, RectY, UiElement, Handle, UiImage, Anchor}; use ui::{WINDOW_TL_CORNER, WINDOW_TR_CORNER, WINDOW_TOP, WINDOW_BL_CORNER, WINDOW_BR_CORNER, WINDOW_BOTTOM, ...
code_fim
hard
{ "lang": "rust", "repo": "SiegeEngine/siege-example-client", "path": "/src/ui/window/decorate.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: krausest/js-framework-benchmark path: /frameworks/keyed/silkenweb/src/main.rs use std::{ cell::{Cell, RefCell}, ops::DerefMut, rc::Rc, }; use futures_signals::{ signal::{Mutable, SignalExt}, signal_vec::{MutableVec, SignalVecExt}, }; use rand::{ prelude::{SliceRandom, Sm...
code_fim
hard
{ "lang": "rust", "repo": "krausest/js-framework-benchmark", "path": "/frameworks/keyed/silkenweb/src/main.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.selected_row.set(Some(row_id)); } fn remove_row(&self, row_id: usize) { self.data.lock_mut().retain(|row| row.id != row_id); } fn new_row(&self) -> Row { let next_row_id = self.next_row_id.get(); self.next_row_id.set(next_row_id + 1); Row::new...
code_fim
hard
{ "lang": "rust", "repo": "krausest/js-framework-benchmark", "path": "/frameworks/keyed/silkenweb/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: badboy/workshop-server path: /src/clock/mod.rs use std::{sync::mpsc::Sender, thread, time::Duration}; use crate::simulation::communication::Message as TeamsMessage; <|fim_suffix|>impl Clock { pub fn new(tick_duration: Duration, tx: Sender<TeamsMessage>) -> Self { Self { tick_durati...
code_fim
medium
{ "lang": "rust", "repo": "badboy/workshop-server", "path": "/src/clock/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Clock { pub fn new(tick_duration: Duration, tx: Sender<TeamsMessage>) -> Self { Self { tick_duration, tx } } pub fn start(&mut self) { loop { thread::sleep(self.tick_duration); if let Err(error) = self.tx.send(TeamsMessage::Tick) { ...
code_fim
medium
{ "lang": "rust", "repo": "badboy/workshop-server", "path": "/src/clock/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: indirect/matasano_challenges path: /vendor/hamming/src/lib.rs pub fn distance(one: &[u8], two: &[u8]) -> i64 { if one.len() != two.len() { panic!("Hamming distance requires equal length strings") } let mut dist = 0i64; <|fim_suffix|> dist } #[test] fn test_hamming_dista...
code_fim
hard
{ "lang": "rust", "repo": "indirect/matasano_challenges", "path": "/vendor/hamming/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dist } #[test] fn test_hamming_distance() { let distance = distance("this is a test".as_bytes(), "wokka wokka!!!".as_bytes()); assert_eq!(37, distance); }<|fim_prefix|>// repo: indirect/matasano_challenges path: /vendor/hamming/src/lib.rs pub fn distance(one: &[u8], two: &[u8]) -> i64 { ...
code_fim
hard
{ "lang": "rust", "repo": "indirect/matasano_challenges", "path": "/vendor/hamming/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test_hamming_distance() { let distance = distance("this is a test".as_bytes(), "wokka wokka!!!".as_bytes()); assert_eq!(37, distance); }<|fim_prefix|>// repo: indirect/matasano_challenges path: /vendor/hamming/src/lib.rs pub fn distance(one: &[u8], two: &[u8]) -> i64 { if one.len()...
code_fim
hard
{ "lang": "rust", "repo": "indirect/matasano_challenges", "path": "/vendor/hamming/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> unsafe { SymbolM { data: T::new(Rf_install(c_str(&x).as_ptr())) } } } } impl<T: SEXPbucket> From<SymbolM<T>> for CString { fn from(x: SymbolM<T>) -> CString { unsafe { CStr::from_ptr(R_CHAR(PRINTNAME(x.data.s()))).to_owned() } } } gen_traits_sexp!(SymbolM);<|fim_prefix|>// r...
code_fim
hard
{ "lang": "rust", "repo": "rustr/rustr", "path": "/src/symbol.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> } } impl<'a, T: SEXPbucket> From<&'a str> for SymbolM<T> { fn from(x: &'a str) -> SymbolM<T> { unsafe { SymbolM { data: T::new(Rf_install(c_str(x).as_ptr())) } } } } impl<T: SEXPbucket> From<String> for SymbolM<T> { fn from(x: String) -> SymbolM<T> { unsafe { SymbolM { da...
code_fim
hard
{ "lang": "rust", "repo": "rustr/rustr", "path": "/src/symbol.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rustr/rustr path: /src/symbol.rs //! R Symbol type //! //! use ::rdll::*; use ::storage::*; use ::traits::*; use ::rtype::*; use ::error::*; use std::convert::*; use std::ffi::*; use ::util::*; pub type Symbol = SymbolM<NoProtect>; impl<T: SEXPbucket> SymbolM<T> { pub fn new<E: ToSEXP>(x...
code_fim
medium
{ "lang": "rust", "repo": "rustr/rustr", "path": "/src/symbol.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub struct Player { pub pos: na::Pnt3<f32>, pub flags: PlayerFlags, pub vel: na::Vec3<f32>, pub eyeheight: f32, pub halfextents: na::Vec3<f32>, pub eyeang: na::Vec3<f32>, pub viewpunch: na::Vec3<f32>, pub viewpunch_vel: na::Vec3<f32>, pub landtime: f32, pu...
code_fim
hard
{ "lang": "rust", "repo": "bvssvni/vel0city", "path": "/src/player/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bvssvni/vel0city path: /src/player/mod.rs use na; pub mod movement; // remove this later pub const PLAYER_HALFEXTENTS: na::Vec3<f32> = na::Vec3 { x: 8.0, y: 12.0, z: 8.0 }; <|fim_suffix|>pub struct Player { pub pos: na::Pnt3<f32>, pub flags: PlayerFlags, pub vel: na::Vec...
code_fim
hard
{ "lang": "rust", "repo": "bvssvni/vel0city", "path": "/src/player/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cogciprocate/vkc path: /src/surface.rs use libc::c_void; use std::ptr; use std::sync::Arc; use std::sync::atomic::AtomicBool; use winit; use vk; use vks; use ::{VkcResult, Instance}; #[derive(Debug)] struct Inner { handle: vks::khr_surface::VkSurfaceKHR, instance: Instance, active:...
code_fim
hard
{ "lang": "rust", "repo": "cogciprocate/vkc", "path": "/src/surface.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> unsafe { ::check(instance.vk().khr_win32_surface.vkCreateWin32SurfaceKHR(instance.handle(), &create_info, ptr::null(), &mut handle)); } Ok(Surface { inner: Arc::new(Inner { handle: handle, instance: instance, ...
code_fim
hard
{ "lang": "rust", "repo": "cogciprocate/vkc", "path": "/src/surface.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let x = input.parse().map(Self::$variant1); $( let x = x.or_else(|_: syn::Error|{ Ok(Self::$variantn(input.parse()?)) }); )* x.map_err(|_: syn::Error|{ ...
code_fim
hard
{ "lang": "rust", "repo": "jam1garner/binread_derive", "path": "/src/meta_attrs/parser/parse_any.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jam1garner/binread_derive path: /src/meta_attrs/parser/parse_any.rs /// Attempt to parse variants in order until a match is found macro_rules! parse_any { (enum $enum:ident { $variant1:ident($ty1:ty), $( $variantn:ident($tyn:ty) ),* $(,)? }) =>...
code_fim
hard
{ "lang": "rust", "repo": "jam1garner/binread_derive", "path": "/src/meta_attrs/parser/parse_any.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// The 'U' in SCRUD. Updates a single item. fn update(&self, conn: Connection) -> Result<T, Error>; /// The 'D' in SCRUD. Removes an entry by id. fn delete(&self, conn: Connection) -> Result<T, Error>; }<|fim_prefix|>// repo: Tzrlk/myth path: /src/core/sql/dao.rs //! SCRUD definition for DAO obje...
code_fim
hard
{ "lang": "rust", "repo": "Tzrlk/myth", "path": "/src/core/sql/dao.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Tzrlk/myth path: /src/core/sql/dao.rs //! SCRUD definition for DAO objects. use rusqlite::Connection; use super::super::error::Error; pub trait Dao<T : Dao<T>> { /// The 'S' in SCRUD. Ensures the schema is set up correctly. fn schema(conn: Connection) -> Result<(), Error>; /// The 'C' in ...
code_fim
hard
{ "lang": "rust", "repo": "Tzrlk/myth", "path": "/src/core/sql/dao.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// The 'C' in SCRUD. Creates a new entry for the given data. fn create(&self, conn: Connection) -> Result<T, Error>; /// The 'R' in SCRUD. Reads a single item by id. fn read(&self, conn: Connection) -> Result<T, Error>; /// The 'U' in SCRUD. Updates a single item. fn update(&self, conn: Connectio...
code_fim
medium
{ "lang": "rust", "repo": "Tzrlk/myth", "path": "/src/core/sql/dao.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bastion-rs/allocator-suite path: /src/allocators/bit_set/bit_set_allocator.rs quired.scale_to_memory_offset_in_bytes(&self.block_size); let new_memory_offset_in_bytes = new_number_of_bits_required.scale_to_memory_offset_in_bytes(&self.block_size); let deallocate_size...
code_fim
hard
{ "lang": "rust", "repo": "bastion-rs/allocator-suite", "path": "/src/allocators/bit_set/bit_set_allocator.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bastion-rs/allocator-suite path: /src/allocators/bit_set/bit_set_allocator.rs bits } else { location .major .unset_middle_bits(number_of_bits_required, number_of_lower_bits); ...
code_fim
hard
{ "lang": "rust", "repo": "bastion-rs/allocator-suite", "path": "/src/allocators/bit_set/bit_set_allocator.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let too_few_bits_available_for_alignment = unaligned_shift != 0 && unaligned_shift < shift_decrement as u64; if unlikely!(too_few_bits_available_for_alignment) { return Right(Self::aligned_trailing_unset_bits( current, ...
code_fim
hard
{ "lang": "rust", "repo": "bastion-rs/allocator-suite", "path": "/src/allocators/bit_set/bit_set_allocator.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// pub struct ProbSDPCone<'a, L: LinAlgEx> { sk: usize, p: usize, cone_psd: ConePSD<'a, L>, cone_zero: ConeZero<L>, } impl<'a, L: LinAlgEx> Cone<L> for ProbSDPCone<'a, L> { fn proj(&mut self, dual_cone: bool, x: &mut L::Sl) -> Result<(), ()> { let (sk, p) = ...
code_fim
hard
{ "lang": "rust", "repo": "convexbrain/Totsu", "path": "/solver_rust_conic/totsu/src/problem/sdp.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> /// Generates the problem data structures to be fed to [`Solver::solve`]. /// /// Returns a tuple of operators, a cone and a work slice. pub fn problem(&mut self) -> (ProbSDPOpC<L>, ProbSDPOpA<L>, ProbSDPOpB<L>, ProbSDPCone<'_, L>, &mut[L::F]) { let p = self.vec_b.size()....
code_fim
hard
{ "lang": "rust", "repo": "convexbrain/Totsu", "path": "/solver_rust_conic/totsu/src/problem/sdp.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: convexbrain/Totsu path: /solver_rust_conic/totsu/src/problem/sdp.rs use num_traits::{Float, Zero, One}; use totsu_core::solver::{Solver, SliceLike, Operator, Cone}; use totsu_core::{LinAlgEx, MatType, MatOp, ConePSD, ConeZero, splitm, splitm_mut}; use crate::MatBuild; // pub struct Prob...
code_fim
hard
{ "lang": "rust", "repo": "convexbrain/Totsu", "path": "/solver_rust_conic/totsu/src/problem/sdp.rs", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>rrent_topic(), _ => {} }, Event::Tick => app.change_message(format!("A new tick arrive {}", app.message)), } }<|fim_prefix|>// repo: francoisblarel/kafui path: /src/handlers/topic_list.rs use crate::app::App; use crate::model::Event; use crossterm::event::KeyCode; pub fn ...
code_fim
hard
{ "lang": "rust", "repo": "francoisblarel/kafui", "path": "/src/handlers/topic_list.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>KeyCode::Up => app.select_previous_topic(), KeyCode::Down => app.select_next_topic(), KeyCode::Enter => app.select_current_topic(), _ => {} }, Event::Tick => app.change_message(format!("A new tick arrive {}", app.message)), } }<|fim_prefix|>// repo: ...
code_fim
medium
{ "lang": "rust", "repo": "francoisblarel/kafui", "path": "/src/handlers/topic_list.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: francoisblarel/kafui path: /src/handlers/topic_list.rs use crate::app::App; use crate::model::Event; use crossterm::event::KeyCode; pub fn handle_key(event: Event<KeyCode>, app: &mut App) { m<|fim_suffix|>KeyCode::Up => app.select_previous_topic(), KeyCode::Down => app.select_ne...
code_fim
medium
{ "lang": "rust", "repo": "francoisblarel/kafui", "path": "/src/handlers/topic_list.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nuta/archives path: /noa-lsp/src/common/oops.rs use std::fmt::Debug; pub trait OopsExt: Sized { fn oops_with_reason(self, reason: &str); <|fim_suffix|> match self { Ok(_) => {} Err(err) if reason.is_empty() => { warn!("oops: {:?}", err); ...
code_fim
hard
{ "lang": "rust", "repo": "nuta/archives", "path": "/noa-lsp/src/common/oops.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> match self { Ok(_) => {} Err(err) if reason.is_empty() => { warn!("oops: {:?}", err); crate::logger::backtrace(); } Err(err) => { warn!("oops: {}: {:?}", reason, err); crate::logger::bac...
code_fim
hard
{ "lang": "rust", "repo": "nuta/archives", "path": "/noa-lsp/src/common/oops.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub use connection_interface::ConnectionInterface; pub use js_module_format::JsModuleFormat; pub use project_config::{ LocalPersistConfig, PersistConfig, ProjectConfig, ProjectName, RemotePersistConfig, SchemaConfig, SchemaLocation, }; pub use typegen_config::{FlowTypegenConfig, FlowTypegenPhase, ...
code_fim
medium
{ "lang": "rust", "repo": "josephsavona/relay", "path": "/compiler/crates/relay-config/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: josephsavona/relay path: /compiler/crates/relay-config/src/lib.rs /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #![deny(warnings)] #![deny(rust_2018_id...
code_fim
medium
{ "lang": "rust", "repo": "josephsavona/relay", "path": "/compiler/crates/relay-config/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }