text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: cedric-h/sqlx path: /sqlx-core/src/mssql/options/parse.rs use crate::error::Error; use crate::mssql::MssqlConnectOptions; use std::str::FromStr; use url::Url; impl FromStr for MssqlConnectOptions { type Err = Error; fn from_str(s: &str) -> Result<Self, Self::Err> { <|fim_suffix|> ...
code_fim
medium
{ "lang": "rust", "repo": "cedric-h/sqlx", "path": "/sqlx-core/src/mssql/options/parse.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let username = url.username(); if !username.is_empty() { options = options.username(username); } if let Some(password) = url.password() { options = options.password(password); } let path = url.path().trim_start_matches('/'); ...
code_fim
hard
{ "lang": "rust", "repo": "cedric-h/sqlx", "path": "/sqlx-core/src/mssql/options/parse.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: facebook/hhvm path: /hphp/hack/src/oxidized_by_ref/gen/mod.rs // Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<9f072f8c3bcc6d2b481c...
code_fim
hard
{ "lang": "rust", "repo": "facebook/hhvm", "path": "/hphp/hack/src/oxidized_by_ref/gen/mod.rs", "mode": "psm", "license": "PHP-3.01", "source": "the-stack-v2" }
<|fim_suffix|> pub mod pos_or_decl; pub mod prim_defs; pub mod saved_state_rollouts; pub mod scoured_comments; pub mod shallow_decl_defs; pub mod typing_defs; pub mod typing_defs_core; pub mod typing_reason; pub mod validation_err; pub mod xhp_attribute;<|fim_prefix|>// repo: facebook/hhvm path: /hphp/hack/src/oxidize...
code_fim
hard
{ "lang": "rust", "repo": "facebook/hhvm", "path": "/hphp/hack/src/oxidized_by_ref/gen/mod.rs", "mode": "spm", "license": "PHP-3.01", "source": "the-stack-v2" }
<|fim_suffix|> 1276\n\ 735\n\ 1716\n\ 1915\n\ 1675\n\ 1126\n\ 1830\n\ 1227\n\ 1299\n\ ...
code_fim
hard
{ "lang": "rust", "repo": "SimY4/advent-of-code-rust", "path": "/src/y2020/day1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SimY4/advent-of-code-rust path: /src/y2020/day1.rs pub fn solve(input: &str) -> Option<i32> { input .lines() .map(|line| line.parse::<i32>().unwrap()) .filter_map(|x| { input .lines() .map(|line| line.parse::<i32>().unwrap()...
code_fim
hard
{ "lang": "rust", "repo": "SimY4/advent-of-code-rust", "path": "/src/y2020/day1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kitlith/rseq_rs path: /src/bin/tempo.rs use rseq_rs::{container, instructions::{OptionalInst, Instruction, U16Parameters}, CookieFile}; use structopt::StructOpt; use std::path::PathBuf; use std::fs::File; use std::error::Error; use std::io::Read; use nom::combinator::cut; use nom::number::Endian...
code_fim
hard
{ "lang": "rust", "repo": "kitlith/rseq_rs", "path": "/src/bin/tempo.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn set_tempo(&mut self, value: u16) -> Option<u16> { // TODO: convert error to the new tempo if needed? let old_current = self.current; self.current = Some(value); old_current } } fn main() -> Result<(), Box<dyn Error>> { let Options { input, output, target } =...
code_fim
hard
{ "lang": "rust", "repo": "kitlith/rseq_rs", "path": "/src/bin/tempo.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match find_crate::find_crate(|name| name == "palette") { Ok(package) => Ident::new(&package.name, Span::call_site()), Err(Error::NotFound) => Ident::new("palette", Span::call_site()), Err(error) => panic!( "error when trying to find the name of the `palette` crate: ...
code_fim
hard
{ "lang": "rust", "repo": "Ogeon/palette", "path": "/palette_derive/src/util.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Ogeon/palette path: /palette_derive/src/util.rs use proc_macro2::{Span, TokenStream}; use quote::quote; use syn::{parse_quote, Ident, Type}; pub fn path<'a, P: AsRef<[&'a str]>>(path: P, internal: bool) -> TokenStream { let path = path .as_ref() .iter() .map(|&ident|...
code_fim
hard
{ "lang": "rust", "repo": "Ogeon/palette", "path": "/palette_derive/src/util.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> } fn listen_string(&self) -> String { return format!("{}:{}", self.listen_address, self.port) } fn handle(&mut self, stream: TcpStream) { let arc_stream = Arc::new(stream); self.pool.execute(move || { let mut handler = RequestHandler { stre...
code_fim
hard
{ "lang": "rust", "repo": "rehan-jaffer/rust-http-server", "path": "/src/server.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rehan-jaffer/rust-http-server path: /src/server.rs use std::net::TcpListener; use std::net::TcpStream; use threadpool::ThreadPool; use std::sync::{Arc}; mod debugger; mod plugins; use super::linescodec; pub struct Server<'a> { pub listen_address: &'a str, pub port: u32, pub debug_mode: ...
code_fim
hard
{ "lang": "rust", "repo": "rehan-jaffer/rust-http-server", "path": "/src/server.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn write_data(&mut self, address: u16, value: u8) { match address { 0x0000..=0x1FFF => { // The RAM. Currently (with the NRAM mapper), this is the only memory space where // we allow writes. Mirrored every 0x0800 bytes. let offset...
code_fim
hard
{ "lang": "rust", "repo": "lordy1992/REMulator", "path": "/src/address_space.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lordy1992/REMulator path: /src/address_space.rs use crate::cartridge::Cartridge; use std::fmt::Formatter; const RAM_SIZE: usize = 0x0800; pub struct AddressSpace<'a> { cartridge: &'a Cartridge, ram: [u8; RAM_SIZE] } impl<'a> std::fmt::Debug for AddressSpace<'a> { fn fmt(&self, f: ...
code_fim
hard
{ "lang": "rust", "repo": "lordy1992/REMulator", "path": "/src/address_space.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> (low_byte as u16) | ((high_byte as u16) << 8) } pub fn read_u16_zero_page(&self, address: u8) -> u16 { let low_byte = self.read_data_u8(address as u16); let high_byte = self.read_data_u8(address.wrapping_add(1) as u16); (low_byte as u16) | ((high_byte as u16) << 8...
code_fim
hard
{ "lang": "rust", "repo": "lordy1992/REMulator", "path": "/src/address_space.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] pub enum OvenTempUnit { C, F, } #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] pub struct Book { pub authors: Option<Vec<String>>, pub title: String, pub isbn: Option<String>, pub notes: Option<Vec<String>>, }<...
code_fim
hard
{ "lang": "rust", "repo": "xneomac/oikos", "path": "/src/rust/open_recipe_format/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xneomac/oikos path: /src/rust/open_recipe_format/src/lib.rs mod ingredient; mod yields; use anyhow::Result; pub use ingredient::*; use serde::{Deserialize, Serialize}; pub use yields::*; #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] pub struct OpenRecipe { pub recipe_name: Str...
code_fim
hard
{ "lang": "rust", "repo": "xneomac/oikos", "path": "/src/rust/open_recipe_format/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] pub struct OpenRecipeStep { pub step: String, pub notes: Option<Vec<String>>, pub haccp: Option<Haccp>, } #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] pub struct Haccp { pub control_point: Option<String>, pub cri...
code_fim
medium
{ "lang": "rust", "repo": "xneomac/oikos", "path": "/src/rust/open_recipe_format/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Implement this for any error type you'd like to return, so that we know how /// to respond to the user/battlesnake server when something goes wrong. pub trait IntoResponse { fn into_response(self) -> Response<Body>; } impl IntoResponse for anyhow::Error { fn into_response(self) -> Response<Bo...
code_fim
medium
{ "lang": "rust", "repo": "jsdw/battlesnake", "path": "/src/http_server.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jsdw/battlesnake path: /src/http_server.rs use hyper::{Body, Request, Response, server::{ Server, conn::AddrStream }}; use std::future::Future; use std::net::SocketAddr; use std::convert::Infallible; pub struct Opts<H, ErrF> { pub addr: SocketAddr, pub handler: H, pub on_error: ErrF...
code_fim
hard
{ "lang": "rust", "repo": "jsdw/battlesnake", "path": "/src/http_server.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub trait Texture: Send + Sync { // (u,v) for 2d texture, p for 3d texture fn value(&self, uv: &Vec2, p: &Vec3) -> Vec3; }<|fim_prefix|>// repo: tttmmmyyyy/ray path: /src/texture.rs pub mod checker; pub mod constant; pub mod image; pub mod noise; <|fim_middle|>use crate::aliases::{Vec2, Vec3};
code_fim
easy
{ "lang": "rust", "repo": "tttmmmyyyy/ray", "path": "/src/texture.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tttmmmyyyy/ray path: /src/texture.rs pub mod checker; pub mod constant; pub mod image; pub mod noise; <|fim_suffix|>pub trait Texture: Send + Sync { // (u,v) for 2d texture, p for 3d texture fn value(&self, uv: &Vec2, p: &Vec3) -> Vec3; }<|fim_middle|>use crate::aliases::{Vec2, Vec3};
code_fim
easy
{ "lang": "rust", "repo": "tttmmmyyyy/ray", "path": "/src/texture.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn vtx_pts(&self, transform: &Transform3f) -> Vec<Point3f> { let sq = Square::new(self.side_len); let mut vertices = vec![]; for tr in &self.transforms { vertices.extend(sq.vtx_pts(&(transform * tr))); } vertices } fn aabb(&self, transform: ...
code_fim
hard
{ "lang": "rust", "repo": "happydpc/minecrust", "path": "/src/geometry/unitcube.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn aabb(&self, transform: &Transform3f) -> Aabb { Aabb::new( transform.translation(), Vector3f::new( self.side_len / 2.0, self.side_len / 2.0, self.side_len / 2.0, ), ) } }<|fim_prefix|>// repo: hap...
code_fim
hard
{ "lang": "rust", "repo": "happydpc/minecrust", "path": "/src/geometry/unitcube.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: happydpc/minecrust path: /src/geometry/unitcube.rs use crate::na::{Isometry, Rotation3, Translation3}; use crate::{ geometry::{square::Square, Aabb, PrimitiveGeometry}, types::prelude::*, vulkan::Vertex3f, }; use alga::general::SubsetOf; use std::f32::consts::{FRAC_PI_2, PI}; #[deri...
code_fim
hard
{ "lang": "rust", "repo": "happydpc/minecrust", "path": "/src/geometry/unitcube.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.partitions } fn get_partition(&self, key: &dyn Any) -> usize { let key = key.downcast_ref::<K>().unwrap(); hash(key) as usize % self.partitions } } #[cfg(test)] mod tests { use super::*; #[test] fn hash_partition() { let data = vec![1, 2]; ...
code_fim
hard
{ "lang": "rust", "repo": "lumost/native_spark", "path": "/src/partitioner.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; #[test] fn hash_partition() { let data = vec![1, 2]; let num_partition = 3; let hash_partitioner = HashPartitioner::<i32>::new(num_partition); for i in &data { println!("value: {:?}-hash: {:?}", i, hash(i)); ...
code_fim
hard
{ "lang": "rust", "repo": "lumost/native_spark", "path": "/src/partitioner.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lumost/native_spark path: /src/partitioner.rs use crate::serializable_traits::Data; use downcast_rs::Downcast; use fasthash::MetroHasher; use serde_derive::{Deserialize, Serialize}; use serde_traitobject::{Deserialize, Serialize}; use std::any::Any; use std::hash::{Hash, Hasher}; use std::marker...
code_fim
hard
{ "lang": "rust", "repo": "lumost/native_spark", "path": "/src/partitioner.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> App::build().add_plugin(EditorPlugin::new(config)).run(); Ok(()) }<|fim_prefix|>// repo: WNiels/feldspar-editor path: /src/bin/editor.rs use feldspar_editor::{Config, EditorPlugin}; use bevy::app::prelude::*; fn main() -> Result<(), ron::Error> { env_logger::Builder::from_default_env() ...
code_fim
easy
{ "lang": "rust", "repo": "WNiels/feldspar-editor", "path": "/src/bin/editor.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: WNiels/feldspar-editor path: /src/bin/editor.rs use feldspar_editor::{Config, EditorPlugin}; use bevy::app::prelude::*; fn main() -> Result<(), ron::Error> { env_logger::Builder::from_default_env() // Filter out some noisy crates .filter(Some("gfx_backend_metal"), log::Leve...
code_fim
easy
{ "lang": "rust", "repo": "WNiels/feldspar-editor", "path": "/src/bin/editor.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: KeAiMianYang/work_repo_training path: /Rust/book/15_01_smart-pointers/smart-pointers/src/bin/drop_impl.rs fn main() { basic_drop(); early_drop(); } use std::ops::Drop; struct MySmartPointer { data: String,} <|fim_suffix|> fn basic_drop() { let c = MySmartPointer { data: String::fr...
code_fim
medium
{ "lang": "rust", "repo": "KeAiMianYang/work_repo_training", "path": "/Rust/book/15_01_smart-pointers/smart-pointers/src/bin/drop_impl.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let c = MySmartPointer { data: String::from("foo") }; let d = MySmartPointer { data: String::from("bar") }; println!("MySmartPointer created"); } fn early_drop() { let c = MySmartPointer { data: String::from("some data") }; println!("MySmartPointer created"); // can't call c.drop...
code_fim
medium
{ "lang": "rust", "repo": "KeAiMianYang/work_repo_training", "path": "/Rust/book/15_01_smart-pointers/smart-pointers/src/bin/drop_impl.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("MySmartPointer created"); } fn early_drop() { let c = MySmartPointer { data: String::from("some data") }; println!("MySmartPointer created"); // can't call c.drop() directly because Rust would still try to drop it when out of scope // so we use std::mem::drop(), who is in th...
code_fim
medium
{ "lang": "rust", "repo": "KeAiMianYang/work_repo_training", "path": "/Rust/book/15_01_smart-pointers/smart-pointers/src/bin/drop_impl.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: johnmave126/sensor-pollster path: /src/sink/mod.rs mod console; mod file; mod postgres; use anyhow::Context; use async_trait::async_trait; use serde::{Deserialize, Serialize}; <|fim_suffix|>#[async_trait] pub trait Sink: Send + Sync { async fn update(&mut self, message: &UpdateMessage) -> ...
code_fim
medium
{ "lang": "rust", "repo": "johnmave126/sensor-pollster", "path": "/src/sink/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, Clone, Deserialize, Serialize)] pub enum SinkConfig { Console, Postgres(postgres::Config), File(file::Config), } impl SinkConfig { pub async fn into_sink(self) -> anyhow::Result<Box<dyn Sink>> { match self { SinkConfig::Console => Ok(Box::new(console::C...
code_fim
medium
{ "lang": "rust", "repo": "johnmave126/sensor-pollster", "path": "/src/sink/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Ryutaro95/rust-todo path: /src/domain/repository/user.rs use super::super::TodoEntry; <|fim_suffix|> fn delete(&self, todo: TodoEntry) -> Result<()>; }<|fim_middle|>pub trait TodoRepository { fn add(&self, todo: TodoEntry) -> Result<()>;
code_fim
medium
{ "lang": "rust", "repo": "Ryutaro95/rust-todo", "path": "/src/domain/repository/user.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn delete(&self, todo: TodoEntry) -> Result<()>; }<|fim_prefix|>// repo: Ryutaro95/rust-todo path: /src/domain/repository/user.rs use super::super::TodoEntry; <|fim_middle|>pub trait TodoRepository { fn add(&self, todo: TodoEntry) -> Result<()>;
code_fim
medium
{ "lang": "rust", "repo": "Ryutaro95/rust-todo", "path": "/src/domain/repository/user.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: COSI-Lab/rust-talks path: /src/db.rs use diesel::{Connection, QueryDsl, RunQueryDsl, SqliteConnection, Table, r2d2::{ConnectionManager, PooledConnection}, result::Error}; use crate::{error::AppError, model::{CreateTalk, Talk}}; use crate::diesel::ExpressionMethods; pub type PooledSqlite = Pool...
code_fim
hard
{ "lang": "rust", "repo": "COSI-Lab/rust-talks", "path": "/src/db.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[allow(dead_code)] pub fn unhide_talk(&self, talk_id: i32) -> Result<usize, AppError> { use super::schema::talks::dsl::*; let talk = talks.find(talk_id); diesel::update(talk) .set(is_visible.eq(true)) .execute(&self.connection) .map_err...
code_fim
hard
{ "lang": "rust", "repo": "COSI-Lab/rust-talks", "path": "/src/db.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.connection.transaction::<i32, _, _>(|| { let id = diesel::insert_into(talks::table) .values(&talk) .execute(&self.connection) .map(|_| last_insert_rowid(&self.connection)); match id { Ok(id) => { Ok(id) ...
code_fim
hard
{ "lang": "rust", "repo": "COSI-Lab/rust-talks", "path": "/src/db.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ia7ck/competitive-programming path: /AtCoder/abc225/src/bin/b/main.rs use input_i_scanner::{scan_with, InputIScanner}; <|fim_suffix|> let n = scan_with!(_i_i, usize); let mut deg = vec![0; n]; for _ in 0..(n - 1) { let (a, b) = scan_with!(_i_i, (usize, usize)); deg[a ...
code_fim
medium
{ "lang": "rust", "repo": "ia7ck/competitive-programming", "path": "/AtCoder/abc225/src/bin/b/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let n = scan_with!(_i_i, usize); let mut deg = vec![0; n]; for _ in 0..(n - 1) { let (a, b) = scan_with!(_i_i, (usize, usize)); deg[a - 1] += 1; deg[b - 1] += 1; } if deg.contains(&(n - 1)) { println!("Yes"); } else { println!("No"); } }<...
code_fim
medium
{ "lang": "rust", "repo": "ia7ck/competitive-programming", "path": "/AtCoder/abc225/src/bin/b/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// turn micro vs standard into a boolean pub fn is_micro(self) -> bool { match self { Size::Micro(_) => true, Size::Standard(_) => false } } } //------------------------------------------------------------------------------------------------- #[derive...
code_fim
hard
{ "lang": "rust", "repo": "j4ncp/qr-gen", "path": "/src/config.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: j4ncp/qr-gen path: /src/config.rs /// Contains enums and structs that will also be exported as the public /// API of this crate. use itertools::Itertools; use std::cmp::{Ordering, PartialOrd}; //------------------------------------------------------------------------------------------------- #...
code_fim
hard
{ "lang": "rust", "repo": "j4ncp/qr-gen", "path": "/src/config.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Size { /// Convert a simple string description into a fitting enum /// value by parsing it. micro symbols are described as "M1" /// through "M4", the standard ones just by their size index, e.g. "6". pub fn from_str(decl: &str) -> Size { if decl.starts_with("M") { ...
code_fim
hard
{ "lang": "rust", "repo": "j4ncp/qr-gen", "path": "/src/config.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: neuroradiology/drdns path: /src/case.rs //! `case.rs`: case comparison utilities //! //! These should probably be replaced with functionality from the //! Rust standard library pub unsafe fn diffb(mut s: *const u8, mut len: u32, mut t: *const u8) -> i32 { let current_block; let mut x: u...
code_fim
hard
{ "lang": "rust", "repo": "neuroradiology/drdns", "path": "/src/case.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub unsafe fn lowerb(mut s: *mut u8, mut len: u32) { let mut x: u8; 'loop1: loop { if !(len > 0u32) { break; } len = len.wrapping_sub(1u32); x = (*s as (i32) - b'A' as (i32)) as (u8); if x as (i32) <= b'Z' as (i32) - b'A' as (i32) { *...
code_fim
hard
{ "lang": "rust", "repo": "neuroradiology/drdns", "path": "/src/case.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.should_delete = should_delete } fn get_object_type(&self) -> ObjectType { ObjectType::Enemy } } impl Renderable for Enemy { fn get_renderable_object(&self) -> &RenderableObject { &self.renderable_object } fn is_visible(&self) -> bool { self.i...
code_fim
hard
{ "lang": "rust", "repo": "GamesFromRust/piston_shooty", "path": "/src/enemy.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: GamesFromRust/piston_shooty path: /src/enemy.rs use crate::collidable::Collidable; use crate::collidable_object::CollidableObject; use crate::game_object::GameObject; use crate::object_type::ObjectType; use crate::renderable::Renderable; use crate::renderable_object::RenderableObject; use crate:...
code_fim
hard
{ "lang": "rust", "repo": "GamesFromRust/piston_shooty", "path": "/src/enemy.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &self.renderable_object } fn is_visible(&self) -> bool { self.is_visible } } impl Collidable for Enemy { fn get_collidable_object(&self) -> &CollidableObject { &self.collidable_object } fn collide(&mut self, other_object_type: ObjectType) { match ...
code_fim
hard
{ "lang": "rust", "repo": "GamesFromRust/piston_shooty", "path": "/src/enemy.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> format!("{}, by {} ({})", self.headline, self.author, self.location) } } impl OtherSummary for NewsArticle { fn summarize_author(&self) -> String { format!("@{}", self.author) } } pub struct Tweet { pub username: String, pub content: String, pub reply: ...
code_fim
hard
{ "lang": "rust", "repo": "markanesko/rust_book", "path": "/traits/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { println!("Hello, world!"); let tweet = Tweet { username: String::from("horse_ebooks"), content: String::from("my long ass tweet"), reply: false, retweet: false, }; println!("summarization of tweet is {}", tweet.summarize()); let article = ...
code_fim
hard
{ "lang": "rust", "repo": "markanesko/rust_book", "path": "/traits/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: markanesko/rust_book path: /traits/src/main.rs #![allow(unused)] pub trait Summary { fn summarize(&self) -> String { String::from("More about that later") // default behavior } } pub trait OtherSummary { fn summarize_author(&self) -> String; fn summarize_other (&sel...
code_fim
hard
{ "lang": "rust", "repo": "markanesko/rust_book", "path": "/traits/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>extern "C" fn open_urls(_this: &Object, _: Sel, app: id, urls: id) { trace!("Triggered `application:openUrls:`"); use cocoa::foundation::NSFastEnumeration; let mut url_strings: Vec<String> = Vec::new(); for url in unsafe { urls.iter() } { use cocoa::foundation::NSString; u...
code_fim
hard
{ "lang": "rust", "repo": "Tryweirder/winit", "path": "/src/platform_impl/macos/app_delegate.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Tryweirder/winit path: /src/platform_impl/macos/app_delegate.rs use super::{activation_hack, app_state::AppState}; use cocoa::base::id; use objc::{ declare::ClassDecl, runtime::{Class, Object, Sel}, }; use std::os::raw::c_void; use crate::platform_impl::platform::event::EventWrapper; use...
code_fim
hard
{ "lang": "rust", "repo": "Tryweirder/winit", "path": "/src/platform_impl/macos/app_delegate.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> context: &mut ServerContext, params: ReferenceParams, ) -> Option<Vec<lsp_types::Location>> { let (uri, location) = convert::from_lsp::position_params(params.text_document_position); let location = context.server.location(&uri, location)?; let usage = context.se...
code_fim
medium
{ "lang": "rust", "repo": "loalang/loalang", "path": "/src/bin/server_handler/handlers/references.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: loalang/loalang path: /src/bin/server_handler/handlers/references.rs use crate::server_handler::*; pub struct ReferencesRequestHandler; impl RequestHandler for ReferencesRequestHandler { type R = request::References; <|fim_suffix|> context: &mut ServerContext, params: Refere...
code_fim
medium
{ "lang": "rust", "repo": "loalang/loalang", "path": "/src/bin/server_handler/handlers/references.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> use crate::tokenizer::simple_tokenizer_factory::SimpleTokenizerFactory; #[test] fn test_simple_tokenizer() { let factory = SimpleTokenizerFactory::new(); let tokenizer = factory.create(); let mut stream = tokenizer.token_stream("hello world!"); { l...
code_fim
medium
{ "lang": "rust", "repo": "klausondrag/bayard", "path": "/src/tokenizer/simple_tokenizer_factory.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use tantivy::tokenizer::Tokenizer; use crate::tokenizer::simple_tokenizer_factory::SimpleTokenizerFactory; #[test] fn test_simple_tokenizer() { let factory = SimpleTokenizerFactory::new(); let tokenizer = factory.create(); let mut stream ...
code_fim
medium
{ "lang": "rust", "repo": "klausondrag/bayard", "path": "/src/tokenizer/simple_tokenizer_factory.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: klausondrag/bayard path: /src/tokenizer/simple_tokenizer_factory.rs use tantivy::tokenizer::SimpleTokenizer; #[derive(Clone)] pub struct SimpleTokenizerFactory {} impl SimpleTokenizerFactory { pub fn new() -> Self { SimpleTokenizerFactory {} } <|fim_suffix|> #[test] fn ...
code_fim
hard
{ "lang": "rust", "repo": "klausondrag/bayard", "path": "/src/tokenizer/simple_tokenizer_factory.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut bytes = vec![]; bytes.write_u32::<LittleEndian>(signature).unwrap(); let result = read_file_type(&mut &bytes[..]); match result { Err(Error::InvalidSignature(s)) => assert_eq!(s, signature), _ => panic!("Invalid result: {:#?}", result), ...
code_fim
hard
{ "lang": "rust", "repo": "matt-thomson/keepass-rust", "path": "/src/signature.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matt-thomson/keepass-rust path: /src/signature.rs use bytes; use {Error, FileType}; use std::io::Read; const SIGNATURE_FILE: u32 = 0x9AA2D903; const SIGNATURE_KEEPASS1: u32 = 0xB54BFB65; const SIGNATURE_KEEPASS2_PRE_RELEASE: u32 = 0xB54BFB66; const SIGNATURE_KEEPASS2: u32 = 0xB54BFB67; pub fn...
code_fim
hard
{ "lang": "rust", "repo": "matt-thomson/keepass-rust", "path": "/src/signature.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[cfg(feature = "native-rpc")] stack.push(native::interface::server(socket_sender, stage_send, db)); stack }<|fim_prefix|>// repo: pombredanne/cauchy path: /cauchy-rpc/src/lib.rs pub mod native; use std::net::SocketAddr; use bytes::Bytes; use futures::{sync::mpsc::Sender, Future}; use toki...
code_fim
hard
{ "lang": "rust", "repo": "pombredanne/cauchy", "path": "/cauchy-rpc/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pombredanne/cauchy path: /cauchy-rpc/src/lib.rs pub mod native; use std::net::SocketAddr; use bytes::Bytes; use futures::{sync::mpsc::Sender, Future}; use tokio::net::TcpStream; use core::{ daemon::{Origin, Priority}, db::mongodb::MongoDB, primitives::{transaction::Transaction, tx...
code_fim
hard
{ "lang": "rust", "repo": "pombredanne/cauchy", "path": "/cauchy-rpc/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fncnt/rsmpi path: /examples/immediate_reduce.rs #![deny(warnings)] #![allow(clippy::needless_pass_by_value)] extern crate mpi; use std::os::raw::{c_int, c_void}; #[cfg(feature = "user-operations")] use mpi::collective::UserOperation; use mpi::collective::{SystemOperation, UnsafeUserOperation};...
code_fim
hard
{ "lang": "rust", "repo": "fncnt/rsmpi", "path": "/examples/immediate_reduce.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: saethlin/loadtxt path: /src/inner.rs use std::fs::File; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use lexical_core::FromLexical; #[derive(Default, Clone)] pub struct Chunk<T> { pub data: Vec<T>, pub rows: usize, } pub fn loadtxt<T: FromLexical + Default + Copy...
code_fim
hard
{ "lang": "rust", "repo": "saethlin/loadtxt", "path": "/src/inner.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>where T: FromLexical, { line.split(u8::is_ascii_whitespace) .filter(|s| !s.is_empty()) .try_fold(0, |count_parsed, word| { lexical_core::parse(word) .map(|item| { parsed.push(item); count_parsed + 1 ...
code_fim
hard
{ "lang": "rust", "repo": "saethlin/loadtxt", "path": "/src/inner.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let columns_this_row = parse_line_usecols(line, usecols, parsed)?; if columns_this_row != usecols.len() { if usecols.len() == 1 { return Err(format!( "Expected 1 column, \ but found {} when parsing \"{}\"", ...
code_fim
hard
{ "lang": "rust", "repo": "saethlin/loadtxt", "path": "/src/inner.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Input 'main: loop { let ch = wget_wch(stdscr()); match ch { Some(WchResult::KeyCode(KEY_MOUSE)) => { // Get stdscr coords let mut mevent = new_mevent(); let err_code = getmouse(&mut mevent); if err_code ...
code_fim
hard
{ "lang": "rust", "repo": "dwn25/Checkers", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Create captured window let captured_win = create_win(CAPTURE_H, CAPTURE_W, CAPTURE_POS.0, CAPTURE_POS.1); draw_captured(captured_win, &game.board); refresh(); // Input 'main: loop { let ch = wget_wch(stdscr()); match ch { Some(WchResult::KeyCode(KEY...
code_fim
hard
{ "lang": "rust", "repo": "dwn25/Checkers", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dwn25/Checkers path: /src/main.rs pub mod board; pub mod game; pub mod moves; pub mod networking; pub mod piece; pub mod player; #[macro_use] extern crate serde_derive; extern crate docopt; extern crate bincode; use docopt::Docopt; use networking::{client, server}; const USAGE: &'static str =...
code_fim
hard
{ "lang": "rust", "repo": "dwn25/Checkers", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wisest30/AlgoStudy path: /source/KickStart/2022_Round_D_1_Image_Labeler/hyo.rs use std::io::{stdin, Read}; fn main() { let mut stdin = stdin(); let mut buf = String::new(); stdin.read_to_string(&mut buf).unwrap(); <|fim_suffix|> ans += if v.len() % 2 == 0 { (v[v...
code_fim
hard
{ "lang": "rust", "repo": "wisest30/AlgoStudy", "path": "/source/KickStart/2022_Round_D_1_Image_Labeler/hyo.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut ans = 0.0; for _ in 0..m - 1 { ans += v.pop().unwrap() as f64; } ans += if v.len() % 2 == 0 { (v[v.len() / 2 - 1] + v[v.len() / 2]) as f64 / 2.0 } else { v[v.len() / 2] as f64 }; println!("Case #{}: {:.1}...
code_fim
hard
{ "lang": "rust", "repo": "wisest30/AlgoStudy", "path": "/source/KickStart/2022_Round_D_1_Image_Labeler/hyo.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: baitcenter/arete path: /src/graphql/query.rs use super::super::env::VERSION; use super::context::Context; pub struct Root; <|fim_suffix|> VERSION } }<|fim_middle|>#[juniper::object( Context = Context, )] impl Root { fn apiVersion(context: &Context) -> &str {
code_fim
medium
{ "lang": "rust", "repo": "baitcenter/arete", "path": "/src/graphql/query.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[juniper::object( Context = Context, )] impl Root { fn apiVersion(context: &Context) -> &str { VERSION } }<|fim_prefix|>// repo: baitcenter/arete path: /src/graphql/query.rs use super::super::env::VERSION; use super::context::Context; <|fim_middle|>pub struct Root;
code_fim
easy
{ "lang": "rust", "repo": "baitcenter/arete", "path": "/src/graphql/query.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(ordering) = settings.atomic_counter_ordering { CALL_COUNTER.fetch_add(internal_call_count, ordering); } (1 + first_call_count.unwrap() + second_call_count, first_thread_count.unwrap() + second_thread_count) } pub fn divide_parallel_no_return(low: u32, high: u32, min_split...
code_fim
hard
{ "lang": "rust", "repo": "David-Thureson/rust-algorithms", "path": "/src/coord/between_threads.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: David-Thureson/rust-algorithms path: /src/coord/between_threads.rs ernal(low, mid, settings); } else { internal_call_count += 1; if settings.inline_fake_work { fake_work_inline_2(mid, high, settings.nsec_per_item); } else { fake_work_2(mid, hig...
code_fim
hard
{ "lang": "rust", "repo": "David-Thureson/rust-algorithms", "path": "/src/coord/between_threads.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: David-Thureson/rust-algorithms path: /src/coord/between_threads.rs + high) / 2; 1 + if mid - low >= min_split_size { divide_simple_defer_low(low, mid, min_split_size, nsec_per_item, inline_fake_work) } else if inline_fake_work { fake_work_inline(low, m...
code_fim
hard
{ "lang": "rust", "repo": "David-Thureson/rust-algorithms", "path": "/src/coord/between_threads.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl SimpleFactorGraph<ExpressionFactor> {}<|fim_prefix|>// repo: CoreRC/rtsam path: /src/inference/expression/factor_graph.rs use crate::inference::factor::*; use crate::inference::factor_graph::*; #[derive(Debug, Clone)] pub struct ExpressionFactor {} impl NonlinearFactor for ExpressionFactor {} imp...
code_fim
medium
{ "lang": "rust", "repo": "CoreRC/rtsam", "path": "/src/inference/expression/factor_graph.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CoreRC/rtsam path: /src/inference/expression/factor_graph.rs use crate::inference::factor::*; use crate::inference::factor_graph::*; #[derive(Debug, Clone)] pub struct ExpressionFactor {} impl NonlinearFactor for ExpressionFactor {} impl Factor for ExpressionFactor { fn num_keys(&self) ->...
code_fim
medium
{ "lang": "rust", "repo": "CoreRC/rtsam", "path": "/src/inference/expression/factor_graph.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/rg3d path: /src/scene/node.rs radius: 10.0, color: Color::white(), cone_angle: std::f32::consts::PI, cone_angle_cos: -1.0, } } } impl Visit for Light { fn visit(&mut self, name: &str, visitor: &mut Visitor) -> VisitResult { ...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/rg3d", "path": "/src/scene/node.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/rg3d path: /src/scene/node.rs t Light { radius: f32, color: Color, cone_angle: f32, cone_angle_cos: f32, } impl Default for Light { fn default() -> Light { Light { radius: 10.0, color: Color::white(), cone_angle: std::f32::...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/rg3d", "path": "/src/scene/node.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[inline] pub fn get_parent(&self) -> Handle<Node> { self.parent } #[inline] pub fn offset(&mut self, vec: Vec3) { self.local_position += vec; } #[inline] pub fn get_children(&self) -> &[Handle<Node>] { &self.children } #[inline] pub f...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/rg3d", "path": "/src/scene/node.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fossabot/luaasm path: /src/parser/constval.rs #![allow(dead_code)] use super::{num_f64, AstCheck}; use crate::writer::{WriteObj, Writer}; use nom::{ alt, call, delimited, error_node_position, error_position, escaped_transform, is_not, map, named, tag, tuple_parser, value, }; #[derive(S...
code_fim
hard
{ "lang": "rust", "repo": "fossabot/luaasm", "path": "/src/parser/constval.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let (_, res) = const_val("125.7\0").unwrap(); assert_eq!(res, ConstValue::Num(125.7)); } #[test] fn const_val_string() { let (_, res) = const_val("\"Hello world!\"\0").unwrap(); assert_eq!(res, ConstValue::Str("Hello world!".to_string())); } #[test] fn const_val_escape() { let (_, res)...
code_fim
hard
{ "lang": "rust", "repo": "fossabot/luaasm", "path": "/src/parser/constval.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn const_val_nil() { let (_, res) = const_val("nil").unwrap(); assert_eq!(res, ConstValue::Nil); } #[test] fn const_val_bool_true() { let (_, res) = const_val("true").unwrap(); assert_eq!(res, ConstValue::Bool(true)); } #[test] fn const_val_bool_false() { let (_, res) = const_v...
code_fim
hard
{ "lang": "rust", "repo": "fossabot/luaasm", "path": "/src/parser/constval.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>{ let mut ans = String::new(); ans.push(S.chars().next().unwrap()); for ch in S.chars().skip(1) { if ch >= ans.chars().next().unwrap() { ans.insert(0, ch); } else { ans.push(ch); } } ans }<|fim_prefix|>// repo: eric7237cire/rust-algori...
code_fim
medium
{ "lang": "rust", "repo": "eric7237cire/rust-algorithm-problems", "path": "/codejam_2016/src/y2016round1A/a.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: eric7237cire/rust-algorithm-problems path: /codejam_2016/src/y2016round1A/a.rs use codejam::util::codejam::run_cases; use std::io::Write; /* Greedy Lexographic order Easy */ pub fn solve_all_cases() { run_cases( &["A-small-practice", "A-large-practice"], "y2016round1A", ...
code_fim
hard
{ "lang": "rust", "repo": "eric7237cire/rust-algorithm-problems", "path": "/codejam_2016/src/y2016round1A/a.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ans.push(S.chars().next().unwrap()); for ch in S.chars().skip(1) { if ch >= ans.chars().next().unwrap() { ans.insert(0, ch); } else { ans.push(ch); } } ans }<|fim_prefix|>// repo: eric7237cire/rust-algorithm-problems path: /codejam_2016/sr...
code_fim
medium
{ "lang": "rust", "repo": "eric7237cire/rust-algorithm-problems", "path": "/codejam_2016/src/y2016round1A/a.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> type Result = Handle<A>; fn add_to_entity( &self, entity: Entity, system_data: &mut Self::SystemData, _: &[Entity], _: &[Entity], ) -> Result<Handle<A>, Error> { let handle = match *self { AssetPrefab::Handle(ref handle) => handle.cl...
code_fim
hard
{ "lang": "rust", "repo": "Ben-PH/treasure-client", "path": "/src/ametheed/assets/prefab.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Ben-PH/treasure-client path: /src/ametheed/assets/prefab.rs use crate::ametheed::assets::SerializableFormat; use crate::ametheed::assets::Format; use crate::ametheed::assets::loader::Loader; use crate::ametheed::assets::storage::AssetStorage; use specs::prelude::*; use crate::ametheed:: { er...
code_fim
hard
{ "lang": "rust", "repo": "Ben-PH/treasure-client", "path": "/src/ametheed/assets/prefab.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: EselDompteur/letsencrypt-inwx path: /src/cli.rs use crate::config::Config; use crate::dns::{check_txt_record, lookup_real_domain}; use crate::inwx::{Inwx, InwxError}; use clap::{App, Arg, SubCommand}; use std::fs::File; use std::io::BufReader; use std::thread::sleep; use std::time::{Duration, In...
code_fim
hard
{ "lang": "rust", "repo": "EselDompteur/letsencrypt-inwx", "path": "/src/cli.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if config.options.wait_interval > 0 { info!( "Waiting {} additional seconds...", &config.options.wait_interval ); sleep(Duration::from_secs(config.options.wait_interval)); info!("=> done!"); } Ok(()) } fn delete(config: &Config, domai...
code_fim
hard
{ "lang": "rust", "repo": "EselDompteur/letsencrypt-inwx", "path": "/src/cli.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn run() -> Result<(), ()> { let mut app = App::new("letsencrypt-inwx") .version(env!("CARGO_PKG_VERSION")) .about("A small cli utility for automating the letsencrypt dns-01 challenge for domains hosted by inwx") .subcommand(SubCommand::with_name("create") .abou...
code_fim
hard
{ "lang": "rust", "repo": "EselDompteur/letsencrypt-inwx", "path": "/src/cli.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: newpavlov/tnef path: /src/lib.rs //! A basic [TNEF] parser written in pure Rust. //! //! TNEF file contains a stream of records called "attributes". Using //! `TnefReader` you can read attributes stored in the provided TNEF buffer. //! At the moment we do not handle parsing of attribute data out...
code_fim
hard
{ "lang": "rust", "repo": "newpavlov/tnef", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a> RawAttachment<'a> { fn is_default(&self) -> bool { match self { RawAttachment { data: None, title: None, meta: None, create_date: None, modify_date: None, transport_filename: None, rend_data: None, props: None...
code_fim
hard
{ "lang": "rust", "repo": "newpavlov/tnef", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match raw { RawAttachment { title: Some(title), data: Some(data), create_date: Some(create_date), modify_date: Some(modify_date), rend_data: Some(rend_data), props: Some(props), ...
code_fim
hard
{ "lang": "rust", "repo": "newpavlov/tnef", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // UTC offset -21600, DST offset 0 is_dst: false, name: Cow::Borrowed("CST"), }), (1113112800, FixedTimespan { // 2005-04-10T06:00:00.000 UTC offset: -18000, // UTC offset -21600, DST offset 3600 is_dst: true, name: Cow::Bo...
code_fim
hard
{ "lang": "rust", "repo": "rust-datetime/zoneinfo-data", "path": "/src/data/America/Managua.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-datetime/zoneinfo-data path: /src/data/America/Managua.rs // ------ // This file is autogenerated! // Any changes you make may be overwritten. // ------ use std::borrow::Cow; use datetime::zone::{StaticTimeZone, FixedTimespanSet, FixedTimespan}; pub static ZONE: StaticTimeZone<'static> ...
code_fim
hard
{ "lang": "rust", "repo": "rust-datetime/zoneinfo-data", "path": "/src/data/America/Managua.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>e: Cow::Borrowed("CDT"), }), (330584400, FixedTimespan { // 1980-06-23T05:00:00.000 UTC offset: -21600, // UTC offset -21600, DST offset 0 is_dst: false, name: Cow::Borrowed("CST"), }), (694260000, FixedTimespan { // 1992-01-01T10:...
code_fim
hard
{ "lang": "rust", "repo": "rust-datetime/zoneinfo-data", "path": "/src/data/America/Managua.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }