text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: CasualX/adventofcode2018 path: /src/bin/day3.rs use std::{io, str, time}; use std::io::Read; fn main() { let stdin = io::stdin(); let mut input = String::new(); stdin.lock().read_to_string(&mut input).unwrap(); let mut claims = Vec::new(); for line in input.lines() { claims.push(line.par...
code_fim
hard
{ "lang": "rust", "repo": "CasualX/adventofcode2018", "path": "/src/bin/day3.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Orca-bit/DataStructureAndAlgorithm path: /src/string_problem/_132_palindrome_partition_2.rs struct Solution; impl Solution { pub fn min_cut(s: String) -> i32 { if s.is_empty() || s.len() == 1 { return 0; } let s = s.chars().collect::<Vec<_>>(); le...
code_fim
hard
{ "lang": "rust", "repo": "Orca-bit/DataStructureAndAlgorithm", "path": "/src/string_problem/_132_palindrome_partition_2.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn dp(s: String) -> i32 { if s.is_empty() || s.len() == 1 { return 0; } let s = s.chars().collect::<Vec<_>>(); let n = s.len(); let mut dp = vec![i32::MAX; n + 1]; dp[n] = -1; let mut is_palindrome = vec![vec![false; n]; n]; f...
code_fim
hard
{ "lang": "rust", "repo": "Orca-bit/DataStructureAndAlgorithm", "path": "/src/string_problem/_132_palindrome_partition_2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub trait MutHelper<T>: RefHelper<T> { fn as_mut(&mut self) -> &mut T; }<|fim_prefix|>// repo: willox/cerium-trifluoride path: /cef/src/include/internal/mod.rs mod cef_string; pub use cef_string::*; mod cef_string_list; pub use cef_string_list::*; mod cef_string_map; pub use cef_string_map::*; mod...
code_fim
medium
{ "lang": "rust", "repo": "willox/cerium-trifluoride", "path": "/cef/src/include/internal/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>} pub trait RefHelper<T> { fn as_ref(&self) -> &T; } pub trait MutHelper<T>: RefHelper<T> { fn as_mut(&mut self) -> &mut T; }<|fim_prefix|>// repo: willox/cerium-trifluoride path: /cef/src/include/internal/mod.rs mod cef_string; pub use cef_string::*; mod cef_string_list; pub use cef_string_li...
code_fim
hard
{ "lang": "rust", "repo": "willox/cerium-trifluoride", "path": "/cef/src/include/internal/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: willox/cerium-trifluoride path: /cef/src/include/internal/mod.rs mod cef_string; pub use cef_string::*; mod cef_string_list; pub use cef_string_list::*; mod cef_string_map; pub use cef_string_map::*; mod cef_string_multimap; pub use cef_string_multimap::*; mod cef_time; pub use cef_time::*; ...
code_fim
medium
{ "lang": "rust", "repo": "willox/cerium-trifluoride", "path": "/cef/src/include/internal/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>::UnOp::Neg(_) => Ok(val.neg()), _ => Err(crate::Error::UnsupportedDiscriminant(def.span())), } } expr => Err(crate::Error::UnsupportedDiscriminant(expr.span())), } }<|fim_prefix|>// repo: blackbeam/rust_mysql_common path: /derive/src/from_value/enums/misc....
code_fim
hard
{ "lang": "rust", "repo": "blackbeam/rust_mysql_common", "path": "/derive/src/from_value/enums/misc.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: blackbeam/rust_mysql_common path: /derive/src/from_value/enums/misc.rs use std::ops::Neg; use num_bigint::BigInt; use syn::spanned::Spanned; pub fn get_discriminant(def: &syn::Expr) -> Result<BigInt, crate::Error> { match def { syn::Expr::Lit(syn::ExprLit { lit: syn::Li...
code_fim
hard
{ "lang": "rust", "repo": "blackbeam/rust_mysql_common", "path": "/derive/src/from_value/enums/misc.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let temp_file = ( io_result_with_prefix ( || format! ( "Error syncing temp file {}: ", temp_file_name), File::open ( self_state.temp_dir_path.join ( temp_file_name))) ) ?; io_result_with_prefix ( || format! ( "Error syncing temp file {}: ", te...
code_fim
hard
{ "lang": "rust", "repo": "jamespharaoh/rzbackup", "path": "/src/misc/atomic_file_writer.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jamespharaoh/rzbackup path: /src/misc/atomic_file_writer.rs use std::fs; use std::fs::File; use std::os::unix::ffi::OsStrExt; use std::path::Path; use std::path::PathBuf; use std::sync::Arc; use std::sync::Mutex; use std::thread; use std::time::Duration; use errno; use libc; use output::Outpu...
code_fim
hard
{ "lang": "rust", "repo": "jamespharaoh/rzbackup", "path": "/src/misc/atomic_file_writer.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // lock with fcntl let mut fcntl_flock = libc::flock { l_type: F_WRLCK, l_whence: libc::SEEK_SET as i16, l_start: 0, l_len: 0, l_pid: 0, }; let fcntl_result = unsafe { libc::fcntl ( lock_fd, libc::F_SETLKW, & mut fcntl_flock as * mut libc::flock, ) ...
code_fim
hard
{ "lang": "rust", "repo": "jamespharaoh/rzbackup", "path": "/src/misc/atomic_file_writer.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pastly/craps-dice-control-rs path: /src/player.rs oll.is_some()); // must have last roll bc of assert let r = table_state.last_roll.unwrap(); // handle winners and losers { let wins: Vec<&Bet> = self.bets.iter().filter(|b| b.wins_with(r)).collect(); ...
code_fim
hard
{ "lang": "rust", "repo": "pastly/craps-dice-control-rs", "path": "/src/player.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut p = PlayerStub::default(); let b1 = Bet::new_field(5); let b2 = Bet::new_pass(5); p.common.add_bet(b1).unwrap(); assert!(p.common.add_bet(b1).is_err()); p.common.add_bet(b2).unwrap(); assert!(p.common.add_bet(b2).is_err()); } #[test]...
code_fim
hard
{ "lang": "rust", "repo": "pastly/craps-dice-control-rs", "path": "/src/player.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pastly/craps-dice-control-rs path: /src/player.rs NT && to_remove.bet_type == BetType::Lay { to_remove.vig_amount() } else { 0 }; // return bet amount and vig (if any) to bankroll. Note that vig wasn't wagered se...
code_fim
hard
{ "lang": "rust", "repo": "pastly/craps-dice-control-rs", "path": "/src/player.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { let path = Path::new("assets/weather.dat"); let mut file = File::open(&path); let data = file.read_to_end().unwrap(); let data_string = String::from_utf8(data); let mut days: Vec<DailyTempSpread> = Vec::new(); for line in data_string.unwrap().as_slice().lines() { match parse_l...
code_fim
hard
{ "lang": "rust", "repo": "jasonthompson/katas", "path": "/kata4/src/weather.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!("32".as_slice(), super::sanitize("32*".as_slice())); assert_eq!("32".as_slice(), super::sanitize("32".as_slice())); } #[test] fn test_parse_line() { let line = " 4 77 59 68 51.1 0.00 110 9.1 130 12 8.6 62 40 1021.1"; let day = super::Da...
code_fim
hard
{ "lang": "rust", "repo": "jasonthompson/katas", "path": "/kata4/src/weather.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jasonthompson/katas path: /kata4/src/weather.rs // http://codekata.com/kata/kata04-data-munging/ // // Kata04: Data Munging // // Martin Fowler gave me a hard time for Kata02, complaining that it was yet // another single-function, academic exercise. Which, or course, it was. So this // week let...
code_fim
hard
{ "lang": "rust", "repo": "jasonthompson/katas", "path": "/kata4/src/weather.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Runnable for KeygenCmd { fn run(&self) { wallet::keygen(); } }<|fim_prefix|>// repo: MSRG/libra path: /ol/onboard/src/commands/keygen_cmd.rs //! `keygen` subcommand #![allow(clippy::never_loop)] <|fim_middle|>use abscissa_core::{Command, Options, Runnable}; use ol_keys::wallet; ///...
code_fim
medium
{ "lang": "rust", "repo": "MSRG/libra", "path": "/ol/onboard/src/commands/keygen_cmd.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> wallet::keygen(); } }<|fim_prefix|>// repo: MSRG/libra path: /ol/onboard/src/commands/keygen_cmd.rs //! `keygen` subcommand #![allow(clippy::never_loop)] <|fim_middle|>use abscissa_core::{Command, Options, Runnable}; use ol_keys::wallet; /// `keygen` subcommand #[derive(Command, Debug, Defa...
code_fim
hard
{ "lang": "rust", "repo": "MSRG/libra", "path": "/ol/onboard/src/commands/keygen_cmd.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MSRG/libra path: /ol/onboard/src/commands/keygen_cmd.rs //! `keygen` subcommand #![allow(clippy::never_loop)] use abscissa_core::{Command, Options, Runnable}; use ol_keys::wallet; /// `keygen` subcommand #[derive(Command, Debug, Default, Options)] pub struct KeygenCmd {} <|fim_suffix|> ...
code_fim
easy
{ "lang": "rust", "repo": "MSRG/libra", "path": "/ol/onboard/src/commands/keygen_cmd.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ackintosh/sandbox path: /rust/book-procon/src/lib.rs mod p119_alds1_4_a_linear_search; mod p122_alds1_4_b_binary_search; mod p127_alds1_4_c_dictionary; mod p46_alds1_1_d_maximum_profit; mod p54_alds1_1_a_insertion_sort; mod p60_alds1_2_a_bubble_sort; mod p65_alds1_2_b_selection_sort; mod p70_ald...
code_fim
medium
{ "lang": "rust", "repo": "ackintosh/sandbox", "path": "/rust/book-procon/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> usize::try_from(n).expect("should be converted to usize") } fn i8_to_usize(n: i8) -> usize { usize::try_from(n).expect("should be converted to usize") } #[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } }<|fim_prefix|>// repo: ackintosh/sandbox path: /...
code_fim
medium
{ "lang": "rust", "repo": "ackintosh/sandbox", "path": "/rust/book-procon/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>struct Solution; impl Solution { pub fn max_sub_array(nums: Vec<i32>) -> i32 { let length = nums.len(); let mut dp = vec![0; length]; dp[0] = nums[0]; let mut max: i32 = nums[0]; for i in 1..length { dp[i] = nums[i] + (if dp[i - 1] > 0 { dp[i - 1] ...
code_fim
hard
{ "lang": "rust", "repo": "accierro/leetcode-solutions", "path": "/easy/arrays/max_subarray/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: accierro/leetcode-solutions path: /easy/arrays/max_subarray/src/main.rs // Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. <|fim_suffix|>impl Solution { pub fn max_sub_array(nums: Vec<i32>) -> i32 { ...
code_fim
hard
{ "lang": "rust", "repo": "accierro/leetcode-solutions", "path": "/easy/arrays/max_subarray/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { assert_eq!( Solution::max_sub_array(vec![-2, 1, -3, 4, -1, 2, 1, -5, 4]), 6 ); }<|fim_prefix|>// repo: accierro/leetcode-solutions path: /easy/arrays/max_subarray/src/main.rs // Given an integer array nums, find the contiguous subarray (containing at least one number) ...
code_fim
hard
{ "lang": "rust", "repo": "accierro/leetcode-solutions", "path": "/easy/arrays/max_subarray/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sria91-rlox/RustLox-1 path: /src/compiler.rs use crate::{ chunk::{Chunk, OpCode}, object::{Object, ObjectList}, parser::Parser, precedence::{Prec, Precedence}, scanner::{Scanner, Token, TokenKind}, value::Value, }; type ParseFn<'a> = Option<fn(&mut Compiler<'a>)>; // The...
code_fim
hard
{ "lang": "rust", "repo": "sria91-rlox/RustLox-1", "path": "/src/compiler.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.parse_precedence(Prec::new(Precedence::Assign)); } fn literal(&mut self) { match self.parser.previous.kind { TokenKind::False => self.emit_op(OpCode::False), TokenKind::True => self.emit_op(OpCode::True), TokenKind::Nil => self.emit_op(OpCo...
code_fim
hard
{ "lang": "rust", "repo": "sria91-rlox/RustLox-1", "path": "/src/compiler.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn grouping(&mut self) { self.expression(); self.consume(TokenKind::RightParen, "Expect ')' after expression."); } fn unary(&mut self) { let operator_kind = self.parser.previous.kind; // Must be grabbed before operand is parsed // Compile the operand s...
code_fim
hard
{ "lang": "rust", "repo": "sria91-rlox/RustLox-1", "path": "/src/compiler.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: w4tson/flicfun path: /src/main.rs use std::sync::{Arc, Mutex}; use flicbtn::*; use std::{time, thread}; use structopt::StructOpt; use tokio::task; use anyhow::Result; use crate::hue::HueApi; pub mod hue; #[tokio::main] async fn main() -> Result<()> { let options = Options::from_args(); ...
code_fim
hard
{ "lang": "rust", "repo": "w4tson/flicfun", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let client = FlicClient::new(&format!("{}:5551", flic_server)) .await? .register_event_handler(on_event) .await; let client1 = Arc::new(client); let client2 = client1.clone(); let program_loop = tokio::spawn(async move { println!("==========================...
code_fim
hard
{ "lang": "rust", "repo": "w4tson/flicfun", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if !extra_fields.is_empty() { debug!("{} extra fields: {:#?}", name, extra_fields); } let modified = match modified { Some(m) => Some(m), None => self.modified.to_datetime(), }; let mut mode: Mode = match self.creator_version.ho...
code_fim
hard
{ "lang": "rust", "repo": "mufeedvh/rc-zip", "path": "/src/format/directory_header.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut mode: Mode = match self.creator_version.host_system() { HostSystem::Unix | HostSystem::Osx => UnixMode(self.external_attrs >> 16).into(), HostSystem::WindowsNtfs | HostSystem::Vfat | HostSystem::MsDos => { MsdosMode(self.external_attrs).into() ...
code_fim
hard
{ "lang": "rust", "repo": "mufeedvh/rc-zip", "path": "/src/format/directory_header.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mufeedvh/rc-zip path: /src/format/directory_header.rs use crate::{encoding, error::*, format::*}; use chrono::offset::TimeZone; use log::*; use nom::{ bytes::streaming::tag, number::streaming::{le_u16, le_u32}, sequence::preceded, }; /// 4.3.12 Central directory structure: File head...
code_fim
hard
{ "lang": "rust", "repo": "mufeedvh/rc-zip", "path": "/src/format/directory_header.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: summerhhh/ekiden path: /core/edl/src/lib.rs #[macro_use] extern crate ekiden_tools; <|fim_suffix|>define_edl! { use sgx_edl; use ekiden_enclave_edl; use ekiden_rpc_edl; use ekiden_db_edl; "core.edl", }<|fim_middle|>extern crate ekiden_db_edl; extern crate ekiden_enclave_edl...
code_fim
medium
{ "lang": "rust", "repo": "summerhhh/ekiden", "path": "/core/edl/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>define_edl! { use sgx_edl; use ekiden_enclave_edl; use ekiden_rpc_edl; use ekiden_db_edl; "core.edl", }<|fim_prefix|>// repo: summerhhh/ekiden path: /core/edl/src/lib.rs #[macro_use] extern crate ekiden_tools; <|fim_middle|>extern crate ekiden_db_edl; extern crate ekiden_enclave_edl...
code_fim
medium
{ "lang": "rust", "repo": "summerhhh/ekiden", "path": "/core/edl/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fleuryz/Focus path: /src/lib.rs extern crate time; extern crate nix; extern crate rand; extern crate find_folder; extern crate os_type; #[macro_use] extern crate conrod; pub mod cenario; pub mod dados; pub mod par; pub mod respostaSN; pub mod sessao; pub mod teste; pub mod variavel; pub mod gui...
code_fim
medium
{ "lang": "rust", "repo": "fleuryz/Focus", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>use std::io::BufReader; use rand::Rng; use std::cmp::Ordering; use nix::sys::signal::Signal; use nix::unistd::Pid; use std::fs; */<|fim_prefix|>// repo: fleuryz/Focus path: /src/lib.rs extern crate time; extern crate nix; extern crate rand; extern crate find_folder; extern crate os_type; #[macro_use] ex...
code_fim
hard
{ "lang": "rust", "repo": "fleuryz/Focus", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let make_svc = make_service_fn(move |_conn| { let base = base.clone(); async move { Ok::<_, Infallible>(service_fn(move |r| { process(r, base.clone()) })) } }); let server = Server::bind(&config.listen).serve(make_svc); if l...
code_fim
medium
{ "lang": "rust", "repo": "railwayhistory/railsite", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> eprintln!("Listening on {}", config.listen); let make_svc = make_service_fn(move |_conn| { let base = base.clone(); async move { Ok::<_, Infallible>(service_fn(move |r| { process(r, base.clone()) })) } }); let server = Serve...
code_fim
medium
{ "lang": "rust", "repo": "railwayhistory/railsite", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: railwayhistory/railsite path: /src/main.rs use std::env; use std::env::current_dir; use std::convert::Infallible; use clap::{App, crate_authors, crate_version}; use hyper::{Body, Response, Server}; use hyper::service::{make_service_fn, service_fn}; use raildata::load::report::Failed; use railsit...
code_fim
hard
{ "lang": "rust", "repo": "railwayhistory/railsite", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust9x/rust path: /compiler/rustc_span/src/tests.rs use super::*; #[test] fn test_lookup_line() { let lines = &[BytePos(3), BytePos(17), BytePos(28)]; assert_eq!(lookup_line(lines, BytePos(0)), -1); assert_eq!(lookup_line(lines, BytePos(3)), 0); assert_eq!(lookup_line(lines, By...
code_fim
hard
{ "lang": "rust", "repo": "rust9x/rust", "path": "/compiler/rustc_span/src/tests.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn check(before: &str, after: &str, expected_positions: &[u32]) { let mut actual = before.to_string(); let mut actual_positions = vec![]; normalize_newlines(&mut actual, &mut actual_positions); let actual_positions: Vec<_> = actual_positions.into_iter().map(|nc| nc.pos....
code_fim
medium
{ "lang": "rust", "repo": "rust9x/rust", "path": "/compiler/rustc_span/src/tests.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test_normalize_newlines() { fn check(before: &str, after: &str, expected_positions: &[u32]) { let mut actual = before.to_string(); let mut actual_positions = vec![]; normalize_newlines(&mut actual, &mut actual_positions); let actual_positions: Vec<_> = actual...
code_fim
medium
{ "lang": "rust", "repo": "rust9x/rust", "path": "/compiler/rustc_span/src/tests.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Dereference { pub fn new() -> Self { Self { metadata: ResolutionMetadata::new(), content: None, content_metadata: None, } } }<|fim_prefix|>// repo: VETER1309/identity.rs path: /identity_core/src/resolver/dereference.rs use serde::{Deseriali...
code_fim
hard
{ "lang": "rust", "repo": "VETER1309/identity.rs", "path": "/identity_core/src/resolver/dereference.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: VETER1309/identity.rs path: /identity_core/src/resolver/dereference.rs use serde::{Deserialize, Serialize}; use crate::resolver::{DocumentMetadata, ResolutionMetadata, Resource}; <|fim_suffix|>impl Dereference { pub fn new() -> Self { Self { metadata: ResolutionMetadata...
code_fim
hard
{ "lang": "rust", "repo": "VETER1309/identity.rs", "path": "/identity_core/src/resolver/dereference.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: 16yuki0702/neqo path: /neqo-transport/src/flow_mgr.rs // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, mod...
code_fim
hard
{ "lang": "rust", "repo": "16yuki0702/neqo", "path": "/neqo-transport/src/flow_mgr.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn max_data(&mut self, maximum_data: u64) { let frame = Frame::MaxData { maximum_data }; self.from_conn.insert(mem::discriminant(&frame), frame); } // -- frames scoped on stream -- /// Indicate to sending remote we are no longer interested in the stream pub fn sto...
code_fim
hard
{ "lang": "rust", "repo": "16yuki0702/neqo", "path": "/neqo-transport/src/flow_mgr.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ap2dCoords}; pub use self::map_3d::{Map3d}; pub use self::map_3d_coords::{Map3dCoords}; pub use self::scene::{Scene};<|fim_prefix|>// repo: yeliknewo/rs-dorp path: /src/components/mod.rs mod transform; mod renderables; mod named; mod map_2d; mod map_2d_coords; mod map_3d; mod map_3d_coords; mod scene; p...
code_fim
medium
{ "lang": "rust", "repo": "yeliknewo/rs-dorp", "path": "/src/components/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yeliknewo/rs-dorp path: /src/components/mod.rs mod transform; mod renderables; mod named; mod map_2d; mod map_2d_coords; mod map_3d; mod map_3d_coords; mod scene; pub use self::transform::{Transform}; pub use self::renderables::{Renderable, RenderableTex2, RenderableSolidColor, <|fim_suffix|>ap...
code_fim
medium
{ "lang": "rust", "repo": "yeliknewo/rs-dorp", "path": "/src/components/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ischeinkman/MediaSync path: /src/players/vlcrc.rs use crate::messages::TimeStamp; use crate::messages::{PlayerPosition, PlayerState}; use crate::traits::{SyncPlayer, SyncPlayerList}; use crate::utils::AbsSub; use crate::DynResult; use futures::future::FutureExt; use futures::future::LocalBoxFutu...
code_fim
hard
{ "lang": "rust", "repo": "ischeinkman/MediaSync", "path": "/src/players/vlcrc.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> proc: impl std::ops::DerefMut<Target = Child>, cmd: &str, ) -> std::io::Result<String> { let mut child_borrow = proc; let stdin = child_borrow.stdin.as_mut().unwrap(); writeln!(stdin, "{}", cmd) .and_then(|_| stdin.flush()) .unwrap(); let stdout = child_borrow.stdou...
code_fim
hard
{ "lang": "rust", "repo": "ischeinkman/MediaSync", "path": "/src/players/vlcrc.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gregl83/rust-lang-book path: /ch07_03_paths_for_referring_to_an_item_in_the_module_tree/src/main.rs use ch07_03_paths_for_referring_to_an_item_in_the_module_tree::{ eat_at_restaurant, settle_invoice, order_at_restaurant, review_restaurant, }; fn main() { // call module funct...
code_fim
medium
{ "lang": "rust", "repo": "gregl83/rust-lang-book", "path": "/ch07_03_paths_for_referring_to_an_item_in_the_module_tree/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // struct scoping (default private require public) order_at_restaurant(); // enum scoping review_restaurant(5); }<|fim_prefix|>// repo: gregl83/rust-lang-book path: /ch07_03_paths_for_referring_to_an_item_in_the_module_tree/src/main.rs use ch07_03_paths_for_referring_to_an_item_in_the_mo...
code_fim
medium
{ "lang": "rust", "repo": "gregl83/rust-lang-book", "path": "/ch07_03_paths_for_referring_to_an_item_in_the_module_tree/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl V1NamespaceCondition { /// NamespaceCondition contains details about state of namespace. pub fn new(status: String, _type: String) -> V1NamespaceCondition { V1NamespaceCondition { last_transition_time: None, message: None, reason: None, ...
code_fim
hard
{ "lang": "rust", "repo": "alberthuang24/kube-rust", "path": "/crates/kubernetes-client/src/models/v1_namespace_condition.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alberthuang24/kube-rust path: /crates/kubernetes-client/src/models/v1_namespace_condition.rs /* * Kubernetes * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v1.21.1 * * Generated by: h...
code_fim
hard
{ "lang": "rust", "repo": "alberthuang24/kube-rust", "path": "/crates/kubernetes-client/src/models/v1_namespace_condition.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: f4z3r/coding_practice path: /rust/src/chapter5_1.rs //! You are given two 32-bit numbers, N and M, and two bit positions, i an j. Write a method to set all bits between i //! and j in N equal to M (e.g., M becomes a substring of N located at i and starting at j). //! //! EXAMPLE:Input: N = 10000...
code_fim
medium
{ "lang": "rust", "repo": "f4z3r/coding_practice", "path": "/rust/src/chapter5_1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(set_bits_2(0b10000000000, 0b10101, 2, 6), 0b10001010100); assert_eq!(set_bits_2(0b10000001101, 0b10101, 2, 6), 0b10001010101); } }<|fim_prefix|>// repo: f4z3r/coding_practice path: /rust/src/chapter5_1.rs //! You are given two 32-bit numbers, N and M, and two bit positions,...
code_fim
medium
{ "lang": "rust", "repo": "f4z3r/coding_practice", "path": "/rust/src/chapter5_1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; #[test] fn test_algo() { assert_eq!(set_bits(0b10000000000, 0b10101, 2, 6), 0b10001010100); assert_eq!(set_bits(0b10000001101, 0b10101, 2, 6), 0b10001010101); assert_eq!(set_bits_2(0b10000000000, 0b10101, 2, 6), 0b10001010100); ...
code_fim
hard
{ "lang": "rust", "repo": "f4z3r/coding_practice", "path": "/rust/src/chapter5_1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> unsafe { let add_ptr = std::mem::transmute::<*const u8, fn(i32, i32) -> i32>(arr_ptr); add_ptr(1, 5); // let pagesize = libc::sysconf(libc::_SC_PAGESIZE); // let pagestart = sub_pointer as i64 & -pagesize; // let end = sub_pointer as i64 + 1024; // // // let...
code_fim
hard
{ "lang": "rust", "repo": "jo4965/rust-memory-rwx-test", "path": "/src/func_hook.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jo4965/rust-memory-rwx-test path: /src/func_hook.rs //use nix::sys::mman::mprotect; use libc; use std::ffi::c_void; use errno::{Errno, errno, set_errno}; fn add(x: i32, y: i32) -> i32 { x + y } fn sub(x: i32, y: i32) -> i32 { <|fim_suffix|> let add_pointer = add as *mut u8; println...
code_fim
medium
{ "lang": "rust", "repo": "jo4965/rust-memory-rwx-test", "path": "/src/func_hook.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match parse_cli() { Ok(_) => (), Err(e) => panic!(format!("{:?}", e)), }; }<|fim_prefix|>// repo: Tamiyo/Mango path: /src/main.rs use crate::cli::parse_cli; mod bytecode; mod cli; mod compiler; mod parser; mod vm; <|fim_middle|>fn main() {
code_fim
easy
{ "lang": "rust", "repo": "Tamiyo/Mango", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Tamiyo/Mango path: /src/main.rs use crate::cli::parse_cli; mod bytecode; mod cli; mod compiler; mod parser; mod vm; <|fim_suffix|> match parse_cli() { Ok(_) => (), Err(e) => panic!(format!("{:?}", e)), }; }<|fim_middle|>fn main() {
code_fim
easy
{ "lang": "rust", "repo": "Tamiyo/Mango", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rosie-home-automation/garage_rfid path: /src/slacker.rs use slack_hook::{Slack, PayloadBuilder, Payload}; use slog; use configuration::Configuration; #[derive(Debug)] pub struct Slacker { channel: String, webhook_url: String, username: String, } impl Slacker { pub fn new(configuration...
code_fim
hard
{ "lang": "rust", "repo": "rosie-home-automation/garage_rfid", "path": "/src/slacker.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> PayloadBuilder::new() .channel(self.channel.as_str()) .username(self.username.as_str()) .text(text) .build() .unwrap() } }<|fim_prefix|>// repo: rosie-home-automation/garage_rfid path: /src/slacker.rs use slack_hook::{Slack, PayloadBuilder, Payload}; use slog; use con...
code_fim
hard
{ "lang": "rust", "repo": "rosie-home-automation/garage_rfid", "path": "/src/slacker.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Trangar/udp_connector path: /src/test/proxy.rs use crate::*; use std::io::ErrorKind; use std::io::{Read, Write}; use std::net::{TcpListener, TcpStream}; use std::thread; use std::time::Duration; impl Socket for TcpStream { fn recv_from(&mut self, buffer: &mut [u8]) -> std::io::Result<(usize...
code_fim
hard
{ "lang": "rust", "repo": "Trangar/udp_connector", "path": "/src/test/proxy.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> println!( " - Relaying to {:?} (-> {:?})", self.server_socket.local_addr().unwrap(), self.server.socket.local_addr().unwrap(), ); self.server_socket .send_to(&data[..count], self.server.socket.local_addr().unwrap()) .expe...
code_fim
hard
{ "lang": "rust", "repo": "Trangar/udp_connector", "path": "/src/test/proxy.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: weslien/cartel path: /src/client/commands/ps.rs use crate::client::cli::ClientConfig; use crate::client::request; use crate::daemon::api::{ApiModuleRunStatus, ApiProbeStatus}; use anyhow::Result; use chrono::Local; use clap::ArgMatches; use console::Style; use std::convert::TryFrom; use std::io;...
code_fim
hard
{ "lang": "rust", "repo": "weslien/cartel", "path": "/src/client/commands/ps.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let time_formatter = timeago::Formatter::new(); let now = u64::try_from(Local::now().timestamp()).unwrap(); let dur = Duration::new(now - mod_status.time_since_status, 0); let formatted_time = if mod_status.status == ApiModuleRunStatus::WAITING { String:...
code_fim
hard
{ "lang": "rust", "repo": "weslien/cartel", "path": "/src/client/commands/ps.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sore0159/rust_island path: /src/ui/c_term.rs pub mod output; pub mod parts; pub mod widget; //use anyhow::Result; use std::io::Write; #[derive(Debug, PartialEq, Clone, Copy)] pub struct Key(pub crossterm::event::KeyEvent); pub type KeyCode = crossterm::event::KeyCode; impl Key { pub fn is...
code_fim
hard
{ "lang": "rust", "repo": "sore0159/rust_island", "path": "/src/ui/c_term.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.stdout.flush() } } impl Drop for Stdout { fn drop(&mut self) { self.quit_cleanup().expect("error in stdout cleanup oh no!"); } } pub struct Stdin; impl Stdin { pub fn new() -> Self { Stdin } } use crossterm::event::{self, poll, read}; use std::time::Dur...
code_fim
hard
{ "lang": "rust", "repo": "sore0159/rust_island", "path": "/src/ui/c_term.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>use crossterm::event::{self, poll, read}; use std::time::Duration; impl Iterator for Stdin { type Item = crate::ui::Event; fn next(&mut self) -> Option<crate::ui::Event> { loop { match poll(Duration::from_secs(0)) { Ok(true) => { match read()...
code_fim
hard
{ "lang": "rust", "repo": "sore0159/rust_island", "path": "/src/ui/c_term.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Woyten/math-util path: /tests/fft.rs use math_util::fft; use math_util::fft::TransformDirection; use nalgebra::DMatrix; use rustfft::num_complex::Complex; #[test] fn sanity_test() { let input = vec![ Complex::new(1.0, 0.0), Complex::new(0.0, 1.0), Complex::new(-1.0, ...
code_fim
medium
{ "lang": "rust", "repo": "Woyten/math-util", "path": "/tests/fft.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(output, expected_output); } #[test] fn sanity_test_2d() { let components = [ Complex::new(1.0, 0.0), Complex::new(0.0, 1.0), Complex::new(-1.0, 0.0), Complex::new(0.0, 1.0), Complex::new(1.0, 0.0), Complex::new(0.0, -1.0), ]; let ...
code_fim
hard
{ "lang": "rust", "repo": "Woyten/math-util", "path": "/tests/fft.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TechPersonYT/midi_file path: /src/file/track.rs use crate::byte_iter::ByteIter; use crate::core::{ Channel, Clocks, DurationName, GeneralMidi, Message, NoteMessage, NoteNumber, Program, ProgramChangeValue, Velocity, }; use crate::error::LibResult; use crate::file::{ Event, MetaEvent,...
code_fim
hard
{ "lang": "rust", "repo": "TechPersonYT/midi_file", "path": "/src/file/track.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn set_general_midi(&mut self, channel: Channel, value: GeneralMidi) -> crate::Result<()> { let program_change = Event::Midi(Message::ProgramChange(ProgramChangeValue { channel, program: Program::new(value.into()), })); if self.is_empty() { ...
code_fim
hard
{ "lang": "rust", "repo": "TechPersonYT/midi_file", "path": "/src/file/track.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let file = File::open(filename).unwrap(); let mut buf_reader = BufReader::new(file); let mut contents = String::new(); buf_reader.read_to_string(&mut contents).unwrap(); contents } #[test] fn large() { let large = read_file("./tests/fixtures/large.json"); let large_correct = r...
code_fim
medium
{ "lang": "rust", "repo": "sondr3/minifie-rs", "path": "/json/tests/test.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sondr3/minifie-rs path: /json/tests/test.rs use json::minify::Minify; use std::fs::File; use std::io::BufReader; use std::io::Read; fn read_file(filename: &str) -> String { let file = File::open(filename).unwrap(); let mut buf_reader = BufReader::new(file); let mut contents = String...
code_fim
medium
{ "lang": "rust", "repo": "sondr3/minifie-rs", "path": "/json/tests/test.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: usamec/cntk-rs path: /src/trainer.rs use learner::Learner; use function::Function; use data_map::DataMap; use device::DeviceDescriptor; use std::ptr; use std::ffi::CStr; cpp! {{ #include <CNTKLibrary.h> #include <cstdio> #include <vector> using namespace CNTK; using namespace std; }...
code_fim
hard
{ "lang": "rust", "repo": "usamec/cntk-rs", "path": "/src/trainer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> error_p = new char[strlen(what)+1]; strcpy(error_p, what); } }); if !error_p.is_null() { let msg = CStr::from_ptr(error_p).to_str().unwrap(); panic!("{}", msg); } }; } } ...
code_fim
hard
{ "lang": "rust", "repo": "usamec/cntk-rs", "path": "/src/trainer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn fill_mut<T: Copy>(ary: &mut [T], value: &T) { for i in 0..ary.len() { ary[i] = *value; } } pub fn unique<T: Copy + PartialEq>(ary: &[T]) -> Vec<T> { unique_adv(&ary).0 } pub fn unique_adv<T: Copy + PartialEq>(ary: &[T]) -> (Vec<T>, Vec<T>) { let mut res = Vec::<T...
code_fim
hard
{ "lang": "rust", "repo": "NorabX/rustils", "path": "/src/array.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: NorabX/rustils path: /src/array.rs extern crate rand; use std::usize::MAX; pub trait ArrayUtils<T> { fn swaping(&mut self, a: usize, b: usize) -> bool; fn index_of(&self, search: &T) -> usize; fn chunk(&self, size: usize) -> Vec<Vec<T>>; fn fill_mut(...
code_fim
hard
{ "lang": "rust", "repo": "NorabX/rustils", "path": "/src/array.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut res = Vec::<T>::new(); let mut removed = Vec::<T>::new(); 'outer: for i in 0..ary.len() { for j in 0..res.len() { if ary[i] == res[j] { removed.push(ary[i]); continue 'outer; } } res.push(ary[i]); } ...
code_fim
hard
{ "lang": "rust", "repo": "NorabX/rustils", "path": "/src/array.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> canvas.set_draw_color(Color::from((0, 0, 0))); canvas.clear(); top.draw(&mut canvas, 50.0, 50.0, 1280.0, 500.0); canvas.present(); } }<|fim_prefix|>// repo: bcamp1/neat-rs path: /src/main.rs extern crate sdl2; extern crate rand; mod network; mod neat; use network::*...
code_fim
hard
{ "lang": "rust", "repo": "bcamp1/neat-rs", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bcamp1/neat-rs path: /src/main.rs extern crate sdl2; extern crate rand; mod network; mod neat; use network::*; use neat::*; use sdl2::event::Event; use sdl2::keyboard::Keycode; use sdl2::keyboard::KeyboardState; use sdl2::keyboard::Scancode; use sdl2::mouse::{MouseState}; use sdl2::pixels::Co...
code_fim
hard
{ "lang": "rust", "repo": "bcamp1/neat-rs", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Shirataki2/competitive_submissions path: /abc180/src/bin/e.rs use proconio::input; use std::cmp::{max, min}; fn dist(from: (i32, i32, i32), to: (i32, i32, i32)) -> i32 { <|fim_suffix|>fn main() { input!(n: usize, coords: [(i32, i32, i32); n]); let mut dp: Vec<Vec<i32>> = vec![vec![1<<3...
code_fim
medium
{ "lang": "rust", "repo": "Shirataki2/competitive_submissions", "path": "/abc180/src/bin/e.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> input!(n: usize, coords: [(i32, i32, i32); n]); let mut dp: Vec<Vec<i32>> = vec![vec![1<<30; n]; 1 << n]; dp[1][0] = 0; for bit in 0..1<<n { for v in 0..n { for u in 0..n { if (bit & (1 << u)) > 0 { continue; } let nbit: usize = bit | (1 ...
code_fim
medium
{ "lang": "rust", "repo": "Shirataki2/competitive_submissions", "path": "/abc180/src/bin/e.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TeXitoi/structopt path: /examples/required_if.rs //! How to use `required_if` with structopt. //! //! Running this example with --help prints this message: //! ----------------------------------------------------- //! structopt 0.3.25 //! //! USAGE: //! required_if -o <out-type> [FILE] //! /...
code_fim
hard
{ "lang": "rust", "repo": "TeXitoi/structopt", "path": "/examples/required_if.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> let opt = Opt::from_iter_safe(&["test", "-o", "file"]); let err = opt.unwrap_err(); assert_eq!(err.kind, clap::ErrorKind::MissingRequiredArgument); } #[test] fn test_opt_out_type_file_with_file_name_returns_ok() { let opt = Opt::from_iter_safe(&["test", "-o", "...
code_fim
medium
{ "lang": "rust", "repo": "TeXitoi/structopt", "path": "/examples/required_if.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> if F::backprop_requires_input_value() { ( vec![self.input_id.value_id(), self.output_id.gradient_id()], vec![self.input_id.gradient_id()] ) } else { ( vec![self.output_id.gradient_id()], vec![self.input_id.gradient_id()] ) } } fn run (&self, data: &Storage) -> Result<B...
code_fim
hard
{ "lang": "rust", "repo": "AI-and-ML/alumina", "path": "/src/ops/activ/elementwise.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AI-and-ML/alumina path: /src/ops/activ/elementwise.rs use graph::{GraphDef, GraphShapes, ErrorKind, Result}; use storage::Storage; use id::{NodeID, DataID, OpID, PassID}; use ops::{standard_op_name, Op, OpInstance, Pass}; use std::any::Any; use std::fmt::Debug; use rayon::prelude::*; pub fn el...
code_fim
hard
{ "lang": "rust", "repo": "AI-and-ML/alumina", "path": "/src/ops/activ/elementwise.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn run (&self, data: &Storage) -> Result<Box<Any>>{ let output_grad = data.get(&self.output_id.gradient_id())?; let mut input_grad = data.get_mut(&self.input_id.gradient_id())?; ensure!( input_grad.shape() == output_grad.shape(), ErrorKind::PassError(self.name(), format!("input shape: {...
code_fim
hard
{ "lang": "rust", "repo": "AI-and-ML/alumina", "path": "/src/ops/activ/elementwise.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: getsentry/symbolicator path: /crates/symbolicator-service/tests/integration/source_errors.rs use std::time::Duration; use symbolicator_service::types::{ CompletedSymbolicationResponse, FrameStatus, ObjectDownloadInfo, ObjectFileStatus, ObjectUseInfo, }; use crate::{example_request, set...
code_fim
hard
{ "lang": "rust", "repo": "getsentry/symbolicator", "path": "/crates/symbolicator-service/tests/integration/source_errors.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // 404 should not result in blocking for _ in 0..3 { let response = symbolication.symbolicate(request.clone()).await.unwrap(); assert_eq!( get_statuses(response), ( FrameStatus::Missing, ObjectFileStatus::Missing, ...
code_fim
hard
{ "lang": "rust", "repo": "getsentry/symbolicator", "path": "/crates/symbolicator-service/tests/integration/source_errors.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fooker/shiplift path: /examples/networkdelete.rs use shiplift::Docker; use std::env; <|fim_suffix|> if let Err(e) = docker.networks().get(&id).delete().await { eprintln!("Error: {}", e) } }<|fim_middle|>#[tokio::main] async fn main() { let docker = Docker::new(); let id =...
code_fim
medium
{ "lang": "rust", "repo": "fooker/shiplift", "path": "/examples/networkdelete.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if let Err(e) = docker.networks().get(&id).delete().await { eprintln!("Error: {}", e) } }<|fim_prefix|>// repo: fooker/shiplift path: /examples/networkdelete.rs use shiplift::Docker; use std::env; <|fim_middle|>#[tokio::main] async fn main() { let docker = Docker::new(); let id =...
code_fim
medium
{ "lang": "rust", "repo": "fooker/shiplift", "path": "/examples/networkdelete.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let cr = LogEntry { txid: None, cmd: DropTable { db_name: db_name.clone(), table_name: table_name.clone(), }, }; let res = self .meta_node .write(cr) .await .map_err...
code_fim
hard
{ "lang": "rust", "repo": "MiaoMiaoGarden/databend", "path": "/metasrv/src/executor/meta_handlers.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MiaoMiaoGarden/databend path: /metasrv/src/executor/meta_handlers.rs // Copyright 2020 Datafuse Labs. // // 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 // // htt...
code_fim
hard
{ "lang": "rust", "repo": "MiaoMiaoGarden/databend", "path": "/metasrv/src/executor/meta_handlers.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let ch: Change<TableMeta> = res.try_into().unwrap(); let (prev, _result) = ch.unpack(); if prev.is_some() || if_exists { Ok(DropTableReply {}) } else { Err(ErrorCode::UnknownTable(format!( "Unknown table: '{:}'", tabl...
code_fim
hard
{ "lang": "rust", "repo": "MiaoMiaoGarden/databend", "path": "/metasrv/src/executor/meta_handlers.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: raylee/cds path: /contrib/uservices/badge/src/badge/handlers.rs use actix_web::error; use actix_web::http::HeaderMap; use actix_web::{AsyncResponder, FutureResponse, HttpRequest, HttpResponse}; use badge_gen::{Badge, BadgeOptions}; use futures::Future; use crate::models::StatusEnum; use crate::...
code_fim
hard
{ "lang": "rust", "repo": "raylee/cds", "path": "/contrib/uservices/badge/src/badge/handlers.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>pub fn badge_handler(req: &HttpRequest<WebState>) -> FutureResponse<HttpResponse> { let project_key = req.match_info().get("project").unwrap_or_default(); let workflow_name = req.match_info().get("workflow").unwrap_or_default(); let query_params = req.query(); let branch = query_params ...
code_fim
hard
{ "lang": "rust", "repo": "raylee/cds", "path": "/contrib/uservices/badge/src/badge/handlers.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }