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 |
|---|---|---|---|---|
packfile.rs | use bytes::{BufMut, BytesMut};
use flate2::{write::ZlibEncoder, Compression};
use sha1::{
digest::{generic_array::GenericArray, FixedOutputDirty},
Digest, Sha1,
};
use std::{convert::TryInto, fmt::Write, io::Write as IoWrite};
// The packfile itself is a very simple format. There is a header, a
// series of pa... | e_to(&mut out)?;
}
}
Self::Blob(blob) => {
out.extend_from_slice(blob);
}
}
Ok(sha1::Sha1::digest(&out))
}
}
| for item in items {
item.encod | conditional_block |
packfile.rs | use bytes::{BufMut, BytesMut};
use flate2::{write::ZlibEncoder, Compression};
use sha1::{
digest::{generic_array::GenericArray, FixedOutputDirty},
Digest, Sha1,
};
use std::{convert::TryInto, fmt::Write, io::Write as IoWrite};
// The packfile itself is a very simple format. There is a header, a
// series of pa... |
pub fn encode_to(&self, original_buf: &mut BytesMut) -> Result<(), anyhow::Error> {
let mut buf = original_buf.split_off(original_buf.len());
buf.reserve(Self::header_size() + Self::footer_size());
// header
buf.extend_from_slice(b"PACK"); // magic header
buf.put_u32(2); /... | {
20
} | identifier_body |
packfile.rs | use bytes::{BufMut, BytesMut};
use flate2::{write::ZlibEncoder, Compression};
use sha1::{
digest::{generic_array::GenericArray, FixedOutputDirty},
Digest, Sha1,
};
use std::{convert::TryInto, fmt::Write, io::Write as IoWrite};
// The packfile itself is a very simple format. There is a header, a
// series of pa... | (&self) -> usize {
self.kind.mode().len() + " ".len() + self.name.len() + "\0".len() + self.hash.len()
}
}
#[derive(Debug)]
pub enum PackFileEntry<'a> {
// jordan@Jordans-MacBook-Pro-2 0d % printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" | cat - f5/473259d9674ed66239766a013f96a3550374e3 | gzip -dc
// com... | size | identifier_name |
poll.rs | extern crate nix;
use std::os::unix::io::AsRawFd;
use std::os::unix::io::RawFd;
use std::time;
use std::io;
use self::nix::sys::epoll;
/// Polls for readiness events on all registered file descriptors.
///
/// `Poll` allows a program to monitor a large number of file descriptors, waiting until one or
/// more become ... | /// # }
/// ```
///
/// # Exclusive access
///
/// Since this `Poll` implementation is optimized for worker-pool style use-cases, all file
/// descriptors are registered using `EPOLL_ONESHOT`. This means that once an event has been issued
/// for a given descriptor, not more events will be issued for that descriptor un... | /// # fn main() {
/// # try_main().unwrap(); | random_line_split |
poll.rs | extern crate nix;
use std::os::unix::io::AsRawFd;
use std::os::unix::io::RawFd;
use std::time;
use std::io;
use self::nix::sys::epoll;
/// Polls for readiness events on all registered file descriptors.
///
/// `Poll` allows a program to monitor a large number of file descriptors, waiting until one or
/// more become ... |
self.events.all.get(*at).map(|e| {
*at += 1;
Token(e.data() as usize)
})
}
}
| {
// events beyond .1 are old
return None;
} | conditional_block |
poll.rs | extern crate nix;
use std::os::unix::io::AsRawFd;
use std::os::unix::io::RawFd;
use std::time;
use std::io;
use self::nix::sys::epoll;
/// Polls for readiness events on all registered file descriptors.
///
/// `Poll` allows a program to monitor a large number of file descriptors, waiting until one or
/// more become ... | <'a> {
events: &'a Events,
at: usize,
}
impl<'a> IntoIterator for &'a Events {
type IntoIter = EventsIterator<'a>;
type Item = Token;
fn into_iter(self) -> Self::IntoIter {
EventsIterator {
events: self,
at: 0,
}
}
}
impl<'a> Iterator for EventsIterator... | EventsIterator | identifier_name |
poll.rs | extern crate nix;
use std::os::unix::io::AsRawFd;
use std::os::unix::io::RawFd;
use std::time;
use std::io;
use self::nix::sys::epoll;
/// Polls for readiness events on all registered file descriptors.
///
/// `Poll` allows a program to monitor a large number of file descriptors, waiting until one or
/// more become ... |
}
| {
let at = &mut self.at;
if *at >= self.events.current {
// events beyond .1 are old
return None;
}
self.events.all.get(*at).map(|e| {
*at += 1;
Token(e.data() as usize)
})
} | identifier_body |
nexus_label.rs | //! GPT labeling for Nexus devices. The primary partition
//! (/dev/x1) will be used for meta data during, rebuild. The second
//! partition contains the file system.
//!
//! The nexus will adjust internal data structures to offset the IO to the
//! right partition. put differently, when connecting to this device via
/... | }
#[derive
(Debug, PartialEq, Default, Clone)]
pub struct GptName {
pub name: String,
}
impl GptName {
pub fn as_str(&self) -> &str {
&self.name
}
}
| t mut out = Vec::new();
let mut end = false;
loop {
match seq.next_element()? {
Some(0) => {
end = true;
}
Some(e) if !end => out.push(e),
_ => break,
}
}
if end {
Ok(... | identifier_body |
nexus_label.rs | //! GPT labeling for Nexus devices. The primary partition
//! (/dev/x1) will be used for meta data during, rebuild. The second
//! partition contains the file system.
//!
//! The nexus will adjust internal data structures to offset the IO to the
//! right partition. put differently, when connecting to this device via
/... | impl GptGuid {
pub(crate) fn new_random() -> Self {
let fields = uuid::Uuid::new_v4();
let fields = fields.as_fields();
GptGuid {
time_low: fields.0,
time_mid: fields.1,
time_high: fields.2,
node: *fields.3,
}
}
}
#[derive(Debug, D... | .to_string()
)
}
}
| random_line_split |
nexus_label.rs | //! GPT labeling for Nexus devices. The primary partition
//! (/dev/x1) will be used for meta data during, rebuild. The second
//! partition contains the file system.
//!
//! The nexus will adjust internal data structures to offset the IO to the
//! right partition. put differently, when connecting to this device via
/... | mut fmt::Formatter) -> fmt::Result {
writeln!(f, "GUID: {}", self.primary.guid.to_string())?;
writeln!(f, "\tHeader crc32 {}", self.primary.self_checksum)?;
writeln!(f, "\tPartition table crc32 {}", self.primary.table_crc)?;
for i in 0.. self.partitions.len() {
writeln!(f, "... | : & | identifier_name |
lib.rs | #![allow(unused_imports)]
#[macro_use]
extern crate log;
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use bytes::{BufMut, BytesMut};
use tokio::net::TcpStream;
use byteorder::{ByteOrder, BigEndian};
use futures::try_ready;
use futures::future::Either;
use tokio::prelude::*;
use chrono::naive::NaiveDateT... | pub fn send(&self, t: T) -> Result<(), ()> {
match self {
Transmitter::Synchronous(sender) => sender.send(t).map_err(|_| ()),
Transmitter::Asynchronous(sender) => {
tokio::spawn({
let sender = sender.clone();
sender.send(t).into... | Asynchronous(futures::sync::mpsc::Sender<T>)
}
impl<T> Transmitter<T> where T: 'static + Send {
/// Send a message through the underlying Sender | random_line_split |
lib.rs | #![allow(unused_imports)]
#[macro_use]
extern crate log;
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use bytes::{BufMut, BytesMut};
use tokio::net::TcpStream;
use byteorder::{ByteOrder, BigEndian};
use futures::try_ready;
use futures::future::Either;
use tokio::prelude::*;
use chrono::naive::NaiveDateT... |
}
#[cfg(feature = "master")]
type EncryptedStream = tokio_tls::TlsStream<TcpStream>;
/// A TCP stream adapter to convert between byte stream and objects
#[cfg(feature = "master")]
#[derive(Debug)]
pub struct SprinklerProto {
socket: EncryptedStream,
read_buffer: BytesMut,
}
#[cfg(feature = "master")]
impl S... | {
let next = self.counter;
self.counter += 1;
T::build(SprinklerOptions {
_id: next,
_hostname: hostname,
..self.params.clone()
})
} | identifier_body |
lib.rs | #![allow(unused_imports)]
#[macro_use]
extern crate log;
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use bytes::{BufMut, BytesMut};
use tokio::net::TcpStream;
use byteorder::{ByteOrder, BigEndian};
use futures::try_ready;
use futures::future::Either;
use tokio::prelude::*;
use chrono::naive::NaiveDateT... | (&self) -> AnomalyTransition {
(*self >> Anomaly::Negative).unwrap()
}
}
#[derive(PartialEq, Debug, Copy, Clone)]
pub enum AnomalyTransition {
Normal, // Negative -> Negative
Occurred, // Negative -> Positive
Unhandled, // Positive -> Positive
Disappeared, // Positive ... | diminish | identifier_name |
lib.rs | bail, Result};
use crossbeam::channel::Sender;
use glob::glob;
use log::{info, warn};
use scan_fmt::scan_fmt;
use simplelog as sl;
use std::cell::RefCell;
use std::collections::HashMap;
use std::env;
use std::ffi::{CString, OsStr, OsString};
use std::fmt::Write as FmtWrite;
use std::fs;
use std::io::prelude::*;
use st... | let mut path = dir.to_owned();
path.push(name);
if let Ok(path) = path.canonicalize() {
if is_executable(&path) {
return Some(path);
}
}
}
None
}
pub fn chgrp<P: AsRef<Path>>(path_in: P, gid: u32) -> Result<bool> {
let path = path_in.a... | random_line_split | |
lib.rs | , Result};
use crossbeam::channel::Sender;
use glob::glob;
use log::{info, warn};
use scan_fmt::scan_fmt;
use simplelog as sl;
use std::cell::RefCell;
use std::collections::HashMap;
use std::env;
use std::ffi::{CString, OsStr, OsString};
use std::fmt::Write as FmtWrite;
use std::fs;
use std::io::prelude::*;
use std::io... | {
Running,
Exiting,
Kicked,
}
pub fn wait_prog_state(dur: Duration) -> ProgState {
let mut first = true;
let mut state = PROG_STATE.lock().unwrap();
loop {
if state.exiting {
return ProgState::Exiting;
}
if LOCAL_KICK_SEQ.with(|seq| {
if *seq.bor... | ProgState | identifier_name |
trie.rs | use crate::config::*;
use crate::louds_dense::LoudsDense;
use crate::louds_sparse::LoudsSparse;
use crate::builder;
pub struct Trie {
louds_dense: LoudsDense,
louds_sparse: LoudsSparse,
suffixes: Vec<Suffix>,
}
// 生ポインタを使えばもっと速くなる
// ベクタofベクタだとキャッシュにも乗らない
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
s... | <u8>>) -> Self {
let include_dense = K_INCLUDE_DENSE;
let sparse_dense = K_SPARSE_DENSE_RATIO;
let mut builder = builder::Builder::new(include_dense, sparse_dense);
builder.build(&keys);
let louds_dense = LoudsDense::new(&builder);
let louds_sparse = LoudsSparse::new(&bu... | ec<Vec | identifier_name |
trie.rs | use crate::config::*;
use crate::louds_dense::LoudsDense;
use crate::louds_sparse::LoudsSparse;
use crate::builder;
pub struct Trie {
louds_dense: LoudsDense,
louds_sparse: LoudsSparse,
suffixes: Vec<Suffix>,
}
// 生ポインタを使えばもっと速くなる
// ベクタofベクタだとキャッシュにも乗らない
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
s... | d_key(key, ret.2);
}
return (ret.0, ret.1);
}
fn _traverse(
&self,
key: &key_t,
) -> (position_t, level_t) {
let ret = self.louds_dense.find_key(key);
if ret.0!= K_NOT_FOUND {
return (ret.0, ret.1);
}
if ret.2!= K_NOT_FOUND {
... | OT_FOUND {
return louds_sparse.fin | conditional_block |
trie.rs | use crate::config::*;
use crate::louds_dense::LoudsDense;
use crate::louds_sparse::LoudsSparse;
use crate::builder;
pub struct Trie {
louds_dense: LoudsDense,
louds_sparse: LoudsSparse,
suffixes: Vec<Suffix>,
}
// 生ポインタを使えばもっと速くなる
// ベクタofベクタだとキャッシュにも乗らない
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
s... | identifier_body | ||
trie.rs | use crate::config::*;
use crate::louds_dense::LoudsDense;
use crate::louds_sparse::LoudsSparse;
use crate::builder;
pub struct Trie {
louds_dense: LoudsDense,
louds_sparse: LoudsSparse,
suffixes: Vec<Suffix>,
}
// 生ポインタを使えばもっと速くなる
// ベクタofベクタだとキャッシュにも乗らない
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
s... | }
},
0 => {},
1 => {
for mask in self.mask_lists[dimension].iter() {
if value & mask == 0 {
updated |= mask;
break;
} else {
... | break;
} else {
updated |= mask;
} | random_line_split |
verifier.rs | use argon2::{defaults, Argon2, ParamErr, Variant, Version};
use std::error::Error;
/// The main export here is `Encoded`. See `examples/verify.rs` for usage
/// examples.
use std::{fmt, str};
macro_rules! maybe {
($e: expr) => {
match $e {
None => return None,
Some(v) => v,
... | if bytes.len() % 4!= 1 && bytes.len() > 0 {
let mut rv = vec![];
let mut pos = 0;
while pos + 4 <= bytes.len() {
let s = maybe!(triplet(&bytes[pos..pos + 4]));
rv.extend_from_slice(&s);
pos += 4;
}
if bytes.len() - pos == 2 {
l... | rv
}
fn debase64_no_pad(bytes: &[u8]) -> Option<Vec<u8>> { | random_line_split |
verifier.rs | use argon2::{defaults, Argon2, ParamErr, Variant, Version};
use std::error::Error;
/// The main export here is `Encoded`. See `examples/verify.rs` for usage
/// examples.
use std::{fmt, str};
macro_rules! maybe {
($e: expr) => {
match $e {
None => return None,
Some(v) => v,
... | }
Some(rv)
} else {
None
}
}
struct Parser<'a> {
enc: &'a [u8],
pos: usize,
}
impl<'a> fmt::Debug for Parser<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?}", String::from_utf8_lossy(&self.enc[..self.pos]))?;
write!(f, "<-- {} -... | {
if bytes.len() % 4 != 1 && bytes.len() > 0 {
let mut rv = vec![];
let mut pos = 0;
while pos + 4 <= bytes.len() {
let s = maybe!(triplet(&bytes[pos..pos + 4]));
rv.extend_from_slice(&s);
pos += 4;
}
if bytes.len() - pos == 2 {
... | identifier_body |
verifier.rs | use argon2::{defaults, Argon2, ParamErr, Variant, Version};
use std::error::Error;
/// The main export here is `Encoded`. See `examples/verify.rs` for usage
/// examples.
use std::{fmt, str};
macro_rules! maybe {
($e: expr) => {
match $e {
None => return None,
Some(v) => v,
... | (&self) -> Vec<u8> {
let vcode = |v| match v {
Variant::Argon2i => "i",
Variant::Argon2d => "d",
Variant::Argon2id => "id",
};
let b64 = |x| String::from_utf8(base64_no_pad(x)).unwrap();
let k_ = match &b64(&self.key[..]) {
bytes if bytes.l... | to_u8 | identifier_name |
disk.rs | // Copyright 2019 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! VM disk image file format I/O.
use std::cmp::min;
use std::fmt::Debug;
use std::fs::File;
use std::io;
use std::io::Read;
use std::io::Seek;
use std::io::SeekFrom;
use s... | (&self, file_offset: u64, length: u64) -> Result<()> {
if self
.inner
.fallocate(file_offset, length, AllocateMode::ZeroRange)
.await
.is_ok()
{
return Ok(());
}
// Fall back to writing zeros if fallocate doesn't work.
let ... | write_zeroes_at | identifier_name |
disk.rs | // Copyright 2019 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! VM disk image file format I/O.
use std::cmp::min;
use std::fmt::Debug;
use std::fs::File;
use std::io;
use std::io::Read;
use std::io::Seek;
use std::io::SeekFrom;
use s... | // max_nesting_depth is only used if the composite-disk or qcow features are enabled.
#[allow(unused_variables)] mut max_nesting_depth: u32,
// image_path is only used if the composite-disk feature is enabled.
#[allow(unused_variables)] image_path: &Path,
) -> Result<Box<dyn DiskFile>> {
if max_nest... | /// Inspect the image file type and create an appropriate disk file to match it.
pub fn create_disk_file(
raw_image: File,
is_sparse_file: bool, | random_line_split |
disk.rs | // Copyright 2019 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! VM disk image file format I/O.
use std::cmp::min;
use std::fmt::Debug;
use std::fs::File;
use std::io;
use std::io::Read;
use std::io::Seek;
use std::io::SeekFrom;
use s... |
#[cfg(feature = "qcow")]
ImageType::Qcow2 => {
Box::new(QcowFile::from(raw_image, max_nesting_depth).map_err(Error::QcowError)?)
as Box<dyn DiskFile>
}
#[cfg(feature = "composite-disk")]
ImageType::CompositeDisk => {
// Valid composite dis... | {
sys::apply_raw_disk_file_options(&raw_image, is_sparse_file)?;
Box::new(raw_image) as Box<dyn DiskFile>
} | conditional_block |
error_format.rs | pub mod data;
use crate::data::tokens::Span;
use crate::data::{position::Position, warnings::Warnings, Interval};
use nom::{
error::{ContextError, ErrorKind, ParseError},
*,
};
pub use crate::data::error_info::ErrorInfo;
pub use data::CustomError;
// TODO: add link to docs
// Parsing Errors
pub const ERROR_... |
pub fn gen_nom_failure<'a, E>(span: Span<'a>, error: &'static str) -> Err<E>
where
E: ParseError<Span<'a>> + ContextError<Span<'a>>,
{
Err::Failure(E::add_context(
span,
error,
E::from_error_kind(span, ErrorKind::Tag),
))
}
pub fn convert_error_from_span<'a>(flow_slice: Span<'a>, ... | {
Err::Error(E::add_context(
span,
error,
E::from_error_kind(span, ErrorKind::Tag),
))
} | identifier_body |
error_format.rs | pub mod data;
use crate::data::tokens::Span;
use crate::data::{position::Position, warnings::Warnings, Interval};
use nom::{
error::{ContextError, ErrorKind, ParseError},
*,
};
pub use crate::data::error_info::ErrorInfo;
pub use data::CustomError;
// TODO: add link to docs
// Parsing Errors
pub const ERROR_... | "JWT(jwt).decode(algo, secret) expect second argument 'claims' of type String";
pub const ERROR_JWT_VALIDATION_CLAIMS: &str =
"JWT(jwt).verify(claims, algo, secret) expect first argument 'claims' of type Object";
pub const ERROR_JWT_VALIDATION_ALGO: &str =
"JWT(jwt).verify(claims, algo, secret) expect seco... | random_line_split | |
error_format.rs | pub mod data;
use crate::data::tokens::Span;
use crate::data::{position::Position, warnings::Warnings, Interval};
use nom::{
error::{ContextError, ErrorKind, ParseError},
*,
};
pub use crate::data::error_info::ErrorInfo;
pub use data::CustomError;
// TODO: add link to docs
// Parsing Errors
pub const ERROR_... | <'a, E>(span: Span<'a>, error: &'static str) -> Err<E>
where
E: ParseError<Span<'a>> + ContextError<Span<'a>>,
{
Err::Failure(E::add_context(
span,
error,
E::from_error_kind(span, ErrorKind::Tag),
))
}
pub fn convert_error_from_span<'a>(flow_slice: Span<'a>, e: CustomError<Span<'a>>... | gen_nom_failure | identifier_name |
lmdb_backend.rs | // Copyright 2018 The Grin Developers
//
// 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 agree... | (&mut self, parent_key_id: &Identifier) -> Result<u32> {
let tx_id_key = to_key(TX_LOG_ID_PREFIX, &mut parent_key_id.to_bytes().to_vec());
let last_tx_log_id = match self.db.borrow().as_ref().unwrap().get_ser(&tx_id_key)? {
Some(t) => t,
None => 0,
};
self.db
.borrow()
.as_ref()
.unwrap()
.put... | next_tx_log_id | identifier_name |
lmdb_backend.rs | // Copyright 2018 The Grin Developers
//
// 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 agree... | fn check_repair(&mut self, delete_unconfirmed: bool) -> Result<()> {
restore::check_repair(self, delete_unconfirmed).context(ErrorKind::Restore)?;
Ok(())
}
fn calc_commit_for_cache(&mut self, amount: u64, id: &Identifier) -> Result<Option<String>> {
if self.config.no_commit_cache == Some(true) {
Ok(None)
... | Ok(())
}
| random_line_split |
lmdb_backend.rs | // Copyright 2018 The Grin Developers
//
// 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 agree... |
self.db = Some(store);
Ok(())
}
/// Disconnect from backend
fn disconnect(&mut self) -> Result<()> {
self.db = None;
Ok(())
}
/// Set password
fn set_password(&mut self, password: ZeroingString) -> Result<()> {
let _ = WalletSeed::from_file(&self.config, password.deref())?;
self.password = Some(pa... | {
let batch = store.batch()?;
batch.put_ser(&acct_key, &default_account)?;
batch.commit()?;
} | conditional_block |
lmdb_backend.rs | // Copyright 2018 The Grin Developers
//
// 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 agree... |
fn accounts<'a>(&'a self) -> Result<Box<dyn Iterator<Item = AcctPathMapping> + 'a>> {
Ok(Box::new(
self.db()?
.iter(&[ACCOUNT_PATH_MAPPING_PREFIX])
.unwrap()
.map(|x| x.1),
))
}
fn get_acct_path(&self, label: &str) -> Result<Option<AcctPathMapping>> {
let acct_key = to_key(ACCOUNT_PATH_MAPPIN... | {
let ctx_key = to_key_u64(
PRIVATE_TX_CONTEXT_PREFIX,
&mut slate_id.to_vec(),
participant_id as u64,
);
let (blind_xor_key, nonce_xor_key) = private_ctx_xor_keys(self.keychain(), slate_id)?;
let mut ctx: Context = option_to_not_found(self.db()?.get_ser(&ctx_key), || {
format!("Slate id: {:x?}", sl... | identifier_body |
lib.rs | let mut h = HashMap::default();
//! h.insert(
//! "MyProgram", "
//! (def (Report
//! (volatile minrtt +infinity)
//! ))
//! (when true
//! (:= Report.minrtt (min Report.minrtt Flow.rtt_sample_us))
//! ... | fn update_field(&self, sc: &Scope, update: &[(&str, u32)]) -> Result<()>;
}
/// A collection of methods to interact with the datapath.
#[derive(Clone)]
pub struct Datapath<T: Ipc> {
sock_id: u32,
sender: BackendSender<T>,
programs: Rc<HashMap<String, Scope>>,
}
impl<T: Ipc> DatapathTrait for Datapath<... | ) -> Result<Scope>;
/// Update the value of a register in an already-installed fold function. | random_line_split |
lib.rs | let mut h = HashMap::default();
//! h.insert(
//! "MyProgram", "
//! (def (Report
//! (volatile minrtt +infinity)
//! ))
//! (when true
//! (:= Report.minrtt (min Report.minrtt Flow.rtt_sample_us))
//! ... | {
pub sock_id: u32,
pub init_cwnd: u32,
pub mss: u32,
pub src_ip: u32,
pub src_port: u32,
pub dst_ip: u32,
pub dst_port: u32,
}
/// Contains the values of the pre-defined Report struct from the fold function.
/// Use `get_field` to query its values using the names defined in the fold funct... | DatapathInfo | identifier_name |
lib.rs | let mut h = HashMap::default();
//! h.insert(
//! "MyProgram", "
//! (def (Report
//! (volatile minrtt +infinity)
//! ))
//! (when true
//! (:= Report.minrtt (min Report.minrtt Flow.rtt_sample_us))
//! ... |
/// Configuration parameters for the portus runtime.
/// Defines a `slog::Logger` to use for (optional) logging
#[derive(Clone, Default)]
pub struct Config {
pub logger: Option<slog::Logger>,
}
/// The set of information passed by the datapath to CCP
/// when a connection starts. It includes a unique 5-tuple (CC... | {
let msg = serialize::install::Msg {
sid: sock_id,
program_uid: sc.program_uid,
num_events: bin.events.len() as u32,
num_instrs: bin.instrs.len() as u32,
instrs: bin,
};
let buf = serialize::serialize(&msg)?;
sender.send_msg(&buf[..])?;
Ok(())
} | identifier_body |
utils.rs | pub const PLUMO_SETUP_PERSONALIZATION: &[u8] = b"PLUMOSET";
pub const ADDRESS_LENGTH: usize = 20;
pub const ADDRESS_LENGTH_IN_HEX: usize = 42;
pub const SIGNATURE_LENGTH_IN_HEX: usize = 130;
pub const DEFAULT_MAX_RETRIES: usize = 5;
pub const ONE_MB: usize = 1024 * 1024;
pub const DEFAULT_CHUNK_SIZE: u64 = 1 * (ONE_MB ... |
pub fn trim_newline(s: &mut String) {
if s.ends_with('\n') {
s.pop();
if s.ends_with('\r') {
s.pop();
}
}
}
pub fn compute_hash_from_file(fname: &str) -> Result<String> {
let challenge_contents = std::fs::read(fname)?;
Ok(hex::encode(setup_utils::calculate_hash(
... | {
File::create(path)?.write_all(
format_attestation(
&attestation.id,
&attestation.address,
&attestation.signature,
)
.as_bytes(),
)?;
Ok(())
} | identifier_body |
utils.rs | pub const PLUMO_SETUP_PERSONALIZATION: &[u8] = b"PLUMOSET";
pub const ADDRESS_LENGTH: usize = 20;
pub const ADDRESS_LENGTH_IN_HEX: usize = 42;
pub const SIGNATURE_LENGTH_IN_HEX: usize = 130;
pub const DEFAULT_MAX_RETRIES: usize = 5;
pub const ONE_MB: usize = 1024 * 1024;
pub const DEFAULT_CHUNK_SIZE: u64 = 1 * (ONE_MB ... | .parse::<u64>()?)
}
pub async fn get_ceremony(url: &str) -> Result<Ceremony> {
let response = reqwest::get(url).await?.error_for_status()?;
let data = response.text().await?;
let ceremony: Ceremony = serde_json::from_str::<Response<Ceremony>>(&data)?.result;
Ok(ceremony)
}
use crate::transcript... | .to_str()? | random_line_split |
utils.rs | pub const PLUMO_SETUP_PERSONALIZATION: &[u8] = b"PLUMOSET";
pub const ADDRESS_LENGTH: usize = 20;
pub const ADDRESS_LENGTH_IN_HEX: usize = 42;
pub const SIGNATURE_LENGTH_IN_HEX: usize = 130;
pub const DEFAULT_MAX_RETRIES: usize = 5;
pub const ONE_MB: usize = 1024 * 1024;
pub const DEFAULT_CHUNK_SIZE: u64 = 1 * (ONE_MB ... | (transcript: &Transcript) -> Result<()> {
let filename = format!("transcript_{}", chrono::Utc::now().timestamp_nanos());
let mut file = File::create(filename)?;
file.write_all(serde_json::to_string_pretty(transcript)?.as_bytes())?;
Ok(())
}
pub fn format_attestation(attestation_message: &str, address:... | backup_transcript | identifier_name |
context.rs | //!The [`Context`][context] contains all the input data for the request
//!handlers, as well as some utilities. This is where request data, like
//!headers, client address and the request body can be retrieved from and it
//!can safely be picked apart, since its ownership is transferred to the
//!handler.
//!
//!##Acce... | //!Handler context and request body reading extensions.
//!
//!#Context
//! | random_line_split | |
context.rs | //!Handler context and request body reading extensions.
//!
//!#Context
//!
//!The [`Context`][context] contains all the input data for the request
//!handlers, as well as some utilities. This is where request data, like
//!headers, client address and the request body can be retrieved from and it
//!can safely be picke... | else {
None
})
},
_ => None
};
BodyReader {
reader: reader,
multipart_boundary: boundary
}
}
}
#[cfg(not(feature = "multipart"))]
impl<'a, 'b> BodyReader<'a, 'b> {
///Internal method that may c... | {
Some(boundary.clone())
} | conditional_block |
context.rs | //!Handler context and request body reading extensions.
//!
//!#Context
//!
//!The [`Context`][context] contains all the input data for the request
//!handlers, as well as some utilities. This is where request data, like
//!headers, client address and the request body can be retrieved from and it
//!can safely be picke... | <'a, 'b: 'a> {
reader: HttpReader<&'a mut BufReader<&'b mut NetworkStream>>,
#[cfg(feature = "multipart")]
multipart_boundary: Option<String>
}
#[cfg(feature = "multipart")]
impl<'a, 'b> BodyReader<'a, 'b> {
///Try to create a `multipart/form-data` reader from the request body.
///
///```
... | BodyReader | identifier_name |
local_cache.rs | // src/io/local_cache.rs -- a local cache of files obtained from another IoProvider
// Copyright 2017-2018 the Tectonic Project
// Licensed under the MIT License.
use fs2::FileExt;
use tempfile;
use std::collections::HashMap;
use std::ffi::{OsStr, OsString};
use std::fs::{self, File};
use std::io::{BufRead, BufReader,... |
return OpenResult::NotAvailable;
}
};
// OK, we can stream the file to a temporary location on disk,
// computing its SHA256 as we go.
let mut digest_builder = digest::create();
let mut length = 0;
let mut temp_dest = match tempfile::Builder::new(... | {
return OpenResult::Err(e.into());
} | conditional_block |
local_cache.rs | // src/io/local_cache.rs -- a local cache of files obtained from another IoProvider
// Copyright 2017-2018 the Tectonic Project
// Licensed under the MIT License.
use fs2::FileExt;
use tempfile;
use std::collections::HashMap;
use std::ffi::{OsStr, OsString};
use std::fs::{self, File};
use std::io::{BufRead, BufReader,... | (&mut self, name: &OsStr, length: u64, digest: Option<DigestData>) -> Result<()> {
let digest_text = match digest {
Some(ref d) => d.to_string(),
None => "-".to_owned(),
};
// Due to a quirk about permissions for file locking on Windows, we
// need to add `.read(... | record_cache_result | identifier_name |
local_cache.rs | // src/io/local_cache.rs -- a local cache of files obtained from another IoProvider
// Copyright 2017-2018 the Tectonic Project
// Licensed under the MIT License.
use fs2::FileExt;
use tempfile;
use std::collections::HashMap;
use std::ffi::{OsStr, OsString};
use std::fs::{self, File};
use std::io::{BufRead, BufReader,... | let mut temp_dest = match tempfile::Builder::new()
.prefix("download_")
.rand_bytes(6)
.tempfile_in(&self.data_path) {
Ok(f) => f,
Err(e) => return OpenResult::Err(e.into()),
};
let mut buf = [0u8; 8192];
while let Ok(nbytes) = stream.read(&mut buf) {
if nbytes == 0 {
brea... | // computing its SHA256 as we go.
let mut digest_builder = digest::create();
let mut length = 0;
| random_line_split |
mod.rs | /*
* Copyright (c) 2017-2018 Boucher, Antoni <bouanto@zoho.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, ... | , message: InnerMessage) {
let bytes =
match encode(message) {
Ok(message) => message,
Err(error) => {
error!("{}", error);
return;
},
};
let message = UserMessage::new("", Some(&bytes.to_vari... | self | identifier_name |
mod.rs | /*
* Copyright (c) 2017-2018 Boucher, Antoni <bouanto@zoho.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, ... | // Set the selected file on the input[type="file"].
fn select_file(&mut self, file: &str) {
if let Some(ref input_file) = self.model.activated_file_input.take() {
// FIXME: this is not working.
input_file.set_value(file);
}
}
fn send(&self, message: InnerMessage) {
... | let document = get_document!(self);
load_username(&document, username);
load_password(&document, password);
}
| identifier_body |
mod.rs | /*
* Copyright (c) 2017-2018 Boucher, Antoni <bouanto@zoho.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, ... | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR ... | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | random_line_split |
mod.rs | /*
* Copyright (c) 2017-2018 Boucher, Antoni <bouanto@zoho.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, ... |
fn send(&self, message: InnerMessage) {
let bytes =
match encode(message) {
Ok(message) => message,
Err(error) => {
error!("{}", error);
return;
},
};
let message = UserMessage::new("", ... | // FIXME: this is not working.
input_file.set_value(file);
}
} | conditional_block |
bidirectional.rs | use rand::{self, Rng, SeedableRng};
use rand_xorshift::XorShiftRng;
use cgmath::{EuclideanSpace, InnerSpace, Point2, Vector3};
use collision::Ray3;
use super::{
algorithm::{contribute, make_tiles, Tile},
LocalProgress, Progress, Renderer, TaskRunner,
};
use crate::cameras::Camera;
use crate::film::{Film, Samp... | index, rng, tile, film, camera, world, resources, renderer, config, progress,
);
},
|_, _| {
progress += 1;
on_status(Progress {
progress: ((progress * 100) / num_tiles) as u8,
message: &status_message,
});
... | {
fn gen_rng() -> XorShiftRng {
XorShiftRng::from_rng(rand::thread_rng()).expect("could not generate RNG")
}
let tiles = make_tiles(film.width(), film.height(), renderer.tile_size, camera);
let status_message = "Rendering";
on_status(Progress {
progress: 0,
message: &status... | identifier_body |
bidirectional.rs | use rand::{self, Rng, SeedableRng};
use rand_xorshift::XorShiftRng;
use cgmath::{EuclideanSpace, InnerSpace, Point2, Vector3};
use collision::Ray3;
use super::{
algorithm::{contribute, make_tiles, Tile},
LocalProgress, Progress, Renderer, TaskRunner,
};
use crate::cameras::Camera;
use crate::film::{Film, Samp... | else {
&mut []
};
contribute(bounce, &mut main, additional_samples, exe);
if i == 0 {
main.1 *= brdf_in;
for (_, reflectance) in additional_samples {
*reflectance *= brdf_in;
}
}
... | {
&mut *additional
} | conditional_block |
bidirectional.rs | use rand::{self, Rng, SeedableRng};
use rand_xorshift::XorShiftRng;
use cgmath::{EuclideanSpace, InnerSpace, Point2, Vector3};
use collision::Ray3;
use super::{
algorithm::{contribute, make_tiles, Tile},
LocalProgress, Progress, Renderer, TaskRunner,
};
use crate::cameras::Camera;
use crate::film::{Film, Samp... | () -> XorShiftRng {
XorShiftRng::from_rng(rand::thread_rng()).expect("could not generate RNG")
}
let tiles = make_tiles(film.width(), film.height(), renderer.tile_size, camera);
let status_message = "Rendering";
on_status(Progress {
progress: 0,
message: &status_message,
})... | gen_rng | identifier_name |
bidirectional.rs | use cgmath::{EuclideanSpace, InnerSpace, Point2, Vector3};
use collision::Ray3;
use super::{
algorithm::{contribute, make_tiles, Tile},
LocalProgress, Progress, Renderer, TaskRunner,
};
use crate::cameras::Camera;
use crate::film::{Film, Sample};
use crate::lamp::{RaySample, Surface};
use crate::tracer::{trace... | use rand::{self, Rng, SeedableRng};
use rand_xorshift::XorShiftRng;
| random_line_split | |
ed25519.rs | // -*- mode: rust; -*-
//
// This file is part of ed25519-dalek.
// Copyright (c) 2017-2019 isis lovecruft
// See LICENSE for licensing information.
//
// Authors:
// - isis agora lovecruft <isis@patternsinthevoid.net>
//! ed25519 keypairs and batch verification.
use core::default::Default;
use rand::CryptoRng;
use ... | fn visit_bytes<E>(self, bytes: &[u8]) -> Result<Keypair, E>
where
E: SerdeError,
{
let secret_key = SecretKey::from_bytes(&bytes[..SECRET_KEY_LENGTH]);
let public_key = PublicKey::from_bytes(&bytes[SECRET_KEY_LENGTH..]);
if se... | formatter.write_str("An ed25519 keypair, 64 bytes in total where the secret key is \
the first 32 bytes and is in unexpanded form, and the second \
32 bytes is a compressed point for a public key.")
}
| identifier_body |
ed25519.rs | // -*- mode: rust; -*-
//
// This file is part of ed25519-dalek.
// Copyright (c) 2017-2019 isis lovecruft
// See LICENSE for licensing information.
//
// Authors:
// - isis agora lovecruft <isis@patternsinthevoid.net>
//! ed25519 keypairs and batch verification.
use core::default::Default;
use rand::CryptoRng;
use ... | // Select a random 128-bit scalar for each signature.
let zs: Vec<Scalar> = signatures
.iter()
.map(|_| Scalar::from(thread_rng().gen::<u128>()))
.collect();
// Compute the basepoint coefficient, ∑ s[i]z[i] (mod l)
let B_coefficient: Scalar = signatures
.iter()
.map(|... | use rand::thread_rng;
use curve25519_dalek::traits::IsIdentity;
use curve25519_dalek::traits::VartimeMultiscalarMul;
| random_line_split |
ed25519.rs | // -*- mode: rust; -*-
//
// This file is part of ed25519-dalek.
// Copyright (c) 2017-2019 isis lovecruft
// See LICENSE for licensing information.
//
// Authors:
// - isis agora lovecruft <isis@patternsinthevoid.net>
//! ed25519 keypairs and batch verification.
use core::default::Default;
use rand::CryptoRng;
use ... | es: &'a [u8]) -> Result<Keypair, SignatureError> {
if bytes.len()!= KEYPAIR_LENGTH {
return Err(SignatureError(InternalError::BytesLengthError {
name: "Keypair",
length: KEYPAIR_LENGTH,
}));
}
let secret = SecretKey::from_bytes(&bytes[..SEC... | es<'a>(byt | identifier_name |
ed25519.rs | // -*- mode: rust; -*-
//
// This file is part of ed25519-dalek.
// Copyright (c) 2017-2019 isis lovecruft
// See LICENSE for licensing information.
//
// Authors:
// - isis agora lovecruft <isis@patternsinthevoid.net>
//! ed25519 keypairs and batch verification.
use core::default::Default;
use rand::CryptoRng;
use ... | Err(SignatureError(InternalError::VerifyError))
}
}
/// An ed25519 keypair.
#[derive(Debug, Default)] // we derive Default in order to use the clear() method in Drop
pub struct Keypair {
/// The secret half of this keypair.
pub secret: SecretKey,
/// The public half of this keypair.
pub pub... | Ok(())
} else {
| conditional_block |
lib.rs | //! Thread stack traces of remote processes.
//!
//! `rstack` (named after Java's `jstack`) uses [libunwind]'s ptrace interface to capture stack
//! traces of the threads of a remote process. It currently only supports Linux with a kernel
//! version of 3.4 or higher, and requires that the `/proc` pseudo-filesystem be ... | }
/// The error type returned by methods in this crate.
#[derive(Debug)]
pub struct Error(ErrorInner);
impl fmt::Display for Error {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
match self.0 {
ErrorInner::Io(ref e) => fmt::Display::fmt(e, fmt),
ErrorInner::Unwind(ref e)... | #[derive(Debug)]
enum ErrorInner {
Io(io::Error),
Unwind(unwind::Error), | random_line_split |
lib.rs | //! Thread stack traces of remote processes.
//!
//! `rstack` (named after Java's `jstack`) uses [libunwind]'s ptrace interface to capture stack
//! traces of the threads of a remote process. It currently only supports Linux with a kernel
//! version of 3.4 or higher, and requires that the `/proc` pseudo-filesystem be ... | {
Io(io::Error),
Unwind(unwind::Error),
}
/// The error type returned by methods in this crate.
#[derive(Debug)]
pub struct Error(ErrorInner);
impl fmt::Display for Error {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
match self.0 {
ErrorInner::Io(ref e) => fmt::Display::f... | ErrorInner | identifier_name |
lib.rs | //! Thread stack traces of remote processes.
//!
//! `rstack` (named after Java's `jstack`) uses [libunwind]'s ptrace interface to capture stack
//! traces of the threads of a remote process. It currently only supports Linux with a kernel
//! version of 3.4 or higher, and requires that the `/proc` pseudo-filesystem be ... |
Ok(thread)
}
}
fn dump(
&self,
space: &AddressSpace<PTraceStateRef>,
options: &TraceOptions,
) -> unwind::Result<Vec<Frame>> {
let state = PTraceState::new(self.0)?;
let mut cursor = Cursor::remote(&space, &state)?;
let mut trace = vec!... | {
return Err(io::Error::new(
io::ErrorKind::Other,
format!("unexpected wait status {}", status),
));
} | conditional_block |
lib.rs | //! Thread stack traces of remote processes.
//!
//! `rstack` (named after Java's `jstack`) uses [libunwind]'s ptrace interface to capture stack
//! traces of the threads of a remote process. It currently only supports Linux with a kernel
//! version of 3.4 or higher, and requires that the `/proc` pseudo-filesystem be ... | } else {
return Err(Error(ErrorInner::Io(e)));
},
};
threads.insert(thread);
}
}
Ok(())
}
fn get_name(pid: u32, tid: u32) -> Option<String> {
let path = format!("/proc/{}/task/{}/comm", pid, tid);
let mut name = vec![... | {
for entry in fs::read_dir(dir).map_err(|e| Error(ErrorInner::Io(e)))? {
let entry = entry.map_err(|e| Error(ErrorInner::Io(e)))?;
let pid = match entry
.file_name()
.to_str()
.and_then(|s| s.parse::<u32>().ok())
{
Some(pid) => pid,
... | identifier_body |
lib.rs | #![deny(missing_docs, intra_doc_link_resolution_failure)]
//! Topological functions execute within a context unique to the path in the runtime call
//! graph of other topological functions preceding the current activation record.
//!
//! Defining a topological function results in a macro definition for binding th... | ty: TypeId,
count: usize,
}
impl Callsite {
fn new(ty: TypeId, last_child: &Option<Callsite>) -> Self {
let prev_count = match last_child {
Some(ref prev) if prev.ty == ty => prev.count,
_ => 0,
};
Self {
ty,
count: prev_... |
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
struct Callsite {
| random_line_split |
lib.rs | #![deny(missing_docs, intra_doc_link_resolution_failure)]
//! Topological functions execute within a context unique to the path in the runtime call
//! graph of other topological functions preceding the current activation record.
//!
//! Defining a topological function results in a macro definition for binding th... | () {
let first_called;
let second_called;
let (first_byte, second_byte) = (0u8, 1u8);
call!(
{
let curr_byte: u8 = *Env::get::<u8>().unwrap();
assert_eq!(curr_byte, first_byte);
first_called = true;
... | call_env | identifier_name |
lib.rs | #![deny(missing_docs, intra_doc_link_resolution_failure)]
//! Topological functions execute within a context unique to the path in the runtime call
//! graph of other topological functions preceding the current activation record.
//!
//! Defining a topological function results in a macro definition for binding th... | ;
let parent = replace(&mut *parent, child);
scopeguard::guard(
(parent_initial_state, parent),
move |(prev_initial_state, mut prev)| {
if reset_on_drop {
prev.state = prev_initial_state;
}
... | {
parent.child(callsite_ty, add_env)
} | conditional_block |
lib.rs | #![deny(missing_docs, intra_doc_link_resolution_failure)]
//! Topological functions execute within a context unique to the path in the runtime call
//! graph of other topological functions preceding the current activation record.
//!
//! Defining a topological function results in a macro definition for binding th... |
/// Returns a reference to a value in the current environment, as [`Env::get`] does, but panics
/// if the value has not been set in the environment.
// TODO typename for debugging here would be v. nice
pub fn expect<E>() -> impl Deref<Target = E> +'static
where
E: Any +'static,
... | {
Point::with_current(|current| {
current
.state
.env
.inner
.get(&TypeId::of::<E>())
.map(|guard| {
OwningRef::new(guard.to_owned()).map(|anon| anon.downcast_ref().unwrap())
... | identifier_body |
lib.rs | //! Advent of Code - Day 10 Instructions
//!
//! Balance Bots
//!
//! You come upon a factory in which many robots are zooming around handing small microchips
//! to each other.
//!
//! Upon closer examination, you notice that each bot only proceeds when it has two microchips,
//! and once it does, it gives each one to... | (bot_id: Id, low_dest: Receiver, high_dest: Receiver) -> Instruction {
Instruction::Transfer {
bot_id,
low_dest,
high_dest,
}
}
}
/// Process a list of instructions.
///
/// Be careful--there's no guard currently in place against an incomplete list of instruction... | transfer | identifier_name |
lib.rs | //! Advent of Code - Day 10 Instructions
//!
//! Balance Bots
//!
//! You come upon a factory in which many robots are zooming around handing small microchips
//! to each other.
//!
//! Upon closer examination, you notice that each bot only proceeds when it has two microchips,
//! and once it does, it gives each one to... |
}
Entry::Vacant(entry) => {
entry.insert(value);
Ok(())
}
},
};
give_to_receiver(low, low_dest)?;
... | {
Ok(())
} | conditional_block |
lib.rs | //! Advent of Code - Day 10 Instructions
//!
//! Balance Bots
//!
//! You come upon a factory in which many robots are zooming around handing small microchips
//! to each other.
//!
//! Upon closer examination, you notice that each bot only proceeds when it has two microchips,
//! and once it does, it gives each one to... | assert_eq!(got, *parsed);
}
}
} | random_line_split | |
lib.rs | //! Advent of Code - Day 10 Instructions
//!
//! Balance Bots
//!
//! You come upon a factory in which many robots are zooming around handing small microchips
//! to each other.
//!
//! Upon closer examination, you notice that each bot only proceeds when it has two microchips,
//! and once it does, it gives each one to... |
}
/// Process a list of instructions.
///
/// Be careful--there's no guard currently in place against an incomplete list of instructions
/// leading to an infinite loop.
pub fn process(instructions: &[Instruction]) -> Result<(Bots, Outputs), Error> {
let mut bots = Bots::new();
let mut outputs = Outputs::new(... | {
Instruction::Transfer {
bot_id,
low_dest,
high_dest,
}
} | identifier_body |
app.rs | use std::cell::RefCell;
use std::error;
use gio::{self, prelude::*};
use gtk::{self, prelude::*};
use crate::utils::*;
use crate::header_bar::*;
use crate::about_dialog::*;
#[derive(Clone)]
pub struct App {
main_window: gtk::ApplicationWindow,
pub header_bar: HeaderBar,
url_input: gtk::Entry
}
#[derive(... |
}
impl Action {
// The full action name as is used in e.g. menu models
pub fn full_name(self) -> &'static str {
match self {
Action::About => "app.about",
Action::Quit => "app.quit",
Action::ClickToggle(_) => "app.toggle",
}
}
// Create our applica... | {
eprintln!("Shutting down the whole thing");
} | identifier_body |
app.rs | use std::cell::RefCell;
use std::error;
use gio::{self, prelude::*};
use gtk::{self, prelude::*};
use crate::utils::*;
use crate::header_bar::*;
use crate::about_dialog::*;
#[derive(Clone)]
pub struct App {
main_window: gtk::ApplicationWindow,
pub header_bar: HeaderBar,
url_input: gtk::Entry
}
#[derive(... | let payload_row = gtk::Box::new(gtk::Orientation::Horizontal, 5);
payload_row.set_sensitive(false);
payload_row.add(&payload_title);
payload_row.pack_start(&payload_input, true, true, 0);
// when POST is selected, activate the payload input box
// TODO: why don't I need ... | let payload_title = gtk::Label::new(None);
payload_title.set_markup("<big>Payload</big>");
let payload_input = gtk::Entry::new();
payload_input.insert_text(r#"ex. {"k": "key","v": "val"}"#, &mut 0);
payload_input.set_sensitive(false); | random_line_split |
app.rs | use std::cell::RefCell;
use std::error;
use gio::{self, prelude::*};
use gtk::{self, prelude::*};
use crate::utils::*;
use crate::header_bar::*;
use crate::about_dialog::*;
#[derive(Clone)]
pub struct App {
main_window: gtk::ApplicationWindow,
pub header_bar: HeaderBar,
url_input: gtk::Entry
}
#[derive(... | (v: &glib::Variant) -> ToggleButtonState {
v.get::<bool>().expect("Invalid record state type").into()
}
}
impl From<bool> for ToggleButtonState {
fn from(v: bool) -> ToggleButtonState {
match v {
false => ToggleButtonState::State1,
true => ToggleButtonState::State2,
... | from | identifier_name |
footprint_analysis.rs | , and use symbolic execution on each opcode again.
use crossbeam::queue::SegQueue;
use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet};
use std::error::Error;
use std::fmt;
use std::io::Write;
use std::path::Path;
use std::sync::Arc;
use std::time::Instant;
use isla_lib::cache::{Cacheable, ... |
}
impl Cacheable for Footprint {
type Key = Footprintkey;
}
impl Footprint {
fn new() -> Self {
Footprint {
write_data_taints: (HashSet::new(), false),
mem_addr_taints: (HashSet::new(), false),
branch_addr_taints: (HashSet::new(), false),
register_reads... | {
format!("opcode_{}", self.opcode)
} | identifier_body |
footprint_analysis.rs | , and use symbolic execution on each opcode again.
use crossbeam::queue::SegQueue;
use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet};
use std::error::Error;
use std::fmt;
use std::io::Write;
use std::path::Path;
use std::sync::Arc;
use std::time::Instant;
use isla_lib::cache::{Cacheable, ... | <B: BV>(from: usize, to: usize, instrs: &[B], footprints: &HashMap<B, Footprint>) -> bool {
if from >= to {
return false;
}
let touched = touched_by(from, to, instrs, footprints);
for reg in &footprints.get(&instrs[to]).unwrap().write_data_taints.0 {
if touched.contains(reg) {
... | data_dep | identifier_name |
footprint_analysis.rs | run, and use symbolic execution on each opcode again.
use crossbeam::queue::SegQueue;
use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet};
use std::error::Error;
use std::fmt;
use std::io::Write;
use std::path::Path;
use std::sync::Arc;
use std::time::Instant;
use isla_lib::cache::{Cacheab... |
let to_footprint = footprints.get(&instrs[to]).unwrap();
to_footprint.is_exclusive && to_footprint.is_store
}
/// The set of registers that could be (syntactically) touched by the
/// first instruction before reaching the second.
#[allow(clippy::needless_range_loop)]
fn touched_by<B: BV>(
from: usize,
... | random_line_split | |
footprint_analysis.rs | , and use symbolic execution on each opcode again.
use crossbeam::queue::SegQueue;
use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet};
use std::error::Error;
use std::fmt;
use std::io::Write;
use std::path::Path;
use std::sync::Arc;
use std::time::Instant;
use isla_lib::cache::{Cacheable, ... |
}
let to_footprint = footprints.get(&instrs[to]).unwrap();
to_footprint.is_exclusive && to_footprint.is_store
}
/// The set of registers that could be (syntactically) touched by the
/// first instruction before reaching the second.
#[allow(clippy::needless_range_loop)]
fn touched_by<B: BV>(
from: usi... | {
return false;
} | conditional_block |
mod.rs | // Copyright © 2018 Cormac O'Brien
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, ... | &self, new_origin: Vector3<f32>) {
self.origin.set(new_origin);
}
pub fn set_left_ear(&self, new_origin: Vector3<f32>) {
self.left_ear.set(new_origin);
}
pub fn set_right_ear(&self, new_origin: Vector3<f32>) {
self.right_ear.set(new_origin);
}
pub fn attenuate(
... | et_origin( | identifier_name |
mod.rs | // Copyright © 2018 Cormac O'Brien
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, ... | };
use thiserror::Error;
use chrono::Duration;
pub const DISTANCE_ATTENUATION_FACTOR: f32 = 0.001;
const MAX_ENTITY_CHANNELS: usize = 128;
#[derive(Error, Debug)]
pub enum SoundError {
#[error("No such music track: {0}")]
NoSuchTrack(String),
#[error("I/O error: {0}")]
Io(#[from] io::Error),
#[err... | use cgmath::{InnerSpace, Vector3};
use rodio::{
source::{Buffered, SamplesConverter},
Decoder, OutputStreamHandle, Sink, Source, | random_line_split |
mod.rs | // Copyright © 2018 Cormac O'Brien
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, ... |
// keep track of which sound started the earliest
match self.channels[oldest] {
Some(ref o) => {
if chan.start_time < o.start_time {
oldest = i;
}
... |
let mut oldest = 0;
for (i, channel) in self.channels.iter().enumerate() {
match *channel {
Some(ref chan) => {
// if this channel is free, return it
if !chan.channel.in_use() {
return i;
}
... | identifier_body |
mod.rs | // Copyright © 2018 Cormac O'Brien
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, ... |
// replace sounds on the same entity channel
if ent_channel!= 0
&& chan.ent_id == ent_id
&& (chan.ent_channel == ent_channel || ent_channel == -1)
{
return i;
}
... |
return i;
}
| conditional_block |
dropck.rs | ::free_region::FreeRegionMap;
use rustc::infer;
use middle::region;
use rustc::ty::subst::{Subst, Substs};
use rustc::ty::{self, AdtKind, Ty, TyCtxt};
use rustc::traits::{self, Reveal};
use util::nodemap::FnvHashSet;
use syntax::ast;
use syntax_pos::{self, Span};
/// check_drop_impl confirms that the Drop implementat... | // definition yields the instantiated assumptions:
//
// ['y : 'z]
//
// We then check all of the predicates of the Drop impl:
//
// ['y:'z, 'x:'y]
//
// and ensure each is in the list of instantiated
// assumptions. Here, `'y:'z` is present, but `'x:'y` is
// absent.... | // self_to_impl_substs = {'c => 'z, 'b => 'y, 'a => 'x}
//
// Applying this to the predicates (i.e. assumptions) provided by the item | random_line_split |
dropck.rs | free_region::FreeRegionMap;
use rustc::infer;
use middle::region;
use rustc::ty::subst::{Subst, Substs};
use rustc::ty::{self, AdtKind, Ty, TyCtxt};
use rustc::traits::{self, Reveal};
use util::nodemap::FnvHashSet;
use syntax::ast;
use syntax_pos::{self, Span};
/// check_drop_impl confirms that the Drop implementatio... | if let Err(_) = infcx.eq_types(true, infer::TypeOrigin::Misc(drop_impl_span),
named_type, fresh_impl_self_ty) {
let item_span = tcx.map.span(self_type_node_id);
struct_span_err!(tcx.sess, drop_impl_span, E0366,
"Implemen... | {
let tcx = ccx.tcx;
let drop_impl_node_id = tcx.map.as_local_node_id(drop_impl_did).unwrap();
let self_type_node_id = tcx.map.as_local_node_id(self_type_did).unwrap();
// check that the impl type can be made to match the trait type.
let impl_param_env = ty::ParameterEnvironment::for_item(tcx, sel... | identifier_body |
dropck.rs | free_region::FreeRegionMap;
use rustc::infer;
use middle::region;
use rustc::ty::subst::{Subst, Substs};
use rustc::ty::{self, AdtKind, Ty, TyCtxt};
use rustc::traits::{self, Reveal};
use util::nodemap::FnvHashSet;
use syntax::ast;
use syntax_pos::{self, Span};
/// check_drop_impl confirms that the Drop implementatio... | <'tcx> {
Overflow(TypeContext, ty::Ty<'tcx>),
}
#[derive(Copy, Clone)]
enum TypeContext {
Root,
ADT {
def_id: DefId,
variant: ast::Name,
field: ast::Name,
}
}
struct DropckContext<'a, 'b: 'a, 'gcx: 'b+'tcx, 'tcx: 'b> {
rcx: &'a mut RegionCtxt<'b, 'gcx, 'tcx>,
/// types ... | Error | identifier_name |
dropck.rs | cannot do `struct S<T>; impl<T:Clone> Drop for S<T> {... }`).
///
pub fn check_drop_impl(ccx: &CrateCtxt, drop_impl_did: DefId) -> Result<(), ()> {
let dtor_self_type = ccx.tcx.lookup_item_type(drop_impl_did).ty;
let dtor_predicates = ccx.tcx.lookup_predicates(drop_impl_did);
match dtor_self_type.sty {
... | {
def.is_dtorck(tcx)
} | conditional_block | |
ui.rs | use failure::{bail, ensure, format_err, Error, Fallible};
use std::cell::{RefCell, RefMut};
use std::io::Read;
use std::rc::Rc;
use crate::terminal::{set_stdin_echo, TERMINAL_CLEAR_LINE};
use crate::util::to_hex_string;
use crate::{Reader, ReaderFactory, Writer};
const ERROR_VERBOSITY: i32 = -1;
const INTERACTIVE_VER... |
Ok(())
}
fn println_interactive(&self, message: &str) -> Fallible<()> {
if self.will_print(INTERACTIVE_VERBOSITY) {
writeln!(self.output.borrow_mut(), "{}", message)?;
}
Ok(())
}
fn println_progress(&self, verbosity: i32, message: &str, finish: bool) -> Fal... | {
writeln!(self.output.borrow_mut(), "{}: {}", self.program_name, err)?;
} | conditional_block |
ui.rs | use failure::{bail, ensure, format_err, Error, Fallible};
use std::cell::{RefCell, RefMut};
use std::io::Read;
use std::rc::Rc;
use crate::terminal::{set_stdin_echo, TERMINAL_CLEAR_LINE};
use crate::util::to_hex_string;
use crate::{Reader, ReaderFactory, Writer};
const ERROR_VERBOSITY: i32 = -1;
const INTERACTIVE_VER... |
pub fn expect_prompt(
self,
matcher: impl AsRef<str>,
reply: Result<impl AsRef<str>, Error>,
) -> Self {
self.prompt_replies.borrow_mut().push_back((
Some(matcher.as_ref().to_string()),
reply.map(|s| s.as_ref().to_string()... | {
TestUI {
..Default::default()
}
} | identifier_body |
ui.rs | use failure::{bail, ensure, format_err, Error, Fallible};
use std::cell::{RefCell, RefMut};
use std::io::Read;
use std::rc::Rc;
use crate::terminal::{set_stdin_echo, TERMINAL_CLEAR_LINE};
use crate::util::to_hex_string;
use crate::{Reader, ReaderFactory, Writer};
const ERROR_VERBOSITY: i32 = -1;
const INTERACTIVE_VER... | }
}
impl UI for TestUI {
fn set_verbosity(&mut self, _verbosity: i32) {}
fn set_progress_enabled(&mut self, _enabled: bool) {}
fn program_name(&self) -> &str {
"rypt"
}
// Write interface
fn will_print(&self, _verbosity: i32) -> bool {
... | }
printed_lines.extend(line_tuples);
Ok(()) | random_line_split |
ui.rs | use failure::{bail, ensure, format_err, Error, Fallible};
use std::cell::{RefCell, RefMut};
use std::io::Read;
use std::rc::Rc;
use crate::terminal::{set_stdin_echo, TERMINAL_CLEAR_LINE};
use crate::util::to_hex_string;
use crate::{Reader, ReaderFactory, Writer};
const ERROR_VERBOSITY: i32 = -1;
const INTERACTIVE_VER... | (&self) -> bool {
self.input.borrow().is_some()
&& self.input_is_tty
&& self.output_is_tty
&& self.will_print(INTERACTIVE_VERBOSITY)
}
fn read_prompt(&self, prompt: &str) -> Fallible<String> {
ensure!(self.can_read(), "Can't read from a non-TTY input");
... | can_read | identifier_name |
resnet.rs | use plant::*;
use std::{rc::Rc, time::Instant, env, cmp::Ordering::*};
macro_rules! read { ($s: expr, $($arg:tt)*) => { ArrayInit::Data(&std::fs::read(&format!(concat!("resnet_data/", $s), $($arg)*)).unwrap()) }; }
type M = Slice<u8, usize>;
static TILE_MAP: [([u32; 6], [u32; 12]); 26] = [
// resnet18, 34
([3, 6... | pl Fn(M), M) {
let expansion = if bottleneck { 4 } else { 1 };
let mut layers = Vec::with_capacity(blocks as _);
layers.push(block(inplanes, planes, size, stride, bottleneck));
for _ in 1..blocks {
layers.push(block(planes * expansion, planes, size / stride, 1, bottleneck));
}
let b = layers.last().unwr... | > (im | identifier_name |
resnet.rs | use plant::*;
use std::{rc::Rc, time::Instant, env, cmp::Ordering::*};
macro_rules! read { ($s: expr, $($arg:tt)*) => { ArrayInit::Data(&std::fs::read(&format!(concat!("resnet_data/", $s), $($arg)*)).unwrap()) }; }
type M = Slice<u8, usize>;
static TILE_MAP: [([u32; 6], [u32; 12]); 26] = [
// resnet18, 34
([3, 6... | let b_init = f.comp("B_init", x![chan,], x!(0));
let b = f.comp("B", x![chan, size, size], x!(a(i0, i1, i2) + buf_b(i0)));
let b_final = f.comp("B_final", x![chan,], x!(buf_b(i0) / ((size * size))));
b_init.before(b, 1).before(b_final, 1);
b_init.store(buf_b);
b.store_at(buf_b, x![i0,]);
b_final.store(buf... | let f = Func::new("avgpool");
let a = f.buf("A", F32, In, x![chan, size, size]);
let buf_b = f.buf("B", F32, Out, x![chan,]); | random_line_split |
resnet.rs | use plant::*;
use std::{rc::Rc, time::Instant, env, cmp::Ordering::*};
macro_rules! read { ($s: expr, $($arg:tt)*) => { ArrayInit::Data(&std::fs::read(&format!(concat!("resnet_data/", $s), $($arg)*)).unwrap()) }; }
type M = Slice<u8, usize>;
static TILE_MAP: [([u32; 6], [u32; 12]); 26] = [
// resnet18, 34
([3, 6... | let (f1, b1) = conv(inplanes, planes, size, 1, stride, 0, 0, 1);
let (f2, b2) = conv(planes, planes, size / stride, 3, 1, 1, 0, 1);
let (f3, b3) = conv(planes, planes * expansion, size / stride, 1, 1, 0, 1, 1);
let f4 = if downsample { Some(conv(inplanes, planes * expansion, size, 1, stride, 0, 0, 0)) } els... | conditional_block | |
resnet.rs | use plant::*;
use std::{rc::Rc, time::Instant, env, cmp::Ordering::*};
macro_rules! read { ($s: expr, $($arg:tt)*) => { ArrayInit::Data(&std::fs::read(&format!(concat!("resnet_data/", $s), $($arg)*)).unwrap()) }; }
type M = Slice<u8, usize>;
static TILE_MAP: [([u32; 6], [u32; 12]); 26] = [
// resnet18, 34
([3, 6... | }), b2)
}
}
fn layer(inplanes: u32, planes: u32, blocks: u32, size: u32, stride: u32, bottleneck: bo
ol) -> (impl Fn(M), M) {
let expansion = if bottleneck { 4 } else { 1 };
let mut layers = Vec::with_capacity(blocks as _);
layers.push(block(inplanes, planes, size, stride, bottleneck));
for _ in 1..block... | anes != planes * expansion;
if bottleneck {
let (f1, b1) = conv(inplanes, planes, size, 1, stride, 0, 0, 1);
let (f2, b2) = conv(planes, planes, size / stride, 3, 1, 1, 0, 1);
let (f3, b3) = conv(planes, planes * expansion, size / stride, 1, 1, 0, 1, 1);
let f4 = if downsample { Some(conv(inplanes, pl... | identifier_body |
terminal.rs | use crate::os_glue::Glue;
use crate::{Features, Key, TermOut};
use stakker::{fwd, timer_max, Fwd, MaxTimerKey, Share, CX};
use std::error::Error;
use std::mem;
use std::panic::PanicInfo;
use std::sync::Arc;
use std::time::Duration;
/// Actor that manages the connection to the terminal
pub struct Terminal {
resize:... | termout: Share<TermOut>,
glue: Glue,
disable_output: bool,
paused: bool,
inbuf: Vec<u8>,
check_enable: bool,
force_timer: MaxTimerKey,
check_timer: MaxTimerKey,
cleanup: Vec<u8>,
panic_hook: Arc<Box<dyn Fn(&PanicInfo<'_>) +'static + Sync + Send>>,
}
impl Terminal {
/// Set u... | random_line_split | |
terminal.rs | use crate::os_glue::Glue;
use crate::{Features, Key, TermOut};
use stakker::{fwd, timer_max, Fwd, MaxTimerKey, Share, CX};
use std::error::Error;
use std::mem;
use std::panic::PanicInfo;
use std::sync::Arc;
use std::time::Duration;
/// Actor that manages the connection to the terminal
pub struct Terminal {
resize:... |
/// Resume terminal output and input handling. Switches to raw
/// mode and sends a resize message to trigger a full redraw.
pub fn resume(&mut self, cx: CX![]) {
if self.paused {
self.paused = false;
self.glue.input(true);
self.termout.rw(cx).discard();
... | {
if !self.paused {
fwd!([self.resize], None);
self.glue.input(false);
self.termout.rw(cx).discard();
self.termout.rw(cx).bytes(&self.cleanup[..]);
self.termout.rw(cx).flush();
self.flush(cx);
self.paused = true;
sel... | identifier_body |
terminal.rs | use crate::os_glue::Glue;
use crate::{Features, Key, TermOut};
use stakker::{fwd, timer_max, Fwd, MaxTimerKey, Share, CX};
use std::error::Error;
use std::mem;
use std::panic::PanicInfo;
use std::sync::Arc;
use std::time::Duration;
/// Actor that manages the connection to the terminal
pub struct Terminal {
resize:... | (&mut self, cx: CX![]) {
if!self.paused {
fwd!([self.resize], None);
self.glue.input(false);
self.termout.rw(cx).discard();
self.termout.rw(cx).bytes(&self.cleanup[..]);
self.termout.rw(cx).flush();
self.flush(cx);
self.paused =... | pause | identifier_name |
terminal.rs | use crate::os_glue::Glue;
use crate::{Features, Key, TermOut};
use stakker::{fwd, timer_max, Fwd, MaxTimerKey, Share, CX};
use std::error::Error;
use std::mem;
use std::panic::PanicInfo;
use std::sync::Arc;
use std::time::Duration;
/// Actor that manages the connection to the terminal
pub struct Terminal {
resize:... |
}
/// Resume terminal output and input handling. Switches to raw
/// mode and sends a resize message to trigger a full redraw.
pub fn resume(&mut self, cx: CX![]) {
if self.paused {
self.paused = false;
self.glue.input(true);
self.termout.rw(cx).discard();
... | {
fwd!([self.resize], None);
self.glue.input(false);
self.termout.rw(cx).discard();
self.termout.rw(cx).bytes(&self.cleanup[..]);
self.termout.rw(cx).flush();
self.flush(cx);
self.paused = true;
self.update_panic_hook();
... | conditional_block |
mod.rs |
fn new(key: &CVWords, chunk_counter: u64, flags: u8) -> Self {
Self {
k: *key,
t: [counter_low(chunk_counter), counter_high(chunk_counter)],
d: flags.into(),
}
}
fn plus_chunks(&self, chunks: u64) -> Self {
let t = self.chunk_counter() + chunks;
... | ///
/// [`update`]: #method.update
/// [`update_with_join`]: #method.update_with_join
/// [`GpuControl`]: struct.GpuControl.html
pub fn update_from_gpu<J: Join>(&mut self, chunk_count: u64, parents: &mut [u8]) -> &mut Self {
assert_eq!(self.chunk_state.len(), 0, "leftover buffered bytes");
... | /// same as the chunk counter in the [`GpuControl`] passed to the shader,
/// otherwise it will lead to a wrong hash output.
///
/// Note: on a big-endian host, this method will swap the endianness of the
/// shader output in-place. | random_line_split |
mod.rs | fn new(key: &CVWords, chunk_counter: u64, flags: u8) -> Self {
Self {
k: *key,
t: [counter_low(chunk_counter), counter_high(chunk_counter)],
d: flags.into(),
}
}
fn plus_chunks(&self, chunks: u64) -> Self {
let t = self.chunk_counter() + chunks;
... |
/// Returns the SPIR-V code for the chunk shader module.
#[cfg(target_endian = "little")]
pub fn chunk_shader() -> &'static [u8] {
include_bytes!("shaders/blake3-chunk-le.spv")
}
/// Returns the SPIR-V code for the parent shader module.
pub fn parent_shader... | {
include_bytes!("shaders/blake3-chunk-be.spv")
} | identifier_body |
mod.rs | fn new(key: &CVWords, chunk_counter: u64, flags: u8) -> Self {
Self {
k: *key,
t: [counter_low(chunk_counter), counter_high(chunk_counter)],
d: flags.into(),
}
}
fn plus_chunks(&self, chunks: u64) -> Self {
let t = self.chunk_counter() + chunks;
... | (&self) -> u8 {
self.d as u8
}
/// Returns the bytes to be copied to the control uniform in the GPU.
///
/// The contents of the returned slice are opaque and should be interpreted
/// only by the shader.
#[inline]
pub fn as_bytes(&self) -> &[u8] {
// According to the specif... | flags | identifier_name |
imp.rs | use super::{
anyhow, env, env_logger, remove_file, DateTime, PathBuf, Receiver, RefCell, Releaser, Result,
Url, Utc, Version, UPDATE_INTERVAL,
};
use crate::Updater;
use std::cell::Cell;
use std::cell::Ref;
use std::cell::RefMut;
use std::path::Path;
use std::sync::mpsc;
pub(super) const LATEST_UPDATE_INFO_CAC... | Ok(true)
} else {
Ok(false)
}
} else {
Ok(false)
}
}
#[allow(dead_code)]
#[deprecated(note = "update_ready_sync is deprecated. use init()")]
pub(super) fn _update_ready_sync(&self) -> Result<bool> {
// A None va... | }
if let Some(ref updater_info) = *self.state.avail_release.borrow() {
if *self.current_version() < updater_info.version { | random_line_split |
imp.rs | use super::{
anyhow, env, env_logger, remove_file, DateTime, PathBuf, Receiver, RefCell, Releaser, Result,
Url, Utc, Version, UPDATE_INTERVAL,
};
use crate::Updater;
use std::cell::Cell;
use std::cell::Ref;
use std::cell::RefMut;
use std::path::Path;
use std::sync::mpsc;
pub(super) const LATEST_UPDATE_INFO_CAC... | (&self) -> Ref<'_, Option<MPSCState>> {
self.worker_state.borrow()
}
pub(super) fn borrow_worker_mut(&self) -> RefMut<'_, Option<MPSCState>> {
self.worker_state.borrow_mut()
}
pub(super) fn download_url(&self) -> Option<Url> {
self.avail_release
.borrow()
... | borrow_worker | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.