text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: archshift/crossbar9 path: /src/ffistr.rs use core::slice; pub unsafe fn str_bytes<'a>(raw: &'a *const u8) -> &'a [u8] { slice::from_raw_parts(*raw, str_len(*raw)) } <|fim_suffix|>pub unsafe fn str_cpy(mut dst: *mut u8, mut s: *const u8) -> usize { let mut count = 0; while *s != 0 {...
code_fim
medium
{ "lang": "rust", "repo": "archshift/crossbar9", "path": "/src/ffistr.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> fn except_for() -> &'static str { /* vec![ r"--", // this is a dirty trick, I need a regex for representing dashes r"..", r":", r"::", r"=", r"\", r"|", r"<-", r"->", r"@", r"~", r"=>" ] */ r"" } fn expression() -> &'static str ...
code_fim
hard
{ "lang": "rust", "repo": "gevorgyana/proof_of_concept_haskell_lexer", "path": "/src/qident.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gevorgyana/proof_of_concept_haskell_lexer path: /src/qident.rs /// asterisk (*) on the left side of a derivation marks terminals /// -> == what is on the left becomes what is on the right /// ( x ) == apply to what is inside the parenthesis /// w/o{} == exclude what is inside the brackets ///...
code_fim
hard
{ "lang": "rust", "repo": "gevorgyana/proof_of_concept_haskell_lexer", "path": "/src/qident.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> sum = 0; let mut a = 1; let mut b = 1; let mut c = 1; println!("{},{},",a,b); while c< 4000000{ c = a+b; //println!("{}",c); b = a; a = c; if c%2 ==0{ sum += c; } } println!("{}",sum); }<|fim_prefix|>// repo: cautonwong/langs path: /src/main.rs fn main(){ println!("sdhfs1249...
code_fim
medium
{ "lang": "rust", "repo": "cautonwong/langs", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cautonwong/langs path: /src/main.rs fn main(){ println!("sdhfs12492839483924dfujd"); let a:String = "Hello".to_string(); let b=String::from("hello"); let c = "World".to_owned(); let d = c.clone(); println!("{0},{1},{2},{3},{0}",a,b,c,d); let x = 1_i32; let add_x = |a| {x+a}; let resul...
code_fim
medium
{ "lang": "rust", "repo": "cautonwong/langs", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: exdx/bitcoin_address path: /src/main.rs use std::string::String; use std::str; use crate::point::Concat; extern crate crypto; <|fim_suffix|>fn main() { let point_x = String::from("0x50863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B2352"); let point_y = String::from("0x2CD47...
code_fim
medium
{ "lang": "rust", "repo": "exdx/bitcoin_address", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let p = point::Point { x: (*point_x.as_bytes()).to_vec(), y: (*point_y.as_bytes()).to_vec(), }; let concat:[u8; 65] = p.concatenate(); let c = str::from_utf8(&concat).unwrap(); println!("concat = {}", c); let sha = hash::get_sha256(&concat); println!("sha = {}...
code_fim
hard
{ "lang": "rust", "repo": "exdx/bitcoin_address", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> loop { // wait for input match read_input(io::stdin()) { Ok(v) => match callback(v) { Ok(response) => send_message(io::stdout(), &response).unwrap(), Err(e) => send!({ "error": format!("{}", e) }).unwrap(), }, Err(e) =...
code_fim
hard
{ "lang": "rust", "repo": "neon64/chrome-native-messaging", "path": "/src/lib.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: neon64/chrome-native-messaging path: /src/lib.rs mod errors; pub use crate::errors::Error; use serde::Serialize; use serde_json::{json, Value}; use std::fmt::Display; use std::io; use std::io::{Read, Write}; use std::panic; /// Writes the given JSON data to stdout, thereby 'sending' a message ...
code_fim
hard
{ "lang": "rust", "repo": "neon64/chrome-native-messaging", "path": "/src/lib.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kentnl-rust/ccache_stats_reader_extras path: /examples/cache_leaf_basic.rs //! A trivial example demonstrating the use of [CacheLeaf::read_file] <|fim_suffix|> let leaf = CacheLeaf::read_file(PathBuf::from( std::env::args() .nth(1) .expect("Must pass a path to...
code_fim
medium
{ "lang": "rust", "repo": "kentnl-rust/ccache_stats_reader_extras", "path": "/examples/cache_leaf_basic.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jxnu-liguobin/cs-summary-reflection path: /rust-leetcode/src/interview_04_10.rs use std::borrow::Borrow; use std::cell::RefCell; use std::rc::Rc; use crate::pre_structs::{Solution, TreeNode}; ///面试题 04.10. 检查子树 //检查子树。你有两棵非常大的二叉树:T1,有几万个节点;T2,有几万个节点。设计一个算法,判断 T2 是否为 T1 的子树。 // //如果 T1 有这么一个节点 ...
code_fim
hard
{ "lang": "rust", "repo": "jxnu-liguobin/cs-summary-reflection", "path": "/rust-leetcode/src/interview_04_10.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> is_sub(&Some(t1).cloned(), &t2) || Solution::check_sub_tree( t1.as_ref().borrow().left.as_ref().cloned(), t2.as_ref().cloned(), ) || Solution::check_sub_tree( t1.as_ref().borrow().right.as_ref()....
code_fim
hard
{ "lang": "rust", "repo": "jxnu-liguobin/cs-summary-reflection", "path": "/rust-leetcode/src/interview_04_10.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vadixidav/zoom path: /src/vector/cartesian1.rs extern crate num; use super::Vector; use self::num::{Float, Zero, FromPrimitive}; use std::ops::{Add, Sub, Neg, Mul, Div}; #[derive(Copy, Clone)] pub struct Cartesian1<D> { pub x: D } impl<D> Cartesian1<D> where D: Copy { pub fn new(x: D) ...
code_fim
hard
{ "lang": "rust", "repo": "vadixidav/zoom", "path": "/src/vector/cartesian1.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Cartesian1{x: self.x / rhs} } } impl<D> Neg for Cartesian1<D> where D: Float { type Output = Self; fn neg(self) -> Self { Cartesian1{x: -self.x} } } impl<D> Vector<D> for Cartesian1<D> where D: Float + FromPrimitive { fn space_ball(d: D) -> D { D::from...
code_fim
hard
{ "lang": "rust", "repo": "vadixidav/zoom", "path": "/src/vector/cartesian1.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: emberian/rust-grammar path: /rparse.rs extern crate syntax; extern crate rustc; extern crate serialize; use std::io; use std::io::Reader; use std::vec::FromVec; use serialize::json; use serialize::json::{Json, List, String, Object}; use rustc::driver::{driver, session, config}; <|fim_suffix|>...
code_fim
hard
{ "lang": "rust", "repo": "emberian/rust-grammar", "path": "/rparse.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match io::stdin().read_to_str() { Ok(text) => { let opt = config::basic_options(); let sess = session::build_session(opt, None); let cfg = config::build_configuration(&sess); let input = driver::StrInput(text); let cr = driver::phase_...
code_fim
hard
{ "lang": "rust", "repo": "emberian/rust-grammar", "path": "/rparse.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let required_fee = Self::ticker_request(ticker_request_sender, tx_type, address, token.clone()) .await?; // We allow fee to be 5% off the required fee let scaled_provided_fee = provided_fee.clone() * BigUint::from(105u...
code_fim
hard
{ "lang": "rust", "repo": "Dima0825/react-native-zksync-ios-reviewer", "path": "/zksync/core/bin/zksync_api/src/api_server/rpc_server/rpc_impl.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Dima0825/react-native-zksync-ios-reviewer path: /zksync/core/bin/zksync_api/src/api_server/rpc_server/rpc_impl.rs use std::collections::HashMap; // External uses use jsonrpc_core::{Error, Result}; use num::{bigint::ToBigInt, BigUint}; // Workspace uses use zksync_types::{ tx::{TxEthSignature...
code_fim
hard
{ "lang": "rust", "repo": "Dima0825/react-native-zksync-ios-reviewer", "path": "/zksync/core/bin/zksync_api/src/api_server/rpc_server/rpc_impl.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: embed-rs/net path: /src/dhcp.rs use {TxPacket, WriteOut}; use ethernet::{EthernetAddress, EthernetPacket}; use ipv4::{Ipv4Address, Ipv4Packet}; use udp::UdpPacket; pub fn new_discover_msg(mac: EthernetAddress) -> EthernetPacket<Ipv4Packet<UdpPacket<DhcpPacket>>> { let dhcp_discover = DhcpPa...
code_fim
hard
{ "lang": "rust", "repo": "embed-rs/net", "path": "/src/dhcp.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test_discover() { use HeapTxPacket; let discover = DhcpPacket { mac: EthernetAddress::new([0x00, 0x08, 0xdc, 0xab, 0xcd, 0xef]), transaction_id: 0xcafebabe, operation: DhcpType::Discover, }; let mut packet = HeapTxPacket::new(discover.len()); discov...
code_fim
hard
{ "lang": "rust", "repo": "embed-rs/net", "path": "/src/dhcp.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn call(&mut self, (keys, block): (Vec<Vec<DataType>>, bool)) -> Self::Future { let span = if crate::trace_next_op() { Some(tracing::trace_span!( "view-request", ?keys, node = self.node.index() )) } else { ...
code_fim
hard
{ "lang": "rust", "repo": "aDotInTheVoid/noria", "path": "/noria/src/view.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aDotInTheVoid/noria path: /noria/src/view.rs use crate::data::*; use crate::{Tagged, Tagger}; use async_bincode::{AsyncBincodeStream, AsyncDestination}; use futures_util::{ future, future::TryFutureExt, ready, stream::futures_unordered::FuturesUnordered, stream::StreamExt, stream::TryStr...
code_fim
hard
{ "lang": "rust", "repo": "aDotInTheVoid/noria", "path": "/noria/src/view.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Retrieve the query results for the given parameter values. /// /// The method will block if the results are not yet available only when `block` is `true`. /// If `block` is false, misses will be returned as empty results. Any requested keys that have /// missing state will be backf...
code_fim
hard
{ "lang": "rust", "repo": "aDotInTheVoid/noria", "path": "/noria/src/view.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> unsafe fn setAlertStyle(self, alertStyle: NSAlertStyle) { msg_send![self, setAlertStyle: alertStyle] } unsafe fn setMessageText(self, messageText: id) { msg_send![self, setMessageText: messageText] } unsafe fn setInformativeText(self, informativeText: id) { ms...
code_fim
hard
{ "lang": "rust", "repo": "bekker/msgbox-rs", "path": "/src/macos.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bekker/msgbox-rs path: /src/macos.rs #![allow(non_camel_case_types)] #![allow(non_snake_case)] use cocoa::base::{id, nil}; use cocoa::foundation::NSString; use common::{IconType, MsgBoxError}; /** * cocoa-rs doesn't implement NSAlert yet (0.14.0) * Then implement it! * Someone would stub a...
code_fim
hard
{ "lang": "rust", "repo": "bekker/msgbox-rs", "path": "/src/macos.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> unsafe fn addButton(self, withTitle: id) { msg_send![self, addButtonWithTitle: withTitle] } unsafe fn window(self) -> id { msg_send![self, window] } unsafe fn runModal(self) -> id { msg_send![self, runModal] } unsafe fn setWindowLevel(self, level: i32...
code_fim
hard
{ "lang": "rust", "repo": "bekker/msgbox-rs", "path": "/src/macos.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MicrohexHQ/bitcoin-ts path: /wasm/hashes/sha256/src/lib.rs #![feature(proc_macro, wasm_import_module, wasm_custom_section)] extern crate sha2; extern crate wasm_bindgen; #[macro_use] extern crate arrayref; use sha2::{Digest, Sha256}; use wasm_bindgen::prelude::*; #[wasm_bindgen] pub fn sha256...
code_fim
hard
{ "lang": "rust", "repo": "MicrohexHQ/bitcoin-ts", "path": "/wasm/hashes/sha256/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let hash_abc = vec![ 186, 120, 22, 191, 143, 1, 207, 234, 65, 65, 64, 222, 93, 174, 34, 35, 176, 3, 97, 163, 150, 23, 122, 156, 180, 16, 255, 97, 242, 0, 21, 173, ]; assert_eq!(sha256(b"abc"), hash_abc); let hash_test = vec![ 159, 134, 208, 129, 136, 76, 125, 101, 1...
code_fim
medium
{ "lang": "rust", "repo": "MicrohexHQ/bitcoin-ts", "path": "/wasm/hashes/sha256/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dora-gt/tower-web path: /src/util/chain.rs /// Combine two values /// /// This trait is used to represent types that can be chained, including /// middleware and resource values. pub tr<|fim_suffix|>ine `self` with `other`. fn chain(self, other: U) -> Self::Output; }<|fim_middle|>ait Chain<U...
code_fim
medium
{ "lang": "rust", "repo": "dora-gt/tower-web", "path": "/src/util/chain.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ine `self` with `other`. fn chain(self, other: U) -> Self::Output; }<|fim_prefix|>// repo: dora-gt/tower-web path: /src/util/chain.rs /// Combine two values /// /// This trait is used to represent types th<|fim_middle|>at can be chained, including /// middleware and resource values. pub trait Chain<U...
code_fim
medium
{ "lang": "rust", "repo": "dora-gt/tower-web", "path": "/src/util/chain.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: brianshannan/nats-rs path: /nats/src/errors.rs use std::error; use std::fmt; use std::io; use std::num; use std::sync::mpsc; use openssl::ssl::error::SslError; use serde_json; use url; use message::Message; // TODO make this smaller? /// An error that occurs during the operation of the Nats c...
code_fim
hard
{ "lang": "rust", "repo": "brianshannan/nats-rs", "path": "/nats/src/errors.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // push all keys as: provider_0, provider_1 .. record.iter().skip(1).enumerate().for_each(|(i, v)| { context .vars_bag .insert(format!("{}_{}", provider, i + 1), v.to_string()); }); let interaction = de...
code_fim
hard
{ "lang": "rust", "repo": "saishashanktheratupally/keyscope", "path": "/src/main.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> println!( "\nTo use from the CLI, run:\n\n\tkeyscope validate {} -p PARAM1 PARAM2 ...", provider ); } else { println!("provider {} has no requirements.", provider); } Ok(true) } else { let provider = c...
code_fim
hard
{ "lang": "rust", "repo": "saishashanktheratupally/keyscope", "path": "/src/main.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: saishashanktheratupally/keyscope path: /src/main.rs mod data; use crate::data::{Definitions, BANNER, DEFS}; use anyhow::anyhow; use anyhow::Result as AnyResult; use clap::crate_version; use clap::{App, Arg, ArgMatches}; use console::style; use service_policy_kit::data::Context; use service_polic...
code_fim
hard
{ "lang": "rust", "repo": "saishashanktheratupally/keyscope", "path": "/src/main.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: crlf0710/metafont-rs path: /src/section_1203.rs //! @ We've noted that there are two versions of \MF84. One, called \.{INIMF}, //! @.INIMF@> //! has to be run first; it initializes everything from scratch, without //! reading a base file, and it has the capability of dumping a base file. //! The...
code_fim
hard
{ "lang": "rust", "repo": "crlf0710/metafont-rs", "path": "/src/section_1203.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>am called \.{MF} //! should be the one that has \.{plain} base preloaded, since that agrees //! with {\sl The {\logos METAFONT\/}book}. Other versions, e.g., \.{CMMF}, //! should also be provided for commonly used bases such as \.{cmbase}. //! @:METAFONTbook}{\sl The {\logos METAFONT\/}book@> //! @.cmbas...
code_fim
hard
{ "lang": "rust", "repo": "crlf0710/metafont-rs", "path": "/src/section_1203.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn equal_to(&self, other: &dyn Packet) -> bool { other .as_any() .downcast_ref::<Goodbye>() .map_or(false, |a| self == a) } fn clone_to(&self) -> Box<dyn Packet> { Box::new(self.clone()) } fn as_any(&self) -> &dyn Any { self...
code_fim
hard
{ "lang": "rust", "repo": "stepa2/webrtc-rs-rtcp", "path": "/src/goodbye/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stepa2/webrtc-rs-rtcp path: /src/goodbye/mod.rs #[cfg(test)] mod goodbye_test; use crate::{error::Error, header::*, packet::*, util::*}; use bytes::{Buf, BufMut, Bytes, BytesMut}; use std::any::Any; use std::fmt; /// The Goodbye packet indicates that one or more sources are no longer active. ...
code_fim
hard
{ "lang": "rust", "repo": "stepa2/webrtc-rs-rtcp", "path": "/src/goodbye/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: n4o847/procon-rust path: /accepted/arc122_c.rs use num_integer::Roots; use proconio::{fastout, input}; fn gen(mut x: u64, mut y: u64) -> Vec<u8> { let mut ops = Vec::new(); loop { if x == 0 && y == 0 { break; } else if y == 0 { x -= 1; ...
code_fim
medium
{ "lang": "rust", "repo": "n4o847/procon-rust", "path": "/accepted/arc122_c.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> input! { n: u64, } const PHI: f64 = 0.61803398874989484820; let m = (n as f64 * PHI).round() as u64; let ops = (m.saturating_sub(1000)..=m.saturating_add(1000)) .map(|k| gen(n, k)) .min_by_key(|ops| ops.len()) .unwrap(); println!("{}", ops.len()); ...
code_fim
medium
{ "lang": "rust", "repo": "n4o847/procon-rust", "path": "/accepted/arc122_c.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jugglerchris/rustfmt path: /tests/source/configs-attributes_on_same_line_as_field-false.rs // rustfmt-attributes_on_same_line_as_field: false // Option to place attributes on the same line as fields where possible <|fim_suffix|>// #1943 pub struct Bzip2 { # [ serde (rename = "level") ] ...
code_fim
medium
{ "lang": "rust", "repo": "jugglerchris/rustfmt", "path": "/tests/source/configs-attributes_on_same_line_as_field-false.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>// #1943 pub struct Bzip2 { # [ serde (rename = "level") ] level: i32 , }<|fim_prefix|>// repo: jugglerchris/rustfmt path: /tests/source/configs-attributes_on_same_line_as_field-false.rs // rustfmt-attributes_on_same_line_as_field: false // Option to place attributes on the same line as fields w...
code_fim
medium
{ "lang": "rust", "repo": "jugglerchris/rustfmt", "path": "/tests/source/configs-attributes_on_same_line_as_field-false.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let system = parts.get(2); if system == Some(&"linux") { parts[1] = "unknown"; }; parts.join("-") }<|fim_prefix|>// repo: crossbeam-rs/crossbeam path: /build-common.rs // The target triplets have the form of 'arch-vendor-system'. // // When building for Linux (e.g. the 'system' part...
code_fim
medium
{ "lang": "rust", "repo": "crossbeam-rs/crossbeam", "path": "/build-common.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: crossbeam-rs/crossbeam path: /build-common.rs // The target triplets have the form of 'arch-vendor-system'. // // When building for Linux (e.g. the 'system' part is // 'linux-something'), replace the vendor with 'unknown' // so that mapping to rust standard targets happens correctly. f<|fim_suff...
code_fim
medium
{ "lang": "rust", "repo": "crossbeam-rs/crossbeam", "path": "/build-common.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>n convert_custom_linux_target(target: String) -> String { let mut parts: Vec<&str> = target.split('-').collect(); let system = parts.get(2); if system == Some(&"linux") { parts[1] = "unknown"; }; parts.join("-") }<|fim_prefix|>// repo: crossbeam-rs/crossbeam path: /build-commo...
code_fim
medium
{ "lang": "rust", "repo": "crossbeam-rs/crossbeam", "path": "/build-common.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Use of `unsafe_destructor_blind_to_params` is sound, // because destructor never accesses `self.1`. println!("Dropping Foo({}, _)", self.0); } } fn main() { let (last_dropped, foo0); let (foo1, first_dropped); last_dropped = ScribbleOnDrop(format!("last")); ...
code_fim
hard
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/run-pass/issues/issue-28498-ugeh-with-lifetime-param.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/run-pass/issues/issue-28498-ugeh-with-lifetime-param.rs // run-pass #![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. // Demonstrate the use of the unguarded escape hatch with a lifetime param // to assert that destructor will not a...
code_fim
hard
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/run-pass/issues/issue-28498-ugeh-with-lifetime-param.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { let (last_dropped, foo0); let (foo1, first_dropped); last_dropped = ScribbleOnDrop(format!("last")); first_dropped = ScribbleOnDrop(format!("first")); foo0 = Foo(0, &last_dropped); foo1 = Foo(1, &first_dropped); println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1...
code_fim
hard
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/run-pass/issues/issue-28498-ugeh-with-lifetime-param.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: erikjohnston/rust-hyper-router path: /src/lib.rs extern crate hyper; extern crate route_recognizer; use hyper::header::Headers; use hyper::method::Method; use hyper::server::Handler as HyperHandler; use hyper::server::{Request, Response}; use hyper::status::StatusCode; use hyper::uri::RequestUr...
code_fim
hard
{ "lang": "rust", "repo": "erikjohnston/rust-hyper-router", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let res = router.get_match(&Method::Put, &RequestUri::AbsolutePath(String::from("/test/"))); assert_eq!(res.unwrap().handler.handler, 0u8); let res = router.get_match(&Method::Post, &RequestUri::AbsolutePath(Str...
code_fim
hard
{ "lang": "rust", "repo": "erikjohnston/rust-hyper-router", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(matches) = self.get_match(tuple.0, tuple.1) { let Match { handler, params } = matches; handler.handler.check_continue(params, tuple) } else { StatusCode::Continue } } } #[cfg(test)] mod tests { use super::*; use hyper::...
code_fim
hard
{ "lang": "rust", "repo": "erikjohnston/rust-hyper-router", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: duskmoon314/aw-pac path: /d1-pac/src/csic/csic_dma/csic_dma_f0_bufa.rs #[doc = "Register `csic_dma_f0_bufa` reader"] pub struct R(crate::R<CSIC_DMA_F0_BUFA_SPEC>); impl core::ops::Deref for R { type Target = crate::R<CSIC_DMA_F0_BUFA_SPEC>; #[inline(always)] fn deref(&self) -> &Self:...
code_fim
hard
{ "lang": "rust", "repo": "duskmoon314/aw-pac", "path": "/d1-pac/src/csic/csic_dma/csic_dma_f0_bufa.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> W(writer) } } #[doc = "Field `f0_bufa` reader - When BK_TOP_EN is enabled, FBC_EN is enabled, DMA_EN is disabled, these bits indicate output address of overhead data in FBC mode.\n\nWhen BK_TOP_EN is enabled, FBC_EN is disabled, DMA_EN is enabled, LBC_EN is disabled, these bits indicate FIFO 0...
code_fim
hard
{ "lang": "rust", "repo": "duskmoon314/aw-pac", "path": "/d1-pac/src/csic/csic_dma/csic_dma_f0_bufa.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: happydpc/kafka-cad path: /operations/obj-defs/src/door.rs use crate::*; use cgmath::InnerSpace; use serde::{Deserialize, Serialize}; use serde_json::json; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Door { id: ObjID, pub dir: RefLineSeg, pub width: WorldCoord, pub...
code_fim
hard
{ "lang": "rust", "repo": "happydpc/kafka-cad", "path": "/operations/obj-defs/src/door.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let (first, second, third, fourth, fifth, sixth, seventh, eighth) = self.get_door_points(); let rect_1 = Rect2D::new(y_z(&first), y_z(&sixth)); let rect_2 = Rect2D::new(y_z(&fourth), y_z(&fifth)); let rect_3 = Rect2D::new(y_z(&second), y_z(&seventh)); let rect_4 = R...
code_fim
hard
{ "lang": "rust", "repo": "happydpc/kafka-cad", "path": "/operations/obj-defs/src/door.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: drbh/merkle-tree-stream path: /examples/async.rs use async_std::task; use merkle_tree_stream::{ DefaultNode, HashMethods, MerkleTreeStream, Node, NodeKind, PartialNode, }; use std::sync::Arc; use std::vec::Vec; struct XorHashMethods; impl HashMethods for XorHashMethods { type Node ...
code_fim
medium
{ "lang": "rust", "repo": "drbh/merkle-tree-stream", "path": "/examples/async.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let hash = Node::hash(a) .iter() .chain(Node::hash(b).iter()) .fold(0, |acc, x| acc ^ x); vec![hash] } } async fn append<H: HashMethods>( mts: &mut MerkleTreeStream<H>, content: &[u8], nodes: &mut Vec<Arc<H::Node>>, ) { mts.next(content, nodes); } fn m...
code_fim
hard
{ "lang": "rust", "repo": "drbh/merkle-tree-stream", "path": "/examples/async.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>where T: AsRef<str>, { match str_range .as_ref() .splitn(2, ':') .collect::<Vec<&str>>() .as_slice() { [start, end] => { let start_parse = || start.parse::<u32>().context("start range parse error"); let end_parse = || end.parse::<...
code_fim
hard
{ "lang": "rust", "repo": "Bestowinc/darkroom", "path": "/src/record.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Bestowinc/darkroom path: /src/record.rs use crate::{guess_json_obj, params::BaseParams, take::*, Record, VirtualRecord}; use anyhow::{anyhow, Context, Error}; use colored::*; use filmreel as fr; use fr::{cut::Register, frame::Frame, reel::*, ToStringHidden}; use log::{debug, error, warn}; use st...
code_fim
hard
{ "lang": "rust", "repo": "Bestowinc/darkroom", "path": "/src/record.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AustinHaugerud/oxidsys path: /src/language/operations/math/val_clamp.rs use language::operations::{make_param_doc, Operation, ParamInfo}; pub struct ValClampOp; const DOC: &str = "Enforces <destination> value to be within <lower_bound>..<upper_bound>-1 range."; <|fim_suffix|> fn identifier...
code_fim
hard
{ "lang": "rust", "repo": "AustinHaugerud/oxidsys", "path": "/src/language/operations/math/val_clamp.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JosephLing/liquid-rust path: /crates/derive/src/value_view.rs use proc_macro2::*; use proc_quote::*; use syn::*; pub fn derive(input: &DeriveInput) -> TokenStream { let DeriveInput { ident, generics, .. } = input; let (impl_generics, ty_generics, where_clause) = generics.sp...
code_fim
hard
{ "lang": "rust", "repo": "JosephLing/liquid-rust", "path": "/crates/derive/src/value_view.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ::liquid::model::value::DisplayCow::Owned(Box::new(::liquid::model::object::ObjectSource::new(self))) } fn type_name(&self) -> &'static str { "object" } fn query_state(&self, state: ::liquid::model::State) -> bool { ...
code_fim
hard
{ "lang": "rust", "repo": "JosephLing/liquid-rust", "path": "/crates/derive/src/value_view.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MicrohexHQ/radeco path: /radeco-lib/src/analysis/valueset/sintrange.rs // Copyright (c) 2015, The Radare Project. All rights reserved. // See the COPYING file at the top-level directory of this distribution. // Licensed under the BSD 3-Clause License: // <http://opensource.org/licenses/BSD-3-Cla...
code_fim
hard
{ "lang": "rust", "repo": "MicrohexHQ/radeco", "path": "/radeco-lib/src/analysis/valueset/sintrange.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> UIntRange { min: 0, max: 0 } } } impl<'a, 'b> BitAnd<&'a SIntRange> for &'b SIntRange { type Output = SIntRange; fn bitand(self, rhs: &SIntRange) -> SIntRange { SIntRange { min: max(self.min, rhs.min), max: min(self.max, rhs.max), } } } im...
code_fim
hard
{ "lang": "rust", "repo": "MicrohexHQ/radeco", "path": "/radeco-lib/src/analysis/valueset/sintrange.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: avranju/iotedge-k8s path: /edgelet/edgelet-docker/src/error.rs // Copyright (c) Microsoft. All rights reserved. use std::fmt; use std::fmt::Display; use failure::{Backtrace, Context, Fail}; use hyper::StatusCode; use serde_json; use docker::apis::{ApiError as DockerApiError, Error as DockerEr...
code_fim
hard
{ "lang": "rust", "repo": "avranju/iotedge-k8s", "path": "/edgelet/edgelet-docker/src/error.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vascofazza/customasm path: /src/asm/label.rs use crate::expr::ExpressionValue; use num_bigint::BigInt; use num_traits::Zero; use std::collections::HashMap; pub struct LabelManager { pub global_labels: Vec<GlobalLabel>, pub name_to_index_map: HashMap<String, usize> } pub type LabelContext =...
code_fim
hard
{ "lang": "rust", "repo": "vascofazza/customasm", "path": "/src/asm/label.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn get_global(&self, name: &str) -> Option<&ExpressionValue> { self.name_to_index_map.get(name).map(|index| &self.global_labels[*index].value) } pub fn get_local(&self, ctx: LabelContext, name: &str) -> Option<&ExpressionValue> { self.global_labels[ctx as usize].local_labels.get(name) } ...
code_fim
hard
{ "lang": "rust", "repo": "vascofazza/customasm", "path": "/src/asm/label.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// Parses the `testnet` CLI subcommand. /// /// This is not a pure function, it reads from disk and may contact network servers. fn process_testnet_subcommand( cli_args: &ArgMatches, mut client_config: ClientConfig, log: &Logger, ) -> Result<(ClientConfig, Eth2Config), String> { let eth2_...
code_fim
hard
{ "lang": "rust", "repo": "astrixial2/lighthouse", "path": "/validator_client/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: astrixial2/lighthouse path: /validator_client/src/lib.rs mod attestation_producer; mod block_producer; mod cli; mod config; mod duties; mod error; mod service; mod signer; pub use cli::cli_app; pub use config::Config; use clap::ArgMatches; use config::{Config as ClientConfig, KeySource}; use e...
code_fim
hard
{ "lang": "rust", "repo": "astrixial2/lighthouse", "path": "/validator_client/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: frondeus/alder path: /src/core/offset.rs pub trait Offset { fn offset(&self, second: &Self) -> usize; } <|fim_suffix|> let fst = self.as_ptr(); let snd = second.as_ptr(); snd as usize - fst as usize } } impl<'a> Offset for &'a str { fn offset(&self, second: ...
code_fim
medium
{ "lang": "rust", "repo": "frondeus/alder", "path": "/src/core/offset.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a> Offset for &'a str { fn offset(&self, second: &Self) -> usize { let fst = self.as_ptr(); let snd = second.as_ptr(); snd as usize - fst as usize } }<|fim_prefix|>// repo: frondeus/alder path: /src/core/offset.rs pub trait Offset { fn offset(&self, second: &Sel...
code_fim
easy
{ "lang": "rust", "repo": "frondeus/alder", "path": "/src/core/offset.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let fst = self.as_ptr(); let snd = second.as_ptr(); snd as usize - fst as usize } }<|fim_prefix|>// repo: frondeus/alder path: /src/core/offset.rs pub trait Offset { fn offset(&self, second: &Self) -> usize; } impl Offset for str { fn offset(&self, second: &Self) -> ...
code_fim
medium
{ "lang": "rust", "repo": "frondeus/alder", "path": "/src/core/offset.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: exoego/ouch path: /src/oof/error.rs //! Errors related to argparsing. use std::{error, ffi::OsString, fmt}; use super::Flag; #[derive(Debug, PartialEq)] pub enum OofError { FlagValueConflict { flag: Flag, previous_value: OsString, new_value: OsString, }, //...
code_fim
hard
{ "lang": "rust", "repo": "exoego/ouch", "path": "/src/oof/error.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl fmt::Display for OofError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { // TODO: implement proper debug messages match self { OofError::FlagValueConflict { flag, previous_value, new_value } => { write!( f, ...
code_fim
hard
{ "lang": "rust", "repo": "exoego/ouch", "path": "/src/oof/error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: akks800/atcoder path: /abc160/src/bin/f.rs use proconio::input; #[allow(unused_imports)] use proconio::marker::{Bytes, Chars, Usize1}; #[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; #[allow(unused_imports)] use std::ops::*; #[derive(Clone, Debug, De...
code_fim
hard
{ "lang": "rust", "repo": "akks800/atcoder", "path": "/abc160/src/bin/f.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, PartialEq, Eq, Clone, Copy)] struct Edge { p: ModInt, n: usize, } // dfs1: 辺の p, n を求める fn dfs1( node: usize, parent: usize, edge_id: usize, v: &Vec<Vec<(usize, usize)>>, nodes: &mut Vec<Node>, edges: &mut Vec<Edge>, comb: &Comb, ) -> (usize, ModInt) { ...
code_fim
hard
{ "lang": "rust", "repo": "akks800/atcoder", "path": "/abc160/src/bin/f.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> env!("CARGO_PKG_NAME") } #[doc = "Description of this program"] fn description () -> & 'static str { env!("CARGO_PKG_DESCRIPTION" ).trim() } ...
code_fim
hard
{ "lang": "rust", "repo": "alex/abscissa", "path": "/derive/src/command.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alex/abscissa path: /derive/src/command.rs //! Custom derive support for `abscissa_core::command::Command`. use ident_case::RenameRule; use proc_macro2::TokenStream; use quote::quote; use synstructure::Structure; /// Custom derive for `abscissa_core::command::Command` pub fn derive_command(s: ...
code_fim
hard
{ "lang": "rust", "repo": "alex/abscissa", "path": "/derive/src/command.rs", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> let listener = match TcpListener::bind("0.0.0.0:50000") { Ok(l) => l, Err(err) => { println!("tcp bind error, err: {}", err); return; } }; for stream in listener.incoming() { let stream = match stream { Ok(s) => s, ...
code_fim
hard
{ "lang": "rust", "repo": "MwlLj/rust-libs", "path": "/package/examples/tcp/v1/unpack/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MwlLj/rust-libs path: /package/examples/tcp/v1/unpack/src/main.rs use package::tcp::v1::{unpack, Body}; use package::tcp::v1::unpack::ResultCode; use std::net::TcpListener; <|fim_suffix|> let listener = match TcpListener::bind("0.0.0.0:50000") { Ok(l) => l, Err(err) => { ...
code_fim
hard
{ "lang": "rust", "repo": "MwlLj/rust-libs", "path": "/package/examples/tcp/v1/unpack/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pevers/dicom-pixel-data path: /src/lib.rs use byteorder::{BigEndian, ByteOrder, LittleEndian}; use dicom::core::value::Value; use dicom::{ encoding::transfer_syntax::{Endianness, TransferSyntaxIndex}, object::DefaultDicomObject, transfer_syntax::TransferSyntaxRegistry, }; use gdcm_rs...
code_fim
hard
{ "lang": "rust", "repo": "pevers/dicom-pixel-data", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Ok(obj .element_by_name("BitsAllocated") .context(MissingRequiredField)? .uint16() .context(ParseError)?) } /// Get the BitsStored fn get_bits_stored(obj: &DefaultDicomObject) -> Result<u16> { Ok(obj .element_by_name("BitsStored") .context(MissingRe...
code_fim
hard
{ "lang": "rust", "repo": "pevers/dicom-pixel-data", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use std::path::Path; use super::*; use dicom::object::open_file; use dicom_test_files; use rstest::rstest; #[rstest(value => [ // "pydicom/693_J2KI.dcm", // "pydicom/693_J2KR.dcm", // "pydicom/693_UNCI.dcm", // "pydicom/693...
code_fim
hard
{ "lang": "rust", "repo": "pevers/dicom-pixel-data", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: qiwei9743/leetcode_rs path: /src/orig/771.jewels-and-stones.rs /* * @lc app=leetcode id=771 lang=rust * * [771] Jewels and Stones * * https://leetcode.com/problems/jewels-and-stones/description/ * * algorithms * Easy (83.47%) * Total Accepted: 317.1K * Total Submissions: 379.3K * T...
code_fim
hard
{ "lang": "rust", "repo": "qiwei9743/leetcode_rs", "path": "/src/orig/771.jewels-and-stones.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(Solution::num_jewels_in_stones("aA".into(), "aAAbbbb".into()), 3); //assert_eq!(Solution::num_jewels_in_stones("z".into(), "ZZ".into()), ); } }<|fim_prefix|>// repo: qiwei9743/leetcode_rs path: /src/orig/771.jewels-and-stones.rs /* * @lc app=leetcode id=771 lang=rust * *...
code_fim
hard
{ "lang": "rust", "repo": "qiwei9743/leetcode_rs", "path": "/src/orig/771.jewels-and-stones.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[ cfg_attr ( feature = "vonuvoli_inline", inline ) ] pub fn pair_mutable_new (left : Value, right : Value) -> (PairMutable) { let internals = PairMutableInternals { left, right }; PairMutable (StdRc::new (StdRefCell::new (internals))) } #[ cfg_attr ( feature = "vonuvoli_inline", inline ) ] pub fn pair...
code_fim
hard
{ "lang": "rust", "repo": "Happy-Ferret/vonuvoli-scheme", "path": "/sources/values_pairs.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Happy-Ferret/vonuvoli-scheme path: /sources/values_pairs.rs voli_inline", inline ) ] pub fn pair_ref (&self) -> (Outcome<PairRef<'a>>) { match *self { PairAsRef::Immutable (value) => succeed! (value.pair_ref ()), PairAsRef::ImmutableEmbedded (_, value) => succeed! (value.pair_re...
code_fim
hard
{ "lang": "rust", "repo": "Happy-Ferret/vonuvoli-scheme", "path": "/sources/values_pairs.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Happy-Ferret/vonuvoli-scheme path: /sources/values_pairs.rs ttr ( feature = "vonuvoli_inline", inline ) ] fn values_length (&self) -> (usize) { 2 } } pub enum PairRef <'a> { Immutable (&'a StdRc<PairImmutableInternals>, &'a PairImmutableInternals), ImmutableEmbedded (StdRc<PairImmutabl...
code_fim
hard
{ "lang": "rust", "repo": "Happy-Ferret/vonuvoli-scheme", "path": "/sources/values_pairs.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> while let Some(mut current) = self.pending_nodes.pop_front() { if let Some(next) = current.next() { if current.len() > 0 { // If there are still more remaining nodes at this level put them to the front // of the queue ...
code_fim
hard
{ "lang": "rust", "repo": "Lukazoid/lz_eytzinger_tree", "path": "/src/traversal/breadth_first_iterator.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Lukazoid/lz_eytzinger_tree path: /src/traversal/breadth_first_iterator.rs use crate::EytzingerTree; use std::collections::VecDeque; use std::iter::{ExactSizeIterator, FusedIterator}; use std::ops::Range; /// A breadth-first iterator which returns owned values. #[derive(Debug, Clone)] pub struct...
code_fim
hard
{ "lang": "rust", "repo": "Lukazoid/lz_eytzinger_tree", "path": "/src/traversal/breadth_first_iterator.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> request.set_endpoint_prefix("mobile".to_string()); let encoded = if let Some(ref payload) = input.contents { Some(payload.to_owned()) } else { None }; request.set_payload(encoded); let mut params = Params::new(); if let Some(...
code_fim
hard
{ "lang": "rust", "repo": "wg/rusoto", "path": "/rusoto/services/mobile/src/generated.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl ListProjectsError { pub fn from_response(res: BufferedHttpResponse) -> RusotoError<ListProjectsError> { if let Some(err) = proto::json::Error::parse_rest(&res) { match err.typ.as_str() { "BadRequestException" => { return RusotoError::Service...
code_fim
hard
{ "lang": "rust", "repo": "wg/rusoto", "path": "/rusoto/services/mobile/src/generated.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wg/rusoto path: /rusoto/services/mobile/src/generated.rs rized(err.msg)) } "ValidationException" => return RusotoError::Validation(err.msg), _ => {} } } RusotoError::Unknown(res) } } impl fmt::Display for ListBundles...
code_fim
hard
{ "lang": "rust", "repo": "wg/rusoto", "path": "/rusoto/services/mobile/src/generated.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Default for lacpdu_actor_partner_params { #[inline(always)] fn default() -> Self { unsafe { zeroed() } } }<|fim_prefix|>// repo: lemonrock/dpdk-sys path: /src/bindgen/structs/lacpdu_actor_partner_params.rs // This file is part of dpdk-sys. It is subject to the license terms in the COPYRIGHT fi...
code_fim
hard
{ "lang": "rust", "repo": "lemonrock/dpdk-sys", "path": "/src/bindgen/structs/lacpdu_actor_partner_params.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lemonrock/dpdk-sys path: /src/bindgen/structs/lacpdu_actor_partner_params.rs // This file is part of dpdk-sys. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/dpdk-sys/master/COPYRIG...
code_fim
hard
{ "lang": "rust", "repo": "lemonrock/dpdk-sys", "path": "/src/bindgen/structs/lacpdu_actor_partner_params.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // If the last tile of the column occludes... if last_tile_occludes { break; } } } fn transform((x, y): (u16, u16), (dx, dy): (u16, u16), octant: u8) -> (u16, u16) { let mut dx = dx as i32; let mut dy = dy as i32; // Mirror across y = +-x. if octant & 1 != 0 { swap(&mut dx, &mut dy); } ...
code_fim
hard
{ "lang": "rust", "repo": "ShunyaoLiang/torch", "path": "/core/src/shadow.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ShunyaoLiang/torch path: /core/src/shadow.rs use std::mem::swap; use std::ops; // Sure would be great if this was an iterator. pub fn cast<M, F>(mut map: &mut M, pos: (u16, u16), radius: u16, mut f: F) where M: Map, M::Output: Occluder, F: FnMut(&mut M, (u16, u16)) -> anyhow::Result<()>, { ...
code_fim
hard
{ "lang": "rust", "repo": "ShunyaoLiang/torch", "path": "/core/src/shadow.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: maximeborges/async-on-embedded path: /nrf52/src/timer.rs //! Timers use core::{ future::Future, pin::Pin, sync::atomic::{self, AtomicBool, Ordering}, task::{Context, Poll, Waker}, time::Duration, }; use cortex_m::peripheral::NVIC; use pac::{Interrupt, RTC0}; use crate::{Bo...
code_fim
hard
{ "lang": "rust", "repo": "maximeborges/async-on-embedded", "path": "/nrf52/src/timer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> static mut WAKER: Option<Waker> = None; if has_expired() { if self.installed_waker { // uninstall the waker NVIC::mask(Interrupt::RTC0); // NOTE(compiler_fence) the interrupt must b...
code_fim
hard
{ "lang": "rust", "repo": "maximeborges/async-on-embedded", "path": "/nrf52/src/timer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Poll::Pending } } } // TODO do this without 64-bit arithmetic const F: u64 = 32_768; // frequency of the LFCLK let ticks = dur.as_secs() * F + (u64::from(dur.subsec_nanos()) * F) / 1_000_000_000; // NOTE we could supp...
code_fim
hard
{ "lang": "rust", "repo": "maximeborges/async-on-embedded", "path": "/nrf52/src/timer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }