text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>// // Handle OSC packet. Do error handling and then pass to vMix. // fn handle_packet(packet: OscPacket, tx: &mpsc::Sender<VmixMessage>) { match packet { OscPacket::Message(msg) => { println!("RX: INFO: Received addr {} args {:?}", msg.addr, msg.args); match msg.addr.a...
code_fim
hard
{ "lang": "rust", "repo": "carstenkoester/osc-vmix", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if msg.args.len() == 1 { match &msg.args[0] { rosc::OscType::Int(val) => tx.send(VmixMessage::PreviewInput(val.to_string())).unwrap(), rosc::OscType::String(val) => tx.send(VmixMessage::PreviewInput(val.clone())).unwrap(), _ => println!("RX: ERR: Received OSC message \"/vmix/previe...
code_fim
hard
{ "lang": "rust", "repo": "carstenkoester/osc-vmix", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: carstenkoester/osc-vmix path: /src/main.rs extern crate rosc; extern crate reqwest; extern crate url; use rosc::{OscPacket, OscMessage}; use reqwest::blocking::ClientBuilder; use retry::retry; use std::env; use std::net::{SocketAddrV4, UdpSocket}; use std::str::FromStr; use std::sync::mpsc; us...
code_fim
hard
{ "lang": "rust", "repo": "carstenkoester/osc-vmix", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: thecog19/AoC2015-rust path: /day-6/p2/src/main.rs use std::time::{Instant}; use std::fs; use md5::{Md5, Digest}; use std::str; use std::thread; use std::thread::JoinHandle; fn thread_spawner(input_string: String, start: u64, end: u64, p1_done: bool) -> JoinHandle<(Option<u64>,Option<u64>)>{ ...
code_fim
hard
{ "lang": "rust", "repo": "thecog19/AoC2015-rust", "path": "/day-6/p2/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if answer2 == 0 { offset += i*chunk_size; i = 0; } else { break; } } let end = start.elapsed().as_micros(); println!("Part 1: {}",answer1); println!("Part 2: {}",answer2); println!("\n execution ti...
code_fim
hard
{ "lang": "rust", "repo": "thecog19/AoC2015-rust", "path": "/day-6/p2/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SimonBuckner/sdlgame path: /src/keyboard.rs use std::collections::HashMap; use sdl2::keyboard::Scancode; #[derive(Debug, Clone, Copy, PartialEq)] pub enum KeyStates { Up, Down, } #[derive(Debug, Clone)] pub struct KeyboardState { previous: HashMap<Scancode, bool>, current: Has...
code_fim
hard
{ "lang": "rust", "repo": "SimonBuckner/sdlgame", "path": "/src/keyboard.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for key in keys.scancodes() { self.current.insert(key.0, key.1); } } pub fn get_keystate(&self, key: Scancode) -> KeyState { let mut ks = KeyState { state: KeyStates::Up, shift: KeyStates::Up, alt: KeyStates::Up, c...
code_fim
hard
{ "lang": "rust", "repo": "SimonBuckner/sdlgame", "path": "/src/keyboard.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn is_down(&self, key: Scancode) -> bool { match self.current.get(&key) { Some(state) => *state, None => false, } } pub fn is_up(&self, key: Scancode) -> bool { match self.current.get(&key) { Some(state) => *state, No...
code_fim
hard
{ "lang": "rust", "repo": "SimonBuckner/sdlgame", "path": "/src/keyboard.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Byron/gitoxide path: /gix-worktree/src/stack/state/ignore.rs use std::path::Path; use bstr::{BStr, ByteSlice}; use gix_glob::pattern::Case; use crate::{ stack::state::{Ignore, IgnoreMatchGroup}, PathIdMapping, }; /// Decide where to read `.gitignore` files from. #[derive(Default, Debu...
code_fim
hard
{ "lang": "rust", "repo": "Byron/gitoxide", "path": "/gix-worktree/src/stack/state/ignore.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub(crate) fn matching_exclude_pattern( &self, relative_path: &BStr, is_dir: Option<bool>, case: Case, ) -> Option<gix_ignore::search::Match<'_>> { let groups = self.match_groups(); let mut dir_match = None; if let Some((source, mapping)) = s...
code_fim
hard
{ "lang": "rust", "repo": "Byron/gitoxide", "path": "/gix-worktree/src/stack/state/ignore.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JiayiXu/mutagen path: /runner/src/main.rs #[macro_use] extern crate failure; extern crate json; extern crate wait_timeout; mod runner; use std::process::{self, Command, Stdio}; use std::fs::{File, remove_file}; use std::io::Read; use std::path::{Path, PathBuf}; use std::str::from_utf8; use run...
code_fim
hard
{ "lang": "rust", "repo": "JiayiXu/mutagen", "path": "/runner/src/main.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if let Err(err) = run() { eprintln!("{}", err); process::exit(1); } } #[cfg(test)] mod tests { use super::Mutation; #[test] fn it_decodes_well_formed_mutations() { let mutation = "2 - add one to int constant @ src/lib.rs:27:21: 27:22"; let mutation = M...
code_fim
hard
{ "lang": "rust", "repo": "JiayiXu/mutagen", "path": "/runner/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut file = File::open(filename)?; let mut s = String::new(); file.read_to_string(&mut s)?; Ok(s.split("\n") .filter(|l| !l.is_empty()) .map(|l| l.to_string()) .collect()) } fn has_flag(flag: &str) -> bool { let mut args = std::env::args_os(); args.find...
code_fim
hard
{ "lang": "rust", "repo": "JiayiXu/mutagen", "path": "/runner/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> unsafe impl TraitVTable<dyn WithStableVTable> for __WithStableVTable_VTable{} unsafe impl StableVTableTrait for dyn WithStableVTable{ type VTable = __WithStableVTable_VTable; } static_assertions::assert_eq_size!(StableRef<dyn WithStableVTable>,Option<StableRef<dyn WithStableVTabl...
code_fim
hard
{ "lang": "rust", "repo": "chorman0773/UserStableVTables", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> } } #[allow(non_upper_case_globals)] #[test] #[should_panic] pub fn test_ref_some_is_not_null(){ let obj = StableVTableImpl; unsafe extern"C" fn dealloc<T: WithStableVTable>(p: *mut ()){ alloc::alloc::dealloc(p as *mut u8,::core::alloc::Layout::new::...
code_fim
hard
{ "lang": "rust", "repo": "chorman0773/UserStableVTables", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chorman0773/UserStableVTables path: /src/lib.rs //! Library for interacting with pointers with *stable-vtable layout* //! #![no_std] #![deny(warnings)] extern crate static_assertions; #[cfg(any(feature="alloc",test))] extern crate alloc; /// Traits used by this library to provide features ...
code_fim
hard
{ "lang": "rust", "repo": "chorman0773/UserStableVTables", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tillens/rust-bdf path: /src/property.rs /// A `Font` property. #[derive(PartialEq, Eq, Clone, Debug)] pub enum Property { /// String(String), /// Integer(i64), } <|fim_suffix|> #[test] fn parse_property() { assert_eq!( Property::String("Hello World".i...
code_fim
hard
{ "lang": "rust", "repo": "tillens/rust-bdf", "path": "/src/property.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn parse_property() { assert_eq!( Property::String("Hello World".into()), Property::parse(r#""Hello World""#) ); assert_eq!( Property::String("Hello World".into()), Property::parse(r#"Hello World"#) ); ...
code_fim
hard
{ "lang": "rust", "repo": "tillens/rust-bdf", "path": "/src/property.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!( Property::String("Hello World".into()), Property::parse(r#""Hello World""#) ); assert_eq!( Property::String("Hello World".into()), Property::parse(r#"Hello World"#) ); assert_eq!(Property::Integer(41), Prop...
code_fim
hard
{ "lang": "rust", "repo": "tillens/rust-bdf", "path": "/src/property.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: szhongren/leetcode path: /654/main.rs use std::cell::RefCell; use std::cmp::Ordering; use std::rc::Rc; fn main() { println!("{:#?}", Solution::construct_maximum_binary_tree(vec![])); println!("{:#?}", Solution::construct_maximum_binary_tree(vec![0])); println!("{:#?}", Solution::con...
code_fim
hard
{ "lang": "rust", "repo": "szhongren/leetcode", "path": "/654/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>struct Solution; impl Solution { pub fn construct_maximum_binary_tree(nums: Vec<i32>) -> Option<Rc<RefCell<TreeNode>>> { Self::construct_maximum_binary_tree_recursive(&nums[..]) } pub fn construct_maximum_binary_tree_recursive(nums: &[i32]) -> Option<Rc<RefCell<TreeNode>>> { ...
code_fim
hard
{ "lang": "rust", "repo": "szhongren/leetcode", "path": "/654/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Solution { pub fn construct_maximum_binary_tree(nums: Vec<i32>) -> Option<Rc<RefCell<TreeNode>>> { Self::construct_maximum_binary_tree_recursive(&nums[..]) } pub fn construct_maximum_binary_tree_recursive(nums: &[i32]) -> Option<Rc<RefCell<TreeNode>>> { match nums.len() {...
code_fim
hard
{ "lang": "rust", "repo": "szhongren/leetcode", "path": "/654/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stm32-rs/stm32-rs-nightlies path: /stm32mp1/src/stm32mp157/eth_mac_mmc/eth_macphycsr.rs #[doc = "Register `ETH_MACPHYCSR` reader"] pub type R = crate::R<ETH_MACPHYCSR_SPEC>; #[doc = "Register `ETH_MACPHYCSR` writer"] pub type W = crate::W<ETH_MACPHYCSR_SPEC>; #[doc = "Field `TC` reader - TC"] pu...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32mp1/src/stm32mp157/eth_mac_mmc/eth_macphycsr.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[doc = "Bit 21 - FALSCARDET"] #[inline(always)] pub fn falscardet(&self) -> FALSCARDET_R { FALSCARDET_R::new(((self.bits >> 21) & 1) != 0) } } impl W { #[doc = "Bit 0 - TC"] #[inline(always)] #[must_use] pub fn tc(&mut self) -> TC_W<ETH_MACPHYCSR_SPEC, 0> { ...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32mp1/src/stm32mp157/eth_mac_mmc/eth_macphycsr.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nsidawy/adventofcode2020 path: /day7/src/main.rs use std::env; use std::fs::File; use std::io::{self, BufRead}; use std::collections::HashMap; #[derive(Debug)] struct Rule { name: String, contents: Vec<Content>, } #[derive(Debug)] struct Content { name: String, count: u32, } f...
code_fim
hard
{ "lang": "rust", "repo": "nsidawy/adventofcode2020", "path": "/day7/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn count_total_bags(contents_map: &HashMap<String, Vec<Content>>, bag: &str) -> u32 { let mut count = 0u32; for content in &contents_map[bag] { count += content.count + content.count * count_total_bags(contents_map, &content.name); } count } fn count_containing_bags(contents_map:...
code_fim
hard
{ "lang": "rust", "repo": "nsidawy/adventofcode2020", "path": "/day7/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lowRISC/opentitan path: /sw/host/opentitanlib/src/test_utils/gpio.rs // Copyright lowRISC contributors. // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 use anyhow::Result; use std::time::Duration; use crate::io::uart::Uart; use...
code_fim
hard
{ "lang": "rust", "repo": "lowRISC/opentitan", "path": "/sw/host/opentitanlib/src/test_utils/gpio.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn write_masked(uart: &dyn Uart, mask: u32, state: u32) -> Result<()> { let payload = GpioSet { action: GpioAction::WriteMasked, pin_mask: mask, state, }; payload.execute(uart) } pub fn set_enabled_masked(uart: &dyn Uart, mask: u3...
code_fim
hard
{ "lang": "rust", "repo": "lowRISC/opentitan", "path": "/sw/host/opentitanlib/src/test_utils/gpio.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: KnudiDudi/nees path: /pixel_renderer/src/command_buffers.rs use ash::prelude::VkResult; use ash::version::DeviceV1_0; use ash::{self, vk}; pub struct CommandBuffersWrapper { pub pool: vk::CommandPool, pub buffers: Vec<vk::CommandBuffer>, // TODO: separate transient_cmd_pool for shor...
code_fim
hard
{ "lang": "rust", "repo": "KnudiDudi/nees", "path": "/pixel_renderer/src/command_buffers.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> unsafe { logical_device.cmd_pipeline_barrier( *command_buffer, // start layout transition immediately vk::PipelineStageFlags::TOP_OF_PIPE, // block TRANSFER stages (our copy operation) ...
code_fim
hard
{ "lang": "rust", "repo": "KnudiDudi/nees", "path": "/pixel_renderer/src/command_buffers.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // transition pixel_image to TRANSFER_DST_OPTIMAL layout for copying let copy_barrier = [vk::ImageMemoryBarrier::builder() .old_layout(vk::ImageLayout::UNDEFINED) .new_layout(vk::ImageLayout::TRANSFER_DST_OPTIMAL) .src_queue_family_in...
code_fim
hard
{ "lang": "rust", "repo": "KnudiDudi/nees", "path": "/pixel_renderer/src/command_buffers.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: katyo/literium path: /rust/backend/src/filters/image_file.rs use base::EitherError; use bytes::{Buf, BufMut, Bytes, BytesMut}; use futures::{Async, Poll, Stream}; use http::{HttpChunk, StatusCode}; use imagesize; use mime::{Mime, BMP, GIF, IMAGE, JPEG, PNG}; use std::error::Error; use std::fmt::...
code_fim
hard
{ "lang": "rust", "repo": "katyo/literium", "path": "/rust/backend/src/filters/image_file.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> 2500000 // 2.5Mbytes } impl Default for ImageOptions { fn default() -> Self { ImageOptions { file_types: default_file_types(), min_width: default_min_width(), max_width: default_max_width(), min_height: default_min_height(), max_...
code_fim
hard
{ "lang": "rust", "repo": "katyo/literium", "path": "/rust/backend/src/filters/image_file.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if size < opts.min_size { return Err(custom(ImageError::SizeNotEnough)); } if size > opts.max_size { return Err(custom(ImageError::SizeExcessive)); } Ok(ImageStream { stream: Some(stream), ...
code_fim
hard
{ "lang": "rust", "repo": "katyo/literium", "path": "/rust/backend/src/filters/image_file.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mangolang/compiler path: /src/parselet/signature/typ.rs use crate::io::slice::SourceSlice; use crate::lexeme::identifier::SimpleIdentifierLexeme; //TODO @mark: keep these representations? or e.g. `()` or `void` or `null`? //TODO @mark: should these be special-cased somewhere? at least registere...
code_fim
hard
{ "lang": "rust", "repo": "mangolang/compiler", "path": "/src/parselet/signature/typ.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; #[test] fn make_void() { let void = TypeParselet::void(SourceSlice::mock()); assert_eq!(void.tmp_type.name.as_str(), "None"); } }<|fim_prefix|>// repo: mangolang/compiler path: /src/parselet/signature/typ.rs use crate::io::slice::Sou...
code_fim
medium
{ "lang": "rust", "repo": "mangolang/compiler", "path": "/src/parselet/signature/typ.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: da-x/casserole path: /src/lib.rs //! Casserole - a serde-based serializer/deserializer with a pluggable //! Content-Addressable Store as backing store so that internal data use //! references into the store. //! //! The result serialized objects are small and are gaining dedup and efficient //! ...
code_fim
medium
{ "lang": "rust", "repo": "da-x/casserole", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub use store::Store; pub use ser::Casserole; mod types;<|fim_prefix|>// repo: da-x/casserole path: /src/lib.rs //! Casserole - a serde-based serializer/deserializer with a pluggable //! Content-Addressable Store as backing store so that internal data use //! references into the store. //! //! The resul...
code_fim
medium
{ "lang": "rust", "repo": "da-x/casserole", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> InvalidUtf8, DisplayHelp, ...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-comments-removed", "path": "/third_party/rust/clap_builder/src/error/kind.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-comments-removed path: /third_party/rust/clap_builder/src/error/kind.rs #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] #[non_exhaustive] pub enum ErrorKind { InvalidValue, ...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-comments-removed", "path": "/third_party/rust/clap_builder/src/error/kind.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> MissingSubcommand, InvalidUtf8, ...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-comments-removed", "path": "/third_party/rust/clap_builder/src/error/kind.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nilq/JazzML path: /src/jazzml/vm.rs use super::frame::Frame; use super::opcodes::Opcode; use super::value::{ArrayRef, FuncKind, FuncRef, Function, Object, ObjectRef, Value}; use fnv::FnvHashMap; use std::cell::RefCell; pub struct VirtualMachine { pub functions: FnvHashMap<usize, FuncRef>, ...
code_fim
hard
{ "lang": "rust", "repo": "nilq/JazzML", "path": "/src/jazzml/vm.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn get_object(&self, s: &usize) -> &ObjectRef { self.pool.get(s).unwrap() } pub fn get_func(&self, s: &usize) -> &FuncRef { self.functions.get(s).unwrap() } pub fn new_object(&mut self) -> usize { let id = self.oid; self.pool .insert(se...
code_fim
hard
{ "lang": "rust", "repo": "nilq/JazzML", "path": "/src/jazzml/vm.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for (i, c) in self.path.iter().enumerate() { if i != 0 { write!(f, "::")?; } write!(f, "{}", c)?; } Ok(()) } } impl From<&'_ str> for RustRelativePath { fn from(s: &str) -> Self { assert!(!s.starts_with("::"), "pa...
code_fim
hard
{ "lang": "rust", "repo": "Tim-Zhang/rust-protobuf", "path": "/protobuf-codegen/src/gen/rust/rel_path.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn push_ident(&mut self, ident: RustIdent) { self.path.push(RustPathComponent::Ident(ident)); } pub fn append_ident(mut self, ident: RustIdent) -> RustRelativePath { self.push_ident(ident); self } pub fn to_reverse(&self) -> RustRelativePath { Rust...
code_fim
hard
{ "lang": "rust", "repo": "Tim-Zhang/rust-protobuf", "path": "/protobuf-codegen/src/gen/rust/rel_path.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Tim-Zhang/rust-protobuf path: /protobuf-codegen/src/gen/rust/rel_path.rs use std::fmt; use std::iter; use crate::gen::rust::component::RustPathComponent; use crate::gen::rust::ident::RustIdent; use crate::gen::rust::path::RustPath; #[derive(Default, Eq, PartialEq, Debug, Clone)] pub(crate) str...
code_fim
hard
{ "lang": "rust", "repo": "Tim-Zhang/rust-protobuf", "path": "/protobuf-codegen/src/gen/rust/rel_path.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Returns the [`Component`] named `name`, if any. pub fn component_by_name<S: AsRef<str>>(&self, name: S) -> Option<Component> { self.symbol(KeyRef::ComponentByName(name.as_ref())) .map(|iid| self.components.get(*iid as usize).unwrap()) .map(|data| Component(self,...
code_fim
hard
{ "lang": "rust", "repo": "yssource/ferrum-fix", "path": "/fefix/src/dictionary.rs", "mode": "spm", "license": "CC-BY-ND-4.0", "source": "the-stack-v2" }
<|fim_suffix|> fn import_field(&mut self, node: roxmltree::Node) -> FieldData { debug_assert_eq!(node.tag_name().name(), "field"); let data_type_iid = DatatypeData::get_or_create_iid_from_ref(&mut self.dict, node); let value_restrictions = value_restrictions_from_node(node, da...
code_fim
hard
{ "lang": "rust", "repo": "yssource/ferrum-fix", "path": "/fefix/src/dictionary.rs", "mode": "spm", "license": "CC-BY-ND-4.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yssource/ferrum-fix path: /fefix/src/dictionary.rs node_with_trailer: roxmltree::Node<'a, 'a>, node_with_components: roxmltree::Node<'a, 'a>, node_with_messages: roxmltree::Node<'a, 'a>, node_with_fields: roxmltree::Node<'a, 'a>, dict: Dictionary, } impl<...
code_fim
hard
{ "lang": "rust", "repo": "yssource/ferrum-fix", "path": "/fefix/src/dictionary.rs", "mode": "psm", "license": "CC-BY-ND-4.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: debox103/frida-rs path: /frida-rs/src/debugsymbol.rs //!Frida functions for debug symbols. //! //!The functions in this module correspond to the JavaScript functions //!grouped under //![https://frida.re/docs/javascript-api/#debugsymbol](https://frida.re/docs/javascript-api/#debugsymbol). use c...
code_fim
hard
{ "lang": "rust", "repo": "debox103/frida-rs", "path": "/frida-rs/src/debugsymbol.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>///Resolve function names matching `glob` and return their addresses. /// ///This is equivalent to calling `DebugSymbol.findFunctionsMatching` in the ///JavaScript API. pub fn find_matching_functions(glob: &str) -> Vec<NativePointer> { frida_rs_sys::debugsymbol::DebugSymbol::find_matching_functions(gl...
code_fim
hard
{ "lang": "rust", "repo": "debox103/frida-rs", "path": "/frida-rs/src/debugsymbol.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rodrigocfd/winsafe path: /src/dshow/com_interfaces/ienummediatypes.rs #![allow(non_camel_case_types, non_snake_case)] use crate::decl::*; use crate::dshow::iterators::*; use crate::kernel::ffi_types::*; use crate::ole::privs::*; use crate::prelude::*; use crate::vt::*; /// [`IEnumMedi...
code_fim
hard
{ "lang": "rust", "repo": "rodrigocfd/winsafe", "path": "/src/dshow/com_interfaces/ienummediatypes.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn_com_noparm! { Reset: IEnumMediaTypesVT; /// [`IEnumMediaTypes::Reset`](https://learn.microsoft.com/en-us/windows/win32/api/strmif/nf-strmif-ienummediatypes-reset) /// method. } /// [`IEnumMediaTypes::Skip`](https://learn.microsoft.com/en-us/windows/win32/api/strmif/nf-strmif-ienummediatype...
code_fim
hard
{ "lang": "rust", "repo": "rodrigocfd/winsafe", "path": "/src/dshow/com_interfaces/ienummediatypes.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Elinvynia/portion-rs path: /tests/iterator.rs use portion_rs::*; #[test] fn singleton() { let x: Vec<u8> = Portion::singleton(2).into_iter().collect(); assert_eq!(x, vec![2]); } #[test] fn closed() { let x: Vec<u8> = Portion::closed(2, 5).into_iter().collect(); assert_eq!(x, ve...
code_fim
hard
{ "lang": "rust", "repo": "Elinvynia/portion-rs", "path": "/tests/iterator.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn open() { let x: Vec<u8> = Portion::open(2, 5).into_iter().collect(); assert_eq!(x, vec![3, 4]); } #[test] fn openclosed() { let x: Vec<u8> = Portion::openclosed(2, 5).into_iter().collect(); assert_eq!(x, vec![3, 4, 5]); } #[test] fn closedopen() { let x: Vec<u8> = Portion:...
code_fim
medium
{ "lang": "rust", "repo": "Elinvynia/portion-rs", "path": "/tests/iterator.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: forkkit/tel-kcna-2019 path: /services/rust/src/main.rs #![feature(proc_macro_hygiene, decl_macro)] #[macro_use] extern crate rocket; fn get_value() -> String { let mut response = match reqwest::get("http://base") { Ok(response) => response, Err(e) => return e.to_string(), ...
code_fim
medium
{ "lang": "rust", "repo": "forkkit/tel-kcna-2019", "path": "/services/rust/src/main.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let value = get_value(); let hashcode = base64::encode(&value); let lines = vec![ "[ Hello KubeCon NA 2019! ]".to_string(), "[ Greetings from Rust ]".to_string(), format!("[ Code: {} ]", hashcode), "".to_string(), format!("Host: {}", get_hostname()), ...
code_fim
hard
{ "lang": "rust", "repo": "forkkit/tel-kcna-2019", "path": "/services/rust/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Patrik-Stas/rust-game-of-life path: /gol_cli/src/main.rs extern crate gol_core; use std::collections::HashMap; use std::thread::sleep; use std::time::Duration; use pancurses::{endwin, initscr}; use gol_core::gol::delta::UpdateDelta; use gol_core::universe::universe::CellUniverse; use gol_core...
code_fim
hard
{ "lang": "rust", "repo": "Patrik-Stas/rust-game-of-life", "path": "/gol_cli/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn run_in(mut universe: impl CellUniverse, mut visualizer: impl UniverseVisualizer) { // println!("Starting GOL"); let mut iter = 0; let limit = 100; loop { visualizer.visualize(universe.iter_alive()); iter += 1; // println!("iter = {}", iter); // if iter > ...
code_fim
medium
{ "lang": "rust", "repo": "Patrik-Stas/rust-game-of-life", "path": "/gol_cli/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ata, EthereumBlockPointer, EthereumBlockTriggerType, EthereumBlockWithCalls, EthereumBlockWithTriggers, EthereumCall, EthereumCallData, EthereumEventData, EthereumTransactionData, EthereumTrigger, };<|fim_prefix|>// repo: orenyodfat/graph-node path: /graph/src/components/ethereum/mod.rs mod adapt...
code_fim
hard
{ "lang": "rust", "repo": "orenyodfat/graph-node", "path": "/graph/src/components/ethereum/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>; pub use self::listener::{ChainHeadUpdate, ChainHeadUpdateListener, ChainHeadUpdateStream}; pub use self::stream::{BlockStream, BlockStreamBuilder}; pub use self::types::{ EthereumBlock, EthereumBlockData, EthereumBlockPointer, EthereumBlockTriggerType, EthereumBlockWithCalls, EthereumBlockWithTr...
code_fim
hard
{ "lang": "rust", "repo": "orenyodfat/graph-node", "path": "/graph/src/components/ethereum/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: orenyodfat/graph-node path: /graph/src/components/ethereum/mod.rs mod adapter; mod listener; mod stream; mod types; pub use self::adapter::{ EthGetLogsFilter, EthereumAdapter, EthereumAdapterError, EthereumBlockFilter, EthereumCallFilter, EthereumContractCall, EthereumContractCallError,...
code_fim
hard
{ "lang": "rust", "repo": "orenyodfat/graph-node", "path": "/graph/src/components/ethereum/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: leNicDev/nebc path: /src/parse.rs use std::io::{Error, ErrorKind}; #[derive(Debug)] pub struct MavenArtifact { repository_url: String, group_id: String, artifact_id: String, version: String, } // nebc artifact format: // <repository url>:<group id>.<artifact id>@<tag|version> /...
code_fim
hard
{ "lang": "rust", "repo": "leNicDev/nebc", "path": "/src/parse.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // get artifact id from nebc artifact let mut artifact_id = String::new(); // remove version from nebc artifact if nebc_artifact.contains("@") { artifact_id = nebc_artifact.split("@").collect::<Vec<&str>>()[0].to_string(); } if nebc_artifact.contains(".") { artifact...
code_fim
hard
{ "lang": "rust", "repo": "leNicDev/nebc", "path": "/src/parse.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kendas/checkers-ponderer path: /rs/src/rules/tests.rs use super::*; use crate::utils; #[test] fn non_king_white_free_movement() { let board = utils::make_board([ "' * ' * ' * ' *", "* ' * ' * ' * '", "' * ' * ' * ' *", "* ' w ' * ' * '", "' * ' * ' * ...
code_fim
hard
{ "lang": "rust", "repo": "kendas/checkers-ponderer", "path": "/rs/src/rules/tests.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn king_white_free_movement_blocked_by_friendly() { let board = utils::make_board([ "' * ' * ' * ' *", "* ' * ' * ' * '", "' * ' * ' w ' *", "* ' * ' w ' * '", "' * ' W ' * ' *", "* ' * ' * ' * '", "' * ' * ' * ' *", "* ' * ' * ' ...
code_fim
hard
{ "lang": "rust", "repo": "kendas/checkers-ponderer", "path": "/rs/src/rules/tests.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xshade-lang/xshade-parser path: /src/ast/expressions/mod.rs use ::ast::*; pub mod binary_expression; pub mod call_expression; pub mod field_accessor_expression; pub mod index_accessor_expression; pub mod literal_expression; pub mod struct_field_initializer_expression; pub mod struct_ins...
code_fim
hard
{ "lang": "rust", "repo": "xshade-lang/xshade-parser", "path": "/src/ast/expressions/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Execute for Expression { fn execute(&self) -> Option<i32> { match *self { Expression::Binary(ref expression) => expression.execute(), Expression::Literal(ref expression) => expression.execute(), Expression::Call(ref expression) => expression.execut...
code_fim
hard
{ "lang": "rust", "repo": "xshade-lang/xshade-parser", "path": "/src/ast/expressions/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ready(Ok(NoopService { service })) } } #[doc(hidden)] pub(crate) struct NoopService<S> { service: S, } impl<S: Service<Req>, Req> Service<Req> for NoopService<S> { type Response = S::Response; type Error = S::Error; type Future = S::Future; crate::dev::forward_ready!(ser...
code_fim
medium
{ "lang": "rust", "repo": "actix/actix-web", "path": "/actix-web/src/middleware/noop.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<S: Service<Req>, Req> Service<Req> for NoopService<S> { type Response = S::Response; type Error = S::Error; type Future = S::Future; crate::dev::forward_ready!(service); fn call(&self, req: Req) -> Self::Future { self.service.call(req) } }<|fim_prefix|>// repo: actix...
code_fim
medium
{ "lang": "rust", "repo": "actix/actix-web", "path": "/actix-web/src/middleware/noop.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: actix/actix-web path: /actix-web/src/middleware/noop.rs //! A no-op middleware. See [Noop] for docs. use actix_utils::future::{ready, Ready}; use crate::dev::{Service, Transform}; /// A no-op middleware that passes through request and response untouched. pub(crate) struct Noop; <|fim_suffix|...
code_fim
hard
{ "lang": "rust", "repo": "actix/actix-web", "path": "/actix-web/src/middleware/noop.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(not(unbroken))] compile_error!("unbroken not set"); fn main() { }<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/commandline-argfile.rs // Check to see if we can get parameters from an @argsfile file // // build-pass // compile-flags: --cfg cmdline_set @{{src-base}}/comma...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/commandline-argfile.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/commandline-argfile.rs // Check to see if we can get parameters from an @argsfile file // // build-pass // compile-flags: --cfg cmdline_set @{{src-base}}/commandline-argfile.args <|fim_suffix|>#[cfg(not(unbroken))] compile_error!("unbroken not ...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/commandline-argfile.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: clucompany/cluLog path: /src/log_block/block_warning.rs use crate::core::LogStatic; use crate::core::LogLockIO; use crate::core::LogBase; use crate::core::LogFlush; use crate::core::LogExtend; use std::io::Write; use std::fmt::Arguments; use std::marker::PhantomData; use std::io; #[derive(Deb...
code_fim
hard
{ "lang": "rust", "repo": "clucompany/cluLog", "path": "/src/log_block/block_warning.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.0.unknown(name, args) } #[inline(always)] fn trace<'l>(&'a self, line: u32, pos: u32, file: &'static str, args: Arguments<'l>) -> io::Result<()> { self.0.trace(line, pos, file, args) } #[inline(always)] fn print<'l>(&'a self, args: Arguments<'l>) -> io::Result<()> { sel...
code_fim
hard
{ "lang": "rust", "repo": "clucompany/cluLog", "path": "/src/log_block/block_warning.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // Read the floats and add them up let mut sum = 0f32; for _ii in 0..4 { let mut tmp = [0u8; 4]; file.read_exact(&mut tmp).unwrap(); let xx = Cursor::new(tmp).get_f32_le(); sum += xx; } // Print result println!("sum = {}", sum); }<|fim_prefix|>// r...
code_fim
medium
{ "lang": "rust", "repo": "NatTuck/scratch-2020-01", "path": "/5600/17/sumfloats/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: NatTuck/scratch-2020-01 path: /5600/17/sumfloats/src/main.rs use std::io::{Cursor, Read, Seek, SeekFrom}; use std::fs::File; extern crate bytes; use bytes::Buf; <|fim_suffix|> // Open the file let mut file = File::open("/tmp/data.dat").unwrap(); file.seek(SeekFrom::Start(8)).unwrap...
code_fim
medium
{ "lang": "rust", "repo": "NatTuck/scratch-2020-01", "path": "/5600/17/sumfloats/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let in_ports: Vec<portmidi::InputPort> = in_devices.into_iter().filter_map(|dev| self.pm_ctx.input_port(dev, MIDI_BUF_LEN).ok()).collect(); let running = self.running.clone(); let finished = self.finished.clone(); thread::spawn(move || Self...
code_fim
hard
{ "lang": "rust", "repo": "chris-zen/hero-synth", "path": "/studio/src/midi/io.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut events = Vec::with_capacity(raw_events.len()); for raw_event in raw_events { let raw_msg = raw_event.message; let msg_buf = [raw_msg.status, raw_msg.data1, raw_msg.data2]; let mut decoder = Decoder::new(&msg_buf); match decoder.next()...
code_fim
hard
{ "lang": "rust", "repo": "chris-zen/hero-synth", "path": "/studio/src/midi/io.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chris-zen/hero-synth path: /studio/src/midi/io.rs use std::sync::{Arc, Mutex}; use std::sync::atomic::{Ordering, AtomicBool}; use std::time::{Duration, Instant}; use std::thread; use std::sync::mpsc::{channel, Sender, Receiver}; use portmidi; use midi::decoder::Decoder; use midi::events::{Even...
code_fim
hard
{ "lang": "rust", "repo": "chris-zen/hero-synth", "path": "/studio/src/midi/io.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Alex-Addy/pysprings-speedy-python path: /mixed-impl/src/lib.rs use std::slice; use std::os::raw::c_char; use std::ffi::CStr; use image::{ImageBuffer, Luma}; mod random_blending; fn convert_slice_to_prob_arr(sli: &[u8]) -> Option<[u8; 9]> { if sli.len() != 9 { None } else { ...
code_fim
hard
{ "lang": "rust", "repo": "Alex-Addy/pysprings-speedy-python", "path": "/mixed-impl/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // we cannot just unwrap the result here as panicing across ffi boundaries is undefined // behavior match img.save(out_path) { Err(err) => { println!("Error while saving image: {}", err); return -1; }, Ok(_) => { return 0; }, ...
code_fim
hard
{ "lang": "rust", "repo": "Alex-Addy/pysprings-speedy-python", "path": "/mixed-impl/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // results let zenith = zenith(lat, dec, h); let azimuth = azimuth(h, dlat.is_sign_negative()); let flux = flux(zenith); return Insolation { flux, azimuth: azimuth.to_degrees(), zenith: zenith.to_degrees(), }; } } ...
code_fim
hard
{ "lang": "rust", "repo": "gschenk/pv_sim", "path": "/solarize/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gschenk/pv_sim path: /solarize/src/lib.rs // This crate provides functions to calculate the relative // position of the sun and electromagnetic flux use std::f64::consts::PI; // number of seconds in a day const SECONDS_DAY: u64 = 86400; // days between new year and northern winter solstice co...
code_fim
hard
{ "lang": "rust", "repo": "gschenk/pv_sim", "path": "/solarize/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// direction to sun, north is 0, east PI/2, south PI, west 3/2 PI // different on either side of the equator fn azimuth(h: f64, is_south: bool) -> f64 { return if is_south { h } else { h + PI }; } // zenith returns the zenith angle [rad] // arguments latitude, declination, hour angle fn zenith(lat: f...
code_fim
hard
{ "lang": "rust", "repo": "gschenk/pv_sim", "path": "/solarize/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> positions.push(tl_); // 5 normals.push(normal); uvs.push(pos_2_uv(&tl_)); positions.push(bl_); // 6 normals.push(normal); uvs.push(pos_2_uv(&bl_)); positions.push(br_); // 7 normals.push(normal); uvs.push(pos_2_uv(&br_)); // assign vertices mesh.set_attribute...
code_fim
hard
{ "lang": "rust", "repo": "JosePedroDias/rust_experiments", "path": "/bevy/src/shapes/stroked_rect.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JosePedroDias/rust_experiments path: /bevy/src/shapes/stroked_rect.rs use bevy::{ math::Vec2, render::mesh::{Indices, Mesh}, render::pipeline::PrimitiveTopology, }; pub fn build_stroked_rect(dims: Vec2, outer_border: f32, inner_border: f32) -> Mesh { let mut mesh = Mesh::new(Pri...
code_fim
hard
{ "lang": "rust", "repo": "JosePedroDias/rust_experiments", "path": "/bevy/src/shapes/stroked_rect.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: EdginAround/edgin_around_rendering path: /edgin_around_rendering/src/utils/errors.rs pub const NOT_EXISTING_ACTOR: &str = "requested actor does not exist"; pub const NOT_EXISTING_HERO: &str = "actor with hero ID does not exist"; pub const HERO_WITHOUT_POSITION: &str = "the hero actor has no posi...
code_fim
hard
{ "lang": "rust", "repo": "EdginAround/edgin_around_rendering", "path": "/edgin_around_rendering/src/utils/errors.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>st"; pub const DEFAULT_VARIANT_AND_ACTION_FAILED: &str = "failed to activate default variant and action"; pub const DEFAULT_ACTION_FAILED: &str = "failed to activate default action"; pub const DEFAULT_ANIMATION_FAILED: &str = "failed to activate default animation"; pub const LOCK_RENDERERS: &str = "failed...
code_fim
hard
{ "lang": "rust", "repo": "EdginAround/edgin_around_rendering", "path": "/edgin_around_rendering/src/utils/errors.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DukeKamono/stats path: /src/lib.rs // Copyright © 2019 Bart Massey // [This program is licensed under the "MIT License"] // Please see the file LICENSE in the source // distribution of this software for license terms. ///! Functions to compute various statistics on a slice of ///! floating-poin...
code_fim
hard
{ "lang": "rust", "repo": "DukeKamono/stats", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Population standard deviation of input values. The /// standard deviation of an empty list is undefined. /// /// # Examples: /// /// ``` /// # use stats::*; /// assert_eq!(None, stddev(&[])); /// ``` /// ``` /// # use stats::*; /// assert_eq!(Some(0.0), stddev(&[1.0, 1.0])); /// ``` /// ``` /// # use ...
code_fim
hard
{ "lang": "rust", "repo": "DukeKamono/stats", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// This takes each array value, minuses it from the offset, /// rasies the power by 2, and then adds it to the total list. /// /// # Examples: /// /// ``` /// # use stats::*; /// assert_eq!(0.0, summation_power(&[], 0.0)); /// ``` /// ``` /// # use stats::*; /// assert_eq!(9.0, summation_power(&[-3.0], 0...
code_fim
hard
{ "lang": "rust", "repo": "DukeKamono/stats", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alexcrichton/wasmtime path: /cranelift/codegen/src/isa/aarch64/lower.rs crate::ir::Inst as IRInst; use crate::ir::{Opcode, Type, Value}; use crate::isa::aarch64::inst::*; use crate::isa::aarch64::AArch64Backend; use crate::machinst::lower::*; use crate::machinst::{Reg, Writable}; use crate::{mac...
code_fim
hard
{ "lang": "rust", "repo": "alexcrichton/wasmtime", "path": "/cranelift/codegen/src/isa/aarch64/lower.rs", "mode": "psm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_suffix|> // We have the base register, if we have any others, we need to add them let addr = lower_add_addends(ctx, base_reg, addends64, addends32); // Figure out what offset we should emit let (addr, imm7) = if let Some(imm7) = SImm7Scaled::maybe_from_i64(offset, I64) { (addr, imm7) }...
code_fim
hard
{ "lang": "rust", "repo": "alexcrichton/wasmtime", "path": "/cranelift/codegen/src/isa/aarch64/lower.rs", "mode": "spm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_suffix|>/// Lower the address of a load or store. pub(crate) fn lower_address( ctx: &mut Lower<Inst>, elem_ty: Type, addr: Value, offset: i32, ) -> AMode { // TODO: support base_reg + scale * index_reg. For this, we would need to // pattern-match shl or mul instructions. // Collect ad...
code_fim
hard
{ "lang": "rust", "repo": "alexcrichton/wasmtime", "path": "/cranelift/codegen/src/isa/aarch64/lower.rs", "mode": "spm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fossabot/necsim-rust path: /rustcoalescence/algorithms/independent/src/lib.rs #![deny(clippy::pedantic)] #![feature(never_type)] #![feature(drain_filter)] #[macro_use] extern crate serde_derive_state; use std::{collections::VecDeque, hint::unreachable_unchecked}; use arguments::{ Independ...
code_fim
hard
{ "lang": "rust", "repo": "fossabot/necsim-rust", "path": "/rustcoalescence/algorithms/independent/src/lib.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> let (habitat, dispersal_sampler, turnover_rate, speciation_probability) = scenario.build::<InMemoryAliasDispersalSampler<O::Habitat, WyHash>>(); let rng = WyHash::seed_from_u64(seed); let lineage_store = IndependentLineageStore::default()...
code_fim
hard
{ "lang": "rust", "repo": "fossabot/necsim-rust", "path": "/rustcoalescence/algorithms/independent/src/lib.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>#[macro_export] macro_rules! expect_eq { ($expected:expr, $actual:expr) => { $crate::expectation::prelude::expect_eq( &$expected, &$actual, file!(), line!(), stringify!($expected), stringify!($actual), ) }; } ...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/connectivity/bluetooth/lib/fuchsia-bluetooth/src/expectation/prelude.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /src/connectivity/bluetooth/lib/fuchsia-bluetooth/src/expectation/prelude.rs // Copyright 2020 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. <|fim_suffix|>#[macro_export] m...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/connectivity/bluetooth/lib/fuchsia-bluetooth/src/expectation/prelude.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ttencate/aoc2018 path: /src/bin/decompiler.rs use aoc::vm::Program; use aoc::vm::decompiler::Decompile; use std::io::Read; <|fim_suffix|> let input = std::io::stdin(); let mut code = String::new(); input.lock().read_to_string(&mut code).unwrap(); print!("{}", Program::parse(&code...
code_fim
easy
{ "lang": "rust", "repo": "ttencate/aoc2018", "path": "/src/bin/decompiler.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }