text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|>// repo: nguyenminhhieu12041996/casper-node path: /execution_engine_testing/tests/src/test/contract_api/revert.rs
use casper_engine_test_support::{
internal::{ExecuteRequestBuilder, InMemoryWasmTestBuilder, DEFAULT_RUN_GENESIS_REQUEST},
DEFAULT_ACCOUNT_ADDR,
};
use casper_types::RuntimeArgs;
<|f... | code_fim | medium | {
"lang": "rust",
"repo": "nguyenminhhieu12041996/casper-node",
"path": "/execution_engine_testing/tests/src/test/contract_api/revert.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> let exec_request =
ExecuteRequestBuilder::standard(*DEFAULT_ACCOUNT_ADDR, REVERT_WASM, RuntimeArgs::default())
.build();
InMemoryWasmTestBuilder::default()
.run_genesis(&DEFAULT_RUN_GENESIS_REQUEST)
.exec(exec_request)
.commit()
.is_error();
}<|f... | code_fim | medium | {
"lang": "rust",
"repo": "nguyenminhhieu12041996/casper-node",
"path": "/execution_engine_testing/tests/src/test/contract_api/revert.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: pdf-rs/pdf path: /pdf/examples/read.rs
extern crate pdf;
use std::env::args;
use std::time::SystemTime;
use std::fs;
use std::collections::HashMap;
use pdf::file::{FileOptions, Log};
use pdf::object::*;
use pdf::primitive::Primitive;
use pdf::error::PdfError;
use pdf::enc::StreamFilter;
struc... | code_fim | hard | {
"lang": "rust",
"repo": "pdf-rs/pdf",
"path": "/pdf/examples/read.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let file = FileOptions::cached().log(VerboseLog).open(&path).unwrap();
let resolver = file.resolver();
if let Some(ref info) = file.trailer.info_dict {
let title = info.title.as_ref().map(|p| p.to_string_lossy());
let author = info.author.as_ref().map(|p| p.to_string_lossy());... | code_fim | hard | {
"lang": "rust",
"repo": "pdf-rs/pdf",
"path": "/pdf/examples/read.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> GeneratorsChain::new(&label).take(n)
})
.collect();
Generators {
pedersen_gens,
n,
m,
G,
H,
}
}
/// Returns j-th share of generators, with an appropriate
/// slice of vectors G... | code_fim | hard | {
"lang": "rust",
"repo": "jonnycrunch/bulletproofs",
"path": "/src/generators.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: jonnycrunch/bulletproofs path: /src/generators.rs
//! The `generators` module contains API for producing a
//! set of generators for a rangeproof.
#![allow(non_snake_case)]
#![deny(missing_docs)]
use curve25519_dalek::ristretto::RistrettoPoint;
use curve25519_dalek::scalar::Scalar;
use curve25... | code_fim | hard | {
"lang": "rust",
"repo": "jonnycrunch/bulletproofs",
"path": "/src/generators.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fn get_random() -> f32 {
let mut rng = rand::thread_rng();
rng.gen()
}
pub fn update(&mut self) {
self.angle += 0.01;
for index in 0..self.count {
let p = &mut self.particles[index as usize];
p.update(self.angle);
if p.x > (... | code_fim | hard | {
"lang": "rust",
"repo": "dizzyplay/webassembly-js-bench-test",
"path": "/src/lib.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: dizzyplay/webassembly-js-bench-test path: /src/lib.rs
mod utils;
use rand::Rng;
extern crate console_error_panic_hook;
use std::panic;
use wasm_bindgen::prelude::*;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_al... | code_fim | hard | {
"lang": "rust",
"repo": "dizzyplay/webassembly-js-bench-test",
"path": "/src/lib.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: atsamd-rs/atsamd path: /pac/atsamd11c/src/evsys/channel.rs
#[doc = "Register `CHANNEL` reader"]
pub struct R(crate::R<CHANNEL_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<CHANNEL_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl ... | code_fim | hard | {
"lang": "rust",
"repo": "atsamd-rs/atsamd",
"path": "/pac/atsamd11c/src/evsys/channel.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> &self.0
}
}
#[doc = "Field `PATH` writer - Path Selection"]
pub struct PATH_W<'a> {
w: &'a mut W,
}
impl<'a> PATH_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PATH_A) -> &'a mut W {
unsafe { self.bits(variant.into()) ... | code_fim | hard | {
"lang": "rust",
"repo": "atsamd-rs/atsamd",
"path": "/pac/atsamd11c/src/evsys/channel.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: skade/actixtagram path: /tests/tests.rs
use actix_web::{App, Error};
use actix_web::dev::Service;
use actix_web::test;
use actixtagram::{hello};
use actix_rt;
<|fim_suffix|> let mut app = test::init_service(app).await;
let req = test::TestRequest::get().uri("/").to_request();
... | code_fim | medium | {
"lang": "rust",
"repo": "skade/actixtagram",
"path": "/tests/tests.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert_eq!(resp.status(), http::StatusCode::OK);
let response_body = match resp.response().body().as_ref() {
Some(actix_web::body::Body::Bytes(bytes)) => bytes,
_ => panic!("Response error"),
};
assert_eq!(response_body, r##"Hello world!"##);
Ok(())
}<|fim_... | code_fim | hard | {
"lang": "rust",
"repo": "skade/actixtagram",
"path": "/tests/tests.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: OisinA/zephyrus path: /src/parser.rs
use crate::token::Token;
use crate::lexer::Lexer;
use std::error::Error;
use std::format;
pub struct Parser<'a> {
lexer: Lexer<'a>,
cur_token: Token,
peek_token: Token,
}
impl Parser<'_> {
pub fn new(mut lexer: Lexer<'_>) -> Parser<'_> {
... | code_fim | hard | {
"lang": "rust",
"repo": "OisinA/zephyrus",
"path": "/src/parser.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> loop {
let att = match self.cur_token.clone() {
Token::Identifier(s) => s,
_ => String::from("uhh"),
};
if self.peek_token != Token::Equals {
... | code_fim | hard | {
"lang": "rust",
"repo": "OisinA/zephyrus",
"path": "/src/parser.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl BeaconSeeker {
/// Wrap a InfraredSensor into a BeaconSeeker
pub fn new(sensor: InfraredSensor, channel: u8) -> Ev3Result<BeaconSeeker> {
sensor.set_mode_ir_seek()?;
Ok(BeaconSeeker {
sensor,
channel: u8::max(1, u8::min(4, channel)) - 1,
})
... | code_fim | hard | {
"lang": "rust",
"repo": "pixix4/ev3dev-lang-rust",
"path": "/src/sensors/infrared_sensor.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Ok(RemoteControl {
sensor,
channel: u8::max(1, u8::min(4, channel)) - 1,
helper: Rc::new(RefCell::new(RemoteControlHelper::new())),
})
}
/// Checks if `red_up` button is pressed.
pub fn is_red_up(&self) -> bool {
self.helper.borrow()... | code_fim | hard | {
"lang": "rust",
"repo": "pixix4/ev3dev-lang-rust",
"path": "/src/sensors/infrared_sensor.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: pixix4/ev3dev-lang-rust path: /src/sensors/infrared_sensor.rs
//! LEGO EV3 infrared sensor.
use super::{Sensor, SensorPort};
use crate::{sensor_mode, Attribute, Device, Driver, Ev3Error, Ev3Result};
use std::cell::RefCell;
use std::collections::HashSet;
use std::fmt;
use std::rc::Rc;
/// LEGO ... | code_fim | hard | {
"lang": "rust",
"repo": "pixix4/ev3dev-lang-rust",
"path": "/src/sensors/infrared_sensor.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: rust-lang/rust path: /compiler/rustc_const_eval/src/interpret/visitor.rs
//! Visitor for a run-time value with a given layout: Traverse enums, structs and other compound
//! types until we arrive at the leaves, with custom handling for primitive types.
use rustc_index::IndexVec;
use rustc_middl... | code_fim | hard | {
"lang": "rust",
"repo": "rust-lang/rust",
"path": "/compiler/rustc_const_eval/src/interpret/visitor.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> // Special treatment for special types, where the (static) layout is not sufficient.
match *ty.kind() {
// If it is a trait object, switch to the real type that was used to create it.
ty::Dynamic(_, _, ty::Dyn) => {
// Dyn types. This is unsized, and... | code_fim | hard | {
"lang": "rust",
"repo": "rust-lang/rust",
"path": "/compiler/rustc_const_eval/src/interpret/visitor.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: stm32-rs/stm32-rs-nightlies path: /stm32mp1/src/stm32mp157/dsi/pcr.rs
#[doc = "Register `PCR` reader"]
pub type R = crate::R<PCR_SPEC>;
#[doc = "Register `PCR` writer"]
pub type W = crate::W<PCR_SPEC>;
#[doc = "Field `ETTXE` reader - ETTXE"]
pub type ETTXE_R = crate::BitReader;
#[doc = "Field `E... | code_fim | hard | {
"lang": "rust",
"repo": "stm32-rs/stm32-rs-nightlies",
"path": "/stm32mp1/src/stm32mp157/dsi/pcr.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #[must_use]
pub fn ettxe(&mut self) -> ETTXE_W<PCR_SPEC, 0> {
ETTXE_W::new(self)
}
#[doc = "Bit 1 - ETRXE"]
#[inline(always)]
#[must_use]
pub fn etrxe(&mut self) -> ETRXE_W<PCR_SPEC, 1> {
ETRXE_W::new(self)
}
#[doc = "Bit 2 - BTAE"]
#[inline(always)]
... | code_fim | hard | {
"lang": "rust",
"repo": "stm32-rs/stm32-rs-nightlies",
"path": "/stm32mp1/src/stm32mp157/dsi/pcr.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> "svojím",
"svojími",
"ta",
"tá",
"tak",
"takže",
"tam",
"táto",
"te",
"tě",
"teda",
"ten",
"tento",
"the",
"tieto",
"tiež",
"to",
"toho",
"tohoto",
... | code_fim | hard | {
"lang": "rust",
"repo": "qdequele/toku",
"path": "/src/stopwords/slk.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: qdequele/toku path: /src/stopwords/slk.rs
use once_cell::sync::Lazy;
use std::collections::HashSet;
/// Slovenčina (Slovak)
pub static STOPWORDS_SLK: Lazy<HashSet<&'static str>> = Lazy::new(|| {
[
"a",
"aby",
"aj",
"ak",
"ako",
"ale",
... | code_fim | hard | {
"lang": "rust",
"repo": "qdequele/toku",
"path": "/src/stopwords/slk.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> "nech",
"než",
"nič",
"nie",
"niektorý",
"nová",
"nové",
"noví",
"nový",
"o",
"od",
"odo",
"of",
"on",
"ona",
"oni",
"ono",
"ony",
"po",
"pod",
... | code_fim | hard | {
"lang": "rust",
"repo": "qdequele/toku",
"path": "/src/stopwords/slk.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl EmptyPadding {
pub fn new() -> Self {
EmptyPadding
}
}
impl Padding for EmptyPadding {
fn padding(&self, _buf: &mut Vec<u8>) {
}
fn unpadding(&self, buf: &mut Vec<u8>) -> Result<usize, CryptoError> {
Ok(buf.len())
}
}<|fim_prefix|>// repo: mengsuenyan/rcrypto... | code_fim | medium | {
"lang": "rust",
"repo": "mengsuenyan/rcrypto",
"path": "/src/cipher_mode/padding.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: mengsuenyan/rcrypto path: /src/cipher_mode/padding.rs
use crate::{Cipher, CryptoError, CryptoErrorKind};
use std::marker::PhantomData;
pub trait Padding {
/// padding the `buf` data in place,
fn padding(&self, buf: &mut Vec<u8>);
/// unpadding the `buf` data in place, the conte... | code_fim | hard | {
"lang": "rust",
"repo": "mengsuenyan/rcrypto",
"path": "/src/cipher_mode/padding.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Err(CryptoError::new(CryptoErrorKind::UnpaddingNotMatch,
format!("unpadding error, not find 0b10*")))
}
}
/// padding nothing
#[derive(Clone)]
pub struct EmptyPadding;
impl EmptyPadding {
pub fn new() -> Self {
EmptyPadding
}
}
impl Padding for EmptyPadding {
... | code_fim | hard | {
"lang": "rust",
"repo": "mengsuenyan/rcrypto",
"path": "/src/cipher_mode/padding.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>)]
pub fn ck8m_tick_num(&self) -> CK8M_TICK_NUM_R {
CK8M_TICK_NUM_R::new(((self.bits >> 8) & 0xff) as u8)
}
#[doc = "Bits 0:7"]
#[inline(always)]
pub fn xtal_tick_num(&self) -> XTAL_TICK_NUM_R {
XTAL_TICK_NUM_R::new((self.bits & 0xff) as u8)
}
}
impl W {
#[doc =... | code_fim | hard | {
"lang": "rust",
"repo": "ForsakenHarmony/esp32c3-pac",
"path": "/src/apb_ctrl/tick_conf.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ForsakenHarmony/esp32c3-pac path: /src/apb_ctrl/tick_conf.rs
#[doc = "Reader of register TICK_CONF"]
pub type R = crate::R<u32, super::TICK_CONF>;
#[doc = "Writer for register TICK_CONF"]
pub type W = crate::W<u32, super::TICK_CONF>;
#[doc = "Register TICK_CONF `reset()`'s with value 0"]
impl cr... | code_fim | hard | {
"lang": "rust",
"repo": "ForsakenHarmony/esp32c3-pac",
"path": "/src/apb_ctrl/tick_conf.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fn alert(s: &str);
}
macro_rules! console_log {
// Note that this is using the `log` function imported above during
// `bare_bones`
($($t:tt)*) => (log(&format_args!($($t)*).to_string()))
}
#[wasm_bindgen]
pub fn hello() {
console_log!("Hello");
web_sys::console::log_1(&"this.is"... | code_fim | hard | {
"lang": "rust",
"repo": "sqchenxiyuan/project-template",
"path": "/wasm-rust/src/lib.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: sqchenxiyuan/project-template path: /wasm-rust/src/lib.rs
use wasm_bindgen::prelude::*;
#[wasm_bindgen(start)]
pub fn run() {
hello();
}
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: w... | code_fim | hard | {
"lang": "rust",
"repo": "sqchenxiyuan/project-template",
"path": "/wasm-rust/src/lib.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: terry90/diesel-enum-derive path: /src/lib.rs
#![recursion_limit = "256"]
extern crate proc_macro;
extern crate syn;
#[macro_use]
extern crate quote;
extern crate heck;
extern crate proc_macro2;
use heck::ToSnakeCase;
use proc_macro::TokenStream;
use proc_macro2::Span;
use syn::Ident;
struct Va... | code_fim | hard | {
"lang": "rust",
"repo": "terry90/diesel-enum-derive",
"path": "/src/lib.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> impl AsExpression<Nullable<VarChar>> for #name {
type Expression = AsExprOf<String, Nullable<VarChar>>;
fn as_expression(self) -> Self::Expression {
<String as AsExpression<Nullable<VarChar>>>::as_expression(self.db_value().to_string())
... | code_fim | hard | {
"lang": "rust",
"repo": "terry90/diesel-enum-derive",
"path": "/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ajmwagar/calc path: /src/main.rs
extern crate rand;
use std::env;
use rand::prelude::*;
use std::f64::consts::PI;
use std::io::{stdin, stdout, Write};
use std::process::Command;
macro_rules! block {
($xs:block) => {
loop { let _ = $xs; break; }
};
}
static HELP: &str = "Welcom... | code_fim | hard | {
"lang": "rust",
"repo": "ajmwagar/calc",
"path": "/src/main.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let res = calc(calc_arr, index, 0.0, true, ans);
return res.to_string();
} else {
return "Please enter a valid expression.".to_string();
}
}
fn run_once(com: String) {
let calc_arr: Vec<&str>;
// Collect on spaces
calc_arr = com.split(" ").collect();
// ... | code_fim | hard | {
"lang": "rust",
"repo": "ajmwagar/calc",
"path": "/src/main.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> // Calculate
let res = calc(calc_arr, index, 0.0, true, 0.0);
println!("{}", res);
} else {
println!("{}", calc_arr[0]);
}
}
fn clear() -> String {
// Clear screen and start
let output = Command::new("clear")
.output()
.unwrap_or_else(|e| p... | code_fim | hard | {
"lang": "rust",
"repo": "ajmwagar/calc",
"path": "/src/main.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>: Scope, handler: NativePatternHandler) -> Result<Match, RuntimeError> {
handler(start)
}<|fim_prefix|>// repo: justinmchase/verse-lang path: /src/runtime/patterns/native.rs
use super::super::{Match, NativePatternHandle<|fim_middle|>r, RuntimeError, Scope};
pub fn native(start | code_fim | easy | {
"lang": "rust",
"repo": "justinmchase/verse-lang",
"path": "/src/runtime/patterns/native.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>sult<Match, RuntimeError> {
handler(start)
}<|fim_prefix|>// repo: justinmchase/verse-lang path: /src/runtime/patterns/native.rs
use super::super::{Match, NativePatternHandler, RuntimeError, Scope};
pub fn native(start<|fim_middle|>: Scope, handler: NativePatternHandler) -> Re | code_fim | easy | {
"lang": "rust",
"repo": "justinmchase/verse-lang",
"path": "/src/runtime/patterns/native.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: justinmchase/verse-lang path: /src/runtime/patterns/native.rs
use super::super::{Match, NativePatternHandle<|fim_suffix|>: Scope, handler: NativePatternHandler) -> Result<Match, RuntimeError> {
handler(start)
}<|fim_middle|>r, RuntimeError, Scope};
pub fn native(start | code_fim | easy | {
"lang": "rust",
"repo": "justinmchase/verse-lang",
"path": "/src/runtime/patterns/native.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: RaymondK99/advent_of_code_2020_rs path: /src/util/day_01.rs
use super::Part;
pub fn solve(input : String, part: Part) -> String {
let numbers:Vec<u32> = input.lines()
.map(|line| line.parse().unwrap())
.collect();
match part {
Part::Part1 => part1(numbers),
... | code_fim | hard | {
"lang": "rust",
"repo": "RaymondK99/advent_of_code_2020_rs",
"path": "/src/util/day_01.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
let input = "1721
979
366
299
675
1456";
assert_eq!("514579", solve(input.to_string(), Part1));
}
#[test]
fn test_part1() {
let input = include_str!("../../input_01.txt");
assert_eq!("787776", solve(input.to_string(), Part1));
}
#[test]
fn test2... | code_fim | hard | {
"lang": "rust",
"repo": "RaymondK99/advent_of_code_2020_rs",
"path": "/src/util/day_01.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>this
:
Pin
<
&
mut
Self
>
)
{
let
_
=
this
;
}
}
}
fn
main
(
)
{
}<|fim_prefix|>// repo: marco-c/gecko-dev-wordified path: /third_party/rust/pin-project-lite/tests/expand/pinned_drop/struct.rs
use
pin_project_lite
:
:
pin_project
;
use
std
:
:
pin
:
:
Pin
;
<|fim_middle|>pin_project
!
{
struct
Struct
<
T... | code_fim | medium | {
"lang": "rust",
"repo": "marco-c/gecko-dev-wordified",
"path": "/third_party/rust/pin-project-lite/tests/expand/pinned_drop/struct.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified path: /third_party/rust/pin-project-lite/tests/expand/pinned_drop/struct.rs
use
pin_project_lite
:
:
pin_project
;
use
std
:
:
pin
:
:
Pin
;
<|fim_suffix|>ned
:
U
}
impl
<
T
U
>
PinnedDrop
for
Struct
<
T
U
>
{
fn
drop
(
this
:
Pin
<
&
mut
Self
>
)
{
let
_
=
this
;
}
}... | code_fim | medium | {
"lang": "rust",
"repo": "marco-c/gecko-dev-wordified",
"path": "/third_party/rust/pin-project-lite/tests/expand/pinned_drop/struct.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: chunningham/tzpkg path: /libs/tezos_api/src/models/unistring.rs
/*
* Tezos RPC
*
* Tezos client RPC API.
*
* The version of the OpenAPI document: 7.5
*
* Generated by: https://openapi-generator.tech
*/
<|fim_suffix|>
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct... | code_fim | medium | {
"lang": "rust",
"repo": "chunningham/tzpkg",
"path": "/libs/tezos_api/src/models/unistring.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl Unistring {
/// Either a plain UTF8 string, or a sequence of bytes for strings that contain invalid byte sequences.
pub fn new(invalid_utf8_string: Vec<i32>) -> Unistring {
Unistring {
invalid_utf8_string,
}
}
}<|fim_prefix|>// repo: chunningham/tzpkg path: /l... | code_fim | medium | {
"lang": "rust",
"repo": "chunningham/tzpkg",
"path": "/libs/tezos_api/src/models/unistring.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: maaft/nrf-secureboot-test path: /nrf-rust-bootloaders/nrf52840-blinky-app/examples/blinky.rs
#![no_main]
#![no_std]
#![allow(warnings)]
extern crate panic_halt;
extern crate nrf52840_hal as hal;
use cortex_m_rt::entry;
<|fim_suffix|> // Alternately flash the red, green and blue leds
loo... | code_fim | hard | {
"lang": "rust",
"repo": "maaft/nrf-secureboot-test",
"path": "/nrf-rust-bootloaders/nrf52840-blinky-app/examples/blinky.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> // Alternately flash the red, green and blue leds
loop {
green_led.set_high();
red_led.set_low();
blue_led.set_high();
timer.delay(250_000); // 250ms
red_led.set_high();
blue_led.set_low();
timer.delay(1_000_000); // 1s
green_led.set_... | code_fim | hard | {
"lang": "rust",
"repo": "maaft/nrf-secureboot-test",
"path": "/nrf-rust-bootloaders/nrf52840-blinky-app/examples/blinky.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>le values: `Linkable` or `Unlinkable`)
pub quote_type: String,
}<|fim_prefix|>// repo: devashishdxt/chain-enclave-ra path: /ra-sp/src/config.rs
/// Configuration required by SP for remote attestation
#[derive(Debug)]
pub struct SpRaConfig {
/// IAS API key
pub ias_key: S<|fim_middle|>tring,
... | code_fim | medium | {
"lang": "rust",
"repo": "devashishdxt/chain-enclave-ra",
"path": "/ra-sp/src/config.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: devashishdxt/chain-enclave-ra path: /ra-sp/src/config.rs
/// Configuration required by SP for remote attestation
#[derive(Debug)]
pub struct SpRaConfig {
/// IAS API key
pub ias_key: S<|fim_suffix|>le values: `Linkable` or `Unlinkable`)
pub quote_type: String,
}<|fim_middle|>tring,
... | code_fim | medium | {
"lang": "rust",
"repo": "devashishdxt/chain-enclave-ra",
"path": "/ra-sp/src/config.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: thomaszub/docker2mqtt path: /src/persistence/no_persistence_repository.rs
use crate::persistence::Repository;
<|fim_suffix|> Vec::new()
}
fn add(&mut self, _: String) {}
fn delete(&mut self, _: String) {}
}<|fim_middle|>pub struct NoPersistenceRepository {}
impl Repository... | code_fim | medium | {
"lang": "rust",
"repo": "thomaszub/docker2mqtt",
"path": "/src/persistence/no_persistence_repository.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fn add(&mut self, _: String) {}
fn delete(&mut self, _: String) {}
}<|fim_prefix|>// repo: thomaszub/docker2mqtt path: /src/persistence/no_persistence_repository.rs
use crate::persistence::Repository;
pub struct NoPersistenceRepository {}
impl Repository for NoPersistenceRepository {
fn li... | code_fim | easy | {
"lang": "rust",
"repo": "thomaszub/docker2mqtt",
"path": "/src/persistence/no_persistence_repository.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: krist7599555/raytracing-in-one-weekend-rust path: /src/four/mesh.rs
use super::{Geometry, HitRecord, Material, Ray, Rayable};
pub struct Mesh<G, M>
where
G: Geometry,
M: Material,
{
pub geometry: G,
pub material: M,
}
<|fim_suffix|> self.geometry.hit(ray).map(|o| HitRecord {
m... | code_fim | hard | {
"lang": "rust",
"repo": "krist7599555/raytracing-in-one-weekend-rust",
"path": "/src/four/mesh.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.geometry.hit(ray).map(|o| HitRecord {
material: &self.material,
normal: o.normal,
position: o.position,
t: o.t,
})
}
}<|fim_prefix|>// repo: krist7599555/raytracing-in-one-weekend-rust path: /src/four/mesh.rs
use super::{Geometry, HitRecord, Material, Ray, ... | code_fim | hard | {
"lang": "rust",
"repo": "krist7599555/raytracing-in-one-weekend-rust",
"path": "/src/four/mesh.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #[derive(Deserialize, FromFile, Debug, PartialEq)]
struct Person {
name: String,
}
let p1 = Person::from_file("test/fixtures/person.json").expect("file->Person");
assert_eq!(
p1,
Person {
name: "Shane".into()
}
);
let p1 = Person::f... | code_fim | medium | {
"lang": "rust",
"repo": "shakyShane/from_file",
"path": "/from_file_derive/tests/derive.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let p1 = Person::from_file("test/fixtures/person.json").expect("file->Person");
assert_eq!(
p1,
Person {
name: "Shane".into()
}
);
let p1 = Person::from_file("test/fixtures/person.yaml").expect("file->Person");
assert_eq!(
p1,
Person... | code_fim | medium | {
"lang": "rust",
"repo": "shakyShane/from_file",
"path": "/from_file_derive/tests/derive.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: shakyShane/from_file path: /from_file_derive/tests/derive.rs
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate from_file_derive;
extern crate from_file;
use from_file::FromFile;
<|fim_suffix|> #[derive(Deserialize, FromFile, Debug, PartialEq)]
struct Person {
na... | code_fim | medium | {
"lang": "rust",
"repo": "shakyShane/from_file",
"path": "/from_file_derive/tests/derive.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
fn top(&self) -> Option<&T>;
}<|fim_prefix|>// repo: nathanfaucett/rs-collection_traits path: /src/stack.rs
use super::collection::Collection;
pub trait Stack<T>: Collection {
fn push(&self, element: T) -> Self;
<|fim_middle|> fn pop(&self) -> Self;
| code_fim | easy | {
"lang": "rust",
"repo": "nathanfaucett/rs-collection_traits",
"path": "/src/stack.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fn pop(&self) -> Self;
fn top(&self) -> Option<&T>;
}<|fim_prefix|>// repo: nathanfaucett/rs-collection_traits path: /src/stack.rs
use super::collection::Collection;
<|fim_middle|>
pub trait Stack<T>: Collection {
fn push(&self, element: T) -> Self;
| code_fim | medium | {
"lang": "rust",
"repo": "nathanfaucett/rs-collection_traits",
"path": "/src/stack.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: nathanfaucett/rs-collection_traits path: /src/stack.rs
use super::collection::Collection;
pub trait Stack<T>: Collection {
fn push(&self, element: T) -> Self;
<|fim_suffix|>
fn top(&self) -> Option<&T>;
}<|fim_middle|> fn pop(&self) -> Self;
| code_fim | easy | {
"lang": "rust",
"repo": "nathanfaucett/rs-collection_traits",
"path": "/src/stack.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[allow(dead_code)]
pub fn get_answer() -> u64 {
let input = r#"73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
1254069874715852386305071569... | code_fim | hard | {
"lang": "rust",
"repo": "joelverhagen/euler",
"path": "/src/problems/problem8.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: joelverhagen/euler path: /src/problems/problem8.rs
use std::cmp::max;
fn normalize_input(input: &str) -> String {
let mut chars: Vec<char> = Vec::new();
for c in input.chars() {
if c.is_digit(10) {
chars.push(c);
}
}
chars.into_iter().collect()
}
fn... | code_fim | hard | {
"lang": "rust",
"repo": "joelverhagen/euler",
"path": "/src/problems/problem8.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #[cfg(feature = "ba-zi-weight")]
/// 取得八字重量。
#[inline]
pub fn get_ba_zi_weight(self) -> u8 {
let i = self as usize;
BA_ZI_WEIGHT_TIME[i]
}
}
impl Display for EarthlyBranch {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
f.write... | code_fim | hard | {
"lang": "rust",
"repo": "magiclen/chinese-lunisolar-calendar",
"path": "/src/earthly_branch.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: magiclen/chinese-lunisolar-calendar path: /src/earthly_branch.rs
use std::{
fmt::{self, Display, Formatter},
mem::transmute,
str::FromStr,
};
use chrono::prelude::*;
#[cfg(feature = "ba-zi-weight")]
use super::BA_ZI_WEIGHT_TIME;
use super::{Zodiac, THE_EARTHLY_BRANCHES, THE_EARTHLY... | code_fim | hard | {
"lang": "rust",
"repo": "magiclen/chinese-lunisolar-calendar",
"path": "/src/earthly_branch.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> use std::iter::FromIterator;
Vec::<(K, V)>::from_value(value).map(FromIterator::from_iter)
}
}
impl<'a, T: FromValue<'a>> FromValue<'a> for Option<T> {
fn from_value(value: &'a Value) -> Option<Option<T>> {
match *value {
Value::Nil => Some(None),
_... | code_fim | hard | {
"lang": "rust",
"repo": "NestedWorld/NestedWorld-Server-RealTime",
"path": "/server/src/net/msg/utils/rmp/convert/from.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: NestedWorld/NestedWorld-Server-RealTime path: /server/src/net/msg/utils/rmp/convert/from.rs
use rmp::value::Value;
use std::collections::HashMap;
pub trait FromValue<'a>: Sized {
fn from_value(value: &'a Value) -> Option<Self>;
}
impl<'a> FromValue<'a> for bool {
fn from_value(value: &... | code_fim | hard | {
"lang": "rust",
"repo": "NestedWorld/NestedWorld-Server-RealTime",
"path": "/server/src/net/msg/utils/rmp/convert/from.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl<'a, K: FromValue<'a> + ::std::hash::Hash + Eq, V: FromValue<'a>> FromValue<'a> for HashMap<K, V> {
fn from_value(value: &'a Value) -> Option<HashMap<K, V>> {
use std::iter::FromIterator;
Vec::<(K, V)>::from_value(value).map(FromIterator::from_iter)
}
}
impl<'a, T: FromValue<'... | code_fim | hard | {
"lang": "rust",
"repo": "NestedWorld/NestedWorld-Server-RealTime",
"path": "/server/src/net/msg/utils/rmp/convert/from.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> warp::serve(routes)
.run(([127, 0, 0, 1], 3030))
.await;
}<|fim_prefix|>// repo: bkrn/greendoor path: /service/src/main.rs
use warp::Filter;
static ASSETS_PATH: Option<&str> = option_env!("ASSETS_PATH");
<|fim_middle|>#[tokio::main]
async fn main() {
let assets_path: &str = ASS... | code_fim | hard | {
"lang": "rust",
"repo": "bkrn/greendoor",
"path": "/service/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let routes = home.or(assets);
warp::serve(routes)
.run(([127, 0, 0, 1], 3030))
.await;
}<|fim_prefix|>// repo: bkrn/greendoor path: /service/src/main.rs
use warp::Filter;
static ASSETS_PATH: Option<&str> = option_env!("ASSETS_PATH");
<|fim_middle|>#[tokio::main]
async fn main(... | code_fim | hard | {
"lang": "rust",
"repo": "bkrn/greendoor",
"path": "/service/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: bkrn/greendoor path: /service/src/main.rs
use warp::Filter;
static ASSETS_PATH: Option<&str> = option_env!("ASSETS_PATH");
#[tokio::main]
async fn main() {
let assets_path: &str = ASSETS_PATH.unwrap_or("../client");
<|fim_suffix|> let routes = home.or(assets);
warp::serve(routes)... | code_fim | hard | {
"lang": "rust",
"repo": "bkrn/greendoor",
"path": "/service/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl Iterator for Encoder {
type Item = Result<u8, CodeError>;
fn next(&mut self) -> Option<Result<u8, CodeError>> {
if self.output_buffer.is_empty() {
loop {
match self.encoding.next(&mut self.input as &mut dyn EncodingInput) {
Some(Ok(bytes... | code_fim | hard | {
"lang": "rust",
"repo": "wfraser/unicoder",
"path": "/src/encoding.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: wfraser/unicoder path: /src/encoding.rs
use std::collections::VecDeque;
use std::error::Error;
use std::fmt;
/// An error in the encoding/decoding process.
#[derive(Debug)]
pub struct CodeError {
message: String,
bad_bytes: Option<Vec<u8>>,
inner: Option<Box<dyn Error>>,
encodin... | code_fim | hard | {
"lang": "rust",
"repo": "wfraser/unicoder",
"path": "/src/encoding.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// Put a previously retrieved byte back in the input buffer.
/// It will be the next one retrieved.
fn unget_byte(&mut self, byte: u8);
}
// Internal structure for buffering the input to the Encoding. This is kept separate from Encoder
// so that it can be borrowed mutably while the Encoding... | code_fim | hard | {
"lang": "rust",
"repo": "wfraser/unicoder",
"path": "/src/encoding.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: acmcarther/depend path: /example/lib.rs
struct Flags;
impl Flags {
fn get_flag<T>(name: &str) -> Option<T> {
// Stub
None
}
}
#[no_mangle]
pub fn first_load(flags: Flags, thread_count: usize) -> Planner {
let initial_world = specs::World::new();
world.add_resource<Flags>(flags... | code_fim | hard | {
"lang": "rust",
"repo": "acmcarther/depend",
"path": "/example/lib.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let data_installer = DataInstaller::<Delta>::new(world);
install_all!(data_installer, [
SomeSystem,
SomeOtherSystem]);
data_installer.take_world()
}
macro_rules! install_all {
($installer:expr, [$($system:ty),*]) => {
$($installer.install::<$system>();)
}
}
#[no_mangle]
pub fn ho... | code_fim | medium | {
"lang": "rust",
"repo": "acmcarther/depend",
"path": "/example/lib.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: anoop901/tetris-rust path: /tetris-lib/src/game_state.rs
ight(&mut self) -> bool {
let new_center = (self.falling_tetromino.center.0 + 1,
self.falling_tetromino.center.1);
let orientation = self.falling_tetromino.orientation;
self.move_tetromino_... | code_fim | hard | {
"lang": "rust",
"repo": "anoop901/tetris-rust",
"path": "/tetris-lib/src/game_state.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: anoop901/tetris-rust path: /tetris-lib/src/game_state.rs
etromino.orientation;
self.move_tetromino_if_fits(new_center, orientation)
}
/// Moves the current tetromino to the right, if it can. Returns `true` if
/// the tetromino was moved successfully, else returns `false`.
... | code_fim | hard | {
"lang": "rust",
"repo": "anoop901/tetris-rust",
"path": "/tetris-lib/src/game_state.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>/// The timing state of a tetris game.
pub struct TimeState {
/// The `TimeStateAction` describing the current tetromino.
pub action: TimeStateAction,
/// The remaining number of milliseconds the current tetromino can spend on the ground
/// before it is forced to lock.
pub time_to_loc... | code_fim | hard | {
"lang": "rust",
"repo": "anoop901/tetris-rust",
"path": "/tetris-lib/src/game_state.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: afilini/neerg path: /src/types.rs
use std::collections::HashMap;
use serde::{de, Deserialize, Serialize};
use bdk::bitcoin;
use bitcoin::hashes::hex::FromHex;
fn deserialize_gait_path<'de, D>(deserializer: D) -> Result<Vec<u16>, D::Error>
where
D: de::Deserializer<'de>,
{
let s = Str... | code_fim | hard | {
"lang": "rust",
"repo": "afilini/neerg",
"path": "/src/types.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub any: bool,
pub email_addr: Option<String>,
pub email_confirmed: bool,
pub phone_number: Option<String>,
}
impl TwoFactorConfigResponse {
pub fn get_enabled(&self) -> Vec<TwoFactorMethod> {
self.methods
.iter()
.filter(|(_, v)| **v)
.map(... | code_fim | hard | {
"lang": "rust",
"repo": "afilini/neerg",
"path": "/src/types.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: wuggen/newt path: /src/util/env.rs
use std::env::{self, VarError};
use std::ffi::{OsStr, OsString};
use std::path::PathBuf;
pub fn env_var<K: AsRef<OsStr>>(name: K) -> Option<OsString> {
match env::var(name) {
Ok(val) => Some(OsString::from(val)),
Err(VarError::NotPresent) =... | code_fim | hard | {
"lang": "rust",
"repo": "wuggen/newt",
"path": "/src/util/env.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> where
String: From<S>,
{
Token::Var(String::from(s))
}
fn simple_test(input: &str, expected: &[Token]) {
let toks: Vec<_> = Lexer::new(input.chars()).collect();
assert_eq!(&toks, expected);
}
#[test]
fn just_text() {
let input = "hey th... | code_fim | hard | {
"lang": "rust",
"repo": "wuggen/newt",
"path": "/src/util/env.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if (human.health < 1) || (goblin.health < 1) {
if human.health > 0 {
human_army.push(human);
println!("A human lives to fight again!");
}
if goblin.health > 0 {
goblin_army.push(goblin);
println!("The goblin victor returns to his army.");
}
println!("There are {... | code_fim | hard | {
"lang": "rust",
"repo": "morochena/1dcs",
"path": "/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if goblin.health > 0 {
goblin_army.push(goblin);
println!("The goblin victor returns to his army.");
}
println!("There are {} humans and {} goblins left.", human_army.len(), goblin_army.len() );
break;
}
}
}
println!("Combat ended!");
}<|fim_prefix|>// repo: morochena/... | code_fim | hard | {
"lang": "rust",
"repo": "morochena/1dcs",
"path": "/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: morochena/1dcs path: /src/main.rs
extern crate rand;
use std::io;
use rand::Rng;
struct Entity {
health: i32,
attack: i32,
accuracy: i32,
}
fn main() {
println!("Welcome to the 1d combat simulator!");
println!("Input the number of humans:");
let mut human_army_size = String::new();
l... | code_fim | hard | {
"lang": "rust",
"repo": "morochena/1dcs",
"path": "/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl Sensor for SensorNO2 {
fn direct_value(&self) -> u64 {
self.concentration
}
}<|fim_prefix|>// repo: zzeroo/xMZ-Mod-Touch-Prototypes path: /exceptions_and_traits/src/sensor_no2.rs
use sensor::Sensor;
use exception::Exceptional;
impl Exceptional for SensorNO2 {}
pub struct SensorNO2 ... | code_fim | medium | {
"lang": "rust",
"repo": "zzeroo/xMZ-Mod-Touch-Prototypes",
"path": "/exceptions_and_traits/src/sensor_no2.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: zzeroo/xMZ-Mod-Touch-Prototypes path: /exceptions_and_traits/src/sensor_no2.rs
use sensor::Sensor;
use exception::Exceptional;
<|fim_suffix|>impl Sensor for SensorNO2 {
fn direct_value(&self) -> u64 {
self.concentration
}
}<|fim_middle|>impl Exceptional for SensorNO2 {}
pub str... | code_fim | medium | {
"lang": "rust",
"repo": "zzeroo/xMZ-Mod-Touch-Prototypes",
"path": "/exceptions_and_traits/src/sensor_no2.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#![feature(non_lifetime_binders)]
//~^ WARN is incomplete and may not be safe to use
async fn walk2<'a, T: 'a>(_: T)
where
for<F> F: 'a,
{}
fn main() {}<|fim_prefix|>// repo: rust-lang/rust path: /tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs
// edition:2021
// check-pass
<|fi... | code_fim | medium | {
"lang": "rust",
"repo": "rust-lang/rust",
"path": "/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>async fn walk2<'a, T: 'a>(_: T)
where
for<F> F: 'a,
{}
fn main() {}<|fim_prefix|>// repo: rust-lang/rust path: /tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs
// edition:2021
// check-pass
// Checks that test_type_match code doesn't ICE when predicates have late-bound types
<|f... | code_fim | medium | {
"lang": "rust",
"repo": "rust-lang/rust",
"path": "/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: rust-lang/rust path: /tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs
// edition:2021
// check-pass
// Checks that test_type_match code doesn't ICE when predicates have late-bound types
<|fim_suffix|>async fn walk2<'a, T: 'a>(_: T)
where
for<F> F: 'a,
{}
fn main() {}<|f... | code_fim | medium | {
"lang": "rust",
"repo": "rust-lang/rust",
"path": "/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> rocket::ignite()
.attach(db::PrimaryDb::fairing())
.mount("/api", routes![
routes::genus::create,
])
.mount("/", StaticFiles::from("ui/public"))
.launch();
}<|fim_prefix|>// repo: PocketOfWeird/farmstudy path: /src/main.rs
#![feature(proc_macro_hygi... | code_fim | medium | {
"lang": "rust",
"repo": "PocketOfWeird/farmstudy",
"path": "/src/main.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: PocketOfWeird/farmstudy path: /src/main.rs
#![feature(proc_macro_hygiene, decl_macro)]
<|fim_suffix|> rocket::ignite()
.attach(db::PrimaryDb::fairing())
.mount("/api", routes![
routes::genus::create,
])
.mount("/", StaticFiles::from("ui/public"))
... | code_fim | medium | {
"lang": "rust",
"repo": "PocketOfWeird/farmstudy",
"path": "/src/main.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>fn main() {
rocket::ignite()
.attach(db::PrimaryDb::fairing())
.mount("/api", routes![
routes::genus::create,
])
.mount("/", StaticFiles::from("ui/public"))
.launch();
}<|fim_prefix|>// repo: PocketOfWeird/farmstudy path: /src/main.rs
#![feature(pro... | code_fim | medium | {
"lang": "rust",
"repo": "PocketOfWeird/farmstudy",
"path": "/src/main.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: weykon/rust-softrender path: /full_example/src/main.rs
extern crate softrender;
extern crate full_example;
use softrender::render::{FrameBuffer, Pipeline, GenericBlend, Primitive, PrimitiveMut, PrimitiveRef};
use softrender::image_compat::ImageFrameBuffer;
use full_example::color::{self, Color... | code_fim | hard | {
"lang": "rust",
"repo": "weykon/rust-softrender",
"path": "/full_example/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut fragment_shader = geometry_shader.finish().with_default_blend::<GenericBlend<_>>();
// Set our pixel blend function
fragment_shader.set_blend_function(|a, b| color::blend(a, b));
fragment_shader.run(full_example::shaders::fragment_shader_green);
... | code_fim | hard | {
"lang": "rust",
"repo": "weykon/rust-softrender",
"path": "/full_example/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> // Set our pixel blend function
fragment_shader.set_blend_function(|a, b| color::blend(a, b));
fragment_shader.run(full_example::shaders::fragment_shader_green);
}
}
println!("Saving example 2 to image");
// copy the framebuffer into an image then... | code_fim | hard | {
"lang": "rust",
"repo": "weykon/rust-softrender",
"path": "/full_example/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ing the library provided http request types. Some provide
//! additional abstractions for an integrated feeling.
//!
//! A complete list can be found in the [`frontends`] module.
//!
//! You can also use this library with any HTTP frontend, see [`frontends::simple`].
//!
//! ## Custom Frontends
//!
//! A... | code_fim | hard | {
"lang": "rust",
"repo": "Stanislav-Lapata/oxide-auth",
"path": "/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Stanislav-Lapata/oxide-auth path: /src/lib.rs
//! # oxide-auth
//!
//! A OAuth2 server library, for use in combination with actix-web or other frontends, featuring a
//! set of configurable and pluggable backends.
//!
//! ## About
//!
//! `oxide-auth` aims at providing a comprehensive and extens... | code_fim | hard | {
"lang": "rust",
"repo": "Stanislav-Lapata/oxide-auth",
"path": "/src/lib.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: rcls/svd2rust-example path: /lpc408x/src/gpdma/softbreq.rs
ts = (self.w.bits & !(0x01 << 10)) | ((value as u32 & 0x01) << 10);
self.w
}
}
#[doc = "Field `SOFTBREQ11` reader - Software burst request flags for each of 16 possible sources. Each bit represents one DMA request line or per... | code_fim | hard | {
"lang": "rust",
"repo": "rcls/svd2rust-example",
"path": "/lpc408x/src/gpdma/softbreq.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> &self.0
}
}
#[doc = "Field `SOFTBREQ15` writer - Software burst request flags for each of 16 possible sources. Each bit represents one DMA request line or peripheral Description (refer to Table 672 for peripheral hardware connections to the DMA controller): 0 - writing 0 has no effect. 1 - wri... | code_fim | hard | {
"lang": "rust",
"repo": "rcls/svd2rust-example",
"path": "/lpc408x/src/gpdma/softbreq.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: rcls/svd2rust-example path: /lpc408x/src/gpdma/softbreq.rs
ys)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 7)) | ((value as u32 & 0x01) << 7);
self.w
}
}
#[doc = "Field `SOFTBREQ8` reader - Software burst request flags for each of ... | code_fim | hard | {
"lang": "rust",
"repo": "rcls/svd2rust-example",
"path": "/lpc408x/src/gpdma/softbreq.rs",
"mode": "psm",
"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.