text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> match t::none::<isize> {
t::some::<isize>(_) => {
for _i in &c {
println!("{}", a);
let a = 17;
b.push(a);
}
}
_ => { }
}
}
enum t<T> { none, some(T), }
pub fn main() { let x = 10; let x = x + 20; ass... | code_fim | medium | {
"lang": "rust",
"repo": "bombless/rustc-chinese",
"path": "/src/test/run-pass/shadow.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: bombless/rustc-chinese path: /src/test/run-pass/shadow.rs
// Copyright 2012 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
// ... | code_fim | hard | {
"lang": "rust",
"repo": "bombless/rustc-chinese",
"path": "/src/test/run-pass/shadow.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.spongos.commit();
Ok(self)
}
}<|fim_prefix|>// repo: iota-community/streams path: /iota-streams-ddml/src/command/wrap/commit.rs
use anyhow::Result;
use super::Context;
use crate::command::Commit;
use iota_streams_core::sponge::prp::PRP;
<|fim_middle|>/// Commit Spongos.
impl<F:... | code_fim | medium | {
"lang": "rust",
"repo": "iota-community/streams",
"path": "/iota-streams-ddml/src/command/wrap/commit.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: iota-community/streams path: /iota-streams-ddml/src/command/wrap/commit.rs
use anyhow::Result;
use super::Context;
use crate::command::Commit;
use iota_streams_core::sponge::prp::PRP;
<|fim_suffix|> self.spongos.commit();
Ok(self)
}
}<|fim_middle|>/// Commit Spongos.
impl<F:... | code_fim | medium | {
"lang": "rust",
"repo": "iota-community/streams",
"path": "/iota-streams-ddml/src/command/wrap/commit.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> console = Console::new(gfx.top_screen.borrow_mut());
println!("Press A to enable/disable wide screen mode.");
}
gfx.wait_for_vblank();
}
}<|fim_prefix|>// repo: FenrirWolf/ctru-rs path: /ctru-rs/examples/gfx-wide-mode.rs
use ctru::prelude::*;
fn main() {
... | code_fim | hard | {
"lang": "rust",
"repo": "FenrirWolf/ctru-rs",
"path": "/ctru-rs/examples/gfx-wide-mode.rs",
"mode": "spm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: FenrirWolf/ctru-rs path: /ctru-rs/examples/gfx-wide-mode.rs
use ctru::prelude::*;
fn main() {
ctru::use_panic_handler();
let apt = Apt::new().unwrap();
let mut hid = Hid::new().unwrap();
let gfx = Gfx::new().unwrap();
let mut console = Console::new(gfx.top_screen.borrow_mut... | code_fim | medium | {
"lang": "rust",
"repo": "FenrirWolf/ctru-rs",
"path": "/ctru-rs/examples/gfx-wide-mode.rs",
"mode": "psm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_suffix|> let wide_mode = gfx.top_screen.borrow().is_wide();
gfx.top_screen.borrow_mut().set_wide_mode(!wide_mode);
console = Console::new(gfx.top_screen.borrow_mut());
println!("Press A to enable/disable wide screen mode.");
}
gfx.wait_for_vblank();... | code_fim | hard | {
"lang": "rust",
"repo": "FenrirWolf/ctru-rs",
"path": "/ctru-rs/examples/gfx-wide-mode.rs",
"mode": "spm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_suffix|> output.write_all(b"demands\r\n")?;
let num_queries = ground_truth.iter().filter(|&&t| t != INFINITY).count();
output.write_all(&(num_queries as u32).to_ne_bytes())?;
for i in 0..ground_truth.len() {
if ground_truth[i] != INFINITY {
output.write_all(&from[i].to_ne_bytes... | code_fim | hard | {
"lang": "rust",
"repo": "PayasR/rust_road_router",
"path": "/conversion/src/bin/td_ben_queries_to_veit_demands.rs",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: PayasR/rust_road_router path: /conversion/src/bin/td_ben_queries_to_veit_demands.rs
// CATCHUp utilitie to write RoutingKit querties to KaTCH demands
use std::{env, error::Error, fs::File, io::prelude::*, path::Path};
use rust_road_router::{cli::CliErr, datastr::graph::INFINITY, io::*};
fn ma... | code_fim | medium | {
"lang": "rust",
"repo": "PayasR/rust_road_router",
"path": "/conversion/src/bin/td_ben_queries_to_veit_demands.rs",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> <div
class="d-flex border-bottom border-1 list-hover justify-content-between align-items-center"
>
<div
class="p-3 d-flex"
style="width: 40%;"
>
... | code_fim | hard | {
"lang": "rust",
"repo": "brotheryeska/domain_try",
"path": "/src/pages/authentication/social/applications.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: brotheryeska/domain_try path: /src/pages/authentication/social/applications.rs
use yew::prelude::*;
// use super::nodejs::Nodejs;
pub struct SocialApplications {}
pub enum Msg {}
impl Component for SocialApplications {
type Message = Msg;
type Properties = ();
fn create(_: Self::... | code_fim | hard | {
"lang": "rust",
"repo": "brotheryeska/domain_try",
"path": "/src/pages/authentication/social/applications.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> <div
class="d-grid"
style="min-width: 40px;"
>
<span
class="fw-bold"
style="
... | code_fim | hard | {
"lang": "rust",
"repo": "brotheryeska/domain_try",
"path": "/src/pages/authentication/social/applications.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: zandeck/aoc-2020 path: /src/challenges/day3.rs
use crate::challenges::utils::read_file;
pub struct Path {
right: usize,
down: usize,
}
pub fn nb_trees_in(data: &[String], p: &Path) -> usize {
data.iter()
.enumerate()
.step_by(p.down)
.map(|(n, l)| l.chars().... | code_fim | hard | {
"lang": "rust",
"repo": "zandeck/aoc-2020",
"path": "/src/challenges/day3.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let paths = vec![
Path { right: 1, down: 1 },
Path { right: 3, down: 1 },
Path { right: 5, down: 1 },
Path { right: 7, down: 1 },
Path { right: 1, down: 2 },
];
println!(
"{}",
paths
.iter()
.map(|p| nb_trees_in(&... | code_fim | hard | {
"lang": "rust",
"repo": "zandeck/aoc-2020",
"path": "/src/challenges/day3.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> println!(
"{}",
paths
.iter()
.map(|p| nb_trees_in(&data, p))
.product::<usize>()
);
}<|fim_prefix|>// repo: zandeck/aoc-2020 path: /src/challenges/day3.rs
use crate::challenges::utils::read_file;
pub struct Path {
right: usize,
down: u... | code_fim | hard | {
"lang": "rust",
"repo": "zandeck/aoc-2020",
"path": "/src/challenges/day3.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #[derive(Clone, Debug, Default)]
struct TestcaseTemp {
input: Option<String>,
output: Option<String>,
}
let mut testcases = vec![TestcaseTemp::default(); TESTCASE_NUM_MAX];
let doc = Html::parse_document(&text);
let sel_part =
Selector::parse(r#"div[class... | code_fim | hard | {
"lang": "rust",
"repo": "ordovicia/atcoder",
"path": "/testcase-scraping/src/lib.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> macro_rules! parse {
($field: ident, $digits: ident) => {{
let number = $digits[1].parse::<usize>().expect("Unexpected non-digit."); // 1-based
if number >= TESTCASE_NUM_MAX {
Err(Error::Testcase("Too many testcase... | code_fim | hard | {
"lang": "rust",
"repo": "ordovicia/atcoder",
"path": "/testcase-scraping/src/lib.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ordovicia/atcoder path: /testcase-scraping/src/lib.rs
mod error;
use error::Error;
use std::collections::HashMap;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Clone, Debug)]
pub struct Session {
client: reqwest::Client,
url_base: url::Url,
}
const TESTCASE_NUM_MAX: us... | code_fim | hard | {
"lang": "rust",
"repo": "ordovicia/atcoder",
"path": "/testcase-scraping/src/lib.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert_eq!(
process(
&vec!["abcde", "fghij", "klmno", "pqrst", "fguij", "axcye", "wvxyz"].join("\n")
)
.to_string(),
"fgij"
);
}
}<|fim_prefix|>// repo: jonesetc/aoc-2018 path: /day2/src/bin/part2.rs
use std::collections:... | code_fim | medium | {
"lang": "rust",
"repo": "jonesetc/aoc-2018",
"path": "/day2/src/bin/part2.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: jonesetc/aoc-2018 path: /day2/src/bin/part2.rs
use std::collections::HashSet;
const INPUT: &str = include_str!("../../etc/input-part2.txt");
fn main() {
println!("answer is: {}", process(INPUT).to_string())
}
fn process(input: &str) -> impl ToString {
<|fim_suffix|> for line in input.l... | code_fim | medium | {
"lang": "rust",
"repo": "jonesetc/aoc-2018",
"path": "/day2/src/bin/part2.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>fn process(input: &str) -> impl ToString {
let mut previous_ids: HashSet<(&str, &str)> = HashSet::new();
for line in input.lines() {
for i in { 0..line.len() } {
let masked_id: (&str, &str) = (&line[..i], &line[i + 1..]);
if !previous_ids.insert(masked_id) {
... | code_fim | medium | {
"lang": "rust",
"repo": "jonesetc/aoc-2018",
"path": "/day2/src/bin/part2.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #[inline]
pub fn rotate(&self, r: Quat) -> Plane {
Plane::new(r * self.normal, self.offset)
}
#[inline]
pub fn transform(self, p: Pose) -> Plane {
let norm = p.orientation * self.normal;
let offset = self.offset - dot(norm, p.position);
Plane::new(norm,... | code_fim | hard | {
"lang": "rust",
"repo": "thomcc/rs-stuff",
"path": "/src/math/plane.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: thomcc/rs-stuff path: /src/math/plane.rs
use math::vec::*;
use math::scalar::*;
use math::traits::*;
use math::quat::*;
use math::pose::*;
use math::geom::*;
use std::ops::Neg;
use std::{default, fmt};
pub const DEFAULT_PLANE_WIDTH: f32 = 0.0008_f32;
#[derive(Copy, Clone, Debug, PartialEq)]
pu... | code_fim | hard | {
"lang": "rust",
"repo": "thomcc/rs-stuff",
"path": "/src/math/plane.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: avs-simulator/ascod-comm path: /ascod-comm-data/src/turret_messages/turret_input_card5.rs
use c2rust_bitfields::BitfieldStruct;
use static_assertions::assert_eq_size;
pub const SIZE_TURRET_INPUT_CARD5: usize = 2;
#[repr(C, packed)]
#[derive(BitfieldStruct, Clone, Debug)]
pub struct TurretInput... | code_fim | hard | {
"lang": "rust",
"repo": "avs-simulator/ascod-comm",
"path": "/ascod-comm-data/src/turret_messages/turret_input_card5.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>6_t", bits = "10..=10")]
#[bitfield(name = "button_f11_gmu", ty = "libc::uint16_t", bits = "11..=11")]
raw: [u8; SIZE_TURRET_INPUT_CARD5],
}
assert_eq_size!(TurretInputCard5, [u8; SIZE_TURRET_INPUT_CARD5]);
impl Default for TurretInputCard5 {
fn default() -> Self {
Self {
... | code_fim | hard | {
"lang": "rust",
"repo": "avs-simulator/ascod-comm",
"path": "/ascod-comm-data/src/turret_messages/turret_input_card5.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: caesarchad/DeCore path: /core/src/signature_verify_phase.rs
//! The `sigverify_phase` implements the signature verification phase of the transaction digesting module. It
//! receives a list of lists of packets and outputs the same list, but tags each
//! top-level list with a list of booleans, t... | code_fim | hard | {
"lang": "rust",
"repo": "caesarchad/DeCore",
"path": "/core/src/signature_verify_phase.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub fn is_idle(&self) -> bool {
self.available_permits() == self.capacity()
}
pub fn is_full(&self) -> bool {
self.available_permits() == 0
}
/// Try to acquire an available permit from the semaphore. If no permits are
/// available, return `None`.
pub fn try_... | code_fim | hard | {
"lang": "rust",
"repo": "caesarchad/DeCore",
"path": "/core/src/signature_verify_phase.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: stm32-rs/stm32h7xx-hal path: /examples/mco.rs
#![deny(warnings)]
#![no_main]
#![no_std]
use cortex_m_rt::entry;
#[macro_use]
mod utilities;
use stm32h7xx_hal::{gpio::Speed, pac, prelude::*, rcc::PllConfigStrategy};
<|fim_suffix|>#[entry]
fn main() -> ! {
utilities::logger::init();
let ... | code_fim | medium | {
"lang": "rust",
"repo": "stm32-rs/stm32h7xx-hal",
"path": "/examples/mco.rs",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> // MCO
info!(
"mco2 = {} MHz",
ccdr.clocks.mco2_ck().unwrap().raw() as f32 / 1e6
);
assert_eq!(ccdr.clocks.mco2_ck().unwrap().raw(), 25_600_000);
info!("MCO outputs running!");
loop {
cortex_m::asm::nop()
}
}<|fim_prefix|>// repo: stm32-rs/stm32h7xx-ha... | code_fim | hard | {
"lang": "rust",
"repo": "stm32-rs/stm32h7xx-hal",
"path": "/examples/mco.rs",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: aristotle9/qt_generator-output path: /qt_widgets/src/graphics_path_item.rs
:RectF {
{
let mut object: ::qt_core::rect_f::RectF =
unsafe { ::cpp_utils::new_uninitialized::NewUninitialized::new_uninitialized() };
unsafe {
::ffi::qt_widgets_c_QGraphicsPathItem_boundi... | code_fim | hard | {
"lang": "rust",
"repo": "aristotle9/qt_generator-output",
"path": "/qt_widgets/src/graphics_path_item.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> fn dynamic_cast(&self) -> ::std::option::Option<&::graphics_path_item::GraphicsPathItem> {
let ffi_result = unsafe { ::ffi::qt_widgets_c_QGraphicsPathItem_G_dynamic_cast_QGraphicsPathItem_ptr_QGraphicsItem(self as *const ::graphics_item::GraphicsItem as *mut ::graphics_item::GraphicsItem) };
uns... | code_fim | hard | {
"lang": "rust",
"repo": "aristotle9/qt_generator-output",
"path": "/qt_widgets/src/graphics_path_item.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl ::cpp_utils::UnsafeStaticCast<::graphics_path_item::GraphicsPathItem> for ::graphics_item::GraphicsItem {
unsafe fn static_cast_mut(&mut self) -> &mut ::graphics_path_item::GraphicsPathItem {
let ffi_result = ::ffi::qt_widgets_c_QGraphicsPathItem_G_static_cast_QGraphicsPathItem_ptr_QGraphicsIte... | code_fim | hard | {
"lang": "rust",
"repo": "aristotle9/qt_generator-output",
"path": "/qt_widgets/src/graphics_path_item.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: kwyse/euler-solutions path: /src/problems/p008.rs
//! Problem 8: Largest product in a series
solve!(expecting_answer: 23_514_624_000, with: || {
include_str!("../../resources/p008")
.lines().collect::<Vec<_>>().concat()
<|fim_suffix|>ow| window.iter().map(|&n| n as u64).product:... | code_fim | medium | {
"lang": "rust",
"repo": "kwyse/euler-solutions",
"path": "/src/problems/p008.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> .chars().filter_map(|c| c.to_digit(10)).collect::<Vec<_>>().windows(13)
.map(|window| window.iter().map(|&n| n as u64).product::<u64>())
.max().unwrap_or(0) as u128
});<|fim_prefix|>// repo: kwyse/euler-solutions path: /src/problems/p008.rs
//! Problem 8: Largest product in a series
... | code_fim | medium | {
"lang": "rust",
"repo": "kwyse/euler-solutions",
"path": "/src/problems/p008.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>pub mod broker_service_url;
pub mod client_channel;
pub mod client_channel_messages;
pub mod client_half_requests;
pub mod client_handler;
pub mod client_responds;
pub mod command;
pub mod commands;
pub mod compression;
pub mod frame;
pub mod protos;
pub mod types;
pub use commands::*;<|fim_prefix|>// re... | code_fim | easy | {
"lang": "rust",
"repo": "tspannhw/pulsar-rs",
"path": "/pulsar-binary-protocol-spec/src/lib.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: tspannhw/pulsar-rs path: /pulsar-binary-protocol-spec/src/lib.rs
pub use ::protobuf;
#[cfg(feature = "with-asynchronous")]
pub use async_channel;
#[cfg(feature = "with-asynchronous")]
pub use futures_channel;
<|fim_suffix|>pub mod broker_service_url;
pub mod client_channel;
pub mod client_chan... | code_fim | easy | {
"lang": "rust",
"repo": "tspannhw/pulsar-rs",
"path": "/pulsar-binary-protocol-spec/src/lib.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>fn parse_array_type(source: &str) -> Option<&str> {
if !source.starts_with("Array") {
return None;
}
let inner_type = &source[6..source.len() - 1];
Some(inner_type)
}
fn parse_decimal(source: &str) -> Option<(u8, u8, NoBits)> {
if source.len() < 12 {
return None;
... | code_fim | hard | {
"lang": "rust",
"repo": "Deniallugo/clickhouse-rs",
"path": "/src/types/column/factory.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Deniallugo/clickhouse-rs path: /src/types/column/factory.rs
use chrono_tz::Tz;
use crate::{
binary::ReadEx,
errors::Result,
types::column::{
array::ArrayColumnData, column_data::ColumnData, date::DateColumnData,
decimal::DecimalColumnData, fixed_string::FixedStringCo... | code_fim | hard | {
"lang": "rust",
"repo": "Deniallugo/clickhouse-rs",
"path": "/src/types/column/factory.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: baoliang/forest path: /forest/src/cli/config.rs
// Copyright 2020 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
use beacon::DistPublic;
use forest_libp2p::Libp2pConfig;
use serde::Deserialize;
use utils::get_home_dir;
#[derive(Debug, Deserialize)]
#[serde(default)]
pub struct Co... | code_fim | medium | {
"lang": "rust",
"repo": "baoliang/forest",
"path": "/forest/src/cli/config.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Ok((remote_conn, stream, ch_wh))
};
fut
}));
}
let _ = session
.disconnect(Disconnect::ByApplication, "", "English")
.await
.map_err(|e| {
println!("=== {:#?}", e);
});
}<|fim_prefix|>// repo: ja... | code_fim | hard | {
"lang": "rust",
"repo": "jason-ni/hsproxy",
"path": "/examples/ssh_tunnel.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: jason-ni/hsproxy path: /examples/ssh_tunnel.rs
extern crate env_logger;
extern crate futures;
extern crate thrussh;
extern crate thrussh_keys;
extern crate tokio;
use anyhow::Context;
use futures::StreamExt;
use hsproxy;
use log::info;
use std::sync::Arc;
use thrussh::client::channel::... | code_fim | hard | {
"lang": "rust",
"repo": "jason-ni/hsproxy",
"path": "/examples/ssh_tunnel.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> // check right
if slot.x < BOARD_LEN - 2 {
let p1 = game_state
.board
.entity_to_right(slot.x, slot.y)
.map(|e| occupied.get(e))
.flatten();
let p2 = game_state
... | code_fim | hard | {
"lang": "rust",
"repo": "charithe/pegsol",
"path": "/src/systems/gameplay.rs",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> // check below
if slot.y < BOARD_LEN - 2 {
let p1 = game_state
.board
.entity_below(slot.x, slot.y)
.map(|e| occupied.get(e))
.flatten();
let p2 = game_state
... | code_fim | hard | {
"lang": "rust",
"repo": "charithe/pegsol",
"path": "/src/systems/gameplay.rs",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: charithe/pegsol path: /src/systems/gameplay.rs
use crate::components::*;
use crate::constants::BOARD_LEN;
use crate::resources::*;
use specs::{Join, ReadStorage, System, WriteExpect, WriteStorage};
pub struct GamePlaySystem;
impl<'a> System<'a> for GamePlaySystem {
type SystemData = (
... | code_fim | hard | {
"lang": "rust",
"repo": "charithe/pegsol",
"path": "/src/systems/gameplay.rs",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> where
A: serde::de::MapAccess<'de>,
{
let mut name = None;
let mut body = None;
for _ in 0..2 {
let (k, v) = map
.next_entry::<String, Option<String>>()?
.ok_or_else(|| serde::de::Error::custom("map not atleast 2 long"))?;... | code_fim | hard | {
"lang": "rust",
"repo": "cramt/dnd_wiki",
"path": "/src/in_model/races/race_category.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: cramt/dnd_wiki path: /src/in_model/races/race_category.rs
use serde::{de::Visitor, Deserialize};
use shoulda::Shoulda;
#[derive(Debug, Shoulda)]
pub struct RaceCategory {
pub name: String,
pub body: Option<String>,
}
struct RaceCategoryVisitor;
impl<'de> Visitor<'de> for RaceCategoryV... | code_fim | hard | {
"lang": "rust",
"repo": "cramt/dnd_wiki",
"path": "/src/in_model/races/race_category.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: jjmark15/bookmarks-search-engine path: /bookmarks/src/domain/bookmark/bookmark_repository.rs
use uuid::Uuid;
use crate::domain::bookmark::Bookmark;
<|fim_suffix|> fn get(&self, id: Uuid) -> Result<Bookmark, BookmarkRepositoryError>;
}
#[derive(Debug, thiserror::Error)]
pub(crate) enum Book... | code_fim | medium | {
"lang": "rust",
"repo": "jjmark15/bookmarks-search-engine",
"path": "/bookmarks/src/domain/bookmark/bookmark_repository.rs",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>}
#[derive(Debug, thiserror::Error)]
pub(crate) enum BookmarkRepositoryError {
#[error("Could not find Bookmark with id: {0}")]
BookmarkNotFound(Uuid),
#[error("Unexpected persistence error occurred: {0}")]
Unexpected(String),
}<|fim_prefix|>// repo: jjmark15/bookmarks-search-engine path... | code_fim | medium | {
"lang": "rust",
"repo": "jjmark15/bookmarks-search-engine",
"path": "/bookmarks/src/domain/bookmark/bookmark_repository.rs",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> fn set_bit(&self, bit: usize, value: bool);
}
impl BitRange<u32> for VolatileCell<u32> {
fn bit_range(&self, msb: usize, lsb: usize) -> u32 {
bitfield::BitRange::bit_range(&(self.get()), msb, lsb)
}
fn set_bit_range(&self, msb: usize, lsb: usize, value: u32) {
let mut val... | code_fim | medium | {
"lang": "rust",
"repo": "halazouna/stm32f429zi_tockos",
"path": "/chips/stm32f429/src/vol_cell.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: halazouna/stm32f429zi_tockos path: /chips/stm32f429/src/vol_cell.rs
//! Various helper methods, traits
use bitfield;
use kernel::common::VolatileCell;
pub trait BitRange<T> {
fn bit_range(&self, msb: usize, lsb: usize) -> T;
fn set_bit_range(&self, msb: usize, lsb: usize, value: T);
<|... | code_fim | hard | {
"lang": "rust",
"repo": "halazouna/stm32f429zi_tockos",
"path": "/chips/stm32f429/src/vol_cell.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> bitfield::BitRange::bit_range(&(self.get()), msb, lsb)
}
fn set_bit_range(&self, msb: usize, lsb: usize, value: u32) {
let mut val = self.get();
bitfield::BitRange::set_bit_range(&mut val, msb, lsb, value);
self.set(val);
}
}
impl Bit for VolatileCell<u32> {
... | code_fim | medium | {
"lang": "rust",
"repo": "halazouna/stm32f429zi_tockos",
"path": "/chips/stm32f429/src/vol_cell.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Kurble/mirror path: /mirror-derive/src/lib.rs
#![recursion_limit="128"]
#[macro_use]
extern crate quote;
extern crate syn;
extern crate proc_macro;
extern crate proc_macro2;
use proc_macro::TokenStream;
use proc_macro2::Span;
use std::collections::HashSet;
use syn::*;
struct MirroredAction {
... | code_fim | hard | {
"lang": "rust",
"repo": "Kurble/mirror",
"path": "/mirror-derive/src/lib.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut actions = Vec::new();
for attr in ast.attrs.iter() {
if let Some(Meta::List(list)) = attr.interpret_meta() {
if list.ident == "ReflectFn" {
for nest_meta in list.nested.iter() {
if let &NestedMeta::Meta (ref sub_attr) = nest_meta {
... | code_fim | hard | {
"lang": "rust",
"repo": "Kurble/mirror",
"path": "/mirror-derive/src/lib.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: phyber/jail_exporter path: /src/macros.rs
// macros: This module contains macros for registering metrics with the
// registry.
#![forbid(unsafe_code)]
#![deny(missing_docs)]
/// Register a Counter Family with the Registry
#[macro_export]
macro_rules! register_counter_with_registry {
... | code_fim | hard | {
"lang": "rust",
"repo": "phyber/jail_exporter",
"path": "/src/macros.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> $REGISTRY.register_with_unit(
$NAME,
$HELP,
$UNIT,
family.clone(),
);
family
}};
}
/// Register a Gauge with the Registry
#[macro_export]
macro_rules! register_gauge_with_registry {
// Single gauge with no specified unit
... | code_fim | hard | {
"lang": "rust",
"repo": "phyber/jail_exporter",
"path": "/src/macros.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> gauge
}};
// Gauge family with no specified unit
($NAME:expr, $HELP:expr, $LABELS:ty, $REGISTRY:ident $(,)?) => {{
use prometheus_client::metrics::{
family::Family,
gauge::Gauge,
};
let family = Family::<$LABELS, Gauge>::default();
... | code_fim | hard | {
"lang": "rust",
"repo": "phyber/jail_exporter",
"path": "/src/macros.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> let references_unique_criterion = relation.referenced_model().unique_criterias().any(|criteria| {
let mut criteria_field_names: Vec<_> = criteria.fields().map(|f| f.name()).collect();
criteria_field_names.sort_unstable();
let mut references_sorted: Vec<_> = relation.referenced... | code_fim | hard | {
"lang": "rust",
"repo": "prisma/prisma-engines",
"path": "/psl/psl-core/src/validate/validation_pipeline/validations/relations.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if !triggers_modifications(&relation) {
return;
}
let parent_model = relation.referencing_model();
// Gather all paths from this model to any other model, skipping
// cyclical relations
let mut paths = Vec::new();
// Add all relations from current model to the graph ... | code_fim | hard | {
"lang": "rust",
"repo": "prisma/prisma-engines",
"path": "/psl/psl-core/src/validate/validation_pipeline/validations/relations.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: aoneill01/wasm-gamebuino path: /src/input_output.rs
use crate::register::{PortRegisters, SercomRegisters};
pub struct St7735 {
x_start: u8,
x_end: u8,
y_start: u8,
y_end: u8,
x: u8,
y: u8,
arg_index: u8,
last_command: u8,
tmp_data: u8,
image_data: [u32; S... | code_fim | hard | {
"lang": "rust",
"repo": "aoneill01/wasm-gamebuino",
"path": "/src/input_output.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if base_index < St7735::WIDTH * St7735::HEIGHT {
self.image_data[base_index] = color;
}
self.x += 1;
if self.x > self.x_end {
self.x = self.x_start;
... | code_fim | hard | {
"lang": "rust",
"repo": "aoneill01/wasm-gamebuino",
"path": "/src/input_output.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if quiet_attack_mask == 0
{
break;
}
}
}
if capture_attack_mask != 0
{
loop
{
... | code_fim | hard | {
"lang": "rust",
"repo": "tsoj/hactar",
"path": "/src/position/mov.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: tsoj/hactar path: /src/position/mov.rs
use chess_data::*;
use evaluation::score::{SCORE, Score};
use search::transposition_table::TranspositionTable;
use position::piece::{NO_PIECE, PAWN, KNIGHT, BISHOP, ROOK, QUEEN, KING, Piece};
use position::piece::get_unicode;
use position::piece::get_notat... | code_fim | hard | {
"lang": "rust",
"repo": "tsoj/hactar",
"path": "/src/position/mov.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: hhatto/jubatus-rust-client path: /src/nearest_neighbor/mod.rs
// This file is auto-generated from nearest_neighbo<|fim_suffix|>.0-76-g95eed232/support-rust-client-for-jenerator
// *** DO NOT EDIT ***
pub mod client;
pub mod types;<|fim_middle|>r.idl(0.8.2-20-g8e4dc3b5) with jenerator version 1.... | code_fim | easy | {
"lang": "rust",
"repo": "hhatto/jubatus-rust-client",
"path": "/src/nearest_neighbor/mod.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> *** DO NOT EDIT ***
pub mod client;
pub mod types;<|fim_prefix|>// repo: hhatto/jubatus-rust-client path: /src/nearest_neighbor/mod.rs
// This file is auto-generated from nearest_neighbor.idl(0.8.2-20-g8e4dc3b5) with jenerator version 1.0<|fim_middle|>.0-76-g95eed232/support-rust-client-for-jenerator
/... | code_fim | easy | {
"lang": "rust",
"repo": "hhatto/jubatus-rust-client",
"path": "/src/nearest_neighbor/mod.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: CasualX/pak-rs path: /src/directory.rs
use std::{fmt, slice};
use crate::*;
/// Directory editor.
///
/// The directory is a sequence of descriptors encoding a light-weight [TLV structure](https://en.wikipedia.org/wiki/Type-length-value).
#[derive(Clone, Debug, Default)]
#[repr(transparent)]
pu... | code_fim | hard | {
"lang": "rust",
"repo": "CasualX/pak-rs",
"path": "/src/directory.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// Removes a descriptor at the given path.
///
/// Returns `false` if no descriptor is found at the given path.
/// The directory remains unchanged, the output argument deleted is untouched.
///
/// Returns `true` if a file descriptor is found at the given path.
/// The descriptor is removed and o... | code_fim | hard | {
"lang": "rust",
"repo": "CasualX/pak-rs",
"path": "/src/directory.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: Hzqi/rust-graphql-resolver path: /rust-graphql-resolver/tests/graphql_data_value_derive.rs
use std::{array::IntoIter, collections::BTreeMap, iter::FromIterator};
use macros::GraphQLDataValue;
use rust_graphql_resolver::value::{DataValue, ToDataValue};
<|fim_suffix|>#[test]
fn test_generate_dat... | code_fim | medium | {
"lang": "rust",
"repo": "Hzqi/rust-graphql-resolver",
"path": "/rust-graphql-resolver/tests/graphql_data_value_derive.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let h = HelloWorld {
hello: "hello".to_string(),
greeting: "rust-graphql-resolver".to_string(),
};
let dv = h.to_data_value();
assert_eq!(
dv,
DataValue::Object(BTreeMap::from_iter(IntoIter::new([
("hello".to_string(), DataValue::String("hello".t... | code_fim | medium | {
"lang": "rust",
"repo": "Hzqi/rust-graphql-resolver",
"path": "/rust-graphql-resolver/tests/graphql_data_value_derive.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: stiiifff/pallet-product-tracking path: /src/builders.rs
use crate::types::*;
use frame_support::sp_std::prelude::*;
use product_registry::ProductId;
// --- ShipmentBuilder ---
#[derive(Default)]
pub struct ShipmentBuilder<AccountId, Moment>
where
AccountId: Default,
Moment: Default,
{
... | code_fim | hard | {
"lang": "rust",
"repo": "stiiifff/pallet-product-tracking",
"path": "/src/builders.rs",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> ShippingEventBuilder {
shipment_id: ShipmentId::default(),
event_type: ShippingEventType::ShipmentPickup,
location: Option::<ReadPoint>::default(),
readings: Vec::<Reading<Moment>>::default(),
timestamp: Moment::default(),
}
}... | code_fim | hard | {
"lang": "rust",
"repo": "stiiifff/pallet-product-tracking",
"path": "/src/builders.rs",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: EFanZh/LeetCode path: /src/problem_0300_longest_increasing_subsequence/dynamic_programming_fast.rs
pub struct Solution;
// ------------------------------------------------------ snip ------------------------------------------------------ //
impl Solution {
#[allow(clippy::option_if_let_els... | code_fim | hard | {
"lang": "rust",
"repo": "EFanZh/LeetCode",
"path": "/src/problem_0300_longest_increasing_subsequence/dynamic_programming_fast.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Self::length_of_lis(nums)
}
}
#[cfg(test)]
mod tests {
#[test]
fn test_solution() {
super::super::tests::run::<super::Solution>();
}
}<|fim_prefix|>// repo: EFanZh/LeetCode path: /src/problem_0300_longest_increasing_subsequence/dynamic_programming_fast.rs
pub struct Solut... | code_fim | medium | {
"lang": "rust",
"repo": "EFanZh/LeetCode",
"path": "/src/problem_0300_longest_increasing_subsequence/dynamic_programming_fast.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: baloo/bootsector path: /src/lib.rs
#![warn(
clippy::cast_lossless,
clippy::cast_possible_truncation,
clippy::cast_possible_wrap
)]
//! Read basic MBR and GPT partition tables from a reader.
//!
//! # Examples
//!
//! Load MBR or GPT partitions from a `reader`:
//!
//! ```rust
//! use... | code_fim | hard | {
"lang": "rust",
"repo": "baloo/bootsector",
"path": "/src/lib.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>/// Settings for handling sector size
pub enum SectorSize {
/// Attempt to identify a valid GPT partition table at various locations, and use this
/// information to derive the sector size. For MBR, it's very likely that 512 is a safe
/// assumption.
GuessOrAssume,
/// Use a specific ... | code_fim | hard | {
"lang": "rust",
"repo": "baloo/bootsector",
"path": "/src/lib.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if pin.is_low() == true {
println!("{}",alm_message11);
}
}}<|fim_prefix|>// repo: sisaphilip/safaricom-alarms path: /src/sfcalm11.rs
use std::error::Error;
use rppal::gpio::Gpio;
use std::string::String;
const GPIO_SENSOR: u8 = 13;
<|fim_middle|>pub fn alm11 () -> Result<(), Box<dyn Error... | code_fim | medium | {
"lang": "rust",
"repo": "sisaphilip/safaricom-alarms",
"path": "/src/sfcalm11.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: sisaphilip/safaricom-alarms path: /src/sfcalm11.rs
use std::error::Error;
use rppal::gpio::Gpio;
use std::string::String;
const GPIO_SENSOR: u8 = 13;
pub fn alm11 () -> Result<(), Box<dyn Error>>
{
<|fim_suffix|> println!("{}",alm_message11);
}
}}<|fim_middle|>
let alm_message11... | code_fim | medium | {
"lang": "rust",
"repo": "sisaphilip/safaricom-alarms",
"path": "/src/sfcalm11.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: alsuren/wash path: /src/up/standalone.rs
use super::CtlCliCommand;
use crate::ctl::*;
use crate::util::{labels_vec_to_hashmap, OutputKind, Result};
use std::collections::HashMap;
use CtlCliCommand::*;
pub(crate) enum HostCommand {
Call {
actor: String,
operation: String,
... | code_fim | hard | {
"lang": "rust",
"repo": "alsuren/wash",
"path": "/src/up/standalone.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> match cmd {
Call(CallCommand {
actor_id,
operation,
data,
output,
..
}) => HostCommand::Call {
actor: actor_id,
operation,
msg: crate::util::json_... | code_fim | hard | {
"lang": "rust",
"repo": "alsuren/wash",
"path": "/src/up/standalone.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: amar-laksh/focusTV_rust path: /src/target/debug/build/opencv-3c40c99bd52f01a8/out/imgproc.consts.rs
pub const BORDER_CONSTANT:i32 = 0x0;
pub const BORDER_DEFAULT:i32 = 0x4;
pub const BORDER_REFLECT:i32 = 0x2;
pub const BORDER_REFLECT101:i32 = 0x4;
pub const BORDER_REFLECT_101:i32 = 0x4;
pub cons... | code_fim | hard | {
"lang": "rust",
"repo": "amar-laksh/focusTV_rust",
"path": "/src/target/debug/build/opencv-3c40c99bd52f01a8/out/imgproc.consts.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>x64;
pub const CV_YUV2RGB_UYNV:i32 = 0x6b;
pub const CV_YUV2RGB_Y422:i32 = 0x6b;
pub const CV_YUV2RGB_YUNV:i32 = 0x73;
pub const CV_YUV2RGB_YUYV:i32 = 0x73;
pub const CV_YUV420p2BGR:i32 = 0x63;
pub const CV_YUV420p2BGRA:i32 = 0x67;
pub const CV_YUV420p2GRAY:i32 = 0x6a;
pub const CV_YUV420p2RGB:i32 = 0x62;... | code_fim | hard | {
"lang": "rust",
"repo": "amar-laksh/focusTV_rust",
"path": "/src/target/debug/build/opencv-3c40c99bd52f01a8/out/imgproc.consts.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let cp = matches.value_of("cp");
let main = matches.value_of("main").unwrap();
let mut cpm = ClassPathManager::new();
if let Some(class_path) = cp {
cpm.add_class_paths(class_path).unwrap();
let cl = ClassLoader::new(Arc::new(cpm), None);
let cf = cl.load_class(ma... | code_fim | hard | {
"lang": "rust",
"repo": "zhiqiangxu/rust-tests",
"path": "/src/bin/main.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: zhiqiangxu/rust-tests path: /src/bin/main.rs
use clap::{App, Arg};
use jvm::{class_loader::ClassLoader, class_path_manager::ClassPathManager};
use std::sync::Arc;
fn main() {
<|fim_suffix|> let cp = matches.value_of("cp");
let main = matches.value_of("main").unwrap();
let mut cpm = ... | code_fim | hard | {
"lang": "rust",
"repo": "zhiqiangxu/rust-tests",
"path": "/src/bin/main.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: vojtechkral/jxlrate path: /src/bitstream/bitreader.rs
use std::io::Read;
use crate::bitstream::FromBits;
use crate::error::*;
/// Pull individual bits or bit ranges up to 56 bits per call
/// out of any `io::Read` type.
pub struct BitReader<R> {
reader: R,
bits: u64,
num_bits: u32,... | code_fim | hard | {
"lang": "rust",
"repo": "vojtechkral/jxlrate",
"path": "/src/bitstream/bitreader.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let mut needed = bits.saturating_sub(self.num_bits);
while needed > 0 {
let mut bytes = (&mut self.reader).bytes();
let byte = bytes.next().ok_or(Error::UnexpectedEof)??;
self.bits |= (byte as u64) << (self.num_bits as u64);
self.num_bits +=... | code_fim | hard | {
"lang": "rust",
"repo": "vojtechkral/jxlrate",
"path": "/src/bitstream/bitreader.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let angle = match *target {
Up => PI / 2.,
Down => 3. * PI / 2.,
Left => PI,
Right => 0.,
};
transform.set_rotation_2d(angle);
}
}
}<|fim_prefix|>// repo: ElectricCoffee/snake path: /src/syste... | code_fim | hard | {
"lang": "rust",
"repo": "ElectricCoffee/snake",
"path": "/src/systems/sprite_updater.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: ElectricCoffee/snake path: /src/systems/sprite_updater.rs
use crate::components::Orientation;
use amethyst::{core::*, derive::SystemDesc, ecs::prelude::*};
use std::f32::consts::PI;
<|fim_suffix|>impl<'s> System<'s> for SpriteUpdater {
type SystemData = (ReadStorage<'s, Orientation>, WriteS... | code_fim | medium | {
"lang": "rust",
"repo": "ElectricCoffee/snake",
"path": "/src/systems/sprite_updater.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: zarubaf/moore path: /src/svlog/hir/mod.rs
// Copyright (c) 2017 Fabian Schuiki
//! The high-level intermediate representation for SystemVerilog.
//!
//! After parsing the AST is lowered into this representation, eliminating a lot
//! of syntactic sugar and resolving any syntactic ambiguities.
... | code_fim | hard | {
"lang": "rust",
"repo": "zarubaf/moore",
"path": "/src/svlog/hir/mod.rs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>impl<'a, 'gcx: 'a, C> AccessTableCollector<'a, C>
where
C: Context<'gcx>,
{
fn is_binding_interesting(&self, binding: NodeId) -> bool {
if self.cx.is_parent_of(self.table.node_id, binding) {
return false;
}
match self.cx.hir_of(binding) {
Ok(HirNode:... | code_fim | hard | {
"lang": "rust",
"repo": "zarubaf/moore",
"path": "/src/svlog/hir/mod.rs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: luccasmmg/noodles path: /noodles-sam/src/header/header.rs
//! SAM header header and fields.
//!
//! The namespace of this module is intentionally awkward to disambiguate a SAM header
//! ([`crate::Header`]) and a header record ([`crate::header::header::Header`]).
mod builder;
pub mod group_orde... | code_fim | hard | {
"lang": "rust",
"repo": "luccasmmg/noodles",
"path": "/noodles-sam/src/header/header.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> match self {
Self::InvalidRecord => f.write_str("invalid record"),
Self::MissingRequiredTag(tag) => write!(f, "missing required tag: {:?}", tag),
Self::InvalidTag(e) => write!(f, "invalid tag: {}", e),
Self::InvalidVersion(e) => write!(f, "invalid ve... | code_fim | hard | {
"lang": "rust",
"repo": "luccasmmg/noodles",
"path": "/noodles-sam/src/header/header.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> /// Returns a mutable reference to the format version.
///
/// # Examples
///
/// ```
/// use noodles_sam::header::header::{Header, Version};
///
/// let mut header = Header::new(Version::new(1, 6));
/// assert_eq!(header.version(), Version::new(1, 6));
///
/// ... | code_fim | hard | {
"lang": "rust",
"repo": "luccasmmg/noodles",
"path": "/noodles-sam/src/header/header.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: wezm/crossterm path: /crossterm_style/src/styledobject.rs
//! This module contains the logic to style an object that contains some 'content' which can be styled.
use super::{color, Color, ObjectStyle};
//use Screen;
use crossterm_utils::{Result, TerminalOutput};
use std::fmt::{self, Display, Fo... | code_fim | hard | {
"lang": "rust",
"repo": "wezm/crossterm",
"path": "/crossterm_style/src/styledobject.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for attr in self.object_style.attrs.iter() {
write!(f, "{}", format!(csi!("{}m"), *attr as i16))?;
reset = true;
}
fmt::Display::fmt(&self.content, f)?;
std::io::stdout().flush().unwrap();
if reset {
colored_terminal.reset().unw... | code_fim | hard | {
"lang": "rust",
"repo": "wezm/crossterm",
"path": "/crossterm_style/src/styledobject.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fmt::Display::fmt(&self.content, f)?;
std::io::stdout().flush().unwrap();
if reset {
colored_terminal.reset().unwrap();
std::io::stdout().flush().unwrap();
}
Ok(())
}
}
impl<D: Display> Colorize<D> for StyledObject<D> {
// foregrou... | code_fim | hard | {
"lang": "rust",
"repo": "wezm/crossterm",
"path": "/crossterm_style/src/styledobject.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: PiDelport/twilio-oai-rust path: /twilio-oai-flex-v1/src/models/mod.rs
pub mod flex_v1_channel;
pub use self::flex_v1_channel::FlexV1Channel;
pub mod flex_v1_configuration;
pub use self::flex_v1_configuration::FlexV1Configuration;
pub mod flex_v1<|fim_suffix|>_flow_response;
pub use self::list_fl... | code_fim | hard | {
"lang": "rust",
"repo": "PiDelport/twilio-oai-rust",
"path": "/twilio-oai-flex-v1/src/models/mod.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>_flow_response;
pub use self::list_flex_flow_response::ListFlexFlowResponse;
pub mod list_web_channel_response;
pub use self::list_web_channel_response::ListWebChannelResponse;<|fim_prefix|>// repo: PiDelport/twilio-oai-rust path: /twilio-oai-flex-v1/src/models/mod.rs
pub mod flex_v1_channel;
pub use sel... | code_fim | hard | {
"lang": "rust",
"repo": "PiDelport/twilio-oai-rust",
"path": "/twilio-oai-flex-v1/src/models/mod.rs",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> let get_route = AppRouter::render(|switch: PublicUrlSwitch| match switch.route() {
AppRoute::Connect4 => html! {<Connect4Board />},
AppRoute::Login => html! {<LoginPage/>},
AppRoute::Stats => html! {<Stats />},
AppRoute::TootAndOtto => html! {<TootAndOttoBoard />},
AppRoute::Home => html!... | code_fim | hard | {
"lang": "rust",
"repo": "blchelle/board-games",
"path": "/client/src/app.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fn view(&self) -> Html {
let get_route = AppRouter::render(|switch: PublicUrlSwitch| match switch.route() {
AppRoute::Connect4 => html! {<Connect4Board />},
AppRoute::Login => html! {<LoginPage/>},
AppRoute::Stats => html! {<Stats />},
AppRoute::TootAndOtto => html! {<TootAndOttoBoard />},
... | code_fim | hard | {
"lang": "rust",
"repo": "blchelle/board-games",
"path": "/client/src/app.rs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: blchelle/board-games path: /client/src/app.rs
use crate::{
components::{
connect4_board::Connect4Board, login::LoginPage, navbar::NavBar, stats::Stats,
toot_and_otto_board::TootAndOttoBoard,
},
switch::{AppRoute, AppRouter, PublicUrlSwitch},
};
use yew::prelude::*;
pub struct App {}
pub... | code_fim | medium | {
"lang": "rust",
"repo": "blchelle/board-games",
"path": "/client/src/app.rs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|>// repo: surgura/RustTetris path: /src/interpolate.rs
use vector::{ V2f32 };
#[derive(Copy)]
#[derive(Clone)]
pub struct InterpolateData {
time_left: f32, // seconds left before interpolation should end
goal: V2f32 // interpolation target
}
<|fim_suffix|>pub fn set_goal(interpolate_data: &mut I... | code_fim | hard | {
"lang": "rust",
"repo": "surgura/RustTetris",
"path": "/src/interpolate.rs",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.