text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>pub fn codegen_compare_unsigned( module: &AatbeModule, op: &String, lhs: LLVMValueRef, rhs: LLVMValueRef, ) -> ValueTypePair { ( match op.as_str() { "<" => module.llvm_builder_ref().build_icmp_ult(lhs, rhs), ">" => module.llvm_builder_ref().build_icmp_ug...
code_fim
hard
{ "lang": "rust", "repo": "chronium/aatbe-lang", "path": "/comp-be/src/codegen/expr/compare.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn apply_transpose(&self, f: SpatialVector) -> SpatialVector { let etf = Vector3::new( self.e[(0, 0)] * f[3] + self.e[(1, 0)] * f[4] + self.e[(2, 0)] * f[5], self.e[(0, 1)] * f[3] + self.e[(1, 1)] * f[4] + self.e[(2, 1)] * f[5], self.e[(0, 2)] * f[3] + s...
code_fim
hard
{ "lang": "rust", "repo": "techgeek1/rigidbody_dynamics", "path": "/src/math/spatial_transform.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: techgeek1/rigidbody_dynamics path: /src/math/spatial_transform.rs use std::ops::{Mul, MulAssign}; use math::*; pub struct SpatialTransform { e: Matrix3x3, r: Vector3 } impl SpatialTransform { pub fn new(e: Matrix3x3, r: Vector3) -> SpatialTransform { SpatialTransform { ...
code_fim
medium
{ "lang": "rust", "repo": "techgeek1/rigidbody_dynamics", "path": "/src/math/spatial_transform.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl RenderBuffer { pub fn new(info: &AppInfo, native_dims: (u32, u32), sprite_atlas: Atlas) -> RenderBuffer { RenderBuffer { sprite_atlas, mode: Mode::Sprite, vbo_data: Vec::new(), dims: RenderDims::new(info.min_dims, info.max_dims, info.tile_wi...
code_fim
hard
{ "lang": "rust", "repo": "SergiusIW/gate", "path": "/gate/src/renderer/render_buffer.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SergiusIW/gate path: /gate/src/renderer/render_buffer.rs // Copyright 2017-2020 Matthew D. Michelotti // // 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:...
code_fim
hard
{ "lang": "rust", "repo": "SergiusIW/gate", "path": "/gate/src/renderer/render_buffer.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: k-hamada/exercism path: /rust/reverse-string/src/lib.rs extern crate unicode_segmentation; <|fim_suffix|>pub fn reverse(word: &str) -> String { UnicodeSegmentation::graphemes(word, true).rev().collect::<String>() }<|fim_middle|>use unicode_segmentation::UnicodeSegmentation;
code_fim
easy
{ "lang": "rust", "repo": "k-hamada/exercism", "path": "/rust/reverse-string/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn reverse(word: &str) -> String { UnicodeSegmentation::graphemes(word, true).rev().collect::<String>() }<|fim_prefix|>// repo: k-hamada/exercism path: /rust/reverse-string/src/lib.rs extern crate unicode_segmentation; <|fim_middle|>use unicode_segmentation::UnicodeSegmentation;
code_fim
easy
{ "lang": "rust", "repo": "k-hamada/exercism", "path": "/rust/reverse-string/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let d = s.value_counts(); let exp: Series<usize, i64> = Series::new(vec![4, 3, 2, 1], vec![1, 3, 2, 4]); assert_eq!(d, exp); } #[test] fn test_series_value_counts_str() { let values: Vec<&str> = vec!["a", "bb", "bb", "c", "a", "a"]; let s = Series::<&str, usize>::from_vec(values); ...
code_fim
hard
{ "lang": "rust", "repo": "sinhrks/brassfibre", "path": "/tests/series_aggregation.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sinhrks/brassfibre path: /tests/series_aggregation.rs extern crate brassfibre; use brassfibre::prelude::*; #[test] fn test_series_agg_int() { let values: Vec<i64> = vec![1, 2, 3, 4, 5]; let index: Vec<i64> = vec![10, 20, 30, 40, 50]; let s = Series::<i64, i64>::new(values, index); ...
code_fim
hard
{ "lang": "rust", "repo": "sinhrks/brassfibre", "path": "/tests/series_aggregation.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> match self { Self::ConnectionExists => write!( f, "There is an existing connection. Please close the current connection before attempting to connect again."), Self::ConnectionFailed => write!( f, "Failed to establish the conne...
code_fim
medium
{ "lang": "rust", "repo": "rcore-os/virtio-drivers", "path": "/src/device/socket/error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rcore-os/virtio-drivers path: /src/device/socket/error.rs //! This module contain the error from the VirtIO socket driver. use core::{fmt, result}; /// The error type of VirtIO socket driver. #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum SocketError { /// There is an existing conne...
code_fim
medium
{ "lang": "rust", "repo": "rcore-os/virtio-drivers", "path": "/src/device/socket/error.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> blink.set_stage(Stage::Wait, t); Some(blink) } } fn set_stage(&mut self, stage: Stage, frame_time: f64) { let duration = match stage { Stage::Wait => self.wait, Stage::GoingOff | Stage::GoingOn => self.transition, Stage:...
code_fim
hard
{ "lang": "rust", "repo": "vhakulinen/gnvim", "path": "/ui/src/components/cursor/blink.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vhakulinen/gnvim path: /ui/src/components/cursor/blink.rs use crate::warn; use super::ease_out_cubic; #[derive(Default, Debug, Clone, glib::Boxed)] #[boxed_type(name = "CursorBlink", nullable)] pub struct Blink { wait: f64, on: f64, off: f64, transition: f64, stage: Stage,...
code_fim
hard
{ "lang": "rust", "repo": "vhakulinen/gnvim", "path": "/ui/src/components/cursor/blink.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn reset_to_wait(&mut self, t: f64) { self.set_stage(Stage::Wait, t); self.alpha = 1.0; } pub fn tick(&mut self, t: f64) { if t < self.stage_start { warn!("Clock going backwards"); return; } if self.stage_end < t { ...
code_fim
hard
{ "lang": "rust", "repo": "vhakulinen/gnvim", "path": "/ui/src/components/cursor/blink.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jacobrosenthal/rust-smc path: /src/sensor.rs use crate::error::SmcResult; use crate::general::{Kind, Subsystem}; use crate::key::Key; use crate::smc::Smc; use crate::smc_kit::SMCKeyData_keyInfo_t; use std::fmt; pub struct Sensor<'a> { smc: &'a Smc, key: Key, key_info: SMCKeyData_ke...
code_fim
hard
{ "lang": "rust", "repo": "jacobrosenthal/rust-smc", "path": "/src/sensor.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn read(&self) -> SmcResult<f32> { self.smc.read_key(&self.key, self.key_info) } pub fn subsystem(&self) -> Subsystem { self.key.subsystem() } pub fn kind(&self) -> Kind { self.key.kind() } }<|fim_prefix|>// repo: jacobrosenthal/rust-smc path: /src/se...
code_fim
hard
{ "lang": "rust", "repo": "jacobrosenthal/rust-smc", "path": "/src/sensor.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // get a packet and print its bytes println!("{:?}", cap.next()); }<|fim_prefix|>// repo: SpiralP/rust-pcap path: /examples/easylisten.rs extern crate pcap; fn main() { <|fim_middle|> // get the default Device let mut cap = pcap::Device::lookup().unwrap().open().unwrap();
code_fim
medium
{ "lang": "rust", "repo": "SpiralP/rust-pcap", "path": "/examples/easylisten.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SpiralP/rust-pcap path: /examples/easylisten.rs extern crate pcap; fn main() { <|fim_suffix|> // get a packet and print its bytes println!("{:?}", cap.next()); }<|fim_middle|> // get the default Device let mut cap = pcap::Device::lookup().unwrap().open().unwrap();
code_fim
medium
{ "lang": "rust", "repo": "SpiralP/rust-pcap", "path": "/examples/easylisten.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> #[argh(switch)] /// display execution time time: bool, } enum SimulationError { HandParseError(CardParseError), TableParseError(CardParseError), InvalidHand(CardSet), InvalidTable(CardSet), WrongNumberOfPlayers(u32), InvalidHandTableComposition(CardSet), } fn execute(...
code_fim
hard
{ "lang": "rust", "repo": "bednabedna/PokerProbabilities", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bednabedna/PokerProbabilities path: /src/main.rs mod poker; use argh::FromArgs; use poker::cardset::{CardParseError, CardSet}; use rayon::prelude::*; use std::{str::FromStr, time::Instant}; /// Max cards allowed in player hand const MAX_HAND: u32 = 2; /// Max cards allowed in table const MAX_TA...
code_fim
hard
{ "lang": "rust", "repo": "bednabedna/PokerProbabilities", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let maybe_execution_time = maybe_timing.map(|time| time.elapsed()); if hand.is_empty() { println!("No hand, equal winning probability among players."); } else { println!( "({:?}) ({:?}) = {}", hand, table, ...
code_fim
hard
{ "lang": "rust", "repo": "bednabedna/PokerProbabilities", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: niofis/light path: /light-wasm/src/lib.rs use light::{Renderer, Camera, Point}; static mut WIDTH: i32 = 0; static mut HEIGHT: i32 = 0; static mut LEN: usize = 0; #[no_mangle] pub unsafe fn render(ptr: *mut u8) { let mut bytes: Vec<u8> = Vec::from_raw_parts(ptr, LEN * 3, LEN * 3); <|fim_su...
code_fim
hard
{ "lang": "rust", "repo": "niofis/light", "path": "/light-wasm/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[no_mangle] pub unsafe fn init(width: i32, height: i32) -> *mut u8 { WIDTH = width; HEIGHT = height; LEN = (width * height) as usize; let mut buffer = Vec::with_capacity(3 * LEN); let ptr = buffer.as_mut_ptr(); std::mem::forget(buffer); let mut renderer = Renderer::build(); ...
code_fim
hard
{ "lang": "rust", "repo": "niofis/light", "path": "/light-wasm/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> app.add_startup_system(setup.system()); app.add_system(update_fps_text.system()); } }<|fim_prefix|>// repo: teevik/bevy-pixel-test path: /src/show_fps/plugin.rs use bevy::prelude::*; use crate::show_fps::systems::update_fps_text::update_fps_text; use crate::show_fps::systems::setup::...
code_fim
medium
{ "lang": "rust", "repo": "teevik/bevy-pixel-test", "path": "/src/show_fps/plugin.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: teevik/bevy-pixel-test path: /src/show_fps/plugin.rs use bevy::prelude::*; use crate::show_fps::systems::update_fps_text::update_fps_text; use crate::show_fps::systems::setup::setup; <|fim_suffix|> app.add_startup_system(setup.system()); app.add_system(update_fps_text.system());...
code_fim
medium
{ "lang": "rust", "repo": "teevik/bevy-pixel-test", "path": "/src/show_fps/plugin.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Plugin for ShowFpsPlugin { fn build(&self, app: &mut AppBuilder) { app.add_startup_system(setup.system()); app.add_system(update_fps_text.system()); } }<|fim_prefix|>// repo: teevik/bevy-pixel-test path: /src/show_fps/plugin.rs use bevy::prelude::*; use crate::show_fps::syst...
code_fim
easy
{ "lang": "rust", "repo": "teevik/bevy-pixel-test", "path": "/src/show_fps/plugin.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Lol3rrr/waswolf path: /src/roles.rs use std::fmt::Display; use serde::{Deserialize, Serialize}; use serenity::model::channel::Message; mod cfg_reactions; pub use cfg_reactions::reactions; mod roles_msg; pub use roles_msg::get_roles_msg; mod distribute; pub use distribute::{distribute_roles, ...
code_fim
hard
{ "lang": "rust", "repo": "Lol3rrr/waswolf", "path": "/src/roles.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let instance = WereWolfRoleInstance::new( "Test".to_string(), Some(Box::new(WereWolfRoleInstance::new( "Other".to_string(), None, Vec::new(), ))), Vec::new(), ); let expected = vec!["Tes...
code_fim
hard
{ "lang": "rust", "repo": "Lol3rrr/waswolf", "path": "/src/roles.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Self{ context, phantom: PhantomData } } }<|fim_prefix|>// repo: yangfengzzz/box2d-rs path: /src/serialize_context.rs use std::marker::PhantomData; pub(crate) struct WithContext<'ctx, T: ?Sized, A> { <|fim_middle|> pub(crate) context: &'ctx T, pub(crate...
code_fim
medium
{ "lang": "rust", "repo": "yangfengzzz/box2d-rs", "path": "/src/serialize_context.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yangfengzzz/box2d-rs path: /src/serialize_context.rs use std::marker::PhantomData; pub(crate) struct WithContext<'ctx, T: ?Sized, A> { pub(crate) context: &'ctx T, pub(crate) phantom: PhantomData<A>, } impl<'ctx, T<|fim_suffix|> Self{ context, phantom: P...
code_fim
medium
{ "lang": "rust", "repo": "yangfengzzz/box2d-rs", "path": "/src/serialize_context.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ajnam12/tock path: /chips/ibex/src/chip.rs //! High-level setup and interrupt mapping for the chip. use core::hint::unreachable_unchecked; use kernel; use kernel::debug; use rv32i::csr::{mcause, mie::mie, mtvec::mtvec, CSR}; use rv32i::syscall::SysCall; use crate::gpio; use crate::interrupts;...
code_fim
hard
{ "lang": "rust", "repo": "ajnam12/tock", "path": "/chips/ibex/src/chip.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> match exception { mcause::Exception::InstructionMisaligned => { panic!("misaligned instruction {:x}\n", mtval); } mcause::Exception::InstructionFault => { panic!("instruction fault {:x}\n", mtval); } mcause::Exception::IllegalInstruction ...
code_fim
hard
{ "lang": "rust", "repo": "ajnam12/tock", "path": "/chips/ibex/src/chip.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>fn parse_peer_id(s: &str) -> Result<PeerId, FieldError> { PeerId::from_str(s).map_err(|err| FieldError::InvalidPeerId { peer_id: s.to_string(), err: err.to_string(), }) } pub fn parse_outcome( outcome: Result<AVMOutcome, AVMError<DataStoreError>>, ) -> Result<(Vec<u8>, Vec<Pee...
code_fim
hard
{ "lang": "rust", "repo": "octaplexsys/fluence", "path": "/aquamarine/src/invoke.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: octaplexsys/fluence path: /aquamarine/src/invoke.rs /* * Copyright 2020 Fluence Labs Limited * * 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....
code_fim
hard
{ "lang": "rust", "repo": "octaplexsys/fluence", "path": "/aquamarine/src/invoke.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DmarshalTU/aws-sdk-rust path: /sdk/s3outposts/src/json_ser.rs // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. pub fn serialize_structure_create_endpoint_input( o<|fim_suffix|>"SecurityGroupId").string(var_2); } if let Some(var_3) = &input.subnet_id { ...
code_fim
hard
{ "lang": "rust", "repo": "DmarshalTU/aws-sdk-rust", "path": "/sdk/s3outposts/src/json_ser.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>"SecurityGroupId").string(var_2); } if let Some(var_3) = &input.subnet_id { object.key("SubnetId").string(var_3); } }<|fim_prefix|>// repo: DmarshalTU/aws-sdk-rust path: /sdk/s3outposts/src/json_ser.rs // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. pu...
code_fim
hard
{ "lang": "rust", "repo": "DmarshalTU/aws-sdk-rust", "path": "/sdk/s3outposts/src/json_ser.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: adeschamps/spade path: /src/lib.rs // Copyright 2017 The Spade Developers. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This fil...
code_fim
medium
{ "lang": "rust", "repo": "adeschamps/spade", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>extern crate num; extern crate cgmath; extern crate nalgebra; extern crate clamp; extern crate smallvec; #[cfg(test)] extern crate approx; #[cfg(test)] extern crate rand; #[cfg(test)] mod testutils; mod traits; mod point_traits; mod misc; mod boundingvolume; mod bigvec; mod exactpred; pub mod delaunay...
code_fim
hard
{ "lang": "rust", "repo": "adeschamps/spade", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] extern crate approx; #[cfg(test)] extern crate rand; #[cfg(test)] mod testutils; mod traits; mod point_traits; mod misc; mod boundingvolume; mod bigvec; mod exactpred; pub mod delaunay; pub mod kernels; pub mod primitives; pub mod rtree; pub use traits::*; pub use boundingvolume::*; pub u...
code_fim
medium
{ "lang": "rust", "repo": "adeschamps/spade", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if e.type_name != Self::TYPE_NAME_1 { return Err(BehaviourCreationError.into()) } Ok(NumericOperation::new(e, Self::OPERATION)) } fn new_entity_instance() -> Arc<ReactiveEntityInstance> { NumericOperationReactiveEntityInstanceFactory::new(Self::TYPE_NAM...
code_fim
hard
{ "lang": "rust", "repo": "aschaeffer/rust-ecs-poc", "path": "/src/behaviour/entity/numeric_operations/behaviour.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aschaeffer/rust-ecs-poc path: /src/behaviour/entity/numeric_operations/behaviour.rs use std::sync::Arc; use crate::behaviour::{BehaviourCreationError, EntityBehaviour}; use crate::model::{ReactiveEntityInstance, ReactiveEntityInstanceFactory}; use crate::reactive::entity::numeric_operation::{Nu...
code_fim
hard
{ "lang": "rust", "repo": "aschaeffer/rust-ecs-poc", "path": "/src/behaviour/entity/numeric_operations/behaviour.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ///Trigger a send (if possible) for the node at the given handle. /// ///Returns true if there was a node at the handle that could be and was triggered. pub fn trigger(&self, handle: NodeHandle) -> bool { if let Some(msg) = self.osc.trigger(handle) { self.ws.send(msg); ...
code_fim
hard
{ "lang": "rust", "repo": "x37v/oscquery-rs", "path": "/src/server.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ///Get the Http service's bound address. pub fn http_local_addr(&self) -> &SocketAddr { self.http.local_addr() } ///Get the OSC service's bound address. pub fn osc_local_addr(&self) -> &SocketAddr { self.osc.local_addr() } ///Get the websocket service's bound ...
code_fim
hard
{ "lang": "rust", "repo": "x37v/oscquery-rs", "path": "/src/server.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: x37v/oscquery-rs path: /src/server.rs use crate::node::Node; use crate::root::{NodeHandle, Root}; use crate::service::{http, osc, websocket}; use std::net::{SocketAddr, ToSocketAddrs}; use std::sync::Arc; /// A batteries included ease of use wrapper for the various services that make osc query....
code_fim
hard
{ "lang": "rust", "repo": "x37v/oscquery-rs", "path": "/src/server.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_p1() { let p = part1(); assert_eq!(p, 6423); } #[test] fn test_1() { let moon_pos = [ Moon::new([0, 0, 0]), Moon::new([0, 0, 0]), Moon::new([0, 0, 0]), Moon::new([0, 0, 0]), ]; let r...
code_fim
hard
{ "lang": "rust", "repo": "jlricon/advent-code-2019-rust", "path": "/src/bin/day_12.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jlricon/advent-code-2019-rust path: /src/bin/day_12.rs //<x=14, y=4, z=5> //<x=12, y=10, z=8> //<x=1, y=7, z=-10> //<x=16, y=-5, z=3> use std::collections::HashMap; use itertools::{zip_eq, Itertools}; use num::Integer; type Velocity = [i32; 3]; type Position = [i32; 3]; type Axis = [i32; 6 * ...
code_fim
hard
{ "lang": "rust", "repo": "jlricon/advent-code-2019-rust", "path": "/src/bin/day_12.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: oxidecomputer/third-party-api-clients path: /docusign/src/template_documents.rs use crate::Client; use crate::ClientResult; pub struct TemplateDocuments { pub client: Client, } impl TemplateDocuments { #[doc(hidden)] pub fn new(client: Client) -> Self { TemplateDocuments { ...
code_fim
hard
{ "lang": "rust", "repo": "oxidecomputer/third-party-api-clients", "path": "/docusign/src/template_documents.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ); self.client .get( &url, crate::Message { body: None, content_type: None, }, ) .await } /** * Updates a template document. * * This function perform...
code_fim
hard
{ "lang": "rust", "repo": "oxidecomputer/third-party-api-clients", "path": "/docusign/src/template_documents.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Default for Shoots { fn default() -> Self { Shoots { rate_of_fire: 1.0, muzzle_velocity: 100.0, displacement: Vec2::new(0.0, 0.0), last_time_shot: 0.0, } } }<|fim_prefix|>// repo: dyst5422/like-galaga-but-different path: /src/co...
code_fim
medium
{ "lang": "rust", "repo": "dyst5422/like-galaga-but-different", "path": "/src/components/shoots.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dyst5422/like-galaga-but-different path: /src/components/shoots.rs use bevy::prelude::*; use bevy_rapier2d::prelude::*; <|fim_suffix|>impl Default for Shoots { fn default() -> Self { Shoots { rate_of_fire: 1.0, muzzle_velocity: 100.0, displacement...
code_fim
medium
{ "lang": "rust", "repo": "dyst5422/like-galaga-but-different", "path": "/src/components/shoots.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DoubleHyphen/morton-encoding path: /src/lib.rs _mask = |x: &mut Key, y| { (*x) &= get_mask(y, siz_rat); let shift_amt = (siz_rat.get() - 1) << y; *x |= *x >> shift_amt; }; let step_amount = ceil_of_log2_of_coor_bits::<Coor>(); (0..step_amount).for_each(|q| s...
code_fim
hard
{ "lang": "rust", "repo": "DoubleHyphen/morton-encoding", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> test_all_possible_values::<u16, u64>(None); } #[test] fn test_u16_u80() { test_all_possible_values::<u16, u128>(Some(5)); } #[test] fn test_u16_u96() { test_all_possible_values::<u16, u128>(Some(6)); } #[test] fn test_u16_u112() { test_al...
code_fim
hard
{ "lang": "rust", "repo": "DoubleHyphen/morton-encoding", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> macro_rules! test_functions { ($encod: ident, $decod: ident, $t1: ty, $t2: ty, $siz_rat: expr) => { let max_bits_for_this = (MAX_BITS - 3) as usize; let tmp_bit_limit = $siz_rat * sizeof!($t1) * 8; if tmp_bit_limit > max_bits_for_this { for _...
code_fim
hard
{ "lang": "rust", "repo": "DoubleHyphen/morton-encoding", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fsi-tue/rocket-csp-endpoint path: /src/main.rs #![feature(plugin)] #![plugin(rocket_codegen)] extern crate time; extern crate rocket; extern crate rocket_contrib; extern crate serde_json; #[macro_use] extern crate serde_derive; use rocket::response::status; use rocket::Outcome; use rocket::htt...
code_fim
hard
{ "lang": "rust", "repo": "fsi-tue/rocket-csp-endpoint", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let csp_report = &json_body.csp_report; let json_report = serde_json::to_string_pretty(&csp_report) .expect("Error: Couldn't serialize the CSP report."); let log_path = Path::new("csp-log.txt"); let mut log_file = OpenOptions::new().create(true).append(true).open(&log_path) ...
code_fim
hard
{ "lang": "rust", "repo": "fsi-tue/rocket-csp-endpoint", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ed-iv/peggy path: /src/tweeter.rs use serde::Deserialize; use egg_mode::tweet::DraftTweet; use egg_mode::Token; use crate::*; pub struct Tweeter { token: Token } impl Tweeter { pub fn new() -> Self { let con_key = dotenv::var("CONSUMER_KEY").unwrap(); let con_secret = d...
code_fim
hard
{ "lang": "rust", "repo": "ed-iv/peggy", "path": "/src/tweeter.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let handle = upload_media( &notification.image, &media_types::image_gif(), &self.token ).await?; tweet.add_media(handle.id); tweet.send(&self.token).await?; Ok(()) } }<|fim_prefix|>// repo: ed-iv/peg...
code_fim
medium
{ "lang": "rust", "repo": "ed-iv/peggy", "path": "/src/tweeter.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let token = egg_mode::Token::Access {consumer: con_token, access: access_token}; Self { token } } pub async fn tweet(&self, notification: Notification) -> Result<(), Box<dyn std::error::Error>> { let mut tweet = DraftTweet::new(notification.message); ...
code_fim
hard
{ "lang": "rust", "repo": "ed-iv/peggy", "path": "/src/tweeter.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let data: Vec<u8> = vec![5; 2000]; let encoding = encode(&data, 4095, 2); let decoding = decode(&encoding.codes, 2); assert_eq!(data, decoding); } #[test] fn decode_works_for_large_data() { let mut i = 0; let mut data = Vec::new(); for _ ...
code_fim
hard
{ "lang": "rust", "repo": "XDA-7/akhashic-record", "path": "/lzw/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: XDA-7/akhashic-record path: /lzw/src/lib.rs 0000, 0b01000000, 0b00100000, 0b00010000, 0b00001000, 0b00000100, 0b00000010, 0b00000001, ]; pub struct EncodingResult { pub codes: Vec<Code>, pub bytes_processed: usize, } pub struct Code { pub value: u32, ...
code_fim
hard
{ "lang": "rust", "repo": "XDA-7/akhashic-record", "path": "/lzw/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: XDA-7/akhashic-record path: /lzw/src/lib.rs [ 0b10000000, 0b01000000, 0b00100000, 0b00010000, 0b00001000, 0b00000100, 0b00000010, 0b00000001, ]; pub struct EncodingResult { pub codes: Vec<Code>, pub bytes_processed: usize, } pub struct Code { pub val...
code_fim
hard
{ "lang": "rust", "repo": "XDA-7/akhashic-record", "path": "/lzw/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>type Position = u16; /// Represents a tictactoe board #[derive(Clone, Copy, PartialEq, Eq, Hash)] pub struct Board { moves_x: Position, // a binary array with 1 iff a position is caputured by X moves_o: Position, // a binary array with 1 iff a position is caputured by X turn: AgentId, // ...
code_fim
medium
{ "lang": "rust", "repo": "prangel-git/tictactoe", "path": "/src/board/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>use self::utils::*; type Position = u16; /// Represents a tictactoe board #[derive(Clone, Copy, PartialEq, Eq, Hash)] pub struct Board { moves_x: Position, // a binary array with 1 iff a position is caputured by X moves_o: Position, // a binary array with 1 iff a position is caputured by X t...
code_fim
medium
{ "lang": "rust", "repo": "prangel-git/tictactoe", "path": "/src/board/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: prangel-git/tictactoe path: /src/board/mod.rs mod display; mod environment; mod actions; mod utils; use self::actions::Actions; use super::Action; use super::AgentId; use self::utils::*; <|fim_suffix|>/// Represents a tictactoe board #[derive(Clone, Copy, PartialEq, Eq, Hash)] pub struct Boa...
code_fim
easy
{ "lang": "rust", "repo": "prangel-git/tictactoe", "path": "/src/board/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn get_nonce(&self, address: EthereumAddress) -> Box<Future<Item = u64, Error = Error> + Send> { let address_clone = address.clone(); Box::new(self.client.get_nonce(address).map_err(ectx!(convert => address_clone))) } fn send_raw_tx(&self, tx: RawEthereumTransaction) -> Box<Fu...
code_fim
hard
{ "lang": "rust", "repo": "StoriqaTeam/blockchain-gateway", "path": "/src/services/ethereum.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: StoriqaTeam/blockchain-gateway path: /src/services/ethereum.rs use std::sync::Arc; use super::error::*; use client::EthereumClient; use models::*; use prelude::*; pub trait EthereumService: Send + Sync + 'static { fn get_nonce(&self, address: EthereumAddress) -> Box<Future<Item = u64, Erro...
code_fim
hard
{ "lang": "rust", "repo": "StoriqaTeam/blockchain-gateway", "path": "/src/services/ethereum.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl EthereumService for EthereumServiceImpl { fn get_eth_balance(&self, address: EthereumAddress) -> Box<Future<Item = Amount, Error = Error> + Send> { let address_clone = address.clone(); Box::new(self.client.get_eth_balance(address).map_err(ectx!(convert => address_clone))) } ...
code_fim
medium
{ "lang": "rust", "repo": "StoriqaTeam/blockchain-gateway", "path": "/src/services/ethereum.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut indices = s.splitn(3, '/').take(3).map(|i| _idx(i)); // [0] is vertex index into "v"/verts // [1] is diffuse texture coordinate index into "vt"/texture // [2] is normals index into "vn"/normals FaceVertexIndices { vert: indices.next().unwrap_or(0...
code_fim
hard
{ "lang": "rust", "repo": "arkadijs/opengl-rust", "path": "/src/model.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: arkadijs/opengl-rust path: /src/model.rs use std::fs::File; use std::io::BufRead; use std::io::BufReader; use std::path::Path; use std::str::FromStr; extern crate vecmath; use self::vecmath::{Vector2, Vector3}; extern crate image as pimage; use self::pimage::error::ImageError; use self::pimage...
code_fim
hard
{ "lang": "rust", "repo": "arkadijs/opengl-rust", "path": "/src/model.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn should_impl_asref() { let anonymous = User { id: 42 }; let alice = UserWithName { inner: anonymous, _name: "Alice".to_owned(), }; assert_eq!(alice.as_ref().id, 42); }<|fim_prefix|>// repo: AtsukiTak/derive_asref path: /tests/impl_asref.rs use derive_asref::AsRe...
code_fim
hard
{ "lang": "rust", "repo": "AtsukiTak/derive_asref", "path": "/tests/impl_asref.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AtsukiTak/derive_asref path: /tests/impl_asref.rs use derive_asref::AsRef; pub struct User { pub id: usize, } // This should be // ``` // impl AsRef<User> for UserWithName { // fn as_ref(&self) -> &User { // &self.inner // } // } // ``` #[derive(AsRef)] pub struct UserWithName { ...
code_fim
medium
{ "lang": "rust", "repo": "AtsukiTak/derive_asref", "path": "/tests/impl_asref.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shish/packetstats path: /src/main.rs extern crate argparse; extern crate etherparse; extern crate pcap; use etherparse::*; use argparse::{ArgumentParser, Store, StoreFalse, StoreTrue}; use dns_lookup::lookup_addr; use pcap::{Capture, Device}; use std::collections::HashMap; use std::convert::Try...
code_fim
hard
{ "lang": "rust", "repo": "shish/packetstats", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn run_capture(device: &String, names: bool, server: bool) { let mut resolv: HashMap<IpAddr, String> = HashMap::new(); let mut hosts: HashMap<String, u64> = HashMap::new(); let mut now = Instant::now(); let freq = 10; let my_mac = get_mac(device); let mut cap = Capture::from_device...
code_fim
hard
{ "lang": "rust", "repo": "shish/packetstats", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: giggs-lynx/exercism-solution path: /rust/anagram/src/lib.rs use std::collections::HashSet; pub fn anagrams_for<'a>(word: &str, possible_anagrams: &[&'a str]) -> HashSet<&'a str> { let w_len = word.len(); let w_lower = word.to_lowercase(); let w_chars = transform(word); possible...
code_fim
medium
{ "lang": "rust", "repo": "giggs-lynx/exercism-solution", "path": "/rust/anagram/src/lib.rs", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> let mut chars: Vec<char> = word.to_lowercase().chars().collect(); chars.sort_unstable(); chars }<|fim_prefix|>// repo: giggs-lynx/exercism-solution path: /rust/anagram/src/lib.rs use std::collections::HashSet; pub fn anagrams_for<'a>(word: &str, possible_anagrams: &[&'a str]) -> HashSet<&'a...
code_fim
hard
{ "lang": "rust", "repo": "giggs-lynx/exercism-solution", "path": "/rust/anagram/src/lib.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: psaintlaurent/azure-sdk-for-rust path: /sdk/core/src/errors.rs use http::header::ToStrError; use http::StatusCode; #[cfg(feature = "enable_hyper")] use hyper::{self, body, Body}; use std::io::Error as IOError; use std::num; use std::num::ParseIntError; use std::str; use std::str::ParseBoolError;...
code_fim
hard
{ "lang": "rust", "repo": "psaintlaurent/azure-sdk-for-rust", "path": "/sdk/core/src/errors.rs", "mode": "psm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_suffix|>impl std::fmt::Display for UnexpectedHTTPResult { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, "Unexpected HTTP result (expected: {:?}, received: {:?})", self.expected, self.received ) } } impl std::error::Erro...
code_fim
hard
{ "lang": "rust", "repo": "psaintlaurent/azure-sdk-for-rust", "path": "/sdk/core/src/errors.rs", "mode": "spm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_prefix|>// repo: freestrings/playground path: /rust-de-ref-impl/src/de/mod.rs pub struct Error {} pub type Result<T> = std::result::Result<T, Error>; pub trait Deserialize: Sized { fn deserialize<D>(deserializer: D) -> Result<Self> where D: Deserializer; } pub trait Deserializer: Sized...
code_fim
medium
{ "lang": "rust", "repo": "freestrings/playground", "path": "/rust-de-ref-impl/src/de/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>} pub trait Visitor: Sized { type Value; fn visit_bool(self, v: bool) -> Result<Self::Value>; fn visit_i32(self, v: i32) -> Result<Self::Value>; }<|fim_prefix|>// repo: freestrings/playground path: /rust-de-ref-impl/src/de/mod.rs pub struct Error {} pub type Result<T> = std::result::Result<...
code_fim
hard
{ "lang": "rust", "repo": "freestrings/playground", "path": "/rust-de-ref-impl/src/de/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if inputString.chars().rev().collect::<String>() == inputString { return true; } false }<|fim_prefix|>// repo: trietnguyen267/code-signal-rust path: /src/solved/checkPalindrome.rs // fn main() { // assert_eq!(checkPalindrome(String::from("aabaa")), true); // assert_eq!(checkPa...
code_fim
medium
{ "lang": "rust", "repo": "trietnguyen267/code-signal-rust", "path": "/src/solved/checkPalindrome.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: trietnguyen267/code-signal-rust path: /src/solved/checkPalindrome.rs // fn main() { // assert_eq!(checkPalindrome(String::from("aabaa")), true); // assert_eq!(checkPalindrome(String::from("a")), true); // assert_eq!(checkPalindrome(String::from("abab")), false); // } <|fim_suffix|> ...
code_fim
medium
{ "lang": "rust", "repo": "trietnguyen267/code-signal-rust", "path": "/src/solved/checkPalindrome.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>sult<(), Error> { try_init(); Ok(()) } }<|fim_prefix|>// repo: bryandmc/runtime-tls path: /src/server.rs #[cfg(test)] mod tests { use super::*; use failure::Error; use pretty_env_logger::{try_init, try_init_tim<|fim_middle|>ed}; #[runtime::test] async fn start_...
code_fim
medium
{ "lang": "rust", "repo": "bryandmc/runtime-tls", "path": "/src/server.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ed}; #[runtime::test] async fn start_server() -> Result<(), Error> { try_init(); Ok(()) } }<|fim_prefix|>// repo: bryandmc/runtime-tls path: /src/server.rs #[cfg(test)] mod tests { use super::*; use failur<|fim_middle|>e::Error; use pretty_env_logger::{try_init...
code_fim
medium
{ "lang": "rust", "repo": "bryandmc/runtime-tls", "path": "/src/server.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bryandmc/runtime-tls path: /src/server.rs #[cfg(test)] mod tests { use super::*; use failur<|fim_suffix|>ed}; #[runtime::test] async fn start_server() -> Result<(), Error> { try_init(); Ok(()) } }<|fim_middle|>e::Error; use pretty_env_logger::{try_init...
code_fim
medium
{ "lang": "rust", "repo": "bryandmc/runtime-tls", "path": "/src/server.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.unary_stream(ExchangePact::new(func), "Exchange", |input, output| { while let Some((time, data)) = input.next() { output.session(time).give_content(data); } }) } }<|fim_prefix|>// repo: hatahet/timely-dataflow path: /src/dataflow/operators/...
code_fim
medium
{ "lang": "rust", "repo": "hatahet/timely-dataflow", "path": "/src/dataflow/operators/exchange.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hatahet/timely-dataflow path: /src/dataflow/operators/exchange.rs use ::Data; use dataflow::channels::pact::Exchange as ExchangePact; use dataflow::{Stream, Scope}; use dataflow::operators::unary::Unary; <|fim_suffix|>impl<G: Scope, D: Data> Exchange<D> for Stream<G, D> { fn exchange<F: Fn(...
code_fim
medium
{ "lang": "rust", "repo": "hatahet/timely-dataflow", "path": "/src/dataflow/operators/exchange.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pmdartus/rust-playground path: /experiments/simple-http/src/lib.rs use std::error::Error; use std::fs::File; use std::io::prelude::*; use std::io::{BufReader, BufWriter}; use std::net::{SocketAddr, TcpListener, TcpStream}; use std::path::Path; use std::time::Instant; mod header; mod request; mo...
code_fim
hard
{ "lang": "rust", "repo": "pmdartus/rust-playground", "path": "/experiments/simple-http/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn handle_request(&self, request: &Request) -> Response { match self.resolve_path(&request) { Some(path) => { let mut f = File::open(path).unwrap(); let mut contents = String::new(); f.read_to_string(&mut contents); ...
code_fim
hard
{ "lang": "rust", "repo": "pmdartus/rust-playground", "path": "/experiments/simple-http/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!( "{method} {uri} {status} - {response_time:?}", method = request.method, uri = request.uri, status = response.status.code, response_time = duration ); } fn handle_request(&self, request: &Request) -> Response { ...
code_fim
hard
{ "lang": "rust", "repo": "pmdartus/rust-playground", "path": "/experiments/simple-http/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test_empty_is_nil() { assert_eq("(do)", Nil); }<|fim_prefix|>// repo: APiercey/mylalang path: /tests/do_test.rs mod common; use common::assert_eq; use myla::core::types::Types::{Bool, Float, Integer, Nil, String as Str}; #[test] fn test_simple_expressions() { assert_eq("(do 1 2 3)", I...
code_fim
medium
{ "lang": "rust", "repo": "APiercey/mylalang", "path": "/tests/do_test.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: APiercey/mylalang path: /tests/do_test.rs mod common; use common::assert_eq; use myla::core::types::Types::{Bool, Float, Integer, Nil, String as Str}; <|fim_suffix|>#[test] fn test_empty_is_nil() { assert_eq("(do)", Nil); }<|fim_middle|>#[test] fn test_simple_expressions() { assert_eq("...
code_fim
hard
{ "lang": "rust", "repo": "APiercey/mylalang", "path": "/tests/do_test.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq( r#" (do ((fn [i] (+ i i)) 1))"#, Integer(2), ); } #[test] fn test_empty_is_nil() { assert_eq("(do)", Nil); }<|fim_prefix|>// repo: APiercey/mylalang path: /tests/do_test.rs mod common; use common::assert_eq; use myla::core::types::Types::{Bool, Float, Integ...
code_fim
medium
{ "lang": "rust", "repo": "APiercey/mylalang", "path": "/tests/do_test.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: media-cloud-ai/models path: /src/common/media_segment.rs use schemars::JsonSchema; use serde::{Deserialize, Se<|fim_suffix|>uct MediaSegment { pub start: u64, pub end: u64, }<|fim_middle|>rialize}; #[derive(Debug, Deserialize, JsonSchema, Serialize)] #[serde(rename_all = "snake_case")] pub ...
code_fim
medium
{ "lang": "rust", "repo": "media-cloud-ai/models", "path": "/src/common/media_segment.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>uct MediaSegment { pub start: u64, pub end: u64, }<|fim_prefix|>// repo: media-cloud-ai/models path: /src/common/media_segment.rs use schemars::JsonSchema; use serde::{Deserialize, Serialize}; #[derive(Debug, Deserialize, JsonSchema, Se<|fim_middle|>rialize)] #[serde(rename_all = "snake_case")] pub ...
code_fim
easy
{ "lang": "rust", "repo": "media-cloud-ai/models", "path": "/src/common/media_segment.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tomon9086/game-of-life-in-rust path: /src/lifegame/map/mod.rs mod generate_cells; mod get_2d_cells; mod map; mod new; <|fim_suffix|>new::*; pub use next_generation::*; pub use randomize::*;<|fim_middle|>mod next_generation; mod randomize; pub use generate_cells::*; pub use get_2d_cells::*; pub ...
code_fim
medium
{ "lang": "rust", "repo": "tomon9086/game-of-life-in-rust", "path": "/src/lifegame/map/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>new::*; pub use next_generation::*; pub use randomize::*;<|fim_prefix|>// repo: tomon9086/game-of-life-in-rust path: /src/lifegame/map/mod.rs mod generate_cells; mod get_2d_cells; mod map; mod new; <|fim_middle|>mod next_generation; mod randomize; pub use generate_cells::*; pub use get_2d_cells::*; pub ...
code_fim
medium
{ "lang": "rust", "repo": "tomon9086/game-of-life-in-rust", "path": "/src/lifegame/map/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if state.key_hit(Key::D) { self.dump_data(state); } if state.mouse_button_pressed(MouseButton::Left) { self.spawn_brick(state); } self.vertices.clear(); self.indices.clear(); self.world.step(1.0 / 60.0, 8, 3); self.wor...
code_fim
hard
{ "lang": "rust", "repo": "fhamidi/rust-piston-nature-of-code", "path": "/5.Physics.Libraries/fixed-boundaries/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fhamidi/rust-piston-nature-of-code path: /5.Physics.Libraries/fixed-boundaries/src/main.rs //! Nature of code - Following the book... in Rust, with Piston! //! http://natureofcode.com/ //! //! Physics libraries - Fixed boundaries. extern crate piston_app; extern crate wrapped2d; use piston_app...
code_fim
hard
{ "lang": "rust", "repo": "fhamidi/rust-piston-nature-of-code", "path": "/5.Physics.Libraries/fixed-boundaries/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.setup_world(state); let (pipeline, renderer) = PistonPipelineBuilder::new() .texture_atlas(TextureAtlas::from_path(window, "assets/brick.png").unwrap()) .vertex_shader(include_bytes!("world_150_core.glslv")) .fragment_shader(include_bytes!("world_15...
code_fim
hard
{ "lang": "rust", "repo": "fhamidi/rust-piston-nature-of-code", "path": "/5.Physics.Libraries/fixed-boundaries/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn move_mouse_relative(dx: i32, dy: i32) { run_async(async move { get_connection().move_mouse_relative(context::current(), dx, dy).await.unwrap() }) }<|fim_prefix|>// repo: RunOnceEx/memlib-rs path: /src/system/functions.rs use super::*; use super::util::run_async; use tarpc::context;...
code_fim
hard
{ "lang": "rust", "repo": "RunOnceEx/memlib-rs", "path": "/src/system/functions.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }