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
wallet.rs
state. fn persistent_state_address( network: NetworkId, master_xpriv: &bip32::ExtendedPrivKey, ) -> String { let child = bip32::ChildNumber::from_hardened_idx(350).unwrap(); let child_xpriv = master_xpriv.derive_priv(&SECP, &[child]).unwrap(); let child_xpub = bip32::Ext...
pub fn sign_transaction(&self, details: &Value) -> Result<String, Error> { debug!("sign_transaction(): {:?}", details); let change_address = self.next_address(&self.internal_xpriv, &self.next_internal_child)?; // If we don't have any inputs, we can fail early. let unspent: Vec<Val...
{ debug!("create_transaction(): {:?}", details); let unfunded_tx = match self.network.id() { NetworkId::Bitcoin(..) => coins::btc::create_transaction(&self.rpc, details)?, NetworkId::Elements(..) => coins::liq::create_transaction(&self.rpc, details)?, }; debug!("...
identifier_body
ui.rs
use super::*; use std::rc::Rc; use std::cell::RefCell; use std::cmp::{min, max}; use stdweb::web; use stdweb::unstable::TryInto; use nalgebra::{Vector2}; use time_steward::{DeterministicRandomId}; use steward_module::{TimeSteward, ConstructibleTimeSteward, Accessor, simple_timeline}; use self::simple_timeline::{q...
(time: f64, game: Rc<RefCell<Game>>) { //let continue_simulating; { let mut game = game.borrow_mut(); let observed_duration = time - game.last_ui_time; let duration_to_simulate = if observed_duration < 100.0 {observed_duration} else {100.0}; let duration_to_simulate = (duration_to_simulate*(SECOND ...
main_loop
identifier_name
ui.rs
use super::*; use std::rc::Rc; use std::cell::RefCell; use std::cmp::{min, max}; use stdweb::web; use stdweb::unstable::TryInto; use nalgebra::{Vector2}; use time_steward::{DeterministicRandomId}; use steward_module::{TimeSteward, ConstructibleTimeSteward, Accessor, simple_timeline}; use self::simple_timeline::{q...
} pub fn draw_game <A: Accessor <Steward = Steward>>(accessor: &A, game: & Game) { let canvas_width: f64 = js! {return canvas.width;}.try_into().unwrap(); let scale = canvas_width/(game.display_radius as f64*2.0); js! { var size = Math.min (window.innerHeight, window.innerWidth); canvas.setAttribute ("w...
display_center: Vector::new (0, 0), display_radius: INITIAL_PALACE_DISTANCE*3/2, selected_object: None, }
random_line_split
ui.rs
use super::*; use std::rc::Rc; use std::cell::RefCell; use std::cmp::{min, max}; use stdweb::web; use stdweb::unstable::TryInto; use nalgebra::{Vector2}; use time_steward::{DeterministicRandomId}; use steward_module::{TimeSteward, ConstructibleTimeSteward, Accessor, simple_timeline}; use self::simple_timeline::{q...
if varying.awareness_range >0 && varying.object_type!= ObjectType::Beast {js! { context.beginPath(); context.arc (@{center [0]},@{center [1]},@{varying.awareness_range as f64}, 0, Math.PI*2); context.lineWidth = @{0.3/scale}; context.stroke(); }} if let Some(home) = varying.home.as_...
{js! { context.beginPath(); context.arc (@{center [0]},@{center [1]},@{varying.interrupt_range as f64}, 0, Math.PI*2); context.lineWidth = @{0.3/scale}; context.stroke(); }}
conditional_block
ui.rs
use super::*; use std::rc::Rc; use std::cell::RefCell; use std::cmp::{min, max}; use stdweb::web; use stdweb::unstable::TryInto; use nalgebra::{Vector2}; use time_steward::{DeterministicRandomId}; use steward_module::{TimeSteward, ConstructibleTimeSteward, Accessor, simple_timeline}; use self::simple_timeline::{q...
} }
{ let mut scores = [0; 2]; loop { let mut game = make_game(DeterministicRandomId::new (& (scores, 0xae06fcf3129d0685u64))); loop { game.now += SECOND /100; let snapshot = game.steward.snapshot_before (& game.now). unwrap (); game.steward.forget_before (& game.now); /*let teams_ali...
identifier_body
util.rs
//! Useful functions and macros for writing figments. //! //! # `map!` macro //! //! The `map!` macro constructs a [`Map`](crate::value::Map) from key-value //! pairs and is particularly useful during testing: //! //! ```rust //! use figment::util::map; //! //! let map = map! { //! "name" => "Bob", //! "age" =>...
} comps.push(a); comps.extend(ita.by_ref()); break; } } } Some(comps.iter().map(|c| c.as_os_str()).collect()) } /// A helper to deserialize `0/false` as `false` and `1/true` as `true`. /// /// Serde's default deserializer for ...
(Some(a), Some(_)) => { comps.push(Component::ParentDir); for _ in itb { comps.push(Component::ParentDir);
random_line_split
util.rs
//! Useful functions and macros for writing figments. //! //! # `map!` macro //! //! The `map!` macro constructs a [`Map`](crate::value::Map) from key-value //! pairs and is particularly useful during testing: //! //! ```rust //! use figment::util::map; //! //! let map = map! { //! "name" => "Bob", //! "age" =>...
fn visit_u64<E: de::Error>(self, n: u64) -> Result<bool, E> { match n { 0 | 1 => Ok(n!= 0), n => Err(E::invalid_value(Unexpected::Unsigned(n), &"0 or 1")) } } fn visit_i64<E: de::Error>(self, n: i64) -> Result<bool, E> { matc...
{ match val { v if uncased::eq(v, "true") => Ok(true), v if uncased::eq(v, "false") => Ok(false), s => Err(E::invalid_value(Unexpected::Str(s), &"true or false")) } }
identifier_body
util.rs
//! Useful functions and macros for writing figments. //! //! # `map!` macro //! //! The `map!` macro constructs a [`Map`](crate::value::Map) from key-value //! pairs and is particularly useful during testing: //! //! ```rust //! use figment::util::map; //! //! let map = map! { //! "name" => "Bob", //! "age" =>...
<'de, D: Deserializer<'de>>(de: D) -> Result<bool, D::Error> { struct Visitor; impl<'de> de::Visitor<'de> for Visitor { type Value = bool; fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str("a boolean") } fn visit_str<E: de::Error>(self, v...
bool_from_str_or_int
identifier_name
main.rs
#![feature(collections)] #[macro_use] extern crate log; extern crate env_logger; extern crate parser_combinators; // TODO: // - Benchmarks // - Cache of last piece // - merge consecutive insert, delete // - snapshots // - Allow String, &str, &[u8], and Vec<u8> as parameter to insert, append /// A...
} #[cfg(not(test))] fn main() { env_logger::init().unwrap(); info!("starting up"); //let mut text = Text::new(); let mut args = std::env::args(); args.next().unwrap(); let s = args.next().unwrap(); let cmd = Command::parse(&s); println!("{:?}", cmd); }
{ let literal = between(char('/'), char('/'), many(satisfy(|c| c != '/')).map(Command::Insert)); let spaces = spaces(); spaces.with(char('i').with(literal)).parse(s) }
identifier_body
main.rs
#![feature(collections)] #[macro_use] extern crate log; extern crate env_logger; extern crate parser_combinators; // TODO: // - Benchmarks // - Cache of last piece // - merge consecutive insert, delete // - snapshots // - Allow String, &str, &[u8], and Vec<u8> as parameter to insert, append /// A...
} } impl AppendOnlyBuffer { /// Constructs a new, empty AppendOnlyBuffer. pub fn new() -> AppendOnlyBuffer { AppendOnlyBuffer { buf: Vec::with_capacity(4096) } } /// Append a slice of bytes. pub fn append(&mut self, bytes: &[u8]) -> Span { let off1 = self.b...
{ Some((Span::new(self.off1, self.off1+n), Span::new(self.off1+n, self.off2))) }
conditional_block
main.rs
#![feature(collections)] #[macro_use] extern crate log; extern crate env_logger; extern crate parser_combinators; // TODO: // - Benchmarks // - Cache of last piece // - merge consecutive insert, delete // - snapshots // - Allow String, &str, &[u8], and Vec<u8> as parameter to insert, append /// A...
} /// Iterator over all pieces (but never the sentinel) fn pieces(&self) -> Pieces { let next = self.get_piece(SENTINEL).next; Pieces { text: self, next: next, off: 0, } } /// Length of Text in bytes pub fn len(&self) -> usize { ...
l += len; p = self.get_piece(p).prev; } assert_eq!(l as usize, self.len());
random_line_split
main.rs
#![feature(collections)] #[macro_use] extern crate log; extern crate env_logger; extern crate parser_combinators; // TODO: // - Benchmarks // - Cache of last piece // - merge consecutive insert, delete // - snapshots // - Allow String, &str, &[u8], and Vec<u8> as parameter to insert, append /// A...
(&mut self, piece1: Piece, piece2: Piece) { let Piece(p1) = piece1; let Piece(p2) = piece2; self.pieces[p1 as usize].next = piece2; self.pieces[p2 as usize].prev = piece1; } /// Find the piece containing offset. Return piece /// and start position of piece in text. ///...
link
identifier_name
math.rs
use num_bigint::{BigInt, ToBigUint}; use num_traits::{Zero, One, Pow}; use std::collections::{BinaryHeap, HashSet, HashMap, VecDeque}; use std::cmp::{max, Ordering}; use std::hash::Hash; use std::ops; use std::fmt; use crate::ast::{AST, as_int}; pub fn to_usize(n : &BigInt) -> Result<usize, String> { match ToBig...
} fn index_of(&mut self, v : AST) -> Option<usize> { match v { AST::Int(n) => if n < Zero::zero() { match to_usize(&-n) { Ok(m) => Some(2*m - 1), _ => None } } else { ...
} fn increasing(&self) -> bool { return false;
random_line_split
math.rs
use num_bigint::{BigInt, ToBigUint}; use num_traits::{Zero, One, Pow}; use std::collections::{BinaryHeap, HashSet, HashMap, VecDeque}; use std::cmp::{max, Ordering}; use std::hash::Hash; use std::ops; use std::fmt; use crate::ast::{AST, as_int}; pub fn to_usize(n : &BigInt) -> Result<usize, String> { match ToBig...
fn calc_nth(&mut self, n : usize) -> Result<Rat, String> { let mut res = Rat::from_usize(1); for (p,a) in prime_factor(BigInt::from(n), &mut self.ps) { let b = int_nth(to_usize(&a)?); let r = Rat::new(p.clone(), One::one()).pow(&b); // println!("{}: {}^({} => {}...
{ return Rationals { ps : PrimeSeq::new() }; }
identifier_body
math.rs
use num_bigint::{BigInt, ToBigUint}; use num_traits::{Zero, One, Pow}; use std::collections::{BinaryHeap, HashSet, HashMap, VecDeque}; use std::cmp::{max, Ordering}; use std::hash::Hash; use std::ops; use std::fmt; use crate::ast::{AST, as_int}; pub fn to_usize(n : &BigInt) -> Result<usize, String> { match ToBig...
(&self) -> bool { return false; } fn index_of(&mut self, v : AST) -> Option<usize> { let (mut n,d) = match v { AST::Int(n) => (n, One::one()), AST::Rat(Rat{n,d}) => (n,d), _ => return None }; let neg = n < Zero::zero(); if neg { ...
increasing
identifier_name
server.rs
//! A generic MIO server. use error::{MioResult, MioError}; use handler::Handler; use io::{Ready, IoHandle, IoReader, IoWriter, IoAcceptor}; use iobuf::{Iobuf, RWIobuf}; use reactor::Reactor; use socket::{TcpSocket, TcpAcceptor, SockAddr}; use std::cell::RefCell; use std::collections::{Deque, RingBuf}; use std::rc::Rc;...
global: Rc<Global<St>>, on_accept: fn(reactor: &mut Reactor) -> C) -> AcceptHandler<St, C> { AcceptHandler { accept_socket: accept_socket, global: global, on_accept: on_accept, } } } impl<St, C: PerClient<St>> Handl...
random_line_split
server.rs
//! A generic MIO server. use error::{MioResult, MioError}; use handler::Handler; use io::{Ready, IoHandle, IoReader, IoWriter, IoAcceptor}; use iobuf::{Iobuf, RWIobuf}; use reactor::Reactor; use socket::{TcpSocket, TcpAcceptor, SockAddr}; use std::cell::RefCell; use std::collections::{Deque, RingBuf}; use std::rc::Rc;...
{ // TODO(cgaebel): ipv6? udp? let socket: TcpSocket = try!(TcpSocket::v4()); let mut client = Some(client); let global = Rc::new(Global::new(())); reactor.connect(socket, connect_to, |socket| { tweak_sock_opts(&socket); Connection::new(socket, global.clone(), client.take().unw...
identifier_body
server.rs
//! A generic MIO server. use error::{MioResult, MioError}; use handler::Handler; use io::{Ready, IoHandle, IoReader, IoWriter, IoAcceptor}; use iobuf::{Iobuf, RWIobuf}; use reactor::Reactor; use socket::{TcpSocket, TcpAcceptor, SockAddr}; use std::cell::RefCell; use std::collections::{Deque, RingBuf}; use std::rc::Rc;...
let mut readbuf_pool = self.readbuf_pool.borrow_mut(); let mut ret = match readbuf_pool.pop() { None => RWIobuf::new(READBUF_SIZE), Some(v) => RWIobuf::from_vec(v), }; debug_assert!(ret.cap() == READBUF_SIZE); ret.set_limits_...
{ return RWIobuf::new(capacity); }
conditional_block
server.rs
//! A generic MIO server. use error::{MioResult, MioError}; use handler::Handler; use io::{Ready, IoHandle, IoReader, IoWriter, IoAcceptor}; use iobuf::{Iobuf, RWIobuf}; use reactor::Reactor; use socket::{TcpSocket, TcpAcceptor, SockAddr}; use std::cell::RefCell; use std::collections::{Deque, RingBuf}; use std::rc::Rc;...
(&mut self, reactor: &mut Reactor) -> MioResult<()> { match self.tick(reactor) { Ok(x) => Ok(x), Err(e) => { // We can't really use this. We already have an error! let _ = self.per_client.on_close(reactor, &mut self.state); Err(e) ...
checked_tick
identifier_name
instruments.rs
//! interfacing with the `instruments` command line tool use std::fmt::Write; use std::fs; use std::path::{Path, PathBuf}; use std::process::{Command, Output}; use anyhow::{anyhow, Result}; use cargo::core::Workspace; use semver::Version; use crate::opt::AppConfig; /// Holds available templates. pub struct Template...
() -> Result<TemplateCatalog> { let Output { status, stdout, stderr } = Command::new("xcrun").args(["xctrace", "list", "templates"]).output()?; if!status.success() { return Err(anyhow!( "Could not list templates. Please check your Xcode Instruments installation." )); } ...
parse_xctrace_template_list
identifier_name
instruments.rs
//! interfacing with the `instruments` command line tool use std::fmt::Write; use std::fs; use std::path::{Path, PathBuf}; use std::process::{Command, Output}; use anyhow::{anyhow, Result}; use cargo::core::Workspace; use semver::Version; use crate::opt::AppConfig; /// Holds available templates. pub struct Template...
Ok(trace_filepath) } /// get the tty of th current terminal session fn get_tty() -> Result<Option<String>> { let mut command = Command::new("ps"); command.arg("otty=").arg(std::process::id().to_string()); Ok(String::from_utf8(command.output()?.stdout)? .split_whitespace() .next() ...
{ let stderr = String::from_utf8(output.stderr).unwrap_or_else(|_| "failed to capture stderr".into()); let stdout = String::from_utf8(output.stdout).unwrap_or_else(|_| "failed to capture stdout".into()); return Err(anyhow!("instruments errored: {} {}", stderr, stdout)); ...
conditional_block
instruments.rs
//! interfacing with the `instruments` command line tool use std::fmt::Write; use std::fs; use std::path::{Path, PathBuf}; use std::process::{Command, Output}; use anyhow::{anyhow, Result}; use cargo::core::Workspace; use semver::Version; use crate::opt::AppConfig; /// Holds available templates. pub struct Template...
/// Return the template name abbreviation if available. fn abbrev_name(template_name: &str) -> Option<&str> { match template_name { "Time Profiler" => Some("time"), "Allocations" => Some("alloc"), "File Activity" => Some("io"), "System Trace" => Some("sys"), _ => None, ...
{ match template_name { "time" => "Time Profiler", "alloc" => "Allocations", "io" => "File Activity", "sys" => "System Trace", other => other, } }
identifier_body
instruments.rs
//! interfacing with the `instruments` command line tool use std::fmt::Write; use std::fs; use std::path::{Path, PathBuf}; use std::process::{Command, Output}; use anyhow::{anyhow, Result}; use cargo::core::Workspace; use semver::Version; use crate::opt::AppConfig; /// Holds available templates. pub struct Template...
"Time Profiler" => Some("time"), "Allocations" => Some("alloc"), "File Activity" => Some("io"), "System Trace" => Some("sys"), _ => None, } } /// Profile the target binary at `binary_filepath`, write results at /// `trace_filepath` and returns its path. pub(crate) fn profile...
/// Return the template name abbreviation if available. fn abbrev_name(template_name: &str) -> Option<&str> { match template_name {
random_line_split
a_fullscreen_wm.rs
//! Fullscreen Window Manager //! //! Implement the [`WindowManager`] trait by writing a simple window manager //! that displays every window fullscreen. When a new window is added, the //! last window that was visible will become invisible. //! //! [`WindowManager`]:../../cplwm_api/wm/trait.WindowManager.html //! //! ...
} /// Try this yourself fn get_screen(&self) -> Screen { self.screen } /// Try this yourself fn resize_screen(&mut self, screen: Screen) { self.screen = screen } } #[cfg(test)] mod a_fullscreen_wm_tests { include!("a_fullscreen_wm_tests.rs"); }
{ Err(FullscreenWMError::UnknownWindow(window)) }
conditional_block
a_fullscreen_wm.rs
//! Fullscreen Window Manager //! //! Implement the [`WindowManager`] trait by writing a simple window manager //! that displays every window fullscreen. When a new window is added, the //! last window that was visible will become invisible. //! //! [`WindowManager`]:../../cplwm_api/wm/trait.WindowManager.html //! //! ...
} /// Try this yourself fn cycle_focus(&mut self, dir: PrevOrNext) { // You will probably notice here that a `Vec` is not the ideal data // structure to implement this function. Feel free to replace the // `Vec` with another data structure. // Do nothing when there are no ...
{ // self.focused_window = window; match window { Some(i_window) => { match self.windows.iter().position(|w| *w == i_window) { None => Err(FullscreenWMError::UnknownWindow(i_window)), Some(i) => { // Set window t...
identifier_body
a_fullscreen_wm.rs
//! Fullscreen Window Manager //! //! Implement the [`WindowManager`] trait by writing a simple window manager //! that displays every window fullscreen. When a new window is added, the //! last window that was visible will become invisible. //! //! [`WindowManager`]:../../cplwm_api/wm/trait.WindowManager.html //! //! ...
/// For more information about why you need this, read the documentation of /// the associated [Error] type of the `WindowManager` trait. /// /// In the code below, we would like to return an error when we are asked to /// do something with a window that we do not manage, so we define an enum /// `FullscreenWMError` wi...
} /// The errors that this window manager can return. ///
random_line_split
a_fullscreen_wm.rs
//! Fullscreen Window Manager //! //! Implement the [`WindowManager`] trait by writing a simple window manager //! that displays every window fullscreen. When a new window is added, the //! last window that was visible will become invisible. //! //! [`WindowManager`]:../../cplwm_api/wm/trait.WindowManager.html //! //! ...
(&self) -> &'static str { match *self { FullscreenWMError::UnknownWindow(_) => "Unknown window", FullscreenWMError::WindowAlreadyManaged(_) => "Window Already Managed", } } } // Now we start implementing our window manager impl WindowManager for FullscreenWM { /// We use...
description
identifier_name
lib.rs
#[macro_use] extern crate include_dir; pub mod cosmogony; mod country_finder; pub mod file_format; mod hierarchy_builder; mod mutable_slice; pub mod zone; pub mod zone_typer; pub use crate::cosmogony::{Cosmogony, CosmogonyMetadata, CosmogonyStats}; use crate::country_finder::CountryFinder; use crate::file_format::Out...
pub fn build_cosmogony( pbf_path: String, with_geom: bool, country_code: Option<String>, ) -> Result<Cosmogony, Error> { let path = Path::new(&pbf_path); let file = File::open(&path).context("no pbf file")?; let mut parsed_pbf = OsmPbfReader::new(file); let (mut zones, mut stats) = if wi...
{ info!("creating ontology for {} zones", zones.len()); let inclusions = find_inclusions(zones); type_zones(zones, stats, country_code, &inclusions)?; build_hierarchy(zones, inclusions); zones.iter_mut().for_each(|z| z.compute_names()); compute_labels(zones); // we remove the useless zon...
identifier_body
lib.rs
#[macro_use] extern crate include_dir; pub mod cosmogony; mod country_finder; pub mod file_format; mod hierarchy_builder; mod mutable_slice; pub mod zone; pub mod zone_typer; pub use crate::cosmogony::{Cosmogony, CosmogonyMetadata, CosmogonyStats}; use crate::country_finder::CountryFinder; use crate::file_format::Out...
( reader: impl std::io::BufRead, format: OutputFormat, ) -> Result<Cosmogony, Error> { match format { OutputFormat::JsonGz => { let r = flate2::read::GzDecoder::new(reader); serde_json::from_reader(r).map_err(|e| failure::err_msg(e.to_string())) } OutputFormat...
load_cosmogony
identifier_name
lib.rs
#[macro_use] extern crate include_dir; pub mod cosmogony; mod country_finder; pub mod file_format; mod hierarchy_builder; mod mutable_slice; pub mod zone; pub mod zone_typer; pub use crate::cosmogony::{Cosmogony, CosmogonyMetadata, CosmogonyStats}; use crate::country_finder::CountryFinder; use crate::file_format::Out...
_ => false, } } pub fn get_zones_and_stats( pbf: &mut OsmPbfReader<File>, ) -> Result<(Vec<zone::Zone>, CosmogonyStats), Error> { info!("Reading pbf with geometries..."); let objects = pbf .get_objs_and_deps(|o| is_admin(o)) .context("invalid osm file")?; info!("reading pbf d...
{ rel.tags .get("boundary") .map_or(false, |v| v == "administrative") && rel.tags.get("admin_level").is_some() }
conditional_block
lib.rs
#[macro_use] extern crate include_dir; pub mod cosmogony; mod country_finder; pub mod file_format; mod hierarchy_builder; mod mutable_slice; pub mod zone; pub mod zone_typer; pub use crate::cosmogony::{Cosmogony, CosmogonyMetadata, CosmogonyStats}; use crate::country_finder::CountryFinder; use crate::file_format::Out...
} Ok((zones, stats)) } fn get_country_code<'a>( country_finder: &'a CountryFinder, zone: &zone::Zone, country_code: &'a Option<String>, inclusions: &Vec<ZoneIndex>, ) -> Option<String> { if let Some(ref c) = *country_code { Some(c.to_uppercase()) } else { country_finder...
random_line_split
main.rs
/* --- Day 12: Subterranean Sustainability --- The year 518 is significantly more underground than your history books implied. Either that, or you've arrived in a vast cavern network under the North Pole. After exploring a little, you discover a long tunnel that contains a row of small pots as far as you can see to ...
(state: &str) -> PlantsState { let mut result: PlantsState = state.chars().map(|x| x == '#').collect(); for _ in 0..OFFSET { result.insert(0, false); result.push(false); } result } fn get_id_for_combinations_map_item( combinations_map: &mut CombinationsMap, id: CombinationId, ch: char, ) -> Opt...
convert_state_str_to_vec
identifier_name
main.rs
/* --- Day 12: Subterranean Sustainability --- The year 518 is significantly more underground than your history books implied. Either that, or you've arrived in a vast cavern network under the North Pole. After exploring a little, you discover a long tunnel that contains a row of small pots as far as you can see to ...
let result = convert_state_str_to_vec("#..##"); let mut expected = vec![true, false, false, true, true]; for _ in 0..OFFSET { expected.insert(0, false); } for _ in 0..OFFSET { expected.push(false); } assert_eq!(result, expected) } #[test] fn test_convert_strs_to_combina...
.collect() } #[test] fn test_convert_state_str_to_vec() {
random_line_split
main.rs
/* --- Day 12: Subterranean Sustainability --- The year 518 is significantly more underground than your history books implied. Either that, or you've arrived in a vast cavern network under the North Pole. After exploring a little, you discover a long tunnel that contains a row of small pots as far as you can see to ...
new_state = get_new_state_after_n_generations(&mut new_state, &mut combinations_map, 1); sum = get_pots_with_plant_sum(&mut new_state) as i64; last_idx += 1; diff_a = sum - prev_sum; if diff_a!= 0 && diff_a == diff_b && diff_b == diff_c { break; } } sum + diff_a * (n_generations as ...
{ let mut sum: i64; let mut new_state: PlantsState = orig_state.clone(); let mut last_idx: i64 = 100; let mut diff_a = 0; let mut diff_b = 0; let mut diff_c; // the number 100 is a random high-enough number found empirically new_state = get_new_state_after_n_generations(&mut new_state, &mut combi...
identifier_body
main.rs
/* --- Day 12: Subterranean Sustainability --- The year 518 is significantly more underground than your history books implied. Either that, or you've arrived in a vast cavern network under the North Pole. After exploring a little, you discover a long tunnel that contains a row of small pots as far as you can see to ...
else { PotState::Empty }; combinations_map.insert( prev_combination_id.unwrap(), Combination::Node(node_content), ); } combinations_map } fn get_result_for_combination_vec( combinations_map: &mut CombinationsMap, combination_vec: &mut PlantsState, ) -> Option<PotState> { let ...
{ PotState::HasPlant }
conditional_block
fetch.rs
use crate::{cargo::Source, util, Krate}; use anyhow::{Context, Error}; use bytes::Bytes; use reqwest::Client; use std::path::Path; use tracing::{error, warn}; use tracing_futures::Instrument; pub(crate) enum KrateSource { Registry(Bytes), Git(crate::git::GitSource), } impl KrateSource { pub(crate) fn len(...
Ok(()) }) .instrument(tracing::debug_span!("fetch")) .await??; let fetch_rev = rev.to_owned(); let temp_db_path = temp_dir.path().to_owned(); let checkout = tokio::task::spawn(async move { match crate::git::prepare_submodules( temp_db_path, submodule_dir.pa...
repo.revparse_single(&fetch_rev) .with_context(|| format!("{} doesn't contain rev '{}'", fetch_url, fetch_rev))?;
random_line_split
fetch.rs
use crate::{cargo::Source, util, Krate}; use anyhow::{Context, Error}; use bytes::Bytes; use reqwest::Client; use std::path::Path; use tracing::{error, warn}; use tracing_futures::Instrument; pub(crate) enum KrateSource { Registry(Bytes), Git(crate::git::GitSource), } impl KrateSource { pub(crate) fn len(...
crate::git::with_fetch_options(&git_config, &url, &mut |mut opts| { repo.remote_anonymous(&url)? .fetch( &[ "refs/heads/master:refs/remotes/origin/master", "HEAD:refs/remotes/origin/HEAD", ], ...
{ // We don't bother to suport older versions of cargo that don't support // bare checkouts of registry indexes, as that has been in since early 2017 // See https://github.com/rust-lang/cargo/blob/0e38712d4d7b346747bf91fb26cce8df6934e178/src/cargo/sources/registry/remote.rs#L61 // for details on why car...
identifier_body
fetch.rs
use crate::{cargo::Source, util, Krate}; use anyhow::{Context, Error}; use bytes::Bytes; use reqwest::Client; use std::path::Path; use tracing::{error, warn}; use tracing_futures::Instrument; pub(crate) enum KrateSource { Registry(Bytes), Git(crate::git::GitSource), } impl KrateSource { pub(crate) fn len(...
(client: &Client, krate: &Krate) -> Result<KrateSource, Error> { async { match &krate.source { Source::Git { url, rev,.. } => via_git(&url.clone(), rev).await.map(KrateSource::Git), Source::Registry { registry, chksum } => { let url = registry.download_url(krate); ...
from_registry
identifier_name
retransmission.rs
//! Retransmission is covered in section 6.3 of RFC 4960. //! //! 1. Perform round-trip time (RTT) measurements from the time a TSN is sent until it is //! acknowledged. //! a) A measurement must be made once per round-trip, but no more. I interpret this to mean //! that only one measurement may be in prog...
if let Some(rtx_chunk) = rtx_chunk { // Re-transmit chunk println!("re-sending chunk: {:?}", rtx_chunk); association.send_chunk(Chunk::Data(rtx_chunk)); // E4) Restart timer association.rtx.timer = Some( association .resources .timer...
let rtx_chunk = association.data.sent_queue.front().map(|c| c.clone());
random_line_split
retransmission.rs
//! Retransmission is covered in section 6.3 of RFC 4960. //! //! 1. Perform round-trip time (RTT) measurements from the time a TSN is sent until it is //! acknowledged. //! a) A measurement must be made once per round-trip, but no more. I interpret this to mean //! that only one measurement may be in prog...
/// "Mark" all unacknowledged packets for retransmission. #[allow(unused)] fn retransmit_all(association: &mut Association) { // Re-queue unacknowledged chunks let bytes = association .data .sent_queue .transfer_all(&mut association.data.send_queue); // Window accounting: Increase the...
{ // TODO: Don't retransmit chunks that were acknowledged in the gap-ack blocks of the most // recent SACK. // Re-queue unacknowledged chunks in the specified range. let bytes = association .data .sent_queue .transfer_range(&mut association.data.send_queue, f...
identifier_body
retransmission.rs
//! Retransmission is covered in section 6.3 of RFC 4960. //! //! 1. Perform round-trip time (RTT) measurements from the time a TSN is sent until it is //! acknowledged. //! a) A measurement must be made once per round-trip, but no more. I interpret this to mean //! that only one measurement may be in prog...
(&mut self) { // We have received acknowledgement of the receipt of the measurement TSN, so calculate the // RTT and related variables. let (_, rtt_start) = self.rtt_measurement.take().unwrap(); // Caller verifies Some(_). let rtt = rtt_start.elapsed(); let min = Duration::from_...
complete_rtt_measurement
identifier_name
file.rs
let proc = self.linux_process(); let file_like = proc.get_file_like(fd)?; let mut buf = vec![0u8; len]; let len = file_like.read(&mut buf).await?; base.write_array(&buf[..len])?; Ok(len) } /// Writes to a specified file using a file descriptor. Before using this call, ...
: UserInPtr<u8>, len: usize) -> SysResult { let path = path.as_c_str()?; info!("truncate: path={:?}, len={}", path, len); self.linux_process().lookup_inode(path)?.resize(len)?; Ok(0) } /// cause the regular file referenced by fd to be truncated to a size of precisely length byte...
(&self, path
identifier_name
file.rs
let proc = self.linux_process(); let file_like = proc.get_file_like(fd)?; let mut buf = vec![0u8; len]; let len = file_like.read(&mut buf).await?; base.write_array(&buf[..len])?; Ok(len) } /// Writes to a specified file using a file descriptor. Before using this call, ...
let mut bytes_written = 0; let mut rlen = read_len; while bytes_written < read_len { let write_len = out_file.write(&buffer[bytes_written..(bytes_written + rlen)])?; if write_len == 0 { info!( "copy_file_rang...
random_line_split
file.rs
proc = self.linux_process(); let file_like = proc.get_file_like(fd)?; let mut buf = vec![0u8; len]; let len = file_like.read(&mut buf).await?; base.write_array(&buf[..len])?; Ok(len) } /// Writes to a specified file using a file descriptor. Before using this call, /...
use the regular file referenced by fd to be truncated to a size of precisely length bytes. pub fn sys_ftruncate(&self, fd: FileDesc, len: usize) -> SysResult { info!("ftruncate: fd={:?}, len={}", fd, len); let proc = self.linux_process(); proc.get_file(fd)?.set_len(len as u64)?; Ok(0...
t path = path.as_c_str()?; info!("truncate: path={:?}, len={}", path, len); self.linux_process().lookup_inode(path)?.resize(len)?; Ok(0) } /// ca
identifier_body
file.rs
let proc = self.linux_process(); let file_like = proc.get_file_like(fd)?; let mut buf = vec![0u8; len]; let len = file_like.read(&mut buf).await?; base.write_array(&buf[..len])?; Ok(len) } /// Writes to a specified file using a file descriptor. Before using this call, ...
flags -= OpenFlags::CLOEXEC; } file_like.set_flags(flags)?; Ok(0) } FcntlCmd::GETFL => Ok(file_like.flags().bits()), FcntlCmd::SETFL => { file_like.set_flags(OpenFlags::from_bi...
flags |= OpenFlags::CLOEXEC; } else {
conditional_block
tokens.rs
use crate::protocol::input_source::{ InputPosition as InputPosition, InputSpan }; /// Represents a particular kind of token. Some tokens represent /// variable-character tokens. Such a token is always followed by a /// `TokenKind::SpanEnd` token. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pu...
LessEquals, // <= ShiftRight, // >> GreaterEquals, // >= // Operator-like (three characters) ShiftLeftEquals,// <<= ShiftRightEquals, // >>= // Special marker token to indicate end of variable-character tokens SpanEnd, } impl TokenKind { /// Returns true if the next expecte...
OrEquals, // |= EqualEqual, // == NotEqual, // != ShiftLeft, // <<
random_line_split
tokens.rs
use crate::protocol::input_source::{ InputPosition as InputPosition, InputSpan }; /// Represents a particular kind of token. Some tokens represent /// variable-character tokens. Such a token is always followed by a /// `TokenKind::SpanEnd` token. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pu...
<'a> { tokens: &'a Vec<Token>, cur: usize, end: usize, } impl<'a> TokenIter<'a> { fn new(buffer: &'a TokenBuffer, start: usize, end: usize) -> Self { Self{ tokens: &buffer.tokens, cur: start, end } } /// Returns the next token (may include comments), or `None` if at the end /// of ...
TokenIter
identifier_name
tokens.rs
use crate::protocol::input_source::{ InputPosition as InputPosition, InputSpan }; /// Represents a particular kind of token. Some tokens represent /// variable-character tokens. Such a token is always followed by a /// `TokenKind::SpanEnd` token. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pu...
/// See `next_positions` pub(crate) fn next_span(&self) -> InputSpan { let (begin, end) = self.next_positions(); return InputSpan::from_positions(begin, end) } /// Advances the iterator to the next (meaningful) token. pub(crate) fn consume(&mut self) { if let Some(kind) = ...
{ debug_assert!(self.cur < self.end); let token = &self.tokens[self.cur]; if token.kind.has_span_end() { let span_end = &self.tokens[self.cur + 1]; debug_assert_eq!(span_end.kind, TokenKind::SpanEnd); (token.pos, span_end.pos) } else { let ...
identifier_body
tokens.rs
use crate::protocol::input_source::{ InputPosition as InputPosition, InputSpan }; /// Represents a particular kind of token. Some tokens represent /// variable-character tokens. Such a token is always followed by a /// `TokenKind::SpanEnd` token. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pu...
} } /// Saves the current iteration position, may be passed to `load` to return /// the iterator to a previous position. pub(crate) fn save(&self) -> (usize, usize) { (self.cur, self.end) } pub(crate) fn load(&mut self, saved: (usize, usize)) { self.cur = saved.0; ...
{ self.cur += 1; }
conditional_block
value_stability.rs
// Copyright 2018 Developers of the Rand project. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed /...
() { // Gamma has 3 cases: shape == 1, shape < 1, shape > 1 test_samples(223, Gamma::new(1.0, 5.0).unwrap(), &[ 5.398085f32, 9.162783, 0.2300583, 1.7235851, ]); test_samples(223, Gamma::new(0.8, 5.0).unwrap(), &[ 0.5051203f32, 0.9048302, 3.095812, 1.8566116, ]); test_samples(223,...
gamma_stability
identifier_name
value_stability.rs
// Copyright 2018 Developers of the Rand project. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed /...
0.47912589330631555, 0.25323238071138526, ]); test_samples(223, Beta::new(3.0, 1.2).unwrap(), &[ 0.49563509121756827, 0.9551305482256759, 0.5151181353461637, 0.7551732971235077, ]); } #[test] fn exponential_stability() { test_samples(223, Exp1, &[ ...
0.8134131062097899,
random_line_split
value_stability.rs
// Copyright 2018 Developers of the Rand project. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed /...
} impl<T: ApproxEq> ApproxEq for [T; 3] { fn assert_almost_eq(&self, rhs: &Self) { self[0].assert_almost_eq(&rhs[0]); self[1].assert_almost_eq(&rhs[1]); self[2].assert_almost_eq(&rhs[2]); } } fn test_samples<F: Debug + ApproxEq, D: Distribution<F>>( seed: u64, distr: D, expected: &...
{ self[0].assert_almost_eq(&rhs[0]); self[1].assert_almost_eq(&rhs[1]); }
identifier_body
text_layout_engine.rs
#![allow(dead_code)] // XXX: should be no harfbuzz in the interface use crate::node::NativeWord; use crate::xetex_font_info::{GlyphBBox, XeTeXFontInst}; //use crate::xetex_font_manager::PlatformFontRef; use crate::cmd::XetexExtCmd; use crate::xetex_font_info::GlyphID; use crate::xetex_layout_interface::FixedPoint; use...
false } /// Not sure what AAT should return, since this is only called with random casts to /// XeTeXLayoutENgine in xetex0. fn using_open_type(&self) -> bool { false } unsafe fn is_open_type_math_font(&self) -> bool { false } } /* trait GraphiteFontSomething { ...
/// Only relevant if this engine actually uses graphite, hence default impl of { false } unsafe fn initGraphiteBreaking(&mut self, _txt: &[u16]) -> bool {
random_line_split
text_layout_engine.rs
#![allow(dead_code)] // XXX: should be no harfbuzz in the interface use crate::node::NativeWord; use crate::xetex_font_info::{GlyphBBox, XeTeXFontInst}; //use crate::xetex_font_manager::PlatformFontRef; use crate::cmd::XetexExtCmd; use crate::xetex_font_info::GlyphID; use crate::xetex_layout_interface::FixedPoint; use...
pub fn from_int(i: i32) -> Option<Self> { Some(match i { 1 => GlyphEdge::Left, 2 => GlyphEdge::Top, 3 => GlyphEdge::Right, 4 => GlyphEdge::Bottom, _ => return None, }) } } #[enum_dispatch::enum_dispatch] pub(crate) enum NativeFont { ...
{ match *self { GlyphEdge::Left | GlyphEdge::Top => options.0, GlyphEdge::Right | GlyphEdge::Bottom => options.1, } }
identifier_body
text_layout_engine.rs
#![allow(dead_code)] // XXX: should be no harfbuzz in the interface use crate::node::NativeWord; use crate::xetex_font_info::{GlyphBBox, XeTeXFontInst}; //use crate::xetex_font_manager::PlatformFontRef; use crate::cmd::XetexExtCmd; use crate::xetex_font_info::GlyphID; use crate::xetex_layout_interface::FixedPoint; use...
(node: &'a NativeWord, justify: bool) -> LayoutRequest<'a> { use crate::xetex_ini::FONT_LETTER_SPACE; let text = node.text(); let line_width = node.width(); let f = node.font() as usize; let letter_space_unit = FONT_LETTER_SPACE[f]; LayoutRequest { text, ...
from_node
identifier_name
server.rs
use crate::api::pos_grpc_service::PosGrpcService; use crate::{DEFAULT_BITS_PER_INDEX, DEFAULT_INDEXES_PER_CYCLE, DEFAULT_SALT}; use anyhow::{bail, Result}; use pos_api::api::job::JobStatus; use pos_api::api::pos_data_service_server::PosDataServiceServer; use pos_api::api::{ AbortJobRequest, AddJobRequest, Config, J...
impl Handler<AddJob> for PosServer { async fn handle(&mut self, _ctx: &mut Context<Self>, msg: AddJob) -> Result<Job> { let data = msg.0; let job = Job { id: rand::random(), bits_written: 0, size_bits: data.post_size_bits, started: 0, subm...
random_line_split
server.rs
use crate::api::pos_grpc_service::PosGrpcService; use crate::{DEFAULT_BITS_PER_INDEX, DEFAULT_INDEXES_PER_CYCLE, DEFAULT_SALT}; use anyhow::{bail, Result}; use pos_api::api::job::JobStatus; use pos_api::api::pos_data_service_server::PosDataServiceServer; use pos_api::api::{ AbortJobRequest, AddJobRequest, Config, J...
self.jobs.remove(&req.id); } Ok(()) } } #[message(result = "Result<()>")] pub(crate) struct SetConfig(pub(crate) Config); /// Set the pos compute config #[async_trait::async_trait] impl Handler<SetConfig> for PosServer { async fn handle(&mut self, _ctx: &mut Context<Self>, msg: S...
{ self.pending_jobs.remove(idx); }
conditional_block
server.rs
use crate::api::pos_grpc_service::PosGrpcService; use crate::{DEFAULT_BITS_PER_INDEX, DEFAULT_INDEXES_PER_CYCLE, DEFAULT_SALT}; use anyhow::{bail, Result}; use pos_api::api::job::JobStatus; use pos_api::api::pos_data_service_server::PosDataServiceServer; use pos_api::api::{ AbortJobRequest, AddJobRequest, Config, J...
(&mut self, _ctx: &mut Context<Self>) { info!("PosServer system service stopped"); } } impl Service for PosServer {} impl Default for PosServer { fn default() -> Self { PosServer { providers: vec![], pending_jobs: vec![], jobs: Default::default(), ...
stopped
identifier_name
server.rs
use crate::api::pos_grpc_service::PosGrpcService; use crate::{DEFAULT_BITS_PER_INDEX, DEFAULT_INDEXES_PER_CYCLE, DEFAULT_SALT}; use anyhow::{bail, Result}; use pos_api::api::job::JobStatus; use pos_api::api::pos_data_service_server::PosDataServiceServer; use pos_api::api::{ AbortJobRequest, AddJobRequest, Config, J...
} ///////////////////////////////////////////// #[message(result = "Result<()>")] pub(crate) struct StartGrpcService { pub(crate) port: u32, pub(crate) host: String, } #[async_trait::async_trait] impl Handler<StartGrpcService> for PosServer { async fn handle(&mut self, _ctx: &mut Context<Self>, msg: Star...
{ // create channel for streaming job statuses let (tx, rx) = mpsc::channel(32); // store the sender indexed by a new unique id self.job_status_subscribers.insert(rand::random(), tx); // return the receiver Ok(ReceiverStream::new(rx)) }
identifier_body
mod.rs
use self::constants::*; use super::*; mod creature; mod rock; pub use self::creature::*; pub use self::rock::*; use std::cell::{Ref, RefMut}; #[cfg(multithreading)] type ReferenceCounter = std::sync::Arc; #[cfg(not(multithreading))] type ReferenceCounter<A> = std::rc::Rc<A>; #[cfg(multithreading)] type MutPoint = s...
impl<B: Intentions> HLSoftBody<B> { fn wants_primary_birth(&self, time: f64) -> bool { let temp = self.borrow(); temp.get_energy() > SAFE_SIZE && temp.brain.wants_birth() > 0.0 && temp.get_age(time) > MATURE_AGE } } impl<B: NeuralNet + Intentions + RecombinationInfinite...
random_line_split
mod.rs
use self::constants::*; use super::*; mod creature; mod rock; pub use self::creature::*; pub use self::rock::*; use std::cell::{Ref, RefMut}; #[cfg(multithreading)] type ReferenceCounter = std::sync::Arc; #[cfg(not(multithreading))] type ReferenceCounter<A> = std::rc::Rc<A>; #[cfg(multithreading)] type MutPoint = s...
} impl<B> Clone for HLSoftBody<B> { fn clone(&self) -> Self { HLSoftBody(ReferenceCounter::clone(&self.0)) } } impl<B> PartialEq<HLSoftBody<B>> for HLSoftBody<B> { fn eq(&self, rhs: &HLSoftBody<B>) -> bool { ReferenceCounter::ptr_eq(&self.0, &rhs.0) } } impl<B> HLSoftBody<B> { //...
{ HLSoftBody(ReferenceCounter::new(MutPoint::new(sb))) }
identifier_body
mod.rs
use self::constants::*; use super::*; mod creature; mod rock; pub use self::creature::*; pub use self::rock::*; use std::cell::{Ref, RefMut}; #[cfg(multithreading)] type ReferenceCounter = std::sync::Arc; #[cfg(not(multithreading))] type ReferenceCounter<A> = std::rc::Rc<A>; #[cfg(multithreading)] type MutPoint = s...
} } /// This function requires a reference to a `Board`. /// This is usually impossible so you'll have to turn to `unsafe`. pub fn return_to_earth( &mut self, time: f64, board_size: BoardSize, terrain: &mut Terrain, climate: &Climate, sbip: &mut ...
{ let force = combined_radius * COLLISION_FORCE; let add_vx = (self_px - collider_px) / distance * force / self_mass; let add_vy = (self_py - collider_py) / distance * force / self_mass; // This is where self is needed to be borrowed mutably. ...
conditional_block
mod.rs
use self::constants::*; use super::*; mod creature; mod rock; pub use self::creature::*; pub use self::rock::*; use std::cell::{Ref, RefMut}; #[cfg(multithreading)] type ReferenceCounter = std::sync::Arc; #[cfg(not(multithreading))] type ReferenceCounter<A> = std::rc::Rc<A>; #[cfg(multithreading)] type MutPoint = s...
<B = Brain>(ReferenceCounter<MutPoint<SoftBody<B>>>); impl<B> From<SoftBody<B>> for HLSoftBody<B> { fn from(sb: SoftBody<B>) -> HLSoftBody<B> { HLSoftBody(ReferenceCounter::new(MutPoint::new(sb))) } } impl<B> Clone for HLSoftBody<B> { fn clone(&self) -> Self { HLSoftBody(ReferenceCounter::...
HLSoftBody
identifier_name
calendar.rs
use crate::{FloatNum, Int}; use std::ops::Rem; #[derive(Clone)] pub struct Calendar { pub mondays: [Int; 13], pub mona365: [Int; 13], pub monaccu: [Int; 13], pub ny400d: Int, pub ny100d: Int, pub ny004d: Int, pub ny001d: Int, pub nud: Int, // TODO? // These values are copied f...
// kstep ! time step since simulation start // ktspd ! time steps per day // kdatim(7)! year,month,day,hour,min,weekday,leapyear fn step2cal(kstep: Int, ktspd: Int, kdatim: &mut [Int; 7], mut cal: &mut Calendar) { let mut iyea: Int; // current year of simulation let mut imon: Int; // current month of...
{ let mut idatim = [0; 7]; if cal.n_days_per_year == 365 { step2cal(kstep, cal.ntspd, &mut idatim, cal); return idatim[2] + cal.monaccu[idatim[1] as usize - 1]; } else { step2cal30(kstep, cal.ntspd, &mut idatim, cal); return idatim[2] + cal.n_days_per_month * (idatim[1] - 1)...
identifier_body
calendar.rs
use crate::{FloatNum, Int}; use std::ops::Rem; #[derive(Clone)] pub struct Calendar { pub mondays: [Int; 13], pub mona365: [Int; 13], pub monaccu: [Int; 13], pub ny400d: Int, pub ny100d: Int, pub ny004d: Int, pub ny001d: Int, pub nud: Int, // TODO? // These values are copied f...
else { // century year is not leap year iy100 = (id400 - 1) / cal.ny100d; // century in segment [1,2,3] id100 = (id400 - 1).rem(cal.ny100d); if id100 < cal.ny004d - 1 { iy004 = 0; // tetrade in century [0] id004 = id100; leap = false; iy0...
{ // century year is leap year iy100 = 0; // century in segment [0] id100 = id400; iy004 = id100 / cal.ny004d; // tetrade in century [0..24] id004 = id100.rem(cal.ny004d); leap = id004 <= cal.ny001d; if leap { iy001 = 0; // year in tetrade [0] ...
conditional_block
calendar.rs
use crate::{FloatNum, Int}; use std::ops::Rem; #[derive(Clone)] pub struct Calendar { pub mondays: [Int; 13], pub mona365: [Int; 13], pub monaccu: [Int; 13], pub ny400d: Int, pub ny100d: Int, pub ny004d: Int, pub ny001d: Int, pub nud: Int, // TODO? // These values are copied f...
( ktspd: Int, // time steps per day kyea: Int, // current year of simulation kmon: Int, // current month of simulation kday: Int, // current day of simulation khou: Int, // current hour of simulation kmin: Int, // current minute of simul...
cal2step
identifier_name
calendar.rs
use crate::{FloatNum, Int}; use std::ops::Rem; #[derive(Clone)] pub struct Calendar { pub mondays: [Int; 13], pub mona365: [Int; 13], pub monaccu: [Int; 13], pub ny400d: Int, pub ny100d: Int, pub ny004d: Int, pub ny001d: Int, pub nud: Int, // TODO? // These values are copied f...
n_days_per_year: 360, n_start_step: 0, ntspd: 1, solar_day: 86400.0, // sec } } } fn yday2mmdd(cal: &Calendar, mut kyday: &mut Int, mut kmon: &mut Int, mut kday: &mut Int) { if cal.n_days_per_year == 365 { *kmon = 1; while *kyday > cal.mon...
ny001d: 365, nud: 6, n_days_per_month: 30,
random_line_split
wsr98d_reader.rs
use crate::MetError; use crate::STRadialData; use binread::prelude::*; use chrono::NaiveDateTime; use encoding_rs::*; use std::cmp::PartialEq; use std::collections::HashMap; use std::io::Cursor; const DATA_TYPE: [&'static str; 37] = [ "dBT", "dBZ", "V", "W", "SQI", "CPA", "ZDR", "LDR", "CC", "PDP", "KDP", "CP", "R...
// println!("{:?}",own_data); dt_data.insert(ddd.data_type.clone(), own_data); } let key = dd.elev_num; let el = cut_infos[dd.elev_num as usize - 1].elev; if!el_az_dt_data.contains_key(&key) { el_az_dt_data.insert(key, vec![(el, dd.az, dt_data)]); ...
/ // let print_data: Vec<&f32> = // // own_data.iter().filter(|d| d != &&crate::MISSING).collect(); // println!( // "{:?} {:?} {:?} {:?} ", // dd.el, // dd.az, // ddd.data_type.clone(), ...
conditional_block
wsr98d_reader.rs
use crate::MetError; use crate::STRadialData; use binread::prelude::*; use chrono::NaiveDateTime; use encoding_rs::*; use std::cmp::PartialEq; use std::collections::HashMap; use std::io::Cursor; const DATA_TYPE: [&'static str; 37] = [ "dBT", "dBZ", "V", "W", "SQI", "CPA", "ZDR", "LDR", "CC", "PDP", "KDP", "CP", "R...
let longtitude = h.longtitude; let antena_height = h.antena_height; let ground_height = h.ground_height; let h: TaskInfo = cursor.read_le()?; let start_date = h.start_date.clone(); let start_time = h.start_time.clone(); // dbg!(&h); let cut_num = h.cut_num; ...
ude;
identifier_name
wsr98d_reader.rs
use crate::MetError; use crate::STRadialData; use binread::prelude::*; use chrono::NaiveDateTime; use encoding_rs::*; use std::cmp::PartialEq; use std::collections::HashMap; use std::io::Cursor; const DATA_TYPE: [&'static str; 37] = [ "dBT", "dBZ", "V", "W", "SQI", "CPA", "ZDR", "LDR", "CC", "PDP", "KDP", "CP", "R...
.iter() .map(|v| { if *v < 5 { return crate::MISSING; } (*v as f32 - offset as f32) / scale as f32 // *v as f32 }) .col...
}) .collect(); } else { own_data = dt_slice
random_line_split
buffer_geometry.rs
extern crate uuid; extern crate heck; extern crate specs; use self::uuid::Uuid; use self::heck::ShoutySnakeCase; use std::vec::Vec; use std::fmt; use std::sync::{Arc,Mutex, LockResult, MutexGuard}; use std::mem; use std::error::Error; use self::specs::{Component, VecStorage}; use math::{ Vector, Vector2, Vector3...
(&self) -> usize { let l = self.len(); l / self.item_size() } pub fn item_size(&self) -> usize { self.data.item_size() } pub fn len(&self) -> usize { self.data.len() } pub fn set_normalized(&mut self, normalized: bool) -> &mut Self { self.normalized = normalized; self } pub fn set_dynamic(&mut s...
count
identifier_name
buffer_geometry.rs
extern crate uuid; extern crate heck; extern crate specs; use self::uuid::Uuid; use self::heck::ShoutySnakeCase; use std::vec::Vec; use std::fmt; use std::sync::{Arc,Mutex, LockResult, MutexGuard}; use std::mem; use std::error::Error; use self::specs::{Component, VecStorage}; use math::{ Vector, Vector2, Vector3...
} #[allow(dead_code)] #[derive(Hash, Eq, PartialEq, Debug, Clone)] pub struct BufferGroup { pub start: usize, pub material_index: usize, pub count: usize, pub name: Option<String>, } #[allow(dead_code)] #[derive(Clone)] pub struct BufferGeometry { pub uuid: Uuid, pub name: String, pub groups: Vec<BufferGroup>...
{ format!("VERTEX_{}_{}", self.buffer_type.definition(), self.data.definition()) }
identifier_body
buffer_geometry.rs
extern crate uuid; extern crate heck; extern crate specs; use self::uuid::Uuid; use self::heck::ShoutySnakeCase; use std::vec::Vec; use std::fmt; use std::sync::{Arc,Mutex, LockResult, MutexGuard}; use std::mem; use std::error::Error; use self::specs::{Component, VecStorage}; use math::{ Vector, Vector2, Vector3...
#[derive(Clone, Debug, Eq, PartialEq)] pub enum BufferType { Position, Normal, Tangent, UV(usize), Color(usize), Joint(usize), Weight(usize), Other(String), } impl BufferType { pub fn definition(&self) -> String { match self { BufferType::Position => "POSITION".to_string(), BufferType::Normal => "NO...
} }
random_line_split
span.rs
use crate::{ buffer::{ cell_buffer::{Contacts, Endorse}, fragment_buffer::FragmentSpan, FragmentBuffer, Property, PropertyBuffer, StringBuffer, }, fragment, fragment::Circle, map::{circle_map, UNICODE_FRAGMENTS}, Cell, Fragment, Merge, Point, Settings, }; use itertools::I...
/// merge as is without checking it it can pub fn merge_no_check(&self, other: &Self) -> Self { let mut cells = self.0.clone(); cells.extend(&other.0); Span(cells) } } impl Merge for Span { fn merge(&self, other: &Self) -> Option<Self> { if self.can_merge(other) { ...
{ self.iter().any(|(cell, ch)| *cell == needle) }
identifier_body
span.rs
use crate::{ buffer::{ cell_buffer::{Contacts, Endorse}, fragment_buffer::FragmentSpan, FragmentBuffer, Property, PropertyBuffer, StringBuffer, }, fragment, fragment::Circle, map::{circle_map, UNICODE_FRAGMENTS}, Cell, Fragment, Merge, Point, Settings, }; use itertools::I...
} } impl Bounds { pub fn new(cell1: Cell, cell2: Cell) -> Self { let (top_left, bottom_right) = Cell::rearrange_bound(cell1, cell2); Self { top_left, bottom_right, } } pub fn top_left(&self) -> Cell { self.top_left } pub fn bottom_right...
{ None }
conditional_block
span.rs
use crate::{ buffer::{ cell_buffer::{Contacts, Endorse}, fragment_buffer::FragmentSpan, FragmentBuffer, Property, PropertyBuffer, StringBuffer, }, fragment, fragment::Circle, map::{circle_map, UNICODE_FRAGMENTS}, Cell, Fragment, Merge, Point, Settings, }; use itertools::I...
(&self) -> Cell { Cell::new(self.top_left.x, self.bottom_right.y) } } /// create a property buffer for all the cells of this span impl<'p> From<Span> for PropertyBuffer<'p> { fn from(span: Span) -> Self { let mut pb = PropertyBuffer::new(); for (cell, ch) in span.iter() { if...
bottom_left
identifier_name
span.rs
use crate::{ buffer::{ cell_buffer::{Contacts, Endorse}, fragment_buffer::FragmentSpan, FragmentBuffer, Property, PropertyBuffer, StringBuffer, }, fragment, fragment::Circle, map::{circle_map, UNICODE_FRAGMENTS}, Cell, Fragment, Merge, Point, Settings, }; use itertools::I...
accepted, rejects: vec![], }; endorsed.extend(re_endorsed); endorsed } /// re try endorsing the contacts into arc and circles by converting it to span first fn re_endorse(rect_rejects: Vec<Contacts>) -> Endorse<FragmentSpan, Span> { // convert back to...
let re_endorsed = Self::re_endorse(rect_endorsed.rejects); let mut endorsed = Endorse {
random_line_split
observing.rs
use std::ffi::CStr; use std::mem; use libc::c_void; use crate::bw; use crate::bw_1161::{self, vars}; pub unsafe fn process_commands_hook( data: *const u8, len: u32, replay: u32, orig: unsafe extern fn(*const u8, u32, u32), ) { if replay == 0 && *vars::current_command_player >= 8 { // Repl...
// To make observers appear in network timeout dialog, we temporarily write their info to // ingame player structure, and revert the change after this function has been called. let bw_players: &mut [bw::Player] = &mut vars::players[..8]; let actual_players: [bw::Player; 8] = { let mut players:...
{ if (*vars::timeout_bin).is_null() { return None; } let mut label = find_dialog_child(*vars::timeout_bin, -10)?; let mut label_count = 0; while !label.is_null() && label_count < 8 { // Flag 0x8 == Shown if (*label).flags & 0x8 != 0 && (*label)...
identifier_body
observing.rs
use std::ffi::CStr; use std::mem; use libc::c_void; use crate::bw; use crate::bw_1161::{self, vars}; pub unsafe fn process_commands_hook( data: *const u8, len: u32, replay: u32, orig: unsafe extern fn(*const u8, u32, u32), ) { if replay == 0 && *vars::current_command_player >= 8 { // Repl...
( storm_player: u32, message: *const u8, length: u32, orig: unsafe extern fn(u32, *const u8, u32) -> u32, ) -> u32 { use std::io::Write; if vars::storm_id_to_human_id[storm_player as usize] >= 8 { // Observer message, we'll have to manually print text and add to replay recording. ...
chat_message_hook
identifier_name
observing.rs
use std::ffi::CStr; use std::mem; use libc::c_void; use crate::bw; use crate::bw_1161::{self, vars}; pub unsafe fn process_commands_hook( data: *const u8, len: u32, replay: u32, orig: unsafe extern fn(*const u8, u32, u32), ) { if replay == 0 && *vars::current_command_player >= 8 { // Repl...
unsafe fn is_local_player_observer() -> bool { // Should probs use shieldbattery's data instead of checking BW variables, // but we don't have anything that's readily accessible by game thread. *vars::local_nation_id ==!0 } pub unsafe fn with_replay_flag_if_obs<F: FnOnce() -> R, R>(func: F) -> R { let ...
} None }
random_line_split
observing.rs
use std::ffi::CStr; use std::mem; use libc::c_void; use crate::bw; use crate::bw_1161::{self, vars}; pub unsafe fn process_commands_hook( data: *const u8, len: u32, replay: u32, orig: unsafe extern fn(*const u8, u32, u32), ) { if replay == 0 && *vars::current_command_player >= 8 { // Repl...
} } for (i, player) in actual_players.iter().enumerate() { vars::players[i] = player.clone(); } } pub unsafe fn update_command_card_hook(orig: unsafe extern fn()) { if is_local_player_observer() &&!(*vars::primary_selected).is_null() { *vars::local_nation_id = (**vars::primary_...
{ // We need to redirect the name string to the storm player string, and replace the // player value to unused player 10, whose color will be set to neutral resource // color. (The neutral player 11 actually can have a different color for neutral // buildi...
conditional_block
uint.rs
let v = (self.value[i] as u64) + (rhs.value[i] as u64) + carry; self.value[i] = v as u32; carry = v >> 32; } assert_eq!(carry, 0); } fn sub(&self, rhs: &Self) -> Self { let mut out = self.clone(); out.sub_assign(rhs); out } /// It...
{ out = Ordering::Equal; }
conditional_block
uint.rs
from_be_bytes(*array_ref![ data, data.len() - (BASE_BYTES * (i + 1)), BASE_BYTES ]); } let rem = data.len() % BASE_BYTES; if rem!= 0 { let mut rest = [0u8; BASE_BYTES]; rest[(BASE_BYTES - rem)..].copy_from_slice...
{ for v in self.value.iter_mut() { *v = 0; } }
identifier_body
uint.rs
for i in 0..(data.len() / BASE_BYTES) { out.value[i] = BaseType::from_be_bytes(*array_ref![ data, data.len() - (BASE_BYTES * (i + 1)), BASE_BYTES ]); } let rem = data.len() % BASE_BYTES; if rem!= 0 { let ...
reduced.copy_if(!overflow, self); self.truncate(modulus.bit_width()); } #[must_use] pub fn shl(&mut self) -> BaseType { let mut carry = 0; for v in self.value.iter_mut() { let (new_v, _) = v.overflowing_shl(1); let new_carry = *v >> 31; *v...
/// /// Will panic if 'self' was >= 2*modulus pub fn reduce_once(&mut self, modulus: &Self) { let mut reduced = Self::from_usize(0, self.bit_width()); let overflow = self.overflowing_sub_to(modulus, &mut reduced);
random_line_split
uint.rs
for i in 0..(data.len() / BASE_BYTES) { out.value[i] = BaseType::from_be_bytes(*array_ref![ data, data.len() - (BASE_BYTES * (i + 1)), BASE_BYTES ]); } let rem = data.len() % BASE_BYTES; if rem!= 0 { let m...
(&mut self, n: usize) { let byte_shift = n / BASE_BITS; let carry_size = n % BASE_BITS; let carry_mask = ((1 as BaseType) << carry_size).wrapping_sub(1); for i in 0..self.value.len() { let v = self.value[i]; self.value[i] = 0; if i < byte_shift { ...
shr_n
identifier_name
lid_shutdown.rs
// Copyright 2021 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use crate::error::PowerManagerError; use crate::message::{Message, MessageReturn}; use crate::node::Node; use crate::shutdown_request::ShutdownRequest; use ...
(&self) -> String { "LidShutdown".to_string() } async fn handle_message(&self, _msg: &Message) -> Result<MessageReturn, PowerManagerError> { Err(PowerManagerError::Unsupported) } } struct InspectData { lid_reports: RefCell<BoundedListNode>, read_errors: inspect::UintProperty, l...
name
identifier_name
lid_shutdown.rs
// Copyright 2021 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use crate::error::PowerManagerError; use crate::message::{Message, MessageReturn}; use crate::node::Node; use crate::shutdown_request::ShutdownRequest; use ...
/// Reads the report from the lid sensor and sends shutdown signal if lid is closed. async fn check_report(&self) -> Result<(), Error> { let (status, report, _time) = self.proxy.read_report().await?; let status = zx::Status::from_raw(status); if status!= zx::Status::OK { retu...
}, }; }
random_line_split
lid_shutdown.rs
// Copyright 2021 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use crate::error::PowerManagerError; use crate::message::{Message, MessageReturn}; use crate::node::Node; use crate::shutdown_request::ShutdownRequest; use ...
event .signal_handle(zx::Signals::NONE, zx::Signals::USER_0) .expect("Failed to signal event"); node.watch_lid_inner().await; // When mock_maker goes out of scope, it verifies the ShutdownNode received the shutdown // request. } /// Tests that when the n...
{ let mut mock_maker = MockNodeMaker::new(); let shutdown_node = mock_maker.make( "Shutdown", vec![( msg_eq!(SystemShutdown(ShutdownRequest::PowerOff)), msg_ok_return!(SystemShutdown), )], ); let event = zx::Event::crea...
identifier_body
lid_shutdown.rs
// Copyright 2021 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use crate::error::PowerManagerError; use crate::message::{Message, MessageReturn}; use crate::node::Node; use crate::shutdown_request::ShutdownRequest; use ...
_ => (), } } Err(format_err!("No lid device found")) } /// Opens the sensor's device file. Returns the device if the correct HID /// report descriptor is found. async fn open_sensor(filename: &PathBuf) -> Result<LidProxy, Error> { let path = Path::n...
{ match Self::open_sensor(&msg.filename).await { Ok(device) => return Ok(device), _ => (), } }
conditional_block
lib.rs
#![deny( // missing_copy_implementations, // missing_debug_implementations, // missing_docs, trivial_casts, trivial_numeric_casts, unused_extern_crates, unused_import_braces, unused_qualifications, variant_size_differences )] // #![warn(rust_2018_idioms)] #![doc(test(attr(deny( m...
; impl Separator for SpaceSeparator { #[inline] fn separator() -> &'static str { " " } } /// Predefined separator using a single comma #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default)] pub struct CommaSeparator; impl Separator for CommaSeparator { #[inline] fn s...
SpaceSeparator
identifier_name
lib.rs
#![deny( // missing_copy_implementations, // missing_debug_implementations, // missing_docs, trivial_casts, trivial_numeric_casts, unused_extern_crates, unused_import_braces, unused_qualifications, variant_size_differences )] // #![warn(rust_2018_idioms)] #![doc(test(attr(deny( m...
//! # assert_eq!(json.replace(" ", "").replace("\n", ""), serde_json::to_string(&foo).unwrap()); //! # assert_eq!(foo, serde_json::from_str(&json).unwrap()); //! # } //! ``` //! //! [`DisplayFromStr`]: https://docs.rs/serde_with/*/serde_with/struct.DisplayFromStr.html //! [`serde_as`]: https://docs.rs/serde_with/*/serd...
//! "1": "006fde" //! } //! } //! # "#;
random_line_split
notification_client.rs
app. /// /// In particular, it takes care of running a full decryption sync, in case the /// event in the notification was impossible to decrypt beforehand. pub struct NotificationClient { /// SDK client that uses an in-memory state store. client: Client, /// SDK client that uses the same state store as t...
// The message is still encrypted, and the client is configured to retry // decryption. // // Spawn an `EncryptionSync` that runs two iterations of the sliding sync loop: // - the first iteration allows to get SS events as well as send e2ee requests. // - the second one ...
{ if !self.retry_decryption { return Ok(None); } let event: AnySyncTimelineEvent = raw_event.deserialize().map_err(|_| Error::InvalidRumaEvent)?; let event_type = event.event_type(); let is_still_encrypted = matches!(event_type, ruma::events...
identifier_body
notification_client.rs
app. /// /// In particular, it takes care of running a full decryption sync, in case the /// event in the notification was impossible to decrypt beforehand. pub struct NotificationClient { /// SDK client that uses an in-memory state store. client: Client, /// SDK client that uses the same state store as t...
( &self, room_id: &RoomId, event_id: &EventId, ) -> Result<Option<RawNotificationEvent>, Error> { // Serialize all the calls to this method by taking a lock at the beginning, // that will be dropped later. let _guard = self.sliding_sync_mutex.lock().await; //...
try_sliding_sync
identifier_name
notification_client.rs
an app. /// /// In particular, it takes care of running a full decryption sync, in case the /// event in the notification was impossible to decrypt beforehand. pub struct NotificationClient { /// SDK client that uses an in-memory state store. client: Client, /// SDK client that uses the same state store a...
timeline_event.push_actions } else { room.event_push_actions(timeline_event).await? } } RawNotificationEvent::Invite(invite_event) => { // Invite events can't be encrypted, so they should be in clear text. ...
self.maybe_retry_decryption(&room, timeline_event).await? { raw_event = RawNotificationEvent::Timeline(timeline_event.event.cast());
random_line_split
main.rs
use std::env; use std::fs; extern crate rgsl; use std::rc::Rc; use std::cell::RefCell; use plotters::prelude::*; use std::time::Instant; use std::path::Path; use std::io::{Error, ErrorKind}; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use image::{imageops::FilterType, ImageFormat}; #[macro_use...
let corrected_points = apply_optical_distortion_correction(&solver.x(), &add_points); if elements[2] == "x"{ let output_str = format!("{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\n", elements[0], elements[1], elements[2], ...
{ let pm0: Vec<f64> = vec![elements[3], elements[4]].iter().filter_map(|e| e.parse::<f64>().ok()).collect(); let pm1: Vec<f64> = vec![elements[5], elements[6]].iter().filter_map(|e| e.parse::<f64>().ok()).collect(); let cp_x: Vec<f64> = elements[7].split(" ").filter_map(|...
conditional_block
main.rs
use std::env; use std::fs; extern crate rgsl; use std::rc::Rc; use std::cell::RefCell; use plotters::prelude::*; use std::time::Instant; use std::path::Path; use std::io::{Error, ErrorKind}; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use image::{imageops::FilterType, ImageFormat}; #[macro_use...
println!("run {} iterations", iter); println!("average time: {} microsecond", total_time_ms/ iter); } */ fn main() { let args: Vec<String> = env::args().collect(); let path = Path::new(&args[1]); if path.is_dir(){ //run_on_folder(&path.to_str().unwrap()); println!("TODO: fix bug in ru...
total_time_ms += now.elapsed().as_micros(); iter += 1; } } }
random_line_split
main.rs
use std::env; use std::fs; extern crate rgsl; use std::rc::Rc; use std::cell::RefCell; use plotters::prelude::*; use std::time::Instant; use std::path::Path; use std::io::{Error, ErrorKind}; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use image::{imageops::FilterType, ImageFormat}; #[macro_use...
println!("theta: {}", theta); let boundary_point = vec![point[0], a * point[0].powi(2) + b * point[0] + c]; let new_length = (boundary_point[1] - point[1]) / *CORNEA_REFRACTIVE_INDEX; new_point.push(boundary_point[0] + new_length * theta.sin()); new_point.push(boundary_point[1] -...
{ let a = params.get(0); let b = params.get(1); let c = params.get(2); let mut new_points: Vec<Vec<f64>> = Vec::new(); for point in points.iter(){ let k1 = 2f64 * a * point[0] + b; let theta_1 = k1.atan(); let mut theta_2 = 0f64; let mut theta = 0f64; ...
identifier_body
main.rs
use std::env; use std::fs; extern crate rgsl; use std::rc::Rc; use std::cell::RefCell; use plotters::prelude::*; use std::time::Instant; use std::path::Path; use std::io::{Error, ErrorKind}; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use image::{imageops::FilterType, ImageFormat}; #[macro_use...
() { let args: Vec<String> = env::args().collect(); let path = Path::new(&args[1]); if path.is_dir(){ //run_on_folder(&path.to_str().unwrap()); println!("TODO: fix bug in run folder"); }else{ let lines = read_file_into_lines(path.to_str().unwrap()); let mut total_time_micr...
main
identifier_name
runner.rs
use graph::Graph; use modules; use num_cpus; use runtime::{Environment, Runtime}; use std::cmp; use std::collections::{HashMap, HashSet}; use std::error::Error; use std::path::{Path, PathBuf}; use std::rc::Rc; use std::sync::mpsc; use std::thread; use task::Task; use term; #[derive(Clone)] pub struct EnvironmentSpec ...
} for dependency in self.graph.get(name).unwrap().dependencies() { if!self.graph.contains(dependency) { try!(self.resolve_task(dependency)); } } Ok(()) } fn runtime(&self) -> Runtime { self.runtime.as_ref().unwrap().clone() } }...
return Err(format!("no matching task or rule for '{}'", name.as_ref()).into()); }
conditional_block
runner.rs
use graph::Graph; use modules; use num_cpus; use runtime::{Environment, Runtime}; use std::cmp; use std::collections::{HashMap, HashSet}; use std::error::Error; use std::path::{Path, PathBuf}; use std::rc::Rc; use std::sync::mpsc; use std::thread; use task::Task; use term; #[derive(Clone)] pub struct EnvironmentSpec ...
(&mut self) { self.spec.always_run = true; } /// Run all tasks even if they throw errors. pub fn keep_going(&mut self) { self.spec.keep_going = true; } /// Sets the number of threads to use to run tasks. pub fn jobs(&mut self, jobs: usize) { self.jobs = jobs; } ...
always_run
identifier_name