text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: newAM/r3 path: /src/r3/src/kernel/startup.rs use core::marker::PhantomData; use crate::utils::Init; /// Represents a registered startup hook in a system. /// /// There are no operations defined for startup hooks, so this type /// is only used for static configuration. /// /// Startup hooks exe...
code_fim
medium
{ "lang": "rust", "repo": "newAM/r3", "path": "/src/r3/src/kernel/startup.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// A startup hook. /// /// This type isn't technically public but needs to be `pub` so that it can be /// referred to by a macro. #[doc(hidden)] #[derive(Clone, Copy)] pub struct StartupHookAttr { pub(super) start: unsafe fn(usize), pub(super) param: usize, } impl Init for StartupHookAttr { ...
code_fim
medium
{ "lang": "rust", "repo": "newAM/r3", "path": "/src/r3/src/kernel/startup.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> kafka::StreamProcessorError::EventHandlerError(val.to_string()) } } impl From<SysmonGeneratorError> for Status { fn from(e: SysmonGeneratorError) -> Self { Status::unknown(e.to_string()) } }<|fim_prefix|>// repo: grapl-security/grapl path: /src/rust/generators/sysmon-generato...
code_fim
hard
{ "lang": "rust", "repo": "grapl-security/grapl", "path": "/src/rust/generators/sysmon-generator/src/error.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: grapl-security/grapl path: /src/rust/generators/sysmon-generator/src/error.rs use rust_proto::graplinc::grapl::api::protocol::status::Status; use thiserror::Error; /// This represents all possible errors that can occur in this generator. #[non_exhaustive] #[derive(Debug, Error)] pub enum Sysmon...
code_fim
hard
{ "lang": "rust", "repo": "grapl-security/grapl", "path": "/src/rust/generators/sysmon-generator/src/error.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: klugdossier/Storage-Controller path: /benches/sloth.rs use criterion::criterion_group; use criterion::criterion_main; use criterion::Criterion; use rug::integer::Order; use rug::{rand::RandState, Integer}; use std::time::{SystemTime, UNIX_EPOCH}; use subspace_core_rust::crypto; use subspace_core...
code_fim
hard
{ "lang": "rust", "repo": "klugdossier/Storage-Controller", "path": "/benches/sloth.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> group.bench_function(format!("{} bits/encode-piece", prime_size), |b| { b.iter(|| { sloth .encode(&mut piece, &integer_expanded_iv, layers) .unwrap(); }) }); group.bench_function(format!("{} bits/decod...
code_fim
hard
{ "lang": "rust", "repo": "klugdossier/Storage-Controller", "path": "/benches/sloth.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iCodeIN/ds-collection path: /src/basic_binary_tree.rs use std::mem; use Set; #[derive(Debug)] pub struct Node { left: Option<Box<Node>>, right: Option<Box<Node>>, value: i32, size: usize // to speed up Select and Rank } impl Node { fn new(x: i32) -> Option<B...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/ds-collection", "path": "/src/basic_binary_tree.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return None; } pub type BasicBinaryTree = Option<Box<Node>>; impl Set for BasicBinaryTree { // create a set fn new() -> Self { None } // is x in the set fn member(&self, x: i32) -> bool { match *self { Some(ref node) => { ...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/ds-collection", "path": "/src/basic_binary_tree.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Pryx/swa-semestral-project path: /review-microservice/src/main.rs #[macro_use] extern crate diesel; extern crate dotenv; extern crate juniper; extern crate config; use std::io; use actix_web::{get, post, web, middleware, App, Error, HttpResponse, HttpServer}; use actix_web::dev::HttpResponseBu...
code_fim
hard
{ "lang": "rust", "repo": "Pryx/swa-semestral-project", "path": "/review-microservice/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[get("/reviews/product/{product_id}")] async fn get_reviews_for_product( pool: web::Data<db::PgPool>, product_uid: web::Path<String>, ) -> Result<HttpResponse, Error> { let product_uid = product_uid.into_inner(); let conn = pool.get().expect("couldn't get db connection from pool"); ...
code_fim
hard
{ "lang": "rust", "repo": "Pryx/swa-semestral-project", "path": "/review-microservice/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match res { Ok(r) => Ok(HttpResponseBuilder::new(StatusCode::from_u16(r.code).unwrap()).json(r)), Err(_) =>{ let msg: model::Response<String> = model::Response{ success: false, data: None, message: format!("Internal server err...
code_fim
hard
{ "lang": "rust", "repo": "Pryx/swa-semestral-project", "path": "/review-microservice/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jgrund/stream-lines path: /examples/strings.rs extern crate futures; extern crate stream_lines; extern crate tokio; use std::string::FromUtf8Error; <|fim_suffix|> let chunks = vec!["\nhello ", "world\n", "\n", "what a\nlovely", "\nday\n"]; let stream = iter_ok::<_, FromUtf8Error>(chunks...
code_fim
medium
{ "lang": "rust", "repo": "jgrund/stream-lines", "path": "/examples/strings.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>use futures::stream::iter_ok; use futures::Stream; use tokio::runtime::Runtime; fn main() { let chunks = vec!["\nhello ", "world\n", "\n", "what a\nlovely", "\nday\n"]; let stream = iter_ok::<_, FromUtf8Error>(chunks); let print = stream_lines::strings(stream).for_each(|line| Ok(println!("{}"...
code_fim
medium
{ "lang": "rust", "repo": "jgrund/stream-lines", "path": "/examples/strings.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let chunks = vec!["\nhello ", "world\n", "\n", "what a\nlovely", "\nday\n"]; let stream = iter_ok::<_, FromUtf8Error>(chunks); let print = stream_lines::strings(stream).for_each(|line| Ok(println!("{}", line))); Runtime::new() .expect("failed to initialize runtime") .block_...
code_fim
medium
{ "lang": "rust", "repo": "jgrund/stream-lines", "path": "/examples/strings.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Luna1996/rust_os path: /bootloader/src/main.rs #![no_std] #![no_main] #![allow(non_camel_case_types, non_upper_case_globals)] #![feature(const_raw_ptr_deref, alloc_error_handler)] #[macro_use] extern crate alloc; use alloc::{ alloc::{GlobalAlloc, Layout}, slice::from_raw_parts_mut, string::...
code_fim
hard
{ "lang": "rust", "repo": "Luna1996/rust_os", "path": "/bootloader/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>//╔═══════════╗ //║ Entry ║ //╚═══════════╝ #[no_mangle] unsafe fn efi_main(img: EFI_HANDLE, st: &'static EFI_SYSTEM_TABLE) -> EFI_STATUS { // Setup globels let boot = st.BootServices; let cout = st.ConOut; BOOT = boot; COUT = cout; // Setup VGA Text for boottime. (cout.ClearScreen)(cout); (cout...
code_fim
hard
{ "lang": "rust", "repo": "Luna1996/rust_os", "path": "/bootloader/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nreihidd/ds path: /src/builtins/types.rs use std::rc::Rc; use ::Value; fn basic_type(s: &str) -> Rc<Value> { Rc::new(Value::String(s.to_string())) } pub fn quote_type() -> Rc<Value> { basic_type("quote") } pub fn branch_type() -> Rc<Value> { basic_type("branch") } pub fn load_type() -> Rc<...
code_fim
hard
{ "lang": "rust", "repo": "nreihidd/ds", "path": "/src/builtins/types.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>y_function") } pub fn assoc_list_type() -> Rc<Value> { basic_type("assoc_list") } pub fn closure_type() -> Rc<Value> { basic_type("closure") } pub fn comment_type() -> Rc<Value> { basic_type("comment") }<|fim_prefix|>// repo: nreihidd/ds path: /src/builtins/types.rs use std::rc::Rc; use ::Value; fn basi...
code_fim
hard
{ "lang": "rust", "repo": "nreihidd/ds", "path": "/src/builtins/types.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: loganyu/leetcode path: /problems/382_linked_list_random_node.rs /* Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen. Implement the Solution class: Solution(ListNode head) Initializes the object with the inte...
code_fim
hard
{ "lang": "rust", "repo": "loganyu/leetcode", "path": "/problems/382_linked_list_random_node.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /** * `&self` means the method takes an immutable reference. * If you need a mutable reference, change it to `&mut self` instead. */ impl Solution { fn new(head: Option<Box<ListNode>>) -> Self { Self { head: head, rng: thread_rng() } } fn get_...
code_fim
hard
{ "lang": "rust", "repo": "loganyu/leetcode", "path": "/problems/382_linked_list_random_node.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lmburns/taskn path: /src/commands/interactive/mod.rs #![allow(unused)] mod events; use anyhow::{anyhow, Context, Result}; use std::{ io::{self, Stdout, Write}, process::Command, }; use thiserror::Error; use termion::{ event::Key, input::MouseTerminal, raw::{IntoRawMode, Raw...
code_fim
hard
{ "lang": "rust", "repo": "lmburns/taskn", "path": "/src/commands/interactive/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> terminal .draw(|frame| common_render(frame, common_state, &[Modifier::DIM])) .context("error drawing terminal") } fn update( &mut self, _opt: &Opt, common_state: &mut CommonState, key: Key, ) -> Result<ActionResult> { let...
code_fim
hard
{ "lang": "rust", "repo": "lmburns/taskn", "path": "/src/commands/interactive/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: prz23/zinc path: /zinc-math/src/bigint/mod.rs //! //! The BigInt parsing tools. //! #[cfg(test)] mod tests; use std::str::FromStr; use num::BigInt; use num::Num; use num::Zero; use crate::error::Error; /// /// The extended BigInt parsing function, which supports: /// /// - binary, octal, he...
code_fim
hard
{ "lang": "rust", "repo": "prz23/zinc", "path": "/zinc-math/src/bigint/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let value = if value_str.len() == leading_zeros { BigInt::zero() } else { BigInt::from_str( value_str .chars() .skip(leading_zeros) .collect::<String>() .as_str(), ...
code_fim
hard
{ "lang": "rust", "repo": "prz23/zinc", "path": "/zinc-math/src/bigint/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: obiesie/coinbase-pro-rs path: /src/wsfeed.rs //! Contains structure which provides futures::Stream to websocket-feed of Coinbase api extern crate url; use std::time::{SystemTime, UNIX_EPOCH}; use self::url::Url; use futures::{Future, Sink, Stream}; use serde_json; use tokio_tungstenite::connec...
code_fim
hard
{ "lang": "rust", "repo": "obiesie/coinbase-pro-rs", "path": "/src/wsfeed.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let subscribe = Subscribe { _type: SubscribeCmd::Subscribe, product_ids: product_ids.into_iter().map(|x| x.to_string()).collect(), channels: channels .to_vec() .into_iter() .map(|x| Channel::Name(x)) ...
code_fim
hard
{ "lang": "rust", "repo": "obiesie/coinbase-pro-rs", "path": "/src/wsfeed.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> println!( "{}", if s_len % (s_len - fail[s_len - 1]) > 0 { 1 } else { s_len / (s_len - fail[s_len - 1]) } ); } }<|fim_prefix|>// repo: utilForever/BOJ path: /Rust/4354 - String Square.rs use std::io; fn m...
code_fim
hard
{ "lang": "rust", "repo": "utilForever/BOJ", "path": "/Rust/4354 - String Square.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: utilForever/BOJ path: /Rust/4354 - String Square.rs use std::io; fn main() { loop { let mut s = String::new(); io::stdin().read_line(&mut s).unwrap(); if s.trim() == "." { break; } let s_chars = s.trim().as_bytes(); let s_len = s...
code_fim
hard
{ "lang": "rust", "repo": "utilForever/BOJ", "path": "/Rust/4354 - String Square.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn reset_setting_value(&self) {} pub fn set_setting_value(&self) {} }<|fim_prefix|>// repo: tsirysndr/kodi-rs path: /src/settings.rs use surf::Client; pub struct SettingsService { client: Client, } <|fim_middle|>impl SettingsService { pub fn new(client: &Client) -> Self { Self { ...
code_fim
hard
{ "lang": "rust", "repo": "tsirysndr/kodi-rs", "path": "/src/settings.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn get_setting_value(&self) {} pub fn get_settings(&self) {} pub fn reset_setting_value(&self) {} pub fn set_setting_value(&self) {} }<|fim_prefix|>// repo: tsirysndr/kodi-rs path: /src/settings.rs use surf::Client; pub struct SettingsService { client: Client, } impl SettingsService { ...
code_fim
easy
{ "lang": "rust", "repo": "tsirysndr/kodi-rs", "path": "/src/settings.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tsirysndr/kodi-rs path: /src/settings.rs use surf::Client; pub struct SettingsService { client: Client, } impl SettingsService { pub fn new(client: &Client) -> Self { Self { client: client.clone(), } } pub fn get_categories(&self) {} <|fim_suffix|> pub fn reset_setting...
code_fim
medium
{ "lang": "rust", "repo": "tsirysndr/kodi-rs", "path": "/src/settings.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jaffa4/siko-1 path: /crates/siko_transpiler/src/module.rs use crate::function::write_function; use crate::internal_module::write_internal_defs; use crate::typedef::write_typedef; use crate::util::get_module_name; use crate::util::Indent; use siko_constants::MIR_INTERNAL_MODULE_NAME; use siko_mir...
code_fim
hard
{ "lang": "rust", "repo": "jaffa4/siko-1", "path": "/crates/siko_transpiler/src/module.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn write( &self, output_file: &mut dyn Write, program: &Program, indent: &mut Indent, ) -> Result<()> { write!(output_file, "mod {} {{\n", get_module_name(&self.name))?; indent.inc(); for typedef_id in &self.typedefs { write_t...
code_fim
hard
{ "lang": "rust", "repo": "jaffa4/siko-1", "path": "/crates/siko_transpiler/src/module.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cloudhead/rgx path: /src/math/size.rs use std::ops::{Div, Mul}; use super::{traits::FloatExt as _, Vector2D, Zero}; /// Size. #[derive(Debug, Copy, Clone, PartialEq, Eq, Default)] pub struct Size<T = f32> { /// Width. pub w: T, /// Height. pub h: T, } impl<T> Size<T> { ///...
code_fim
hard
{ "lang": "rust", "repo": "cloudhead/rgx", "path": "/src/math/size.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<T> From<(T, T)> for Size<T> { fn from((w, h): (T, T)) -> Self { Self::new(w, h) } } impl<T: Copy> From<T> for Size<T> { fn from(n: T) -> Self { Self::new(n, n) } } impl<T> From<[T; 2]> for Size<T> { fn from([w, h]: [T; 2]) -> Self { Self::new(w, h) } ...
code_fim
hard
{ "lang": "rust", "repo": "cloudhead/rgx", "path": "/src/math/size.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Self::new(w, h) } } impl<T: Copy> From<T> for Size<T> { fn from(n: T) -> Self { Self::new(n, n) } } impl<T> From<[T; 2]> for Size<T> { fn from([w, h]: [T; 2]) -> Self { Self::new(w, h) } } impl From<Size<u32>> for Size<f32> { fn from(other: Size<u32>) -> ...
code_fim
hard
{ "lang": "rust", "repo": "cloudhead/rgx", "path": "/src/math/size.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: timkurvers/advent-of-code path: /rust/src/2021/01.rs use advent_of_code::utils::challenges::prelude::*; fn parse(input: &PuzzleInput) -> Vec<u32> { input.trim().lines().map(|s| s.parse().unwrap()).collect() } <|fim_suffix|>fn part_two(input: &PuzzleInput, _args: &RawPuzzleArgs) -> Solution...
code_fim
hard
{ "lang": "rust", "repo": "timkurvers/advent-of-code", "path": "/rust/src/2021/01.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn part_one(input: &PuzzleInput, _args: &RawPuzzleArgs) -> Solution { let measurements = parse(input); let count = measurements .windows(2) .filter(|window| window[0] < window[1]) .count(); Answer(count as u64) } fn part_two(input: &PuzzleInput, _args: &RawPuzzleArgs...
code_fim
medium
{ "lang": "rust", "repo": "timkurvers/advent-of-code", "path": "/rust/src/2021/01.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ST3ALth/SPE3D path: /src/bus.rs use std::sync::mpsc::{channel, Receiver, Sender}; use std::sync::{Arc, Mutex}; use std::thread; use crate::error::*; use crate::models::{DownloadFile, DownloadList, CaptchaResult}; /// Message bus to share messages through the /// complete system. #[derive(Clone)...
code_fim
hard
{ "lang": "rust", "repo": "ST3ALth/SPE3D", "path": "/src/bus.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let msg = self.receiver_internal.lock()?.recv()?; let mut senders = self.sender_internal.lock()?; for is in 0..senders.len() { if let Err(_) = senders.get(is).ok_or("Sender was't in list")?.send(msg.clone()) { senders.remove(is); } }...
code_fim
hard
{ "lang": "rust", "repo": "ST3ALth/SPE3D", "path": "/src/bus.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let timestamp = Instant::from_millis(timer_now().as_millis() as i64); let mut sockets = socketset.lock(); match self.iface.lock().poll(&mut sockets, timestamp) { Ok(_) => { // warn!("now in impl NetDriver for E1000Interface poll need SOCKET_ACTIVITY.noti...
code_fim
hard
{ "lang": "rust", "repo": "wuJflower/zCore", "path": "/kernel-hal-bare/src/devices/net/e1000.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wuJflower/zCore path: /kernel-hal-bare/src/devices/net/e1000.rs // alloc use alloc::collections::BTreeMap; use alloc::string::String; use alloc::sync::Arc; use alloc::vec::Vec; // smoltcp use smoltcp::iface::Interface; use smoltcp::iface::InterfaceBuilder; use smoltcp::iface::NeighborCache; use...
code_fim
hard
{ "lang": "rust", "repo": "wuJflower/zCore", "path": "/kernel-hal-bare/src/devices/net/e1000.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> old_index += 1; new_index += 2; continue; } // remove old if (old_look_ahead && old_match) { index++; remove_node(changes, local_patches, old_key, old_node, index); index += old_node.descendants_count || 0; index++; diff_node(old_next_node, new_node, local_patches, index)...
code_fim
hard
{ "lang": "rust", "repo": "grncdr/vdom-rs", "path": "/src/diff.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: grncdr/vdom-rs path: /src/diff.rs use std::fmt::Debug; use super::{Node, Attr, Child}; #[derive(Debug, PartialEq)] pub enum Operation<'node, Msg: 'static + Debug> { ReplaceNode(&'node Node<Msg>), ReplaceText(&'node str), RemoveAttribute(&'node Attr), SetAttribute(&'node Attr), ...
code_fim
hard
{ "lang": "rust", "repo": "grncdr/vdom-rs", "path": "/src/diff.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dirvine/ewok path: /src/network.rs use std::collections::BTreeMap; use message::Message; use random::random; // FIXME: need to implement in-order message delivery so that disconnects and reconnects // don't get out of order. // A BTreeMap<(Name, Name), BTreeMap<u64, Vec<Message>> should be suf...
code_fim
hard
{ "lang": "rust", "repo": "dirvine/ewok", "path": "/src/network.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let prob_deliver = self.prob_deliver; self.messages.range_mut(start_step..step) .flat_map(|(&step_sent, messages)| { // Partition randomly based on p, whilst also delivering any messages // which were sent at start step. let (del...
code_fim
hard
{ "lang": "rust", "repo": "dirvine/ewok", "path": "/src/network.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Send messages at the given step. pub fn send(&mut self, step: u64, messages: Vec<Message>) { let step_messages = self.messages.entry(step).or_insert_with(Vec::new); step_messages.extend(messages); } }<|fim_prefix|>// repo: dirvine/ewok path: /src/network.rs use std::collec...
code_fim
hard
{ "lang": "rust", "repo": "dirvine/ewok", "path": "/src/network.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: 5l1v3r1/secp256kfun path: /ecdsa_fun/src/adaptor/mod.rs //! ECDSA Adaptor signatures. use crate::{Signature, ECDSA}; use digest::{generic_array::typenum::U32, Digest}; use secp256kfun::{ derive_nonce, g, hash::{Derivation, NonceHash}, marker::*, s, Point, Scalar, G, }; mod encry...
code_fim
hard
{ "lang": "rust", "repo": "5l1v3r1/secp256kfun", "path": "/ecdsa_fun/src/adaptor/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> EncryptedSignature { R: PointNonce { point: R, x_scalar: R_x, }, R_hat, s_hat, proof, } } } impl<CH: Digest<OutputSize = U32> + Clone, NH> Adaptor<CH, NH> { #[must_use] pub fn verify_en...
code_fim
hard
{ "lang": "rust", "repo": "5l1v3r1/secp256kfun", "path": "/ecdsa_fun/src/adaptor/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iliekturtles/uom path: /src/si/mod.rs //! [International System of Units][si] (SI) and [International System of Quantities][isq] (ISQ) //! implementations. //! //! [si]: https://jcgm.bipm.org/vim/en/1.16.html //! [isq]: https://jcgm.bipm.org/vim/en/1.6.html #[macro_use] mod prefix; system! { ...
code_fim
hard
{ "lang": "rust", "repo": "iliekturtles/uom", "path": "/src/si/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Kind of thermodynamic temperature. pub trait TemperatureKind: crate::marker::Mul + crate::marker::MulAssign + crate::marker::Div + crate::marker::DivAssign + crate::marker::Rem + crate::marker::RemAssign { } /// Kind of constituent c...
code_fim
hard
{ "lang": "rust", "repo": "iliekturtles/uom", "path": "/src/si/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ggriffiniii/bstr path: /src/bstr.rs lly, we are only dealing with u8 data, which is Copy, which // means we can copy without worrying about ownership/destructors. unsafe { ptr::copy( self.get_unchecked(src_start), self.get_unchecked_mut...
code_fim
hard
{ "lang": "rust", "repo": "ggriffiniii/bstr", "path": "/src/bstr.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ggriffiniii/bstr path: /src/bstr.rs &'a self, limit: usize, splitter: &'a B, ) -> SplitNReverse<'a> { SplitNReverse::new(self, BStr::new(splitter.as_ref()), limit) } /// Replace all matches of the given needle with the given replacement, and /// the res...
code_fim
hard
{ "lang": "rust", "repo": "ggriffiniii/bstr", "path": "/src/bstr.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Cow::Borrowed(OsStr::from_bytes(self.as_bytes())) } #[cfg(feature = "std")] #[cfg(not(unix))] #[inline] fn to_os_str_lossy_imp(&self) -> Cow<OsStr> { use std::ffi::OsString; match self.to_str_lossy() { Cow::Borrowed(x) => Cow::Borrowed(OsStr::new(x...
code_fim
hard
{ "lang": "rust", "repo": "ggriffiniii/bstr", "path": "/src/bstr.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: akhilles/twitter-streams path: /src/main.rs use std::str; use std::sync::RwLock; use circular_queue::CircularQueue; use futures::future::join; use once_cell::sync::Lazy; mod oauth; mod server; mod twitter; mod util; use crate::oauth::Credentials; use crate::server::serve_graph_data; use crate...
code_fim
hard
{ "lang": "rust", "repo": "akhilles/twitter-streams", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>async fn process_tweets(credentials: &Credentials, shared_data: &SharedData) { loop { match FilteredTweets::new(&credentials).await { Ok(mut stream) => stream.stream(shared_data).await, Err(e) => println!("err: {:?}", e), }; } } #[tokio::main] async fn main...
code_fim
hard
{ "lang": "rust", "repo": "akhilles/twitter-streams", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let processed_tweets = CircularQueue::with_capacity(NUM_PROCESSED_TWEETS_STORED); let processed_tweets = RwLock::new(processed_tweets); let back_pressure_entries = CircularQueue::with_capacity(NUM_BACK_PRESSURE_ENTRIES_STORED); let back_pressure_entries = RwLock::new(back_p...
code_fim
medium
{ "lang": "rust", "repo": "akhilles/twitter-streams", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/* impl Solution { pub fn duplicate_zeros(arr: &mut Vec<i32>) { let mut temp = vec![]; for i in arr.iter() { temp.push(*i); if *i == 0 { temp.push(*i); } } *arr = temp[..arr.len()].to_vec(); } } */ /* 执行结果: 通过 显示详...
code_fim
hard
{ "lang": "rust", "repo": "flyq/datastruct-algorithm", "path": "/leetcode/p1089/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: flyq/datastruct-algorithm path: /leetcode/p1089/src/main.rs fn main() { println!("Hello, world!"); let mut a = vec![1, 0, 2, 3, 0, 4, 5, 0]; Solution::duplicate_zeros(&mut a); println!("{:?}", a); } pub struct Solution {} <|fim_suffix|>/* impl Solution { pub fn duplicate_zer...
code_fim
hard
{ "lang": "rust", "repo": "flyq/datastruct-algorithm", "path": "/leetcode/p1089/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: arkworks-rs/algebra path: /ff/src/fields/models/mod.rs pub mod fp; pub use self::fp::*; pub mod fp2; pub use self::fp2::*; pub mod fp3; pub use self::fp3::*; <|fim_suffix|>pub mod fp6_2over3; pub mod fp6_3over2; pub use self::fp6_3over2::*; pub mod fp12_2over3over2; pub use self::fp12_2over...
code_fim
easy
{ "lang": "rust", "repo": "arkworks-rs/algebra", "path": "/ff/src/fields/models/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[macro_use] pub mod cubic_extension; pub use cubic_extension::*;<|fim_prefix|>// repo: arkworks-rs/algebra path: /ff/src/fields/models/mod.rs pub mod fp; pub use self::fp::*; pub mod fp2; pub use self::fp2::*; <|fim_middle|>pub mod fp3; pub use self::fp3::*; pub mod fp4; pub use self::fp4::*; pub mo...
code_fim
hard
{ "lang": "rust", "repo": "arkworks-rs/algebra", "path": "/ff/src/fields/models/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ($name:ident: $ty:ty = $fun:ident($expr:expr)) => ( lazy_static!(static ref $name: ::thread_local::CachedThreadLocal<$ty> = ::thread_local::CachedThreadLocal::new();); fn $fun() -> &'static $ty { $name.get_or(|| Box::new($expr)) } ); }<|fim_prefix|>/...
code_fim
medium
{ "lang": "rust", "repo": "neivv/more_bullets_yay", "path": "/src/macros.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: neivv/more_bullets_yay path: /src/macros.rs /// A macro for creating static thread locals with assumption that they are generally accessed /// from a single thread. Also can't run into windows's TLS limitations. /// /// The value can be easily accessed by calling $fun(), which will initialize it...
code_fim
medium
{ "lang": "rust", "repo": "neivv/more_bullets_yay", "path": "/src/macros.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test_nostd_get_set_bools_as_u8() { let mut ctx = CTX.write(); ctx.clear_coils(); let mut data_mem = alloc_stack!([bool; CONTEXT_SIZE]); let mut data = FixedVec::new(&mut data_mem); data.push_all(&[ true, true, true, false, true, true, true, true, true, false, false, ...
code_fim
hard
{ "lang": "rust", "repo": "sanri/rmodbus", "path": "/src/tests/test_nostd.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sanri/rmodbus path: /src/tests/test_nostd.rs use crate::client::*; use crate::server::context::{ModbusContextSmall, SMALL_CONTEXT_SIZE as CONTEXT_SIZE}; use crate::server::*; use crate::*; use fixedvec::alloc_stack; use fixedvec::FixedVec; use spin::RwLock; lazy_static! { pub static ref CTX...
code_fim
hard
{ "lang": "rust", "repo": "sanri/rmodbus", "path": "/src/tests/test_nostd.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>const SLACK_BASE_URL: &'static str = "https://slack.com/api/"; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct SlackError { pub ok: bool, pub error: String, }<|fim_prefix|>// repo: jeremyletang/latte path: /src/slack/mod.rs // Copyright 2016 Jeremy Letang. // Licensed under th...
code_fim
medium
{ "lang": "rust", "repo": "jeremyletang/latte", "path": "/src/slack/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct SlackError { pub ok: bool, pub error: String, }<|fim_prefix|>// repo: jeremyletang/latte path: /src/slack/mod.rs // Copyright 2016 Jeremy Letang. // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.a...
code_fim
medium
{ "lang": "rust", "repo": "jeremyletang/latte", "path": "/src/slack/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jeremyletang/latte path: /src/slack/mod.rs // Copyright 2016 Jeremy Letang. // 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 file ...
code_fim
medium
{ "lang": "rust", "repo": "jeremyletang/latte", "path": "/src/slack/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut tiles = Vec::<Bigtile>::new(); let mut sy: i32 = endy; let mut ey: i32 = -1; for y in (starty..endy).step_by(16) { // define a 16px x 16px (or less at the edges) tile. let mut identical = true; // test whether this row of tiles differs fr...
code_fim
hard
{ "lang": "rust", "repo": "ajnewlands/screenpub", "path": "/src/snapscreen/snapscreen.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ajnewlands/screenpub path: /src/snapscreen/snapscreen.rs use scrap::{Capturer, Display}; use std::io::ErrorKind; use std::is_x86_feature_detected; use log::debug; mod converters; use converters::{ avx2_bgra_to_rgba, avx2_cmp_and_convert, avx2_cmp, avx2_convert_in_place }; #[derive(PartialEq, E...
code_fim
hard
{ "lang": "rust", "repo": "ajnewlands/screenpub", "path": "/src/snapscreen/snapscreen.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: theIDinside/cxg path: /src/opengl/glinit.rs use super::types::{Matrix, Vec4f}; use crate::MainInitError; use gl::{CompileShader, CreateProgram, GetProgramInfoLog, GetProgramiv, GetShaderInfoLog, GetShaderiv, ShaderSource}; use std::ffi::CString; pub struct OpenGLHandle { pub vao: gl::types:...
code_fim
hard
{ "lang": "rust", "repo": "theIDinside/cxg", "path": "/src/opengl/glinit.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let message = unsafe { std::ffi::CStr::from_ptr(message).to_str().expect("Failed to cast CStr to String") }; println!("---------------"); println!("Debug message ({}): {}", id, message); match source { gl::DEBUG_SOURCE_API => println!("Source: API"), gl::DEBUG_SOURCE_WIND...
code_fim
hard
{ "lang": "rust", "repo": "theIDinside/cxg", "path": "/src/opengl/glinit.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("---------------"); println!("Debug message ({}): {}", id, message); match source { gl::DEBUG_SOURCE_API => println!("Source: API"), gl::DEBUG_SOURCE_WINDOW_SYSTEM => println!("Source: Window System"), gl::DEBUG_SOURCE_SHADER_COMPILER => println!("Source: Shad...
code_fim
hard
{ "lang": "rust", "repo": "theIDinside/cxg", "path": "/src/opengl/glinit.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kmat1984/web-dom path: /src/exttexturefilteranisotropic.rs #[allow(unused_imports)] use crate::*; #[allow(unused<|fim_suffix|> MAX_TEXTURE_MAX_ANISOTROPY_EXT: f32 = 0x84FF as f32;<|fim_middle|>_imports)] use alloc::string::String; pub const TEXTURE_MAX_ANISOTROPY_EXT: f32 = 0x84FE as f32; pub co...
code_fim
medium
{ "lang": "rust", "repo": "kmat1984/web-dom", "path": "/src/exttexturefilteranisotropic.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>RE_MAX_ANISOTROPY_EXT: f32 = 0x84FE as f32; pub const MAX_TEXTURE_MAX_ANISOTROPY_EXT: f32 = 0x84FF as f32;<|fim_prefix|>// repo: kmat1984/web-dom path: /src/exttexturefilteranisotropic.rs #[allow(unused_imports)] use crate::*; #[allow(unused<|fim_middle|>_imports)] use alloc::string::String; pub const TE...
code_fim
easy
{ "lang": "rust", "repo": "kmat1984/web-dom", "path": "/src/exttexturefilteranisotropic.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: guillaume-be/rust-bert path: /benches/sst2_benchmark.rs #[macro_use] extern crate criterion; use criterion::Criterion; use rust_bert::pipelines::sentiment::SentimentModel; use rust_bert::pipelines::sequence_classification::SequenceClassificationConfig; use serde::Deserialize; use std::error::Er...
code_fim
hard
{ "lang": "rust", "repo": "guillaume-be/rust-bert", "path": "/benches/sst2_benchmark.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>fn sst2_load_model(iters: u64) -> Duration { let mut duration = Duration::new(0, 0); for _i in 0..iters { let start = Instant::now(); let config = SequenceClassificationConfig { device: Device::cuda_if_available(), ..Default::default() }; let...
code_fim
hard
{ "lang": "rust", "repo": "guillaume-be/rust-bert", "path": "/benches/sst2_benchmark.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>fn bench_sst2(c: &mut Criterion) { // Set-up classifier let model = create_sentiment_model(); unsafe { torch_sys::dummy_cuda_dependency(); } // Define input let mut sst2_path = PathBuf::from(env::var("SST2_PATH").expect( "Please set the \"SST2_PATH\" environme...
code_fim
hard
{ "lang": "rust", "repo": "guillaume-be/rust-bert", "path": "/benches/sst2_benchmark.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> match self { Self::Opl2 => ffi::ALSAHWDEP_IFACE_TYPE_OPL2, Self::Opl3 => ffi::ALSAHWDEP_IFACE_TYPE_OPL3, Self::Opl4 => ffi::ALSAHWDEP_IFACE_TYPE_OPL4, Self::Sb16csp => ffi::ALSAHWDEP_IFACE_TYPE_SB16CSP, Self::Emu10k1 => ffi::ALSAHWDEP_IFA...
code_fim
hard
{ "lang": "rust", "repo": "alsa-project/alsa-gobject-rs", "path": "/alsahwdep/src/auto/enums.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alsa-project/alsa-gobject-rs path: /alsahwdep/src/auto/enums.rs // This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use glib::error::ErrorDomain; use glib::translate::*; use glib::value::FromValue; use ...
code_fim
hard
{ "lang": "rust", "repo": "alsa-project/alsa-gobject-rs", "path": "/alsahwdep/src/auto/enums.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match c { '-' => true, '.' => true, '_' => true, _ => c.is_alpha() || c.is_dec_digit(), } } fn parse_digit_or_wildcard(input: &str) -> IResult<&str, u32> { map( alt((digit1, value("4294967295", tag("*")))), |digit: &str| digit.parse().unwrap(), ...
code_fim
hard
{ "lang": "rust", "repo": "David-OConnor/pyflow", "path": "/src/dep_parser.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> use super::*; #[test] fn dummy_test() {} #[rstest(input, expected, case("*", Ok(("", Constraint::new(ReqType::Gte, Version::new(0, 0, 0))))), case("==1.9.2", Ok(("", Constraint::new(ReqType::Exact, Version::new(1, 9, 2))))), case("1.9.2", Ok(("", Constraint::new(R...
code_fim
hard
{ "lang": "rust", "repo": "David-OConnor/pyflow", "path": "/src/dep_parser.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: David-OConnor/pyflow path: /src/dep_parser.rs -> IResult<&str, Req> { // eg saturn = ">=0.3.4", as in pyproject.toml map( alt(( separated_pair( parse_package_name, tuple((space0, tag("="), space0)), delimited(quote, pars...
code_fim
hard
{ "lang": "rust", "repo": "David-OConnor/pyflow", "path": "/src/dep_parser.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DanielMorton/Sifaka path: /src/collaborative/mat/mod.rs use std::iter::Sum; use num_traits::{Num, Signed}; pub use mat::CsMatBaseExt; pub use mat_float::CsMatFloat; pub use vec::CsVecBaseExt; pub use vec_float::CsVecFloat; <|fim_suffix|>pub trait Value: Num + Sum + Copy + Clone + Signed + Par...
code_fim
medium
{ "lang": "rust", "repo": "DanielMorton/Sifaka", "path": "/src/collaborative/mat/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub trait Value: Num + Sum + Copy + Clone + Signed + PartialOrd {} impl<T> Value for T where T: Num + Sum + Copy + Clone + Signed + PartialOrd {}<|fim_prefix|>// repo: DanielMorton/Sifaka path: /src/collaborative/mat/mod.rs use std::iter::Sum; use num_traits::{Num, Signed}; pub use mat::CsMatBaseExt; p...
code_fim
medium
{ "lang": "rust", "repo": "DanielMorton/Sifaka", "path": "/src/collaborative/mat/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for event in events.iter() { for filter in event.filters() { if new_event.filters().contains(&filter) { return true; } } } false } /// Try to add an event to an event group. /// /// Return...
code_fim
hard
{ "lang": "rust", "repo": "gz/autoperf", "path": "/src/profile.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gz/autoperf path: /src/profile.rs ) { // TOR events requires filter_opc // Set to: 0x192 PrefData Prefetch Data into LLC but don’t pass to L2. Includes Hints PerfEvent::push_arg(&mut ret, String::from("filter_opc=0x192")); } ret } pub...
code_fim
hard
{ "lang": "rust", "repo": "gz/autoperf", "path": "/src/profile.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gz/autoperf path: /src/profile.rs value .split(",") .map(|x| x.trim()) .filter(|x| x.len() > 0) .collect() }) } pub fn match_filter(&self, filter: &str) -> bool { self.filters().contains(&filter) ...
code_fim
hard
{ "lang": "rust", "repo": "gz/autoperf", "path": "/src/profile.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let x = d.variable.id(); let n = self.nb_variables(); for (v, item) in benefits.iter_mut().enumerate().take(n).skip(x) { // for all unassigned vars *item = state.benef[v] + d.value * self.graph[(d.variable, Variable(v))]; } McpState {depth: 1 + state.dep...
code_fim
hard
{ "lang": "rust", "repo": "xgillard/ddo", "path": "/ddo/examples/mcp/model.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // The \( (s^k_k)^+ \) component let res = max(0, state.benef[d.variable.id()]); // The \( \sum_{l > k, s^k_l w_{kl} \le 0} \min\left\{ |s^k_l|, |w_{kl}| \right\} \) let mut sum = 0; for v in x..n { let skl = state.benef[v]; let wkl = self.gr...
code_fim
hard
{ "lang": "rust", "repo": "xgillard/ddo", "path": "/ddo/examples/mcp/model.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xgillard/ddo path: /ddo/examples/mcp/model.rs // Copyright 2020 Xavier Gillard // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including wit...
code_fim
hard
{ "lang": "rust", "repo": "xgillard/ddo", "path": "/ddo/examples/mcp/model.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// saving to disk let mut index_file = tempfile::tempfile()?; builder.write_index(&mut index_file)?; let mut elements_file = tempfile::tempfile()?; builder.write_elements(&mut elements_file)?; // loading (memory-mapping) index and vectors let elements = unsafe { angular::Vectors::from_file(&elements_fil...
code_fim
hard
{ "lang": "rust", "repo": "slckl/granne", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: slckl/granne path: /src/lib.rs //#![warn(clippy::all, clippy::pedantic, clippy::cargo)] #![deny(missing_docs)] /*! Granne (**g**raph-based **r**etrieval of **a**pproximate **n**earest **ne**ighbors) provides approximate nearest neighbor search among (typically) high-dimensional vectors. It focu...
code_fim
hard
{ "lang": "rust", "repo": "slckl/granne", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Ok(()) # } ``` */ mod elements; mod index; mod io; mod math; mod max_size_heap; mod odd_byte_int; mod slice_vector; use odd_byte_int::{FiveByteInt, ThreeByteInt}; pub use elements::{angular, angular_int, embeddings}; pub use elements::{Dist, ElementContainer, ExtendableElementContainer, Permutable}; ...
code_fim
hard
{ "lang": "rust", "repo": "slckl/granne", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rustwasm/wasm-bindgen path: /crates/web-sys/src/features/gen_Window.rs change(this: &Window, value: Option<&::js_sys::Function>); #[cfg(feature = "Worklet")] # [wasm_bindgen (structural , catch , method , getter , js_class = "Window" , js_name = paintWorklet)] #[doc = "Getter for the...
code_fim
hard
{ "lang": "rust", "repo": "rustwasm/wasm-bindgen", "path": "/crates/web-sys/src/features/gen_Window.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rustwasm/wasm-bindgen path: /crates/web-sys/src/features/gen_Window.rs eactivate(this: &Window, value: Option<&::js_sys::Function>); # [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = onvrdisplaypresentchange)] #[doc = "Getter for the `onvrdisplaypresentchang...
code_fim
hard
{ "lang": "rust", "repo": "rustwasm/wasm-bindgen", "path": "/crates/web-sys/src/features/gen_Window.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>sult<(), JsValue>; # [wasm_bindgen (structural , catch , method , getter , js_class = "Window" , js_name = scrollX)] #[doc = "Getter for the `scrollX` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollX)"] #[d...
code_fim
hard
{ "lang": "rust", "repo": "rustwasm/wasm-bindgen", "path": "/crates/web-sys/src/features/gen_Window.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: KappaDistributive/rsurl path: /src/main.rs extern crate reqwest; extern crate clap; #[macro_use] extern crate serde_derive; use clap::{App, Arg}; <|fim_suffix|>fn shorten_url(input: &str) -> Result<String, reqwest::Error> { let r: String = format!("https://is.gd/create.php?format=json&url=...
code_fim
medium
{ "lang": "rust", "repo": "KappaDistributive/rsurl", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let app = App::new("rsurl") .version("0.1.0") .author("Stefan Mesken") .about("Shortens a URL via is.gd") .arg(Arg::with_name("INPUT") .help("The URL to shorten") .required(true) .index(1)) .get_matches(); match sh...
code_fim
hard
{ "lang": "rust", "repo": "KappaDistributive/rsurl", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let url = Url::parse("http://httpbin.org/get").unwrap(); println!("{}", Request::new(url).param("foo", "bar").get().unwrap().body); }<|fim_prefix|>// repo: bluss/ease path: /examples/strings.rs extern crate ease; use ease::{Url, Request}; <|fim_middle|>fn main() {
code_fim
easy
{ "lang": "rust", "repo": "bluss/ease", "path": "/examples/strings.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }