text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>mod cast_target {
use super::*;
pub trait CastTarget: Sized {
fn cast_from(h: &Handle) -> Result<Option<Self>>;
}
}
impl CastTarget for Handle {
fn cast_from(h: &Handle) -> Result<Option<Handle>> {
Ok(Some(h.handle_ref().clone()))
}
}
pub(crate) use cast_target::*;
... | code_fim | hard | {
"lang": "rust",
"repo": "ndarilek/synthizer-rs",
"path": "/synthizer/src/casting.rs",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert_url_eq(&client, &format!("/applications/{}", ID_VEC[0]));
client
.v1()
.application(ID_VEC[0].as_str())
.get_extension_properties(ID_VEC[1].as_str());
assert_url_eq(
&client,
&format!(
"/applications/{}/extensionProperties/{}",
... | code_fim | medium | {
"lang": "rust",
"repo": "Arstman/graph-rs",
"path": "/tests/applications_url.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Arstman/graph-rs path: /tests/applications_url.rs
#[macro_use]
extern crate lazy_static;
use graph_http::BlockingHttpClient;
use graph_rs_sdk::prelude::*;
use test_tools::assert_url_eq;
use test_tools::common::TestTools;
<|fim_suffix|>#[test]
fn applications_url() {
let client = graph();
... | code_fim | medium | {
"lang": "rust",
"repo": "Arstman/graph-rs",
"path": "/tests/applications_url.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: AlterionX/seren path: /lib/src/game/trigger.rs
use crate::game::state::KeyedStore;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
#[serde(untagged)]
pub enum ValueChange {
SetBool(bool),
SetInt(i64),
SetFloat(f64),
UpdateInt(i64),
UpdateFloat(... | code_fim | medium | {
"lang": "rust",
"repo": "AlterionX/seren",
"path": "/lib/src/game/trigger.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl SceneChange {
pub fn to_inner(&self) -> (String, Option<usize>) {
(self.name.to_owned(), self.target_line.clone())
}
}
#[derive(Serialize, Deserialize, Debug)]
#[serde(bound = "")]
pub struct Trigger<T: KeyedStore> {
#[serde(default)]
pub stats_changes: Option<Vec<StatChange<... | code_fim | medium | {
"lang": "rust",
"repo": "AlterionX/seren",
"path": "/lib/src/game/trigger.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ShantanuNair/innernet path: /shared/src/interface_config.rs
use crate::{ensure_dirs_exist, Endpoint, Error, IoErrorContext, CLIENT_CONFIG_DIR};
use colored::*;
use indoc::writedoc;
use ipnetwork::IpNetwork;
use serde::{Deserialize, Serialize};
use std::{
fs::{File, OpenOptions},
io::Writ... | code_fim | hard | {
"lang": "rust",
"repo": "ShantanuNair/innernet",
"path": "/shared/src/interface_config.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl InterfaceConfig {
pub fn write_to_path<P: AsRef<Path>>(
&self,
path: P,
comments: bool,
mode: Option<u32>,
) -> Result<(), Error> {
let path = path.as_ref();
let mut target_file = OpenOptions::new()
.create_new(true)
.wri... | code_fim | hard | {
"lang": "rust",
"repo": "ShantanuNair/innernet",
"path": "/shared/src/interface_config.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: tigregalis/bevy-2d-template path: /src/main.rs
#![feature(external_doc)]
#![doc(include = "../README.md")]
use bevy::{
app::AppExit, diagnostic::FrameTimeDiagnosticsPlugin, diagnostic::PrintDiagnosticsPlugin,
prelude::*,
};
mod display_diagnostic;
use display_diagnostic::DisplayDiagnos... | code_fim | hard | {
"lang": "rust",
"repo": "tigregalis/bevy-2d-template",
"path": "/src/main.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>struct A;
fn test_change_text_system_a(mut text_query: Query<(&mut Text, &A)>) {
for (mut text, _a) in &mut text_query.iter() {
text.value = format!("this is not\nwhat it was\nbefore");
}
}
struct B;
fn test_change_text_system_b(mut text_query: Query<(&mut Text, &B)>) {
for (mut tex... | code_fim | hard | {
"lang": "rust",
"repo": "tigregalis/bevy-2d-template",
"path": "/src/main.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[derive(PartialEq, Eq)]
#[allow(dead_code)]
enum GameState {
Starting,
Restarting,
Playing,
Paused,
Win,
Lose,
}
fn exit_on_esc_system(
keyboard_input: Res<Input<KeyCode>>,
mut app_exit_events: ResMut<Events<AppExit>>,
) {
if keyboard_input.just_pressed(KeyCode::Space... | code_fim | hard | {
"lang": "rust",
"repo": "tigregalis/bevy-2d-template",
"path": "/src/main.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let uri = Uri::builder()
.scheme(tracking.scheme.unwrap_or(Scheme::try_from("https")?))
.authority(tracking.authority.unwrap())
.path_and_query(String::from("/") + path)
.build()?;
log::info!("checking {:?}", uri);
let https = hyper_r... | code_fim | hard | {
"lang": "rust",
"repo": "vulppine/denViews-rs",
"path": "/src/servers/routing/api.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: vulppine/denViews-rs path: /src/servers/routing/api.rs
use super::response_utils;
use super::tools::ToolsHandler;
use crate::database::{
postgres::database::Postgres, Database, DatabaseOperation, DatabaseTool, DenViewSettings,
};
use crate::Error;
use hyper::{
header::{LOCATION, USER_AGE... | code_fim | hard | {
"lang": "rust",
"repo": "vulppine/denViews-rs",
"path": "/src/servers/routing/api.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> async fn check_site(&self, path: &str) -> Result<(bool, String), Error> {
use http::uri::Scheme;
use std::convert::TryFrom;
let tracking = self.settings.site.parse::<Uri>()?.into_parts();
if tracking.authority.is_none() {
return Err(Box::new(APIError {
... | code_fim | hard | {
"lang": "rust",
"repo": "vulppine/denViews-rs",
"path": "/src/servers/routing/api.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: micromaomao/serverwatch path: /lib/utils/timeout.rs
use std::time;
use std::thread;
use std::sync::mpsc;
/// Run a closure with a timeout, returning either its return value, or None, in case
/// it timed out.
///
/// This function should only take at most `timeout` to return.
///
/// ## Example... | code_fim | medium | {
"lang": "rust",
"repo": "micromaomao/serverwatch",
"path": "/lib/utils/timeout.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert_eq!(with_timeout(|| {1}, time::Duration::from_secs(1)), Some(1));
assert_eq!(with_timeout(|| {thread::sleep(time::Duration::from_millis(500)); 1}, time::Duration::from_secs(1)), Some(1));
let measure = time::Instant::now();
assert_eq!(with_timeout(|| {thread::sleep(time::Duration::from_millis(1... | code_fim | medium | {
"lang": "rust",
"repo": "micromaomao/serverwatch",
"path": "/lib/utils/timeout.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let p = p.translate(&to_light.scale(0.001));
if normal.dot(&to_light) >= 0.0 {
for other_sphere in &s.spheres {
let r = sphere.f.ambient * sphere.c.r;
let g = sphere.f.ambient * sphere.... | code_fim | hard | {
"lang": "rust",
"repo": "NateGraff/RustRaytracer",
"path": "/tracer/src/cast.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: NateGraff/RustRaytracer path: /tracer/src/cast.rs
use data::*;
pub struct Viewport {
pub eye: Point,
pub eye_width: f64,
pub eye_height: f64,
pub img_width: u32,
pub img_height: u32,
}
pub struct Scene {
pub spheres: Vec<Sphere>,
pub light_source: Light,
pub lig... | code_fim | hard | {
"lang": "rust",
"repo": "NateGraff/RustRaytracer",
"path": "/tracer/src/cast.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>pub fn print_bitmap(bitmap: &Vec<Vec<Color>>) {
for row in bitmap {
for pixel in row {
if (pixel.r + pixel.g + pixel.b) < 0.5 {
print!(" ");
} else {
print!("##");
}
}
print!("\n");
}
}<|fim_prefix|>// rep... | code_fim | hard | {
"lang": "rust",
"repo": "NateGraff/RustRaytracer",
"path": "/tracer/src/cast.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> // Register the interrupt handler
match interrupts::register_interrupt(PIT_CHANNEL_0_IRQ, pit_timer_handler) {
Ok(_) => { /* success, do nothing */}
Err(handler) if handler == pit_timer_handler as usize => { /* already registered, do nothing */ }
Err(_other) => return Err("... | code_fim | hard | {
"lang": "rust",
"repo": "theseus-os/Theseus",
"path": "/kernel/pit_clock/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: theseus-os/Theseus path: /kernel/pit_clock/src/lib.rs
//! Full support for the Programmable Interval Timer (PIT) system clock.
//!
//! This crate allows one to enable/configure PIT interrupts.
//! For a simpler crate that just allows PIT-based waiting, use `pit_clock_basic`.
#![no_std]
#![feat... | code_fim | hard | {
"lang": "rust",
"repo": "theseus-os/Theseus",
"path": "/kernel/pit_clock/src/lib.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Ok(())
}
extern "x86-interrupt" fn pit_timer_handler(_stack_frame: InterruptStackFrame) {
static PIT_TICKS: AtomicUsize = AtomicUsize::new(0);
let ticks = PIT_TICKS.fetch_add(1, Ordering::Acquire);
trace!("PIT timer interrupt, ticks: {}", ticks);
interrupts::eoi(Some(PIT_CHANNEL_0_I... | code_fim | hard | {
"lang": "rust",
"repo": "theseus-os/Theseus",
"path": "/kernel/pit_clock/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let sym = match r.target() {
RelocationTarget::Symbol(index) => match obj.symbol_by_index(index) {
Ok(sym) => sym,
Err(_) => continue,
},
_ => continue,
};
relocations.push((
... | code_fim | hard | {
"lang": "rust",
"repo": "bytecodealliance/wasmtime",
"path": "/crates/jit/src/debug.rs",
"mode": "spm",
"license": "LLVM-exception",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: bytecodealliance/wasmtime path: /crates/jit/src/debug.rs
use anyhow::{anyhow, bail, ensure, Error};
use object::elf::*;
use object::endian::{BigEndian, Endian, Endianness, LittleEndian};
use object::read::elf::{FileHeader, SectionHeader};
use object::{
File, NativeEndian as NE, Object, Objec... | code_fim | hard | {
"lang": "rust",
"repo": "bytecodealliance/wasmtime",
"path": "/crates/jit/src/debug.rs",
"mode": "psm",
"license": "LLVM-exception",
"source": "the-stack-v2"
} |
<|fim_suffix|> match header.e_machine.get(e) {
EM_AARCH64 => (),
EM_X86_64 => (),
EM_S390 => (),
EM_RISCV => (),
machine => {
bail!("Unsupported ELF target machine: {:x}", machine);
}
}
ensure!(
header.e_phoff.get(e) == 0 && header.e_phnum.g... | code_fim | hard | {
"lang": "rust",
"repo": "bytecodealliance/wasmtime",
"path": "/crates/jit/src/debug.rs",
"mode": "spm",
"license": "LLVM-exception",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn configure_find_services(
mock: &mut MockKubeImpl,
svc_selector: &'static str,
result_file: &'static str,
result_error: bool,
) {
trace!("mock.expect_find_services svc_selector:{}", svc_selector);
mock.expect_find_services()
.times(... | code_fim | hard | {
"lang": "rust",
"repo": "jiayihu/akri",
"path": "/controller/src/util/shared_test_utils.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn configure_find_config(
mock: &mut MockKubeImpl,
config_name: &'static str,
config_namespace: &'static str,
result_file: &'static str,
result_error: bool,
) {
trace!("mock.expect_find_configuration config_name:{}", config_name);
mock.ex... | code_fim | hard | {
"lang": "rust",
"repo": "jiayihu/akri",
"path": "/controller/src/util/shared_test_utils.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: jiayihu/akri path: /controller/src/util/shared_test_utils.rs
#[cfg(test)]
pub mod config_for_tests {
use akri_shared::{
akri::{
configuration::KubeAkriConfig,
instance::{Instance, KubeAkriInstance, KubeAkriInstanceList},
},
k8s::test_kube::Mock... | code_fim | hard | {
"lang": "rust",
"repo": "jiayihu/akri",
"path": "/controller/src/util/shared_test_utils.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: chromium/chromium path: /third_party/rust/os_str_bytes/v6/crate/src/util.rs
pub(super) const BYTE_SHIFT: u8 = 6;
pub(super) const CONT_MASK: u8 = (1 << BYTE_SHIFT) - 1;
<|fim_suffix|>#[cfg_attr(not(windows), allow(dead_code))]
pub(super) const fn is_continuation(byte: u8) -> bool {
byte & ... | code_fim | easy | {
"lang": "rust",
"repo": "chromium/chromium",
"path": "/third_party/rust/os_str_bytes/v6/crate/src/util.rs",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[cfg_attr(not(windows), allow(dead_code))]
pub(super) const fn is_continuation(byte: u8) -> bool {
byte & !CONT_MASK == CONT_TAG
}<|fim_prefix|>// repo: chromium/chromium path: /third_party/rust/os_str_bytes/v6/crate/src/util.rs
pub(super) const BYTE_SHIFT: u8 = 6;
<|fim_middle|>pub(super) const CO... | code_fim | medium | {
"lang": "rust",
"repo": "chromium/chromium",
"path": "/third_party/rust/os_str_bytes/v6/crate/src/util.rs",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: sseg/hadron path: /lib/rust/src/client/publisher.rs
//! Publisher client.
use std::collections::HashMap;
use std::hash::Hasher;
use std::sync::Arc;
use anyhow::{bail, Context, Result};
use http::request::Request;
use http::Method;
use prost::Message;
use proto::v1::{self, StreamPubRequest, Str... | code_fim | hard | {
"lang": "rust",
"repo": "sseg/hadron",
"path": "/lib/rust/src/client/publisher.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// Setup a channel for use as a publisher channel.
#[tracing::instrument(level = "debug", skip(self, node))]
async fn setup_publisher_channel(&mut self, node: Arc<String>) -> Result<H2DataChannel> {
// Build up request.
let body_req = StreamPubSetupRequest { name: self.name.cl... | code_fim | hard | {
"lang": "rust",
"repo": "sseg/hadron",
"path": "/lib/rust/src/client/publisher.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> let diffs = input.windows(2).fold((1,1), |accum, v| {
if (v[1] - v[0]).abs() == 1 {
(accum.0 + 1, accum.1)
}
else if (v[1] - v[0]).abs() == 3 {
(accum.0, accum.1 + 1)
} else {
accum
}
});
for i in input.windows(2)... | code_fim | hard | {
"lang": "rust",
"repo": "manorom/advent-of-code-2020",
"path": "/day10/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> input.push(max_joltage);
println!("Product of number of differences: {}", diffs.0 * diffs.1);
println!("Number of viable combinations: {}", part2(input.iter(), max_joltage as usize));
}<|fim_prefix|>// repo: manorom/advent-of-code-2020 path: /day10/src/main.rs
use std::iter::Iterator;
use st... | code_fim | hard | {
"lang": "rust",
"repo": "manorom/advent-of-code-2020",
"path": "/day10/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: manorom/advent-of-code-2020 path: /day10/src/main.rs
use std::iter::Iterator;
use std::slice::Iter;
fn part2(mut iter: Iter<i64>, len: usize) -> i64 {
let mut dynprog = vec![0; len];
dynprog.push(0);
dynprog[0] = 1;
<|fim_suffix|> let diffs = input.windows(2).fold((1,1), |accum,... | code_fim | hard | {
"lang": "rust",
"repo": "manorom/advent-of-code-2020",
"path": "/day10/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: avranju/iotedge-k8s path: /edgelet/edgelet-http-mgmt/src/server/identity/update.rs
// Copyright (c) Microsoft. All rights reserved.
use std::sync::{Arc, Mutex};
use failure::{Fail, ResultExt};
use futures::{Future, IntoFuture, Stream};
use hyper::header::{CONTENT_LENGTH, CONTENT_TYPE};
use hyp... | code_fim | hard | {
"lang": "rust",
"repo": "avranju/iotedge-k8s",
"path": "/edgelet/edgelet-http-mgmt/src/server/identity/update.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #[test]
fn update() {
let manager = TestIdentityManager::new(vec![TestIdentity::new(
"m1",
"iotedge",
"g1",
AuthType::Sas,
)]);
let handler = UpdateIdentity::new(manager);
let update_req =
UpdateIdentityReq... | code_fim | hard | {
"lang": "rust",
"repo": "avranju/iotedge-k8s",
"path": "/edgelet/edgelet-http-mgmt/src/server/identity/update.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: 29decibel/fit-rs path: /src/developer_fields.rs
use std::collections::HashMap;
use std::io::Read;
use crate::types::data_field::DataField;
use crate::Value;
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct DeveloperFieldDefinition {
pub field_number: u8,
pub size: u8,
pub develo... | code_fim | hard | {
"lang": "rust",
"repo": "29decibel/fit-rs",
"path": "/src/developer_fields.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>pacity(6);
values.into_iter().for_each(|v| {
hmap.insert(v.field_num, v.value);
});
Self {
developer_data_index: hmap.remove(&0).unwrap().into(),
field_definition_number: hmap.remove(&1).unwrap().into(),
fit_base_type: match hmap.remo... | code_fim | hard | {
"lang": "rust",
"repo": "29decibel/fit-rs",
"path": "/src/developer_fields.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let client = Client::new("http://127.0.0.1:5000/v1.0", "tester", "testing", None).unwrap();
match client.authenticate() {
Ok(data) => println!("Storage URL: {}, Token: {}", data.storage_url, data.auth_token),
Err(err) => println!("Error: {}", err)
}
}<|fim_prefix|>// repo: cdum... | code_fim | easy | {
"lang": "rust",
"repo": "cdumay/swift-keystone-rs",
"path": "/examples/auth_v1.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: cdumay/swift-keystone-rs path: /examples/auth_v1.rs
extern crate swift_keystone;
use swift_keystone::authv1::Client;
<|fim_suffix|> let client = Client::new("http://127.0.0.1:5000/v1.0", "tester", "testing", None).unwrap();
match client.authenticate() {
Ok(data) => println!("Sto... | code_fim | easy | {
"lang": "rust",
"repo": "cdumay/swift-keystone-rs",
"path": "/examples/auth_v1.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: danluu/pelikan path: /src/server/pingserver-rs/src/admin.rs
// ccommon - a cache common library.
// Copyright (C) 2019 Twitter, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy ... | code_fim | medium | {
"lang": "rust",
"repo": "danluu/pelikan",
"path": "/src/server/pingserver-rs/src/admin.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> match (*req).type_ {
REQ_QUIT => return Action::Close,
REQ_STATS => {
procinfo_update();
rsp.data.data = self.buf.as_mut_ptr() as *mut c_char;
rsp.data.len = print_stats(
self.bu... | code_fim | hard | {
"lang": "rust",
"repo": "danluu/pelikan",
"path": "/src/server/pingserver-rs/src/admin.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>Self
)
{
let
_
=
&
*
*
lazy
;
}
}
}
;
(
MAKE
TY
(
#
[
attr
:
meta
]
)
*
(
(
vis
:
tt
)
*
)
N
:
ident
)
=
>
{
#
[
allow
(
missing_copy_implementations
)
]
#
[
allow
(
non_camel_case_types
)
]
#
[
allow
(
dead_code
)
]
(
#
[
attr
]
)
*
(
vis
)
*
struct
N
{
__private_field
:
(
)
}
#
[
doc
(
hidden
)
]
(
vis
... | code_fim | hard | {
"lang": "rust",
"repo": "marco-c/gecko-dev-wordified-and-comments-removed",
"path": "/third_party/rust/lazy_static/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified-and-comments-removed path: /third_party/rust/lazy_static/src/lib.rs
#
!
[
doc
(
html_root_url
=
"
https
:
/
/
docs
.
rs
/
lazy_static
/
1
.
4
.
0
"
)
]
#
!
[
no_std
]
#
[
cfg
(
not
(
feature
=
"
spin_no_std
"
)
)
]
#
[
path
=
"
inline_lazy
.
rs
"
]
#
[
doc
(
hidden
)
... | code_fim | hard | {
"lang": "rust",
"repo": "marco-c/gecko-dev-wordified-and-comments-removed",
"path": "/third_party/rust/lazy_static/src/lib.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: jtakakura/io-kit-rs path: /io-kit-sys/src/hid/base.rs
// exports from <IOKit/hid/IOHIDBase.h>
use std::os::raw::c_void;
use core_foundation_sys::base::CFIndex;
use core_foundation_sys::dictionary::CFDictionaryRef;
use crate::{hid::keys::IOHIDReportType, ret::IOReturn};
<|fim_suffix|>pub type... | code_fim | hard | {
"lang": "rust",
"repo": "jtakakura/io-kit-rs",
"path": "/io-kit-sys/src/hid/base.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>pub type IOHIDReportCallback = unsafe extern "C" fn(
context: *mut c_void,
result: IOReturn,
sender: *mut c_void,
type_: IOHIDReportType,
reportID: u32,
report: *mut u8,
reportLength: CFIndex,
);
pub type IOHIDReportWithTimeStampCallback = unsafe extern "C" fn(
context: *mu... | code_fim | hard | {
"lang": "rust",
"repo": "jtakakura/io-kit-rs",
"path": "/io-kit-sys/src/hid/base.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: LiGuanBin001/Rust_os_summer path: /labexercise/ex16/src/main.rs
use std::env;
fn main() {
// let mut args = env::args(); //每使用一次args.next()就会移到下一次, 可以看做C中的++1, 这次使用完之后再加1.
<|fim_suffix|> // let script = args.next().unwrap();
//
// let user_name = match args.next() {
/... | code_fim | hard | {
"lang": "rust",
"repo": "LiGuanBin001/Rust_os_summer",
"path": "/labexercise/ex16/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> // let script = args.next().unwrap();
//
// let user_name = match args.next() {
// Some(s) => s,
// None => String::from(""),
// };
//
// println!("Hello, {}, I am the {} script.", user_name, script);
}<|fim_prefix|>// repo: LiGuanBin001/Rust_os_summer path: /labex... | code_fim | hard | {
"lang": "rust",
"repo": "LiGuanBin001/Rust_os_summer",
"path": "/labexercise/ex16/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>const SIGNATURE: [u8; 7] = *b"no$gba ";
static NO_CASH_DEBUGGING: InitOnce<bool> = InitOnce::new();
/// Returns whether we are running in `NO$GBA`.
#[inline(never)]
pub fn detect() -> bool {
*NO_CASH_DEBUGGING.get(|| {
for i in 0..7 {
if SIGNATURE_ADDR.index(i).read() != SIGNATURE[i] {
... | code_fim | hard | {
"lang": "rust",
"repo": "Hpmason/gba",
"path": "/src/debugging/nocash.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Hpmason/gba path: /src/debugging/nocash.rs
//! Special utils for if you're running on the NO$GBA emulator.
//!
//! Note that this assumes that you're using the very latest version (3.03). If
//! you've got some older version of things there might be any number of
//! differences or problems.
<|... | code_fim | hard | {
"lang": "rust",
"repo": "Hpmason/gba",
"path": "/src/debugging/nocash.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>// ------ ------
// Attributes
// ------ ------
// ------ String ------
impl<'a> ApplyToElement<Text<'a>> for String {
fn apply_to_element(self, text: &mut Text) {
text.text = Cow::from(self);
}
}
// ------ &str ------
impl<'a> ApplyToElement<Text<'a>> for &'a str {
fn apply_to_e... | code_fim | hard | {
"lang": "rust",
"repo": "isgasho/MoonZoon",
"path": "/crates/zoon/src/element/text.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: isgasho/MoonZoon path: /crates/zoon/src/element/text.rs
use crate::{RenderContext, dom::dom_text, Element, __TrackedCall, __TrackedCallStack, ApplyToElement, render, element_macro};
use std::borrow::Cow;
// ------ ------
// Element
// ------ ------
element_macro!(text, Text::default());
<... | code_fim | hard | {
"lang": "rust",
"repo": "isgasho/MoonZoon",
"path": "/crates/zoon/src/element/text.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl<'a> ApplyToElement<Text<'a>> for String {
fn apply_to_element(self, text: &mut Text) {
text.text = Cow::from(self);
}
}
// ------ &str ------
impl<'a> ApplyToElement<Text<'a>> for &'a str {
fn apply_to_element(self, text: &mut Text<'a>) {
text.text = Cow::from(self);
... | code_fim | medium | {
"lang": "rust",
"repo": "isgasho/MoonZoon",
"path": "/crates/zoon/src/element/text.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ilyar/project-diffus path: /src/main.rs
use diffus::edit;
use diffus::Diffable;
use diffus::Diffus;
#[derive(Diffus)]
struct Point {
x: i32,
y: i32,
}
<|fim_suffix|> let left_point = Point { x: 1, y: 2 };
let right_point = Point { x: 1, y: 3 };
let diff = left_point.diff(&r... | code_fim | medium | {
"lang": "rust",
"repo": "ilyar/project-diffus",
"path": "/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> match diff {
edit::Edit::Copy(_) => println!("point: no difference"),
edit::Edit::Change(EditedPoint { x, y }) => {
match x {
edit::Edit::Copy(_) => println!("x: no difference"),
edit::Edit::Change((left_x, right_x)) => println!("x: {} => {}"... | code_fim | medium | {
"lang": "rust",
"repo": "ilyar/project-diffus",
"path": "/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#[cfg(test)]
mod tests {
use std::str;
use std::string::*;
use super::*;
use quickcheck::*;
use rand::thread_rng;
#[test]
fn floats() {
fn prop(s:String) -> bool {
if let IResult::Done(rem,out) = float_alts(&s[..].as_bytes()) {
let newstr... | code_fim | hard | {
"lang": "rust",
"repo": "holtchesley/urql",
"path": "/src/parser/parse_fns.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: holtchesley/urql path: /src/parser/parse_fns.rs
str::from_utf8),
FromStr::from_str
),
toss
)
);
named!(binary_operator_7<BinaryOperator>,
delimited!(toss,
map_res!(
... | code_fim | hard | {
"lang": "rust",
"repo": "holtchesley/urql",
"path": "/src/parser/parse_fns.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: holtchesley/urql path: /src/parser/parse_fns.rs
ber::Int)));
named!(literal<Literal>,alt_complete!(map!(string_lit,Literal::String)
|map!(float_alts,Literal::Float)
|map!(integer,Literal::Int)
... | code_fim | hard | {
"lang": "rust",
"repo": "holtchesley/urql",
"path": "/src/parser/parse_fns.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: philip-peterson/yew path: /yewtil/src/pure.rs
//! Shortcut for terse component definitions.
use crate::NeqAssign;
use yew::{Component, ComponentLink, Html, Properties, ShouldRender};
/// Allows immutable components to be declared using a single struct and a single method.
pub trait PureComponen... | code_fim | hard | {
"lang": "rust",
"repo": "philip-peterson/yew",
"path": "/yewtil/src/pure.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: tomc1998/rogun path: /rogun_engine/src/state/comp_list.rs
use entity::{Component, EntityID};
use std::slice;
use std::ops::{Index, IndexMut};
/// Struct to represent a list of components. Internally, components are stored
/// in an ordered list (by entty ID) to allow binary searching.
pub struc... | code_fim | hard | {
"lang": "rust",
"repo": "tomc1998/rogun",
"path": "/rogun_engine/src/state/comp_list.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.list.iter()
}
}
/// Implement the IntoIterator for CompList mut ref, lets us iterate over
/// the list of components.
impl<'a, T : Component> IntoIterator for &'a mut CompList<T> {
type Item = &'a mut T;
type IntoIter = slice::IterMut<'a, T>;
fn into_iter(self) -> Self::IntoIter {
se... | code_fim | hard | {
"lang": "rust",
"repo": "tomc1998/rogun",
"path": "/rogun_engine/src/state/comp_list.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn remove(&mut self, index: usize) {
self.list.remove(index);
}
}
/// Implement the IntoIterator for CompList ref, lets us iterate over the list
/// of components.
impl<'a, T : Component> IntoIterator for &'a CompList<T> {
type Item = &'a T;
type IntoIter = slice::Iter<'a, T>;
fn into_i... | code_fim | hard | {
"lang": "rust",
"repo": "tomc1998/rogun",
"path": "/rogun_engine/src/state/comp_list.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: RustyDucky/Rusty-City path: /assets/prefab/fly-camera.ron
Prefab (
entities: [
(
data: (
light: (ambient_color: ((0.1, 0.1, 0.1, 1.0)))
)
),
(
data: (
graphics: (
mesh: Asset(File(... | code_fim | hard | {
"lang": "rust",
"repo": "RustyDucky/Rusty-City",
"path": "/assets/prefab/fly-camera.ron",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> aspect: 1.3,
fovy: 1.0471975512,
znear: 0.1,
zfar: 2000.0
),
// fly control tag
control_tag: ()
)
)
]
)<|fim_prefix|>// repo: RustyDucky/Rusty-City path:... | code_fim | hard | {
"lang": "rust",
"repo": "RustyDucky/Rusty-City",
"path": "/assets/prefab/fly-camera.ron",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: felixmulder/flaskcards path: /rapp/src/main.rs
#![feature(plugin)]
#[plugin] #[no_link]
extern crate regex_macros;
extern crate regex;
extern crate serialize;
use std::collections::HashMap;
use std::io;
use serialize::json;
fn read_questions(path: &'static str) -> HashMap<String, String> {
... | code_fim | medium | {
"lang": "rust",
"repo": "felixmulder/flaskcards",
"path": "/rapp/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let contents = io::File::open(&Path::new(path)).read_to_string();
match contents {
Ok(data) => {
let proper = data.replace("\"\"\"", "\"");
let sliced = proper.as_slice().slice_from(12);
match json::decode(sliced) {
Ok(res) => res,
... | code_fim | medium | {
"lang": "rust",
"repo": "felixmulder/flaskcards",
"path": "/rapp/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let reg_tag = regex!(r"<[a-z^<^>/]*>");
let questions = read_questions("../questions.py");
let indices = range(1, questions.len()).rev();
let mut q_i = questions.iter().zip(indices);
let mut input = io::stdio::stdin();
for ((q, a), r) in q_i {
println!("{} questions remain... | code_fim | hard | {
"lang": "rust",
"repo": "felixmulder/flaskcards",
"path": "/rapp/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: balena-io-modules/libnm-rs path: /src/vpn_plugin_info.rs
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files
// DO NOT EDIT
#[cfg(any(feature = "v1_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))]
use crate::VpnEditorPlugin;
#[cfg(a... | code_fim | hard | {
"lang": "rust",
"repo": "balena-io-modules/libnm-rs",
"path": "/src/vpn_plugin_info.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// ## `group`
/// group name
/// ## `key`
/// name of the property
///
/// # Returns
///
/// [`VpnPluginInfo`][crate::VpnPluginInfo] is internally a [`glib::KeyFile`][crate::glib::KeyFile]. Returns the matching
/// property.
#[cfg(any(feature = "v1_2", feature = "d... | code_fim | hard | {
"lang": "rust",
"repo": "balena-io-modules/libnm-rs",
"path": "/src/vpn_plugin_info.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl MonitorHandle {
#[inline]
pub fn name(&self) -> Option<String> {
todo!()
}
#[inline]
pub fn size(&self) -> PhysicalSize<u32> {
todo!()
}
#[inline]
pub fn position(&self) -> PhysicalPosition<i32> {
todo!()
}
#[inline]
pub fn scale_... | code_fim | medium | {
"lang": "rust",
"repo": "tauri-apps/winit",
"path": "/src/platform_impl/linux/monitor.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: tauri-apps/winit path: /src/platform_impl/linux/monitor.rs
use crate::{
dpi::{PhysicalPosition, PhysicalSize},
monitor::{MonitorHandle as RootMonitorHandle, VideoMode as RootVideoMode},
};
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct MonitorHandle;
impl MonitorHan... | code_fim | hard | {
"lang": "rust",
"repo": "tauri-apps/winit",
"path": "/src/platform_impl/linux/monitor.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> &mut self,
world: &World,
render_context: &mut dyn RenderContext,
_input: &ResourceSlots,
_output: &mut ResourceSlots,
) {
let shared_buffers = world.get_resource::<SharedBuffers>().unwrap();
shared_buffers.apply(render_context);
}
}<|fim_pre... | code_fim | medium | {
"lang": "rust",
"repo": "simensgreen/bevy",
"path": "/crates/bevy_render/src/render_graph/nodes/shared_buffers_node.rs",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: simensgreen/bevy path: /crates/bevy_render/src/render_graph/nodes/shared_buffers_node.rs
use crate::{
render_graph::{Node, ResourceSlots},
renderer::{RenderContext, SharedBuffers},
};
use bevy_ecs::world::World;
<|fim_suffix|>impl Node for SharedBuffersNode {
fn update(
&mut... | code_fim | medium | {
"lang": "rust",
"repo": "simensgreen/bevy",
"path": "/crates/bevy_render/src/render_graph/nodes/shared_buffers_node.rs",
"mode": "psm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|>use std::fmt;
impl fmt::Display for GoogleId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}<|fim_prefix|>// repo: katandps/beatoraja_play_recommend path: /crates/model/src/account/google_id.rs
use serde::Serialize;
#[derive(Clone, Debug, Serializ... | code_fim | medium | {
"lang": "rust",
"repo": "katandps/beatoraja_play_recommend",
"path": "/crates/model/src/account/google_id.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: katandps/beatoraja_play_recommend path: /crates/model/src/account/google_id.rs
use serde::Serialize;
#[derive(Clone, Debug, Serialize)]
pub struct GoogleId(String);
<|fim_suffix|>use std::fmt;
impl fmt::Display for GoogleId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
... | code_fim | medium | {
"lang": "rust",
"repo": "katandps/beatoraja_play_recommend",
"path": "/crates/model/src/account/google_id.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: minus3theta/contest path: /cargo/abc175/src/bin/c.rs
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::Integer;
#[allow(unused_imports)]
use proconio::derive_readable;
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;... | code_fim | medium | {
"lang": "rust",
"repo": "minus3theta/contest",
"path": "/cargo/abc175/src/bin/c.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> input! {
x: i64,
k: i64,
d: i64,
}
let x = x.abs();
let min = x - k.checked_mul(d).unwrap_or(1 << 60);
let mut ans = min.abs();
let rem = (x + (k % 2) * d) % (2 * d);
if rem >= min {
ans = cmp::min(ans, rem);
}
let neg = rem - 2 * d;
... | code_fim | medium | {
"lang": "rust",
"repo": "minus3theta/contest",
"path": "/cargo/abc175/src/bin/c.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: rafael049/simple_2D_game_engine path: /src/camera.rs
extern crate nalgebra_glm as glm;
extern crate glfw;
use crate::input;
use glfw::Key;
pub const WIDTH: i32 = (640 as f32 * 2.0) as i32;
pub const HEIGHT: i32 = (360 as f32 * 2.0) as i32;
<|fim_suffix|>impl Camera{
pub f... | code_fim | hard | {
"lang": "rust",
"repo": "rafael049/simple_2D_game_engine",
"path": "/src/camera.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn get_view_projection(&self) -> glm::Mat4 {
let scaled = glm::scale(&self.ortho, &glm::vec3(self.zoom as f32 ,self.zoom as f32 ,1.0));
let view = glm::translate(&scaled, &glm::vec3(-self.pos.x, -self.pos.y, 0.0));
view
}
pub fn get_zoom(&self) -> f32 {
s... | code_fim | hard | {
"lang": "rust",
"repo": "rafael049/simple_2D_game_engine",
"path": "/src/camera.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: rick68/rust-trace path: /libcore/intrinsics/u64_mul_with_overflow.rs
#![feature(core, core_intrinsics)]
extern crate core;
#[cfg(test)]
mod tests {
use core::intrinsics::u64_mul_with_overflow;
<|fim_suffix|> assert_eq!(result, 0xffffffffffffffff); // 18446744073709551615
assert_eq!(is_ove... | code_fim | hard | {
"lang": "rust",
"repo": "rick68/rust-trace",
"path": "/libcore/intrinsics/u64_mul_with_overflow.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let (result, is_overflow): (u64, bool) = unsafe {
u64_mul_with_overflow(x, y)
};
assert_eq!(result, 0xfffffffffffffffe); // 18446744073709551614
assert_eq!(is_overflow, true);
}
}<|fim_prefix|>// repo: rick68/rust-trace path: /libcore/intrinsics/u64_mul_with_overflow.rs
#![feature(core, cor... | code_fim | hard | {
"lang": "rust",
"repo": "rick68/rust-trace",
"path": "/libcore/intrinsics/u64_mul_with_overflow.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: rust-lang/rustc-perf path: /collector/compile-benchmarks/futures/src/stream/fuse.rs
use {Task, Poll};
use stream::Stream;
/// A stream which "fuse"s a stream once it's terminated.
///
/// Normally streams can behave unpredictably after they've terminated or
/// returned an error, but `Fuse` is ... | code_fim | medium | {
"lang": "rust",
"repo": "rust-lang/rustc-perf",
"path": "/collector/compile-benchmarks/futures/src/stream/fuse.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let ret = self.stream.as_mut().map(|s| s.poll(task));
match ret {
Some(Poll::Ok(None)) => self.stream = None,
_ => {}
}
ret.unwrap_or(Poll::NotReady)
}
fn schedule(&mut self, task: &mut Task) {
if let Some(ref mut stream) = self.stre... | code_fim | medium | {
"lang": "rust",
"repo": "rust-lang/rustc-perf",
"path": "/collector/compile-benchmarks/futures/src/stream/fuse.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: pka/ogcapi path: /ogcapi/src/import/args.rs
#[derive(clap::Parser, Debug)]
pub struct Args {
/// Input file
#[clap(long, value_parser)]
pub input: std::path::PathBuf,
/// Set the collection name, defaults to layer name or `osm`
#[clap(long)]
pub collection: String,
... | code_fim | medium | {
"lang": "rust",
"repo": "pka/ogcapi",
"path": "/ogcapi/src/import/args.rs",
"mode": "psm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl Args {
pub fn new(
input: impl Into<std::path::PathBuf>,
collection: &str,
database_url: &url::Url,
) -> Self {
Args {
input: input.into(),
collection: collection.to_string(),
filter: None,
s_srs: None,
... | code_fim | hard | {
"lang": "rust",
"repo": "pka/ogcapi",
"path": "/ogcapi/src/import/args.rs",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: pbar1/vault-rs path: /vault/src/models/secret_destroy_input.rs
/*
* HashiCorp Vault API
*
* HTTP API that gives you full access to Vault. All API routes are prefixed with `/v1/`.
*
* The version of the OpenAPI document: 1.6.0
*
* Generated by: https://openapi-generator.tech
*/
<|fim_su... | code_fim | hard | {
"lang": "rust",
"repo": "pbar1/vault-rs",
"path": "/vault/src/models/secret_destroy_input.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl SecretDestroyInput {
pub fn new() -> SecretDestroyInput {
SecretDestroyInput {
versions: None,
}
}
}<|fim_prefix|>// repo: pbar1/vault-rs path: /vault/src/models/secret_destroy_input.rs
/*
* HashiCorp Vault API
*
* HTTP API that gives you full access to Vault. ... | code_fim | hard | {
"lang": "rust",
"repo": "pbar1/vault-rs",
"path": "/vault/src/models/secret_destroy_input.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> mod stream_id;
pub mod stream_type;
pub mod table_id;
pub mod pack_header;
pub mod program_descriptor;
pub mod descriptor;<|fim_prefix|>// repo: media-io/rs_mpegts path: /src/parser/mod.rs
pub mod packet;
pub mod adaptation_field;
pub mod adaptation<|fim_middle|>_field_extension;
pub mod program_clock;... | code_fim | medium | {
"lang": "rust",
"repo": "media-io/rs_mpegts",
"path": "/src/parser/mod.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: media-io/rs_mpegts path: /src/parser/mod.rs
pub mod packet;
pub mod adaptation_field;
pub mod adaptation_field_extension;
pub mod program_clock;
pub mod payload;
pub<|fim_suffix|>d pack_header;
pub mod program_descriptor;
pub mod descriptor;<|fim_middle|> mod stream_id;
pub mod stream_type;
pub... | code_fim | medium | {
"lang": "rust",
"repo": "media-io/rs_mpegts",
"path": "/src/parser/mod.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>d pack_header;
pub mod program_descriptor;
pub mod descriptor;<|fim_prefix|>// repo: media-io/rs_mpegts path: /src/parser/mod.rs
pub mod packet;
pub mod adaptation_field;
pub mod adaptation_field_extension;
pub mod program_clock;
pub mod payload;
pub<|fim_middle|> mod stream_id;
pub mod stream_type;
pub... | code_fim | medium | {
"lang": "rust",
"repo": "media-io/rs_mpegts",
"path": "/src/parser/mod.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>pub fn rocket(rocket: rocket::Rocket) -> rocket::Rocket {
rocket
.attach(cors::Cors {})
.attach(PgConn::fairing())
.register(catchers::create_catchers())
.mount("/users", routes::users::create_routes())
.mount("/fandoms", routes::fandoms::create_routes())
... | code_fim | medium | {
"lang": "rust",
"repo": "EdSabino/rust_server_manga",
"path": "/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: EdSabino/rust_server_manga path: /src/main.rs
#![feature(async_closure)]
#![feature(proc_macro_hygiene, decl_macro)]
#![feature(result_contains_err)]
#[cfg(test)]
pub mod test;
<|fim_suffix|>#[database("postgres_db")]
pub struct PgConn(databases::diesel::PgConnection);
pub fn rocket(rocket: r... | code_fim | hard | {
"lang": "rust",
"repo": "EdSabino/rust_server_manga",
"path": "/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[database("postgres_db")]
pub struct PgConn(databases::diesel::PgConnection);
pub fn rocket(rocket: rocket::Rocket) -> rocket::Rocket {
rocket
.attach(cors::Cors {})
.attach(PgConn::fairing())
.register(catchers::create_catchers())
.mount("/users", routes::users::crea... | code_fim | hard | {
"lang": "rust",
"repo": "EdSabino/rust_server_manga",
"path": "/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: eranimo/imperianova-rust path: /game_plugin/src/viewport.rs
use crate::{GameState, Inspected};
use bevy::{prelude::*, render::camera::{Camera}};
pub struct ViewportPlugin;
pub struct ViewportCamera;
impl Plugin for ViewportPlugin {
fn build(&self, app: &mut AppBuilder) {
app.add_s... | code_fim | hard | {
"lang": "rust",
"repo": "eranimo/imperianova-rust",
"path": "/game_plugin/src/viewport.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if keyboard_input.pressed(KeyCode::W) || keyboard_input.pressed(KeyCode::Up) {
direction += Vec3::new(0.0, 1.0, 0.0);
}
if keyboard_input.pressed(KeyCode::S) || keyboard_input.pressed(KeyCode::Down) {
direction -= Vec3::new(0.0, 1.0, 0.0);
}
... | code_fim | hard | {
"lang": "rust",
"repo": "eranimo/imperianova-rust",
"path": "/game_plugin/src/viewport.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ejmg/rsass path: /src/parser/pos.rs
use super::Span;
use std::str::from_utf8;
/// A position in sass input.
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
pub struct SourcePos {
pub line: String,
pub line_no: u32,
pub line_pos: usize,
pub file: SourceName,
}
<|fim_suff... | code_fim | hard | {
"lang": "rust",
"repo": "ejmg/rsass",
"path": "/src/parser/pos.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl SourceName {
pub fn root<T: ToString>(name: T) -> Self {
SourceName {
name: name.to_string(),
imported: None,
}
}
pub fn imported<T: ToString>(name: T, from: SourcePos) -> Self {
SourceName {
name: name.to_string(),
i... | code_fim | hard | {
"lang": "rust",
"repo": "ejmg/rsass",
"path": "/src/parser/pos.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn name(&self) -> &str {
&self.name
}
pub fn imported_from(&self) -> Option<&SourcePos> {
self.imported.as_ref().map(|b| b.as_ref())
}
}<|fim_prefix|>// repo: ejmg/rsass path: /src/parser/pos.rs
use super::Span;
use std::str::from_utf8;
/// A position in sass input.
#... | code_fim | hard | {
"lang": "rust",
"repo": "ejmg/rsass",
"path": "/src/parser/pos.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> // NOTE the try-operator ? is necessary for implicitly converting the String to MainError.
Err("strings can be used as errors")?;
Ok(())
}<|fim_prefix|>// repo: zummenix/main_error path: /examples/01_string_error.rs
use main_error::MainError;
<|fim_middle|>fn main() -> Result<(), MainError>... | code_fim | easy | {
"lang": "rust",
"repo": "zummenix/main_error",
"path": "/examples/01_string_error.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: zummenix/main_error path: /examples/01_string_error.rs
use main_error::MainError;
<|fim_suffix|> // NOTE the try-operator ? is necessary for implicitly converting the String to MainError.
Err("strings can be used as errors")?;
Ok(())
}<|fim_middle|>fn main() -> Result<(), MainError>... | code_fim | easy | {
"lang": "rust",
"repo": "zummenix/main_error",
"path": "/examples/01_string_error.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.