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 |
|---|---|---|---|---|
web.rs |
use std::path::PathBuf;
use std::rc::Rc;
use std::cell::RefCell;
use std::collections::BTreeMap;
use std::fs::File;
use std::io::prelude::*;
use std::ffi::OsStr;
use std::sync::Arc;
use std::time::{Duration as SDuration, Instant};
use crate::utils::{print_error_and_causes, FutureExt as _, ResultExt as ResultExt2};
... | else {
Err(::failure::err_msg("Unknown asset"))
}
}))
}
None => make404(),
}
}
fn serve_history<'a>(&self, date: Option<&'a str>) -> HandlerResult {
match NaiveDate::parse_from_str(date.unwrap_or("nodate"), ... | {
let mut f = File::open(path).unwrap();
let mut buffer = String::new();
f.read_to_string(&mut buffer).unwrap();
Ok(buffer).map(str_to_response)
} | conditional_block |
web.rs |
use std::path::PathBuf;
use std::rc::Rc;
use std::cell::RefCell;
use std::collections::BTreeMap;
use std::fs::File;
use std::io::prelude::*;
use std::ffi::OsStr;
use std::sync::Arc;
use std::time::{Duration as SDuration, Instant};
use crate::utils::{print_error_and_causes, FutureExt as _, ResultExt as ResultExt2};
... |
fn box_and_convert_error<F>(result: F) -> HandlerResult
where
F: Future<Item = Response, Error = Error> + Sized +'static,
{
Box::new(result.then(|result| {
let f = match result {
Ok(response) => response,
Err(err) => {
use std::fmt::Write;
let mu... | {
Response::new()
.with_header(header::ContentLength(body.len() as u64))
.with_body(body)
} | identifier_body |
lib.rs | #[macro_use]
extern crate serde_derive;
extern crate argon2;
extern crate libc;
extern crate liner;
#[macro_use]
extern crate failure;
extern crate pkgutils;
extern crate rand;
extern crate redoxfs;
extern crate syscall;
extern crate termion;
mod config;
mod disk_wrapper;
pub use config::Config;
pub use config::file:... | )
}
pub fn install<P, S>(config: Config, output: P, cookbook: Option<S>, live: bool)
-> Result<()> where
P: AsRef<Path>,
S: AsRef<str>,
{
println!("Install {:#?} to {}", config, output.as_ref().display());
if output.as_ref().is_dir() {
install_dir(config, output, cookbook)
... | with_redoxfs(
disk_redoxfs,
password_opt,
callback | random_line_split |
lib.rs | #[macro_use]
extern crate serde_derive;
extern crate argon2;
extern crate libc;
extern crate liner;
#[macro_use]
extern crate failure;
extern crate pkgutils;
extern crate rand;
extern crate redoxfs;
extern crate syscall;
extern crate termion;
mod config;
mod disk_wrapper;
pub use config::Config;
pub use config::file:... | }
let output_dir = output_dir.as_ref();
let output_dir = output_dir.to_owned();
install_packages(&config, output_dir.to_str().unwrap(), cookbook);
for file in config.files {
file.create(&output_dir)?;
}
let mut passwd = String::new();
let mut shadow = String::new();
let ... | {
//let mut context = liner::Context::new();
macro_rules! prompt {
($dst:expr, $def:expr, $($arg:tt)*) => (if config.general.prompt {
Err(io::Error::new(
io::ErrorKind::Other,
"prompt not currently supported"
))
// match unwrap_or_prom... | identifier_body |
lib.rs | #[macro_use]
extern crate serde_derive;
extern crate argon2;
extern crate libc;
extern crate liner;
#[macro_use]
extern crate failure;
extern crate pkgutils;
extern crate rand;
extern crate redoxfs;
extern crate syscall;
extern crate termion;
mod config;
mod disk_wrapper;
pub use config::Config;
pub use config::file:... | <P, F, T>(disk_path: P, bootloader_bios: &[u8], bootloader_efi: &[u8], password_opt: Option<&[u8]>, callback: F)
-> Result<T> where
P: AsRef<Path>,
F: FnOnce(&Path) -> Result<T>
{
let target = get_target();
let bootloader_efi_name = match target.as_str() {
"aarch64-unknown-redox" =>... | with_whole_disk | identifier_name |
verify.rs | set can require
/// overflow storage :(.
#[derive(Clone)]
pub struct StackSlot {
vars: Bitset,
code: Atom,
expr: Range<usize>,
}
/// A constructor trait for plugging in to the verifier, to collect extra data during the
/// verification pass
pub trait ProofBuilder {
/// The data type being generated
... | <P: ProofBuilder>(state: &mut VerifyState<P>, label: TokenPtr) -> Result<()> {
// it's either an assertion or a hypothesis. $f hyps have pseudo-frames
// which this function can use, $e don't and need to be looked up in the
// local hyp list after the frame lookup fails
let frame = match state.scoper.g... | prepare_step | identifier_name |
verify.rs | bitset can require
/// overflow storage :(.
#[derive(Clone)]
pub struct StackSlot {
vars: Bitset,
code: Atom,
expr: Range<usize>,
}
/// A constructor trait for plugging in to the verifier, to collect extra data during the
/// verification pass
pub trait ProofBuilder {
/// The data type being generated... | state.builder.build(hyp.address(),
Default::default(),
&state.stack_buffer,
tos..ntos)));
}
/// Adds a named $e hypothesis to the prepared array. These are not kept in the
/// frame arra... | tos..ntos, | random_line_split |
verify.rs | , Diagnostic>;
/// Variables are added lazily to the extended frame. All variables which are
/// associated with hypotheses or $d constraints are numbered by scopeck, but if
/// a dummy variable is used in a proof without a $d constraint it won't be
/// discovered until we get here, and a number needs to be assigned ... | {
state.cur_frame = frame;
if let Err(diag) = verify_proof(&mut state, stmt) {
diagnostics.insert(stmt.address(), diag);
}
} | conditional_block | |
instruction.rs | use std::fmt;
use std::hash;
enum_from_primitive! {
#[allow(non_camel_case_types)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Opcode {
// Two-operand opcodes (2OP)
OP2_1 = 1, OP2_2 = 2, OP2_3 = 3, OP2_4 = 4, OP2_5 = 5, OP2_6 = 6,
OP2_7 = 7, OP2_8 = 8, ... |
pub fn should_advance(&self, version: u8) -> bool {
!self.does_call(version) && self.opcode!= Opcode::OP0_181 && self.opcode!= Opcode::OP0_182
}
}
impl hash::Hash for Instruction {
fn hash<H>(&self, state: &mut H)
where
H: hash::Hasher,
{
state.write_usize(self.... | {
use self::Opcode::*;
match self.opcode {
OP2_25 | OP2_26 | OP1_136 | VAR_224 | VAR_236 | VAR_249 | VAR_250 => true,
OP1_143 => version >= 4,
_ => false,
}
} | identifier_body |
instruction.rs | use std::fmt;
use std::hash;
enum_from_primitive! {
#[allow(non_camel_case_types)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Opcode {
// Two-operand opcodes (2OP)
OP2_1 = 1, OP2_2 = 2, OP2_3 = 3, OP2_4 = 4, OP2_5 = 5, OP2_6 = 6,
OP2_7 = 7, OP2_8 = 8, ... | (bytes: &[u8]) -> Vec<OperandType> {
bytes
.iter()
.fold(Vec::new(), |mut acc, n| {
acc.push((n & 0b1100_0000) >> 6);
acc.push((n & 0b0011_0000) >> 4);
acc.push((n & 0b0000_1100) >> 2);
acc.push(n & 0b0000_0011);
... | from | identifier_name |
instruction.rs | use std::fmt;
use std::hash;
enum_from_primitive! {
#[allow(non_camel_case_types)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Opcode {
// Two-operand opcodes (2OP)
OP2_1 = 1, OP2_2 = 2, OP2_3 = 3, OP2_4 = 4, OP2_5 = 5, OP2_6 = 6,
OP2_7 = 7, OP2_8 = 8, ... | pub addr: usize,
pub opcode: Opcode,
pub name: String,
pub operands: Vec<Operand>,
pub store: Option<u8>,
pub branch: Option<Branch>,
pub text: Option<String>,
pub next: usize,
}
impl Instruction {
pub fn does_store(opcode: Opcode, version: u8) -> bool {
use self... |
#[derive(Debug)]
pub struct Instruction {
| random_line_split |
peer.rs | use config;
use dt::{Set};
use proto::{Request, Response, Transport};
use tokio_core::channel::{channel, Sender, Receiver};
use tokio_core::reactor::Handle;
use tokio_core::net::TcpStream;
use tokio_service::Service;
use tokio_proto::easy::{EasyClient, multiplex};
use tokio_timer::{Timer, Sleep};
use futures::{Future... | reactor_handle: handle.clone(),
timer: timer.clone(),
// Initialize in the "waiting to connect" state but with a 0 length
// sleep. This will effectively initiate the connect immediately
state: State::Waiting(timer.sleep(Duration::from_millis(0))),
... | rx: rx,
route: route, | random_line_split |
peer.rs | use config;
use dt::{Set};
use proto::{Request, Response, Transport};
use tokio_core::channel::{channel, Sender, Receiver};
use tokio_core::reactor::Handle;
use tokio_core::net::TcpStream;
use tokio_service::Service;
use tokio_proto::easy::{EasyClient, multiplex};
use tokio_timer::{Timer, Sleep};
use futures::{Future... | (&mut self) -> Poll<(), ()> {
trace!(" --> process peer connection");
let service = match self.state {
State::Connected(ref mut service) => service,
_ => unreachable!(),
};
// The connection is currently in the connected state. If there are any
// pen... | process_connected | identifier_name |
peer.rs | use config;
use dt::{Set};
use proto::{Request, Response, Transport};
use tokio_core::channel::{channel, Sender, Receiver};
use tokio_core::reactor::Handle;
use tokio_core::net::TcpStream;
use tokio_service::Service;
use tokio_proto::easy::{EasyClient, multiplex};
use tokio_timer::{Timer, Sleep};
use futures::{Future... | let set = self.pending_message.message_to_send().unwrap();
let msg = Request::Join(set);
trace!(" --> sending Join message");
// Dispatch the replication request and get back a future repesenting
// the response from the peer node.
let resp = service.call(msg);
... | {
trace!(" --> process peer connection");
let service = match self.state {
State::Connected(ref mut service) => service,
_ => unreachable!(),
};
// The connection is currently in the connected state. If there are any
// pending replication requests, th... | identifier_body |
lib.rs | #![cfg_attr(docsrs, doc = include_str!("../README.md"))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg, doc_cfg_hide))]
#![cfg_attr(docsrs, deny(missing_docs))]
#![cfg_attr(not(any(feature = "std", test)), no_std)]
#![allow(unused_unsafe)]
//!
//! ## data structures
//!
//! `cordyceps` provides implementations of t... | ///
/// Suppose we have an entry type like this:
/// ```rust
/// use cordyceps::list;
///
/// struct Entry {
/// links: list::Links<Self>,
/// data: usize,
/// }
/// ```
///
/// The naive implementation of [`links`](Linked::links) for this `Entry` type
/// might look like this:
///
/// ```
/// use cordyceps::Li... | random_line_split | |
accounts.rs | use nimiq_account::{
Account, Accounts, BlockLogger, BlockState, RevertInfo, TransactionOperationReceipt,
};
use nimiq_block::{Block, BlockError, SkipBlockInfo};
use nimiq_blockchain_interface::PushError;
use nimiq_database::{traits::Database, TransactionProxy};
use nimiq_keys::Address;
use nimiq_primitives::{
... | block.block_number(),
&body.fork_proofs,
skip_block_info,
Some(txn),
);
// Get the revert info for this block.
let revert_info = self
.chain_store
.get_revert_info(block.block_number(), Some(txn))
.expect("Failed t... | random_line_split | |
accounts.rs | use nimiq_account::{
Account, Accounts, BlockLogger, BlockState, RevertInfo, TransactionOperationReceipt,
};
use nimiq_block::{Block, BlockError, SkipBlockInfo};
use nimiq_blockchain_interface::PushError;
use nimiq_database::{traits::Database, TransactionProxy};
use nimiq_keys::Address;
use nimiq_primitives::{
... | // Macro blocks are final and receipts for the previous batch are no longer necessary
// as rebranching across this block is not possible.
self.chain_store.clear_revert_infos(txn.raw());
// Store the transactions and the inherents into the History tree.
... | {
// Get the accounts from the state.
let accounts = &state.accounts;
let block_state = BlockState::new(block.block_number(), block.timestamp());
// Check the type of the block.
match block {
Block::Macro(ref macro_block) => {
// Initialize a vector t... | identifier_body |
accounts.rs | use nimiq_account::{
Account, Accounts, BlockLogger, BlockState, RevertInfo, TransactionOperationReceipt,
};
use nimiq_block::{Block, BlockError, SkipBlockInfo};
use nimiq_blockchain_interface::PushError;
use nimiq_database::{traits::Database, TransactionProxy};
use nimiq_keys::Address;
use nimiq_primitives::{
... | {
/// The end of the chunk. The end key is exclusive.
/// When set to None it means that it is the last trie chunk.
pub end_key: Option<KeyNibbles>,
/// The set of accounts retrieved.
pub accounts: Vec<(Address, Account)>,
}
/// Implements methods to handle the accounts.
impl Blockchain {
/// ... | AccountsChunk | identifier_name |
refcounteddb.rs | // Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity Ethereum.
// Parity Ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at yo... | (&self) -> HashMap<H256, i32> {
self.forward.keys()
}
}
#[cfg(test)]
mod tests {
use keccak_hash::keccak;
use hash_db::{HashDB, EMPTY_PREFIX};
use super::*;
use kvdb_memorydb;
use crate::{JournalDB, inject_batch, commit_batch};
fn new_db() -> RefCountedDB {
let backing = Arc::new(kvdb_memorydb::create(0));... | keys | identifier_name |
refcounteddb.rs | // Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity Ethereum.
// Parity Ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at yo... | .expect("rlp read from db; qed");
trace!(target: "rcdb", "delete journal for time #{}.{}=>{}, (canon was {}): deleting {:?}", end_era, db_key.index, our_id, canon_id, to_remove);
for i in &to_remove {
self.forward.remove(i, EMPTY_PREFIX);
}
batch.delete(self.column, &last);
db_key.index += 1;
}
... | {
view.inserts()
} | conditional_block |
refcounteddb.rs | // Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity Ethereum.
// Parity Ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at yo... | fn mem_used(&self) -> usize {
let mut ops = new_malloc_size_ops();
self.inserts.size_of(&mut ops) + self.removes.size_of(&mut ops)
}
fn is_empty(&self) -> bool {
self.latest_era.is_none()
}
fn backing(&self) -> &Arc<dyn KeyValueDB> {
&self.backing
}
fn latest_era(&self) -> Option<u64> { self.latest_e... | })
}
| random_line_split |
refcounteddb.rs | // Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity Ethereum.
// Parity Ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at yo... |
#[test]
fn long_history() {
// history is 3
let mut jdb = new_db();
let h = jdb.insert(EMPTY_PREFIX, b"foo");
commit_batch(&mut jdb, 0, &keccak(b"0"), None).unwrap();
assert!(jdb.contains(&h, EMPTY_PREFIX));
jdb.remove(&h, EMPTY_PREFIX);
commit_batch(&mut jdb, 1, &keccak(b"1"), None).unwrap();
asser... | {
let backing = Arc::new(kvdb_memorydb::create(0));
RefCountedDB::new(backing, None)
} | identifier_body |
main.rs | use std::collections::HashMap;
fn main() {
let test_one_input = "Today is Monday";
let max_chars = one(test_one_input);
println!("1) the most of a char(first appearing) in '{}' is '{}', appearing {} times", test_one_input, max_chars.0, max_chars.1);
let test_two_input = "supracalafragalisticexpealadoc... |
fn fifteen(i: &str) -> isize {
let mut i = i.to_uppercase();
let mut r = 0;
let mut to_long = 0;
while i.len() > 0 {
for (rn, an) in ROMANS.iter().rev() {
if i.starts_with(rn) {
r = r + an;
i = i.replacen(rn,"",1);
break;
... | {
let mut i = String::from(i);
let is_negative = i.contains('-');
if is_negative {
i = i.replace("-", "");
}
let mut r = 0;
for c in i.chars() {
let d = c.to_digit(10).unwrap();
r = d + (r * 10);
}
let mut r = r as isize;
if is_negative {
r = r * -1;
... | identifier_body |
main.rs | use std::collections::HashMap;
fn main() {
let test_one_input = "Today is Monday";
let max_chars = one(test_one_input);
println!("1) the most of a char(first appearing) in '{}' is '{}', appearing {} times", test_one_input, max_chars.0, max_chars.1);
let test_two_input = "supracalafragalisticexpealadoc... | println!("9) the first unrepeated char in '{}' is '{}'", test_nine_input, test_nine_output);
let test_ten_input = "best is Rust";
let test_ten_output = ten(test_ten_input);
println!("10) reversed sentence '{}' is '{}'", test_ten_input, test_ten_output);
let test_eleven_input1 = "this is a test str... | println!("8) '{}' has {} permutations {:?}", test_eight_input, test_eight_output.len(), test_eight_output);
let test_nine_input = "uprasupradupra";
let test_nine_output = nine(test_nine_input); | random_line_split |
main.rs | use std::collections::HashMap;
fn main() {
let test_one_input = "Today is Monday";
let max_chars = one(test_one_input);
println!("1) the most of a char(first appearing) in '{}' is '{}', appearing {} times", test_one_input, max_chars.0, max_chars.1);
let test_two_input = "supracalafragalisticexpealadoc... |
while l > 0 && r < m && i[l].0 == i[r].0 {
l = l - 1;
r = r + 1;
}
l = std::cmp::max(0, l);
r = std::cmp::min(i.len() - 1, r);
let begin = i[l+1].1;
let end = std::cmp::min(input.len() - 1,i[r].1);
let result = String::from(&input[begin..end]);
result
}
fn twentyone(i: ... | { // we are not the same assume a center "pivot" character center
r = r + 1;
} | conditional_block |
main.rs | use std::collections::HashMap;
fn main() {
let test_one_input = "Today is Monday";
let max_chars = one(test_one_input);
println!("1) the most of a char(first appearing) in '{}' is '{}', appearing {} times", test_one_input, max_chars.0, max_chars.1);
let test_two_input = "supracalafragalisticexpealadoc... | (input: &str) -> String {
let mut r = String::new();
input.chars().for_each( | c | {
r = format!("{}{}", c, r);
});
r
}
fn seven(i1: &str, i2: &str) -> String {
let mut r2 = String::from(i2);
if i1.len() == 0 {
return r2;
}
r2.push(i1.chars().last().unwrap());
let si... | six | identifier_name |
output.rs | use super::Token;
pub use json::object::Object;
pub use json::JsonValue;
use nom::{
alt, call, do_parse, error_position, is_not, many0, map, named, opt, separated_list, tag, value,
};
use log::{error, info};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ResultClass {
Done,
Running,
Connected,
... | let byte = input[0];
if byte == b'\"' {
IResult::Error(::nom::ErrorKind::Custom(1)) //what are we supposed to return here??
} else {
IResult::Done(&input[1..], byte)
}
}
named!(
escaped_character<u8>,
alt!(
value!(b'\n', tag!("\\n"))
| value!(b'\r', tag!("\\r... | | value!(ResultClass::Exit, tag!("exit"))
)
);
fn non_quote_byte(input: &[u8]) -> IResult<&[u8], u8> { | random_line_split |
output.rs | use super::Token;
pub use json::object::Object;
pub use json::JsonValue;
use nom::{
alt, call, do_parse, error_position, is_not, many0, map, named, opt, separated_list, tag, value,
};
use log::{error, info};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ResultClass {
Done,
Running,
Connected,
... |
}
result_pipe.send(record).expect("send result to pipe");
}
Output::OutOfBand(record) => {
if let OutOfBandRecord::AsyncRecord {
class: AsyncClass::Stopped,
... | {} | conditional_block |
output.rs | use super::Token;
pub use json::object::Object;
pub use json::JsonValue;
use nom::{
alt, call, do_parse, error_position, is_not, many0, map, named, opt, separated_list, tag, value,
};
use log::{error, info};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ResultClass {
Done,
Running,
Connected,
... | (line: &str) -> Result<Self, String> {
match output(line.as_bytes()) {
IResult::Done(_, c) => Ok(c),
IResult::Incomplete(e) => Err(format!("parsing line: incomplete {:?}", e)), //Is it okay to read the next bytes then?
IResult::Error(e) => Err(format!("parse error: {}", e)),
... | parse | identifier_name |
miopoll.rs | use crate::mio::event::{Event, Source};
use crate::mio::{Events, Interest, Poll, Token, Waker};
use slab::Slab;
use stakker::{fwd_nop, Fwd, Stakker};
use std::cell::RefCell;
use std::io::{Error, ErrorKind, Result};
use std::ops::{Deref, DerefMut};
use std::rc::Rc;
use std::sync::Arc;
use std::time::Duration;
const WAK... | waker: Arc<Waker>,
}
impl Control {
#[inline]
fn del(&mut self, token: Token, handle: &mut impl Source) -> Result<()> {
let rv = retry(|| self.poll.registry().deregister(handle));
if self.token_map.contains(token.into()) {
self.token_map.remove(token.into());
return ... | // only for 0..=9
queues: [Vec<QueueEvent>; MAX_PRI as usize],
max_pri: u32,
events: Events,
errors: Vec<Error>, | random_line_split |
miopoll.rs | use crate::mio::event::{Event, Source};
use crate::mio::{Events, Interest, Poll, Token, Waker};
use slab::Slab;
use stakker::{fwd_nop, Fwd, Stakker};
use std::cell::RefCell;
use std::io::{Error, ErrorKind, Result};
use std::ops::{Deref, DerefMut};
use std::rc::Rc;
use std::sync::Arc;
use std::time::Duration;
const WAK... |
}
self.events.clear();
if!done {
for qu in self.queues.iter_mut().rev() {
if!qu.is_empty() {
for qev in qu.drain(..) {
if let Some(ref mut entry) = self.token_map.get_mut(qev.token) {
done = true... | {
// Fast-path for highest priority level present in
// registrations, so if user uses only one priority level,
// there is no queuing necessary here.
let ready = Ready::new(ev);
if entry.pri == self.max_pri {
done = tru... | conditional_block |
miopoll.rs | use crate::mio::event::{Event, Source};
use crate::mio::{Events, Interest, Poll, Token, Waker};
use slab::Slab;
use stakker::{fwd_nop, Fwd, Stakker};
use std::cell::RefCell;
use std::io::{Error, ErrorKind, Result};
use std::ops::{Deref, DerefMut};
use std::rc::Rc;
use std::sync::Arc;
use std::time::Duration;
const WAK... | {
token_map: Slab<Entry>,
poll: Poll,
// Highest priority in use goes on a fast path so we need queues
// only for 0..=9
queues: [Vec<QueueEvent>; MAX_PRI as usize],
max_pri: u32,
events: Events,
errors: Vec<Error>,
waker: Arc<Waker>,
}
impl Control {
#[inline]
fn del(&mut ... | Control | identifier_name |
internals.rs | use rustfft::FftPlanner;
use crate::utils::buffer::ComplexComponent;
use crate::utils::buffer::{copy_complex_to_real, square_sum};
use crate::utils::buffer::{copy_real_to_complex, BufferPool};
use crate::utils::peak::choose_peak;
use crate::utils::peak::correct_peak;
use crate::utils::peak::detect_peaks;
use crate::ut... | <T>
where
T: Float,
{
pub frequency: T,
pub clarity: T,
}
/// Data structure to hold any buffers needed for pitch computation.
/// For WASM it's best to allocate buffers once rather than allocate and
/// free buffers repeatedly, so we use a `BufferPool` object to manage the buffers.
pub struct DetectorInte... | Pitch | identifier_name |
internals.rs | use rustfft::FftPlanner;
use crate::utils::buffer::ComplexComponent;
use crate::utils::buffer::{copy_complex_to_real, square_sum};
use crate::utils::buffer::{copy_real_to_complex, BufferPool};
use crate::utils::peak::choose_peak;
use crate::utils::peak::correct_peak;
use crate::utils::peak::detect_peaks;
use crate::ut... | // adding this to our sum.
square_error
.iter_mut()
.enumerate()
.skip(1)
.for_each(|(i, a)| {
sum = sum + *a;
*a = *a * T::from_usize(i + 1).unwrap() / sum;
});
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn windowed_autocorrelation... | square_error[0] = T::one();
// square_error[0] should always be zero, so we don't need to worry about | random_line_split |
internals.rs | use rustfft::FftPlanner;
use crate::utils::buffer::ComplexComponent;
use crate::utils::buffer::{copy_complex_to_real, square_sum};
use crate::utils::buffer::{copy_real_to_complex, BufferPool};
use crate::utils::peak::choose_peak;
use crate::utils::peak::correct_peak;
use crate::utils::peak::detect_peaks;
use crate::ut... | .iter_mut()
.for_each(|x| *x = (*x * 100.).round() / 100.);
assert_eq!(result, computed_result);
}
#[test]
fn windowed_square_error_test() {
let signal: Vec<f64> = vec![0., 1., 2., 0., -1., -2.];
let window_size: usize = 3;
let buffers = &mut BufferP... | {
let signal: Vec<f64> = vec![0., 1., 2., 0., -1., -2.];
let window_size: usize = 3;
let buffers = &mut BufferPool::new(signal.len());
let result: Vec<f64> = (0..window_size)
.map(|i| {
signal[..window_size]
.iter()
.z... | identifier_body |
main.rs | #![cfg_attr(feature = "with-bench", feature(test))]
extern crate actix_net;
extern crate actix_web;
extern crate bech32;
extern crate bincode;
extern crate bytes;
extern crate cardano;
extern crate cardano_storage;
extern crate cbor_event;
extern crate chain_addr;
extern crate chain_core;
extern crate chain_crypto;
ext... | GenPrivKeyType::Ed25519Extended => gen_priv_key_bech32::<Ed25519Extended>(),
GenPrivKeyType::FakeMMM => gen_priv_key_bech32::<FakeMMM>(),
GenPrivKeyType::Curve25519_2HashDH => gen_priv_key_bech32::<Curve25519_2HashDH>(),
};
println!("{}", priv_key_... | {
let command = match Command::load() {
Err(err) => {
eprintln!("{}", err);
std::process::exit(1);
}
Ok(v) => v,
};
match command {
Command::Start(start_settings) => {
if let Err(error) = start(start_settings) {
eprintln!("... | identifier_body |
main.rs | #![cfg_attr(feature = "with-bench", feature(test))]
extern crate actix_net;
extern crate actix_web;
extern crate bech32;
extern crate bincode;
extern crate bytes;
extern crate cardano;
extern crate cardano_storage;
extern crate cbor_event;
extern crate chain_addr;
extern crate chain_core;
extern crate chain_crypto;
ext... | match command {
Command::Start(start_settings) => {
if let Err(error) = start(start_settings) {
eprintln!("jormungandr error: {}", error);
std::process::exit(1);
}
}
Command::GeneratePrivKey(args) => {
let priv_key_bech32 = ... | random_line_split | |
main.rs | #![cfg_attr(feature = "with-bench", feature(test))]
extern crate actix_net;
extern crate actix_web;
extern crate bech32;
extern crate bincode;
extern crate bytes;
extern crate cardano;
extern crate cardano_storage;
extern crate cbor_event;
extern crate chain_addr;
extern crate chain_core;
extern crate chain_crypto;
ext... |
Ok(v) => v,
};
match command {
Command::Start(start_settings) => {
if let Err(error) = start(start_settings) {
eprintln!("jormungandr error: {}", error);
std::process::exit(1);
}
}
Command::GeneratePrivKey(args) => {
... | {
eprintln!("{}", err);
std::process::exit(1);
} | conditional_block |
main.rs | #![cfg_attr(feature = "with-bench", feature(test))]
extern crate actix_net;
extern crate actix_web;
extern crate bech32;
extern crate bincode;
extern crate bytes;
extern crate cardano;
extern crate cardano_storage;
extern crate cbor_event;
extern crate chain_addr;
extern crate chain_core;
extern crate chain_crypto;
ext... | (
gd: &GenesisData,
blockchain: &Blockchain<Cardano>,
_settings: &settings::start::Settings,
) {
println!(
"k={} tip={}",
gd.epoch_stability_depth,
blockchain.get_tip()
);
}
// Expand the type with more variants
// when it becomes necessary to represent different error cases... | startup_info | identifier_name |
table.rs | use std::convert::TryFrom;
use std::io::{self, Write};
#[derive(Debug)]
#[derive(Clone)]
pub struct Table {
// A vector of columns (vectors) of rows. Each column represents an implicant set.
entries: Vec<Vec<Row>>,
// the SOP min-term list
all_implicants: Vec<u32>,
// bit size of the data
bit... |
// Put together the base implicants of the candidate new implicant
temp_implicants = [work_set[i].implicants.clone(), work_set[a].implicants.clone()].concat();
// LOgic not right!!!!!!
// Test to see if the i... | {
continue;
} | conditional_block |
table.rs | use std::convert::TryFrom;
use std::io::{self, Write};
#[derive(Debug)]
#[derive(Clone)]
pub struct Table {
// A vector of columns (vectors) of rows. Each column represents an implicant set.
entries: Vec<Vec<Row>>,
// the SOP min-term list
all_implicants: Vec<u32>,
// bit size of the data
bit... | } else if x.ones == * pivot {
equal.push(x.clone());
} else {
larger.push(x.clone());
}
}
// return recursivly.
[quick_sort(smaller), equal, quick_sort(larger)].concat()
}
pub fn initialize_table (sop: & Vec<u32>) -> Table {
// Get the bit size nee... | {
// If the array has a length less than or equal to one then it is already sorted
if & table.len() <= & 1 {
return table
}
// delare the three vectors
let mut smaller: Vec<Row> = Vec::new();
let mut equal: Vec<Row> = Vec::new();
let mut larger: Vec<Row> = Vec::new();
// Get ... | identifier_body |
table.rs | use std::convert::TryFrom;
use std::io::{self, Write};
#[derive(Debug)]
#[derive(Clone)]
pub struct Table {
// A vector of columns (vectors) of rows. Each column represents an implicant set.
entries: Vec<Vec<Row>>,
// the SOP min-term list
all_implicants: Vec<u32>,
// bit size of the data
bit... | };
// initialize a vector of row
let mut vec_of_rows: Vec<Row> = Vec::new();
// Throw a row into the vector of rows
for i in sop {
the_row.bin = dec_2_bin_vec(i, &bit_size);
the_row.ones = sum_bin_vec(& the_row.bin);
the_row.implicants = vec![*i];
vec_of_rows.pu... | bin: vec![0,0,0,0],
ones: 0,
implicants: vec![0], | random_line_split |
table.rs | use std::convert::TryFrom;
use std::io::{self, Write};
#[derive(Debug)]
#[derive(Clone)]
pub struct Table {
// A vector of columns (vectors) of rows. Each column represents an implicant set.
entries: Vec<Vec<Row>>,
// the SOP min-term list
all_implicants: Vec<u32>,
// bit size of the data
bit... | (mut table: Table) -> Table {
// imps is a vector of rows that houses the new column of implicants
let mut imps: Vec<Row> = Vec::new();
// num_dashes is a u32 that contains the number of dashes (don't cares) in a row. If
// there is more or less than one then the rows cannot be combined.
let mut ... | initial_comparison | identifier_name |
utils.rs | use crate::config::{config, CheckLook, CritterRates, MovingRates, SenseRates};
use tnf_common::{
dll::param_getters,
engine_types::{critter::Critter, map::Map},
primitives::{Hex, MaybeInvalid},
utils::map::{
get_distance_hex,
server::{get_hex_in_path, get_hex_in_path_wall},
HexEx... | {
if(!player.IsPlayer() ) return false;
if(!isLoadedGMs )
LoadGMs( player, 0, 0, 0 );
if( player.StatBase[ ST_ACCESS_LEVEL ] < ACCESS_MODER && ( player.GetAccess() >= ACCESS_MODER || isPocketGM( player.Id ) ) )
player.StatBase[ ST_ACCESS_LEVEL ] = ACCESS_MODER;
return player.StatBase[ ST_ACCESS_LEVEL ] >= ACCESS_MOD... | random_line_split | |
utils.rs | use crate::config::{config, CheckLook, CritterRates, MovingRates, SenseRates};
use tnf_common::{
dll::param_getters,
engine_types::{critter::Critter, map::Map},
primitives::{Hex, MaybeInvalid},
utils::map::{
get_distance_hex,
server::{get_hex_in_path, get_hex_in_path_wall},
HexEx... | er, rates: &MovingRates) -> f32 {
if cr.IsRuning {
rates.running
//} else if cr.is_walking() {
// rates.walking
} else {
rates.still
}
}
fn sense_mul(rates: &SenseRates, cr: &Critter, opponent: &Critter, look_dir: i8) -> f32 {
rates.dir... | (cr: &Critt | identifier_name |
utils.rs | use crate::config::{config, CheckLook, CritterRates, MovingRates, SenseRates};
use tnf_common::{
dll::param_getters,
engine_types::{critter::Critter, map::Map},
primitives::{Hex, MaybeInvalid},
utils::map::{
get_distance_hex,
server::{get_hex_in_path, get_hex_in_path_wall},
HexEx... | enses: Vec<(f32, f32)> = config
.senses
.iter()
.map(|sense| {
let critter_rates = if self_is_npc {
&sense.npc
} else {
&sense.player
};
let basic_dist = basic_dist(critter_rates, cr_perception);
let sense_m... | ates.dir_rate[look_dir as usize]
* moving_rate(cr, &rates.self_moving)
* moving_rate(opponent, &rates.target_moving)
}
let s | identifier_body |
utils.rs | use crate::config::{config, CheckLook, CritterRates, MovingRates, SenseRates};
use tnf_common::{
dll::param_getters,
engine_types::{critter::Critter, map::Map},
primitives::{Hex, MaybeInvalid},
utils::map::{
get_distance_hex,
server::{get_hex_in_path, get_hex_in_path_wall},
HexEx... | ;
if dist > cr_hex.get_distance(end_hex) {
is_view = false;
hear_mul *= match cr_perception {
1..=4 => 0.1,
5..=8 => 0.3,
9..=10 => 0.4,
_ => 1.0,
};
}
if dist > max_view {
is_view = false;
}
let max_hear = (max_hear as... | , cr_hex, opp_hex, 0.0, dist) | conditional_block |
fifo.rs | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... | (
#[values(true, false)] unbounded_file: bool,
) -> Result<()> {
// Create session context
let config = SessionConfig::new()
.with_batch_size(TEST_BATCH_SIZE)
.with_collect_statistics(false)
.with_target_partitions(1);
let ctx = SessionContext::with_c... | unbounded_file_with_swapped_join | identifier_name |
fifo.rs | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... | else {
JoinOperation::LeftUnmatched
};
operations.push(op);
}
tasks.into_iter().for_each(|jh| jh.join().unwrap());
// The SymmetricHashJoin executor produces FULL join results at every
// pruning, which happens before it reaches the end of input a... | {
JoinOperation::RightUnmatched
} | conditional_block |
fifo.rs | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... | }
// This test provides a relatively realistic end-to-end scenario where
// we swap join sides to accommodate a FIFO source.
#[rstest]
#[timeout(std::time::Duration::from_secs(30))]
#[tokio::test(flavor = "multi_thread", worker_threads = 8)]
async fn unbounded_file_with_swapped_join(
... | }
}
return Err(DataFusionError::Execution(e.to_string()));
}
Ok(()) | random_line_split |
main.rs | use clap::{App, AppSettings, Arg, SubCommand};
use default_boxed::DefaultBoxed;
#[derive(DefaultBoxed)]
struct Outer<'a, 'b> {
inner: HeapApp<'a, 'b>,
}
struct HeapApp<'a, 'b> {
app: App<'a, 'b>,
}
impl<'a, 'b> Default for HeapApp<'a, 'b> {
fn | () -> Self {
let mut app = App::new("servicemanagement1")
.setting(clap::AppSettings::ColoredHelp)
.author("Sebastian Thiel <byronimo@gmail.com>")
.version("0.1.0-20200619")
.about("Google Service Management allows service producers to publish their services on Google... | default | identifier_name |
main.rs | use clap::{App, AppSettings, Arg, SubCommand};
use default_boxed::DefaultBoxed;
#[derive(DefaultBoxed)]
struct Outer<'a, 'b> {
inner: HeapApp<'a, 'b>,
}
struct HeapApp<'a, 'b> {
app: App<'a, 'b>,
}
impl<'a, 'b> Default for HeapApp<'a, 'b> {
fn default() -> Self {
let mut app = App::new("servicema... | use google_servicemanagement1 as api;
fn main() {
// TODO: set homedir afterwards, once the address is unmovable, or use Pin for the very first time
// to allow a self-referential structure :D!
let _home_dir = dirs::config_dir()
.expect("configuration directory can be obtained")
.join("google... | random_line_split | |
main.rs | use clap::{App, AppSettings, Arg, SubCommand};
use default_boxed::DefaultBoxed;
#[derive(DefaultBoxed)]
struct Outer<'a, 'b> {
inner: HeapApp<'a, 'b>,
}
struct HeapApp<'a, 'b> {
app: App<'a, 'b>,
}
impl<'a, 'b> Default for HeapApp<'a, 'b> {
fn default() -> Self {
let mut app = App::new("servicema... | {
// TODO: set homedir afterwards, once the address is unmovable, or use Pin for the very first time
// to allow a self-referential structure :D!
let _home_dir = dirs::config_dir()
.expect("configuration directory can be obtained")
.join("google-service-cli");
let outer = Outer::default_... | identifier_body | |
ycsb.rs | the data stored under a bytestring key of `self.key_len` bytes.
// - set: A function that stores the data stored under a bytestring key of `self.key_len` bytes
// with a bytestring value of `self.value_len` bytes.
// # Return
// A three tuple consisting of the duration that this thread ran th... |
// Add the receiver to a netbricks pipeline.
match scheduler.add_task(YcsbRecv::new(
ports[0].clone(),
34 * 1000 * 1000 as u64,
master,
native,
)) {
Ok(_) => {
info!(
"Successfully added YcsbRecv with rx queue {}.",
ports[... | {
error!("Client should be configured with exactly 1 port!");
std::process::exit(1);
} | conditional_block |
ycsb.rs | the data stored under a bytestring key of `self.key_len` bytes.
// - set: A function that stores the data stored under a bytestring key of `self.key_len` bytes
// with a bytestring value of `self.value_len` bytes.
// # Return
// A three tuple consisting of the duration that this thread ran th... | let mut p_get = self.payload_get.borrow_mut();
let mut p_put = self.payload_put.borrow_mut();
// XXX Heavily dependent on how `Ycsb` creates a key. Only the first four
// bytes of the key matter, the rest are zero. The value is always zero.
... | {
// Return if there are no more requests to generate.
if self.requests <= self.sent {
return;
}
// Get the current time stamp so that we can determine if it is time to issue the next RPC.
let curr = cycles::rdtsc();
// If it is either time to send out a req... | identifier_body |
ycsb.rs | fetches the data stored under a bytestring key of `self.key_len` bytes.
// - set: A function that stores the data stored under a bytestring key of `self.key_len` bytes
// with a bytestring value of `self.value_len` bytes.
// # Return
// A three tuple consisting of the duration that this threa... | // Setup Netbricks.
let mut net_context = setup::config_and_init_netbricks(&config);
// Setup the client pipeline.
net_context.start_schedulers();
// The core id's which will run the sender and receiver threads.
// XXX The following two arrays heavily depend on the set of cores
// configur... | random_line_split | |
ycsb.rs | the data stored under a bytestring key of `self.key_len` bytes.
// - set: A function that stores the data stored under a bytestring key of `self.key_len` bytes
// with a bytestring value of `self.value_len` bytes.
// # Return
// A three tuple consisting of the duration that this thread ran th... | (port: T, resps: u64, master: bool, native: bool) -> YcsbRecv<T> {
YcsbRecv {
receiver: dispatch::Receiver::new(port),
responses: resps,
start: cycles::rdtsc(),
recvd: 0,
latencies: Vec::with_capacity(resps as usize),
master: master,
... | new | identifier_name |
workspace.rs | Error>>>;
pub type ReportFuture<T> =
future::Shared<BoxFuture<(T, ReportTree), CancelError<ReportTree>>>;
struct WorkspaceFileInner {
workspace: Arc<RwLock<WorkspaceShared>>,
pool: Arc<CpuPool>,
cancel_token: CancelToken,
source: Arc<RwLock<Source>>,
message_locale: Locale,
path: PathBuf,... | (&mut self, version: u64,
event: protocol::TextDocumentContentChangeEvent) -> WorkspaceResult<()> {
// TODO, there are several ambiguities with offsets?
if event.range.is_some() || event.rangeLength.is_some() {
return Err(WorkspaceError("incremental edits not yet supp... | apply_change | identifier_name |
workspace.rs | ::Error>>>;
pub type ReportFuture<T> =
future::Shared<BoxFuture<(T, ReportTree), CancelError<ReportTree>>>;
struct WorkspaceFileInner {
workspace: Arc<RwLock<WorkspaceShared>>,
pool: Arc<CpuPool>,
cancel_token: CancelToken,
source: Arc<RwLock<Source>>,
message_locale: Locale,
path: PathBu... | impl fmt::Debug for Workspace {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Workspace")
.field("message_locale", &self.message_locale)
.field("pool", &Ellipsis)
.field("files", &self.files)
.field("source", &Ellipsis)
.field("shared", &self.... | random_line_split | |
workspace.rs | let source = inner.source.read();
let path = source.file(span.unit()).map(|f| f.path());
let diags = ReportTree::new(inner.message_locale, path);
let report = diags.report(|span| diags::translate_span(span, &source));
... | {
if let Ok(path) = uri_to_path(uri) {
let file = self.ensure_file(&path);
file.cancel();
let _ = file.ensure_chunk();
Some(file)
} else {
None
}
} | identifier_body | |
menu.rs | //! Menu abstrction module
use std::collections::HashMap;
use std::rc::Rc;
use std::cell::RefCell;
use dbusmenu::ComCanonicalDbusmenu;
use dbus::arg;
use dbus;
#[derive(Default)]
pub struct Menu {
/// - `revision: i32`: The revision number of the layout.
/// For matching with layoutUpdated signals.
revis... |
fn get_status(&self) -> Result<String, Self::Err> {
println!("get_status called!");
// Menus will always be in "normal" state, may change later on
Ok("normal".into())
}
}
#[derive(Default, Clone)]
pub struct MData;
impl<'a> dbus::tree::DataType for MData {
type Tree = ();
type ... |
// ????
println!("about_to_show called!");
Ok(3)
}
| identifier_body |
menu.rs | //! Menu abstrction module
use std::collections::HashMap;
use std::rc::Rc;
use std::cell::RefCell;
use dbusmenu::ComCanonicalDbusmenu;
use dbus::arg;
use dbus;
#[derive(Default)]
pub struct Menu {
/// - `revision: i32`: The revision number of the layout.
/// For matching with layoutUpdated signals.
revis... | &self) -> Result<u32, Self::Err> {
//????
println!("about_to_show called!");
Ok(3)
}
fn get_status(&self) -> Result<String, Self::Err> {
println!("get_status called!");
// Menus will always be in "normal" state, may change later on
Ok("normal".into())
}
}
#[... | et_version( | identifier_name |
menu.rs | //! Menu abstrction module
use std::collections::HashMap;
use std::rc::Rc;
use std::cell::RefCell;
use dbusmenu::ComCanonicalDbusmenu;
use dbus::arg;
use dbus;
#[derive(Default)]
pub struct Menu {
/// - `revision: i32`: The revision number of the layout.
/// For matching with layoutUpdated signals.
revis... | }
#[derive(Default, Clone)]
pub struct MData;
impl<'a> dbus::tree::DataType for MData {
type Tree = ();
type ObjectPath = Menu; // Every objectpath in the tree now owns a menu object.
type Property = ();
type Interface = ();
type Method = ();
type Signal = ();
}
/// Since parts of the menu ar... | random_line_split | |
poll_evented.rs | use crate::io::driver::{Direction, Handle, ReadyEvent};
use crate::io::registration::Registration;
use crate::io::{AsyncRead, AsyncWrite, ReadBuf};
use mio::event::Evented;
use std::fmt;
use std::io::{self, Read, Write};
use std::marker::Unpin;
use std::pin::Pin;
use std::task::{Context, Poll};
cfg_io_driver! {
/... | (mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
loop {
let ev = ready!(self.poll_write_ready(cx))?;
let r = (*self).get_mut().flush();
if is_wouldblock(&r) {
self.clear_readiness(ev);
continue;
}
... | poll_flush | identifier_name |
poll_evented.rs | use crate::io::driver::{Direction, Handle, ReadyEvent};
use crate::io::registration::Registration;
use crate::io::{AsyncRead, AsyncWrite, ReadBuf};
use mio::event::Evented;
use std::fmt;
use std::io::{self, Read, Write};
use std::marker::Unpin;
use std::pin::Pin;
use std::task::{Context, Poll};
cfg_io_driver! {
/... |
/// Returns a shared reference to the underlying I/O object this readiness
/// stream is wrapping.
#[cfg(any(
feature = "process",
feature = "tcp",
feature = "udp",
feature = "uds",
feature = "signal"
))]
pub(crate) fn get_ref(&self) -> &E {
self.io.... | {
let registration = Registration::new_with_ready_and_handle(&io, ready, handle)?;
Ok(Self {
io: Some(io),
registration,
})
} | identifier_body |
poll_evented.rs | use crate::io::driver::{Direction, Handle, ReadyEvent};
use crate::io::registration::Registration;
use crate::io::{AsyncRead, AsyncWrite, ReadBuf};
use mio::event::Evented;
use std::fmt;
use std::io::{self, Read, Write};
use std::marker::Unpin;
use std::pin::Pin;
use std::task::{Context, Poll};
cfg_io_driver! {
/... |
return Poll::Ready(r.map(|n| {
buf.add_filled(n);
}));
}
}
}
impl<E> AsyncWrite for PollEvented<E>
where
E: Evented + Write + Unpin,
{
fn poll_write(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<io::Resul... | {
self.clear_readiness(ev);
continue;
} | conditional_block |
poll_evented.rs | use crate::io::driver::{Direction, Handle, ReadyEvent};
use crate::io::registration::Registration;
use crate::io::{AsyncRead, AsyncWrite, ReadBuf};
use mio::event::Evented;
use std::fmt;
use std::io::{self, Read, Write};
use std::marker::Unpin;
use std::pin::Pin;
use std::task::{Context, Poll};
cfg_io_driver! {
/... | ///
/// # Warning
///
/// This method may not be called concurrently. It takes `&self` to allow
/// calling it concurrently with `poll_write_ready`.
pub(crate) fn poll_read_ready(&self, cx: &mut Context<'_>) -> Poll<io::Result<ReadyEvent>> {
self.registration.poll_readiness(cx, Direction... | /// This function panics if:
///
/// * `ready` includes writable.
/// * called from outside of a task context. | random_line_split |
util.rs | // Copyright 2019-2023 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
use std::{
collections::VecDeque,
future::Future,
sync::{
atomic::{self, AtomicU64},
Arc,
},
};
use crate::ipld::{CidHashSet, Ipld};
use crate::shim::clock::ChainEpoch;
use crate::utils::db::car_stream... | }
}
enum Task {
// Yield the block, don't visit it.
Emit(Cid),
// Visit all the elements, recursively.
Iterate(DfsIter),
}
pin_project! {
pub struct ChainStream<DB, T> {
#[pin]
tipset_iter: T,
db: DB,
dfs: VecDeque<Task>, // Depth-first work queue.
seen:... | Ipld::Map(map) => map.into_values().rev().for_each(|elt| self.walk_next(elt)),
other => return Some(other),
}
}
None | random_line_split |
util.rs | // Copyright 2019-2023 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
use std::{
collections::VecDeque,
future::Future,
sync::{
atomic::{self, AtomicU64},
Arc,
},
};
use crate::ipld::{CidHashSet, Ipld};
use crate::shim::clock::ChainEpoch;
use crate::utils::db::car_stream... |
/// Depth-first-search iterator for `ipld` leaf nodes.
///
/// This iterator consumes the given `ipld` structure and returns leaf nodes (i.e.,
/// no list or map) in depth-first order. The iterator can be extended at any
/// point by the caller.
///
/// Consider walking this `ipld` graph:
/// ```text
/// List
/// ├ ... | {
// Don't include identity CIDs.
// We only include raw and dagcbor, for now.
// Raw for "code" CIDs.
if cid.hash().code() == u64::from(cid::multihash::Code::Identity) {
false
} else {
matches!(
cid.codec(),
crate::shim::crypto::IPLD_RAW | fvm_ipld_encoding::... | identifier_body |
util.rs | // Copyright 2019-2023 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
use std::{
collections::VecDeque,
future::Future,
sync::{
atomic::{self, AtomicU64},
Arc,
},
};
use crate::ipld::{CidHashSet, Ipld};
use crate::shim::clock::ChainEpoch;
use crate::utils::db::car_stream... | Yield the block, don't visit it.
Emit(Cid),
// Visit all the elements, recursively.
Iterate(DfsIter),
}
pin_project! {
pub struct ChainStream<DB, T> {
#[pin]
tipset_iter: T,
db: DB,
dfs: VecDeque<Task>, // Depth-first work queue.
seen: CidHashSet,
statero... | // | identifier_name |
octree_gui.rs | use std::collections::VecDeque;
use std::ops::RangeInclusive;
use std::sync::{Arc, Mutex};
use std::time::Duration;
use cgmath::{Rotation, Vector3};
use glium::{Display, Surface};
use glium::glutin;
use glium::glutin::event::WindowEvent;
use glium::glutin::window::WindowBuilder;
use imgui::*;
use imgui::{Context, Font... | (&mut self) -> Vec<Filter> {
vec![
crate::filter!(Octree, Mesh, Transformation),
crate::filter!(Camera, Transformation),
]
}
fn handle_input(&mut self, _event: &Event<()>) {
let platform = &mut self.platform;
let display = self.display.lock().unwrap();
... | get_filter | identifier_name |
octree_gui.rs | use std::collections::VecDeque;
use std::ops::RangeInclusive;
use std::sync::{Arc, Mutex};
use std::time::Duration;
use cgmath::{Rotation, Vector3};
use glium::{Display, Surface};
use glium::glutin;
use glium::glutin::event::WindowEvent;
use glium::glutin::window::WindowBuilder;
use imgui::*;
use imgui::{Context, Font... |
fn handle_input(&mut self, _event: &Event<()>) {
let platform = &mut self.platform;
let display = self.display.lock().unwrap();
let gl_window = display.gl_window();
let mut imgui = self.imgui.lock().unwrap();
match _event {
Event::MainEventsCleared => {
... | {
vec![
crate::filter!(Octree, Mesh, Transformation),
crate::filter!(Camera, Transformation),
]
} | identifier_body |
octree_gui.rs | use std::collections::VecDeque;
use std::ops::RangeInclusive;
use std::sync::{Arc, Mutex};
use std::time::Duration;
use cgmath::{Rotation, Vector3};
use glium::{Display, Surface};
use glium::glutin;
use glium::glutin::event::WindowEvent;
use glium::glutin::window::WindowBuilder;
use imgui::*;
use imgui::{Context, Font... | view_dir.as_mut(),
).read_only(true).build();
InputFloat3::new(
&ui,
im_str!("Camera Position"),
camera_transform.position.as_mut(),
).build();
camera_transform.update();
}
}
}
impl System for ... | random_line_split | |
lib.rs | //! This is a platform agnostic Rust driver for the MAX3010x high-sensitivity
//! pulse oximeter and heart-rate sensor for wearable health, based on the
//! [`embedded-hal`] traits.
//!
//! [`embedded-hal`]: https://github.com/rust-embedded/embedded-hal
//!
//! This driver allows you to:
//! - Get the number of samples... |
pub struct MultiLed(());
}
pub mod ic {
pub struct Max30102(());
}
}
/// MAX3010x device driver.
#[derive(Debug, Default)]
pub struct Max3010x<I2C, IC, MODE> {
/// The concrete I²C device implementation.
i2c: I2C,
temperature_measurement_started: bool,
mode: Config,
fif... | ter(()); | identifier_name |
lib.rs | //! This is a platform agnostic Rust driver for the MAX3010x high-sensitivity
//! pulse oximeter and heart-rate sensor for wearable health, based on the
//! [`embedded-hal`] traits.
//!
//! [`embedded-hal`]: https://github.com/rust-embedded/embedded-hal
//!
//! This driver allows you to:
//! - Get the number of samples... | const DEVICE_ADDRESS: u8 = 0b101_0111;
struct Register;
impl Register {
const INT_STATUS: u8 = 0x0;
const INT_EN1: u8 = 0x02;
const INT_EN2: u8 = 0x03;
const FIFO_WR_PTR: u8 = 0x04;
const OVF_COUNTER: u8 = 0x05;
const FIFO_DATA: u8 = 0x07;
const FIFO_CONFIG: u8 = 0x08;
const MODE: u8 =... | pub alc_overflow: bool,
/// Internal die temperature conversion ready interrupt
pub temperature_ready: bool,
}
| random_line_split |
asn1.rs | //! Support for ECDSA signatures encoded as ASN.1 DER.
// Adapted from BearSSL. Copyright (c) 2016 Thomas Pornin <pornin@bolet.org>.
// Relicensed under Apache 2.0 + MIT (from original MIT) with permission.
//
// <https://www.bearssl.org/gitweb/?p=BearSSL;a=blob;f=src/ec/ecdsa_atr.c>
// <https://www.bearssl.org/gitweb... | (&self) -> &[u8] {
&self.bytes.as_slice()[..self.len()]
}
/// Serialize this signature as a boxed byte slice
#[cfg(feature = "alloc")]
pub fn to_bytes(&self) -> Box<[u8]> {
self.as_bytes().to_vec().into_boxed_slice()
}
/// Create an ASN.1 DER encoded signature from big endian `... | as_bytes | identifier_name |
asn1.rs | //! Support for ECDSA signatures encoded as ASN.1 DER.
// Adapted from BearSSL. Copyright (c) 2016 Thomas Pornin <pornin@bolet.org>.
// Relicensed under Apache 2.0 + MIT (from original MIT) with permission.
//
// <https://www.bearssl.org/gitweb/?p=BearSSL;a=blob;f=src/ec/ecdsa_atr.c>
// <https://www.bearssl.org/gitweb... | serialize_int(r, &mut bytes[offset..], r_len, scalar_size);
let r_end = offset.checked_add(2).unwrap().checked_add(r_len).unwrap();
// Second INTEGER (s)
serialize_int(s, &mut bytes[r_end..], s_len, scalar_size);
let s_end = r_end.checked_add(2).unwrap().checked_add(s_len).unwra... | {
let r_len = int_length(r);
let s_len = int_length(s);
let scalar_size = C::FieldSize::to_usize();
let mut bytes = DocumentBytes::<C>::default();
// SEQUENCE header
bytes[0] = SEQUENCE_TAG as u8;
let zlen = r_len.checked_add(s_len).unwrap().checked_add(4).unwrap... | identifier_body |
asn1.rs | //! Support for ECDSA signatures encoded as ASN.1 DER.
// Adapted from BearSSL. Copyright (c) 2016 Thomas Pornin <pornin@bolet.org>.
// Relicensed under Apache 2.0 + MIT (from original MIT) with permission.
//
// <https://www.bearssl.org/gitweb/?p=BearSSL;a=blob;f=src/ec/ecdsa_atr.c>
// <https://www.bearssl.org/gitweb... |
if bytes[0]!= 0 {
return Err(Error::new());
}
bytes = &bytes[1..];
offset += 1;
}
while!bytes.is_empty() && bytes[0] == 0 {
bytes = &bytes[1..];
offset += 1;
}
Ok(offset)
}
#[cfg(all(feature = "dev", test))]
mod tests {
use crate::dev... | {
return Err(Error::new());
} | conditional_block |
asn1.rs | //! Support for ECDSA signatures encoded as ASN.1 DER.
// Adapted from BearSSL. Copyright (c) 2016 Thomas Pornin <pornin@bolet.org>.
// Relicensed under Apache 2.0 + MIT (from original MIT) with permission.
//
// <https://www.bearssl.org/gitweb/?p=BearSSL;a=blob;f=src/ec/ecdsa_atr.c>
// <https://www.bearssl.org/gitweb... | if s_end!= bytes.as_ref().len() {
return Err(Error::new());
}
let mut byte_arr = DocumentBytes::<C>::default();
byte_arr[..s_end].copy_from_slice(bytes.as_ref());
Ok(Signature {
bytes: byte_arr,
r_range: Range {
start: r_start... | let s_range = parse_int(&bytes[r_end..], C::FieldSize::to_usize())?;
let s_start = r_end.checked_add(s_range.start).unwrap();
let s_end = r_end.checked_add(s_range.end).unwrap();
| random_line_split |
lsp_plugin.rs | // Copyright 2018 The xi-editor Authors.
//
// 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 ag... | (
&mut self,
language_id: &str,
workspace_root: &Option<Url>,
) -> Option<(String, Arc<Mutex<LanguageServerClient>>)> {
workspace_root
.clone()
.map(|r| r.into_string())
.or_else(|| {
let config = &self.config.language_config[language_... | get_lsclient_from_workspace_root | identifier_name |
lsp_plugin.rs | // Copyright 2018 The xi-editor Authors.
//
// 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 ag... | Err(err) => {
error!(
"Error occured while starting server for Language: {}: {:?}",
language_id, err
);
None
}
... | {
let config = &self.config.language_config[language_id];
let client = start_new_server(
config.start_command.clone(),
config.start_arguments.clone(),
config.extensions.clone(),
langua... | conditional_block |
lsp_plugin.rs | // Copyright 2018 The xi-editor Authors.
//
// 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 ag... | Err(err) => {
error!(
"Error occured while starting server for Language: {}: {:?}",
language_id, err
);
None
}
... | self.language_server_clients
.insert(language_server_identifier.clone(), client);
Some((language_server_identifier, client_clone))
} | random_line_split |
lsp_plugin.rs | // Copyright 2018 The xi-editor Authors.
//
// 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 ag... |
fn new_view(&mut self, view: &mut View<Self::Cache>) {
trace!("new view {}", view.get_id());
let document_text = view.get_document().unwrap();
let path = view.get_path();
let view_id = view.get_id();
// TODO: Use Language Idenitifier assigned by core when the
// i... | {
trace!("close view {}", view.get_id());
self.with_language_server_for_view(view, |ls_client| {
ls_client.send_did_close(view.get_id());
});
} | identifier_body |
sphere.rs | // Copyright 2017 Dasein Phaos aka. Luxko
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except a... | thetamax: thetamax,
phimax: phimax,
}
}
/// Constructs a full sphere
#[inline]
pub fn full(radius: Float) -> Sphere {
Sphere::new(radius, -radius, radius, float::pi() * (2.0 as Float))
}
/// returns the local space bounding box
#[inline]
pub fn ... | {
assert!(radius>(0.0 as Float), "Sphere radius should be positive");
assert!(zmin<zmax, "zmin should be lower than zmax");
if zmin < -radius { zmin = -radius; }
if zmax > radius { zmax = radius; }
if phimax < (0.0 as Float) { phimax = 0.0 as Float; }
let twopi = float:... | identifier_body |
sphere.rs | // Copyright 2017 Dasein Phaos aka. Luxko
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except a... | // #[inline]
// pub fn intersect_ray(&self, ray: &RawRay) -> Option<Float>
// {
// if let Some(t) = Sphere::intersect_ray_full(self.radius, ray) {
// let p = ray.evaluate(t);
// // TODO: refine sphere intersection
// let mut phi = p.y.atan2(p.x);
// if... | Point3f::new(self.radius, self.radius, self.zmax)
)
}
// /// test intersection in local frame, returns `t` when first hit | random_line_split |
sphere.rs | // Copyright 2017 Dasein Phaos aka. Luxko
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except a... | (radius: Float, ray: &RawRay) -> Option<Float>
{
let origin = ray.origin().to_vec();
let direction = ray.direction();
let a = direction.magnitude2();
let b = (direction.mul_element_wise(origin) * (2.0 as Float)).sum();
let c = origin.magnitude2() - radius * radius;
l... | intersect_ray_full | identifier_name |
node.rs | use std::convert::TryFrom;
use std::sync::Arc;
use std::time::Duration;
use bytes::Bytes;
use casbin::prelude::{Enforcer, MgmtApi};
use dashmap::DashMap;
use http::Uri;
use prost::Message;
use raft::prelude::*;
use raft::{Config, RawNode};
use slog::Logger;
use tokio::sync::mpsc::*;
use tokio::sync::RwLock;
use tokio:... | (
&mut self,
) -> Result<(), Box<dyn std::error::Error + Send + Sync +'static>> {
let mut ready = self.node.ready();
let is_leader = self.node.raft.leader_id == self.node.raft.id;
slog::info!(
self.logger,
"Leader ID: {}, Node ID: {}",
self.node.r... | ready | identifier_name |
node.rs | use std::convert::TryFrom;
use std::sync::Arc;
use std::time::Duration;
use bytes::Bytes;
use casbin::prelude::{Enforcer, MgmtApi};
use dashmap::DashMap;
use http::Uri;
use prost::Message;
use raft::prelude::*;
use raft::{Config, RawNode};
use slog::Logger;
use tokio::sync::mpsc::*;
use tokio::sync::RwLock;
use tokio:... |
match timeout(Duration::from_millis(100), self.conf_recv.recv()).await {
Ok(Some(cc)) => {
let ccc = cc.clone();
let state = self.node.apply_conf_change(&cc)?;
self.node.mut_store().set_conf_state(state);
let ... | {
slog::info!(self.logger, "Inbound raft message: {:?}", msg);
self.node.step(msg.into())?;
} | conditional_block |
node.rs | use std::convert::TryFrom;
use std::sync::Arc;
use std::time::Duration;
use bytes::Bytes;
use casbin::prelude::{Enforcer, MgmtApi};
use dashmap::DashMap;
use http::Uri;
use prost::Message;
use raft::prelude::*;
use raft::{Config, RawNode};
use slog::Logger;
use tokio::sync::mpsc::*;
use tokio::sync::RwLock;
use tokio:... |
fn set_hard_state(
&mut self,
commit: u64,
term: u64,
) -> Result<(), crate::error::Error> {
self.node.raft.mut_store().set_hard_state(commit, term);
Ok(())
}
#[allow(irrefutable_let_patterns)]
pub async fn run(
mut self,
) -> Result<(), Box<dyn... | {
self.node.raft.raft_log.committed = 0;
self.node.raft.become_candidate();
self.node.raft.become_leader();
} | identifier_body |
node.rs | use std::convert::TryFrom;
use std::sync::Arc;
use std::time::Duration;
use bytes::Bytes;
use casbin::prelude::{Enforcer, MgmtApi};
use dashmap::DashMap;
use http::Uri;
use prost::Message;
use raft::prelude::*;
use raft::{Config, RawNode};
use slog::Logger;
use tokio::sync::mpsc::*;
use tokio::sync::RwLock;
use tokio:... | internal_raft_message
.merge(Bytes::from(entry.data.clone()))
.unwrap();
if let Err(error) = self.apply(internal_raft_message) {
slog::error!(self.logger, "Unable to apply entry. {:?}", error);
// TODO: return... | let mut internal_raft_message = InternalRaftMessage::default(); | random_line_split |
index_file_deleter.rs | self.inc_ref_files(&sis.files(true));
}
}
// We keep commits list in sorted order (oldest to newest):
self.commits.sort();
// refCounts only includes "normal" filenames (does not include write.lock)
{
let ref_counts = self.ref_counts.read(... | }
pub fn has_dv_updates(&self) -> bool {
self.has_dv_updates
} | random_line_split | |
index_file_deleter.rs | <D>>,
inited: bool,
}
impl<D: Directory> IndexFileDeleter<D> {
pub fn new(directory: Arc<LockValidatingDirectoryWrapper<D>>) -> Self {
IndexFileDeleter {
ref_counts: Arc::new(RwLock::new(HashMap::new())),
commits: vec![],
last_files: HashSet::new(),
polic... |
pub fn dec_ref_files_no_error(&self, files: &HashSet<String>) {
if let Err(e) = self.dec_ref_files(files) {
warn!("dec_ref_files_no_error failed with '{:?}'", e);
}
}
/// Returns true if the file should now be deleted.
fn dec_ref(&self, filename: &str) -> bool {
se... | {
let mut to_delete = HashSet::new();
for f in files {
if self.dec_ref(f) {
to_delete.insert(f.clone());
}
}
self.delete_files(&to_delete, true)
} | identifier_body |
index_file_deleter.rs | );
self.commits.push(commit_point);
current_commit_point_idx = Some(self.commits.len() - 1);
self.inc_ref_files(&sis.files(true));
}
}
// We keep commits list in sorted order (oldest to newest):
self.commits.sort();
//... | delete | identifier_name | |
index_file_deleter.rs | <D>>,
inited: bool,
}
impl<D: Directory> IndexFileDeleter<D> {
pub fn new(directory: Arc<LockValidatingDirectoryWrapper<D>>) -> Self {
IndexFileDeleter {
ref_counts: Arc::new(RwLock::new(HashMap::new())),
commits: vec![],
last_files: HashSet::new(),
polic... |
}
self.delete_commits()?;
self.inited = true;
Ok(starting_commit_deleted)
}
/// Set all gens beyond what we currently see in the directory, to avoid double-write
/// in cases where the previous IndexWriter did not gracefully close/rollback (e.g.
/// os/machine crashed... | {
starting_commit_deleted = true;
} | conditional_block |
ssh.rs | _from_slice(&tag_bytes[..TAG_LEN_BYTES]);
tag
}
/// OpenSSH-supported ciphers.
#[allow(clippy::enum_variant_names)]
#[derive(Clone, Copy, Debug)]
enum OpenSshCipher {
Aes256Cbc,
Aes128Ctr,
Aes192Ctr,
Aes256Ctr,
Aes256Gcm,
}
impl OpenSshCipher {
/// Returns the length of the authenticating ... | (
self,
kdf: &OpenSshKdf,
p: SecretString,
ct: &[u8],
) -> Result<Vec<u8>, DecryptError> {
match self {
OpenSshCipher::Aes256Cbc => decrypt::aes_cbc::<Aes256CbcDec>(kdf, p, ct),
OpenSshCipher::Aes128Ctr => Ok(decrypt::aes_ctr::<Aes128Ctr>(kdf, p, ct)),... | decrypt | identifier_name |
ssh.rs | copy_from_slice(&tag_bytes[..TAG_LEN_BYTES]);
tag
}
/// OpenSSH-supported ciphers.
#[allow(clippy::enum_variant_names)]
#[derive(Clone, Copy, Debug)]
enum OpenSshCipher {
Aes256Cbc,
Aes128Ctr,
Aes192Ctr,
Aes256Ctr,
Aes256Gcm,
}
impl OpenSshCipher {
/// Returns the length of the authenticat... | }
}
mod decrypt {
use aes::cipher::{block_padding::NoPadding, BlockDecryptMut, KeyIvInit, StreamCipher};
use aes_gcm::aead::{AeadMut, KeyInit};
use age_core::secrecy::SecretString;
use cipher::generic_array::{ArrayLength, GenericArray};
use super::OpenSshKdf;
use crate::error::DecryptError... | Identity::Encrypted(_) => unreachable!(),
} | random_line_split |
ssh.rs | _from_slice(&tag_bytes[..TAG_LEN_BYTES]);
tag
}
/// OpenSSH-supported ciphers.
#[allow(clippy::enum_variant_names)]
#[derive(Clone, Copy, Debug)]
enum OpenSshCipher {
Aes256Cbc,
Aes128Ctr,
Aes192Ctr,
Aes256Ctr,
Aes256Gcm,
}
impl OpenSshCipher {
/// Returns the length of the authenticating ... | else {
None
}
}),
alt((
map(openssh_rsa_privkey, move |sk| {
UnencryptedKey::SshRsa(ssh_key_rsa.clone(), Box::new(sk)).into()
}),
map(openssh_ed25519_privkey, move |privkey| {
... | {
Some(c1)
} | conditional_block |
wd.rs | //! WebDriver types and declarations.
use crate::error;
#[cfg(doc)]
use crate::Client;
use http::Method;
use serde::{Deserialize, Serialize};
use std::borrow::Cow;
use std::convert::TryFrom;
use std::fmt;
use std::fmt::Debug;
use std::time::Duration;
use url::{ParseError, Url};
use webdriver::command::TimeoutsParamete... | }
/// Return true if this session should only support the legacy webdriver protocol.
///
/// This only applies to the obsolete JSON Wire Protocol and should return `false`
/// for all implementations that follow the W3C specification.
///
/// See <https://www.selenium.dev/documentation/lega... | random_line_split | |
wd.rs | //! WebDriver types and declarations.
use crate::error;
#[cfg(doc)]
use crate::Client;
use http::Method;
use serde::{Deserialize, Serialize};
use std::borrow::Cow;
use std::convert::TryFrom;
use std::fmt;
use std::fmt::Debug;
use std::time::Duration;
use url::{ParseError, Url};
use webdriver::command::TimeoutsParamete... | (&self, request_url: &Url) -> (Method, Option<String>) {
T::method_and_body(self, request_url)
}
fn is_new_session(&self) -> bool {
T::is_new_session(self)
}
fn is_legacy(&self) -> bool {
T::is_legacy(self)
}
}
/// A [handle][1] to a browser window.
///
/// Should be obtai... | method_and_body | identifier_name |
decoder.rs | use crate::ebml;
use crate::schema::{Schema, SchemaDict};
use crate::vint::{read_vint, UnrepresentableLengthError};
use chrono::{DateTime, NaiveDateTime, Utc};
use err_derive::Error;
use log_derive::{logfn, logfn_inputs};
use std::convert::TryFrom;
pub trait ReadEbmlExt: std::io::Read {
#[logfn(ok = "TRACE", err =... | if parent_pos.r#type!='m' {
// throw new Error("parent element is not master element");
unreachable!();
}
self.queue.push(
(
ebml::MasterEndElement {
ebml_id: parent_pos.ebml_id,
... | }
// 閉じタグを挿入すべきタイミングが来た | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.