text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: steveklabnik/snowmew path: /src/snowmew.rs // Copyright 2014 Colin Sherratt // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.o...
code_fim
hard
{ "lang": "rust", "repo": "steveklabnik/snowmew", "path": "/src/snowmew.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub mod position { pub use _position::{ MatrixManager, Deltas, ComputedPositionGL, ComputedPosition, CalcPositionsCl, PositionData, Positions }; } pub mod core { pub use _core::{ DisplayConfig, Render, IOManager, ...
code_fim
hard
{ "lang": "rust", "repo": "steveklabnik/snowmew", "path": "/src/snowmew.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sam701/syconf path: /syconf-lib/src/compiler/mod.rs use std::collections::HashMap; use context::Context; pub use value::{Func, SerializableValue, TypeMismatch, Value, ValueString}; <|fim_suffix|>pub fn compile(expr: &ExprWithLocation) -> Result<Value, Error> { let node = compile::Compiler....
code_fim
hard
{ "lang": "rust", "repo": "sam701/syconf", "path": "/syconf-lib/src/compiler/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub fn compile(expr: &ExprWithLocation) -> Result<Value, Error> { let node = compile::Compiler.compile(&Context::empty(), expr)?; debug!(?node, "compiled node"); node.resolve(&Context::empty()) }<|fim_prefix|>// repo: sam701/syconf path: /syconf-lib/src/compiler/mod.rs use std::collections::H...
code_fim
medium
{ "lang": "rust", "repo": "sam701/syconf", "path": "/syconf-lib/src/compiler/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> debug!("TunTcpSocket.drop: {}", self.handle); let mut guard = TUN.lock(); let mut_tun = guard.as_mut().expect("no tun setup"); mut_tun.sockets.release(self.handle); } } impl Read for TunTcpSocket { fn poll_read( self: Pin<&mut Self>, cx: &mut Conte...
code_fim
hard
{ "lang": "rust", "repo": "antewu/seeker", "path": "/tun/src/socket/tcp_socket.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: antewu/seeker path: /tun/src/socket/tcp_socket.rs use crate::socket::to_socket_addr; use crate::TUN; use async_std::io::{Read, Write}; use smoltcp::socket::{SocketHandle, TcpSocket}; use std::io; use std::io::Error; use std::net::SocketAddr; use std::pin::Pin; use std::task::{Context, Poll}; use...
code_fim
hard
{ "lang": "rust", "repo": "antewu/seeker", "path": "/tun/src/socket/tcp_socket.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: 21eleven/leetcode-solutions path: /rust/0001_two_sum/two_sum.rs use std::collections::HashMap; impl Solution { pub fn two_sum(nums: Vec<i32>, target: i32) -> Vec<i32> { let mut numset : HashMap<i32, i32> = HashMap::new(); let mut soln: Vec<i32> = vec!(); for (i, n) i...
code_fim
hard
{ "lang": "rust", "repo": "21eleven/leetcode-solutions", "path": "/rust/0001_two_sum/two_sum.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> *numset.get(&m).unwrap())); } else { numset.insert(*n, idx); } } soln } }<|fim_prefix|>// repo: 21eleven/leetcode-solutions path: /rust/0001_two_sum/two_sum.rs use std::collections::HashMap; impl Solution { pub fn two_sum(nums: Vec<i32>, t...
code_fim
hard
{ "lang": "rust", "repo": "21eleven/leetcode-solutions", "path": "/rust/0001_two_sum/two_sum.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static("/services.provider.v1.Provider/Invite"); self.inner.unary(request.into_request(), path, codec).await } pub async fn invite_with_wo...
code_fim
hard
{ "lang": "rust", "repo": "skurhse/sdk", "path": "/cli/src/proto/services/provider/v1/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: skurhse/sdk path: /cli/src/proto/services/provider/v1/mod.rs #[derive(Clone, PartialEq, ::prost::Message)] pub struct InviteRequest { #[prost(enumeration = "ParticipantType", tag = "1")] pub participant: i32, #[prost(string, tag = "2")] pub description: ::prost::alloc::string::St...
code_fim
hard
{ "lang": "rust", "repo": "skurhse/sdk", "path": "/cli/src/proto/services/provider/v1/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MonadicDavidHuang/mcmc path: /src/main.rs extern crate nalgebra as na; extern crate gnuplot; extern crate rand; use na::*; use std::f64; use std::vec::Vec; use rand::Rng; use std::collections::BTreeMap; use gnuplot::{Figure, Color}; const PI: f64 = std::f64::consts::PI; // gaussian ditributio...
code_fim
hard
{ "lang": "rust", "repo": "MonadicDavidHuang/mcmc", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut base: Vec<f64> = Vec::new(); let mut cur_point: f64 = mn; for _ in (mn as i32)..((mx as i32) + 1) { cur_point += window; let point = cur_point - (window / 2.0); base.push(point); } base.sort_by(|a, b| {a.partial_cmp(b).unwrap()}); let mut discretiz...
code_fim
hard
{ "lang": "rust", "repo": "MonadicDavidHuang/mcmc", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fossabot/sahke path: /src/requests/payloads/set_chat_sticker_set.rs use serde::{Deserialize, Serialize}; use crate::{ requests::{dynamic, json, Method}, types::{ChatId, True}, }; /// Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in th...
code_fim
hard
{ "lang": "rust", "repo": "fossabot/sahke", "path": "/src/requests/payloads/set_chat_sticker_set.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dynamic::Kind::Json(serde_json::to_string(self).unwrap()) } } impl SetChatStickerSet { pub fn new<C, S>(chat_id: C, sticker_set_name: S) -> Self where C: Into<ChatId>, S: Into<String> { let chat_id = chat_id.into(); let sticker_set_name = sticker_se...
code_fim
medium
{ "lang": "rust", "repo": "fossabot/sahke", "path": "/src/requests/payloads/set_chat_sticker_set.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl json::Payload for SetChatStickerSet {} impl dynamic::Payload for SetChatStickerSet { fn kind(&self) -> dynamic::Kind { dynamic::Kind::Json(serde_json::to_string(self).unwrap()) } } impl SetChatStickerSet { pub fn new<C, S>(chat_id: C, sticker_set_name: S) -> Self where ...
code_fim
medium
{ "lang": "rust", "repo": "fossabot/sahke", "path": "/src/requests/payloads/set_chat_sticker_set.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub mute_on_connect: Option<bool>, #[serde(rename = "pttActive", skip_serializing_if = "Option::is_none")] pub ptt_active: Option<bool>, #[serde(rename = "pttKey", skip_serializing_if = "Option::is_none")] pub ptt_key: Option<String>, #[serde(rename = "vadActive", skip_serializing_...
code_fim
hard
{ "lang": "rust", "repo": "Potato-Gaming/crystal", "path": "/league-client/src/models/lol_premade_voice_settings_resource.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Potato-Gaming/crystal path: /league-client/src/models/lol_premade_voice_settings_resource.rs /* * * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * Generated by: https://opena...
code_fim
hard
{ "lang": "rust", "repo": "Potato-Gaming/crystal", "path": "/league-client/src/models/lol_premade_voice_settings_resource.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mallatai/rastfm path: /src/main.rs extern crate regex; extern crate hyper; extern crate serde_json; extern crate serde_urlencoded; extern crate crypto; extern crate futures; extern crate tokio_core; <|fim_suffix|> rastfm::lastfm_api::scrobble_tracks(&mut track_info_list); }<|fim_middle|>mod ...
code_fim
medium
{ "lang": "rust", "repo": "mallatai/rastfm", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("Starting..."); let mut track_info_list = rastfm::logfile::parse(); println!("Total tracks collected: {}", track_info_list.len()); rastfm::lastfm_api::scrobble_tracks(&mut track_info_list); }<|fim_prefix|>// repo: mallatai/rastfm path: /src/main.rs extern crate regex; extern cra...
code_fim
easy
{ "lang": "rust", "repo": "mallatai/rastfm", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sclolus/Turbofish path: /rust_kernel/dependencies/kernel_modules/src/writer.rs //! This module manage println! and print! rust macros use core::fmt::{Result, Write}; /// Main Writer structure pub struct Writer { f: Option<fn(&str)>, } /// Main implementation impl Writer { /// Void new...
code_fim
hard
{ "lang": "rust", "repo": "sclolus/Turbofish", "path": "/rust_kernel/dependencies/kernel_modules/src/writer.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Main Writer Globale pub static mut WRITER: Writer = Writer::new(); /// common print method #[macro_export] #[cfg(not(test))] macro_rules! print { ($($arg:tt)*) => ({ match format_args!($($arg)*) { a => { use crate::WRITER; #[allow(unused_unsafe...
code_fim
hard
{ "lang": "rust", "repo": "sclolus/Turbofish", "path": "/rust_kernel/dependencies/kernel_modules/src/writer.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> has the upper 3 bits \\[10:8\\] of the SOF frame number."] #[inline(always)] pub fn frame_number_msb(&self) -> FRAME_NUMBER_MSB_R { FRAME_NUMBER_MSB_R::new((self.bits & 0x07) as u8) } }<|fim_prefix|>// repo: mvertescher/psoc6-pac path: /src/usbfs0/usbdev/sof1.rs #[doc = "Reader of re...
code_fim
medium
{ "lang": "rust", "repo": "mvertescher/psoc6-pac", "path": "/src/usbfs0/usbdev/sof1.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mvertescher/psoc6-pac path: /src/usbfs0/usbdev/sof1.rs #[doc = "Reader of register SOF1"] pub type R = crate::R<u32, super::SOF1>; #[doc = "Reader of field `<|fim_suffix|>er_msb(&self) -> FRAME_NUMBER_MSB_R { FRAME_NUMBER_MSB_R::new((self.bits & 0x07) as u8) } }<|fim_middle|>FRAME_NU...
code_fim
hard
{ "lang": "rust", "repo": "mvertescher/psoc6-pac", "path": "/src/usbfs0/usbdev/sof1.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>er_msb(&self) -> FRAME_NUMBER_MSB_R { FRAME_NUMBER_MSB_R::new((self.bits & 0x07) as u8) } }<|fim_prefix|>// repo: mvertescher/psoc6-pac path: /src/usbfs0/usbdev/sof1.rs #[doc = "Reader of register SOF1"] pub type R = crate::R<u32, super::SOF1>; #[doc = "Reader of field `FRAME_NUMBER_MSB`"] pu...
code_fim
medium
{ "lang": "rust", "repo": "mvertescher/psoc6-pac", "path": "/src/usbfs0/usbdev/sof1.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: therustmonk/rustymind path: /src/lib.rs use log::{debug, error, info, warn}; pub const HEADSETID_AUTOCONNECT: [u8; 1] = [0xc2]; #[derive(PartialEq, Eq, Debug)] pub enum PacketType { HeadsetConnected(u16), HeadsetConnectedUndefined, HeadsetNotFound(u16), NoHeadsetFound, NotF...
code_fim
hard
{ "lang": "rust", "repo": "therustmonk/rustymind", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> n += 4; } else if self.payload[n] == 0xd1 { // Headset Not Found if self.payload[n + 1] == 0x02 { warn!( "Headset {:#04x} {:#04x} not found", self.payload[n + 2], ...
code_fim
hard
{ "lang": "rust", "repo": "therustmonk/rustymind", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let test_vec: Vec<u8> = vec![ 0xAA, // [SYNC] 0xAA, // [SYNC] 0x20, // [PLENGTH] (payload length) of 32 bytes 0x02, // [POOR_SIGNAL] Quality 0x00, // No poor signal detected (0/200) 0x83, // [ASIC_EEG_POWER_INT] 0x...
code_fim
hard
{ "lang": "rust", "repo": "therustmonk/rustymind", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn generate_workout(intensity: u32, random_num: u32) { let mut calc_results = Cacher::new(|num| { println!("doing calc..",); thread::sleep(Duration::from_secs(2)); num }); if intensity < 25 { println!("DO PUSHUPS, {}", calc_results.value(intensity)); pr...
code_fim
hard
{ "lang": "rust", "repo": "TakaakiFuruse/rust-practice", "path": "/the_book/iterators_and_closures_2/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TakaakiFuruse/rust-practice path: /the_book/iterators_and_closures_2/src/main.rs use std::collections::HashMap; use std::thread; use std::time::Duration; fn main() { // Closure example and Cache logic(Hash map) let user_specified_value = 10; let random_num = 7; // generate_work...
code_fim
hard
{ "lang": "rust", "repo": "TakaakiFuruse/rust-practice", "path": "/the_book/iterators_and_closures_2/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; #[test] fn call_with_different_variables() { let mut c = Cacher::new(|a| a); let _v1 = c.value(1); let v2 = c.value(2); assert_eq!(v2, 2); } }<|fim_prefix|>// repo: TakaakiFuruse/rust-practice path: /the_book/iterat...
code_fim
hard
{ "lang": "rust", "repo": "TakaakiFuruse/rust-practice", "path": "/the_book/iterators_and_closures_2/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!( runner().ok("@function foo($args...) {\ \n @return adjust-color($args...);\ \n}\n\ \n.foo {val: foo(#102030, $blue: 5)}\n"), ".foo {\ \n val: #102035;\ \n}\n" ); }<|fim_prefix|>// repo: kaj/rsass path: /rsass/t...
code_fim
medium
{ "lang": "rust", "repo": "kaj/rsass", "path": "/rsass/tests/spec/non_conformant/scss_tests/t103_test_function_var_args_passed_to_native.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kaj/rsass path: /rsass/tests/spec/non_conformant/scss_tests/t103_test_function_var_args_passed_to_native.rs //! Tests auto-converted from "sass-spec/spec/non_conformant/scss-tests/103_test_function_var_args_passed_to_native.hrx" #[allow(unused)] fn runner() -> crate::TestRunner { <|fim_suffix|>...
code_fim
medium
{ "lang": "rust", "repo": "kaj/rsass", "path": "/rsass/tests/spec/non_conformant/scss_tests/t103_test_function_var_args_passed_to_native.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(v) = v1_iter.next() { println!("v = {}", v); //4 } if let Some(v) = v1_iter.next() { println!("v = {}", v); } else { println!("end!!!"); // end!!! } // ------------迭代可变引用---------------- let mut v2 = vec![1, 2, 3, 4]; let mut iter_v2 = ...
code_fim
hard
{ "lang": "rust", "repo": "zzl133/my_rust_road", "path": "/learn-rust/the_rust_book/learn_iter1/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zzl133/my_rust_road path: /learn-rust/the_rust_book/learn_iter1/src/main.rs /// 1 迭代器负责遍历序列中的每一项和决定序列何时结束的逻辑 /// 2 创建迭代器: 迭代器是惰性的,意思是在调用方法使用迭代器之前,不会有任何效果 /// 3 每个迭代器都实现了iterator tiait, Iterator triat定义在标准库中: trait Iterator { type Item; fn next(&mut self) -> Option<Self::Item>; // type It...
code_fim
hard
{ "lang": "rust", "repo": "zzl133/my_rust_road", "path": "/learn-rust/the_rust_book/learn_iter1/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut stream = TcpStream::connect(ADDR).unwrap(); let req = rpp::Request { command: "PING".to_owned(), args: vec!["HI".to_owned()], }; rpp::req_to_writer(&mut stream, &req); std::io::copy(&mut stream, &mut std::io::stdout()).unwrap(); }<|fim_prefix|>// repo: ouromoros...
code_fim
easy
{ "lang": "rust", "repo": "ouromoros/talent-plan", "path": "/redis-pingpong/src/bin/client.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ouromoros/talent-plan path: /redis-pingpong/src/bin/client.rs use std::{net::TcpStream}; const ADDR: &str = "127.0.0.1:7878"; <|fim_suffix|> let mut stream = TcpStream::connect(ADDR).unwrap(); let req = rpp::Request { command: "PING".to_owned(), args: vec!["HI".to_owned(...
code_fim
easy
{ "lang": "rust", "repo": "ouromoros/talent-plan", "path": "/redis-pingpong/src/bin/client.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Convenience method provided so that we can generate /// STOREV i64 /// /// instead of /// /// LOADC i64 /// STORE fn storev(&mut self, val: i64) { self.loadc(val); self.store(); } /// Jumps to a location on the stack, by moving the program count...
code_fim
hard
{ "lang": "rust", "repo": "cjkenn/tyr", "path": "/src/vm.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cjkenn/tyr path: /src/vm.rs ::process; use util; /// Maximum size for program stack. const STACK_SIZE: usize = 50; /// Holds relevant state info for the execution of a program. /// /// The vm is stack based, with all operations taking their /// arguments off of the stack and returning results ...
code_fim
hard
{ "lang": "rust", "repo": "cjkenn/tyr", "path": "/src/vm.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(vm.peek(), 1); } #[test] fn test_run_div_with_remainder() { let prog = vec![OpCode::LOADC(3), OpCode::LOADC(10), OpCode::DIV]; let sym_tab = SymbolTable::new(); let mut vm = Vm::new(&prog, &sym_tab); vm.run(); assert_eq!(vm.peek(), 3...
code_fim
hard
{ "lang": "rust", "repo": "cjkenn/tyr", "path": "/src/vm.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Self::flip_lights(n, presses) } } #[cfg(test)] mod tests { #[test] fn test_solution() { super::super::tests::run::<super::Solution>(); } }<|fim_prefix|>// repo: EFanZh/LeetCode path: /src/problem_0672_bulb_switcher_ii/enumerate.rs pub struct Solution; // ----------------...
code_fim
hard
{ "lang": "rust", "repo": "EFanZh/LeetCode", "path": "/src/problem_0672_bulb_switcher_ii/enumerate.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: EFanZh/LeetCode path: /src/problem_0672_bulb_switcher_ii/enumerate.rs pub struct Solution; // ------------------------------------------------------ snip ------------------------------------------------------ // <|fim_suffix|>impl super::Solution for Solution { fn flip_lights(n: i32, press...
code_fim
hard
{ "lang": "rust", "repo": "EFanZh/LeetCode", "path": "/src/problem_0672_bulb_switcher_ii/enumerate.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut q_y = Fp2::zero(&extension_2); q_y.c0 = q_y_0; q_y.c1 = q_y_1; let p = CurvePoint::point_from_xy(&curve, p_x, p_y); // println!("P.x = {}", p.x.into_repr()); let q = CurvePoint::point_from_xy(&twist, q_x, q_y); // let x = BigUint::from_str_radix("368541675371338701678...
code_fim
hard
{ "lang": "rust", "repo": "matter-labs/eip1962", "path": "/src/bench/pairing/bls12/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matter-labs/eip1962 path: /src/bench/pairing/bls12/mod.rs extern crate test as rust_test; use self::rust_test::Bencher; use num_bigint::BigUint; use num_traits::FromPrimitive; use num_integer::Integer; use crate::field::{U384Repr, U256Repr, new_field}; use crate::fp::Fp; use crate::traits::{Fie...
code_fim
hard
{ "lang": "rust", "repo": "matter-labs/eip1962", "path": "/src/bench/pairing/bls12/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ZaoIsmael/football path: /src/simulator/simulator.rs use crate::simulator::context::GlobalContext; use crate::simulator::{SimulationContext, SimulatorData}; use crate::continent::ContinentResult; pub struct FootballSimulator; impl FootballSimulator { pub fn simulate(data: &mut SimulatorDat...
code_fim
medium
{ "lang": "rust", "repo": "ZaoIsmael/football", "path": "/src/simulator/simulator.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for result in results { result.process(data); } data.next_date(); } }<|fim_prefix|>// repo: ZaoIsmael/football path: /src/simulator/simulator.rs use crate::simulator::context::GlobalContext; use crate::simulator::{SimulationContext, SimulatorData}; use cra...
code_fim
hard
{ "lang": "rust", "repo": "ZaoIsmael/football", "path": "/src/simulator/simulator.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let results: Vec<ContinentResult> = data.continents.iter_mut() .map(|continent| continent.simulate(ctx.with_continent(continent.id))) .collect(); for result in results { result.process(data); } data.next_date(); } }<|fim_pre...
code_fim
medium
{ "lang": "rust", "repo": "ZaoIsmael/football", "path": "/src/simulator/simulator.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> //logical let pi_less_4 = std::f64::consts::PI < 4.0; //True // > <= >= == let x=5; let x_is_5 = x==5; //True println!("pi_less_4 is {:?}, x is {}, x_is_5 is {:?}",pi_less_4, x,x_is_5); }<|fim_prefix|>// repo: neel-maddy/rust_1stPhase path: /src/operators.rs use std::mem; p...
code_fim
hard
{ "lang": "rust", "repo": "neel-maddy/rust_1stPhase", "path": "/src/operators.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: neel-maddy/rust_1stPhase path: /src/operators.rs use std::mem; pub fn run(){ let mut a =2+3*4; println!("a={}",a); //+= -= *= /= a+=1; a-=2; println!("a={}",a); println!("Remainder of {}/{}={}",a,3,(a%3)); <|fim_suffix|> //logical let pi_less_4 = std...
code_fim
hard
{ "lang": "rust", "repo": "neel-maddy/rust_1stPhase", "path": "/src/operators.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: andrewvy/async-discord path: /src/cache.rs use std::collections::HashMap; use async_std::sync::RwLock; use futures::future; use twilight_model::{ channel::GuildChannel, guild::Guild, id::{GuildId, UserId}, user::{CurrentUser, User}, }; /// Simple caching mechanism that processes Dispat...
code_fim
hard
{ "lang": "rust", "repo": "andrewvy/async-discord", "path": "/src/cache.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let _ = future::join_all( guild .members .into_iter() .map(|(_, member)| self.cache_user(member.user)), ) .await; } async fn cache_user(&self, user: User) { let mut users = self.users.write().await; users.insert(user.id, user); } async fn cache_...
code_fim
hard
{ "lang": "rust", "repo": "andrewvy/async-discord", "path": "/src/cache.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gyan0890/RustProgrammingLanguage path: /RustBook/Chapter3/FahrenheitCelsius.rs use std::io; fn main() { /* Create a mutable variable called input to get the choice from user A: Fahrenheit to Celsius B: Celsium to Fahrenheit */ let mut input = String::new(); println!(...
code_fim
hard
{ "lang": "rust", "repo": "gyan0890/RustProgrammingLanguage", "path": "/RustBook/Chapter3/FahrenheitCelsius.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let C: i32 = C.trim().parse().expect("invalid input"); let mut F = 0; F = (C*9/5) + 32; println!("Temperate in Fahrenheit is: {}", F); } else { println!("You have chosen a wrong option!"); } /* Comments Can enhance using loops Keep takin...
code_fim
hard
{ "lang": "rust", "repo": "gyan0890/RustProgrammingLanguage", "path": "/RustBook/Chapter3/FahrenheitCelsius.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: apiplant/apiplant-rs path: /apiplant-server-bin/src/main.rs use seahorse::{App, Context, Flag, FlagType}; use std::env; use std::alloc::System; use apiplant_server_lib; #[global_allocator] static ALLOCATOR: System = System; <|fim_suffix|>fn run(c: &Context) { apiplant_server_lib::init_apip...
code_fim
hard
{ "lang": "rust", "repo": "apiplant/apiplant-rs", "path": "/apiplant-server-bin/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn run(c: &Context) { apiplant_server_lib::init_apiplant( &c.string_flag("config").unwrap_or("./config.toml".to_string()), &c.string_flag("plugins").unwrap_or("./plugins".to_string()), ); }<|fim_prefix|>// repo: apiplant/apiplant-rs path: /apiplant-server-bin/src/main.rs use s...
code_fim
medium
{ "lang": "rust", "repo": "apiplant/apiplant-rs", "path": "/apiplant-server-bin/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mnts26/aws-sdk-rust path: /sdk/firehose/src/operation.rs record when using <a>PutRecord</a>. The data record consists of a data blob that can be up to 1,000 /// KB in size, and any kind of data. For example, it could be a segment from a log file, /// geographic location data, website clickstream...
code_fim
hard
{ "lang": "rust", "repo": "mnts26/aws-sdk-rust", "path": "/sdk/firehose/src/operation.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: melted/aoc2017 path: /src/bin/day14.rs use std::collections::HashSet; fn one_round<T : Copy>(v : &Vec<T>, pos : i32, size : i32) -> Vec<T> { let mut out = v.clone(); let end = pos + size; let len = v.len() as i32; for j in 0..size { out[((end-j-1)%len) as usize] = v[((po...
code_fim
hard
{ "lang": "rust", "repo": "melted/aoc2017", "path": "/src/bin/day14.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut unexplored = data.clone(); let mut count = 0; while !unexplored.is_empty() { let n = *unexplored.iter().next().unwrap(); let mut frontier = HashSet::new(); frontier.insert(n); while !frontier.is_empty() { let mut next = HashSet::new(); ...
code_fim
hard
{ "lang": "rust", "repo": "melted/aoc2017", "path": "/src/bin/day14.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut out = Vec::new(); out.push((p.0 - 1, p.1)); out.push((p.0, p.1 - 1)); out.push((p.0 + 1, p.1)); out.push((p.0, p.1 + 1)); out } fn count_regions(data : &HashSet<(i32, i32)>) -> i32 { let mut unexplored = data.clone(); let mut count = 0; while !unexplored.is_em...
code_fim
hard
{ "lang": "rust", "repo": "melted/aoc2017", "path": "/src/bin/day14.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: RustPanda/my-first-webserver-on-rocket path: /src/main.rs use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; use async_graphql::{EmptyMutation, EmptySubscription, Object, Schema}; use rocket::fs::{relative, FileServer}; use rocket::response::content; use rocket::{State, get, ...
code_fim
hard
{ "lang": "rust", "repo": "RustPanda/my-first-webserver-on-rocket", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[get("/graphql?<query..>")] async fn graphql_query(schema: &State<StarWarsSchema>, query: Query) -> Response { query.execute(schema).await } #[post("/graphql", data = "<request>")] async fn graphql_request(schema: &State<StarWarsSchema>, request: BatchRequest) -> Response { request.execute(schem...
code_fim
hard
{ "lang": "rust", "repo": "RustPanda/my-first-webserver-on-rocket", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: togatoga/scrapsat path: /src/core/assign.rs use crate::types::lit::Lit; #[derive(Debug, Default)] pub struct AssignTrail { /// Stores all assignments made in the order they made. pub stack: Vec<Lit>, /// Separator indices for different decision levels in `stack` /// e.g. For `st...
code_fim
hard
{ "lang": "rust", "repo": "togatoga/scrapsat", "path": "/src/core/assign.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(trail.num_assign(), 3); assert_eq!(trail.decision_level(), 0); trail.new_decision_level(); assert_eq!(trail.decision_level(), 1); while let Some(x) = trail.pop() { eprintln!("{:?}", x); assert!(lits.pop_front() == Some(x)); ...
code_fim
hard
{ "lang": "rust", "repo": "togatoga/scrapsat", "path": "/src/core/assign.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for (i, rot) in Car::sensor_rotations().iter().enumerate() { let model = self .model .clone() .transform(self.pos.clone(), self.rot.clone() + rot); let distance = model .edges() .iter() ...
code_fim
hard
{ "lang": "rust", "repo": "nilsmartel/ai-race", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nilsmartel/ai-race path: /src/main.rs mod model; use model::*; use ultraviolet::Vec2; const PI: f32 = 3.141592653589; fn main() { println!("Hello, world!"); } <|fim_suffix|> for (i, rot) in Car::sensor_rotations().iter().enumerate() { let model = self .mo...
code_fim
hard
{ "lang": "rust", "repo": "nilsmartel/ai-race", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> [-PI / 3.0, -PI / 6.0, 0.0, PI / 6.0, PI / 3.0] } pub fn state(&self) -> [f32; 5] { let mut res = [0.0; 5]; for (i, rot) in Car::sensor_rotations().iter().enumerate() { let model = self .model .clone() .transform...
code_fim
medium
{ "lang": "rust", "repo": "nilsmartel/ai-race", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let re_array_types = Regex::new(r"struct (futhark_.+_\d+d) ;").expect("Regex failed!"); let array_types: Vec<String> = re_array_types .captures_iter(&headers) .map(|c| c[1].to_owned()) .collect(); //println!("{:#?}", array_types); //println!("{}", gen_impl_futhark_t...
code_fim
hard
{ "lang": "rust", "repo": "porcuquine/genfut", "path": "/src/main.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|>// repo: porcuquine/genfut path: /src/main.rs #![allow(unused_must_use)] #![allow(unused_variables)] use std::fs::create_dir; use std::fs::File; use std::io::Write; use std::path::Path; use std::path::PathBuf; use regex::Regex; mod arrays; mod entry; mod genc; use crate::arrays::gen_impl_futhark_types...
code_fim
hard
{ "lang": "rust", "repo": "porcuquine/genfut", "path": "/src/main.rs", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pxlp/river path: /pixelport_app/src/main.rs extern crate pixelport_document; extern crate pixelport; extern crate pixelport_viewport; extern crate rustc_serialize; extern crate docopt; #[macro_use] extern crate log; extern crate env_logger; use std::path::{Path, PathBuf}; use std::fs::File; use...
code_fim
hard
{ "lang": "rust", "repo": "pxlp/river", "path": "/pixelport_app/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("## READY FOR CONNECTIONS ##"); println!("{{ \"port\": {} }}", app.tcpinterface.port()); info!("Starting main loop"); while { app.update() } {} info!("Writing document to doc_state.xml"); let mut f = File::create("doc_state.xml").unwrap(); f.write_all(&app...
code_fim
hard
{ "lang": "rust", "repo": "pxlp/river", "path": "/pixelport_app/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>omponentSection ) - > & mut Self { self . bytes . push ( section . id ( ) ) ; section . encode ( & mut self . bytes ) ; self } pub fn as_slice ( & self ) - > & [ u8 ] { & self . bytes } } impl Default for Component { fn default ( ) - > Self { Self : : new ( ) } } impl ComponentSection for CustomSection < ...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified-and-comments-removed", "path": "/third_party/rust/wasm-encoder/src/component.rs", "mode": "spm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_suffix|>impl R { #[inline(always)] pub fn bits(&self) -> u32 { self.bits } #[inline(always)] pub fn efti(&self) -> EFTIR { let bits = ((self.bits >> 29) & 0b111) as u8; EFTIR { bits } } #[inline(always)] pub fn efid2(&self) -> EFID2R { let bits = ((s...
code_fim
hard
{ "lang": "rust", "repo": "romixlab/stcan", "path": "/src/messageram/extended_message_id_filter_f1.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Reader for xtended filter type pub struct EFTIR { bits: u8, } impl EFTIR { pub fn variant(&self) -> FilterType { use FilterType::*; match self.bits { 0b00 => RangeWithMask, 0b01 => DualId, 0b10 => Classic, 0b11 => RangeWithoutMask...
code_fim
hard
{ "lang": "rust", "repo": "romixlab/stcan", "path": "/src/messageram/extended_message_id_filter_f1.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: romixlab/stcan path: /src/messageram/extended_message_id_filter_f1.rs #[doc = r"Value read from the register"] pub struct R { bits: u32, } #[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::ExtendedMessageIdFilterF1 { #[doc = r"Modifies the contents of...
code_fim
hard
{ "lang": "rust", "repo": "romixlab/stcan", "path": "/src/messageram/extended_message_id_filter_f1.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(iter.next(), Some(&40)); assert_eq!(iter.next(), Some(&50)); } #[test] fn iter_fold() { // An iterator method that applies a function, producing a single, final value. Think reduce let a: Vec<_> = (1..=100).collect(); let sum = a.iter().fold(0, |acc, x| acc + x); ...
code_fim
hard
{ "lang": "rust", "repo": "iykekings/rust-iterators", "path": "/src/iter1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iykekings/rust-iterators path: /src/iter1.rs #[cfg(test)] mod test { #[test] fn iter_skip_while() { // Creates an iterator that skips elements based on a predicate. let a = vec![-132, 0, 1]; let mut iter = a.iter().skip_while(|&&x| x < 0); assert_eq!(iter.next(), Some(&0))...
code_fim
hard
{ "lang": "rust", "repo": "iykekings/rust-iterators", "path": "/src/iter1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn iter_find() { // Searches for an element of an iterator that satisfies a predicate. let a = [1, 2, 3, 4]; assert_eq!(a.iter().find(|&&x| x == 3), Some(&3)); assert_eq!(a.iter().find(|&&x| x == 4), Some(&4)); assert_eq!(a.iter().find(|&&x| x == 5), None); } #[test] ...
code_fim
hard
{ "lang": "rust", "repo": "iykekings/rust-iterators", "path": "/src/iter1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // write assert_eq!( end0.set_write_threshold(SOCKET_SIZE * 2).unwrap_err(), ZxError::INVALID_ARGS ); // have space when setting threshold assert!(end0.set_write_threshold(10).is_ok()); assert!(end0.signal().contains(Signal::SOCKET_WR...
code_fim
hard
{ "lang": "rust", "repo": "rcore-os/zCore", "path": "/zircon-object/src/ipc/socket.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rcore-os/zCore path: /zircon-object/src/ipc/socket.rs lt)] struct SocketInner { data: VecDeque<u8>, datagram_len: VecDeque<usize>, read_threshold: usize, write_threshold: usize, read_disabled: bool, } const SOCKET_SIZE: usize = 128 * 2048; impl_kobject!(Socket fn peer(&...
code_fim
hard
{ "lang": "rust", "repo": "rcore-os/zCore", "path": "/zircon-object/src/ipc/socket.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rcore-os/zCore path: /zircon-object/src/ipc/socket.rs hreshold: usize, read_disabled: bool, } const SOCKET_SIZE: usize = 128 * 2048; impl_kobject!(Socket fn peer(&self) -> ZxResult<Arc<dyn KernelObject>> { let peer = self.peer.upgrade().ok_or(ZxError::PEER_CLOSED)?; Ok(...
code_fim
hard
{ "lang": "rust", "repo": "rcore-os/zCore", "path": "/zircon-object/src/ipc/socket.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn matches(&self, candidate: &str) -> bool { self.globset.is_match(candidate) } } fn build_glob_matcher(source: &HashSet<String>) -> Result<GlobSet, globset::Error> { let mut builder = GlobSetBuilder::new(); for item in source { let matcher = GlobBuilder::new(item) ...
code_fim
hard
{ "lang": "rust", "repo": "davidtraff/rmber", "path": "/backend/schema/src/query.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: davidtraff/rmber path: /backend/schema/src/query.rs use std::collections::HashSet; use globset::{GlobBuilder, GlobSet, GlobSetBuilder}; #[derive(Debug)] pub struct QuerySet { points: HashSet<String>, globset: GlobSet, } impl QuerySet { pub fn new<TSource>(source: TSource) -> Resul...
code_fim
hard
{ "lang": "rust", "repo": "davidtraff/rmber", "path": "/backend/schema/src/query.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn make_rule(source_code: Rc<String>) -> LangResult<Rule> { let tokens = super::lexer::tokenize(&source_code)?; let parse_tree = super::parser::parse(source_code.clone(), &tokens)?; Rule::try_from(parse_tree) }<|fim_prefix|>// repo: HactarCE/NDCA path: /src/ast/mod.rs //! Functions and da...
code_fim
medium
{ "lang": "rust", "repo": "HactarCE/NDCA", "path": "/src/ast/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HactarCE/NDCA path: /src/ast/mod.rs //! Functions and data structures for construction, representation, and //! compilation/evaluation of the abstract syntax tree. //! //! Semantically, the AST consists of a top-level Rule node, which contains //! UserFunction nodes, which contain Statement node...
code_fim
hard
{ "lang": "rust", "repo": "HactarCE/NDCA", "path": "/src/ast/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let weapons: Vec<Weapon> = WeaponKind::values() .iter() .map(|k| Weapon::new(*k, false)) .collect(); let mut world = World::new(); let mut resources = Resources::new(); resources.insert(map); resources.insert(weapons); create_physics_resources(&mut resou...
code_fim
hard
{ "lang": "rust", "repo": "smokku/soldank", "path": "/client/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: smokku/soldank path: /client/src/main.rs #[macro_use] extern crate clap; macro_rules! iif( ($cond:expr, $then:expr, $else:expr) => (if $cond { $then } else { $else }) ); mod anims; mod bullet; mod calc; mod cli; mod constants; mod control; mod cvars; mod debug; mod engine; mod game; mod ma...
code_fim
hard
{ "lang": "rust", "repo": "smokku/soldank", "path": "/client/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> AnimData::initialize(&mut filesystem); Soldier::initialize(&mut filesystem, &config); let weapons: Vec<Weapon> = WeaponKind::values() .iter() .map(|k| Weapon::new(*k, false)) .collect(); let mut world = World::new(); let mut resources = Resources::new(); ...
code_fim
hard
{ "lang": "rust", "repo": "smokku/soldank", "path": "/client/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<R: Read + Seek> Seek for RarAesReader<R> { /// Seek to an offset, in bytes, in a stream. /// [Read more](https://doc.rust-lang.org/nightly/std/io/trait.Seek.html#tymethod.seek) /// /// When seeking, this reader takes care of reinitializing the CbcDecryptor with the correct IV. ///...
code_fim
hard
{ "lang": "rust", "repo": "Roba1993/RAR", "path": "/src/aes_reader.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let read = self.read_decrypt(buf)?; Ok(read) } } impl<R: Read + Seek> Seek for RarAesReader<R> { /// Seek to an offset, in bytes, in a stream. /// [Read more](https://doc.rust-lang.org/nightly/std/io/trait.Seek.html#tymethod.seek) /// /// When seeking, this reader take...
code_fim
hard
{ "lang": "rust", "repo": "Roba1993/RAR", "path": "/src/aes_reader.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Roba1993/RAR path: /src/aes_reader.rs use crypto::aessafe::AesSafe256Decryptor; use crypto::blockmodes::{CbcDecryptor, DecPadding, NoPadding}; use crypto::buffer::{BufferResult, ReadBuffer, RefReadBuffer, RefWriteBuffer, WriteBuffer}; use crypto::hmac::Hmac; use crypto::pbkdf2::pbkdf2; use crypt...
code_fim
hard
{ "lang": "rust", "repo": "Roba1993/RAR", "path": "/src/aes_reader.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MayastorControlPlane/mayastor-openapi path: /src/models/create_volume_body_policy_topology_labelled_node_topology.rs /* * Mayastor RESTful API * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI docume...
code_fim
hard
{ "lang": "rust", "repo": "MayastorControlPlane/mayastor-openapi", "path": "/src/models/create_volume_body_policy_topology_labelled_node_topology.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateVolumeBodyPolicyTopologyLabelledNodeTopology { /// exclusive labels #[serde(rename = "exclusion")] pub exclusion: Vec<String>, /// inclusive labels #[serde(rename = "inclusion")] pub inclusion: Vec<String>...
code_fim
medium
{ "lang": "rust", "repo": "MayastorControlPlane/mayastor-openapi", "path": "/src/models/create_volume_body_policy_topology_labelled_node_topology.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl State { /// checks if the state is stopped #[must_use] pub fn is_stopped(&self) -> bool { *self == State::Stopped } } impl Display for State { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str(match self { Self::Initializ...
code_fim
hard
{ "lang": "rust", "repo": "tremor-rs/tremor-runtime", "path": "/src/instance.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tremor-rs/tremor-runtime path: /src/instance.rs // Copyright 2020-2021, The Tremor Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache...
code_fim
hard
{ "lang": "rust", "repo": "tremor-rs/tremor-runtime", "path": "/src/instance.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> f.write_str(match self { Self::Initializing => "initialized", Self::Running => "running", Self::Paused => "paused", Self::Draining => "draining", Self::Stopped => "stopped", Self::Failed => "failed", }) } }<|fim_pr...
code_fim
hard
{ "lang": "rust", "repo": "tremor-rs/tremor-runtime", "path": "/src/instance.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: finitum/dspfs path: /src/dspfs/builder.rs use crate::dspfs::server::Server; use crate::dspfs::Dspfs; use crate::global_store::inmemory::InMemoryStore; use crate::global_store::{SharedStore, Store}; use crate::user::PrivateUser; use anyhow::Result; use ring::pkcs8::Document; use std::collections:...
code_fim
hard
{ "lang": "rust", "repo": "finitum/dspfs", "path": "/src/dspfs/builder.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl DspfsBuilderInMemory { pub fn with_user( &self, (user, document): (PrivateUser, Document), ) -> DspfsBuilderWithStore<InMemoryStore> { let mut store = InMemoryStore::default(); store.set_signing_key(document).unwrap(); store.set_self_user(user.public_us...
code_fim
hard
{ "lang": "rust", "repo": "finitum/dspfs", "path": "/src/dspfs/builder.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dropbox/rust-brotli-decompressor path: /src/bit_reader/mod.rs , 0xFFFFFFFF]; #[inline] pub fn BitMask(n: u32) -> u32 { if false { // Masking with this expression turns to a single // "Unsigned Bit Field Extract" UBFX instruction on ARM. !((0xffffffffu32) << n) } else { fa...
code_fim
hard
{ "lang": "rust", "repo": "dropbox/rust-brotli-decompressor", "path": "/src/bit_reader/mod.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dropbox/rust-brotli-decompressor path: /src/bit_reader/mod.rs ow(non_snake_case)] use core::default::Default; macro_rules! xprintln ( ($a : expr) => (); ($a : expr, $b : expr) => (); ($a : expr, $b : expr, $c : expr) => (); ($a : expr, $b : expr, $c : expr, $d : expr) => (); ($a : expr...
code_fim
hard
{ "lang": "rust", "repo": "dropbox/rust-brotli-decompressor", "path": "/src/bit_reader/mod.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> { let data: [u8; 12] = [0x50, 0x3b, 0xbb, 0x5e, 0xc5, 0x96, 0x81, 0xb7, 0x52, 0x89, 0xea, 0x3d]; let mut bit_reader = BrotliBitReader { val_: 0xe1e56a736e04fbf5, bit_pos_: 6, avail_in: 12, next_in: 0, }; let mut val: u32 = 0; let ret = Brot...
code_fim
hard
{ "lang": "rust", "repo": "dropbox/rust-brotli-decompressor", "path": "/src/bit_reader/mod.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>pub const OGF_STATUS_PARAM: u8 = 0x05; pub const OCF_READ_RSSI: u16 = 0x0005; pub const OGF_LE_CTL: u8 = 0x08; pub const OCF_LE_SET_EVENT_MASK: u16 = 0x0001; pub const OCF_LE_SET_SCAN_PARAMETERS: u16 = 0x000b; pub const OCF_LE_SET_SCAN_ENABLE: u16 = 0x000c; pub const OCF_LE_CREATE_CONN: u16 = 0x000d; pub...
code_fim
hard
{ "lang": "rust", "repo": "connectedcars/rumble", "path": "/src/bluez/constants.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }