file_name large_stringlengths 4 69 | prefix large_stringlengths 0 26.7k | suffix large_stringlengths 0 24.8k | middle large_stringlengths 0 2.12k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
softmax.rs | use alumina_core::{
base_ops::{OpInstance, OpSpecification},
errors::{ExecutionError, GradientError, OpBuildError, ShapePropError},
exec::ExecutionContext,
grad::GradientContext,
graph::{Graph, Node, NodeID},
shape_prop::ShapePropContext,
util::wrap_dim,
};
use indexmap::{indexset, IndexMap, IndexSet};
use ndarr... |
}
/// Softmax OpInstance
#[derive(Clone, Debug)]
pub struct SoftmaxInstance {
logits: NodeID,
output: NodeID,
axis: usize,
}
impl OpInstance for SoftmaxInstance {
fn type_name(&self) -> &'static str {
"Softmax"
}
fn as_specification(&self, graph: &Graph) -> Box<dyn Any> {
Box::new(Softmax {
logits: gra... | {
Ok(SoftmaxInstance {
logits: self.logits.id(),
output: self.output.id(),
axis: self.axis,
})
} | identifier_body |
softmax.rs | use alumina_core::{
base_ops::{OpInstance, OpSpecification},
errors::{ExecutionError, GradientError, OpBuildError, ShapePropError},
exec::ExecutionContext,
grad::GradientContext,
graph::{Graph, Node, NodeID},
shape_prop::ShapePropContext,
util::wrap_dim,
};
use indexmap::{indexset, IndexMap, IndexSet};
use ndarr... |
ctx.merge_output_shape(&self.logits_grad, &logits_shape.slice().into())
}
fn execute(&self, ctx: &ExecutionContext) -> Result<(), ExecutionError> {
Zip::from(ctx.get_output(&self.logits_grad).lanes_mut(Axis(self.axis)))
.and(ctx.get_input(&self.logits).lanes(Axis(self.axis)))
.and(ctx.get_input(&self.out... | {
return Err(format!("SoftmaxBack requires the output grad to have the shape of the logits: logits:{:?} output_grad:{:?}, axis: {}", logits_shape.slice(), output_grad_shape.slice(), self.axis).into());
} | conditional_block |
mod.rs | mod task;
mod worker;
use crate::executor::Executor;
use crossbeam::{
deque::{Injector, Stealer, Worker},
queue::ArrayQueue,
};
use futures::Future;
use std::{
io,
sync::{atomic::Ordering, Arc},
thread::JoinHandle,
};
use task::Task;
/// An executor which distributes tasks across multiple threads ... | (&mut self, shutdown: usize) {
self.shutdown = true;
for (_, handle) in &self.workers {
handle.state.store(shutdown, Ordering::Release);
handle.unparker.unpark();
}
while let Some((thread, _)) = self.workers.pop() {
let _ = thread.join();
}
... | shutdown_priv | identifier_name |
mod.rs | mod task;
mod worker;
use crate::executor::Executor;
use crossbeam::{
deque::{Injector, Stealer, Worker},
queue::ArrayQueue,
};
use futures::Future;
use std::{
io,
sync::{atomic::Ordering, Arc},
thread::JoinHandle,
};
use task::Task;
/// An executor which distributes tasks across multiple threads ... |
});
CustomFuture { waker, shared }
}
}
impl Future for CustomFuture {
type Output = ();
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
if self.shared.load(Ordering::SeqCst) {
... | {
waker.wake();
shared_thread.store(true, Ordering::SeqCst);
} | conditional_block |
mod.rs | mod task;
mod worker;
use crate::executor::Executor;
use crossbeam::{
deque::{Injector, Stealer, Worker},
queue::ArrayQueue,
};
use futures::Future;
use std::{
io,
sync::{atomic::Ordering, Arc},
thread::JoinHandle,
};
use task::Task;
/// An executor which distributes tasks across multiple threads ... |
#[test]
fn custom_thread_count() {
let executor = ThreadPool::with_threads(32).unwrap();
executor.spawn(async {});
}
#[test]
#[ignore]
fn bad_future() {
// A future that spawns a thread, returns Poll::Ready(()), and
// keeps trying to reschedule itself on the t... | {
let executor = ThreadPool::with_threads(0).unwrap();
executor.spawn(async {});
} | identifier_body |
mod.rs | mod task;
mod worker;
use crate::executor::Executor;
use crossbeam::{
deque::{Injector, Stealer, Worker},
queue::ArrayQueue,
};
use futures::Future;
use std::{
io,
sync::{atomic::Ordering, Arc},
thread::JoinHandle,
};
use task::Task;
/// An executor which distributes tasks across multiple threads ... | #[test]
fn custom_thread_count() {
let executor = ThreadPool::with_threads(32).unwrap();
executor.spawn(async {});
}
#[test]
#[ignore]
fn bad_future() {
// A future that spawns a thread, returns Poll::Ready(()), and
// keeps trying to reschedule itself on the thr... | let executor = ThreadPool::with_threads(0).unwrap();
executor.spawn(async {});
}
| random_line_split |
main.rs | // Copyright (c) 2020 DDN. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
use futures::{channel::oneshot, FutureExt, TryFutureExt, TryStreamExt};
use iml_agent_comms::{
error::ImlAgentCommsError,
flush_queue,
host::{self, SharedH... |
Ok(())
}
async fn session_create_req_handler(
sessions: &mut Sessions,
client: Connection,
fqdn: Fqdn,
plugin: PluginName,
) -> Result<(), ImlAgentCommsError> {
let session = Session::new(plugin.clone(), fqdn.clone());
tracing::info!("Creating session {}", session);
let last_opt = s... | {
tracing::warn!("Terminating session because unknown {}", data);
send_message(
client.clone(),
"",
AGENT_TX_RUST,
ManagerMessage::SessionTerminate {
fqdn: data.fqdn,
plugin: data.plugin,
session_id: data.se... | conditional_block |
main.rs | // Copyright (c) 2020 DDN. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
use futures::{channel::oneshot, FutureExt, TryFutureExt, TryStreamExt};
use iml_agent_comms::{
error::ImlAgentCommsError,
flush_queue,
host::{self, SharedH... |
tracing::debug!(
"Put data on host queue {}: Queue size: {:?}",
fqdn,
queue.len()
);
} else {
tracing::warn!(
"Dropping message to {:?} because it ... | queue.push_back(msg.data); | random_line_split |
main.rs | // Copyright (c) 2020 DDN. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
use futures::{channel::oneshot, FutureExt, TryFutureExt, TryStreamExt};
use iml_agent_comms::{
error::ImlAgentCommsError,
flush_queue,
host::{self, SharedH... | () -> Result<(), Box<dyn std::error::Error>> {
iml_tracing::init();
// Handle an error in locks by shutting down
let (tx, rx) = oneshot::channel();
let shared_hosts = host::shared_hosts();
let shared_hosts2 = Arc::clone(&shared_hosts);
let shared_hosts3 = Arc::clone(&shared_hosts);
tokio:... | main | identifier_name |
mod.rs | mod workflow_machines;
// TODO: Move all these inside a submachines module
#[allow(unused)]
mod activity_state_machine;
#[allow(unused)]
mod cancel_external_state_machine;
#[allow(unused)]
mod cancel_workflow_state_machine;
#[allow(unused)]
mod child_workflow_state_machine;
mod complete_workflow_state_machine;
#[allow... | (&self) -> bool {
self.was_cancelled_before_sent_to_server()
}
}
/// Exists purely to allow generic implementation of `is_final_state` for all [StateMachine]
/// implementors
trait CheckStateMachineInFinal {
/// Returns true if the state machine is in a final state
fn is_final_state(&self) -> bool;... | was_cancelled_before_sent_to_server | identifier_name |
mod.rs | mod workflow_machines;
// TODO: Move all these inside a submachines module
#[allow(unused)]
mod activity_state_machine;
#[allow(unused)]
mod cancel_external_state_machine;
#[allow(unused)]
mod cancel_workflow_state_machine;
#[allow(unused)]
mod child_workflow_state_machine;
mod complete_workflow_state_machine;
#[allow... |
}
/// Exists purely to allow generic implementation of `is_final_state` for all [StateMachine]
/// implementors
trait CheckStateMachineInFinal {
/// Returns true if the state machine is in a final state
fn is_final_state(&self) -> bool;
}
impl<SM> CheckStateMachineInFinal for SM
where
SM: StateMachine,
{... | {
self.was_cancelled_before_sent_to_server()
} | identifier_body |
mod.rs | mod workflow_machines;
// TODO: Move all these inside a submachines module
#[allow(unused)]
mod activity_state_machine;
#[allow(unused)] | mod cancel_external_state_machine;
#[allow(unused)]
mod cancel_workflow_state_machine;
#[allow(unused)]
mod child_workflow_state_machine;
mod complete_workflow_state_machine;
#[allow(unused)]
mod continue_as_new_workflow_state_machine;
#[allow(unused)]
mod fail_workflow_state_machine;
#[allow(unused)]
mod local_activit... | random_line_split | |
cimport.rs | use libc::{c_char, c_uint, c_float, c_int};
use scene::RawScene;
use types::{AiString, MemoryInfo};
use fileio::{AiFileIO};
/// Represents an opaque set of settings to be used during importing.
#[repr(C)]
pub struct | {
sentinel: c_char,
}
#[link(name = "assimp")]
extern {
/// Reads the given file and returns its content.
///
/// If the call succeeds, the imported data is returned in an aiScene
/// structure. The data is intended to be read-only, it stays property of
/// the ASSIMP library and will be sta... | PropertyStore | identifier_name |
cimport.rs | use libc::{c_char, c_uint, c_float, c_int};
use scene::RawScene;
use types::{AiString, MemoryInfo};
use fileio::{AiFileIO};
/// Represents an opaque set of settings to be used during importing.
#[repr(C)]
pub struct PropertyStore {
sentinel: c_char,
}
#[link(name = "assimp")]
extern {
/// Reads the given fi... | ///
/// * props PropertyStore instance containing import settings.
pub fn aiImportFileFromMemoryWithProperties(buf: *const c_char,
len: c_uint,
flags: c_uint,
hint: *const c_ch... | /// Same as aiImportFileFromMemory, but adds an extra parameter
/// containing importer settings. | random_line_split |
stacks.rs | //! Generate a Wasm program that keeps track of its current stack frames.
//!
//! We can then compare the stack trace we observe in Wasmtime to what the Wasm
//! program believes its stack should be. Any discrepencies between the two
//! points to a bug in either this test case generator or Wasmtime's stack
//! walker.... |
fn validate(wasm: &[u8]) {
let mut validator = Validator::new();
let err = match validator.validate_all(wasm) {
Ok(_) => return,
Err(e) => e,
};
drop(std::fs::write("test.wasm", wasm));
if let Ok(text) = wasmprinter::print_bytes(wasm) {
d... | {
let mut rng = SmallRng::seed_from_u64(0);
let mut buf = vec![0; 2048];
for _ in 0..1024 {
rng.fill_bytes(&mut buf);
let u = Unstructured::new(&buf);
if let Ok(stacks) = Stacks::arbitrary_take_rest(u) {
let wasm = stacks.wasm();
... | identifier_body |
stacks.rs | //! Generate a Wasm program that keeps track of its current stack frames.
//!
//! We can then compare the stack trace we observe in Wasmtime to what the Wasm
//! program believes its stack should be. Any discrepencies between the two
//! points to a bug in either this test case generator or Wasmtime's stack
//! walker.... | vec![wasm_encoder::ValType::I32, wasm_encoder::ValType::I32],
);
let null_type = types.len();
types.function(vec![], vec![]);
let call_func_type = types.len();
types.function(vec![wasm_encoder::ValType::FUNCREF], vec![]);
section(&mut module, types);
... | let get_stack_type = types.len();
types.function(
vec![], | random_line_split |
stacks.rs | //! Generate a Wasm program that keeps track of its current stack frames.
//!
//! We can then compare the stack trace we observe in Wasmtime to what the Wasm
//! program believes its stack should be. Any discrepencies between the two
//! points to a bug in either this test case generator or Wasmtime's stack
//! walker.... | (u: &mut Unstructured) -> Result<Vec<Function>> {
let mut funcs = vec![Function::default()];
// The indices of functions within `funcs` that we still need to
// generate.
let mut work_list = vec![0];
while let Some(f) = work_list.pop() {
let mut ops = Vec::with_capa... | arbitrary_funcs | identifier_name |
window.rs | struct Window {
window: winit::window::Window,
last_frame_time: std::time::Instant,
alive: Arc<()>,
app_handle: app::AppHandle,
invalidate_amount: InvalidateAmount,
// Everything for rendering
surface: wgpu::Surface,
gpu_device: wgpu::Device,
swap_chain_desc: wgpu::SwapChainDescrip... | } | random_line_split | |
window.rs | invalidate_amount: Cell<InvalidateAmount>,
}
impl LayoutContext<'_> {
/// Requests invalidation of the specified `amount` after the current frame is
/// finished. The resulting requested invalidation amount is the maximum of
/// all `request_invalidate()` calls for one frame.
#[inline]
pub fn requ... | (&mut self) {
let val = std::mem::replace(&mut *self.imgui_context, unsafe {
std::mem::MaybeUninit::uninit().assume_init()
});
self.wrapped_window.imgui = ImguiContext::Suspended(val.suspend());
}
}
impl Deref for ActiveWindow<'_> {
type Target = Window;
fn deref(&self)... | drop | identifier_name |
window.rs | std::time::Duration {
let now = std::time::Instant::now();
let frame_delta = now - self.last_frame_time;
self.last_frame_time = now;
frame_delta
}
/// Creates a standard top level window.
///
/// Call this method inside the closure passed to `App::new_window()`.
p... | {
return Err(ErrorCode::WINDOW_DOES_NOT_EXIST.into());
} | conditional_block | |
window.rs | invalidate_amount: Cell<InvalidateAmount>,
}
impl LayoutContext<'_> {
/// Requests invalidation of the specified `amount` after the current frame is
/// finished. The resulting requested invalidation amount is the maximum of
/// all `request_invalidate()` calls for one frame.
#[inline]
pub fn requ... |
}
/// A window prepared to be updated.
///
/// This struct is used to disjoin the lifetimes of the `Window` with that of the
/// `imgui::Context`.
pub struct ActiveWindow<'a> {
/// The imgui context of the `window`.
pub imgui_context: std::mem::ManuallyDrop<imgui::Context>,
/// The original native window,... | {
&mut self.renderer.textures
} | identifier_body |
main.rs | #![feature(try_trait)]
#![feature(label_break_value)]
extern crate serenity;
mod converter;
mod arc_commands;
mod message_helper;
use message_helper::MessageHelper;
use std::sync::{Arc, Mutex};
use std::process::Command;
use serenity::model::prelude::*;
use serenity::prelude::*;
use serenity::utils::MessageBuilder;
u... | else {
message.say("Channel was not set");
}
}
}
} else {
message.reply("You do not have the proper permissions to set the channel.");
}
}
impl EventHandler for Handler {
fn message(&self, context: Context, message: Message) {
let mes... | {
message.say("Channel unset");
} | conditional_block |
main.rs | #![feature(try_trait)]
#![feature(label_break_value)]
extern crate serenity;
mod converter;
mod arc_commands;
mod message_helper;
use message_helper::MessageHelper;
use std::sync::{Arc, Mutex};
use std::process::Command;
use serenity::model::prelude::*;
use serenity::prelude::*;
use serenity::utils::MessageBuilder;
u... | (label_paths: &[&str]) {
hash40::set_labels(
label_paths
.iter()
.map(|label| hash40::read_labels(label).unwrap())
.flatten()
)
}
fn update(message: &MessageHelper) {
let update_output =
match Command::new("sh").arg("update.sh").output() {
Ok(x) ... | update_labels | identifier_name |
main.rs | #![feature(try_trait)]
#![feature(label_break_value)]
extern crate serenity;
mod converter;
mod arc_commands;
mod message_helper;
use message_helper::MessageHelper;
use std::sync::{Arc, Mutex};
use std::process::Command;
use serenity::model::prelude::*;
use serenity::prelude::*;
use serenity::utils::MessageBuilder;
u... |
}
use converter::SUPPORTED_TYPES;
static HELP_TEXT: &str =
"%convert [args] - convert file even if channel isn't set
%help - display this message\n\
%set_channel - watch this channel for files\n\
%unset_channel - don't watch this channel to watch for files\n\
%update - update param labels and install paramxml if no... | {
Handler {
channel_id: Arc::new(Mutex::new(channels.into_iter().collect())),
..Default::default()
}
} | identifier_body |
main.rs | #![feature(try_trait)]
#![feature(label_break_value)]
extern crate serenity;
mod converter;
mod arc_commands;
mod message_helper;
use message_helper::MessageHelper;
use std::sync::{Arc, Mutex};
use std::process::Command;
use serenity::model::prelude::*;
use serenity::prelude::*;
use serenity::utils::MessageBuilder;
u... | enum SetUnset {
Set,
Unset
}
use SetUnset::*;
fn save_channels(channel_ids: &BTreeSet<ChannelId>, message: &MessageHelper, owner: &User) {
if let Err(e) = fs::write(
CHANNELS_PATH,
channel_ids.iter()
.map(ToString::to_string)
.collect::<Vec<_>>()
.join("\n"... | Arthur, Dr. Hypercake, Birdwards, SMG, Meshima, TNN, Blazingflare, TheSmartKid - Param labels\n\
coolsonickirby, SushiiZ - testing help";
| random_line_split |
ext.rs | use digest::Digest;
use hmac::crypto_mac::MacError;
use hmac::{Hmac, Mac, NewMac};
use typenum::Unsigned;
use crate::arithmetic::*;
use crate::elliptic::curves::{Curve, ECScalar, Point, Scalar};
/// [Digest] extension allowing to hash elliptic points, scalars, and bigints
///
/// Can be used with any hashing algorith... |
}
unreachable!("The probably of this reaching is extremely small ((2^n-q)/(2^n))^(2^32)")
}
fn digest_bigint(bytes: &[u8]) -> BigInt {
Self::new().chain(bytes).result_bigint()
}
}
/// [Hmac] extension allowing to use bigints to instantiate hmac, update, and finalize it.
pub trait ... | {
return scalar;
} | conditional_block |
ext.rs | use digest::Digest;
use hmac::crypto_mac::MacError;
use hmac::{Hmac, Mac, NewMac};
use typenum::Unsigned;
use crate::arithmetic::*;
use crate::elliptic::curves::{Curve, ECScalar, Point, Scalar};
/// [Digest] extension allowing to hash elliptic points, scalars, and bigints
///
/// Can be used with any hashing algorith... | mut self,
scalars: impl IntoIterator<Item = &'s Scalar<E>>,
) -> Self
where
Self: Sized,
{
for scalar in scalars {
self.input_scalar(scalar)
}
self
}
fn result_bigint(self) -> BigInt;
fn result_scalar<E: Curve>(self) -> Scalar<E>;
... | self
}
fn chain_scalars<'s, E: Curve>( | random_line_split |
ext.rs | use digest::Digest;
use hmac::crypto_mac::MacError;
use hmac::{Hmac, Mac, NewMac};
use typenum::Unsigned;
use crate::arithmetic::*;
use crate::elliptic::curves::{Curve, ECScalar, Point, Scalar};
/// [Digest] extension allowing to hash elliptic points, scalars, and bigints
///
/// Can be used with any hashing algorith... | <E: Curve>() {
let generator = Point::<E>::generator();
let base_point2 = Point::<E>::base_point2();
let result1 = Sha256::new()
.chain_point(&generator)
.chain_point(base_point2)
.result_scalar::<E>();
assert!(result1.to_bigint().bit_length() > 240);
... | create_sha256_from_ge_test | identifier_name |
ext.rs | use digest::Digest;
use hmac::crypto_mac::MacError;
use hmac::{Hmac, Mac, NewMac};
use typenum::Unsigned;
use crate::arithmetic::*;
use crate::elliptic::curves::{Curve, ECScalar, Point, Scalar};
/// [Digest] extension allowing to hash elliptic points, scalars, and bigints
///
/// Can be used with any hashing algorith... |
}
/// [Hmac] extension allowing to use bigints to instantiate hmac, update, and finalize it.
pub trait HmacExt: Sized {
fn new_bigint(key: &BigInt) -> Self;
fn input_bigint(&mut self, n: &BigInt);
fn chain_bigint(mut self, n: &BigInt) -> Self
where
Self: Sized,
{
self.input_bigin... | {
Self::new().chain(bytes).result_bigint()
} | identifier_body |
oldlib.rs | extern crate byteorder;
// use byteorder::{WriteBytesExt, LE};
// use std::io::{self, Cursor, Read, Write};
pub const MAX_SAMPLES_PER_FRAME: usize = 1152 * 2;
/// More than ISO spec's
pub const MAX_FREE_FORMAT_FRAME_SIZE: usize = 2304;
pub const MAX_FRAME_SYNC_MATCHES: usize = 10;
/// MUST be >= 320000/8/32000*1152 ... | (h: &[u8]) -> bool {
(h[2] & 0x2)!= 0
}
pub fn hdr_test_mpeg1(h: &[u8]) -> bool {
(h[1] & 0x08)!= 0
}
pub fn hdr_test_not_mpeg25(h: &[u8]) -> bool {
(h[1] & 0x10)!= 0
}
pub fn hdr_test_i_stereo(h: &[u8]) -> bool {
(h[3] & 0x10)!= 0
}
pub fn hdr_test_ms_stereo(h: &[u8]) -> bool {
(h[3] & 0x20)!= ... | hdr_test_padding | identifier_name |
oldlib.rs | extern crate byteorder;
// use byteorder::{WriteBytesExt, LE};
// use std::io::{self, Cursor, Read, Write};
pub const MAX_SAMPLES_PER_FRAME: usize = 1152 * 2;
/// More than ISO spec's
pub const MAX_FREE_FORMAT_FRAME_SIZE: usize = 2304;
pub const MAX_FRAME_SYNC_MATCHES: usize = 10;
/// MUST be >= 320000/8/32000*1152 ... |
self.pos += n as usize;
p += 1;
next = p & (255 >> s);
while shl > 0 {
shl -= 8;
cache |= next << shl;
next = p;
p += 1;
}
return cache | (next >> -shl);
}
}
/*
pub fn hdr_valid(h: &[u8]) -> bool {
h[0] == 0xFF
... | {
return 0;
} | conditional_block |
oldlib.rs | extern crate byteorder;
// use byteorder::{WriteBytesExt, LE};
// use std::io::{self, Cursor, Read, Write};
pub const MAX_SAMPLES_PER_FRAME: usize = 1152 * 2;
/// More than ISO spec's
pub const MAX_FREE_FORMAT_FRAME_SIZE: usize = 2304;
pub const MAX_FRAME_SYNC_MATCHES: usize = 10;
/// MUST be >= 320000/8/32000*1152 ... | 4
} else {
1
}
} else {
0
}
}
pub fn L12_subband_alloc_table(hdr: &[u8], sci: &mut L12ScaleInfo) -> Vec<L12SubbandAlloc> {
let mode = hdr_get_stereo_mode(hdr) as usize;
let mut nbands;
let mut alloc: Vec<L12SubbandAlloc> = vec![];
let stereo_bands ... | random_line_split | |
oldlib.rs | extern crate byteorder;
// use byteorder::{WriteBytesExt, LE};
// use std::io::{self, Cursor, Read, Write};
pub const MAX_SAMPLES_PER_FRAME: usize = 1152 * 2;
/// More than ISO spec's
pub const MAX_FREE_FORMAT_FRAME_SIZE: usize = 2304;
pub const MAX_FRAME_SYNC_MATCHES: usize = 10;
/// MUST be >= 320000/8/32000*1152 ... |
}
/*
pub fn hdr_valid(h: &[u8]) -> bool {
h[0] == 0xFF
&& ((h[1] & 0xF0) == 0xF0 || (h[1] & 0xFE) == 0xE2)
&& hdr_get_layer(h)!= 0
&& hdr_get_bitrate(h)!= 15
&& hdr_get_sample_rate(h)!= 3
}
pub fn hdr_compare(h1: &[u8], h2: &[u8]) -> bool {
hdr_valid(h2)
&& ((h1[1] ^ h... | {
let mut next: u32;
let mut cache: u32 = 0;
let s = (self.pos & 7) as u32;
let mut shl: i32 = n as i32 + s as i32;
let mut p = self.pos as u32 / 8;
if self.pos + (n as usize) > self.limit {
return 0;
}
self.pos += n as usize;
p += 1;
... | identifier_body |
main.rs | extern crate rand;
extern crate getopts;
extern crate num_cpus;
extern crate cards;
extern crate poker_hands;
use std::env;
use std::collections::HashMap;
use std::str::FromStr;
use std::thread;
use std::sync::*;
use getopts::{Options, Matches, HasArg, Occur};
use rand::{thread_rng, Rng};
use cards::{Card, Rank, Suit... | let num_cards = chars.len() / 2;
let mut cards = Vec::with_capacity(num_cards);
for card_index in 0..num_cards {
let rank_index = card_index * 2;
let suit_index = rank_index + 1;
let rank_char = chars[rank_index];
let suit_char = chars[suit_index];
let rank = parse_ra... | let chars: Vec<char> = cards_string.chars().collect();
assert!(chars.len() % 2 == 0, "Odd numbers of characters, cannot be cards: {}", cards_string);
| random_line_split |
main.rs | extern crate rand;
extern crate getopts;
extern crate num_cpus;
extern crate cards;
extern crate poker_hands;
use std::env;
use std::collections::HashMap;
use std::str::FromStr;
use std::thread;
use std::sync::*;
use getopts::{Options, Matches, HasArg, Occur};
use rand::{thread_rng, Rng};
use cards::{Card, Rank, Suit... |
fn get_num_threads(matches: &Matches) -> i32 {
get_numeric_arg(matches, NUM_THREADS_ARG, num_cpus::get() as i32)
}
fn get_numeric_arg(matches: &Matches, arg: &str, default: i32) -> i32 {
if!matches.opt_present(arg) {
return default;
}
let num_str = matches.opt_str(arg).unwrap();
let num_m... | {
get_numeric_arg(matches, NUM_SIMS_ARG, DEFAULT_NUM_SIMS)
} | identifier_body |
main.rs | extern crate rand;
extern crate getopts;
extern crate num_cpus;
extern crate cards;
extern crate poker_hands;
use std::env;
use std::collections::HashMap;
use std::str::FromStr;
use std::thread;
use std::sync::*;
use getopts::{Options, Matches, HasArg, Occur};
use rand::{thread_rng, Rng};
use cards::{Card, Rank, Suit... | () -> Options {
// Unfortunately, there doesn't seem to be a way to require that an option appears at least once.
let mut opts = Options::new();
opts.opt(HOLE_CARDS_ARG, "hole cards", "A single player's hole cards", "XxYy", HasArg::Yes, Occur::Multi);
opts.opt(NUM_SIMS_ARG, "number of simulations", "The... | create_opts | identifier_name |
main.rs | extern crate rand;
extern crate getopts;
extern crate num_cpus;
extern crate cards;
extern crate poker_hands;
use std::env;
use std::collections::HashMap;
use std::str::FromStr;
use std::thread;
use std::sync::*;
use getopts::{Options, Matches, HasArg, Occur};
use rand::{thread_rng, Rng};
use cards::{Card, Rank, Suit... | else {
get_num_sims(&arg_matches)
};
let all_hole_cards = get_hole_cards(&arg_matches);
let num_threads = get_num_threads(&arg_matches);
println!("Simulating {} hands", total_num_sims);
if initial_board.len() > 0 {
println!("For board {:?}", initial_board);
}
println!("Usin... | {
println!("The given board is full, so there's no uncertainty.");
1
} | conditional_block |
day18.rs | use crate::day::{DayResult, PartResult};
use chumsky::prelude::*;
use itertools::Itertools;
use std::{collections::LinkedList, ops::Add, str::FromStr};
pub fn run() -> Result<DayResult, Box<dyn std::error::Error>> {
let part1 = part1(include_str!("inputs/day18.txt"))?;
let part2 = part2(include_str!("inputs/da... | [[[[5,4],[7,7]],8],[[8,3],8]]
[[9,3],[[9,9],[6,[4,9]]]]
[[2,[[7,7],7]],[[5,8],[[9,3],[0,2]]]]
[[[[5,2],5],[8,[3,7]]],[[5,[7,5]],[4,4]]]",
)
.unwrap();
assert_eq!(result, 4140);
}
#[test]
fn test_part2_sample() {
let result = part2(
"[[[0,[5,8]],[[1,7],[9,6]]],[[4,[1,2]],[[1,4],2]]]
[[[5,[2,8]],4... | random_line_split | |
day18.rs | use crate::day::{DayResult, PartResult};
use chumsky::prelude::*;
use itertools::Itertools;
use std::{collections::LinkedList, ops::Add, str::FromStr};
pub fn run() -> Result<DayResult, Box<dyn std::error::Error>> {
let part1 = part1(include_str!("inputs/day18.txt"))?;
let part2 = part2(include_str!("inputs/da... | (&self) -> Self {
Self {
value: self.value,
depth: self.depth + 1,
}
}
}
impl SnailfishNumber {
fn split(&mut self) -> bool {
if let Some(index_to_split) = self
.values
.iter()
.enumerate()
.filter(|(_, v)| v.value >= 1... | deeper | identifier_name |
day18.rs | use crate::day::{DayResult, PartResult};
use chumsky::prelude::*;
use itertools::Itertools;
use std::{collections::LinkedList, ops::Add, str::FromStr};
pub fn run() -> Result<DayResult, Box<dyn std::error::Error>> {
let part1 = part1(include_str!("inputs/day18.txt"))?;
let part2 = part2(include_str!("inputs/da... |
fn part2(input: &str) -> Result<u32, Box<dyn std::error::Error>> {
let sfns = input
.lines()
.map(|l| SnailfishNumber::from_str(l))
.collect::<Result<Vec<_>, _>>()?;
let pairs = sfns.into_iter().permutations(2);
let magnitudes = pairs.map(|p| (p[0].clone() + p[1].clone()).magnitude())... | {
let mut sfns = input
.lines()
.map(|l| SnailfishNumber::from_str(l))
.collect::<Result<LinkedList<_>, _>>()?;
let first = sfns.pop_front().ok_or(format!("No numbers were parsed"))?;
let result = sfns.into_iter().fold(first, |a, x| a + x);
Ok(result.magnitude())
} | identifier_body |
stream.rs | #![allow(dead_code)]
use libc;
use listpack::*;
use rax::*;
use sds::*;
use std;
use std::default::Default;
use std::fmt;
use std::mem::size_of;
use std::ptr;
pub struct Stream {
pub s: *mut stream,
}
const STREAM_ID: StreamID = StreamID { ms: 0, seq: 0 };
const STREAM_ID_REF: *const StreamID = &STREAM_ID as *co... |
unsafe {
StreamID {
ms: u64::from_be(*(ptr as *mut [u8; 8] as *mut u64)),
seq: u64::from_be(*(ptr.offset(8) as *mut [u8; 8] as *mut u64)),
}
}
}
}
#[derive(Clone, Copy)]
#[repr(C)]
pub struct EntryPack;
//use std::fs::File;
//use std::io::p... | {
return StreamID::default();
} | conditional_block |
stream.rs | #![allow(dead_code)]
use libc;
use listpack::*;
use rax::*;
use sds::*;
use std;
use std::default::Default;
use std::fmt;
use std::mem::size_of;
use std::ptr;
pub struct Stream {
pub s: *mut stream,
}
const STREAM_ID: StreamID = StreamID { ms: 0, seq: 0 };
const STREAM_ID_REF: *const StreamID = &STREAM_ID as *co... | (&self) -> (*const u8, usize) {
(self as *const _ as *const u8, size_of::<StreamID>())
}
fn from_buf(ptr: *const u8, len: usize) -> StreamID {
if len!= size_of::<StreamID>() {
return StreamID::default();
}
unsafe {
StreamID {
ms: u64::fro... | to_buf | identifier_name |
stream.rs | #![allow(dead_code)]
use libc;
use listpack::*;
use rax::*;
use sds::*;
use std;
use std::default::Default;
use std::fmt;
use std::mem::size_of;
use std::ptr;
pub struct Stream {
pub s: *mut stream,
}
const STREAM_ID: StreamID = StreamID { ms: 0, seq: 0 };
const STREAM_ID_REF: *const StreamID = &STREAM_ID as *co... | s: *const libc::c_char,
value: *mut libc::uint64_t,
) -> libc::c_int;
fn streamCreateNACK(
consumer: *mut streamConsumer
) -> *mut streamNACK;
fn streamFreeNACK(
na: *mut streamNACK
);
fn streamFreeConsumer(
sc: *mut streamConsumer
);
fn stream... | random_line_split | |
stream.rs | #![allow(dead_code)]
use libc;
use listpack::*;
use rax::*;
use sds::*;
use std;
use std::default::Default;
use std::fmt;
use std::mem::size_of;
use std::ptr;
pub struct Stream {
pub s: *mut stream,
}
const STREAM_ID: StreamID = StreamID { ms: 0, seq: 0 };
const STREAM_ID_REF: *const StreamID = &STREAM_ID as *co... |
fn deserialize() -> *mut listpack {
std::ptr::null_mut()
}
fn append(lp: *mut listpack, fields: &[Sds]) -> *mut listpack {
/* Create a new listpack and radix tree node if needed. Note that when
* a new listpack is created, we populate it with a "master entry". This
* is just a s... | {
// std::fs::File::open()
//
// let mut f = File::open(filename).expect("file not found");
//
// let mut contents = String::new();
// f.read_to_string(&mut contents)
// .expect("something went wrong reading the file");
} | identifier_body |
vk.rs | use vulkano::device::Queue;
use vulkano::swapchain::Surface;
use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer };
use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState};
use vulkano::device::{Device, DeviceExtensions};
use vulkano::format::Format;
use vulkano::framebuffer::{Framebuffer, FramebufferA... | () -> Result<Self, Box<dyn Error>> {
println!("Beginning Vulkan setup...");
let instance = {
let extensions = vulkano_win::required_extensions();
Instance::new(None, &extensions, None)
}?;
// We then choose which physical device to use.
//
// In a... | new | identifier_name |
vk.rs | use vulkano::device::Queue;
use vulkano::swapchain::Surface;
use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer };
use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState};
use vulkano::device::{Device, DeviceExtensions};
use vulkano::format::Format;
use vulkano::framebuffer::{Framebuffer, FramebufferA... |
void main() {
gl_Position = vec4(position, 1.0);
fragColour = colour;
}
"
}
}
mod fs {
vulkano_shaders::shader! {
ty: "fragment",
src: "
#version 450
layout(location = 0) in vec4 fr... | random_line_split | |
windows.rs | it might run out of memory.
// Now the way we would normally handle this is to have a counter and limit the
// number of outstandig buffers, queueing requests and only handle them when the
// counter is below the high water mark. The same goes for using unlimited timeouts.
// http://www.serverframework.com/asynchronou... |
let mut overlapped = ffi::WSAOVERLAPPED::zeroed();
ffi::post_queued_completion_status(self.completion_port, 0, 0, &mut overlapped)?;
Ok(())
}
}
// possible Arc<InnerSelector> needed
#[derive(Debug)]
pub struct Selector {
completion_port: isize,
}
impl Selector {
pub fn new() -> io... | {
return Err(io::Error::new(
io::ErrorKind::Interrupted,
"Poll instance is dead.",
));
} | conditional_block |
windows.rs | it might run out of memory.
// Now the way we would normally handle this is to have a counter and limit the
// number of outstandig buffers, queueing requests and only handle them when the
// counter is below the high water mark. The same goes for using unlimited timeouts.
// http://www.serverframework.com/asynchronou... | (token: usize) -> Self {
Operation {
wsaoverlapped: WSAOVERLAPPED::zeroed(),
token,
}
}
}
// You can find most of these here: https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types
/// The HANDLE type is actually a `*mut c_v... | new | identifier_name |
windows.rs | it might run out of memory.
// Now the way we would normally handle this is to have a counter and limit the
// number of outstandig buffers, queueing requests and only handle them when the
// counter is below the high water mark. The same goes for using unlimited timeouts.
// http://www.serverframework.com/asynchronou... | } else {
Ok(ul_num_entries_removed)
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn selector_new_creates_valid_port() {
let selector = Selector::new().expect("create completion port failed");
assert!(selector.completion_port > 0);
}
#[test]... | {
let mut ul_num_entries_removed: u32 = 0;
// can't coerce directly to *mut *mut usize and cant cast `&mut` as `*mut`
// let completion_key_ptr: *mut &mut usize = completion_key_ptr;
// // but we can cast a `*mut ...`
// let completion_key_ptr: *mut *mut usize = completion_key_pt... | identifier_body |
windows.rs | that it might run out of memory.
// Now the way we would normally handle this is to have a counter and limit the
// number of outstandig buffers, queueing requests and only handle them when the
// counter is below the high water mark. The same goes for using unlimited timeouts.
// http://www.serverframework.com/asynch... | pub const INFINITE: u32 = 0xFFFFFFFF;
#[link(name = "Kernel32")]
extern "stdcall" {
// https://docs.microsoft.com/en-us/windows/win32/fileio/createiocompletionport
fn CreateIoCompletionPort(
filehandle: HANDLE,
existing_completionport: HANDLE,
completion... | random_line_split | |
strobe.rs | bitflags;
use subtle::{self, ConstantTimeEq};
/// Version of Strobe that this crate implements.
pub const STROBE_VERSION: &str = "1.0.2";
bitflags! {
/// Operation flags defined in the Strobe paper. This is defined as a bitflags struct.
pub(crate) struct OpFlags: u8 {
/// Is data being moved inbound
... | else if flags.contains(OpFlags::C) {
// This is equivalent to the `duplex` operation in the Python implementation, with
// `cbefore = True`
self.exchange(data);
} else {
// This should normally call `absorb`, but `absorb` does not mutate, so the implementor
... | {
// Special case of case below. This is PRF. Use `squeeze` instead of `exchange`.
self.squeeze(data);
} | conditional_block |
strobe.rs | ::bitflags;
use subtle::{self, ConstantTimeEq};
/// Version of Strobe that this crate implements.
pub const STROBE_VERSION: &str = "1.0.2";
bitflags! {
/// Operation flags defined in the Strobe paper. This is defined as a bitflags struct.
pub(crate) struct OpFlags: u8 {
/// Is data being moved inbound... | self.operate_no_mutate(flags, data, more);
}
#[doc = $doc_str]
pub fn $meta_name(&mut self, data: &[u8], more: bool) {
let flags = $flags | OpFlags::M;
self.operate_no_mutate(flags, data, more);
}
};
}
impl Strobe {
/// Makes a new `Strobe` o... | #[doc = $doc_str]
pub fn $name(&mut self, data: &[u8], more: bool) {
let flags = $flags; | random_line_split |
strobe.rs | bitflags;
use subtle::{self, ConstantTimeEq};
/// Version of Strobe that this crate implements.
pub const STROBE_VERSION: &str = "1.0.2";
bitflags! {
/// Operation flags defined in the Strobe paper. This is defined as a bitflags struct.
pub(crate) struct OpFlags: u8 {
/// Is data being moved inbound
... | (&mut self, data: &[u8]) {
for b in data {
self.st.0[self.pos] ^= *b;
self.pos += 1;
if self.pos == self.rate {
self.run_f();
}
}
}
/// XORs the given data into the state, then sets the data equal the state. This is a special
... | absorb | identifier_name |
strobe.rs | bitflags;
use subtle::{self, ConstantTimeEq};
/// Version of Strobe that this crate implements.
pub const STROBE_VERSION: &str = "1.0.2";
bitflags! {
/// Operation flags defined in the Strobe paper. This is defined as a bitflags struct.
pub(crate) struct OpFlags: u8 {
/// Is data being moved inbound
... |
//
// These operations mutate their inputs
//
def_op_mut!(
send_enc,
meta_send_enc,
OpFlags::A | OpFlags::C | OpFlags::T,
"Sends an encrypted message."
);
def_op_mut!(
recv_enc,
meta_recv_enc,
OpFlags::I | OpFlags::A | OpFlags::C | OpFla... | {
self.generalized_ratchet(num_bytes_to_zero, more, /* is_meta */ true)
} | identifier_body |
main.rs | #[macro_use]
extern crate diesel;
pub mod models;
pub mod schema;
pub mod error;
use self::models::*;
use self::error::{
Error as MCWhitelistError,
WhitelistErrorKind,
};
use diesel::{
mysql::MysqlConnection,
prelude::*,
r2d2::{
ConnectionManager,
Pool,
},
result::{
Error as DieselError,
... |
DatabaseErrorKind::UnableToSendCommand => {
response = "Unable to contact MySQL server. Please try again later.";
}
_ => { }
};
}
_ => { }
};
msg.reply(
&ctx,
response.to_string(),
)?;
Ok(())
}
| {
// whack
if msg.contains("discord_id") {
response = "You have already linked your account.\nYou may only have one linked account at a time.\nTo unlink, please type `!unlink`";
} else if msg.contains("minecraft_uuid") {
response = "Somebody has linked this Minecraf... | conditional_block |
main.rs | #[macro_use]
extern crate diesel;
pub mod models;
pub mod schema;
pub mod error;
use self::models::*;
use self::error::{
Error as MCWhitelistError,
WhitelistErrorKind,
};
use diesel::{
mysql::MysqlConnection,
prelude::*,
r2d2::{
ConnectionManager,
Pool,
},
result::{
Error as DieselError,
... | (_discord_id: u64) -> Option<MinecraftUser> {
use self::schema::minecrafters::dsl::*;
let connection = POOL.get().unwrap();
let res = minecrafters.filter(discord_id.eq(_discord_id))
.load::<FullMCUser>(&connection)
.expect("Error loading minecraft user");
if res.len() < 1 {
println!("[WARN] NO PLAY... | sel_mc_account | identifier_name |
main.rs | #[macro_use]
extern crate diesel;
pub mod models;
pub mod schema;
pub mod error;
use self::models::*;
use self::error::{
Error as MCWhitelistError,
WhitelistErrorKind,
};
use diesel::{
mysql::MysqlConnection,
prelude::*,
r2d2::{
ConnectionManager,
Pool,
},
result::{
Error as DieselError,
... | );
// Start listening for events, single shard. Shouldn't need more than one shard
if let Err(why) = client.start() {
println!("An error occurred while running the client: {:?}", why);
}
}
fn add_accounts(discordid: u64, mc_user: &MinecraftUser) -> QueryResult<usize> {
use self::schema::minecrafters;
... | client.with_framework(
StandardFramework::new()
.configure(|c| c.prefix("!"))
.group(&GENERAL_GROUP), | random_line_split |
mod.rs | //! `proptest`-related features for `nalgebra` data structures.
//!
//! **This module is only available when the `proptest-support` feature is enabled in `nalgebra`**.
//!
//! `proptest` is a library for *property-based testing*. While similar to `QuickCheck`,
//! which may be more familiar to some users, it has a more... | /// use proptest::prelude::*;
///
/// proptest! {
/// # /*
/// #[test]
/// # */
/// fn my_test(a in matrix(0.. 5i32, Const::<3>, 0..= 5)) {
/// // Let's make sure we've got the correct type first
/// let a: OMatrix<_, Const::<3>, Dyn> = a;
/// prop_assert!(a.nrows() == 3);
/// ... | /// ```
/// use nalgebra::proptest::matrix;
/// use nalgebra::{OMatrix, Const, Dyn}; | random_line_split |
mod.rs | //! `proptest`-related features for `nalgebra` data structures.
//!
//! **This module is only available when the `proptest-support` feature is enabled in `nalgebra`**.
//!
//! `proptest` is a library for *property-based testing*. While similar to `QuickCheck`,
//! which may be more familiar to some users, it has a more... |
}
impl From<RangeInclusive<usize>> for DimRange<Dyn> {
fn from(range: RangeInclusive<usize>) -> Self {
DimRange::from(Dyn(*range.start())..=Dyn(*range.end()))
}
}
impl<D: Dim> DimRange<D> {
/// Converts the `DimRange` into an instance of `RangeInclusive`.
pub fn to_range_inclusive(&self) -> R... | {
DimRange(range)
} | identifier_body |
mod.rs | //! `proptest`-related features for `nalgebra` data structures.
//!
//! **This module is only available when the `proptest-support` feature is enabled in `nalgebra`**.
//!
//! `proptest` is a library for *property-based testing*. While similar to `QuickCheck`,
//! which may be more familiar to some users, it has a more... | () -> Self {
Self {
rows: DimRange::from(R::name()),
cols: dynamic_dim_range(),
value_parameters: NParameters::default(),
}
}
}
impl<NParameters, C> Default for MatrixParameters<NParameters, Dyn, C>
where
NParameters: Default,
C: DimName,
{
fn default... | default | identifier_name |
probe_reports.rs | // Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
failure::{Error, ResultExt},
fidl::endpoints::ServiceMarker,
fidl_fuchsia_overnet::ServiceConsumerProxyInterface,
fidl_fuchsia_overne... |
}
if let Some(node_links) = result.links {
for link in node_links.iter() {
if let Some(source) = link.source {
if node_id!= source {
failure::bail!("Invalid source node id {:?} from {:?}", source, node_id);
}
... | {
peer_connections.extend(node_peer_connections.into_iter());
} | conditional_block |
probe_reports.rs | // Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
failure::{Error, ResultExt},
fidl::endpoints::ServiceMarker,
fidl_fuchsia_overnet::ServiceConsumerProxyInterface,
fidl_fuchsia_overne... | (&mut self, key: &str, value: &str) -> &mut Self {
self.set_value(key, Attr::HTML(value.to_string()))
}
fn set_bool(&mut self, key: &str, value: bool) -> &mut Self {
self.set_value(key, Attr::Bool(value))
}
fn render(self) -> String {
let mut out = String::new();
for (k... | set_html | identifier_name |
probe_reports.rs | // Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
failure::{Error, ResultExt},
fidl::endpoints::ServiceMarker,
fidl_fuchsia_overnet::ServiceConsumerProxyInterface,
fidl_fuchsia_overne... | {
Ok(r) => peers = r,
Err(_) => break,
}
}
let own_id = (|| -> Result<NodeId, Error> {
for peer in peers.iter() {
if peer.is_self {
return Ok(peer.id);
}
}
failure::bail!("Cannot find myself");
})()?;
... | )
.await | random_line_split |
lib.rs | use anyhow::{anyhow, bail, Error};
use std::cmp;
use std::env;
use walrus::ir::Value;
use walrus::{ExportItem, GlobalId, GlobalKind, MemoryId, Module};
use walrus::{FunctionId, InitExpr, ValType};
use wasm_bindgen_wasm_conventions as wasm_conventions;
const PAGE_SIZE: u32 = 1 << 16;
/// Configuration for the transfor... | //... and finally flag it as the new start function
module.start = Some(id);
Ok(())
}
fn find_wbindgen_malloc(module: &Module) -> Result<FunctionId, Error> {
let e = module
.exports
.iter()
.find(|e| e.name == "__wbindgen_malloc")
.ok_or_else(|| anyhow!("failed to find `__w... | random_line_split | |
lib.rs | use anyhow::{anyhow, bail, Error};
use std::cmp;
use std::env;
use walrus::ir::Value;
use walrus::{ExportItem, GlobalId, GlobalKind, MemoryId, Module};
use walrus::{FunctionId, InitExpr, ValType};
use wasm_bindgen_wasm_conventions as wasm_conventions;
const PAGE_SIZE: u32 = 1 << 16;
/// Configuration for the transfor... |
fn delete_synthetic_global(module: &mut Module, name: &str) -> Result<u32, Error> {
let id = match delete_synthetic_export(module, name)? {
walrus::ExportItem::Global(g) => g,
_ => bail!("`{}` must be a global", name),
};
let g = match module.globals.get(id).kind {
walrus::GlobalKi... | {
match delete_synthetic_export(module, name)? {
walrus::ExportItem::Function(f) => Ok(f),
_ => bail!("`{}` must be a function", name),
}
} | identifier_body |
lib.rs | use anyhow::{anyhow, bail, Error};
use std::cmp;
use std::env;
use walrus::ir::Value;
use walrus::{ExportItem, GlobalId, GlobalKind, MemoryId, Module};
use walrus::{FunctionId, InitExpr, ValType};
use wasm_bindgen_wasm_conventions as wasm_conventions;
const PAGE_SIZE: u32 = 1 << 16;
/// Configuration for the transfor... | {
init: walrus::FunctionId,
size: u32,
align: u32,
}
fn inject_start(
module: &mut Module,
tls: Tls,
addr: u32,
stack_pointer: GlobalId,
stack_size: u32,
memory: MemoryId,
) -> Result<(), Error> {
use walrus::ir::*;
assert!(stack_size % PAGE_SIZE == 0);
let mut builder... | Tls | identifier_name |
lib.rs | ::{
ab_glyph, legacy, BuiltInLineBreaker, Extra, FontId, GlyphCruncher, GlyphPositioner,
HorizontalAlign, Layout, LineBreak, LineBreaker, OwnedSection, OwnedText, Section,
SectionGeometry, SectionGlyph, SectionGlyphIter, SectionText, Text, VerticalAlign,
};
use crate::pipe::{glyph_pipe, GlyphVertex, IntoDi... |
if cache.pso.0!= target.format() {
cache.pso = (
target.format(),
self.pso_using(target.format(), depth_target.map(|d| d.format())),
);
}
self.draw_cache = Some(cache);
}
match brush_action.unwr... | {
cache.pipe_data.out_depth.take();
} | conditional_block |
lib.rs | ::{
ab_glyph, legacy, BuiltInLineBreaker, Extra, FontId, GlyphCruncher, GlyphPositioner,
HorizontalAlign, Layout, LineBreak, LineBreaker, OwnedSection, OwnedText, Section,
SectionGeometry, SectionGlyph, SectionGlyphIter, SectionText, Text, VerticalAlign,
};
use crate::pipe::{glyph_pipe, GlyphVertex, IntoDi... | <'a, S>(&mut self, section: S)
where
S: Into<Cow<'a, Section<'a>>>,
{
self.glyph_brush.queue(section)
}
/// Returns a [`DrawBuilder`](struct.DrawBuilder.html) allowing the queued glyphs to be drawn.
///
/// Drawing will trim the cache, see [caching behaviour](#caching-behaviour)... | queue | identifier_name |
lib.rs | brush::{
ab_glyph, legacy, BuiltInLineBreaker, Extra, FontId, GlyphCruncher, GlyphPositioner,
HorizontalAlign, Layout, LineBreak, LineBreaker, OwnedSection, OwnedText, Section,
SectionGeometry, SectionGlyph, SectionGlyphIter, SectionText, Text, VerticalAlign,
};
use crate::pipe::{glyph_pipe, GlyphVertex, I... | gfx::handle::Texture<R, TexSurface>,
gfx_core::handle::ShaderResourceView<R, f32>,
),
texture_filter_method: texture::FilterMethod,
factory: GF,
program: gfx::handle::Program<R>,
draw_cache: Option<DrawnGlyphBrush<R>>,
glyph_brush: glyph_brush::GlyphBrush<GlyphVertex, Extra, F, H... | random_line_split | |
lib.rs | section.
/// This is cached so future calls to any of the methods for the same section are much
/// cheaper. In the case of [`GlyphBrush::queue`](#method.queue) the calculations will also be
/// used for actual drawing.
///
/// The cache for a section will be **cleared** after a
/// [`.use_queue().draw(..)`](struct.Dr... | {
let kind = texture::Kind::D2(
width as texture::Size,
height as texture::Size,
texture::AaMode::Single,
);
let tex = factory.create_texture(
kind,
1,
gfx::memory::Bind::SHADER_RESOURCE,
gfx::memory::Usage::Dynamic,
Some(<TexChannel as format... | identifier_body | |
std_fs.rs | // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
#![allow(clippy::disallowed_methods)]
use std::fs;
use std::io;
use std::io::Write;
use std::path::Path;
use std::path::PathBuf;
use std::rc::Rc;
use deno_core::unsync::spawn_blocking;
use deno_io::fs::File;
use deno_io::fs::FsResult;
use den... |
fn write_file_sync(
&self,
path: &Path,
options: OpenOptions,
data: &[u8],
) -> FsResult<()> {
let opts = open_options(options);
let mut file = opts.open(path)?;
#[cfg(unix)]
if let Some(mode) = options.mode {
use std::os::unix::fs::PermissionsExt;
file.set_permissions(... | {
let atime = filetime::FileTime::from_unix_time(atime_secs, atime_nanos);
let mtime = filetime::FileTime::from_unix_time(mtime_secs, mtime_nanos);
spawn_blocking(move || {
filetime::set_file_times(path, atime, mtime).map_err(Into::into)
})
.await?
} | identifier_body |
std_fs.rs | // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
#![allow(clippy::disallowed_methods)]
use std::fs;
use std::io;
use std::io::Write;
use std::path::Path;
use std::path::PathBuf;
use std::rc::Rc;
use deno_core::unsync::spawn_blocking;
use deno_io::fs::File;
use deno_io::fs::FsResult;
use den... | (path: &Path) -> FsResult<FsStat> {
let metadata = fs::metadata(path)?;
let mut fsstat = FsStat::from_std(metadata);
use winapi::um::winbase::FILE_FLAG_BACKUP_SEMANTICS;
let path = path.canonicalize()?;
stat_extra(&mut fsstat, &path, FILE_FLAG_BACKUP_SEMANTICS)?;
Ok(fsstat)
}
#[cfg(not(windows))]
fn lstat(... | stat | identifier_name |
std_fs.rs | // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
#![allow(clippy::disallowed_methods)]
use std::fs;
use std::io;
use std::io::Write;
use std::path::Path;
use std::path::PathBuf;
use std::rc::Rc;
use deno_core::unsync::spawn_blocking;
use deno_io::fs::File;
use deno_io::fs::FsResult;
use den... | #[cfg(not(windows))]
fn symlink(
oldpath: &Path,
newpath: &Path,
_file_type: Option<FsFileType>,
) -> FsResult<()> {
std::os::unix::fs::symlink(oldpath, newpath)?;
Ok(())
}
#[cfg(windows)]
fn symlink(
oldpath: &Path,
newpath: &Path,
file_type: Option<FsFileType>,
) -> FsResult<()> {
let file_type = m... | .collect();
Ok(entries)
}
| random_line_split |
std_fs.rs | // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
#![allow(clippy::disallowed_methods)]
use std::fs;
use std::io;
use std::io::Write;
use std::path::Path;
use std::path::PathBuf;
use std::rc::Rc;
use deno_core::unsync::spawn_blocking;
use deno_io::fs::File;
use deno_io::fs::FsResult;
use den... | else {
// If no mask provided, we query the current. Requires two syscalls.
let prev = umask(Mode::from_bits_truncate(0o777));
let _ = umask(prev);
prev
};
#[cfg(target_os = "linux")]
{
Ok(r.bits())
}
#[cfg(any(
target_os = "macos",
target_os = "openbsd",
... | {
// If mask provided, return previous.
umask(Mode::from_bits_truncate(mask as mode_t))
} | conditional_block |
register.rs | /*
* Copyright 2018 Fluence Labs Limited
*
* 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.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | ;
if is_registered {
Ok(Registered::AlreadyRegistered)
} else {
let tx = utils::with_progress(
"Registering the node in the smart contract...",
step_counter.format_next_step().as_str(),
"Transaction with... | {
false
} | conditional_block |
register.rs | /*
* Copyright 2018 Fluence Labs Limited
*
* 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.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
pub fn generate_register(credentials: Credentials) -> Register {
let mut rng = rand::thread_rng();
let rnd_num: u64 = rng.gen();
let tendermint_key: H256 = H256::from(rnd_num);
let tendermint_node_id: H160 = H160::from(rnd_num);
let eth = generate_eth_args(credentials);
... | {
let account: Address = "4180fc65d613ba7e1a385181a219f1dbfe7bf11d".parse().unwrap();
EthereumArgs::with_acc_creds(account, credentials)
} | identifier_body |
register.rs | /*
* Copyright 2018 Fluence Labs Limited
*
* 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.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | const NO_STATUS_CHECK: &str = "no_status_check";
#[derive(Debug, Getters)]
pub struct Register {
node_ip: IpAddr,
tendermint_key: H256,
tendermint_node_id: H160,
api_port: u16,
capacity: u16,
private: bool,
no_status_check: bool,
eth: EthereumParams,
}
#[derive(PartialEq, Debug)]
pub e... | use web3::types::H160;
const API_PORT: &str = "api_port";
const CAPACITY: &str = "capacity";
const PRIVATE: &str = "private"; | random_line_split |
register.rs | /*
* Copyright 2018 Fluence Labs Limited
*
* 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.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | <'a, 'b>() -> App<'a, 'b> {
let args = &[
node_ip().display_order(1),
tendermint_key().display_order(2),
base64_tendermint_key().display_order(3),
tendermint_node_id().display_order(4),
Arg::with_name(API_PORT)
.alias(API_PORT)
.long(API_PORT)
... | subcommand | identifier_name |
lib.rs | crate are as follows:
* [`linkage`](fn.linkage.html) performs hierarchical clustering on a pairwise
dissimilarity matrix.
* [`Method`](enum.Method.html) determines the linkage criteria.
* [`Dendrogram`](struct.Dendrogram.html) is a representation of a "stepwise"
dendrogram, which serves as the output of hierarchi... | f) -> Option<MethodChain> {
match self {
Method::Single => Some(MethodChain::Single),
Method::Complete => Some(MethodChain::Complete),
Method::Average => Some(MethodChain::Average),
Method::Weighted => Some(MethodChain::Weighted),
Method::Ward => Some(... | _method_chain(sel | identifier_name |
lib.rs | crate are as follows:
* [`linkage`](fn.linkage.html) performs hierarchical clustering on a pairwise
dissimilarity matrix.
* [`Method`](enum.Method.html) determines the linkage criteria.
* [`Dendrogram`](struct.Dendrogram.html) is a representation of a "stepwise"
dendrogram, which serves as the output of hierarchi... | impl FromStr for MethodChain {
type Err = Error;
fn from_str(s: &str) -> Result<MethodChain> {
match s {
"single" => Ok(MethodChain::Single),
"complete" => Ok(MethodChain::Complete),
"average" => Ok(MethodChain::Average),
"weighted" => Ok(MethodChain::Wei... | self.into_method().sqrt(dend);
}
}
| identifier_body |
lib.rs | this crate are as follows:
* [`linkage`](fn.linkage.html) performs hierarchical clustering on a pairwise
dissimilarity matrix.
* [`Method`](enum.Method.html) determines the linkage criteria.
* [`Dendrogram`](struct.Dendrogram.html) is a representation of a "stepwise"
dendrogram, which serves as the output of hier... | io::Error::new(io::ErrorKind::Other, err)
}
}
/// A method for computing the dissimilarities between clusters.
///
/// The method selected dictates how the dissimilarities are computed whenever
/// a new cluster is formed. In particular, when clusters `a` and `b` are
/// merged into a new cluster `ab`, the... | }
impl From<Error> for io::Error {
fn from(err: Error) -> io::Error { | random_line_split |
mesh.rs | use super::vertex::Vertex;
use super::face::Face;
use super::pair::{ Pair, PairInfo };
use std::collections::BinaryHeap;
use nalgebra::base::Matrix4;
use std::path::Path;
use ordered_float::OrderedFloat;
use std::io::LineWriter;
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use std::io::BufRead;
u... | continue;
}
if self.pairs[*idx].set_vertex(pos, new_pos) {
new_v.pairs.push((idx.clone(), pos.clone()));
} else {
self.pairs[*idx].destroy();
}
}
vertex1.destroy();
vertex2.destroy();
self.... | if *idx == id { | random_line_split |
mesh.rs | use super::vertex::Vertex;
use super::face::Face;
use super::pair::{ Pair, PairInfo };
use std::collections::BinaryHeap;
use nalgebra::base::Matrix4;
use std::path::Path;
use ordered_float::OrderedFloat;
use std::io::LineWriter;
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use std::io::BufRead;
u... | identifier_name | ||
mesh.rs | use super::vertex::Vertex;
use super::face::Face;
use super::pair::{ Pair, PairInfo };
use std::collections::BinaryHeap;
use nalgebra::base::Matrix4;
use std::path::Path;
use ordered_float::OrderedFloat;
use std::io::LineWriter;
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use std::io::BufRead;
u... | new_v.coord.x = best_point.x;
new_v.coord.y = best_point.y;
new_v.coord.z = best_point.z;
new_v.q_v = vertex1.q_v + vertex2.q_v;
// 更新相关的面片
for (idx, pos) in vertex1.faces.iter() {
let valid = self.faces[*idx].valid();
if valid {
l... | self.vertices[second].clone();
let mut vertex1 = first_ptr.borrow_mut();
let mut vertex2 = second_ptr.borrow_mut();
// 回收旧顶点编号
self.trash.push(first);
self.trash.push(second);
let new_pos = self.trash.pop().unwrap();
// 获取用于存放新顶点的顶点实体
let temp_pos = se... | identifier_body |
mesh.rs | use super::vertex::Vertex;
use super::face::Face;
use super::pair::{ Pair, PairInfo };
use std::collections::BinaryHeap;
use nalgebra::base::Matrix4;
use std::path::Path;
use ordered_float::OrderedFloat;
use std::io::LineWriter;
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use std::io::BufRead;
u... | self.pre_pairs[idx2].insert(idx1);
}
if idx1 < idx3 {
self.pre_pairs[idx1].insert(idx3);
} else {
assert!( idx1!= idx3);
self.pre_pairs[idx3].insert(idx1);
... | } else {
assert!( idx1 != idx2);
| conditional_block |
main.rs | // Copyright 2020 Sean Kelleher. All rights reserved.
// Use of this source code is governed by a MIT
// licence that can be found in the LICENCE file.
use std::convert::TryInto;
use std::io::ErrorKind;
use std::io::Read;
use std::io::Write;
extern crate alacritty;
extern crate pancurses;
use alacritty::ansi::{Color... | (w: i32, h: i32) -> SizeInfo {
SizeInfo {
width: w as f32,
height: h as f32,
cell_width: 1.0,
cell_height: 1.0,
padding_x: 0.0,
padding_y: 0.0,
}
}
fn render_term_to_win(term: &Term, win: &Window, border_char: char) -> RenderResult {
win.clear();
let (y,... | new_size_info | identifier_name |
main.rs | // Copyright 2020 Sean Kelleher. All rights reserved.
// Use of this source code is governed by a MIT
// licence that can be found in the LICENCE file.
use std::convert::TryInto;
use std::io::ErrorKind;
use std::io::Read;
use std::io::Write;
extern crate alacritty;
extern crate pancurses;
use alacritty::ansi::{Color... | use alacritty::term::SizeInfo;
use alacritty::tty;
use pancurses::colorpair::ColorPair;
use pancurses::Input;
use pancurses::ToChtype;
use pancurses::Window;
const OS_IO_ERROR: i32 = 5;
fn main() {
let win = pancurses::initscr();
// Characters are not rendered when they're typed, instead they're sent to
... | use alacritty::cli::Options;
use alacritty::config::Config;
use alacritty::index::{Point, Line, Column};
use alacritty::Term; | random_line_split |
main.rs | // Copyright 2020 Sean Kelleher. All rights reserved.
// Use of this source code is governed by a MIT
// licence that can be found in the LICENCE file.
use std::convert::TryInto;
use std::io::ErrorKind;
use std::io::Read;
use std::io::Write;
extern crate alacritty;
extern crate pancurses;
use alacritty::ansi::{Color... |
fn new_size_info(w: i32, h: i32) -> SizeInfo {
SizeInfo {
width: w as f32,
height: h as f32,
cell_width: 1.0,
cell_height: 1.0,
padding_x: 0.0,
padding_y: 0.0,
}
}
fn render_term_to_win(term: &Term, win: &Window, border_char: char) -> RenderResult {
win.cle... | {
for i in 1..COLOUR_INDEXES.len()-1 {
if c == COLOUR_INDEXES[i] {
return i
}
}
0
} | identifier_body |
options.rs | "$ ",
env!("CARGO_BIN_NAME"),
" old/ new/\n\n",
"If you have a file with conflict markers, you can pass it as a single argument. Difftastic will diff the two conflicting file states.\n\n",
"$ ",
env!("CARGO_BIN_NAME"),
" file_with_conflicts... |
fn relative_to_current(path: &Path) -> PathBuf {
if let Ok(current_path) = std::env::current_dir() {
let path = try_canonicalize(path);
let current_path = try_canonicalize(¤t_path);
if let Ok(rel_path) = path.strip_prefix(current_path) {
return rel_path.into();
}... | {
path.canonicalize().unwrap_or_else(|_| path.into())
} | identifier_body |
options.rs | . Difftastic will diff the two conflicting file states.\n\n",
"$ ",
env!("CARGO_BIN_NAME"),
" file_with_conflicts.js\n\n",
"Difftastic can also be invoked with 7 arguments in the format that GIT_EXTERNAL_DIFF expects.\n\n",
"See the full manual at: https://dif... | .value_of("parse-error-limit")
.expect("Always present as we've given clap a default")
.parse::<usize>()
.expect("Value already validated by clap"); | random_line_split | |
options.rs | new("missing-as-empty").long("missing-as-empty")
.help("Treat paths that don't exist as equivalent to an empty file. Only applies when diffing files, not directories.")
)
.arg(
Arg::new("override").long("override")
.value_name("GLOB:NAME")
.help(co... | test_detect_display_width | identifier_name | |
streamer.rs | // Copyright 2022, 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.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... | else {
AsyncSinkReply::Fail(cf_data)
};
ctx.swallow_err(
reply_tx.send(reply),
&format!("Error sending ack/fail for upload {upload_id} to {object_id}"),
);
}
res?;
Ok(())
}
async fn fail_upload(&mut sel... | {
if let Some(location) = out.location() {
debug!("{ctx} Finished upload {upload_id} for {location}");
} else {
debug!("{ctx} Finished upload {upload_id} for {object_id}");
}
// the duration of handling in the sink i... | conditional_block |
streamer.rs | // Copyright 2022, 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.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... | pub(crate) struct Config {
aws_region: Option<String>,
url: Option<Url<HttpsDefaults>>,
/// optional default bucket
bucket: Option<String>,
#[serde(default = "Default::default")]
mode: Mode,
#[serde(default = "Config::fivembs")]
buffer_size: usize,
/// Enable path-style access
... | random_line_split | |
streamer.rs | // Copyright 2022, 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.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... | (
&self,
id: &Alias,
_: &ConnectorConfig,
config: &Value,
_kill_switch: &KillSwitch,
) -> Result<Box<dyn Connector>> {
let mut config = Config::new(config)?;
config.normalize(id);
Ok(Box::new(S3Connector { config }))
}
}
struct S3Connector {
c... | build_cfg | identifier_name |
streamer.rs | // Copyright 2022, 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.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
fn is_failed(&self) -> bool {
self.failed
}
fn mark_as_failed(&mut self) {
self.failed = true;
}
fn track(&mut self, event: &Event) {
self.event_id.track(&event.id);
if!event.op_meta.is_empty() {
self.op_meta.merge(event.op_meta.clone());
}
... | {
&self.object_id
} | identifier_body |
conn_write.rs | use std::cmp;
use std::fmt;
use std::task::Poll;
use bytes::Bytes;
use futures::task::Context;
use tls_api::AsyncSocket;
use crate::common::conn::Conn;
use crate::common::conn::ConnStateSnapshot;
use crate::common::conn_read::ConnReadSideCustom;
use crate::common::pump_stream_to_write_loop::PumpStreamToWrite;
use cra... | else {
debug!("sending frame {:?}", frame.debug_no_data());
}
self.queued_write.queue_not_goaway(frame);
return;
}
let mut pos = 0;
while pos < data.len() {
let end = cmp::min(data.len(), pos + max_frame_size);
let ... | {
debug!("sending frame {:?}", frame);
} | conditional_block |
conn_write.rs | use std::cmp;
use std::fmt;
use std::task::Poll;
use bytes::Bytes;
use futures::task::Context;
use tls_api::AsyncSocket;
use crate::common::conn::Conn;
use crate::common::conn::ConnStateSnapshot;
use crate::common::conn_read::ConnReadSideCustom;
use crate::common::pump_stream_to_write_loop::PumpStreamToWrite;
use cra... | let mut pos = 0;
while pos < data.len() {
let end = cmp::min(data.len(), pos + max_frame_size);
let end_stream_in_frame = if end == data.len() && end_stream == EndStream::Yes {
EndStream::Yes
} else {
EndStream::No
};
... | {
let max_frame_size = self.peer_settings.max_frame_size as usize;
// if client requested end of stream,
// we must send at least one frame with end stream flag
if end_stream == EndStream::Yes && data.len() == 0 {
let mut frame = DataFrame::with_data(stream_id, Bytes::new())... | identifier_body |
conn_write.rs | use std::cmp;
use std::fmt;
use std::task::Poll;
use bytes::Bytes;
use futures::task::Context;
use tls_api::AsyncSocket;
use crate::common::conn::Conn;
use crate::common::conn::ConnStateSnapshot;
use crate::common::conn_read::ConnReadSideCustom;
use crate::common::pump_stream_to_write_loop::PumpStreamToWrite;
use cra... | self.process_stream_enqueue(stream_id, part)
}
CommonToWriteMessage::Pull(stream_id, stream, out_window_receiver) => {
self.process_stream_pull(stream_id, stream, out_window_receiver)
}
CommonToWriteMessage::IncreaseInWindow(stream_id, incr... | CommonToWriteMessage::StreamEnqueue(stream_id, part) => { | random_line_split |
conn_write.rs | use std::cmp;
use std::fmt;
use std::task::Poll;
use bytes::Bytes;
use futures::task::Context;
use tls_api::AsyncSocket;
use crate::common::conn::Conn;
use crate::common::conn::ConnStateSnapshot;
use crate::common::conn_read::ConnReadSideCustom;
use crate::common::pump_stream_to_write_loop::PumpStreamToWrite;
use cra... | (&mut self, stream_id: StreamId, part: HttpStreamCommand) {
match part {
HttpStreamCommand::Data(data, end_stream) => {
self.write_part_data(stream_id, data, end_stream);
}
HttpStreamCommand::Headers(headers, end_stream) => {
self.write_part_he... | write_part | identifier_name |
stream.rs | use crate::{JsonRpcClient, Middleware, PinBoxFut, Provider, ProviderError};
use ethers_core::types::{Transaction, TxHash, U256};
use futures_core::stream::Stream;
use futures_core::Future;
use futures_util::stream::FuturesUnordered;
use futures_util::{stream, FutureExt, StreamExt};
use pin_project::pin_project;
use s... | if let Some(ref sent) = sent {
assert_eq!(sent.len(), watch_received.len());
let sent_txs = sent
.iter()
.map(|tx| tx.transaction_hash)
.collect::<HashSet<_>>();
assert_eq!(se... | if watch_received.len() == num_txs && sub_received.len() == num_txs { | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.