text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> let loops = loop_analysis.loops().collect::<Vec<Loop>>();
assert_eq!(loops.len(), 2);
assert_eq!(loop_analysis.loop_header(loops[0]), block0);
assert_eq!(loop_analysis.loop_header(loops[1]), block1);
assert_eq!(loop_analysis.loop_parent(loops[1]), Some(loops[0]));
... | code_fim | hard | {
"lang": "rust",
"repo": "bytecodealliance/wasmtime",
"path": "/cranelift/codegen/src/loop_analysis.rs",
"mode": "spm",
"license": "LLVM-exception",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: bytecodealliance/wasmtime path: /cranelift/codegen/src/loop_analysis.rs
rmation for a single function.
///
/// Loops are referenced by the Loop object, and for each loop you can access its header block,
/// its eventual parent in the loop tree and all the block belonging to the loop.
pub struct ... | code_fim | hard | {
"lang": "rust",
"repo": "bytecodealliance/wasmtime",
"path": "/cranelift/codegen/src/loop_analysis.rs",
"mode": "psm",
"license": "LLVM-exception",
"source": "the-stack-v2"
} |
<|fim_suffix|>pub fn nrf52840_gpio_create<'a>() -> Port<'a, NUM_PINS> {
Port::new([
GPIOPin::new(Pin::P0_00),
GPIOPin::new(Pin::P0_01),
GPIOPin::new(Pin::P0_02),
GPIOPin::new(Pin::P0_03),
GPIOPin::new(Pin::P0_04),
GPIOPin::new(Pin::P0_05),
GPIOPin::new(Pin::P0... | code_fim | medium | {
"lang": "rust",
"repo": "tock/tock",
"path": "/chips/nrf52840/src/gpio.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: tock/tock path: /chips/nrf52840/src/gpio.rs
// Licensed under the Apache License, Version 2.0 or the MIT License.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Copyright Tock Contributors 2022.
pub use nrf52::gpio::{GPIOPin, Pin, Port};
<|fim_suffix|>pub fn nrf52840_gpio_create<'a>() -> Por... | code_fim | medium | {
"lang": "rust",
"repo": "tock/tock",
"path": "/chips/nrf52840/src/gpio.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> let remaining_tokens = vec![
open_brace_remaining,
win_remaining,
colon_remaining,
true_token_remaining,
close_brace_remaining,
];
assert_eq!(remove_whitespace(tokens), remaining_tokens)
}
}<|fim_prefix|>// repo: pete... | code_fim | hard | {
"lang": "rust",
"repo": "peterheesterman/jsonist",
"path": "/src/parser/utils.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: peterheesterman/jsonist path: /src/parser/utils.rs
use crate::tokenizer::Token;
pub fn remove_whitespace(tokens: Vec<Token>) -> Vec<Token> {
tokens
.into_iter()
.filter(|token| match token {
Token::WhiteSpace(_, _) => false,
_ => true,
})
... | code_fim | hard | {
"lang": "rust",
"repo": "peterheesterman/jsonist",
"path": "/src/parser/utils.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let tokens = vec![
whitespace,
open_brace,
whitespace2,
win,
whitespace3,
colon,
whitespace4,
true_token,
whitespace5,
close_brace,
whitespace6,
whitespac... | code_fim | hard | {
"lang": "rust",
"repo": "peterheesterman/jsonist",
"path": "/src/parser/utils.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: pixers/imaginator path: /src/url.rs
use nom;
use base64;
use urlencoding;
use crypto::hmac::Hmac;
use crypto::mac::{MacResult, Mac};
use crypto::sha1::Sha1;
use crate::cfg::CONFIG;
use crate::imaginator::url::filter;
use crate::imaginator::filter::Filter;
#[derive(Debug, Fail, Clone)]
pub enum ... | code_fim | hard | {
"lang": "rust",
"repo": "pixers/imaginator",
"path": "/src/url.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>named!(full_url(&str) -> (Option<bool>, Filter), do_parse! (
sig: opt!(complete!(signature)) >>
filter: call!(filter) >>
(sig, filter)
));
pub fn parse(input: &str) -> Result<Filter, UrlParseError> {
let url = match urlencoding::decode(input) {
Ok(url) => url,
Err(_) => re... | code_fim | hard | {
"lang": "rust",
"repo": "pixers/imaginator",
"path": "/src/url.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: leonkunert/Projects-Rust path: /numbers/tile_cost_calculator.rs
extern crate debug;
use std::io;
fn to_interger(string :String) -> int {
<|fim_suffix|> let price = width * depth * tile_price;
println!("The Price for the tiles would be: {}€", price);
}<|fim_middle|> match from_str::<... | code_fim | hard | {
"lang": "rust",
"repo": "leonkunert/Projects-Rust",
"path": "/numbers/tile_cost_calculator.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> println!("Enter width of the room:");
let width = to_interger(io::stdin().read_line().unwrap());
println!("Enter depth of the room:");
let depth = to_interger(io::stdin().read_line().unwrap());
println!("Enter price of sqrm of tiles:");
let tile_price = to_interger(io::stdin().read... | code_fim | medium | {
"lang": "rust",
"repo": "leonkunert/Projects-Rust",
"path": "/numbers/tile_cost_calculator.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> &mut self.runtime
}
}
#[cfg(test)]
pub fn parse<'a>(input: &'a str) -> WithError<SourceFile> {
use crate::ParseDatabase;
use errors::FileDatabase;
use std::io::Write;
use tempfile::NamedTempFile;
let mut file = NamedTempFile::new().unwrap();
write!(file, "{}", input).... | code_fim | medium | {
"lang": "rust",
"repo": "Lapz/tox",
"path": "/parser/src/utils.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[cfg(test)]
pub fn parse<'a>(input: &'a str) -> WithError<SourceFile> {
use crate::ParseDatabase;
use errors::FileDatabase;
use std::io::Write;
use tempfile::NamedTempFile;
let mut file = NamedTempFile::new().unwrap();
write!(file, "{}", input).unwrap();
let db = MockDatabase... | code_fim | hard | {
"lang": "rust",
"repo": "Lapz/tox",
"path": "/parser/src/utils.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Lapz/tox path: /parser/src/utils.rs
use crate::AstNode;
#[cfg(test)]
use errors::WithError;
#[cfg(test)]
use syntax::ast::SourceFile;
pub fn dump_debug<T: AstNode>(item: &T) -> String {
format!("{:#?}", item.syntax())
}
#[cfg(test)]
#[salsa::database(errors::FileDatabaseStorage, crate::Par... | code_fim | medium | {
"lang": "rust",
"repo": "Lapz/tox",
"path": "/parser/src/utils.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>// Writes multiple meshes to context
pub fn draw_mesh<F>(context: &mut Context, mesh: &SimpleMesh, transform: Matrix4<f32>, shader: F)
where
F: Fn(f32) -> char,
{
for triangle in &mesh.triangles {
draw_triangle(context, &triangle, transform, &shader);
}
}
pub fn draw_triangle<F>(
... | code_fim | hard | {
"lang": "rust",
"repo": "ecumene/rust-sloth",
"path": "/src/rasterizer.rs",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ecumene/rust-sloth path: /src/rasterizer.rs
use crate::context::Context;
use crate::geometry::{SimpleMesh, Triangle};
use nalgebra::{Matrix4, Vector4};
pub fn default_shader(shade: f32) -> char {
if shade <= 0.20 {
'.'
} else if shade <= 0.30 {
':'
} else if shade <=... | code_fim | hard | {
"lang": "rust",
"repo": "ecumene/rust-sloth",
"path": "/src/rasterizer.rs",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: LongJohnCoder/sv-parser path: /sv-parser-parser/src/lib.rs
pub mod keywords;
#[macro_use]
pub mod utils;
pub(crate) use keywords::*;
pub(crate) use utils::*;
mod tests;
pub mod behavioral_statements;
pub mod declarations;
pub mod expressions;
pub mod general;
pub mod instantiations;
pub mod pr... | code_fim | hard | {
"lang": "rust",
"repo": "LongJohnCoder/sv-parser",
"path": "/sv-parser-parser/src/lib.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.tracable_info = info;
self
}
}
impl HasExtraState<bool> for SpanInfo {
fn get_extra_state(&self) -> bool {
in_directive()
}
}
// -----------------------------------------------------------------------------
nom_packrat::storage!(AnyNode, bool, 1024);
pub fn sv_... | code_fim | hard | {
"lang": "rust",
"repo": "LongJohnCoder/sv-parser",
"path": "/sv-parser-parser/src/lib.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: crossterm-rs/examples path: /snake/src/map.rs
use std::io::{stdout, Write};
use crossterm::{cursor::MoveTo, queue, style::Colorize, style::PrintStyledContent, Result};
use rand::{
self,
distributions::{IndependentSample, Range},
};
use super::snake::Snake;
use super::types::Position;
... | code_fim | hard | {
"lang": "rust",
"repo": "crossterm-rs/examples",
"path": "/snake/src/map.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// Spawns a new food and draws it.
///
/// The `snake` argument is used to check that the food position doesn't collide
/// with any snake fragment.
pub fn spawn_food(&mut self, snake: &Snake) -> Result<()> {
let free_area_width = self.width - 2;
let free_area_height =... | code_fim | hard | {
"lang": "rust",
"repo": "crossterm-rs/examples",
"path": "/snake/src/map.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: constf1/aoc_2020 path: /src/day_16.rs
use std::collections::HashMap;
use std::error::Error;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::ops::RangeInclusive;
use std::str::FromStr;
struct Rule {
name: String,
range_1: RangeInclusive<usize>,
range_2: RangeInclusive<... | code_fim | hard | {
"lang": "rust",
"repo": "constf1/aoc_2020",
"path": "/src/day_16.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ticket.iter().all(|val| is_valid_any_rule(rules, val))
}
pub fn run() {
println!("--- Day 16: Ticket Translation ---");
let rules = read_rules().expect("invalid rules");
let mut tickets = read_tickets().expect("invalid tickets");
// Start by determining which tickets are completely ... | code_fim | hard | {
"lang": "rust",
"repo": "constf1/aoc_2020",
"path": "/src/day_16.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ErichDonGubler/cargo-release path: /src/error.rs
#[derive(Debug)]
pub struct CliError {
error: Option<anyhow::Error>,
code: i32,
}
impl CliError {
pub fn silent(code: i32) -> Self {
Self { error: None, code }
}
pub fn message(e: impl Into<anyhow::Error>) -> Self {
... | code_fim | medium | {
"lang": "rust",
"repo": "ErichDonGubler/cargo-release",
"path": "/src/error.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl std::fmt::Display for CliError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
if let Some(error) = self.error.as_ref() {
error.fmt(f)
} else {
Ok(())
}
}
}
/// Report any error message and exit.
pub fn exit(result: Result<()... | code_fim | hard | {
"lang": "rust",
"repo": "ErichDonGubler/cargo-release",
"path": "/src/error.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>/// Report, delegating exiting to the caller.
pub fn report(result: Result<(), CliError>) -> i32 {
match result {
Ok(()) => 0,
Err(err) => {
if let Some(error) = err.error {
// At this point, we might be exiting due to a broken pipe, just do our best and
... | code_fim | hard | {
"lang": "rust",
"repo": "ErichDonGubler/cargo-release",
"path": "/src/error.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn update_bucket(&mut self, node_info: NodeInfo) {
let distance = node_info.get_id().distance(&self.id);
self.k_bucket.update_bucket(node_info, distance);
}
}<|fim_prefix|>// repo: tkmct/kadrs path: /src/node.rs
use {
crate::{bucket::KBucket, error::Result, in_memory_hash_... | code_fim | medium | {
"lang": "rust",
"repo": "tkmct/kadrs",
"path": "/src/node.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: tkmct/kadrs path: /src/node.rs
use {
crate::{bucket::KBucket, error::Result, in_memory_hash_table::Table, key::Key},
serde::{Deserialize, Serialize},
std::net::SocketAddrV4,
};
#[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize)]
pub struct NodeInfo {
host: SocketAddrV... | code_fim | hard | {
"lang": "rust",
"repo": "tkmct/kadrs",
"path": "/src/node.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl NodeInfo {
pub fn new(host: SocketAddrV4, id: Key) -> Self {
Self { host, id }
}
pub fn get_id(&self) -> &Key {
&self.id
}
pub fn get_host(&self) -> &SocketAddrV4 {
&self.host
}
}
impl From<SocketAddrV4> for NodeInfo {
fn from(host: SocketAddrV4) ... | code_fim | medium | {
"lang": "rust",
"repo": "tkmct/kadrs",
"path": "/src/node.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl SpeechSynthesisWordBoundaryEvent {
pub fn from_handle(handle: SPXEVENTHANDLE) -> Result<Self> {
unsafe {
let mut audio_offset: u64 = MaybeUninit::uninit().assume_init();
let mut text_offset: u32 = MaybeUninit::uninit().assume_init();
let mut word_length... | code_fim | hard | {
"lang": "rust",
"repo": "Daenecompass/cognitive-services-speech-sdk-rs",
"path": "/src/speech/speech_synthesis_word_boundary_event.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Ok(SpeechSynthesisWordBoundaryEvent {
handle: SmartHandle::create(
"SpeechSynthesisWordBoundaryEvent",
handle,
synthesizer_event_handle_release,
),
audio_offset,
text_off... | code_fim | hard | {
"lang": "rust",
"repo": "Daenecompass/cognitive-services-speech-sdk-rs",
"path": "/src/speech/speech_synthesis_word_boundary_event.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Daenecompass/cognitive-services-speech-sdk-rs path: /src/speech/speech_synthesis_word_boundary_event.rs
use crate::error::{convert_err, Result};
use crate::ffi::{
synthesizer_event_handle_release, synthesizer_word_boundary_event_get_values, SmartHandle,
SPXEVENTHANDLE,
};
use std::mem::M... | code_fim | hard | {
"lang": "rust",
"repo": "Daenecompass/cognitive-services-speech-sdk-rs",
"path": "/src/speech/speech_synthesis_word_boundary_event.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> v // return ownership
}<|fim_prefix|>// repo: kdxu/rust-sand path: /cargo-test/src/own.rs
fn main () {
}
fn foo () {
let v = vec![1, 2, 3]; //vector allocates space for heap
let v2 = v;
println!("v[0] : {}", v[0]); // occurs error
}
<|fim_middle|>fn foo2(v: Vec<i32>) -> Vec<i32> {
| code_fim | easy | {
"lang": "rust",
"repo": "kdxu/rust-sand",
"path": "/cargo-test/src/own.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: kdxu/rust-sand path: /cargo-test/src/own.rs
fn main () {
}
fn foo () {
let v = vec![1, 2, 3]; //vector allocates space for heap
let v2 = v;
println!("v[0] : {}", v[0]); // occurs error
}
<|fim_suffix|> v // return ownership
}<|fim_middle|>fn foo2(v: Vec<i32>) -> Vec<i32> {
| code_fim | easy | {
"lang": "rust",
"repo": "kdxu/rust-sand",
"path": "/cargo-test/src/own.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>fn foo2(v: Vec<i32>) -> Vec<i32> {
v // return ownership
}<|fim_prefix|>// repo: kdxu/rust-sand path: /cargo-test/src/own.rs
fn main () {
}
fn foo () {
<|fim_middle|> let v = vec![1, 2, 3]; //vector allocates space for heap
let v2 = v;
println!("v[0] : {}", v[0]); // occurs error
}
| code_fim | medium | {
"lang": "rust",
"repo": "kdxu/rust-sand",
"path": "/cargo-test/src/own.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let app_url = if dev {
&config.build.dev_path
} else {
&config.build.dist_dir
};
let assets = match app_url {
AppUrl::Url(url) => match url {
WindowUrl::External(_) => Default::default(),
WindowUrl::App(path) => {
if path.components().count() == 0 {
panic... | code_fim | hard | {
"lang": "rust",
"repo": "tauri-apps/tauri",
"path": "/core/tauri-codegen/src/context.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> let key = uuid::Uuid::new_v4().to_string();
let map_isolation = map_isolation(&options, dir.clone());
let assets = EmbeddedAssets::new(dir, &options, |key, path, input, csp_hashes| {
// we check if `__TAURI_ISOLATION_HOOK__` exists in the isolation code
// before modifyin... | code_fim | hard | {
"lang": "rust",
"repo": "tauri-apps/tauri",
"path": "/core/tauri-codegen/src/context.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: tauri-apps/tauri path: /core/tauri-codegen/src/context.rs
hes, EmbeddedAssets, EmbeddedAssetsError};
/// Necessary data needed by [`context_codegen`] to generate code for a Tauri application context.
pub struct ContextData {
pub dev: bool,
pub config: Config,
pub config_parent: PathBuf,
... | code_fim | hard | {
"lang": "rust",
"repo": "tauri-apps/tauri",
"path": "/core/tauri-codegen/src/context.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: cloudboss/ferro path: /src/command.rs
use std::io;
use std::process;
use std::vec::Vec;
pub fn run(command: String, args: Vec<String><|fim_suffix|>(process::Stdio::piped())
.spawn()
.and_then(|child| child.wait_with_output())
}<|fim_middle|>) -> Result<process::Output, io::Error... | code_fim | medium | {
"lang": "rust",
"repo": "cloudboss/ferro",
"path": "/src/command.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>(process::Stdio::piped())
.spawn()
.and_then(|child| child.wait_with_output())
}<|fim_prefix|>// repo: cloudboss/ferro path: /src/command.rs
use std::io;
use std::process;
use std::vec::Vec;
pub fn run(command: String, args: Vec<String>) -> Result<process::Output, io::Error> {
proces... | code_fim | medium | {
"lang": "rust",
"repo": "cloudboss/ferro",
"path": "/src/command.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// Read the target's registers.
///
/// The registers should be read in the order specified in the
/// [`<target>.xml`](#whats-targetxml). The provided `push_reg` function
/// should be called with the register's value.
// e.g: for ARM: binutils-gdb/blob/master/gdb/features/arm/ar... | code_fim | hard | {
"lang": "rust",
"repo": "sapir/gdbstub",
"path": "/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// Write bytes to the specified address range.
fn write_addrs(&mut self, get_addr_val: impl FnMut() -> Option<(Self::Usize, u8)>);
/// Return the platform's `features.xml` file.
///
/// Implementing this method enables `gdb` to automatically detect the
/// target's architecture, ... | code_fim | hard | {
"lang": "rust",
"repo": "sapir/gdbstub",
"path": "/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: sapir/gdbstub path: /src/lib.rs
//! An implementation of the
//! [GDB Remote Serial Protocol](https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html#Remote-Protocol)
//! in Rust, primarily for use in emulators.
//!
//! `gdbstub` tries to make as few assumptions as possible about your pro... | code_fim | hard | {
"lang": "rust",
"repo": "sapir/gdbstub",
"path": "/src/lib.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut stmts = Vec::new();
let fn_ident = ast::Ident::new(token::intern(format!("__inner_{}", fn_name).as_slice()));
// Construct the inner function.
let inner_item = box(GC) Item { attrs: Vec::new(), .. (*item).clone() };
stmts.push(fn_decl(sp,... | code_fim | hard | {
"lang": "rust",
"repo": "rust-highfive/libhoare",
"path": "/libhoare/lib.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let fn_name = ast::Ident::new(token::intern(format!("__inner_fn_{}", fn_name).as_slice()));
// Construct the inner function.
let inner_item = box(GC) Item { attrs: Vec::new(), .. (*item).clone() };
stmts.push(fn_decl(sp, fn_name, inner_item));
/... | code_fim | hard | {
"lang": "rust",
"repo": "rust-highfive/libhoare",
"path": "/libhoare/lib.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: rust-highfive/libhoare path: /libhoare/lib.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.a... | code_fim | hard | {
"lang": "rust",
"repo": "rust-highfive/libhoare",
"path": "/libhoare/lib.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> sky_memcpy(str_ptr as _, string.as_ptr() as _, string.len()).ok()?;
Ok(())
}
/// Overwrite a value in read-only data with a passed value given an offset from the start of .text
pub unsafe fn patch_data<T: Sized + Copy>(offset: usize, val: &T) -> Result<(), Error> {
let text_ptr = getRegionAd... | code_fim | hard | {
"lang": "rust",
"repo": "kolakcc/skyline-rs",
"path": "/src/patching.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: kolakcc/skyline-rs path: /src/patching.rs
use crate::libc::{c_void, size_t, strlen};
use crate::error::{SwitchResult, Error, ErrorKind};
use crate::hooks::{Region, getRegionAddress};
extern "C" {
pub fn sky_memcpy(dst: *const c_void, src: *const c_void, size: size_t) -> SwitchResult;
}
///... | code_fim | medium | {
"lang": "rust",
"repo": "kolakcc/skyline-rs",
"path": "/src/patching.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Ok(())
}
/// Overwrite a value in read-only data with a passed value given an offset from the start of .text
pub unsafe fn patch_data<T: Sized + Copy>(offset: usize, val: &T) -> Result<(), Error> {
let text_ptr = getRegionAddress(Region::Text) as *const u8;
patch_data_from_text(text_ptr, offs... | code_fim | medium | {
"lang": "rust",
"repo": "kolakcc/skyline-rs",
"path": "/src/patching.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: vi/rq path: /serde-avro/src/error.rs
use serde;
use serde_json;
use std::fmt;
use std::io;
use std::string;
error_chain! {
foreign_links {
IO(io::Error);
Utf8(string::FromUtf8Error);
JsonDecode(serde_json::Error);
}
errors {
NoSuchType(type_name: Str... | code_fim | hard | {
"lang": "rust",
"repo": "vi/rq",
"path": "/serde-avro/src/error.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> called {:?}", name)
}
EndOfStream {
description("end of stream")
display("end of stream")
}
IntegerOverflow {
description("integer overflow")
display("integer overflow")
}
NegativeLength {
descript... | code_fim | hard | {
"lang": "rust",
"repo": "vi/rq",
"path": "/serde-avro/src/error.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: raiote/design-pattern path: /strategy/src/lib.rs
mod coupon;
mod context {
pub use crate::CouponTrait;
pub struct Context<T> {
coupon: Box<dyn CouponTrait<T>>,
}
impl<T> Context<T> {
pub fn new(coupon: Box<dyn CouponTrait<T>>) -> Self {
Self { coupo... | code_fim | hard | {
"lang": "rust",
"repo": "raiote/design-pattern",
"path": "/strategy/src/lib.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let ctx = Context::new(Box::new(Discount {}));
let price = ctx.amount(0.8, 100.0);
assert_eq!(price, 80.0);
}
#[test]
fn fixed() {
let ctx = Context::new(Box::new(Fixed {}));
let price = ctx.amount(50.0, 100.0);
assert_eq!(price, 50.0);
}
... | code_fim | medium | {
"lang": "rust",
"repo": "raiote/design-pattern",
"path": "/strategy/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
let mut goto_item: HashMap<Letter, GotoTableItem> = HashMap::new();
let mut action_item: HashMap<Letter, ActionTableItem> = HashMap::new();
let mut merge: HashSet<LR1Item> = HashSet::new();
for set in hash_lr0.get(&state_hash).unwrap().iter() {
// println!("a... | code_fim | hard | {
"lang": "rust",
"repo": "wormtql/rusty-parser",
"path": "/src/lalr1/mod.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut goto_item: HashMap<Letter, GotoTableItem> = HashMap::new();
let mut action_item: HashMap<Letter, ActionTableItem> = HashMap::new();
let mut merge: HashSet<LR1Item> = HashSet::new();
for set in hash_lr0.get(&state_hash).unwrap().iter() {
// println!("aa... | code_fim | hard | {
"lang": "rust",
"repo": "wormtql/rusty-parser",
"path": "/src/lalr1/mod.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: wormtql/rusty-parser path: /src/lalr1/mod.rs
use crate::lr1::lr1_item_set_family::LR1ItemSetFamily;
use crate::lr1::lr1_item::LR1Item;
use std::collections::{HashMap, HashSet};
// use std::hash::Hash;
use std::iter;
use crate::lr_table::LALRTable;
use crate::grammar::letter::Letter;
use crate::g... | code_fim | hard | {
"lang": "rust",
"repo": "wormtql/rusty-parser",
"path": "/src/lalr1/mod.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Madoshakalaka/malvolio path: /malvolio/src/tags/option.rs
/*
This source code file is distributed subject to the terms of the Mozilla Public License v2.0.
A copy of this license can be found in the `licenses` directory at the root of this project.
*/
use crate::{
into_attribute_for_grouping... | code_fim | hard | {
"lang": "rust",
"repo": "Madoshakalaka/malvolio",
"path": "/malvolio/src/tags/option.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> f.write_str("<option ")?;
write_attributes(&self.attrs, f)?;
f.write_str(">")?;
self.text.fmt(f)?;
f.write_str("</option>")
}
}
utility_enum!(
/// An attribute for the <select> tag.
#[allow(missing_docs)]
pub enum SelectOptionAttr {
Value(Va... | code_fim | hard | {
"lang": "rust",
"repo": "Madoshakalaka/malvolio",
"path": "/malvolio/src/tags/option.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[cfg(not(feature = "pure"))]
mod impure {
elf_from_fd!(!0);
}<|fim_prefix|>// repo: ticki/goblin path: /src/elf/_32/mod.rs
//! The ELF 32-bit struct definitions and associated values
pub mod header;
pub mod sym;
pub mod program_header;
pub mod section_header;
pub mod dyn;
pub mod rela;
<|fim_middl... | code_fim | easy | {
"lang": "rust",
"repo": "ticki/goblin",
"path": "/src/elf/_32/mod.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ticki/goblin path: /src/elf/_32/mod.rs
//! The ELF 32-bit struct definitions and associated values
<|fim_suffix|>#[cfg(not(feature = "pure"))]
mod impure {
elf_from_fd!(!0);
}<|fim_middle|>pub mod header;
pub mod sym;
pub mod program_header;
pub mod section_header;
pub mod dyn;
pub mod rela... | code_fim | medium | {
"lang": "rust",
"repo": "ticki/goblin",
"path": "/src/elf/_32/mod.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[cfg(not(feature = "pure"))]
pub use self::impure::*;
#[cfg(not(feature = "pure"))]
mod impure {
elf_from_fd!(!0);
}<|fim_prefix|>// repo: ticki/goblin path: /src/elf/_32/mod.rs
//! The ELF 32-bit struct definitions and associated values
<|fim_middle|>pub mod header;
pub mod sym;
pub mod program_h... | code_fim | medium | {
"lang": "rust",
"repo": "ticki/goblin",
"path": "/src/elf/_32/mod.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: snicmakino/competitive-programming-ant path: /src/q1_1.rs
mod q1_1 {
pub fn solve(n: usize, m: i32, k: Vec<i32>) -> bool {
let mut kk = vec![];
for a in 0..n {
for b in 0..n {
kk.push(k[a] + k[b]);
}
}
kk.sort();
... | code_fim | hard | {
"lang": "rust",
"repo": "snicmakino/competitive-programming-ant",
"path": "/src/q1_1.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let n = 3;
let m = 10;
let k = vec![1, 3, 5];
assert_eq!(solve(n, m, k), true);
}
#[test]
fn test2() {
let n = 3;
let m = 9;
let k = vec![1, 3, 5];
assert_eq!(solve(n, m, k), false);
}
}<|fim_prefix|>// repo: snicmakino/compet... | code_fim | medium | {
"lang": "rust",
"repo": "snicmakino/competitive-programming-ant",
"path": "/src/q1_1.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>w();
copy("src/created_files", "src/pasta", &options);
}<|fim_prefix|>// repo: DaniloSamways/RustFileManager path: /src/clone.rs
extern crate fs_extra;
use fs_extra::dir::*;
pub fn clone_dir(){
//fs::copy("src/created_files/dsadds.txt", "src/cr<|fim_middle|>eated_files/arquivo.txt");
let opt... | code_fim | medium | {
"lang": "rust",
"repo": "DaniloSamways/RustFileManager",
"path": "/src/clone.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: DaniloSamways/RustFileManager path: /src/clone.rs
extern crate fs_extra;
use fs_extra::dir::*;
pub fn clone_d<|fim_suffix|>eated_files/arquivo.txt");
let options = CopyOptions::new();
copy("src/created_files", "src/pasta", &options);
}<|fim_middle|>ir(){
//fs::copy("src/created_file... | code_fim | medium | {
"lang": "rust",
"repo": "DaniloSamways/RustFileManager",
"path": "/src/clone.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: MaiCw4J/leetcode.rs path: /src/algorithms/remove_outer_parentheses_1021.rs
// https://leetcode.com/problems/remove-outermost-parentheses/
pub fn remove_outer_parentheses(s: String) -> String {
let mut res = String::from("");
let mut opened = 0;
for c in s.chars() {
match c {... | code_fim | medium | {
"lang": "rust",
"repo": "MaiCw4J/leetcode.rs",
"path": "/src/algorithms/remove_outer_parentheses_1021.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let input = "(()())(())".to_owned();
let output = "()()()".to_owned();
assert_eq!(output, remove_outer_parentheses(input));
}
}<|fim_prefix|>// repo: MaiCw4J/leetcode.rs path: /src/algorithms/remove_outer_parentheses_1021.rs
// https://leetcode.com/problems/remove-outermost-p... | code_fim | medium | {
"lang": "rust",
"repo": "MaiCw4J/leetcode.rs",
"path": "/src/algorithms/remove_outer_parentheses_1021.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: sanbox-irl/bit-bots path: /src/hardware_interfaces/renderer/renderer_component.rs
let image_count = if swap_config.present_mode.contains(PresentMode::MAILBOX) {
(caps.image_count.end() - 1).min(*caps.image_count.start().max(&3))
} else {
(caps.im... | code_fim | hard | {
"lang": "rust",
"repo": "sanbox-irl/bit-bots",
"path": "/src/hardware_interfaces/renderer/renderer_component.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let depth_stencil = DepthStencilDesc {
depth: None,
depth_bounds: false,
stencil: None,
};
let blender = BlendDesc {
logic_op: Some(LogicOp::Copy),
targets: vec![ColorBlendDesc {
mask: ColorMask::ALL,
... | code_fim | hard | {
"lang": "rust",
"repo": "sanbox-irl/bit-bots",
"path": "/src/hardware_interfaces/renderer/renderer_component.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let attributes = Vertex::attributes();
let rasterizer = Rasterizer {
depth_clamping: false,
polygon_mode: PolygonMode::Fill,
cull_face: Face::empty(),
front_face: FrontFace::Clockwise,
depth_bias: None,
conservative: ... | code_fim | hard | {
"lang": "rust",
"repo": "sanbox-irl/bit-bots",
"path": "/src/hardware_interfaces/renderer/renderer_component.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> -> RsbtResult<()>;
async fn quit() -> RsbtResult<()>;
}<|fim_prefix|>// repo: rsbt/rsbt path: /_rsbt-app/src/application/app_service.rs
use super::AppTypeFactory;
use crate::RsbtResult;
use async<|fim_middle|>_trait::async_trait;
#[async_trait]
pub trait AppService {
async fn start() -> RsbtRes... | code_fim | medium | {
"lang": "rust",
"repo": "rsbt/rsbt",
"path": "/_rsbt-app/src/application/app_service.rs",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> async fn start() -> RsbtResult<()>;
async fn stop() -> RsbtResult<()>;
async fn quit() -> RsbtResult<()>;
}<|fim_prefix|>// repo: rsbt/rsbt path: /_rsbt-app/src/application/app_service.rs
use super::AppTypeFactory;
use crate::RsbtResult;
use async<|fim_middle|>_trait::async_trait;
#[async_tr... | code_fim | medium | {
"lang": "rust",
"repo": "rsbt/rsbt",
"path": "/_rsbt-app/src/application/app_service.rs",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: rsbt/rsbt path: /_rsbt-app/src/application/app_service.rs
use super::AppTypeFactory;
use crate::RsbtResult;
use async<|fim_suffix|> async fn start() -> RsbtResult<()>;
async fn stop() -> RsbtResult<()>;
async fn quit() -> RsbtResult<()>;
}<|fim_middle|>_trait::async_trait;
#[async_tr... | code_fim | medium | {
"lang": "rust",
"repo": "rsbt/rsbt",
"path": "/_rsbt-app/src/application/app_service.rs",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: tobyoxborrow/adventofcode path: /2020/07-handy-haversacks/aoc202007/src/main.rs
use petgraph::graph::NodeIndex;
use petgraph::{Graph, Incoming, Outgoing};
use std::collections::HashMap;
use std::collections::HashSet;
#[macro_use]
extern crate lazy_static;
use regex::Regex;
const PUZZLE: &str = ... | code_fim | hard | {
"lang": "rust",
"repo": "tobyoxborrow/adventofcode",
"path": "/2020/07-handy-haversacks/aoc202007/src/main.rs",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> weight
}
#[test]
fn test_solve_a0() {
let test_puzzle: &str = "
light red bags contain 1 bright white bag, 2 muted yellow bags.
dark orange bags contain 3 bright white bags, 4 muted yellow bags.
bright white bags contain 1 shiny gold bag.
muted yellow bags contain 2 shiny gold bags, 9 faded blue ... | code_fim | hard | {
"lang": "rust",
"repo": "tobyoxborrow/adventofcode",
"path": "/2020/07-handy-haversacks/aoc202007/src/main.rs",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> model_map.insert(variable_name, function_string);
}
}
let mut variables = variables.into_iter().collect::<Vec<_>>();
variables.sort();
let mut graph = RegulatoryGraph::new(variables.clone());
// First, build graph.
for variable ... | code_fim | hard | {
"lang": "rust",
"repo": "sybila/biodivine-lib-param-bn",
"path": "/src/_impl_boolean_network_from_bnet.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: sybila/biodivine-lib-param-bn path: /src/_impl_boolean_network_from_bnet.rs
use crate::_aeon_parser::FnUpdateTemp;
use crate::{BooleanNetwork, RegulatoryGraph};
use std::collections::{HashMap, HashSet};
use std::convert::TryFrom;
impl BooleanNetwork {
/// Try to load a Boolean network from ... | code_fim | hard | {
"lang": "rust",
"repo": "sybila/biodivine-lib-param-bn",
"path": "/src/_impl_boolean_network_from_bnet.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: mbellani/cadence path: /cadence/examples/unwrapped-client.rs
// Cadence - An extensible Statsd client for Rust!
//
// To the extent possible under law, the author(s) have dedicated all copyright and
// related and neighboring rights to this file to the public domain worldwide.
// This software i... | code_fim | medium | {
"lang": "rust",
"repo": "mbellani/cadence",
"path": "/cadence/examples/unwrapped-client.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> let metrics_copy = self.metrics.clone();
let t = thread::spawn(move || {
let _ = metrics_copy.count("request.handled", 1);
println!("Hello from a threaded handler!");
});
t.join().unwrap();
Ok(())
}
}
fn main() {
let handler = Thre... | code_fim | hard | {
"lang": "rust",
"repo": "mbellani/cadence",
"path": "/cadence/examples/unwrapped-client.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl RequestHandler for ThreadedHandler {
fn handle(&self) -> Result<(), String> {
let metrics_copy = self.metrics.clone();
let t = thread::spawn(move || {
let _ = metrics_copy.count("request.handled", 1);
println!("Hello from a threaded handler!");
});... | code_fim | hard | {
"lang": "rust",
"repo": "mbellani/cadence",
"path": "/cadence/examples/unwrapped-client.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut build = builder();
if cfg!(feature = "cty") {
build = build.ctypes_prefix("::cty");
};
build
.use_core()
.default_enum_style(EnumVariation::Rust {
non_exhaustive: true,
})
.rust_target(RustTarget::Nightly)
.array_pointers_... | code_fim | medium | {
"lang": "rust",
"repo": "elichai/syscalls-rs",
"path": "/linux-sys/build.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>fn unrecognized_arch() -> ! {
if env::var("CARGO_CFG_TARGET_FAMILY").unwrap() == "unix" {
let target = env::var("TARGET").unwrap();
panic!(
"unix target isn't recognize: {}, please report to: {}",
target, ISSUE
);
} else {
panic!("Tried to us... | code_fim | hard | {
"lang": "rust",
"repo": "elichai/syscalls-rs",
"path": "/linux-sys/build.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: elichai/syscalls-rs path: /linux-sys/build.rs
use bindgen::{builder, EnumVariation, RustTarget};
use std::env;
use std::path::PathBuf;
const ISSUE: &str = "https://github.com/elichai/syscalls-rs/issues";
// We can rely on include order to first include our `#include <linux/*.h>` before the sys... | code_fim | hard | {
"lang": "rust",
"repo": "elichai/syscalls-rs",
"path": "/linux-sys/build.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>pub const SOFTOFF_EXT_ID: u32 = 350;<|fim_prefix|>// repo: romixlab/uwb-playground path: /src/newconfig/mod.rs
#[cfg(feature = "master")]
pub mod master;
#[cfg(feature = "tr")]
pub mod tr;
#[cfg(feature = "bl")]
pub mod bl;
#[cfg(feature = "br")]
pub mod br;
<|fim_middle|>#[cfg(feature = "master")]
pub ... | code_fim | medium | {
"lang": "rust",
"repo": "romixlab/uwb-playground",
"path": "/src/newconfig/mod.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: romixlab/uwb-playground path: /src/newconfig/mod.rs
#[cfg(feature = "master")]
pub mod master;
#[cfg(feature = "tr")]
pub mod tr;
#[cfg(feature = "bl")]
pub mod bl;
#[cfg(feature = "br")]
pub mod br;
<|fim_suffix|>pub const SOFTOFF_EXT_ID: u32 = 350;<|fim_middle|>#[cfg(feature = "master")]
pub ... | code_fim | medium | {
"lang": "rust",
"repo": "romixlab/uwb-playground",
"path": "/src/newconfig/mod.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> // Only list features if QUIET != "true"
match env::var("QUIET") {
Ok(v) => if v != "true" { list_features() },
Err(_) => list_features(),
};
rocket::ignite()
.mount("/", routes![index, health])
.catch(errors![not_found])
.launch();
}<|fim_prefix|>/... | code_fim | hard | {
"lang": "rust",
"repo": "KattMingMing/syntect_server",
"path": "/src/main.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>fn main() {
// Only list features if QUIET != "true"
match env::var("QUIET") {
Ok(v) => if v != "true" { list_features() },
Err(_) => list_features(),
};
rocket::ignite()
.mount("/", routes![index, health])
.catch(errors![not_found])
.launch();
}<|f... | code_fim | hard | {
"lang": "rust",
"repo": "KattMingMing/syntect_server",
"path": "/src/main.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: KattMingMing/syntect_server path: /src/main.rs
#![feature(plugin)]
#![plugin(rocket_codegen)]
extern crate rocket;
extern crate serde_json;
#[macro_use]
extern crate rocket_contrib;
#[macro_use]
extern crate serde_derive;
extern crate syntect;
#[macro_use]
extern crate lazy_static;
extern crate... | code_fim | hard | {
"lang": "rust",
"repo": "KattMingMing/syntect_server",
"path": "/src/main.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> // Get the new memory map and terminate boot services
bs.get_memory_map(&mut mmap).map_err(BootError::MemoryMapError)?;
bs.exit_boot_services(mmap.key).map_err(BootError::TerminateServicesError)?;
set_efi_mmap(data, &mmap)?;
// Setup upper virtual mapping if requested
let real_ent... | code_fim | hard | {
"lang": "rust",
"repo": "alnyan/yboot2",
"path": "/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> real_entry = entry;
} else {
real_entry = if entry >= 0xFFFFFF0000000000 {
entry - 0xFFFFFF0000000000
} else {
entry
};
}
unsafe {
llvm_asm!("xor %rbp, %rbp; jmp *$0"::"{di}"(real_entry));
}
loop {}
}
#[no_mangle]
extern ... | code_fim | hard | {
"lang": "rust",
"repo": "alnyan/yboot2",
"path": "/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: alnyan/yboot2 path: /src/main.rs
#![feature(asm, const_fn, llvm_asm)]
#![no_main]
#![no_std]
extern crate char16_literal;
extern crate core_rt;
extern crate efi;
extern crate yboot2_proto;
pub(crate) use char16_literal::cstr16;
use core::convert::TryInto;
use efi::{
image_handle, system_ta... | code_fim | hard | {
"lang": "rust",
"repo": "alnyan/yboot2",
"path": "/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> &self,
table_id: MetaId,
table_version: Option<MetaVersion>,
) -> Result<Arc<TableMeta>> {
self.meta_client
.get_table_by_id(&self.name, table_id, table_version)
}
fn get_tables(&self) -> Result<Vec<Arc<TableMeta>>> {
self.meta_client.get_db... | code_fim | hard | {
"lang": "rust",
"repo": "ebottabi/datafuse",
"path": "/fusequery/query/src/datasources/remote/remote_database.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ebottabi/datafuse path: /fusequery/query/src/datasources/remote/remote_database.rs
// Copyright 2020-2021 The Datafuse Authors.
//
// SPDX-License-Identifier: Apache-2.0.
use std::sync::Arc;
use common_exception::Result;
use common_metatypes::MetaId;
use common_metatypes::MetaVersion;
use comm... | code_fim | medium | {
"lang": "rust",
"repo": "ebottabi/datafuse",
"path": "/fusequery/query/src/datasources/remote/remote_database.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Phala-Network/phala-blockchain path: /pallets/phala/src/lib.rs
#![cfg_attr(not(feature = "std"), no_std)]
//! Phala Pallets
//!
//! This is the central crate of Phala tightly-coupled pallets.
#[cfg(target_arch = "wasm32")]
extern crate webpki_wasm as webpki;
#[cfg(not(feature = "std"))]
exter... | code_fim | hard | {
"lang": "rust",
"repo": "Phala-Network/phala-blockchain",
"path": "/pallets/phala/src/lib.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>pub mod migrations;
pub mod utils;
pub mod compute;
pub mod mq;
pub mod phat;
pub mod puppets;
pub mod registry;
pub mod stake_pool;
use compute::{base_pool, computation, pool_proxy, stake_pool_v2, vault, wrapped_balances};
use frame_support::traits::LockableCurrency;
/// The unified config of the comp... | code_fim | medium | {
"lang": "rust",
"repo": "Phala-Network/phala-blockchain",
"path": "/pallets/phala/src/lib.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: cholcombe973/isilon path: /src/models/id_resolution_paths_error.rs
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deseri<|fim_suffix|>Option<String>,
#[serde(rename = "message")]
pub message: Option<String>,
}<|fim_middle|>alize)]
pub struct IdResolutionPaths... | code_fim | medium | {
"lang": "rust",
"repo": "cholcombe973/isilon",
"path": "/src/models/id_resolution_paths_error.rs",
"mode": "psm",
"license": "LicenseRef-scancode-unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>Option<String>,
#[serde(rename = "message")]
pub message: Option<String>,
}<|fim_prefix|>// repo: cholcombe973/isilon path: /src/models/id_resolution_paths_error.rs
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct IdResolutionPathsError {
#[... | code_fim | medium | {
"lang": "rust",
"repo": "cholcombe973/isilon",
"path": "/src/models/id_resolution_paths_error.rs",
"mode": "spm",
"license": "LicenseRef-scancode-unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>pub trait FeatureMap {
fn set_roi(&mut self, roi: Rectangle);
fn compute(&mut self, input: *const u8, width: u32, height: u32);
}<|fim_prefix|>// repo: mesalock-linux/crates-sgx path: /vendor/rustface/src/feat/mod.rs
// This file is part of the open-source port of SeetaFace engine, which original... | code_fim | medium | {
"lang": "rust",
"repo": "mesalock-linux/crates-sgx",
"path": "/vendor/rustface/src/feat/mod.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: mesalock-linux/crates-sgx path: /vendor/rustface/src/feat/mod.rs
// This file is part of the open-source port of SeetaFace engine, which originally includes three modules:
// SeetaFace Detection, SeetaFace Alignment, and SeetaFace Identification.
//
// This file is part of the SeetaFace Det... | code_fim | medium | {
"lang": "rust",
"repo": "mesalock-linux/crates-sgx",
"path": "/vendor/rustface/src/feat/mod.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: i509VCB/vulkano path: /vulkano/src/device/features.rs
$($member: self.$member && other.$member,)*
}
}
/// Builds a `Features` that is the difference of another `Features` object from `self`.
///
/// The result's fi... | code_fim | hard | {
"lang": "rust",
"repo": "i509VCB/vulkano",
"path": "/vulkano/src/device/features.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: i509VCB/vulkano path: /vulkano/src/device/features.rs
ice may not be copied, modified, or distributed except
// according to those terms.
use crate::Version;
use std::marker::PhantomPinned;
use std::ptr::addr_of_mut;
macro_rules! features {
{
$({ $member:ident => $($ffi_struct:iden... | code_fim | hard | {
"lang": "rust",
"repo": "i509VCB/vulkano",
"path": "/vulkano/src/device/features.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.