text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> pub fn moveroo(&mut self, args: &Button) {
use crate::Direction::*;
if self.complete {
return;
}
let dir = match &args {
Button::Keyboard(Key::Right) => Left,
Button::Keyboard(Key::Left) => Right,
Button::Keyboard(Key::Dow... | code_fim | hard | {
"lang": "rust",
"repo": "crgl/npuzzle",
"path": "/src/game.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: kakoc/leetcode path: /src/bst_from_preorder.rs
// Definition for a binary tree node.
#[derive(Debug, PartialEq, Eq)]
pub struct TreeNode {
pub val: i32,
pub left: Option<Rc<RefCell<TreeNode>>>,
pub right: Option<Rc<RefCell<TreeNode>>>,
}
<|fim_suffix|> Some(Rc::new(RefCell::new(r... | code_fim | hard | {
"lang": "rust",
"repo": "kakoc/leetcode",
"path": "/src/bst_from_preorder.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if let Some(n) = construct(vec, i, vec.get(*i), key, max) {
root.right = Some(Rc::new(RefCell::new(n)));
} else {
root.right = None;
}
}
return Some(root);
}
return None;
}
// fn change(n: &mut usize) {
// *... | code_fim | hard | {
"lang": "rust",
"repo": "kakoc/leetcode",
"path": "/src/bst_from_preorder.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>/// Dispatch events to the different [`EventHandler`]s.
pub struct EventDispatcher<E> {
processors: Vec<Box<dyn EventProcessor<E>>>,
}
impl<E> EventDispatcher<E> {
/// Create a new instance for a list of events handlers.
pub fn new(processors: Vec<Box<dyn EventProcessor<E>>>) -> Self {
... | code_fim | medium | {
"lang": "rust",
"repo": "vedangj044/drogue-cloud",
"path": "/operator-common/src/controller/base/event/mod.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: vedangj044/drogue-cloud path: /operator-common/src/controller/base/event/mod.rs
mod processor;
pub use processor::*;
use async_trait::async_trait;
use drogue_cloud_registry_events::stream::EventHandler;
use std::boxed::Box;
#[async_trait]
impl<E> EventHandler for EventDispatcher<E>
where
... | code_fim | hard | {
"lang": "rust",
"repo": "vedangj044/drogue-cloud",
"path": "/operator-common/src/controller/base/event/mod.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// Create a new instance for a single handler.
pub fn one<P>(processor: P) -> Self
where
P: EventProcessor<E> + 'static,
{
Self::new(vec![Box::new(processor)])
}
}<|fim_prefix|>// repo: vedangj044/drogue-cloud path: /operator-common/src/controller/base/event/mod.rs
mo... | code_fim | hard | {
"lang": "rust",
"repo": "vedangj044/drogue-cloud",
"path": "/operator-common/src/controller/base/event/mod.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/regions/regions-fn-subtyping.rs
// run-pass
#![allow(dead_code)]
#![allow(unused_assignments)]
// Issue #2263.
// pretty-expanded FIXME #23616
#![allow(unused_variables)]
<|fim_suffix|>// This version is the same as above, except that here, g... | code_fim | hard | {
"lang": "rust",
"repo": "IThawk/rust-project",
"path": "/rust-master/src/test/ui/regions/regions-fn-subtyping.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>// This version is the same as above, except that here, g's type is
// inferred.
fn ok_inferred(f: Box<dyn FnMut(&usize)>) {
let mut g: Box<dyn for<'r> FnMut(&'r usize)> = Box::new(|_| {});
g = f;
}
pub fn main() {
}<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/region... | code_fim | hard | {
"lang": "rust",
"repo": "IThawk/rust-project",
"path": "/rust-master/src/test/ui/regions/regions-fn-subtyping.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: BasileiosKal/bbs-signatures path: /src/bls12381.rs
/*
* Copyright 2020 - MATTR Limited
* 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 of the License at
* http://www.apache.org/l... | code_fim | hard | {
"lang": "rust",
"repo": "BasileiosKal/bbs-signatures",
"path": "/src/bls12381.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>/// Creates a BBS+ PoK
#[wasm_bindgen(js_name = blsCreateProof)]
pub async fn bls_create_proof(request: JsValue) -> Result<JsValue, JsValue> {
set_panic_hook();
let request: BlsCreateProofRequest = request.try_into()?;
if request.revealed.iter().any(|r| *r > request.messages.len()) {
r... | code_fim | hard | {
"lang": "rust",
"repo": "BasileiosKal/bbs-signatures",
"path": "/src/bls12381.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>/// Get the BBS public key associated with the private key
#[wasm_bindgen(js_name = bls12381toBbs)]
pub async fn bls_to_bbs_key(request: JsValue) -> Result<JsValue, JsValue> {
set_panic_hook();
let request: Bls12381ToBbsRequest = request.try_into()?;
if request.messageCount == 0 {
retu... | code_fim | hard | {
"lang": "rust",
"repo": "BasileiosKal/bbs-signatures",
"path": "/src/bls12381.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: anthhub/yew-train-ticket path: /src/service/city_list.rs
#![allow(unused_variables)]
use super::fetch::Fetch;
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
pub struct CityResult {
pub hotCities: Vec<HotCities>,
pub cityList: Vec<CityList>,
pub version... | code_fim | medium | {
"lang": "rust",
"repo": "anthhub/yew-train-ticket",
"path": "/src/service/city_list.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[derive(Debug, Serialize, Deserialize)]
pub struct City {
pub name: String,
}
pub async fn get_city_list() -> CityResult {
// let base_url = "http://118.190.37.169:7000";
let base_url = "http://att.liuma.top";
let url = format!("{}/api/cities", base_url);
let json = Fetch::get(url).a... | code_fim | hard | {
"lang": "rust",
"repo": "anthhub/yew-train-ticket",
"path": "/src/service/city_list.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: shanlashari/vector path: /src/event/mod.rs
ections::HashMap;
use std::iter::FromIterator;
use string_cache::DefaultAtom as Atom;
pub mod flatten;
pub mod metric;
mod unflatten;
pub use metric::Metric;
pub mod proto {
include!(concat!(env!("OUT_DIR"), "/event.proto.rs"));
}
lazy_static! {... | code_fim | hard | {
"lang": "rust",
"repo": "shanlashari/vector",
"path": "/src/event/mod.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>// TODO: should probably get rid of this
impl From<Event> for Vec<u8> {
fn from(event: Event) -> Vec<u8> {
event
.into_log()
.into_value(&MESSAGE)
.unwrap()
.as_bytes()
.to_vec()
}
}
impl From<Bytes> for Event {
fn from(messa... | code_fim | hard | {
"lang": "rust",
"repo": "shanlashari/vector",
"path": "/src/event/mod.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: shanlashari/vector path: /src/event/mod.rs
self, key: K, value: V)
where
K: Into<Atom>,
V: Into<ValueKind>,
{
self.fields.insert(
key.into(),
Value {
value: value.into(),
explicit: true,
},
... | code_fim | hard | {
"lang": "rust",
"repo": "shanlashari/vector",
"path": "/src/event/mod.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self
}
pub fn add_viewport(
mut self,
x: f32,
y: f32,
width: f32,
height: f32,
min_depth: f32,
max_depth: f32,
) -> Self {
let viewport = vk::Viewport::builder()
.width(width)
.height(height)
... | code_fim | hard | {
"lang": "rust",
"repo": "DasCapschen/rusterizer",
"path": "/src/vulkan.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: DasCapschen/rusterizer path: /src/vulkan.rs
width));
let h = caps
.min_image_extent
.height
.max(caps.max_image_extent.height.min(height));
vk::Extent2D::builder().width(w).height(h).build()
};
let image_count = if caps.max_image_count... | code_fim | hard | {
"lang": "rust",
"repo": "DasCapschen/rusterizer",
"path": "/src/vulkan.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn tesselation(mut self, patch_control_points: u32) -> Self {
self.tesselation_info = Some(
vk::PipelineTessellationStateCreateInfo::builder()
.patch_control_points(patch_control_points)
.build(),
);
self
}
pub fn add_vi... | code_fim | hard | {
"lang": "rust",
"repo": "DasCapschen/rusterizer",
"path": "/src/vulkan.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> evaluate_data_set(KLISCH_DATA.get(&ParsingMethod::ByAnnotation).unwrap().deref(), DataSetName::KlischData, "decision_forest");
}
#[test]
fn test_klisch_data_by_threshold_decision_forest() {
evaluate_data_set(KLISCH_DATA.get(&ParsingMethod::ByThreshold).unwrap().deref(), DataSe... | code_fim | hard | {
"lang": "rust",
"repo": "Geigerkind/decision-tree-based-hand-gesture-recognition",
"path": "/simulation/src/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Geigerkind/decision-tree-based-hand-gesture-recognition path: /simulation/src/main.rs
(gesture);
args.append(&mut darkness_dist_geom.deref().iter().map(|val| *val as i32).collect());
args.append(&mut brightness_dist_geom.deref().iter().map(|val| *val as i32).collect());
args
}
#[cfg... | code_fim | hard | {
"lang": "rust",
"repo": "Geigerkind/decision-tree-based-hand-gesture-recognition",
"path": "/simulation/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Geigerkind/decision-tree-based-hand-gesture-recognition path: /simulation/src/main.rs
deref().to_vec());
let center_of_gravity_x = CenterOfGravityDistributionFloatX::calculate(&gesture);
let center_of_gravity_y = CenterOfGravityDistributionFloatY::calculate(&gesture);
args.append(&mu... | code_fim | hard | {
"lang": "rust",
"repo": "Geigerkind/decision-tree-based-hand-gesture-recognition",
"path": "/simulation/src/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: nham/Rust.peg path: /src/libpeg/middle/visitor.rs
// Copyright 2014 Pierre Talbot (IRCAM)
// 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 of the License at
// http://www.apache.o... | code_fim | hard | {
"lang": "rust",
"repo": "nham/Rust.peg",
"path": "/src/libpeg/middle/visitor.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> fn visit_non_terminal_symbol(&mut self, _sp: Span, _id: Ident) {}
fn visit_sequence(&mut self, _sp: Span, exprs: &Vec<Box<Expression>>)
{
walk_exprs(self, exprs);
}
fn visit_choice(&mut self, _sp: Span, exprs: &Vec<Box<Expression>>)
{
walk_exprs(self, exprs);
}
fn visit_zero_or_... | code_fim | hard | {
"lang": "rust",
"repo": "nham/Rust.peg",
"path": "/src/libpeg/middle/visitor.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>pub fn parse_flow<'a>(slice: &'a str) -> Result<Flow, ErrorInfo> {
match start_parsing::<CustomError<Span<'a>>>(Span::new(slice)) {
Ok((_, (instructions, flow_type))) => Ok(Flow {
flow_instructions: instructions
.into_iter()
.map(|elem| (elem.instruc... | code_fim | hard | {
"lang": "rust",
"repo": "salimclevy/csml-interpreter",
"path": "/src/parser.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: salimclevy/csml-interpreter path: /src/parser.rs
pub mod operator;
pub mod parse_actions;
pub mod parse_braces;
pub mod parse_comments;
pub mod parse_foreach;
pub mod parse_functions;
pub mod parse_goto;
pub mod parse_idents;
pub mod parse_if;
pub mod parse_import;
pub mod parse_literal;
pub mod... | code_fim | hard | {
"lang": "rust",
"repo": "salimclevy/csml-interpreter",
"path": "/src/parser.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Ok((
s,
Instruction {
instruction_type: InstructionType::NormalStep(ident.ident),
actions: Expr::Scope {
block_type: BlockType::Step,
scope: actions,
range: RangeInterval { start, end },
},
},
... | code_fim | hard | {
"lang": "rust",
"repo": "salimclevy/csml-interpreter",
"path": "/src/parser.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> where
Iter: IntoIterator<Item = I>,
{
let mut root: Option<IntervalTreeNode<T, D>> = None;
for into_entry in iter.into_iter() {
let entry: IntervalTreeEntry<T, D> = into_entry.into();
let new_node = IntervalTreeNode::from(entry);
if root... | code_fim | hard | {
"lang": "rust",
"repo": "mfkiwl/space-partitioning",
"path": "/src/interval_tree/interval_tree_node.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: mfkiwl/space-partitioning path: /src/interval_tree/interval_tree_node.rs
use crate::interval_tree::{InorderIterator, Interval, IntervalTreeEntry, IntervalType};
/// A child node in the tree.
pub type ChildNode<T, D> = Option<Box<IntervalTreeNode<T, D>>>;
/// Structure to represent a node in In... | code_fim | hard | {
"lang": "rust",
"repo": "mfkiwl/space-partitioning",
"path": "/src/interval_tree/interval_tree_node.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#[cfg(test)]
mod tests {
use super::*;
use test::Bencher;
use std::ffi::CStr;
#[test]
fn correctly_discover_primes_up_to_4th() {
let expected_primes = vec![2, 3, 5, 7];
assert_eq!(expected_primes, discover_primes(4));
}
#[test]
fn correctly_discover_primes_up_to_100th() {
le... | code_fim | hard | {
"lang": "rust",
"repo": "alexbrahastoll/demo-rust-in-ruby",
"path": "/lib/cargo/primes/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert_eq!(expected_primes, discover_primes(100));
}
#[test]
fn correctly_list_primes_up_to_4th() {
let expected_list = "2, 3, 5, 7";
unsafe {
let actual_list = CStr::from_ptr(list_primes_up_to_nth(4)).to_str().unwrap();
assert_eq!(expected_list, actual_list);
}
}
... | code_fim | hard | {
"lang": "rust",
"repo": "alexbrahastoll/demo-rust-in-ruby",
"path": "/lib/cargo/primes/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: alexbrahastoll/demo-rust-in-ruby path: /lib/cargo/primes/src/lib.rs
#![feature(test)]
extern crate test;
use std::ffi::CString;
use std::os::raw::c_char;
pub fn discover_primes(up_to_nth_prime: u32) -> Vec<u32> {
let mut primes: Vec<u32> = vec![];
let mut potential_prime = 2;
while (pr... | code_fim | hard | {
"lang": "rust",
"repo": "alexbrahastoll/demo-rust-in-ruby",
"path": "/lib/cargo/primes/src/lib.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rsz_newtype! {
#[rsz_offset(1)]
#[derive(Debug, Serialize)]
#[serde(transparent)]
pub struct RareTypes(pub u8);
}
rsz_newtype! {
// Despite the enum naming from TDB
// it seems that the 0-based raw value is used to index messages.
#[rsz_offset(0)]
#[derive(Debug, Serialize... | code_fim | hard | {
"lang": "rust",
"repo": "rockingdice/mhrice",
"path": "/src/rsz/item.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rsz_newtype! {
// Despite the enum naming from TDB
// it seems that the 0-based raw value is used to index messages.
#[rsz_offset(0)]
#[derive(Debug, Serialize, PartialEq, Eq, Hash, Copy, Clone)]
#[serde(transparent)]
pub struct MaterialCategory(pub i32);
}
rsz_struct! {
#[rsz... | code_fim | hard | {
"lang": "rust",
"repo": "rockingdice/mhrice",
"path": "/src/rsz/item.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: rockingdice/mhrice path: /src/rsz/item.rs
use super::*;
use crate::rsz_enum;
use crate::rsz_newtype;
use crate::rsz_struct;
use serde::*;
rsz_enum! {
#[rsz(i32)]
#[derive(Debug, Serialize)]
pub enum CarriableFilter {
All = 0,
Quest = 1,
Hyakuryu = 2,
... | code_fim | hard | {
"lang": "rust",
"repo": "rockingdice/mhrice",
"path": "/src/rsz/item.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: twitter/rpc-perf path: /src/config_file.rs
get,
#[serde(default)]
connection: Connection,
#[serde(default)]
request: Request,
tls: Option<Tls>,
keyspace: Vec<Keyspace>,
}
impl ConfigFile {
pub fn general(&self) -> General {
self.general.clone()
}
pub... | code_fim | hard | {
"lang": "rust",
"repo": "twitter/rpc-perf",
"path": "/src/config_file.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn cardinality(&self) -> u32 {
self.cardinality
}
pub fn inner_keys(&self) -> Vec<InnerKey> {
self.inner_keys.clone()
}
pub fn commands(&self) -> Vec<Command> {
self.commands.clone()
}
pub fn values(&self) -> Vec<Value> {
self.values.clone... | code_fim | hard | {
"lang": "rust",
"repo": "twitter/rpc-perf",
"path": "/src/config_file.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: twitter/rpc-perf path: /src/config_file.rs
ons::HashMap;
use std::io::Read;
use std::net::SocketAddr;
use std::net::ToSocketAddrs;
use zookeeper::*;
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ConfigFile {
general: General,
#[serde(default)]
debug: Debug,
#[s... | code_fim | hard | {
"lang": "rust",
"repo": "twitter/rpc-perf",
"path": "/src/config_file.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: synapticarbors/exercism path: /rust/custom-set/src/lib.rs
#[derive(Debug, PartialEq)]
pub struct CustomSet<T> {
inner: Vec<T>,
}
impl<T: Clone + Copy + Ord + Sized + std::cmp::PartialEq> CustomSet<T> {
pub fn new(_input: &[T]) -> Self {
let mut inner = _input.to_vec();
i... | code_fim | medium | {
"lang": "rust",
"repo": "synapticarbors/exercism",
"path": "/rust/custom-set/src/lib.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn union(&self, _other: &Self) -> Self {
let mut x = self.inner.clone();
x.extend(_other.inner.clone());
Self::new(&x)
}
}<|fim_prefix|>// repo: synapticarbors/exercism path: /rust/custom-set/src/lib.rs
#[derive(Debug, PartialEq)]
pub struct CustomSet<T> {
inner: V... | code_fim | hard | {
"lang": "rust",
"repo": "synapticarbors/exercism",
"path": "/rust/custom-set/src/lib.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: astral-sh/ruff path: /crates/ruff/src/rules/flake8_pyi/rules/ellipsis_in_non_empty_class_body.rs
use ruff_python_ast::{Expr, ExprConstant, Ranged, Stmt, StmtExpr};
use ruff_diagnostics::{AutofixKind, Diagnostic, Fix, Violation};
use ruff_macros::{derive_message_formats, violation};
use crate::... | code_fim | hard | {
"lang": "rust",
"repo": "astral-sh/ruff",
"path": "/crates/ruff/src/rules/flake8_pyi/rules/ellipsis_in_non_empty_class_body.rs",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if !value.is_ellipsis() {
continue;
}
let mut diagnostic = Diagnostic::new(EllipsisInNonEmptyClassBody, stmt.range());
if checker.patch(diagnostic.kind.rule()) {
let edit = autofix::edits::delete_stmt(
stmt,
Some(pare... | code_fim | hard | {
"lang": "rust",
"repo": "astral-sh/ruff",
"path": "/crates/ruff/src/rules/flake8_pyi/rules/ellipsis_in_non_empty_class_body.rs",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Th3-M4jor/serenity path: /examples/e14_slash_commands/src/main.rs
use std::env;
use serenity::{
async_trait,
client::bridge::gateway::GatewayIntents,
model::{gateway::Ready, interactions::{Interaction, InteractionResponseType, ApplicationCommand}},
prelude::*,
};
struct Handler... | code_fim | hard | {
"lang": "rust",
"repo": "Th3-M4jor/serenity",
"path": "/examples/e14_slash_commands/src/main.rs",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Pctg-x8/peridot path: /examples/basic/src/lib.rs
use std::marker::PhantomData;
<|fim_suffix|> Game(PhantomData)
}
}<|fim_middle|>pub struct Game<NL>(PhantomData<*const NL>);
impl<NL: peridot::NativeLinker> peridot::FeatureRequests for Game<NL> {}
impl<NL: peridot::NativeLinker> perid... | code_fim | hard | {
"lang": "rust",
"repo": "Pctg-x8/peridot",
"path": "/examples/basic/src/lib.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Game(PhantomData)
}
}<|fim_prefix|>// repo: Pctg-x8/peridot path: /examples/basic/src/lib.rs
use std::marker::PhantomData;
<|fim_middle|>pub struct Game<NL>(PhantomData<*const NL>);
impl<NL: peridot::NativeLinker> peridot::FeatureRequests for Game<NL> {}
impl<NL: peridot::NativeLinker> perid... | code_fim | hard | {
"lang": "rust",
"repo": "Pctg-x8/peridot",
"path": "/examples/basic/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl X for () {
fn foo(&self) {}
}
impl Trait for dyn X {}
pub fn main() {
<dyn X as X>::foo(&()); //~ERROR: trying to call something that is not a method
}<|fim_prefix|>// repo: rust-lang/miri path: /tests/fail/issue-miri-2432.rs
#![allow(where_clauses_object_safety)]
trait Trait {}
trait X ... | code_fim | easy | {
"lang": "rust",
"repo": "rust-lang/miri",
"path": "/tests/fail/issue-miri-2432.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: rust-lang/miri path: /tests/fail/issue-miri-2432.rs
#![allow(where_clauses_object_safety)]
<|fim_suffix|>pub fn main() {
<dyn X as X>::foo(&()); //~ERROR: trying to call something that is not a method
}<|fim_middle|>trait Trait {}
trait X {
fn foo(&self)
where
Self: Trait;
... | code_fim | medium | {
"lang": "rust",
"repo": "rust-lang/miri",
"path": "/tests/fail/issue-miri-2432.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: iCodeIN/icu4x path: /utils/codepointtrie/src/lib.rs
// This file is part of ICU4X. For terms of use, please see the file
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
<|fim_suffix|>extern crate alloc;
// Wor... | code_fim | hard | {
"lang": "rust",
"repo": "iCodeIN/icu4x",
"path": "/utils/codepointtrie/src/lib.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#![no_std]
extern crate alloc;
// Workaround for https://github.com/rust-lang/rust/issues/87932
#[cfg(feature = "serde")]
extern crate serde;
pub mod codepointtrie;
pub mod error;
mod impl_const;
pub mod planes;<|fim_prefix|>// repo: iCodeIN/icu4x path: /utils/codepointtrie/src/lib.rs
// This file is ... | code_fim | hard | {
"lang": "rust",
"repo": "iCodeIN/icu4x",
"path": "/utils/codepointtrie/src/lib.rs",
"mode": "spm",
"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.