text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|>// repo: SpaceManiac/opus-rs path: /tests/fec.rs
//! Test that supplying empty packets does forward error correction.
extern crate opus;
use opus::*;
<|fim_suffix|> let mut output = vec![0i16; 5760];
let size = opus.decode(&[], &mut output[..], true).unwrap();
assert_eq!(size, 5760);
}<|fim_... | code_fim | medium | {
"lang": "rust",
"repo": "SpaceManiac/opus-rs",
"path": "/tests/fec.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut output = vec![0i16; 5760];
let size = opus.decode(&[], &mut output[..], true).unwrap();
assert_eq!(size, 5760);
}<|fim_prefix|>// repo: SpaceManiac/opus-rs path: /tests/fec.rs
//! Test that supplying empty packets does forward error correction.
<|fim_middle|>extern crate opus;
use op... | code_fim | medium | {
"lang": "rust",
"repo": "SpaceManiac/opus-rs",
"path": "/tests/fec.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: lcgong/dcone path: /src/node/map.rs
use std::sync::Arc;
use im::HashMap;
use super::value::NodeValue;
#[derive(PartialEq)]
pub struct MapValue {
pub(crate) map: HashMap<String, Arc<NodeValue>>,
}
impl MapValue {
pub fn new() -> MapValue {
MapValue {
map: HashMap... | code_fim | hard | {
"lang": "rust",
"repo": "lcgong/dcone",
"path": "/src/node/map.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> MapValue {
map: self.map.clone()
}
}
}
impl ::std::fmt::Debug for MapValue {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut first = true;
fmt.write_str("{")?;
for (k, v) in self.map.iter() {
if !... | code_fim | hard | {
"lang": "rust",
"repo": "lcgong/dcone",
"path": "/src/node/map.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #[inline]
pub fn get_item(&self, key: &String) -> Option<&Arc<NodeValue>> {
return self.map.get(key)
}
pub fn remove(&self, key: &String) -> MapValue {
let mut new_map = self.map.clone();
new_map.remove(key);
MapValue {
map: new_map
}... | code_fim | hard | {
"lang": "rust",
"repo": "lcgong/dcone",
"path": "/src/node/map.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.count += 1;
self.hashes.push(h.finish());
}
}
pub struct Murmur128 {
count: usize,
counters1: Vec<usize>,
counters2: Vec<usize>,
hashes1: Vec<u64>,
hashes2: Vec<u64>,
}
impl Murmur128 {
pub fn new() -> Murmur128 {
Murmur128{
count: 0,
... | code_fim | hard | {
"lang": "rust",
"repo": "kerinin/hammer",
"path": "/src/simhash.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: kerinin/hammer path: /src/simhash.rs
use std::marker::PhantomData;
use std::hash::{Hasher, SipHasher};
use murmurhash3::{murmurhash3_x64_128};
use murmurhash3::{murmurhash3_x86_32};
use bit_matrix::BitTranspose;
/// SimHash hashes bytes to produce simhashes of type T
pub trait SimHash<T> {
... | code_fim | hard | {
"lang": "rust",
"repo": "kerinin/hammer",
"path": "/src/simhash.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Lucassifoni/imago path: /native/imago/src/imago/dithers.rs
use image::GenericImageView;
use rustler::{Env, NifResult, Term};
use rustler::Encoder;
use atoms;
use imago::image::pixel_luminance;
use imago::util::open_file_arg0;
pub fn threshold<'a>(env: Env<'a>, args: &[Term<'a>]) -> NifResult<T... | code_fim | hard | {
"lang": "rust",
"repo": "Lucassifoni/imago",
"path": "/native/imago/src/imago/dithers.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>pub fn dither_bayer<'a>(env: Env<'a>, args: &[Term<'a>]) -> NifResult<Term<'a>> {
if let Ok(f) = open_file_arg0(args[0]) {
let bayer_threshold_map = [
[15, 135, 45, 165],
[195, 75, 225, 105],
[60, 180, 30, 150],
[240, 120, 210, 90]
];
... | code_fim | hard | {
"lang": "rust",
"repo": "Lucassifoni/imago",
"path": "/native/imago/src/imago/dithers.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>w_mut+=5;
println!("*mut reference: {:?}", *raw_mut);
}
}<|fim_prefix|>// repo: addictedcoder0/Rusty path: /RustProg/rust_docs/raw_pointers/src/main.rs
fn main() {
let x = 5;
let raw = &x as *const i32;
unsaf<|fim_middle|>e{
println!("*const reference: {:?}", *raw);
}
let mut ... | code_fim | medium | {
"lang": "rust",
"repo": "addictedcoder0/Rusty",
"path": "/RustProg/rust_docs/raw_pointers/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: addictedcoder0/Rusty path: /RustProg/rust_docs/raw_pointers/src/main.rs
fn main() {
let x = 5;
let raw = &x as *const i32;
unsafe{
println!("*const reference: {:?}", *raw);
}
let mut<|fim_suffix|>w_mut+=5;
println!("*mut reference: {:?}", *raw_mut);
}
}<|fim_middle|> ... | code_fim | medium | {
"lang": "rust",
"repo": "addictedcoder0/Rusty",
"path": "/RustProg/rust_docs/raw_pointers/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Self {
workspaces: Some(vec![]),
tags: Some(tags),
layouts: layouts.names(),
layout_definitions: layouts.layouts,
layout_mode: LayoutMode::Tag,
// TODO: add sane default for scratchpad config.
// Currently default ... | code_fim | hard | {
"lang": "rust",
"repo": "leftwm/leftwm",
"path": "/leftwm/src/config/default.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let tags = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
.iter()
.map(|s| (*s).to_string())
.collect();
let scratchpad = ScratchPad {
name: "Alacritty".into(),
value: "alacritty".to_string(),
x: Some(Size::Pixel(860))... | code_fim | hard | {
"lang": "rust",
"repo": "leftwm/leftwm",
"path": "/leftwm/src/config/default.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: leftwm/leftwm path: /leftwm/src/config/default.rs
use leftwm_core::models::{ScratchPad, Size};
#[cfg(feature = "lefthk")]
use super::{default_terminal, exit_strategy, BaseCommand, Keybind};
use super::{Config, Default, FocusBehaviour, LayoutMode, ThemeSetting};
impl Default for Config {
//... | code_fim | hard | {
"lang": "rust",
"repo": "leftwm/leftwm",
"path": "/leftwm/src/config/default.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>1;
println!("The value of y is {}", y);
let y = y * MAX_POINTS;
println!("The value of y is {}", y);
}<|fim_prefix|>// repo: Andrew-xj/rust-demo path: /Chapter 3/lesson-3-1_variables/src/main.rs
const MAX_POINTS: u32 = 2;
fn main() {
// let x = 5; // immutable
println!("Test 1: mut... | code_fim | hard | {
"lang": "rust",
"repo": "Andrew-xj/rust-demo",
"path": "/Chapter 3/lesson-3-1_variables/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Andrew-xj/rust-demo path: /Chapter 3/lesson-3-1_variables/src/main.rs
const MAX_POINTS: u32 = 2;
fn main() {
// let x = 5; // immutable
println!("Test 1: mutable");
let <|fim_suffix|>Shadowing
println!("Test 2: shadow");
let y = 5;
println!("The value of y is {}", y);
... | code_fim | medium | {
"lang": "rust",
"repo": "Andrew-xj/rust-demo",
"path": "/Chapter 3/lesson-3-1_variables/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut replica_config = ReplicaConfig::new(&env.get_state_dir(), opts.no_artificial_delay);
replica_config.http_handler = http_handler;
Ok(replica_config)
}
/// Gets the configuration options for the Internet Computer replica as they were specified in the
/// dfx configuration file.
fn get_c... | code_fim | hard | {
"lang": "rust",
"repo": "jplevyak/sdk",
"path": "/src/dfx/src/commands/replica.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: jplevyak/sdk path: /src/dfx/src/commands/replica.rs
use crate::actors::shutdown_controller::ShutdownController;
use crate::actors::{start_emulator_actor, start_replica_actor, start_shutdown_controller};
use crate::config::dfinity::ConfigDefaultsReplica;
use crate::error_invalid_argument;
use cra... | code_fim | hard | {
"lang": "rust",
"repo": "jplevyak/sdk",
"path": "/src/dfx/src/commands/replica.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> port.map(|port| port.parse())
.unwrap_or_else(|| {
let default = 8080;
Ok(config.port.unwrap_or(default))
})
.map_err(|err| error_invalid_argument!("Invalid port number: {}", err))
}
fn start_replica(
env: &dyn Environment,
opts: ReplicaOpts,
... | code_fim | hard | {
"lang": "rust",
"repo": "jplevyak/sdk",
"path": "/src/dfx/src/commands/replica.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: tawawhite/stork path: /benches/basic.rs
use std::path::PathBuf;
use criterion::{criterion_group, criterion_main, Criterion};
fn build_federalist(c: &mut Criterion) {
<|fim_suffix|> c.bench_function("search::federalist::liberty", |b| {
b.iter(|| stork_search::search_with_index(&index... | code_fim | hard | {
"lang": "rust",
"repo": "tawawhite/stork",
"path": "/benches/basic.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>criterion_group!(benches, build_federalist, search_federalist_for_liberty);
criterion_main!(benches);<|fim_prefix|>// repo: tawawhite/stork path: /benches/basic.rs
use std::path::PathBuf;
use criterion::{criterion_group, criterion_main, Criterion};
fn build_federalist(c: &mut Criterion) {
let path ... | code_fim | hard | {
"lang": "rust",
"repo": "tawawhite/stork",
"path": "/benches/basic.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// If set, traversal will only happen along the checked-out head.
/// Otherwise it will take into consideration all remote branches, too
/// Also useful for bare-repositories
#[structopt(long = "head-only")]
head_only: bool,
/// the repository to index for queries
#[structopt... | code_fim | hard | {
"lang": "rust",
"repo": "Byron/git-commits-by-blob",
"path": "/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Byron/git-commits-by-blob path: /src/main.rs
extern crate failure;
extern crate failure_tools;
extern crate git2;
extern crate indicatif;
#[macro_use]
extern crate structopt;
extern crate crossbeam;
extern crate fixedbitset;
extern crate num_cpus;
extern crate walkdir;
use failure_tools::ok_or_... | code_fim | medium | {
"lang": "rust",
"repo": "Byron/git-commits-by-blob",
"path": "/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// The sum of all the rows of this matrix. The result is transposed and returned as a column vector.
///
/// # Example
///
/// ```
/// # use nalgebra::{Matrix2x3, Matrix3x2};
/// # use nalgebra::{Vector2, Vector3};
///
/// let m = Matrix2x3::new(1.0, 2.0, 3.0,
/// ... | code_fim | hard | {
"lang": "rust",
"repo": "dimforge/nalgebra",
"path": "/src/base/statistics.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> res
}
}
/// # Common statistics operations
impl<T: Scalar, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S> {
/*
*
* Sum computation.
*
*/
/// The sum of all the elements of this matrix.
///
/// # Example
///
/// ```
/// # use nalgebra... | code_fim | hard | {
"lang": "rust",
"repo": "dimforge/nalgebra",
"path": "/src/base/statistics.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: dimforge/nalgebra path: /src/base/statistics.rs
use crate::allocator::Allocator;
use crate::storage::RawStorage;
use crate::{Const, DefaultAllocator, Dim, Matrix, OVector, RowOVector, Scalar, VectorView, U1};
use num::{One, Zero};
use simba::scalar::{ClosedAdd, ClosedMul, Field, SupersetOf};
use... | code_fim | hard | {
"lang": "rust",
"repo": "dimforge/nalgebra",
"path": "/src/base/statistics.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> "RDHR register accessor: an alias for `Reg<RDHR_SPEC>`"]
pub type RDHR = crate::Reg<rdhr::RDHR_SPEC>;
#[doc = "receive FIFO mailbox data high register"]
pub mod rdhr;<|fim_prefix|>// repo: rust-lang/rustc-perf path: /collector/compile-benchmarks/stm32f4-0.14.0/src/stm32f407/can1/rx.rs
#[doc = "RIR regis... | code_fim | hard | {
"lang": "rust",
"repo": "rust-lang/rustc-perf",
"path": "/collector/compile-benchmarks/stm32f4-0.14.0/src/stm32f407/can1/rx.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: rust-lang/rustc-perf path: /collector/compile-benchmarks/stm32f4-0.14.0/src/stm32f407/can1/rx.rs
#[doc = "RIR register accessor: an alias for `Reg<RIR_SPEC>`"]
pub type RIR = crate::Reg<rir::RIR_SPEC>;
#[doc = "receive FIFO mailbox identifier register"]
pub mod ri<|fim_suffix|>doc = "RDLR regist... | code_fim | medium | {
"lang": "rust",
"repo": "rust-lang/rustc-perf",
"path": "/collector/compile-benchmarks/stm32f4-0.14.0/src/stm32f407/can1/rx.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: JasterV/chat-rooms-actix path: /src/messages/session/command.rs
use actix::Message as ActixMessage;
use derive_more::{Display, Error};
use std::convert::Into;
use std::str::FromStr;
<|fim_suffix|> fn from_str(data: &str) -> Result<Self, Self::Err> {
let words: Vec<&str> = data.trim()... | code_fim | hard | {
"lang": "rust",
"repo": "JasterV/chat-rooms-actix",
"path": "/src/messages/session/command.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if let Some((&command, words)) = opt {
return match command {
"/roomId" => Ok(Command::GetRoomId),
"/setName" if words.len() > 0 => Ok(Command::SetName(words[0].into())),
"/setName" => Err(CommandError {
msg: "Invalid ... | code_fim | hard | {
"lang": "rust",
"repo": "JasterV/chat-rooms-actix",
"path": "/src/messages/session/command.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let words: Vec<&str> = data.trim().split_whitespace().collect();
let opt = words.split_first();
if let Some((&command, words)) = opt {
return match command {
"/roomId" => Ok(Command::GetRoomId),
"/setName" if words.len() > 0 => Ok(Comman... | code_fim | hard | {
"lang": "rust",
"repo": "JasterV/chat-rooms-actix",
"path": "/src/messages/session/command.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Some(match self.inner {
StateError::ChannelError(_) => {
PhaseState::<R, Shutdown>::new(self.coordinator_state, self.request_rx).into()
}
_ => PhaseState::<R, Idle>::new(self.coordinator_state, self.request_rx).into(),
})
}
}<|fim_pre... | code_fim | hard | {
"lang": "rust",
"repo": "Pranay144/xaynet",
"path": "/rust/src/state_machine/phases/error.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Pranay144/xaynet path: /rust/src/state_machine/phases/error.rs
use crate::state_machine::{
coordinator::CoordinatorState,
phases::{Idle, Phase, PhaseName, PhaseState, Shutdown},
requests::RequestReceiver,
RoundFailed,
StateMachine,
};
use thiserror::Error;
/// Error that can... | code_fim | hard | {
"lang": "rust",
"repo": "Pranay144/xaynet",
"path": "/rust/src/state_machine/phases/error.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: mnts26/aws-sdk-rust path: /sdk/marketplaceentitlement/src/client.rs
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[derive(Debug)]
pub(crate) struct Handle<
C = smithy_client::erase::DynConnector,
M = aws_hyper::AwsMiddleware,
R = smithy_client::ret... | code_fim | hard | {
"lang": "rust",
"repo": "mnts26/aws-sdk-rust",
"path": "/sdk/marketplaceentitlement/src/client.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: 73nko/json-parser-toy path: /src/parsers/integer_parser.rs
use nom::{branch::alt, IResult};
use nom::bytes::complete::tag;
use nom::character::complete::{digit0, one_of};
use nom::combinator::{opt, recognize};
use nom::sequence::pair;
use crate::JSONParseError;
use crate::Node;
// This can be ... | code_fim | hard | {
"lang": "rust",
"repo": "73nko/json-parser-toy",
"path": "/src/parsers/integer_parser.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>pub fn json_integer(input: &str) -> IResult<&str, Node, JSONParseError> {
let (remain, raw_int) = integer_body(input)?;
match raw_int.parse::<i64>() {
Ok(i) => Ok((remain, Node::Integer(i))),
Err(_) => Err(nom::Err::Failure(JSONParseError::BadInt)),
}
}
#[test]
fn test_intege... | code_fim | hard | {
"lang": "rust",
"repo": "73nko/json-parser-toy",
"path": "/src/parsers/integer_parser.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let width = input.width();
let height = input.height();
let mut max_score = 0;
for x in 1..width - 1 {
for y in 1..height - 1 {
let x = x as isize;
let y = y as isize;
let current_tree = input.get((x, y).into())... | code_fim | hard | {
"lang": "rust",
"repo": "RSWilli/advent-of-code",
"path": "/2022/rust/days/08/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: RSWilli/advent-of-code path: /2022/rust/days/08/src/main.rs
use lib::{
spatial::{dense::SpatialDense, point2d::Point2D, spatial_trait::Spatial},
AOCError, AOCReader, AdventOfCode,
};
struct Day {}
fn visible(current: &usize, trees: &[&usize]) -> usize {
trees.iter().take_while(|t| ... | code_fim | hard | {
"lang": "rust",
"repo": "RSWilli/advent-of-code",
"path": "/2022/rust/days/08/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: zmilan/examples-1 path: /middleware/src/read_request_body.rs
use std::cell::RefCell;
use std::pin::Pin;
use std::rc::Rc;
use std::task::{Context, Poll};
use actix_service::{Service, Transform};
use actix_web::{dev::ServiceRequest, dev::ServiceResponse, Error, HttpMessage};
use bytes::BytesMut;
... | code_fim | hard | {
"lang": "rust",
"repo": "zmilan/examples-1",
"path": "/middleware/src/read_request_body.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Box::pin(async move {
let mut body = BytesMut::new();
let mut stream = req.take_payload();
while let Some(chunk) = stream.next().await {
body.extend_from_slice(&chunk?);
}
println!("request body: {:?}", body);
... | code_fim | medium | {
"lang": "rust",
"repo": "zmilan/examples-1",
"path": "/middleware/src/read_request_body.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: bejens/article path: /src/entity/article.rs
use rustorm::{rustorm_dao, FromDao, ToColumnNames, ToDao, ToTableName};
#[derive(Serialize, Deserialize, Clone, Debug, FromDao, ToColumnNames, ToTableName, ToDao)]
pub struct Article <|fim_suffix|>create_time: Option<i64>,
pub creator: Option<i64>... | code_fim | medium | {
"lang": "rust",
"repo": "bejens/article",
"path": "/src/entity/article.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>istParams {
pub page: i64,
pub size: i64,
pub title: Option<String>,
pub describe: Option<String>,
pub content: Option<String>,
pub article_type: Option<i32>,
}<|fim_prefix|>// repo: bejens/article path: /src/entity/article.rs
use rustorm::{rustorm_dao, FromDao, ToColumnNames, ToD... | code_fim | hard | {
"lang": "rust",
"repo": "bejens/article",
"path": "/src/entity/article.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: DoumanAsh/clipboard-master path: /src/lib.rs
//! Clipboard master
//!
//! Provides simple way to track updates of clipboard.
//!
//! ## Example:
//!
//! ```rust,no_run
//! extern crate clipboard_master;
//!
//! use clipboard_master::{Master, ClipboardHandler, CallbackResult};
//!
//! use std::io... | code_fim | hard | {
"lang": "rust",
"repo": "DoumanAsh/clipboard-master",
"path": "/src/lib.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #[inline(always)]
///Returns sleep interval for polling implementations (e.g. Mac).
///
///Default value is 500ms
fn sleep_interval(&self) -> core::time::Duration {
core::time::Duration::from_millis(500)
}
}
///Possible return values of callback.
pub enum CallbackResult {
... | code_fim | hard | {
"lang": "rust",
"repo": "DoumanAsh/clipboard-master",
"path": "/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: jbowles/algos_math_comp path: /rust_no_cargo/distances_among_pairs.rs
fn main() {
let mut v: Vec<i32> = vec![];
for i in 1..10 {
v.push(i)
};
let dists: Vec<f64> = distances_among_pairs(&mut v);
println!("{:?}", dists);
}
<|fim_suffix|> //println!("{:?}", v);
... | code_fim | medium | {
"lang": "rust",
"repo": "jbowles/algos_math_comp",
"path": "/rust_no_cargo/distances_among_pairs.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> //println!("{:?}", v);
let nin: usize = v.len();
/*
* length out output vector; two wasy to get it:
* let nout = (nin * nin - nin) /2;
* let nnout = (usize::pow(nin,2)-nin) /2;
*
* println!("nout: {}", nout);
* println!("nnout: {}", nnout);
*/
let mut dis... | code_fim | medium | {
"lang": "rust",
"repo": "jbowles/algos_math_comp",
"path": "/rust_no_cargo/distances_among_pairs.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut iter = input.split_whitespace();
let timestamp_result = iter.next().unwrap_or_default().parse();
if input.split_whitespace().count() < 2 || timestamp_result.is_err() {
return None;
} else {
let words: Vec<&str> = iter.collect();
let message: String = words.... | code_fim | medium | {
"lang": "rust",
"repo": "phudekar/rust_log_parser",
"path": "/src/messages/info_message.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[test]
fn should_not_parse_info_message_if_does_not_have_timestamp() {
let message = InfoMessage::parse("checking things");
assert!(message.is_none(), "Expected message to be empty");
}<|fim_prefix|>// repo: phudekar/rust_log_parser path: /src/messages/info_message.rs
use super::log_message::{Lo... | code_fim | hard | {
"lang": "rust",
"repo": "phudekar/rust_log_parser",
"path": "/src/messages/info_message.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: phudekar/rust_log_parser path: /src/messages/info_message.rs
use super::log_message::{LogMessage, LogMessageParser, MessageType};
#[derive(Debug)]
pub struct InfoMessage;
pub struct WarningMessage;
impl LogMessageParser for InfoMessage {
fn parse(input: &str) -> Option<LogMessage> {
<|fim... | code_fim | hard | {
"lang": "rust",
"repo": "phudekar/rust_log_parser",
"path": "/src/messages/info_message.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ireina7/leetcode.note path: /Rust/pascals-triangle-ii.rs
impl Solution {
pub fn get_row(row_index: i32) -> Vec<i32> {
let n = row_index as usize;
let mut ans = vec![1; n + 1];
for i in 1..=n {
<|fim_suffix|>mp[j-1] + tmp[j];
}
ans[i] = 1;
... | code_fim | medium | {
"lang": "rust",
"repo": "ireina7/leetcode.note",
"path": "/Rust/pascals-triangle-ii.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let tmp = ans.clone();
for j in 1..i {
ans[j] = tmp[j-1] + tmp[j];
}
ans[i] = 1;
}
ans
}
}<|fim_prefix|>// repo: ireina7/leetcode.note path: /Rust/pascals-triangle-ii.rs
impl Solution {
pub fn get_row(row_index: i32) -> Ve... | code_fim | medium | {
"lang": "rust",
"repo": "ireina7/leetcode.note",
"path": "/Rust/pascals-triangle-ii.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Triple-S-y-agregados/database-lib path: /src/models.rs
use super::schema::records;
<|fim_suffix|>#[derive(Insertable)]
#[table_name="records"]
pub struct NewRecord<'a> {
pub timestamp: &'a str,
pub voltage: &'a f32,
}<|fim_middle|>#[derive(Queryable,Clone)]
pub struct Record {
pub i... | code_fim | medium | {
"lang": "rust",
"repo": "Triple-S-y-agregados/database-lib",
"path": "/src/models.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[derive(Insertable)]
#[table_name="records"]
pub struct NewRecord<'a> {
pub timestamp: &'a str,
pub voltage: &'a f32,
}<|fim_prefix|>// repo: Triple-S-y-agregados/database-lib path: /src/models.rs
use super::schema::records;
<|fim_middle|>#[derive(Queryable,Clone)]
pub struct Record {
pub i... | code_fim | medium | {
"lang": "rust",
"repo": "Triple-S-y-agregados/database-lib",
"path": "/src/models.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// Specifies an additional include path to use during preprocessing.
pub fn include<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
self.extra_include_dirs.push(path.as_ref().to_owned());
self
}
/// Specifies an additional preprocessor definition to use during preproce... | code_fim | hard | {
"lang": "rust",
"repo": "FaultyRAM/windres-rs",
"path": "/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: FaultyRAM/windres-rs path: /src/lib.rs
// Copyright (c) 2017-2021 FaultyRAM
//
// 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 | hard | {
"lang": "rust",
"repo": "FaultyRAM/windres-rs",
"path": "/src/lib.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let next_word_id = model_output
.lm_logits
.get(0)
.get(-1)
.argmax(-1, true)
.int64_value(&[0]);
let next_word = tokenizer.decode(&[next_word_id], true, true);
assert_eq!(model_output.lm_logits.size(), vec!(1, 11, 50257));
match model_output.cache ... | code_fim | hard | {
"lang": "rust",
"repo": "guillaume-be/rust-bert",
"path": "/tests/distilgpt2.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> // Define input
let input = ["One two three four five six seven eight nine ten eleven"];
let tokenized_input = tokenizer.encode_list(&input, 128, &TruncationStrategy::LongestFirst, 0);
let max_len = tokenized_input
.iter()
.map(|input| input.token_ids.len())
.max... | code_fim | hard | {
"lang": "rust",
"repo": "guillaume-be/rust-bert",
"path": "/tests/distilgpt2.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: guillaume-be/rust-bert path: /tests/distilgpt2.rs
use rust_bert::gpt2::{
GPT2LMHeadModel, Gpt2Config, Gpt2ConfigResources, Gpt2MergesResources, Gpt2ModelResources,
Gpt2VocabResources,
};
use rust_bert::pipelines::generation_utils::Cache;
use rust_bert::resources::{RemoteResource, Resourc... | code_fim | hard | {
"lang": "rust",
"repo": "guillaume-be/rust-bert",
"path": "/tests/distilgpt2.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Ok(IndexRequest {
env: Arc::new(Mutex::new(AnyMap::new())),
_spoopy: PhantomData,
})
}
}<|fim_prefix|>// repo: ashleygwilliams/cargonauts path: /src/rigging/src/receive/mod.rs
use std::marker::PhantomData;
use std::sync::{Arc, Mutex};
use mainsail::{AnyMap, Re... | code_fim | hard | {
"lang": "rust",
"repo": "ashleygwilliams/cargonauts",
"path": "/src/rigging/src/receive/mod.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ashleygwilliams/cargonauts path: /src/rigging/src/receive/mod.rs
use std::marker::PhantomData;
use std::sync::{Arc, Mutex};
use mainsail::{AnyMap, ResourceEndpoint, Error};
<|fim_suffix|>pub mod middleware;
pub trait Receive<T: ResourceEndpoint>: Default + Clone {
fn get(&self, _: http::R... | code_fim | medium | {
"lang": "rust",
"repo": "ashleygwilliams/cargonauts",
"path": "/src/rigging/src/receive/mod.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: brooks-builds/exploring_rust_macros path: /src/main.rs
use bbecs::get_resource;
use bbecs::resources::resource::ResourceCast;
use bbecs::world::{World, WorldMethods};
// macro_rules! hello_world {
// () => {
// println!("hello unknown");
// };
// ($($name:expr), *) => {
//... | code_fim | hard | {
"lang": "rust",
"repo": "brooks-builds/exploring_rust_macros",
"path": "/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut world = bbecs::world::World::new();
world.add_resource("size".to_string(), 15.0_f32);
// let wrapped_resource = world.get_resource("size").unwrap().borrow();
// let resource: &f32 = wrapped_resource.cast().unwrap();
// let resource = get_resource!("size", world, f32);
// p... | code_fim | hard | {
"lang": "rust",
"repo": "brooks-builds/exploring_rust_macros",
"path": "/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: hearues-zueke-github/python_programs path: /rust/vec_own.rs
mod vec_own {
use std::fmt;
use std::ops;
pub struct VecOwn<T>(Vec<T>);
impl<T> VecOwn<T> {
pub fn new() -> Self {
let vec: Vec<T> = Vec::new();
return VecOwn::<T>(vec);
}
}... | code_fim | hard | {
"lang": "rust",
"repo": "hearues-zueke-github/python_programs",
"path": "/rust/vec_own.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> write!(f, "[")?;
for v in self.iter() {
write!(f, "{}, ", v)?;
}
write!(f, "]")?;
Ok(())
}
}
impl<T: fmt::UpperHex> fmt::UpperHex for VecOwn<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
... | code_fim | hard | {
"lang": "rust",
"repo": "hearues-zueke-github/python_programs",
"path": "/rust/vec_own.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl Iterator for ConcatCsv {
type Item = Result<(BString, u64), Error>;
fn next(&mut self) -> Option<Result<(BString, u64), Error>> {
loop {
if self.cur.is_none() {
match self.inputs.pop() {
None => return None,
Some(pat... | code_fim | hard | {
"lang": "rust",
"repo": "BurntSushi/fst",
"path": "/fst-bin/src/util.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: BurntSushi/fst path: /fst-bin/src/util.rs
use std::ascii;
use std::fs::File;
use std::io;
use std::path::{Path, PathBuf};
use bstr::{io::BufReadExt, BString};
use csv;
use fst::raw::{Fst, Output};
use fst::{IntoStreamer, Streamer};
use memmap2::Mmap;
use crate::Error;
pub unsafe fn mmap_fst<P... | code_fim | hard | {
"lang": "rust",
"repo": "BurntSushi/fst",
"path": "/fst-bin/src/util.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fn next(&mut self) -> Option<Result<(BString, u64), Error>> {
loop {
if self.cur.is_none() {
match self.inputs.pop() {
None => return None,
Some(path) => {
let rdr = match get_reader(Some(path)) {
... | code_fim | hard | {
"lang": "rust",
"repo": "BurntSushi/fst",
"path": "/fst-bin/src/util.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
let current_counter : u32;
self.executions_counter += 1;
// Create a copy
current_counter = self.executions_counter;
// Create execution record
let current_time = Utc::now();
// Create an execution record
let exec... | code_fim | hard | {
"lang": "rust",
"repo": "IncompleteWorlds/07_GSaaS_Rust",
"path": "/07_GSaaS_Rust/02_FDSaaS_R/src/backup/v5_20210103/tasks_manager.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: IncompleteWorlds/07_GSaaS_Rust path: /07_GSaaS_Rust/02_FDSaaS_R/src/backup/v5_20210103/tasks_manager.rs
/**
* (c) Incomplete Worlds 2020
* Alberto Fernandez (ajfg)
*
* FDS as a Service
* Tasks Manager
* It maintains a list of asynchronous tasks
*
*/
use std::sync::{Arc, Mutex, RwLock};... | code_fim | hard | {
"lang": "rust",
"repo": "IncompleteWorlds/07_GSaaS_Rust",
"path": "/07_GSaaS_Rust/02_FDSaaS_R/src/backup/v5_20210103/tasks_manager.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: cobalt-org/cobalt.rs path: /src/pagination/dates.rs
use crate::cobalt_model::pagination::DateIndex;
use crate::cobalt_model::DateTime;
use crate::document::Document;
use super::*;
use helpers::extract_scalar;
use paginator::Paginator;
#[derive(Debug, Clone)]
struct DateIndexHolder<'a> {
va... | code_fim | hard | {
"lang": "rust",
"repo": "cobalt-org/cobalt.rs",
"path": "/src/pagination/dates.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> date.iter().map(format_date_holder).collect()
}
fn walk_dates(
date_holder: &mut DateIndexHolder<'_>,
config: &PaginationConfig,
doc: &Document,
parent_dates: Option<Vec<DateIndexHolder<'_>>>,
) -> Result<Vec<Paginator>> {
let mut cur_date_holder_paginators: Vec<Paginator> = vec![... | code_fim | hard | {
"lang": "rust",
"repo": "cobalt-org/cobalt.rs",
"path": "/src/pagination/dates.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>//==============================================================================
// Linux data structures
//==============================================================================
#[cfg(target_os = "linux")]
pub type SockAddr = libc::sockaddr;
#[cfg(target_os = "linux")]
pub type SockAddrIn = lib... | code_fim | hard | {
"lang": "rust",
"repo": "jthelin/demikernel",
"path": "/src/rust/pal/data_structures.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[cfg(target_os = "linux")]
pub type SockAddr = libc::sockaddr;
#[cfg(target_os = "linux")]
pub type SockAddrIn = libc::sockaddr_in;
#[cfg(target_os = "linux")]
pub type Socklen = libc::socklen_t;<|fim_prefix|>// repo: jthelin/demikernel path: /src/rust/pal/data_structures.rs
// Copyright (c) Microsoft... | code_fim | hard | {
"lang": "rust",
"repo": "jthelin/demikernel",
"path": "/src/rust/pal/data_structures.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: jthelin/demikernel path: /src/rust/pal/data_structures.rs
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#[cfg(target_os = "windows")]
use windows::Win32::Networking::WinSock;
<|fim_suffix|>#[cfg(target_os = "linux")]
pub type SockAddrIn = libc::sockaddr_in;
#[cfg(... | code_fim | hard | {
"lang": "rust",
"repo": "jthelin/demikernel",
"path": "/src/rust/pal/data_structures.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let section = orig.serialize();
let mut buf = BytesMut::new();
portable_storage::write::<LittleEndian>(&mut buf, §ion);
let mut buf = buf.into_buf();
buf.set_position(0);
let section = portable_storage::read::<LittleEndian, _>(&mut buf).unwrap();
let deserialized = Version... | code_fim | hard | {
"lang": "rust",
"repo": "gogobook/xmr",
"path": "/portable-storage/tests/serde.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: gogobook/xmr path: /portable-storage/tests/serde.rs
#[macro_use]
extern crate portable_storage;
extern crate bytes;
use portable_storage::{Serialize, Deserialize};
#[derive(Default, Eq, PartialEq)]
pub struct VersionCommand {
pub version: u8,
}
serializable! {
VersionCommand { version... | code_fim | medium | {
"lang": "rust",
"repo": "gogobook/xmr",
"path": "/portable-storage/tests/serde.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut buf = buf.into_buf();
buf.set_position(0);
let section = portable_storage::read::<LittleEndian, _>(&mut buf).unwrap();
let deserialized = VersionCommand::deserialize(§ion).unwrap();
assert!(orig == deserialized);
}<|fim_prefix|>// repo: gogobook/xmr path: /portable-storag... | code_fim | hard | {
"lang": "rust",
"repo": "gogobook/xmr",
"path": "/portable-storage/tests/serde.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: gfx-rs/metal-rs path: /examples/raytracing/main.rs
extern crate objc;
use cocoa::{appkit::NSView, base::id as cocoa_id};
use core_graphics_types::geometry::CGSize;
use metal::*;
use objc::{rc::autoreleasepool, runtime::YES};
use std::mem;
use winit::{
event::{Event, WindowEvent},
event_... | code_fim | hard | {
"lang": "rust",
"repo": "gfx-rs/metal-rs",
"path": "/examples/raytracing/main.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>fn main() {
let events_loop = winit::event_loop::EventLoop::new();
let size = winit::dpi::LogicalSize::new(800, 600);
let window = winit::window::WindowBuilder::new()
.with_inner_size(size)
.with_title("Metal Raytracing Example".to_string())
.build(&events_loop)
... | code_fim | hard | {
"lang": "rust",
"repo": "gfx-rs/metal-rs",
"path": "/examples/raytracing/main.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let input = r#"<https://api.github.com/search/code?q=addClass+user%3Amozilla&page=15>; rel="next""#;
let res = link(input);
asserting("Parsing link-dir").that(&res).is_equal_to(Ok((
"",
Link {
url: "https://api.github.... | code_fim | hard | {
"lang": "rust",
"repo": "lukaspustina/github-watchtower",
"path": "/src/github/link.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: lukaspustina/github-watchtower path: /src/github/link.rs
use std::convert::TryFrom;
#[derive(Debug)]
pub struct Links<'a> {
pub first: Option<&'a str>,
pub prev: Option<&'a str>,
pub next: Option<&'a str>,
pub last: Option<&'a str>,
}
impl<'a> Default for Links<'a> {
fn def... | code_fim | hard | {
"lang": "rust",
"repo": "lukaspustina/github-watchtower",
"path": "/src/github/link.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// Return interface list or return a readable error message
fn read_interfaces(stream: &ClassInputStream) -> Result<ClassFragment, String> {
Err("Not implemented".to_string())
}
/// Return field list or return a readable error message
fn read_fields(stream: &ClassInputStream)... | code_fim | hard | {
"lang": "rust",
"repo": "clidev/rust-jvmti",
"path": "/src/bytecode/mod.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: clidev/rust-jvmti path: /src/bytecode/mod.rs
use self::classfile::*;
use self::constant::*;
use self::stream::{ ClassInputStream };
pub mod classfile;
pub mod collections;
pub mod constant;
pub mod stream;
///
/// Provides functionality for reading JVM class files as a whole
pub struct ClassRe... | code_fim | hard | {
"lang": "rust",
"repo": "clidev/rust-jvmti",
"path": "/src/bytecode/mod.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> // Send push notification
if let Err(e) = FCM.push(
"fcm",
&FCMPayloadData {
receiver_loc: &new_record.loc,
receiver_loc_kind: new_record.loc_kind.into(),
target_id: 0,
k... | code_fim | hard | {
"lang": "rust",
"repo": "cesindo/pandemia",
"path": "/src/event_handler/data_event_handler.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let dao = MapMarkerDao::new(conn);
let scope_meta = new_record
.meta
.iter()
.filter(|a| a.starts_with("loc_scope:"))
.map(|a| a.as_str())
.collect();
if let Ok(Some(marker)) = dao.get_by_name(&new_record.loc, scope_meta) {
// update
le... | code_fim | hard | {
"lang": "rust",
"repo": "cesindo/pandemia",
"path": "/src/event_handler/data_event_handler.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: cesindo/pandemia path: /src/event_handler/data_event_handler.rs
//! Event handler for data records
use chrono::prelude::*;
use diesel::prelude::*;
use crate::{
api::types,
dao::{FeedDao, MapMarkerDao, NotifDao},
event_handler::FCM,
eventstream::{self, Event::*},
geolocator,
... | code_fim | hard | {
"lang": "rust",
"repo": "cesindo/pandemia",
"path": "/src/event_handler/data_event_handler.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> busy_time += now.elapsed().as_nanos();
self.sender.send(Some(block_extra)).unwrap();
now = Instant::now();
}
None => break,
}
}
info!(
"ending fee processer total tx {}, busy... | code_fim | hard | {
"lang": "rust",
"repo": "rajarshimaitra/blocks_iterator",
"path": "/src/fee.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: rajarshimaitra/blocks_iterator path: /src/fee.rs
use crate::truncmap::TruncMap;
use crate::BlockExtra;
use bitcoin::{OutPoint, Script, Transaction, TxOut, Txid};
use log::{debug, info, trace};
use std::sync::mpsc::Receiver;
use std::sync::mpsc::SyncSender;
use std::time::Instant;
pub struct Fee... | code_fim | hard | {
"lang": "rust",
"repo": "rajarshimaitra/blocks_iterator",
"path": "/src/fee.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> debug!(
"#{:>6} {} size:{:>7} txs:{:>4} total_txs:{:>9} fee:{:?}",
block_extra.height,
block_extra.block_hash,
block_extra.size,
block_extra.block.txdata.len(),
... | code_fim | hard | {
"lang": "rust",
"repo": "rajarshimaitra/blocks_iterator",
"path": "/src/fee.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: pklazy/lpc54628-rust path: /src/pint/pmctrl.rs
#[doc = r"Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::PMCTRL {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
... | code_fim | hard | {
"lang": "rust",
"repo": "pklazy/lpc54628-rust",
"path": "/src/pint/pmctrl.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> match *self {
ENA_RXEVR::DISABLED => false,
ENA_RXEVR::ENABLED => true,
}
}
}
#[doc = r"Reader of the field"]
pub type ENA_RXEV_R = crate::FR<bool, ENA_RXEVR>;
impl ENA_RXEV_R {
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
... | code_fim | hard | {
"lang": "rust",
"repo": "pklazy/lpc54628-rust",
"path": "/src/pint/pmctrl.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Corallus-Caninus/windows-rs path: /crates/deps/sys/src/Windows/Win32/Security/Tpm/mod.rs
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub type ITpmVirtualSmartCardManager = *mut ::c... | code_fim | hard | {
"lang": "rust",
"repo": "Corallus-Caninus/windows-rs",
"path": "/crates/deps/sys/src/Windows/Win32/Security/Tpm/mod.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ERROR = 15i32;
pub const TPMVSCMGR_ERROR_GENERATE_FILESYSTEM: TPMVSCMGR_ERROR = 16i32;
pub const TPMVSCMGR_ERROR_CARD_CREATE: TPMVSCMGR_ERROR = 17i32;
pub const TPMVSCMGR_ERROR_CARD_DESTROY: TPMVSCMGR_ERROR = 18i32;
pub type TPMVSCMGR_STATUS = i32;
pub const TPMVSCMGR_STATUS_VTPMSMARTCARD_INITIALIZING: TP... | code_fim | hard | {
"lang": "rust",
"repo": "Corallus-Caninus/windows-rs",
"path": "/crates/deps/sys/src/Windows/Win32/Security/Tpm/mod.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Jimskapt/rust-book-fr path: /FRENCH/listings/ch17-oop/listing-17-08/src/main.rs
// ANCHOR: here
use gui::Affichable;
<|fim_suffix|> // code servant à afficher vraiment une liste déroulante
}
}
// ANCHOR_END: here
fn main() {}<|fim_middle|>struct ListeDeroulante {
largeur: u32,
... | code_fim | medium | {
"lang": "rust",
"repo": "Jimskapt/rust-book-fr",
"path": "/FRENCH/listings/ch17-oop/listing-17-08/src/main.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> // code servant à afficher vraiment une liste déroulante
}
}
// ANCHOR_END: here
fn main() {}<|fim_prefix|>// repo: Jimskapt/rust-book-fr path: /FRENCH/listings/ch17-oop/listing-17-08/src/main.rs
// ANCHOR: here
use gui::Affichable;
<|fim_middle|>struct ListeDeroulante {
largeur: u32,
... | code_fim | medium | {
"lang": "rust",
"repo": "Jimskapt/rust-book-fr",
"path": "/FRENCH/listings/ch17-oop/listing-17-08/src/main.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl Subcommand {
pub(crate) fn run(self, config: &Config) -> Result<(), Error> {
match self {
Self::Print(print) => print.run(config),
Self::Open(open) => open.run(config),
Self::Dump(dump) => dump.run(config),
}
}
}<|fim_prefix|>// repo: casey/odin path: /src/subcommand.rs... | code_fim | hard | {
"lang": "rust",
"repo": "casey/odin",
"path": "/src/subcommand.rs",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: casey/odin path: /src/subcommand.rs
use crate::common::*;
pub(crate) mod dump;
pub(crate) mod open;
pub(crate) mod print;
<|fim_suffix|>impl Subcommand {
pub(crate) fn run(self, config: &Config) -> Result<(), Error> {
match self {
Self::Print(print) => print.run(config),
Self... | code_fim | hard | {
"lang": "rust",
"repo": "casey/odin",
"path": "/src/subcommand.rs",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: swift-nav/libsbp path: /rust/sbp/tests/integration/auto_check_sbp_bootload_msg_bootloader_handshake_resp.rs
//
// Copyright (C) 2019-2021 Swift Navigation Inc.
// Contact: https://support.swiftnav.com
//
// This source is subject to the license found in the file 'LICENSE' which must
// be be dis... | code_fim | hard | {
"lang": "rust",
"repo": "swift-nav/libsbp",
"path": "/rust/sbp/tests/integration/auto_check_sbp_bootload_msg_bootloader_handshake_resp.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn get_plot_pyargs(&self, py: Python<'py>) -> &PyTuple {
// makes into &PyTuple to pass up to calling function
let (x, y) = self.data_as_np_array(py);
PyTuple::new(
py,
vec![x, y].into_iter(), // vec![self.x_data.to_owned(), self.y_data.to_owned()].i... | code_fim | hard | {
"lang": "rust",
"repo": "PhilDK1/rustmplotlib",
"path": "/src/plots/plot.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let x: &PyArray<T, Ix1> = PyArray::from_array(py, &self.x);
let y: &PyArray<T, Ix1> = PyArray::from_array(py, &self.y);
(x, y)
}
pub fn get_plot_pyargs(&self, py: Python<'py>) -> &PyTuple {
// makes into &PyTuple to pass up to calling function
let (x, y) = ... | code_fim | hard | {
"lang": "rust",
"repo": "PhilDK1/rustmplotlib",
"path": "/src/plots/plot.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.