text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>R {
#[doc = "Bits 0:31 - Received Octets"]
#[inline(always)]
pub fn rxo(&self) -> RXO_R {
RXO_R::new((self.bits & 0xffff_ffff) as u32)
}
}<|fim_prefix|>// repo: ju6ge/atsame70q21 path: /src/gmac/gmac_orlo.rs
#[doc = "Reader of register GMAC_ORLO"]
pub type R = crate::R<u32, super:... | code_fim | medium | {
"lang": "rust",
"repo": "ju6ge/atsame70q21",
"path": "/src/gmac/gmac_orlo.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ju6ge/atsame70q21 path: /src/gmac/gmac_orlo.rs
#[doc = "Reader of register GMAC_ORLO"]
pub type R = crate::R<u32, super::GMAC_ORLO>;
#[doc = "Reader of field `RXO`"]
pub type RXO_R = crate::R<u32, u32>;
impl <|fim_suffix|>xo(&self) -> RXO_R {
RXO_R::new((self.bits & 0xffff_ffff) as u32)
... | code_fim | medium | {
"lang": "rust",
"repo": "ju6ge/atsame70q21",
"path": "/src/gmac/gmac_orlo.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: bitshifter/mathbench-rs path: /benches/ray_sphere_intersect.rs
#![cfg_attr(feature = "unstable", feature(stmt_expr_attributes))]
#[path = "support/macros.rs"]
#[macro_use]
mod macros;
use criterion::{criterion_group, criterion_main, Criterion, Throughput};
#[cfg(any(feature = "ultraviolet_f32x... | code_fim | hard | {
"lang": "rust",
"repo": "bitshifter/mathbench-rs",
"path": "/benches/ray_sphere_intersect.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> $b.iter(|| {
for (ray_d, result) in data.ray_d.iter().zip(&mut data.result) {
do_inner(ray_d, result);
}
})
}};
}
fn bench_ray_sphere_intersect_scalar(c: &mut Criterion) {
let mut group = c.benchmark_group("scalar ray-sphere intersection");
... | code_fim | hard | {
"lang": "rust",
"repo": "bitshifter/mathbench-rs",
"path": "/benches/ray_sphere_intersect.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: oskarbraten/zelda path: /src/receiver.rs
pub use futures::channel::mpsc::{
channel, Receiver as InnerReceiver, Sender as InnerSender, TryRecvError, TrySendError,
};
use futures::StreamExt;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum RecvError {
#[error("No messages available.... | code_fim | medium | {
"lang": "rust",
"repo": "oskarbraten/zelda",
"path": "/src/receiver.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl<T> Receiver<T> {
pub fn new(receiver: InnerReceiver<T>) -> Self {
Self { receiver }
}
/// Asynchronously receive an event, returns [`None`] when the receiver is empty and disconnected.
pub async fn recv(&mut self) -> Option<T> {
self.receiver.next().await
}
/... | code_fim | hard | {
"lang": "rust",
"repo": "oskarbraten/zelda",
"path": "/src/receiver.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// Attempts to receive an event. This function is non-blocking.
pub fn try_recv(&mut self) -> Result<T, RecvError> {
match self.receiver.try_next() {
Ok(Some(t)) => Ok(t),
Ok(None) => Err(RecvError::Disconnected),
Err(_) => Err(RecvError::Empty),
... | code_fim | hard | {
"lang": "rust",
"repo": "oskarbraten/zelda",
"path": "/src/receiver.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn set_from_array (&mut self, data: &[Vector3<T>] ) -> &mut Self {
let mut max = Vector3::new_max();
let mut min = Vector3::new_max();
max.negate();
data
.iter()
.for_each( |e| {
max.max(e);
min.min(e);
});
self.set(min, max)
}
pub fn is_empty(&self) -> bool {
self.m... | code_fim | hard | {
"lang": "rust",
"repo": "pit-rpg/Viz",
"path": "/src/core/boundings.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: pit-rpg/Viz path: /src/core/boundings.rs
use helpers::Nums;
use math::{Vector, Vector3};
pub struct Rect<T>
where T: Nums,
{
pub width: T,
pub height: T,
pub x: T,
pub y: T,
}
#[derive(Clone, Debug)]
pub struct BBox3<T>
where
T:Nums
{
min: Vector3<T>,
max: Vector3<T>,
}
// pub struct ... | code_fim | hard | {
"lang": "rust",
"repo": "pit-rpg/Viz",
"path": "/src/core/boundings.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: JordanShurmer/solid-rust path: /server/tests/postman_tests.rs
use log::info;
use std::process::Command;
use tokio::runtime::Runtime;
use tokio::sync::oneshot;
#[tokio::test]
async fn run_postman() {
pretty_env_logger::init();
<|fim_suffix|> // TODO: use a channel to communicate that the... | code_fim | hard | {
"lang": "rust",
"repo": "JordanShurmer/solid-rust",
"path": "/server/tests/postman_tests.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> // TODO: use a channel to communicate that the server is ready rather than waiting
std::thread::yield_now();
std::thread::sleep(std::time::Duration::from_millis(25));
info!("starting the postman collection test suite");
let status = if cfg!(target_os = "windows") {
Command::ne... | code_fim | hard | {
"lang": "rust",
"repo": "JordanShurmer/solid-rust",
"path": "/server/tests/postman_tests.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>fn run() {
let root = slog_term::stderr().into_logger(o!());
slog_stdlog::set_logger(root).unwrap();
let reg_arc = Arc::new(Mutex::new(prometheus::Registry::new("0.0.0.0".to_string(), 6780)));
let counter_arc = Arc::new(Mutex::new(prometheus::Counter::new("sleep_count".to_string(),
... | code_fim | medium | {
"lang": "rust",
"repo": "moises-silva/prometheus-rs",
"path": "/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: moises-silva/prometheus-rs path: /src/main.rs
#[macro_use]
extern crate slog;
extern crate slog_term;
extern crate slog_stdlog;
#[macro_use]
extern crate log;
extern crate prometheus;
extern crate sys_info;
use std::thread;
use std::sync::{Arc, Mutex};
use std::time::Duration;
use sys_info::l... | code_fim | medium | {
"lang": "rust",
"repo": "moises-silva/prometheus-rs",
"path": "/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let predict_object = format!("{}/{}", out_dir, "test.o");
assemble(&predict_object, "test.asm");
Config::new()
.object(&predict_object)
.compile("libtest.a");
}<|fim_prefix|>// repo: kubo39/test path: /rust/asm/build.... | code_fim | medium | {
"lang": "rust",
"repo": "kubo39/test",
"path": "/rust/asm/build.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: kubo39/test path: /rust/asm/build.rs
extern crate gcc;
use gcc::Config;
use std::env;
use std::process::Command;
#[cfg(all(target_arch="x86_64", target_os="linux"))]
fn assemble(out_path: &str, in_path: &str) {
<|fim_suffix|> let out_dir = env::var("OUT_DIR").unwrap();
let predict_objec... | code_fim | medium | {
"lang": "rust",
"repo": "kubo39/test",
"path": "/rust/asm/build.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Zacch/Advent-of-Code-2020 path: /src/Day22.rs
use std::collections::{VecDeque, HashSet};
use std::fs;
use std::str::FromStr;
pub fn day22() {
let contents = fs::read_to_string("Input/Day22.txt").expect("Couldn't read the file");
let mut p1: VecDeque<i32> = VecDeque::new();
let mut ... | code_fim | hard | {
"lang": "rust",
"repo": "Zacch/Advent-of-Code-2020",
"path": "/src/Day22.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>fn sub_game(p1_super_game: &VecDeque<i32>, p2_super_game: &VecDeque<i32>) -> bool {
let mut history = HashSet::new();
let mut p1 = VecDeque::new();
for i in 1..=*p1_super_game.front().unwrap() as usize {
p1.push_back(p1_super_game[i]);
}
let mut p2 = VecDeque::new();
for i ... | code_fim | hard | {
"lang": "rust",
"repo": "Zacch/Advent-of-Code-2020",
"path": "/src/Day22.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: gahag/reminder-bot path: /src/controller/action/parser/tests.rs
use super::*;
// TODO: add more tests
#[test]
fn test_add() {
let chat_id = 0.into();
let parse = |input| super
::parse(chat_id, input)
.expect("parse failed");
let date = |str| Date
::parse_from_str(str, "%Y-%m-%d")
... | code_fim | hard | {
"lang": "rust",
"repo": "gahag/reminder-bot",
"path": "/src/controller/action/parser/tests.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#[test]
fn test_list() {
let chat_id = 0.into();
let parse = |input| super
::parse(chat_id, input)
.expect("parse failed");
assert_eq!(
parse("chora"),
Action::ListReminders(chat_id),
);
assert_eq!(
parse(" chora "),
Action::ListReminders(chat_id),
);
}
#[test]
fn test_remove()... | code_fim | hard | {
"lang": "rust",
"repo": "gahag/reminder-bot",
"path": "/src/controller/action/parser/tests.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if let Err(err) = cli::run() {
println!("error: {}", err);
std::process::exit(1);
}
}<|fim_prefix|>// repo: mitsuhiko/logteewoop path: /src/main.rs
//! logteewoop is a work in progress thing that lets you tee stdout/stderr
//! to a remote logteewoop service.
mod actors;
mod cli;
m... | code_fim | easy | {
"lang": "rust",
"repo": "mitsuhiko/logteewoop",
"path": "/src/main.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: mitsuhiko/logteewoop path: /src/main.rs
//! logteewoop is a work in progress thing that lets you tee stdout/stderr
//! to a remote logteewoop service.
mod actors;
mod cli;
mod server;
<|fim_suffix|> if let Err(err) = cli::run() {
println!("error: {}", err);
std::process::exit... | code_fim | easy | {
"lang": "rust",
"repo": "mitsuhiko/logteewoop",
"path": "/src/main.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl Error for DirError {
fn description(&self) -> &str {
match *self {
DirNodeErr(ref inner) => inner.description(),
NoSuchDirectory => "The directory does not exist",
IsNotDirectory => "The requested object is not a directory",
DirectoryNotEmpt... | code_fim | hard | {
"lang": "rust",
"repo": "Sawchord/strato-fs",
"path": "/strato/src/error.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Sawchord/strato-fs path: /strato/src/error.rs
use std::error::Error;
use std::fmt::{Display, Formatter, Result};
use libc::*;
use self::NodeError::*;
use self::FileError::*;
use self::DirError::*;
use std::any::Any;
pub trait IsFileError {}
pub trait IsDirError {}
impl IsFileError for NodeEr... | code_fim | hard | {
"lang": "rust",
"repo": "Sawchord/strato-fs",
"path": "/strato/src/error.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub(crate) fn get_libc_code(&self) -> i32 {
match *self {
FileNodeErr(ref inner) => inner.get_libc_code(),
NoSuchFile => ENOENT,
IsDirectory => EISDIR,
FileExists => EEXIST,
}
}
}
#[derive (Debug, Clone)]
pub enum DirError {
Dir... | code_fim | hard | {
"lang": "rust",
"repo": "Sawchord/strato-fs",
"path": "/strato/src/error.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl PartialOrd for QueryResult {
fn partial_cmp(&self, other: &QueryResult) -> Option<Ordering> {
Some(self.cmp(other))
}
}
pub struct QueryResults {
heap: BinaryHeap<QueryResult>
}
impl QueryResults {
pub fn new() -> Self {
QueryResults { heap: BinaryHeap::new() }
}... | code_fim | hard | {
"lang": "rust",
"repo": "olivernn/ff",
"path": "/src/query_result.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: olivernn/ff path: /src/query_result.rs
use termion::style;
use std::collections::{BinaryHeap, HashSet};
use std::cmp::Ordering;
use std::iter::FromIterator;
use std::fmt;
use query::Match;
pub struct QueryResult {
pub path: String,
pub score: usize,
pub positions: HashSet<usize>
}... | code_fim | hard | {
"lang": "rust",
"repo": "olivernn/ff",
"path": "/src/query_result.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Some(self.cmp(other))
}
}
pub struct QueryResults {
heap: BinaryHeap<QueryResult>
}
impl QueryResults {
pub fn new() -> Self {
QueryResults { heap: BinaryHeap::new() }
}
pub fn insert(&mut self, query_result: QueryResult) {
self.heap.push(query_result)
}
... | code_fim | hard | {
"lang": "rust",
"repo": "olivernn/ff",
"path": "/src/query_result.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[derive(Clone, Copy, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum LogEntry {
ReceivedStorageRequest,
SentStorageResponse,
StorageServiceError,
}<|fim_prefix|>// repo: richardsj/libra path: /state-sync/storage-service/server/src/logging.rs
// Copyright (c) The Diem Core Contributo... | code_fim | hard | {
"lang": "rust",
"repo": "richardsj/libra",
"path": "/state-sync/storage-service/server/src/logging.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: richardsj/libra path: /state-sync/storage-service/server/src/logging.rs
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::Error;
use diem_logger::Schema;
use serde::Serialize;
use storage_service_types::StorageServiceRequest;
<|fim_suffix|>#[derive(C... | code_fim | hard | {
"lang": "rust",
"repo": "richardsj/libra",
"path": "/state-sync/storage-service/server/src/logging.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: nabijaczleweli/checksums path: /src/util.rs
//! Module containing various utility functions
use std::path::Path;
use std::iter;
/// Merges two `Vec`s.
///
/// # Examples
///
/// ```
/// let vec1 = vec![0];
/// let vec2 = vec![1];
///
/// assert_eq!(checksums::util::vec_merge(vec1, vec2), vec... | code_fim | hard | {
"lang": "rust",
"repo": "nabijaczleweli/checksums",
"path": "/src/util.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>/// Create a user-usable path to `what` from `prefix`.
///
/// # Examples
///
/// ```
/// # use std::path::Path;
/// assert_eq!(checksums::util::relative_name(Path::new("/usr"), Path::new("/usr/bin/checksums")),
/// "bin/checksums".to_string());
/// ```
pub fn relative_name(prefix: &Path, what:... | code_fim | hard | {
"lang": "rust",
"repo": "nabijaczleweli/checksums",
"path": "/src/util.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>fn read_block(
block_dev: &mut File,
block_size: u32,
offset: u64,
expected: u8,
) -> std::io::Result<()> {
block_dev.seek(SeekFrom::Start(offset * u64::from(block_size)))?;
let mut data: Vec<u8> = vec![0; block_size as usize];
block_dev.read_exact(&mut data)?;
if !data.ite... | code_fim | hard | {
"lang": "rust",
"repo": "gnoliyil/fuchsia",
"path": "/src/virtualization/tests/virtio_block_test_util/src/linux_main.rs",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /src/virtualization/tests/virtio_block_test_util/src/linux_main.rs
// Copyright 2018 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.
#![deny(warnings)]
use libc;
use std::fs:... | code_fim | hard | {
"lang": "rust",
"repo": "gnoliyil/fuchsia",
"path": "/src/virtualization/tests/virtio_block_test_util/src/linux_main.rs",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: fflorent/espadon path: /src/statements.rs
use expressions::{expression, expression_without_ws, Expression};
use misc::{Identifier, identifier, StrSpan, Location};
/// [A variable declarator]
/// (https://github.com/estree/estree/blob/master/es5.md#variabledeclarator)
#[derive(Debug, PartialEq)]... | code_fim | hard | {
"lang": "rust",
"repo": "fflorent/espadon",
"path": "/src/statements.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>named!(variable_declarator< StrSpan, VariableDeclarator >, es_parse!({
id: identifier >>
init: opt!(
do_parse!(
ws!(tag!("=")) >>
res: expression_without_ws >>
(res)
)
)
} => (VariableDeclarator {
i... | code_fim | hard | {
"lang": "rust",
"repo": "fflorent/espadon",
"path": "/src/statements.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if !path.exists(){
return String::new();
}
// Open the path in read-only mode
let mut file = match File::open(&path) {
Err(why) => panic!("couldn't open {}: {}", display, why.description()),
Ok(file) => file,
};
// Read the file contents into a string
... | code_fim | hard | {
"lang": "rust",
"repo": "alaminopu/kctl",
"path": "/src/config.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> // Read the file contents into a string
let mut s = String::new();
file.read_to_string(&mut s).expect("Couldn't read value from config!");
let val: Vec<&str> = s.split("=").collect();
String::from(val[1])
}
#[cfg(test)]
mod tests{
use super::*;
#[test]
fn test_set(){
... | code_fim | medium | {
"lang": "rust",
"repo": "alaminopu/kctl",
"path": "/src/config.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: alaminopu/kctl path: /src/config.rs
extern crate dirs;
use std::error::Error;
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;
use std::panic;
// Set value to config file
pub fn set(key: &str, value: &str){
// Create a path to the desired file
let home = dirs::home_d... | code_fim | medium | {
"lang": "rust",
"repo": "alaminopu/kctl",
"path": "/src/config.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: bottlerocket-os/bottlerocket path: /sources/api/pluto/src/eks.rs
use crate::aws::sdk_config;
use crate::{aws, proxy};
use aws_sdk_eks::types::KubernetesNetworkConfigResponse;
use snafu::{OptionExt, ResultExt, Snafu};
use std::time::Duration;
// Limit the timeout for the EKS describe cluster API... | code_fim | medium | {
"lang": "rust",
"repo": "bottlerocket-os/bottlerocket",
"path": "/sources/api/pluto/src/eks.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #[snafu(display("Timed-out waiting for EKS Describe Cluster API response: {}", source))]
DescribeClusterTimeout { source: tokio::time::error::Elapsed },
#[snafu(display("Missing field '{}' in EKS response", field))]
Missing { field: &'static str },
#[snafu(context(false), display("{}... | code_fim | hard | {
"lang": "rust",
"repo": "bottlerocket-os/bottlerocket",
"path": "/sources/api/pluto/src/eks.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: drewet/vulkano path: /vulkano/src/pipeline/viewport.rs
use std::ops::Range;
use vk;
#[derive(Debug, Clone)]
pub enum ViewportsState {
Fixed {
data: Vec<(Viewport, Scissor)>,
},
DynamicViewports {
scissors: Vec<Scissor>,
},
DynamicScissors {
viewport... | code_fim | hard | {
"lang": "rust",
"repo": "drewet/vulkano",
"path": "/vulkano/src/pipeline/viewport.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[derive(Debug, Clone)]
pub struct Viewport {
pub origin: [f32; 2],
pub dimensions: [f32; 2],
pub depth_range: Range<f32>,
}
#[doc(hidden)]
impl Into<vk::Viewport> for Viewport {
#[inline]
fn into(self) -> vk::Viewport {
vk::Viewport {
x: self.origin[0],
... | code_fim | hard | {
"lang": "rust",
"repo": "drewet/vulkano",
"path": "/vulkano/src/pipeline/viewport.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: baloo/cbor path: /tests/canonical.rs
extern crate serde_cbor;
use serde_cbor::ObjectKey;
#[test]
fn integer_canonical_sort_order() {
let expected = [
0, 23, 24, 255, 256, 65535, 65536, 4294967295,
-1, -24, -25, -256, -257, -65536, -65537, -4294967296,
].into_iter().map(|... | code_fim | hard | {
"lang": "rust",
"repo": "baloo/cbor",
"path": "/tests/canonical.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[test]
fn major_type_canonical_sort_order() {
let expected = vec![
ObjectKey::Integer(0),
ObjectKey::Integer(-1),
ObjectKey::Bytes(vec![]),
ObjectKey::String("".to_string()),
ObjectKey::Null,
].into_iter().collect::<Vec<_>>();
let mut sorted = expected... | code_fim | hard | {
"lang": "rust",
"repo": "baloo/cbor",
"path": "/tests/canonical.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: input-output-hk/chain-libs path: /chain-impl-mockchain/src/testing/scenario/template/mod.rs
mod builders;
use crate::key::EitherEd25519SecretKey;
use crate::ledger::governance::{ParametersGovernanceAction, TreasuryGovernanceAction};
use crate::testing::data::AddressData;
use crate::testing::dat... | code_fim | hard | {
"lang": "rust",
"repo": "input-output-hk/chain-libs",
"path": "/chain-impl-mockchain/src/testing/scenario/template/mod.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn from_vote_plan<S: Into<String>>(
alias: S,
owner_alias: Option<S>,
vote_plan: &VotePlan,
) -> VotePlanDef {
let mut builder = VotePlanDefBuilder::new(&alias.into());
if let Some(owner_alias) = owner_alias {
builder.owner(&owner_alias.into... | code_fim | hard | {
"lang": "rust",
"repo": "input-output-hk/chain-libs",
"path": "/chain-impl-mockchain/src/testing/scenario/template/mod.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: technetos/heatshield path: /src/refresh_token.rs
use crate::schema::refresh_tokens;
<|fim_suffix|>#[resource]
struct RefreshToken {
uuid: Uuid,
}<|fim_middle|>use compat_uuid::Uuid;
use diesel::{
self, delete, insert_into, prelude::*, result::Error, update, Associations, FromSqlRow,
... | code_fim | medium | {
"lang": "rust",
"repo": "technetos/heatshield",
"path": "/src/refresh_token.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[resource]
struct RefreshToken {
uuid: Uuid,
}<|fim_prefix|>// repo: technetos/heatshield path: /src/refresh_token.rs
use crate::schema::refresh_tokens;
<|fim_middle|>use compat_uuid::Uuid;
use diesel::{
self, delete, insert_into, prelude::*, result::Error, update, Associations, FromSqlRow,
... | code_fim | medium | {
"lang": "rust",
"repo": "technetos/heatshield",
"path": "/src/refresh_token.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn botan_bcrypt_generate(
out: *mut u8,
out_len: *mut usize,
password: *const c_char,
rng: botan_rng_t,
work_factor: usize,
flags: u32,
) -> c_int;
pub fn botan_bcrypt_is_valid(pass: *const c_char, hash: *const c_char) -> c_int;
}<|fim_pref... | code_fim | easy | {
"lang": "rust",
"repo": "randombit/botan-rs",
"path": "/botan-sys/src/passhash.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: randombit/botan-rs path: /botan-sys/src/passhash.rs
use crate::ffi_types::{c_char, c_int};
use crate::rng::botan_rng_t;
<|fim_suffix|> pub fn botan_bcrypt_generate(
out: *mut u8,
out_len: *mut usize,
password: *const c_char,
rng: botan_rng_t,
work_fac... | code_fim | easy | {
"lang": "rust",
"repo": "randombit/botan-rs",
"path": "/botan-sys/src/passhash.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let order_range = 0..=100usize;
order_range
.prop_flat_map(|order| {
let size_range = if order > 0 { 0..=100usize } else { 0..=0 };
(
proptest::strategy::Just(order),
proptest::collection::vec(((0..order), (0..order)), size_range),
)
})
.prop_map(|(order, edges)| TestGra... | code_fim | hard | {
"lang": "rust",
"repo": "cbbowen/sif",
"path": "/src/model/test_graph.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: cbbowen/sif path: /src/model/test_graph.rs
use super::sparse;
use crate::{
map::{Map, MapMut},
Digraph, InGraph, InsertGraph, OutGraph,
};
use std::{borrow::Borrow, collections::HashSet};
use proptest::{
arbitrary::Arbitrary,
strategy::{BoxedStrategy, Strategy},
};
type Vert = usize;
type... | code_fim | hard | {
"lang": "rust",
"repo": "cbbowen/sif",
"path": "/src/model/test_graph.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> // Build an identity mapping.
let mut map = g.ephemeral_vert_map(None);
for v in g.verts() {
assert_eq!(*map.get(v).borrow(), None);
*map.get_mut(v) = Some(v);
}
// Verify the set values are retained.
for v in g.verts() {
assert_eq!(*map.get(v).borrow(), Some(v));
}
}
fn assert_ephemeral_edg... | code_fim | hard | {
"lang": "rust",
"repo": "cbbowen/sif",
"path": "/src/model/test_graph.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>pub use fsmc::FSMC;
pub use pwr::PWR;
pub use rcc::RCC;
pub use gpioa::{GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG};
pub use afio::AFIO;
pub use exti::EXTI;
pub use dma1::{DMA1, DMA2};
pub use sdio::SDIO;
pub use rtc::RTC;
pub use bkp::BKP;
pub use iwdg::IWDG;
pub use wwdg::WWDG;
pub use tim1::{TIM1,... | code_fim | hard | {
"lang": "rust",
"repo": "nicholastmosher/stm32f103xx",
"path": "/src/lib.rs",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: nicholastmosher/stm32f103xx path: /src/lib.rs
# ! [ doc = "Peripheral access API for STM32F103XX microcontrollers (generated using svd2rust v0.9.1)\n\nYou can find an overview of the API [here].\n\n[here]: https://docs.rs/svd2rust/0.9.1/svd2rust/#peripheral-api" ]
# ! [ deny ( missing_docs ) ]
... | code_fim | hard | {
"lang": "rust",
"repo": "nicholastmosher/stm32f103xx",
"path": "/src/lib.rs",
"mode": "psm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|>struct Bug<const N: fn(usize)>;
fn main() {
let x = Bug::<{
unsafe { transmute(|x: u8| {}) }
}>;
}<|fim_prefix|>// repo: rust-lang/glacier path: /fixed/61455.rs
#![feature(const_generics)]
#![feature(const_compare_raw_pointers)]
<|fim_middle|>use std::mem::transmute;
| code_fim | easy | {
"lang": "rust",
"repo": "rust-lang/glacier",
"path": "/fixed/61455.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: rust-lang/glacier path: /fixed/61455.rs
#![feature(const_generics)]
#![feature(const_compare_raw_pointers)]
<|fim_suffix|> let x = Bug::<{
unsafe { transmute(|x: u8| {}) }
}>;
}<|fim_middle|>use std::mem::transmute;
struct Bug<const N: fn(usize)>;
fn main() {
| code_fim | medium | {
"lang": "rust",
"repo": "rust-lang/glacier",
"path": "/fixed/61455.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Yinet-project/dislog-hal path: /src/macros.rs
macro_rules! macros_l_self_r_ref_inner {
($self_:ident, $fn_name: ident, $hs_type: ident, $rhs_o: ident, $body:expr, $output: ty) => {
fn $fn_name($self_, $rhs_o: &'b $hs_type<T>) -> $output {
$body
}
};
}
macro_r... | code_fim | hard | {
"lang": "rust",
"repo": "Yinet-project/dislog-hal",
"path": "/src/macros.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> macros_l_self_r_ref_inner! {self, $fn_name, $hs_type, rhs_o, { (&self).$fn_name(rhs_o) }, $output}
}
};
}
macro_rules! define_l_val_r_val {
(
$hs_type: ident,
$hs_a: ident,
$trait_name: ident,
$fn_name: ident,
$output: ty
) => {
... | code_fim | hard | {
"lang": "rust",
"repo": "Yinet-project/dislog-hal",
"path": "/src/macros.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn element_size(&self) -> Option<i32> {
match self {
InstanceSize::PrimitiveArray(esize) => Some(*esize),
InstanceSize::ObjArray => Some(mem::ptr_width()),
InstanceSize::Str => Some(1),
InstanceSize::Fixed(_) => None,
InstanceSize... | code_fim | hard | {
"lang": "rust",
"repo": "dinfuehr/dora",
"path": "/dora-runtime/src/size.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: dinfuehr/dora path: /dora-runtime/src/size.rs
use crate::mem;
use crate::object::Header;
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum InstanceSize {
Fixed(i32),
PrimitiveArray(i32),
ObjArray,
UnitArray,
StructArray(i32),
FreeArray,
CodeObject,
Str,
}
<|... | code_fim | hard | {
"lang": "rust",
"repo": "dinfuehr/dora",
"path": "/dora-runtime/src/size.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: notgull/tasinput2 path: /src/lib.rs
/*
* src/lib.rs
* tasinput2 - Plugin for creating TAS inputs
*
* This file is part of tasinput2.
*
* tasinput2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Sof... | code_fim | hard | {
"lang": "rust",
"repo": "notgull/tasinput2",
"path": "/src/lib.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> 0
}) {
Ok(_) => m64p_sys::m64p_error_M64ERR_SUCCESS,
Err(e) => {
dprintln!("Panic occurred during startup: {:?}", e);
m64p_sys::m64p_error_M64ERR_SYSTEM_FAIL
}
}
}
/// Put the DLL's information into a plugin information struct.
///
/// # Saf... | code_fim | hard | {
"lang": "rust",
"repo": "notgull/tasinput2",
"path": "/src/lib.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: chadrc/simple-expression-language path: /sel_common/src/sel_types/pair.rs
use crate::{DataType, SELValue};
#[derive(Clone, Serialize, Deserialize)]
pub struct Pair {
left: SELValue,
right: SELValue,
}
impl Pair {
pub fn empty() -> Self {
return Pair {
left: SELV... | code_fim | medium | {
"lang": "rust",
"repo": "chadrc/simple-expression-language",
"path": "/sel_common/src/sel_types/pair.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn get_left(&self) -> &SELValue {
return &self.left;
}
pub fn get_right(&self) -> &SELValue {
return &self.right;
}
}<|fim_prefix|>// repo: chadrc/simple-expression-language path: /sel_common/src/sel_types/pair.rs
use crate::{DataType, SELValue};
#[derive(Clone, Seri... | code_fim | medium | {
"lang": "rust",
"repo": "chadrc/simple-expression-language",
"path": "/sel_common/src/sel_types/pair.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> fn set_config_options(&mut self) -> QueryResult<()> {
self.execute("SET sql_mode=(SELECT CONCAT(@@sql_mode, ',PIPES_AS_CONCAT'))")?;
self.execute("SET time_zone = '+00:00';")?;
self.execute("SET character_set_client = 'utf8mb4'")?;
self.execute("SET character_set_connec... | code_fim | hard | {
"lang": "rust",
"repo": "Diggsey/diesel",
"path": "/diesel/src/mysql/connection/mod.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Diggsey/diesel path: /diesel/src/mysql/connection/mod.rs
mod bind;
mod raw;
mod stmt;
mod url;
use self::raw::RawConnection;
use self::stmt::iterator::StatementIterator;
use self::stmt::Statement;
use self::url::ConnectionOptions;
use super::backend::Mysql;
use crate::connection::commit_error_p... | code_fim | hard | {
"lang": "rust",
"repo": "Diggsey/diesel",
"path": "/diesel/src/mysql/connection/mod.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> let field = Field::new(FieldType::King, player_color);
self.update_single_state(x, y, field);
}
for y in 0..10 {
for x in 0..10 {
self.send_single_state(x, y);
}
}
}
}
}
pu... | code_fim | hard | {
"lang": "rust",
"repo": "WisartArfun/Divisionaries",
"path": "/ancient_src/logic/game.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: WisartArfun/Divisionaries path: /ancient_src/logic/game.rs
use std::sync::{Arc, Mutex};
use rand::{self, Rng};
use crate::logic::client;
use crate::web_socket;
use std::thread;
use std::time::Duration;
use crate::http_server::game_manager;
enum FieldType {
Ground,
Fog,
King,
}
... | code_fim | hard | {
"lang": "rust",
"repo": "WisartArfun/Divisionaries",
"path": "/ancient_src/logic/game.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.set_edx((v >> 32) as u32)?;
self.set_eax(v as u32)?;
Ok(())
}
pub fn msr_from_reg(&mut self) -> Result<(), EmuException> {
let addr = self.ac.get_gpreg(GpReg32::ECX)?;
let v = ((self.get_edx()? as u64) << 32) + self.get_eax()? as u64;
self.ac.... | code_fim | hard | {
"lang": "rust",
"repo": "shift-crops/x64emu",
"path": "/src/emulator/instruction/exec/misc.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: shift-crops/x64emu path: /src/emulator/instruction/exec/misc.rs
use std::convert::TryFrom;
use crate::emulator::*;
use crate::emulator::access::register::*;
impl<'a> super::Exec<'a> {
pub fn cr_to_reg(&mut self) -> Result<(), EmuException> {
let cr = self.ac.get_creg(self.idata.modr... | code_fim | hard | {
"lang": "rust",
"repo": "shift-crops/x64emu",
"path": "/src/emulator/instruction/exec/misc.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ademcaglin/didcomm-rs path: /src/crypto/mod.rs
pub mod encryptor;
pub mod signer;
pub use crate::Error;
#[cfg(feature = "raw-crypto")]
pub use encryptor::CryptoAlgorithm;
#[cfg(feature = "raw-crypto")]
pub use signer::SignatureAlgorithm;
/// Return `FnOnce` signature definition for symmetric c... | code_fim | medium | {
"lang": "rust",
"repo": "ademcaglin/didcomm-rs",
"path": "/src/crypto/mod.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>}
/// Trait must be implemented for plugablu signatures.
/// Implemented by `SignatureAlgorithm` with `raw-crypto` feature.
///
pub trait Signer {
fn signer(&self) -> SigningMethod;
fn validator(&self) -> ValidationMethod;
}<|fim_prefix|>// repo: ademcaglin/didcomm-rs path: /src/crypto/mod.rs
pu... | code_fim | medium | {
"lang": "rust",
"repo": "ademcaglin/didcomm-rs",
"path": "/src/crypto/mod.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: krait-yxin/tornado path: /collector/jmespath/src/config.rs
use serde::{Deserialize, Serialize};
use tornado_common_api::Payload;
#[derive(Deserialize, Serialize, Clone, De<|fim_suffix|>{
pub event_type: String,
pub payload: Payload,
}<|fim_middle|>bug, PartialEq)]
pub struct JMESPathEve... | code_fim | easy | {
"lang": "rust",
"repo": "krait-yxin/tornado",
"path": "/collector/jmespath/src/config.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>{
pub event_type: String,
pub payload: Payload,
}<|fim_prefix|>// repo: krait-yxin/tornado path: /collector/jmespath/src/config.rs
use serde::{Deserialize, Serialize};
use tornado_common_api::Payload;
#[derive(Deserialize, Serialize, Clone, De<|fim_middle|>bug, PartialEq)]
pub struct JMESPathEve... | code_fim | easy | {
"lang": "rust",
"repo": "krait-yxin/tornado",
"path": "/collector/jmespath/src/config.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>// Error: attempt to multiply with overflowrustc
// create_non_standard_unit!(YottaByte, Byte, dec!(1024.0e21), "yottabyte", "yottabytes", "YB");<|fim_prefix|>// repo: Its-its/Calculator path: /conversion/src/units/data.rs
// https://en.wikipedia.org/wiki/Orders_of_magnitude_(data)
use rust_decimal::Dec... | code_fim | hard | {
"lang": "rust",
"repo": "Its-its/Calculator",
"path": "/conversion/src/units/data.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Its-its/Calculator path: /conversion/src/units/data.rs
// https://en.wikipedia.org/wiki/Orders_of_magnitude_(data)
use rust_decimal::Decimal;
use rust_decimal_macros::dec;
<|fim_suffix|>
create_standard_unit!(Byte, "byte", "bytes", "B");
create_non_standard_unit!(Bit, Byte, dec!(0.125), "bit"... | code_fim | medium | {
"lang": "rust",
"repo": "Its-its/Calculator",
"path": "/conversion/src/units/data.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>create_non_standard_unit!(Bit, Byte, dec!(0.125), "bit", "bits", "bit");
create_non_standard_unit!(KiloByte, Byte, dec!(1024.0), "kilobyte", "kilobytes", "kB");
create_non_standard_unit!(MegaByte, Byte, dec!(1024.0e3), "megabyte", "megabytes", "MB");
create_non_standard_unit!(GigaByte, Byte, dec!(1024.0e6... | code_fim | medium | {
"lang": "rust",
"repo": "Its-its/Calculator",
"path": "/conversion/src/units/data.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut user_role_final = HashMap::new();
for (user_sub, apps) in &user_role {
for (app_name, perms) in apps {
let perm_str = perms
.iter()
.fold(String::new(), |acc, perm| acc + "," + perm);
user_role_final
.entry(use... | code_fim | hard | {
"lang": "rust",
"repo": "multun/gateway",
"path": "/gateway/src/permission.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: multun/gateway path: /gateway/src/permission.rs
use std::collections::{HashMap, HashSet};
use std::process::exit;
use std::sync::Arc;
use serde::Deserialize;
use bytes::Buf as _;
use regex::Regex;
use hyper::Client;
use tokio::sync::RwLock;
use tokio::time::{sleep, Duration};
use crate::ru... | code_fim | hard | {
"lang": "rust",
"repo": "multun/gateway",
"path": "/gateway/src/permission.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for perm_uri in RUNTIME_CONFIG.get().unwrap().perm_uris.iter().as_ref() {
match fetch_perm(&perm_uri).await {
Some(perm_vec) => {
for perm in perm_vec.iter() {
if is_role_perm.is_match(&perm.role_name) {
let captures = is_... | code_fim | hard | {
"lang": "rust",
"repo": "multun/gateway",
"path": "/gateway/src/permission.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// Used to convert the pin
///
/// #Arguments
/// * `pin` - The index of the pin the be converted
pub fn reflect(&self, pin: i32) -> i32 {
let index = pin as usize;
self.wire_map[index]
}
}<|fim_prefix|>// repo: Aegen/Enigma path: /src/reflector.rs
pub static REFL... | code_fim | medium | {
"lang": "rust",
"repo": "Aegen/Enigma",
"path": "/src/reflector.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Aegen/Enigma path: /src/reflector.rs
pub static REFLECTOR_MAP: [i32; 26] = [
24, 17, 20, 7, 16, 18, 11, 3, 15, 23, 13, 6, 14, 10, 12, 8, 4, 1, 5, 25, 2, 22, 21, 9, 0, 19,
];
/// Data representing a single rotor
pub struct Reflector {
wire_map: [i32; 26],
}
<|fim_suffix|> /// Used to... | code_fim | medium | {
"lang": "rust",
"repo": "Aegen/Enigma",
"path": "/src/reflector.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Jontaylor529/wyag_rust path: /src/lib/sorted_dict.rs
use std::{cell::RefCell, hash::Hash, ptr::null};
use std::collections::{HashMap,LinkedList};
use std::ptr::null_mut;
use std::rc::{Rc, Weak};
///Dictionary that remembers the order that keys were added in
#[derive(Debug)]
pub struct OrderedDi... | code_fim | hard | {
"lang": "rust",
"repo": "Jontaylor529/wyag_rust",
"path": "/src/lib/sorted_dict.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> fn into_iter(self) -> Self::IntoIter {
OrderedDictIter::new(self)
}
}
pub struct OrderedDictIter<K: Hash + Eq + PartialEq + Clone ,V> {
current_node: Option<StrongNode<K>>,
dictionary: OrderedDictionary<K,V>,
}
impl <K: Hash + Eq + PartialEq + Clone ,V> OrderedDictIter<K,V> {
... | code_fim | hard | {
"lang": "rust",
"repo": "Jontaylor529/wyag_rust",
"path": "/src/lib/sorted_dict.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>se crate::{Arity, LispFn1, LispFn2, LispFn3, LispFnN};
use crate::{LispResult, Value};<|fim_prefix|>// repo: l3kn/EulerLisp path: /src/evaluator.rs
use std::cell::RefCell;
use std::fs;
use std::fs::File;
use std::io::{Read, Write};
use std::rc::Rc;
use crate::builtin::{self, BuiltinRegistry};
use crate:... | code_fim | medium | {
"lang": "rust",
"repo": "l3kn/EulerLisp",
"path": "/src/evaluator.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: l3kn/EulerLisp path: /src/evaluator.rs
use std::cell::RefCell;
use std::fs;
use std::fs::File;
use std::io::{Read, Write};
us<|fim_suffix|>iler;
use crate::parser::Parser;
use crate::symbol_table::Symbol;
use crate::vm::VM;
use crate::{Arity, LispFn1, LispFn2, LispFn3, LispFnN};
use crate::{Lisp... | code_fim | medium | {
"lang": "rust",
"repo": "l3kn/EulerLisp",
"path": "/src/evaluator.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>iler;
use crate::parser::Parser;
use crate::symbol_table::Symbol;
use crate::vm::VM;
use crate::{Arity, LispFn1, LispFn2, LispFn3, LispFnN};
use crate::{LispResult, Value};<|fim_prefix|>// repo: l3kn/EulerLisp path: /src/evaluator.rs
use std::cell::RefCell;
use std::fs;
use std::fs::File;
use std::io::{R... | code_fim | medium | {
"lang": "rust",
"repo": "l3kn/EulerLisp",
"path": "/src/evaluator.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ptomato/mozjs path: /third_party/rust/term_size/src/platform/mod.rs
#[cfg(any(target_os = "linux",
target_os = "android",
target_os = "macos",
target_os = "ios",
target_os = "bitrig",
target_os = "dragonfly",
target_os = "freebsd",
... | code_fim | hard | {
"lang": "rust",
"repo": "ptomato/mozjs",
"path": "/third_party/rust/term_size/src/platform/mod.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>// makes project compilable on unsupported platforms
#[cfg(not(any(target_os = "linux",
target_os = "android",
target_os = "macos",
target_os = "ios",
target_os = "bitrig",
target_os = "dragonfly",
target_os = "freebsd",
... | code_fim | hard | {
"lang": "rust",
"repo": "ptomato/mozjs",
"path": "/third_party/rust/term_size/src/platform/mod.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn execute(&mut self) -> Result<i64, ProgramError> {
for opcode in &self.program {
match opcode {
OpCode::Load(source_idx, value) => {
self.register[*source_idx] = *value;
}
OpCode::Add(source_l_idx, source_r_i... | code_fim | hard | {
"lang": "rust",
"repo": "Shinyaigeek/Onsen",
"path": "/src/bytecode/interpreter/vm.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Shinyaigeek/Onsen path: /src/bytecode/interpreter/vm.rs
use crate::bytecode::bytecode::opcode::OpCode;
use std::result::Result;
#[derive(Debug)]
pub enum ProgramError {
DivisionByZero,
UnexpectedTermination,
// UnknownOpcode, // compiler ensures this can never happen
}
<|fim_suffix... | code_fim | hard | {
"lang": "rust",
"repo": "Shinyaigeek/Onsen",
"path": "/src/bytecode/interpreter/vm.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> }
#[doc = "Bit 24 - LON Transmission Done Interrupt Mask"]
#[inline(always)]
pub fn ltxd(&self) -> LTXD_R {
LTXD_R::new(((self.bits >> 24) & 0x01) != 0)
}
#[doc = "Bit 25 - LON Collision Interrupt Mask"]
#[inline(always)]
pub fn lcol(&self) -> LCOL_R {
LCOL_R... | code_fim | hard | {
"lang": "rust",
"repo": "tstellanova/atsame7xx-pac",
"path": "/src/atsame70q21b/usart0/us_imr_lon_mode.rs",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: tstellanova/atsame7xx-pac path: /src/atsame70q21b/usart0/us_imr_lon_mode.rs
#[doc = "Reader of register US_IMR_LON_MODE"]
pub type R = crate::R<u32, super::US_IMR_LON_MODE>;
#[doc = "Reader of field `RXRDY`"]
pub type RXRDY_R = crate::R<bool, bool>;
#[doc = "Reader of field `TXRDY`"]
pub type TX... | code_fim | hard | {
"lang": "rust",
"repo": "tstellanova/atsame7xx-pac",
"path": "/src/atsame70q21b/usart0/us_imr_lon_mode.rs",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: bradunov/shkola path: /questions/geom_2/q00032/text.rs
Koliki (konveksan) ugao obrazuju mala (crvena) i velika (plava) kazaljka na satu u momentu kada je @numb_h@ @hour@ i @numb_m@ minuta?
<|fim_suffix|>@center@ Kazaljke obrazuju ugao od @hspacept(3)@ @answ@<|fim_middle|>@center@ @mycanvas(r... | code_fim | easy | {
"lang": "rust",
"repo": "bradunov/shkola",
"path": "/questions/geom_2/q00032/text.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@center@ Kazaljke obrazuju ugao od @hspacept(3)@ @answ@<|fim_prefix|>// repo: bradunov/shkola path: /questions/geom_2/q00032/text.rs
Koliki (konveksan) ugao obrazuju mala (crvena) i velika (plava) kazaljka na satu u momentu kada je @numb_h@ @hour@ i @numb_m@ minuta?
<|fim_middle|>@center@ @mycanvas(r... | code_fim | easy | {
"lang": "rust",
"repo": "bradunov/shkola",
"path": "/questions/geom_2/q00032/text.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: gauteh/ambiq-apollo3-pac path: /src/mspi/intclr/mod.rs
()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
}
#[doc = r" Value of the field"]
pub struct RXFR {
bits: bool,
}
impl RXFR {
#[doc = r" Val... | code_fim | hard | {
"lang": "rust",
"repo": "gauteh/ambiq-apollo3-pac",
"path": "/src/mspi/intclr/mod.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: gauteh/ambiq-apollo3-pac path: /src/mspi/intclr/mod.rs
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
}
#[doc = r" Value of the field"]
pub struct RXOR {
bits: bool,
}
impl RXOR {
#[doc... | code_fim | hard | {
"lang": "rust",
"repo": "gauteh/ambiq-apollo3-pac",
"path": "/src/mspi/intclr/mod.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> u32 {
self.bits
}
#[doc = "Bit 12 - Scrambling Alignment Error. Scrambling operations must be aligned to word (4-byte) start address."]
#[inline]
pub fn screrr(&self) -> SCRERRR {
let bits = {
const MASK: bool = true;
const OFFSET: u8 = 12;
... | code_fim | hard | {
"lang": "rust",
"repo": "gauteh/ambiq-apollo3-pac",
"path": "/src/mspi/intclr/mod.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.next.is_null() {
return None;
};
Some(unsafe {
let result = &*self.next;
self.next = (*self.next).next;
result
})
}
}
pub struct UnicastAddressesIterator<'a> {
_head: &'a IpAdapterAddresses,
next: *const... | code_fim | hard | {
"lang": "rust",
"repo": "willstott101/if-addrs",
"path": "/src/windows.rs",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.