text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> // Creating our own scheme mapper with the default ports fn db_scheme_type_mapper(scheme: &str) -> SchemeType { match scheme { "postgres" => SchemeType::Relative(5432), "mysql" => SchemeType::Relative(3306), _ => SchemeType::NonRelative, } } /// Returns a driver instance ...
code_fim
hard
{ "lang": "rust", "repo": "ramn/dbmigrate", "path": "/src/drivers/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> match scheme { "postgres" => SchemeType::Relative(5432), "mysql" => SchemeType::Relative(3306), _ => SchemeType::NonRelative, } } /// Returns a driver instance depending on url pub fn get_driver(url: &str) -> MigrateResult<Box<Driver>> { // Mysql driver does not allow ...
code_fim
hard
{ "lang": "rust", "repo": "ramn/dbmigrate", "path": "/src/drivers/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> env_logger::init().unwrap_or_else( |err| panic!("unable to initiate env logger: {}", err) ); match core::start() { Ok(()) => info!("game exiting"), Err(err) => error!("core start error: {}", err), } }<|fim_prefix|>// repo: yeliknewo/explore path: /src/...
code_fim
easy
{ "lang": "rust", "repo": "yeliknewo/explore", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yeliknewo/explore path: /src/main.rs extern crate nalgebra; #[macro_use] extern crate log; extern crate env_logger; <|fim_suffix|> env_logger::init().unwrap_or_else( |err| panic!("unable to initiate env logger: {}", err) ); match core::start() { Ok(()) =>...
code_fim
medium
{ "lang": "rust", "repo": "yeliknewo/explore", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DanMaycock/fortunes_algorithm_rs path: /src/boundingbox.rs ::Point2<f64>, direction: &cgmath::Vector2<f64>) -> (cgmath::Point2<f64>, Side) { assert!(self.contains(origin)); let (t1, side1) = if direction.x < 0.0 { ((self.right - origin.x) / direction.x, Side::Right) ...
code_fim
hard
{ "lang": "rust", "repo": "DanMaycock/fortunes_algorithm_rs", "path": "/src/boundingbox.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DanMaycock/fortunes_algorithm_rs path: /src/boundingbox.rs ight => Side::Top, Side::Bottom => Side::Right, Side::None => Side::None, } } } #[derive(Debug)] pub struct BoundingBox { left: f64, right: f64, top: f64, bottom: f64, } impl Bounding...
code_fim
hard
{ "lang": "rust", "repo": "DanMaycock/fortunes_algorithm_rs", "path": "/src/boundingbox.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if !inside || !next_inside { let intersections = self.get_intersections( &voronoi.get_vertex_point(origin), &voronoi.get_vertex_point(destination), ); if !inside && !next_inside { ...
code_fim
hard
{ "lang": "rust", "repo": "DanMaycock/fortunes_algorithm_rs", "path": "/src/boundingbox.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test_connector] fn listing_a_single_migration_name_should_work(api: TestApi) { let dm = api.datamodel_with_provider( r#" model Cat { id Int @id name String } "#, ); let migrations_directory = api.create_migrations_directory(); api.cre...
code_fim
medium
{ "lang": "rust", "repo": "prisma/prisma-engines", "path": "/schema-engine/sql-migration-tests/tests/list_migration_directories/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> chunk: &Chunk, device: &wgpu::Device, queue: &wgpu::Queue, ) -> MeshBufferVerts { // Calculate total length of buffer e.g. a full chunk of different voxels. This way a new buffer only has to be created when the voxel capacity is changed. let verts = Mesh::verts(chunk); let vert_le...
code_fim
hard
{ "lang": "rust", "repo": "ericrobolson/Archived_Tremor", "path": "/v0/src/gfx/voxels/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn process_match_results(result: &MatchResult, data: &mut SimulatorData) { let now = data.date; let league = data.league_mut(result.league_id).unwrap(); league.schedule.as_mut().unwrap().update_match_result( &result.schedule_id, result.home_goals, ...
code_fim
hard
{ "lang": "rust", "repo": "BeastNeedsMoreTorque/football-simulator", "path": "/src/core/src/country/result.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn process_match_events(result: &MatchResult, data: &mut SimulatorData) { for match_event in &result.details.as_ref().unwrap().events { match match_event { MatchEvent::MatchPlayed(player_id, is_start_squad, minutes_played) => { ...
code_fim
hard
{ "lang": "rust", "repo": "BeastNeedsMoreTorque/football-simulator", "path": "/src/core/src/country/result.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[cfg(feature = "breakout")] let memfile_bytes = include_bytes!("stm32h743zi_memory.x"); #[cfg(not(feature = "breakout"))] let memfile_bytes = include_bytes!("stm32h743vi_memory.x"); // Put the linker script somewhere the linker can find it let out = &PathBuf::from(env::var_os("O...
code_fim
medium
{ "lang": "rust", "repo": "tstellanova/openmv_h7_bsp", "path": "/build.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let mut buffer: String = String::new(); io::stdin().read_line(&mut buffer)?; Ok(buffer.trim_right().to_owned()) } fn main() { let num = input("Ingrese un número: ") .unwrap() .parse::<i32>() .expect("Expected a number"); if num % 2 == 0 { ...
code_fim
medium
{ "lang": "rust", "repo": "NightRoadIx/IntraLenguaje", "path": "/parimpar.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: NightRoadIx/IntraLenguaje path: /parimpar.rs use std::io; fn input(user_message: &str) -> io::Result<String> { use std::io::Write; print!("{}", user_message); io::stdout().flush()?; <|fim_suffix|> let num = input("Ingrese un número: ") .unwrap() .par...
code_fim
medium
{ "lang": "rust", "repo": "NightRoadIx/IntraLenguaje", "path": "/parimpar.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let root = builder::build_composite(1, &tree_map); root.accept(&mut Printer::new()); } #[test] fn test_component_debug_print() { let tree_map: MultiMap<IDType, IDType> = TREE_MAP_DEF.iter().cloned().collect(); let root = builder::build_composite(1, &tree_map);...
code_fim
hard
{ "lang": "rust", "repo": "Geraet/kompositum-rs", "path": "/src/tests.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[actix_web::main] async fn main() -> std::io::Result<()> { // Set keep-alive to 75 seconds let _one = HttpServer::new(app).keep_alive(Duration::from_secs(75)); // Use OS's keep-alive (usually quite long) let _two = HttpServer::new(app).keep_alive(KeepAlive::Os); // Disable keep-aliv...
code_fim
hard
{ "lang": "rust", "repo": "actix/actix-website", "path": "/examples/server/src/keep_alive.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // No need to do this shit, since logger redirects to console. // Only first match is required. // TODO: Formatting, < 80 dude for event in events { match event { (_, event::Event::ConsoleMessage(msg, level)) => self.add_entry(msg, level), ...
code_fim
hard
{ "lang": "rust", "repo": "barreyo/DAT205-advanced-computer-graphics", "path": "/src/ui/console.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: barreyo/DAT205-advanced-computer-graphics path: /src/ui/console.rs use std::collections::VecDeque; use std::collections::HashMap; use conrod; use alewife; use core::event; use rendering::colors; widget_ids!{ pub struct ConsoleIds { container, bg, log, inpu...
code_fim
hard
{ "lang": "rust", "repo": "barreyo/DAT205-advanced-computer-graphics", "path": "/src/ui/console.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Do not draw anything if not shown if !self.visible { return; } // Canvas or to not Canvas? that is the question /* widget::Canvas::new() .floating(true) .w_h(self.window_w, self.window_h) .middle_of(ui.window) ...
code_fim
hard
{ "lang": "rust", "repo": "barreyo/DAT205-advanced-computer-graphics", "path": "/src/ui/console.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn map_ignored(_: IRCToken) -> Result<IRCToken, ~str> { Ok(Ignored) } fn map_params(tok: IRCToken) -> Result<IRCToken, ~str> { // Sequence(~[Sequence(~[Sequence(~[Ignored, Unparsed(~"##codelab")])]), Sequence(~[Sequence(~[Ignored, Unparsed(~":"), Unparsed(~"hi")])])]) match tok { Sequ...
code_fim
hard
{ "lang": "rust", "repo": "tiffany352/tiffbot-2", "path": "/irc.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tiffany352/tiffbot-2 path: /irc.rs use parse::*; #[deriving(Clone)] pub struct Prefix { nick: ~str, user: ~str, host: ~str } impl ToStr for Prefix { fn to_str(&self) -> ~str { match (self.nick.clone(), self.user.clone(), self.host.clone()) { (~"", ~"", ~"") ...
code_fim
hard
{ "lang": "rust", "repo": "tiffany352/tiffbot-2", "path": "/irc.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[tauri::command] pub fn set_working_folder(working_folder: String) -> Result<(), ()> { unsafe { WORKING_FOLDER = working_folder; } Ok(()) } #[tauri::command] pub fn write_board(board_name: String, contents: String) -> Result<(), String> { let mut configurator = Configurator::new(...
code_fim
hard
{ "lang": "rust", "repo": "projectacrn/acrn-hypervisor", "path": "/misc/config_tools/configurator/packages/configurator/src-tauri/src/configurator.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Ok(contents) } } /// HTTP error consisting of a status code and body contents. #[derive(Debug)] pub(crate) struct HttpError { pub(crate) status_code: String, pub(crate) contents: Vec<u8>, } impl std::error::Error for HttpError {} impl fmt::Display for HttpError { fn fmt(&self, f: &mut fmt::Format...
code_fim
hard
{ "lang": "rust", "repo": "TheBlueMatt/rust-lightning", "path": "/lightning-block-sync/src/http.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TheBlueMatt/rust-lightning path: /lightning-block-sync/src/http.rs sed. async fn send_request_with_retry(&mut self, request: &str) -> std::io::Result<Vec<u8>> { match self.send_request(request).await { Ok(bytes) => Ok(bytes), Err(_) => { // Reconnect and retry on fail. This can happ...
code_fim
hard
{ "lang": "rust", "repo": "TheBlueMatt/rust-lightning", "path": "/lightning-block-sync/src/http.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TheBlueMatt/rust-lightning path: /lightning-block-sync/src/http.rs t; #[cfg(not(feature = "tokio"))] let read_res = reader.read_line(&mut line); match read_res { Ok(bytes_read) => break bytes_read, Err(e) if e.kind() == std::io::ErrorKind::WouldBlock => { timeou...
code_fim
hard
{ "lang": "rust", "repo": "TheBlueMatt/rust-lightning", "path": "/lightning-block-sync/src/http.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut in_garbage = false; let mut prev_cancel = false; for c in s.chars(){ if in_garbage { if c == '>' && !prev_cancel { in_garbage = false; prev_cancel = false; } else if c == '!' && !prev_cancel { p...
code_fim
hard
{ "lang": "rust", "repo": "Enigmatrix/aoc17", "path": "/src/day09.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Enigmatrix/aoc17 path: /src/day09.rs use std::collections::*; pub fn day09_1(s : String) -> u32{ let mut running_total = 0; let mut scope = 0; let mut in_garbage = false; let mut prev_cancel = false; for c in s.chars(){ if in_garbage { if c == '>' && !pre...
code_fim
hard
{ "lang": "rust", "repo": "Enigmatrix/aoc17", "path": "/src/day09.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[error("failed to parse value '{value}' for variable '{name}'")] ReadVariable { name: String, value: String }, #[error(transparent)] // #[error("fail to process io")] Io { #[from] source: std::io::Error, // backtrace: Backtrace, }, #[error("fail to pro...
code_fim
hard
{ "lang": "rust", "repo": "ffizer/ffizer", "path": "/src/error.rs", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> #[error("fail to parse string as uri for git repo '{value:?}'")] ParseGitUri { value: String, source: regex::Error }, #[error("local path({path:?}) not found for uri({uri:?}) subfolder({subfolder:?})")] LocalPathNotFound { path: PathBuf, uri: String, subfolder: Opt...
code_fim
hard
{ "lang": "rust", "repo": "ffizer/ffizer", "path": "/src/error.rs", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> let state = state::State::new()?; let mut runtime = config::runtime(&args, &state)?; runtime.filterer(filterer::globset(&args).await?); info!("initialising Watchexec runtime"); let wx = Watchexec::new(init, runtime)?; if !args.postpone { debug!("kicking off with empty event"); wx.send_event(Ev...
code_fim
hard
{ "lang": "rust", "repo": "watchexec/watchexec", "path": "/crates/cli/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bqqbarbhg/adventofcode path: /2022/05/part2.rs mod common; use std::{io::{self, BufRead}}; use std::vec::Vec; use regex::Regex; use common::{match_iter, match_capture, ensure_size}; fn get_disjoint<T>(ts: &mut [T], a: usize, b: usize) -> (&mut T, &mut T) { assert!(a != b, "a ({}) and b ({})...
code_fim
medium
{ "lang": "rust", "repo": "bqqbarbhg/adventofcode", "path": "/2022/05/part2.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let re_top = Regex::new(r" {4}|\[([A-Z])\]").unwrap(); let re_action = Regex::new(r"move (\d+) from (\d+) to (\d+)").unwrap(); let mut stacks: Vec<Vec<char>> = Vec::new(); let mut input = io::stdin().lock().lines() .flat_map(|l| l.ok()); for line in &mut input { if li...
code_fim
medium
{ "lang": "rust", "repo": "bqqbarbhg/adventofcode", "path": "/2022/05/part2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>unsafe impl TxPin<UART4> for P0_22<AF3> {} unsafe impl TxPin<UART4> for P1_29<AF5> {} unsafe impl TxPin<UART4> for P5_4<AF4> {} unsafe impl RxPin<UART4> for P2_9<AF3> {} unsafe impl RxPin<UART4> for P5_3<AF4> {}<|fim_prefix|>// repo: thenewwazoo/lpc177x_8x-hal path: /src/serial/pkg_208pin.rs use lpc::{U...
code_fim
hard
{ "lang": "rust", "repo": "thenewwazoo/lpc177x_8x-hal", "path": "/src/serial/pkg_208pin.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sutetako/rust_learning path: /src/main.rs :Orca, _ => None // error: incompatible types } */ // 6.4.1 /* if let pattern = expr { block1 } else { block2 } match expr { pattern => { block1 } _ => { block2 } ...
code_fim
hard
{ "lang": "rust", "repo": "sutetako/rust_learning", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // /// Dump an error message to `stderr`. // /// // /// If another error happens while building the error message or // /// writing to `stderr`, it is ignored. // fn print_error(mut err: &Error) { // let _ = writeln!(stderr(), "error: {}", err); // while let Some(cause...
code_fim
hard
{ "lang": "rust", "repo": "sutetako/rust_learning", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sutetako/rust_learning path: /src/main.rs d of Medusa".to_string(), "a salt cellar".to_string(), ], ); fn show(table: Table) { for (artist, works) in table { println!("works by {}", artist); for work in works { println!...
code_fim
hard
{ "lang": "rust", "repo": "sutetako/rust_learning", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: VamshikShetty/matrix-rust-sdk path: /matrix/src/apis/device_management_api.rs /* * Matrix Client-Server Registration and Login API * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * OpenAPI spec version: 1.0.0 * * Generated ...
code_fim
hard
{ "lang": "rust", "repo": "VamshikShetty/matrix-rust-sdk", "path": "/matrix/src/apis/device_management_api.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let configuration: &configuration::Configuration = self.configuration.borrow(); let client = &configuration.client; let uri_str = format!("{}/client/r0/devices/{deviceId}", configuration.base_path, deviceId=urlencode(device_id)); let mut req_builder = client.put(uri_str.as...
code_fim
hard
{ "lang": "rust", "repo": "VamshikShetty/matrix-rust-sdk", "path": "/matrix/src/apis/device_management_api.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn get_devices(&self, ) -> Result<::models::ListOfDevice, Error> { let configuration: &configuration::Configuration = self.configuration.borrow(); let client = &configuration.client; let uri_str = format!("{}/client/r0/devices", configuration.base_path); let mut req_bu...
code_fim
hard
{ "lang": "rust", "repo": "VamshikShetty/matrix-rust-sdk", "path": "/matrix/src/apis/device_management_api.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &self, native_code_start_address: UINT_PTR, ) -> Result<Vec<COR_DEBUG_IL_TO_NATIVE_MAP>, HRESULT>; fn get_code_info_4( &self, native_code_start_address: UINT_PTR, ) -> Result<Vec<COR_PRF_CODE_INFO>, HRESULT>; }<|fim_prefix|>// repo: longde123/clr-profiler path:...
code_fim
hard
{ "lang": "rust", "repo": "longde123/clr-profiler", "path": "/clr_profiler/src/traits/cor_profiler_info_9.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let app = App::new_insert_into_element(parent_div, subaction).await; let event_tx = app.get_event_tx(); let frame = document.create_element("p").unwrap(); frame.set_inner_html("Frame: 0"); body.append_child(&frame).unwrap(); let button = document.create_element("button").unwrap()...
code_fim
hard
{ "lang": "rust", "repo": "rukai/brawllib_rs", "path": "/examples/visualiser_for_wasm.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let document = web_sys::window().unwrap().document().unwrap(); let body = document.body().unwrap(); let parent_div = document.create_element("div").unwrap(); parent_div .dyn_ref::<HtmlElement>() .unwrap() .style() .set_css_text("margin: auto; width: 80%; as...
code_fim
hard
{ "lang": "rust", "repo": "rukai/brawllib_rs", "path": "/examples/visualiser_for_wasm.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Sets the end. /// Only used when `parts > 1`. /// The size of the part is `end - begin + 1`. /// `end` should be larger than `begin`, otherwise an overflow error occurrs. pub fn end(mut self, end: u64) -> EncodeOptions { self.end = end; self } /// Encodes t...
code_fim
hard
{ "lang": "rust", "repo": "aswaving/yenc", "path": "/src/encode.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> variant as u8 != 0 } } #[doc = "Reader of field `RESUME`"] pub type RESUME_R = crate::pac::generic::R<bool, RESUME_A>; impl RESUME_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::pac::generic::Variant<bool, RESUME_A> { use cra...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-usbd", "path": "/src/pac/usb/cntr.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stm32-rs/stm32-usbd path: /src/pac/usb/cntr.rs he field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4); self.w } } #[doc = "LPM L1 Resume request\n\nValue on reset: 0"] #[der...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-usbd", "path": "/src/pac/usb/cntr.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stm32-rs/stm32-usbd path: /src/pac/usb/cntr.rs a mut W, } impl<'a> FSUSP_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: FSUSP_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "No effect"] ...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-usbd", "path": "/src/pac/usb/cntr.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aedm/stillaxis path: /rust/stillaxis/src/stillaxis.rs use crate::dom::document::Document; use crate::dom::flow_node::{Element, ElementProviderRef, ElementRef}; use crate::dom::mutation::FlowMutation; use stillaxis_core::node::{Node, ProviderRef}; use stillaxis_core::render::render_graph::Message...
code_fim
hard
{ "lang": "rust", "repo": "aedm/stillaxis", "path": "/rust/stillaxis/src/stillaxis.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut stillaxis = Stillaxis::new(); let mut _c1; let csum; let fsum = stillaxis.new_node::<SumNode>(); { let ff1 = stillaxis.new_node::<FloatNode>(); _c1 = Some(ff1.borrow().core_node.clone()); csum = fsum.borrow().core_node.c...
code_fim
hard
{ "lang": "rust", "repo": "aedm/stillaxis", "path": "/rust/stillaxis/src/stillaxis.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> _c1 = Some(ff1.borrow().core_node.clone()); csum = fsum.borrow().core_node.clone(); let mut flow_mutation = FlowMutation::new(vec![ CreateNodeFlowMutation::new(&ff1), CreateNodeFlowMutation::new(&fsum), SetSlotConnections...
code_fim
hard
{ "lang": "rust", "repo": "aedm/stillaxis", "path": "/rust/stillaxis/src/stillaxis.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> where V: AsyncVisitResponse<BinaryWriter = W>; } /// A visitor over response body formats. pub trait VisitResponse { /// The server's binary response body writer type. type BinaryWriter; /// The output type returned by visit methods. type Output; /// Visits an empty body...
code_fim
hard
{ "lang": "rust", "repo": "svc-excavator-bot-org/conjure-rust", "path": "/conjure-http/src/server.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a, T: FromSql<'a>> FromSql<'a> for Timestamp<T> { fn from_sql(ty: &Type, raw: &'a [u8]) -> Result<Self, Box<dyn Error + Sync + Send>> { match types::timestamp_from_sql(raw)? { i64::MAX => Ok(Timestamp::PosInfinity), i64::MIN => Ok(Timestamp::NegInfinity), ...
code_fim
hard
{ "lang": "rust", "repo": "sfackler/rust-postgres", "path": "/postgres-types/src/special.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut privilege = TOKEN_PRIVILEGES{ PrivilegeCount: 1, Privileges: [LUID_AND_ATTRIBUTES {Luid: luid, Attributes: SE_PRIVILEGE_ENABLED}], }; let r = unsafe { AdjustTokenPrivileges(handle, false as i32, &mut privilege, std::mem::size_of::<TOKEN_PRIVILEGES>() as u32, st...
code_fim
hard
{ "lang": "rust", "repo": "songlinshu/registry-rs", "path": "/examples/private-hive.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ance serialization, especially for large data structures, //! should look at more advanced solutions such as protocol buffers. mod binary; mod errors; mod varint; pub use self::binary::*; pub use errors::*; pub use varint::*;<|fim_prefix|>// repo: sammyne/encoding-rs path: /crates/binary/src/lib.rs //!...
code_fim
hard
{ "lang": "rust", "repo": "sammyne/encoding-rs", "path": "/crates/binary/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sammyne/encoding-rs path: /crates/binary/src/lib.rs //! Implementation of simple translation between numbers and byte //! sequences and encoding and decoding of varints. //! //! Numbers are translated by reading and writing fixed-size values. //! A fixed-size value is either a fixed-size arithme...
code_fim
hard
{ "lang": "rust", "repo": "sammyne/encoding-rs", "path": "/crates/binary/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // The header lied about how long the body was if end > self.cursor.get_ref().len() { Some(Err(Error::IncompleteError)) } else { // Switching to a vendor namespace, and we don't know how to handle /...
code_fim
hard
{ "lang": "rust", "repo": "Xudong-Huang/radiotap", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn bad_version() { let frame = [ 1, 0, 39, 0, 46, 72, 0, 192, 0, 0, 0, 128, 0, 0, 0, 160, 4, 0, 0, 0, 16, 2, 158, 9, 160, 0, 227, 5, 0, 0, 255, 255, 255, 255, 2, 0, 222, 173, 4, ]; match Radiotap::from_bytes(&frame).unwrap_err() { ...
code_fim
hard
{ "lang": "rust", "repo": "Xudong-Huang/radiotap", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gregscott94/gspos-server path: /src/main.rs extern crate ws; extern crate nickel; use std::thread; use std::time; use std::env; use ws::{listen, Handler, Sender, Result, Message, Handshake, CloseCode, Error}; use nickel::{Nickel, Mountable, StaticFilesHandler}; mod youtube; struct Server { ...
code_fim
hard
{ "lang": "rust", "repo": "gregscott94/gspos-server", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let ws_server_thread = thread::Builder::new().name("ws_server".to_string()).spawn(move || { println!("Starting websocket server.."); listen("127.0.0.1:3012", |out| { Server { out: out } }).unwrap() }).unwrap(); thread::sleep(time::Duration::from_millis(1000)); match env::var("PROD_ENV...
code_fim
hard
{ "lang": "rust", "repo": "gregscott94/gspos-server", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>struct Solution; impl Solution { pub fn coin_change(coins: Vec<i32>, amount: i32) -> i32 { 5 } } fn main() { let input1 = vec![1,2,5]; let sol = Solution::coin_change(input1, 11); println!("Result: {}, Expected: 3", sol); }<|fim_prefix|>// repo: ChrisRG/CodingChallenges path...
code_fim
medium
{ "lang": "rust", "repo": "ChrisRG/CodingChallenges", "path": "/old_leetcode/easy/322_coin_change.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ChrisRG/CodingChallenges path: /old_leetcode/easy/322_coin_change.rs // You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. // Return the fewest number of coins that you need to make up that amount. If th...
code_fim
medium
{ "lang": "rust", "repo": "ChrisRG/CodingChallenges", "path": "/old_leetcode/easy/322_coin_change.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn threaded_quick_sort<T: 'static + PartialOrd + Debug + Send>(v: &mut [T]) { if v.len() <= 1 { return; } let p = pivot(v); println!("{:?}", v); let (a, b) = v.split_at_mut(p); let raw_a = a as *mut [T]; let raw_s = RawSend(raw_a); unsafe { let handle = ...
code_fim
hard
{ "lang": "rust", "repo": "tengrommel/lesson", "path": "/Algorithm/lesson1/ex-sorting/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn threaded_quick_sort<T: 'static + PartialOrd + Debug + Send>(v: &mut [T]) { if v.len() <= 1 { return; } let p = pivot(v); println!("{:?}", v); let (a, b) = v.split_at_mut(p); let raw_a = a as *mut [T]; let raw_s = RawSend(raw_a); unsafe { let handle =...
code_fim
hard
{ "lang": "rust", "repo": "tengrommel/lesson", "path": "/Algorithm/lesson1/ex-sorting/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tengrommel/lesson path: /Algorithm/lesson1/ex-sorting/src/lib.rs mod rand; use std::fmt::Debug; use rayon::prelude::*; pub fn bubble_sort<T: PartialOrd + Debug>(v: &mut [T]) { for p in 0..v.len() { // println!("{:?}", v); let mut sorted = true; for i in 0..(v.len()-...
code_fim
hard
{ "lang": "rust", "repo": "tengrommel/lesson", "path": "/Algorithm/lesson1/ex-sorting/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, Copy, Clone, PartialEq)] pub enum ShapeType { Rectangle(f32, f32), Circle(f32), } #[derive(Debug, Copy, Clone, PartialEq)] pub struct Shape { pub shape_type: ShapeType, pub colour: Color, }<|fim_prefix|>// repo: carribus/rust-game-experiments path: /ggez-test2/src/compone...
code_fim
medium
{ "lang": "rust", "repo": "carribus/rust-game-experiments", "path": "/ggez-test2/src/components.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: carribus/rust-game-experiments path: /ggez-test2/src/components.rs use ggez::graphics::Color; #[derive(Debug, Copy, Clone, Default, PartialEq)] pub struct Position { pub x: f32, pub y: f32, } #[derive(Debug, Copy, Clone, Default, PartialEq)] pub struct Velocity { pub xv: f32, p...
code_fim
medium
{ "lang": "rust", "repo": "carribus/rust-game-experiments", "path": "/ggez-test2/src/components.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cryptoballot/cryptoballot path: /cryptoballot/src/ballot.rs use indexmap::IndexMap; use prost::Message; #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Ballot { pub id: String, pub contests: Vec<u32>, // List of contest indexes /// Application specific properties. //...
code_fim
hard
{ "lang": "rust", "repo": "cryptoballot/cryptoballot", "path": "/cryptoballot/src/ballot.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Approval voting is a single-winner electoral system where each voter may select (“approve”) any number of candidates. /// The winner is the most-approved candidate. /// /// For Approval tally, `Selection.score` has no meaning. Approval, /// The Condorcet method is a ranked-ch...
code_fim
hard
{ "lang": "rust", "repo": "cryptoballot/cryptoballot", "path": "/cryptoballot/src/ballot.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn ascripted_fn_args() { test_parse!(ascripted_arg, "(x : int)"); let res = test_parse!(decl, "fn plus1 (x : int) = x + 1"); assert_eq!( res, Decl::Fun { name: "plus1".try_into().unwrap(), body: Fun { ...
code_fim
hard
{ "lang": "rust", "repo": "glittershark/achilles", "path": "/src/parser/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: glittershark/achilles path: /src/parser/mod.rs use nom::character::complete::{multispace0, multispace1}; use nom::error::{ErrorKind, ParseError}; use nom::{alt, char, complete, do_parse, many0, named, separated_list0, tag, terminated}; #[macro_use] mod macros; mod expr; mod type_; use crate::a...
code_fim
hard
{ "lang": "rust", "repo": "glittershark/achilles", "path": "/src/parser/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>named!(ascripted_arg(&str) -> Arg, do_parse!( complete!(char!('(')) >> multispace0 >> ident: ident >> multispace0 >> complete!(char!(':')) >> multispace0 >> type_: type_ >> multispace0 >> complete!(char!(')')) >> (Arg { ...
code_fim
hard
{ "lang": "rust", "repo": "glittershark/achilles", "path": "/src/parser/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: EFanZh/LeetCode path: /src/problem_0557_reverse_words_in_a_string_iii/iterative.rs pub struct Solution; // ------------------------------------------------------ snip ------------------------------------------------------ // <|fim_suffix|> s.split_mut(|&c| c == b' ').for_each(<[_]>::rev...
code_fim
medium
{ "lang": "rust", "repo": "EFanZh/LeetCode", "path": "/src/problem_0557_reverse_words_in_a_string_iii/iterative.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Self::reverse_words(s) } } #[cfg(test)] mod tests { #[test] fn test_solution() { super::super::tests::run::<super::Solution>(); } }<|fim_prefix|>// repo: EFanZh/LeetCode path: /src/problem_0557_reverse_words_in_a_string_iii/iterative.rs pub struct Solution; // ----------...
code_fim
hard
{ "lang": "rust", "repo": "EFanZh/LeetCode", "path": "/src/problem_0557_reverse_words_in_a_string_iii/iterative.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for node in nodes.iter() { print_node(prefix, node); } } pub fn pretty_print(ir: &std::collections::HashMap<String, IRFunction>) { for (_, func) in ir { println!("Function-'{}':", func.name); println!(" Arguments:"); for param in func.parameters.iter() { ...
code_fim
hard
{ "lang": "rust", "repo": "Lol3rrr/rust-facomp", "path": "/src/frontend/ir/pretty_print.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Lol3rrr/rust-facomp path: /src/frontend/ir/pretty_print.rs use super::{IRExpression, IRFunction, IRNode}; fn print_expression(prefix: &str, exp: &IRExpression) { let next_prefix = format!("{} ", prefix); match exp { &IRExpression::Value(ref value) => { println!("{}V...
code_fim
hard
{ "lang": "rust", "repo": "Lol3rrr/rust-facomp", "path": "/src/frontend/ir/pretty_print.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn print_nodes(prefix: &str, nodes: &[IRNode]) { for node in nodes.iter() { print_node(prefix, node); } } pub fn pretty_print(ir: &std::collections::HashMap<String, IRFunction>) { for (_, func) in ir { println!("Function-'{}':", func.name); println!(" Arguments:"); ...
code_fim
hard
{ "lang": "rust", "repo": "Lol3rrr/rust-facomp", "path": "/src/frontend/ir/pretty_print.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tokio-rs/axum path: /examples/tracing-aka-logging/src/main.rs //! Run with //! //! ```not_rust //! cargo run -p example-tracing-aka-logging //! ``` use axum::{ body::Bytes, extract::MatchedPath, http::{HeaderMap, Request}, response::{Html, Response}, routing::get, Router...
code_fim
hard
{ "lang": "rust", "repo": "tokio-rs/axum", "path": "/examples/tracing-aka-logging/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // build our application with a route let app = Router::new() .route("/", get(handler)) // `TraceLayer` is provided by tower-http so you have to add that as a dependency. // It provides good defaults but is also very customizable. // // See https://docs.rs/t...
code_fim
hard
{ "lang": "rust", "repo": "tokio-rs/axum", "path": "/examples/tracing-aka-logging/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>d synonyms; pub mod thesaurus; pub mod yourdictionary;<|fim_prefix|>// repo: AlejandroDaneri/tp2-conc path: /src/actors/mod.rs //! Este es el modulo principal para la busqueda de sinonimos mediante el modelo de actores pub mod merria<|fim_middle|>mwebster; pub mod messages; pub mod requester; pub mo
code_fim
easy
{ "lang": "rust", "repo": "AlejandroDaneri/tp2-conc", "path": "/src/actors/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AlejandroDaneri/tp2-conc path: /src/actors/mod.rs //! Este es el modulo principal para la busqueda de s<|fim_suffix|>d synonyms; pub mod thesaurus; pub mod yourdictionary;<|fim_middle|>inonimos mediante el modelo de actores pub mod merriamwebster; pub mod messages; pub mod requester; pub mo
code_fim
medium
{ "lang": "rust", "repo": "AlejandroDaneri/tp2-conc", "path": "/src/actors/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> context.vm.frame_mut().loop_iteration_count = previous_iteration_count.wrapping_add(1); Ok(CompletionType::Normal) } }<|fim_prefix|>// repo: boa-dev/boa path: /boa_engine/src/vm/opcode/iteration/loop_ops.rs use crate::JsNativeError; use crate::{ vm::{opcode::Operation, CompletionT...
code_fim
hard
{ "lang": "rust", "repo": "boa-dev/boa", "path": "/boa_engine/src/vm/opcode/iteration/loop_ops.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Operation for IncrementLoopIteration { const NAME: &'static str = "IncrementLoopIteration"; const INSTRUCTION: &'static str = "INST - IncrementLoopIteration"; fn execute(context: &mut Context<'_>) -> JsResult<CompletionType> { let previous_iteration_count = context.vm.frame_mut()...
code_fim
hard
{ "lang": "rust", "repo": "boa-dev/boa", "path": "/boa_engine/src/vm/opcode/iteration/loop_ops.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: EugeneGonzalez/aoc_2020 path: /src/day2.rs use aoc_runner_derive::{aoc, aoc_generator}; use parse_display::{Display, FromStr}; use std::error::Error; #[derive(Display, FromStr, PartialEq, Debug)] #[display("{min}-{max} {letter}: {password}")] struct PasswordRule { min: usize, max: usize...
code_fim
hard
{ "lang": "rust", "repo": "EugeneGonzalez/aoc_2020", "path": "/src/day2.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[aoc(day2, part1)] fn part1(rules: &Vec<PasswordRule>) -> usize { rules .iter() .filter(|rule| (rule.min..=rule.max).contains(&rule.password.matches(rule.letter).count())) .count() } #[aoc(day2, part2)] fn part2(rules: &Vec<PasswordRule>) -> usize { rules .iter() ...
code_fim
medium
{ "lang": "rust", "repo": "EugeneGonzalez/aoc_2020", "path": "/src/day2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: baitcenter/gdlk path: /api/src/util.rs //! General utility functions and types. #[cfg(test)] pub use tests::*; use diesel::{r2d2::ConnectionManager, PgConnection}; /// Type aliases for DB connections pub type Pool = r2d2::Pool<ConnectionManager<PgConnection>>; pub type PooledConnection = ...
code_fim
medium
{ "lang": "rust", "repo": "baitcenter/gdlk", "path": "/api/src/util.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> (&conn as &PgConnection).begin_test_transaction().unwrap(); conn } /// Assert that the first value is an Err, and that its string form matches /// the second argument. #[macro_export] macro_rules! assert_err { ($res:expr, $msg:tt $(,)?) => { match $...
code_fim
hard
{ "lang": "rust", "repo": "baitcenter/gdlk", "path": "/api/src/util.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// #[cfg(test)] mod test { use super::santa; #[test] fn example() { assert!(santa(&"(())".to_string()) == 0); assert!(santa(&"()()".to_string()) == 0); assert!(santa(&"(((".to_string()) == 3); assert!(santa(&"(()(()(".to_string()) == 3); assert!(santa(&"...
code_fim
hard
{ "lang": "rust", "repo": "0000marcell/LearnRust", "path": "/RH/aoc1/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: 0000marcell/LearnRust path: /RH/aoc1/src/main.rs fn main() { let instruction: Vec<String> = std::env::args().collect(); let instruction: &String = &instruction[1]; println!("{}", santa(instruction)); } fn santa(instruction: &String) -> i32 { // if '(' up else if ')' down le...
code_fim
medium
{ "lang": "rust", "repo": "0000marcell/LearnRust", "path": "/RH/aoc1/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Self { label: self.label.clone(), dispatcher: self.dispatcher.clone(), } } } impl<P: Params> Hash for DetachedWindow<P> { /// Only use the [`DetachedWindow`]'s label to represent its hash. fn hash<H: Hasher>(&self, state: &mut H) { self.label.hash(state) } } impl<P: Param...
code_fim
hard
{ "lang": "rust", "repo": "gabcoh/tauri", "path": "/core/tauri-runtime/src/window.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>rse_to_value::*; pub use scanner::*; pub use value::*;<|fim_prefix|>// repo: bartlomieju/jsonc-parser path: /src/lib.rs pub mod common; pub mod ast; pub mod errors; pub mod tokens; mod parse_to_ast; mod scanner; mod parse_to_v<|fim_middle|>alue; mod value; pub use parse_to_ast::*; pub use pa
code_fim
easy
{ "lang": "rust", "repo": "bartlomieju/jsonc-parser", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> current_version .to_version(&available_versions) .ok_or(FrumError::VersionNotFound { version: current_version, })? .clone() } }; let installations_dir = confi...
code_fim
hard
{ "lang": "rust", "repo": "kenoss/frum", "path": "/src/commands/install.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Provide a default value for --with-openssl-dir if !configure_opts .iter() .any(|opt| opt.starts_with("--with-openssl-dir")) { command.arg(format!("--with-openssl-dir={}", openssl_dir()?)); } let configure = command .current_dir(&current_dir) ...
code_fim
hard
{ "lang": "rust", "repo": "kenoss/frum", "path": "/src/commands/install.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Read Files for name in names { // File Content let read = fs::read_to_string(name.clone()).unwrap(); // Parse and Sort Numbers let mut numbers: Vec<u64> = read.lines().map(|s| s.parse::<u64>().unwrap()).collect(); numbers.sort(); // Stringify Numbers let data: Vec<String> = numbers.it...
code_fim
medium
{ "lang": "rust", "repo": "ja1den/research-project", "path": "/scenarios/1/rs/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Stringify Numbers let data: Vec<String> = numbers.iter().map(|n| format!("{:0>8}", n)).collect(); // Create File fs::write(o_path.join(name.file_name().unwrap()), data.join("\n")).unwrap(); // Sum Numbers let sum: u64 = numbers.iter().sum(); println!("{}", sum); } }<|fim_prefix|>// rep...
code_fim
hard
{ "lang": "rust", "repo": "ja1den/research-project", "path": "/scenarios/1/rs/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> group.bench_function("fyrstikker 2000", |b| { b.iter(|| fyrstikk_tal_kombinasjonar(2000)) }); group.finish(); } criterion_group!(benches, criterion_benchmark); criterion_main!(benches);<|fim_prefix|>// repo: torhovland/fyrstikker path: /benches/my_benchmark.rs use criterion::{criter...
code_fim
hard
{ "lang": "rust", "repo": "torhovland/fyrstikker", "path": "/benches/my_benchmark.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zBaitu/rfmt path: /tests/ft/items/in_mod.rs mod a { extern crate aa as _; extern crate cc as dd; extern crate bb; <|fim_suffix|> mod d; mod a; pub mod c; mod b; }<|fim_middle|> use *; use ::*; use ::f; use a::b::{c}; use a::b::c as d; use...
code_fim
hard
{ "lang": "rust", "repo": "zBaitu/rfmt", "path": "/tests/ft/items/in_mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> use crate::aa as x; mod d; mod a; pub mod c; mod b; }<|fim_prefix|>// repo: zBaitu/rfmt path: /tests/ft/items/in_mod.rs mod a { extern crate aa as _; extern crate cc as dd; extern crate bb; <|fim_middle|> use *; use ::*; use ::f; use a::b::{c}; ...
code_fim
hard
{ "lang": "rust", "repo": "zBaitu/rfmt", "path": "/tests/ft/items/in_mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CloudSetDrive/game path: /network/src/lib.rs extern crate serde; #[macro_use] extern crate serde_derive; extern crate bincode; mod packet; // Reexports pub use packet::ServerPacket as ServerPacket; pub use packet::ClientPacket as ClientPacket; use std::io; use std::net::{UdpSocket, SocketAddr...
code_fim
hard
{ "lang": "rust", "repo": "CloudSetDrive/game", "path": "/network/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Ok(ClientConn { sock, }) } pub fn send(&self, pack: ServerPacket) -> bool { match pack.serialize() { Some(data) => self.sock.send(&data).is_ok(), None => false, } } }<|fim_prefix|>// repo: CloudSetDrive/game path: /network/s...
code_fim
hard
{ "lang": "rust", "repo": "CloudSetDrive/game", "path": "/network/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let manager = ConnectionManager::<PgConnection>::new(database_url); Pool::builder() .max_size(*pool_connection_number() as u32) .build(manager) .unwrap() }) }<|fim_prefix|>// repo: Godofh3ell/el_monitorro-1 path: /src/db.rs use chrono::prelude::*; ...
code_fim
hard
{ "lang": "rust", "repo": "Godofh3ell/el_monitorro-1", "path": "/src/db.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Remove an item, while on a different thread from the shard's local thread. pub(super) fn remove_remote(&self, addr: Address) { if let Some(page) = self.shared.get(addr.page()) { page.remove_remote(addr); } } fn local(&self, i: usize) -> &page::Local { ...
code_fim
hard
{ "lang": "rust", "repo": "oshunter/fuchsia", "path": "/third_party/rust_crates/vendor/tokio/src/util/slab/shard.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }