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 |
|---|---|---|---|---|
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... |
fn load() -> Result<UpdaterState> {
let data_file_path = Self::build_data_fn()?;
crate::Data::load_from_file(data_file_path)
.ok_or_else(|| anyhow!("cannot load cached state of updater"))
}
// Save updater's state
pub(super) fn save(&self) -> Result<()> {
let data_f... | {
self.state.update_interval = t;
} | identifier_body |
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... |
}
pub(super) fn last_check(&self) -> Option<DateTime<Utc>> {
self.state.last_check.get()
}
pub(super) fn set_last_check(&self, t: DateTime<Utc>) {
self.state.last_check.set(Some(t));
}
pub(super) fn update_interval(&self) -> i64 {
self.state.update_interval
}
... | {
let current_version = env::workflow_version()
.map_or_else(|| Ok(Version::new(0, 0, 0)), |v| Version::parse(&v))?;
let state = UpdaterState {
current_version,
last_check: Cell::new(None),
avail_release: RefCell::new(None),
... | conditional_block |
pbms.rs | URL")?;
Ok(())
}
/// Replace the {foo} placeholders in repo paths.
///
/// {version} is replaced with the Fuchsia SDK version string.
/// {sdk.root} is replaced with the SDK directory path.
fn expand_placeholders(uri: &str, version: &str, sdk_root: &str) -> Result<url::Url> {
let expanded = uri.replace("{vers... | let mut throttle = Throttle::from_duration(std::time::Duration::from_millis(500));
let url = product_uri.to_string();
while let Some(chunk) =
stream.try_next().await.with_context(|| format!("Downloading {}", product_uri))?
{
file.write_all(&chunk).await.with_context(|| format!("Writing {... | // the user will have trouble seeing anyway. Without throttling,
// around 20% of the execution time can be spent updating the
// progress UI. The throttle makes the overhead negligible. | random_line_split |
pbms.rs | ")?;
Ok(())
}
/// Replace the {foo} placeholders in repo paths.
///
/// {version} is replaced with the Fuchsia SDK version string.
/// {sdk.root} is replaced with the SDK directory path.
fn expand_placeholders(uri: &str, version: &str, sdk_root: &str) -> Result<url::Url> {
let expanded = uri.replace("{version}... |
/// Separate the URL on the last "#" character.
///
/// If no "#" is found, use the whole input as the url.
///
/// "file://foo#bar" -> "file://foo"
/// "file://foo" -> "file://foo"
pub(crate) fn url_sans_fragment(product_url: &url::Url) -> Result<url::Url> {
let mut product_url = product_url.to_owned();
prod... | {
Ok(get_storage_dir().await?.join(pb_dir_name(product_url)))
} | identifier_body |
pbms.rs | ")?;
Ok(())
}
/// Replace the {foo} placeholders in repo paths.
///
/// {version} is replaced with the Fuchsia SDK version string.
/// {sdk.root} is replaced with the SDK directory path.
fn expand_placeholders(uri: &str, version: &str, sdk_root: &str) -> Result<url::Url> {
let expanded = uri.replace("{version}... | () {
let sdk_prefix = PathBuf::from("/"); // this is only used for file paths
let url = url::Url::parse("fake://foo#bar").expect("url");
let path =
local_path_helper(&url, "foo", /*dir=*/ true, &sdk_prefix).await.expect("dir helper");
assert!(path.to_string_lossy().ends_with(... | test_local_path_helper | identifier_name |
lib.rs | //! `litem` is a compile-time templating library.
//!
//! At compile time, the `#[template]` attribute will read a template file,
//! parse it, and generate the rendering functions.
//!
//! ## Template Syntax
//! ### Expressions
//! - `{EXPR}` will expand to value of `EXPR`, which
//! can be any Rust expression that ... |
}
impl<'i> Iterator for TokenIterator<'i> {
type Item = Token<'i>;
fn next(&mut self) -> Option<Token<'i>> {
let (first_idx, first) = match self.chars.peek() {
None => return None,
Some(v) => *v,
};
let mut n_braces = 0;
let (final_idx, final_) = loop ... | {
Self {
src,
chars: src.char_indices().peekable(),
}
} | identifier_body |
lib.rs | //! `litem` is a compile-time templating library.
//!
//! At compile time, the `#[template]` attribute will read a template file,
//! parse it, and generate the rendering functions.
//!
//! ## Template Syntax
//! ### Expressions
//! - `{EXPR}` will expand to value of `EXPR`, which
//! can be any Rust expression that ... | (&mut self) -> Option<Token<'i>> {
let (first_idx, first) = match self.chars.peek() {
None => return None,
Some(v) => *v,
};
let mut n_braces = 0;
let (final_idx, final_) = loop {
let (idx, chr) = self.chars.next().unwrap();
let (next_idx... | next | identifier_name |
lib.rs | //! `litem` is a compile-time templating library.
//!
//! At compile time, the `#[template]` attribute will read a template file,
//! parse it, and generate the rendering functions.
//!
//! ## Template Syntax
//! ### Expressions
//! - `{EXPR}` will expand to value of `EXPR`, which
//! can be any Rust expression that ... | ,
_ => panic!("#[template]: expected name = value")
}
}
let escape_func = match escape.as_str() {
"txt" => |s: syn::Expr| -> TokenStream { (quote! { #s }) },
"html" => |s: syn::Expr| -> TokenStream {
let q = quote! {
::std::string::ToString::to_st... | {
let ident = val.path.get_ident().expect("#[template]: expected name = value; name must be identifier, not path");
match ident.to_string().as_str() {
"escape" => {
let type_ = match &val.lit {
syn::Lit::Str(s) => s.... | conditional_block |
lib.rs | //! `litem` is a compile-time templating library.
//!
//! At compile time, the `#[template]` attribute will read a template file,
//! parse it, and generate the rendering functions.
//!
//! ## Template Syntax
//! ### Expressions
//! - `{EXPR}` will expand to value of `EXPR`, which
//! can be any Rust expression that ... | if first!= '{' && next_chr == '{' {
break (idx, chr);
}
if first == '{' {
if next_chr == '{' {
n_braces += 1;
}
if next_chr == '}' {
if n_braces == 0 {
sel... | None => { break (idx, chr); },
Some(x) => *x,
};
| random_line_split |
driver.rs | use std::any::Any;
use std::ffi::CString;
use std::fs::File;
use std::os::raw::{c_char, c_int};
use rustc::middle::cstore::EncodedMetadata;
use rustc::mir::mono::{Linkage as RLinkage, Visibility};
use rustc::session::config::{DebugInfo, OutputType};
use rustc_codegen_ssa::back::linker::LinkerInfo;
use rustc_codegen_ss... |
fn codegen_mono_items<'tcx>(
tcx: TyCtxt<'tcx>,
module: &mut Module<impl Backend +'static>,
debug_context: Option<&mut DebugContext<'tcx>>,
log: &mut Option<File>,
mono_items: FxHashMap<MonoItem<'tcx>, (RLinkage, Visibility)>,
) {
let mut cx = CodegenCx::new(tcx, module, debug_context);
ti... | {
let (_, cgus) = tcx.collect_and_partition_mono_items(LOCAL_CRATE);
let mono_items = cgus
.iter()
.map(|cgu| cgu.items_in_deterministic_order(tcx).into_iter())
.flatten()
.collect::<FxHashMap<_, (_, _)>>();
codegen_mono_items(tcx, module, debug.as_mut(), log, mono_items);
... | identifier_body |
driver.rs | use std::any::Any;
use std::ffi::CString;
use std::fs::File;
use std::os::raw::{c_char, c_int};
use rustc::middle::cstore::EncodedMetadata;
use rustc::mir::mono::{Linkage as RLinkage, Visibility};
use rustc::session::config::{DebugInfo, OutputType};
use rustc_codegen_ssa::back::linker::LinkerInfo;
use rustc_codegen_ss... | <R>(name: &str, f: impl FnOnce() -> R) -> R {
println!("[{}] start", name);
let before = std::time::Instant::now();
let res = f();
let after = std::time::Instant::now();
println!("[{}] end time: {:?}", name, after - before);
res
}
| time | identifier_name |
driver.rs | use std::any::Any;
use std::ffi::CString;
use std::fs::File;
use std::os::raw::{c_char, c_int};
use rustc::middle::cstore::EncodedMetadata;
use rustc::mir::mono::{Linkage as RLinkage, Visibility};
use rustc::session::config::{DebugInfo, OutputType};
use rustc_codegen_ssa::back::linker::LinkerInfo;
use rustc_codegen_ss... | jit_module.finalize_definitions();
tcx.sess.abort_if_errors();
let finalized_main: *const u8 = jit_module.get_finalized_function(main_func_id);
println!("Rustc codegen cranelift will JIT run the executable, because the SHOULD_RUN env var is set");
let f: extern "C" fn(c_int, *const *const c_char... | .unwrap();
codegen_cgus(tcx, &mut jit_module, &mut None, log);
crate::allocator::codegen(tcx.sess, &mut jit_module); | random_line_split |
driver.rs | use std::any::Any;
use std::ffi::CString;
use std::fs::File;
use std::os::raw::{c_char, c_int};
use rustc::middle::cstore::EncodedMetadata;
use rustc::mir::mono::{Linkage as RLinkage, Visibility};
use rustc::session::config::{DebugInfo, OutputType};
use rustc_codegen_ssa::back::linker::LinkerInfo;
use rustc_codegen_ss... |
run_aot(tcx, metadata, need_metadata_module, &mut log)
}
#[cfg(not(target_arch = "wasm32"))]
fn run_jit(tcx: TyCtxt<'_>, log: &mut Option<File>) ->! {
use cranelift_simplejit::{SimpleJITBackend, SimpleJITBuilder};
let imported_symbols = load_imported_symbols_for_jit(tcx);
let mut jit_builder = Simp... | {
#[cfg(not(target_arch = "wasm32"))]
let _: ! = run_jit(tcx, &mut log);
#[cfg(target_arch = "wasm32")]
panic!("jit not supported on wasm");
} | conditional_block |
lib.rs | //! This crate implements various functions that help speed up dynamic
//! programming, most importantly the SMAWK algorithm for finding row
//! or column minima in a totally monotone matrix with *m* rows and
//! *n* columns in time O(*m* + *n*). This is much better than the
//! brute force solution which would take O(... | rd case: row i-1 does not supply a column minimum in any
// column up to tentative. We simply advance finished while
// maintaining the invariant.
if m![i - 1, tentative] >= result[tentative].1 {
finished = i;
continue;
}
// Fourth and final case: a new c... | sult[i] = (i - 1, diag);
base = i - 1;
tentative = i;
finished = i;
continue;
}
// Thi | conditional_block |
lib.rs | //! This crate implements various functions that help speed up dynamic
//! programming, most importantly the SMAWK algorithm for finding row
//! or column minima in a totally monotone matrix with *m* rows and
//! *n* columns in time O(*m* + *n*). This is much better than the
//! brute force solution which would take O(... | matrix = vec![
vec![3], //
vec![2],
];
assert_eq!(smawk_row_minima(&matrix), vec![0, 0]);
assert_eq!(smawk_column_minima(&matrix), vec![1]);
}
#[test]
fn smawk_1x2() {
let matrix = vec![vec![2, 1]];
assert_eq!(smawk_row_minima(&matrix), vec![... | let | identifier_name |
lib.rs | //! This crate implements various functions that help speed up dynamic
//! programming, most importantly the SMAWK algorithm for finding row
//! or column minima in a totally monotone matrix with *m* rows and
//! *n* columns in time O(*m* + *n*). This is much better than the
//! brute force solution which would take O(... | //! vec![2, 1, 3, 3, 4],
//! vec![2, 1, 3, 3, 4],
//! vec![3, 2, 4, 3, 4],
//! vec![4, 3, 2, 1, 1],
//! ];
//! let minima = vec![1, 1, 4, 4, 4];
//! assert_eq!(smawk_column_minima(&matrix), minima);
//! ```
//!
//! The `minima` vector gives the index of the minimum value per
//! column, so `minima[0] ==... | //! ```
//! use smawk::{Matrix, smawk_column_minima};
//!
//! let matrix = vec![
//! vec![3, 2, 4, 5, 6], | random_line_split |
lib.rs | //! This crate implements various functions that help speed up dynamic
//! programming, most importantly the SMAWK algorithm for finding row
//! or column minima in a totally monotone matrix with *m* rows and
//! *n* columns in time O(*m* + *n*). This is much better than the
//! brute force solution which would take O(... | lumn minima in the given area of the matrix. The
/// `minima` slice is updated inplace.
fn smawk_inner<T: PartialOrd + Copy, M: Fn(usize, usize) -> T>(
matrix: &M,
rows: &[usize],
cols: &[usize],
mut minima: &mut [usize],
) {
if cols.is_empty() {
return;
}
let mut stack = Vec::with_... | nima = vec![0; matrix.ncols()];
smawk_inner(
&|i, j| matrix.index(i, j),
&(0..matrix.nrows()).collect::<Vec<_>>(),
&(0..matrix.ncols()).collect::<Vec<_>>(),
&mut minima,
);
minima
}
/// Compute co | identifier_body |
mod.rs | let mut latch_nodes = NodeSet::new();
for edge in self.graph.edges_directed(cur_node, Incoming) {
// backedges are always from original graph nodes
if visited.contains(edge.source()) {
backedges.insert(edge.id());
... | CfgNode::Code(AstNodeC::BasicBlock(block)) | random_line_split | |
mod.rs | `", s),
}
}
}
pub fn structure_whole(mut self) -> (AstNode<'cd, A>, A) {
let mut loop_headers = NodeSet::new();
let mut podfs_trace = Vec::new();
graph_utils::depth_first_search(&self.graph, self.entry, |ev| {
use self::graph_utils::DfsEvent::*;
... | export | identifier_name | |
mod.rs | nodes must be reachable from `entry`
pub fn new(
graph: StableDiGraph<CfgNode<'cd, A>, CfgEdge>,
entry: NodeIndex,
cctx: CondContext<'cd, A>,
actx: A,
) -> Self {
let ret = Self {
graph,
entry,
cctx,
actx,
};
... |
// replace abnormal exit edges with "break"
for (exit_num, exit_target) in abn_succ_iter.clone() {
let exit_edges: Vec<_> =
graph_utils::edges_from_region_to_node(&self.graph, &loop_nodes, exit_target)
.collect();
for exit_edge in exit_edges {
... | {
// replace "normal" exit edges with "break"
{
let exit_edges: Vec<_> =
graph_utils::edges_from_region_to_node(&self.graph, &loop_nodes, final_succ)
.collect();
for exit_edge in exit_edges {
let break_node = self.graph.add_node... | identifier_body |
mod.rs | //
// Copyright 2020 The Project Oak Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law o... |
Some(ConfigType::GrpcClientConfig(config)) => {
let grpc_client_root_tls_certificate = self
.secure_server_configuration
.clone()
.grpc_config
.expect("no gRPC identity provided to Oak Runtime")
.... | {
let wasm_module_bytes = self
.application_configuration
.wasm_modules
.get(&config.wasm_module_name)
.ok_or(ConfigurationError::IncorrectWebAssemblyModuleName)?;
Ok(CreatedNode {
instanc... | conditional_block |
mod.rs | //
// Copyright 2020 The Project Oak Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law o... | privilege: NodePrivilege::default(),
}),
Some(ConfigType::StorageConfig(_config)) => Ok(CreatedNode {
instance: Box::new(storage::StorageNode::new(node_name)),
privilege: NodePrivilege::default(),
}),
Some(ConfigType::HttpSe... | })
}
Some(ConfigType::RoughtimeClientConfig(config)) => Ok(CreatedNode {
instance: Box::new(roughtime::RoughtimeClientNode::new(node_name, config)), | random_line_split |
mod.rs | //
// Copyright 2020 The Project Oak Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law o... | {
pub application_configuration: ApplicationConfiguration,
pub permissions_configuration: PermissionsConfiguration,
pub secure_server_configuration: SecureServerConfiguration,
pub signature_table: SignatureTable,
pub kms_credentials: Option<std::path::PathBuf>,
}
impl NodeFactory<NodeConfiguration... | ServerNodeFactory | identifier_name |
mod.rs | //
// Copyright 2020 The Project Oak Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law o... | }),
Some(ConfigType::LogConfig(LogConfiguration {})) => Ok(CreatedNode {
instance: Box::new(logger::LogNode::new(node_name)),
// Allow the logger Node to declassify log messages in debug builds only.
#[cfg(feature = "oak-unsafe")]
... | {
if !self
.permissions_configuration
.allowed_creation(node_configuration)
// TODO(#1027): Use anyhow or an improved ConfigurationError
.map_err(|_| ConfigurationError::InvalidNodeConfiguration)?
{
return Err(ConfigurationError::NodeCreationNo... | identifier_body |
parse.rs | use std::collections::HashSet;
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub struct Point {
pub row: usize,
pub col: usize,
}
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct TBox(pub Point, pub Point);
pub struct Lines(pub Vec<Vec<char>>);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Direction {... | border(b)
)
}
}
| {
let b = TBox(Point { row: 1, col: 1 }, Point { row: 3, col: 4 });
use Direction::*;
assert_eq!(
vec![
(Point { row: 0, col: 1 }, Up),
(Point { row: 0, col: 2 }, Up),
(Point { row: 0, col: 3 }, Up),
(Point { row: 0, col: 4 }, Up),
(Point { row: 4, col: 1 }, Dn),
(Point { row: 4, col: 2... | identifier_body |
parse.rs | use std::collections::HashSet;
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub struct Point {
pub row: usize,
pub col: usize,
}
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct TBox(pub Point, pub Point);
pub struct Lines(pub Vec<Vec<char>>);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Direction {... | (lines: &Lines, mut p: Point, d: Direction) -> Option<(Point, char)> {
while let Some((q, c)) = lines.in_dir(p, d) {
// p
// --* < can't connect
//
if!can_go(c, d.rev()) {
return lines.at(p).map(|c| (p, c));
}
p = q;
// p
// --. < can connect, can't continue
//
if!can_go(c, d) {
return Som... | scan_dir | identifier_name |
parse.rs | use std::collections::HashSet;
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub struct Point {
pub row: usize,
pub col: usize,
}
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct TBox(pub Point, pub Point);
pub struct Lines(pub Vec<Vec<char>>);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Direction {... |
}
}
ret
}
fn scan_dir(lines: &Lines, mut p: Point, d: Direction) -> Option<(Point, char)> {
while let Some((q, c)) = lines.in_dir(p, d) {
// p
// --* < can't connect
//
if!can_go(c, d.rev()) {
return lines.at(p).map(|c| (p, c));
}
p = q;
// p
// --. < can connect, can't continue
//
if!c... | {
ret.push((p, c));
} | conditional_block |
parse.rs | use std::collections::HashSet;
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub struct Point {
pub row: usize,
pub col: usize,
}
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct TBox(pub Point, pub Point);
pub struct Lines(pub Vec<Vec<char>>);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Direction {... | }
fn scan_path(lines: &Lines, p: Point, d: Direction) -> Vec<Point> {
if!lines.at(p).map(|c| can_go(c, d)).unwrap_or(false) {
return vec![];
}
let mut ret = vec![];
let mut it = PathIter::new(&lines, p, d);
while let Some(next) = it.next() {
if ret.contains(&next) {
return ret;
}
ret.push(next);
}
re... | }
}
} | random_line_split |
thread.rs | use {
super::process::Process,
super::*,
crate::object::*,
alloc::{boxed::Box, sync::Arc},
core::{
any::Any,
future::Future,
pin::Pin,
task::{Context, Poll, Waker},
},
spin::Mutex,
};
pub use self::thread_state::*;
mod thread_state;
/// Runnable / computati... | (
self: &Arc<Self>,
entry: usize,
stack: usize,
arg1: usize,
arg2: usize,
) -> ZxResult<()> {
let regs = GeneralRegs::new_fn(entry, stack, arg1, arg2);
self.start_with_regs(regs)
}
/// Start execution with given registers.
pub fn start_with_regs(s... | start | identifier_name |
thread.rs | use {
super::process::Process,
super::*,
crate::object::*,
alloc::{boxed::Box, sync::Arc},
core::{
any::Any,
future::Future,
pin::Pin,
task::{Context, Poll, Waker},
},
spin::Mutex,
};
pub use self::thread_state::*;
mod thread_state;
/// Runnable / computati... |
inner.state = Some(state);
}
#[derive(Default)]
struct ThreadInner {
/// HAL thread handle
///
/// Should be `None` before start or after terminated.
hal_thread: Option<kernel_hal::Thread>,
/// Thread state
///
/// Only be `Some` on suspended.
state: Option<&'static mut ThreadStat... | {
state.general = old_state.general;
} | conditional_block |
thread.rs | use {
super::process::Process,
super::*,
crate::object::*,
alloc::{boxed::Box, sync::Arc},
core::{
any::Any,
future::Future,
pin::Pin,
task::{Context, Poll, Waker},
},
spin::Mutex,
};
pub use self::thread_state::*;
mod thread_state;
/// Runnable / computati... | thread: self.clone(),
}
}
pub fn resume(&self) {
let mut inner = self.inner.lock();
assert_ne!(inner.suspend_count, 0);
inner.suspend_count -= 1;
if inner.suspend_count == 0 {
if let Some(waker) = inner.waker.take() {
waker.wake();... | }
}
}
RunnableChecker { | random_line_split |
thread.rs | use {
super::process::Process,
super::*,
crate::object::*,
alloc::{boxed::Box, sync::Arc},
core::{
any::Any,
future::Future,
pin::Pin,
task::{Context, Poll, Waker},
},
spin::Mutex,
};
pub use self::thread_state::*;
mod thread_state;
/// Runnable / computati... | }
// start a new thread
let thread_ref_count = Arc::strong_count(&thread);
let handle = Handle::new(proc.clone(), Rights::DEFAULT_PROCESS);
proc.start(&thread, entry as usize, stack_top, handle.clone(), 2)
.expect("failed to start thread");
// wait 100ms for ... | root_job = Job::root();
let proc = Process::create(&root_job, "proc", 0).expect("failed to create process");
let thread = Thread::create(&proc, "thread", 0).expect("failed to create thread");
let thread1 = Thread::create(&proc, "thread1", 0).expect("failed to create thread");
// allocat... | identifier_body |
lib.rs | //! [](./LICENSE-MIT)
//! [](./LICENSE-APACHE)
//! [](https://docs.rs/der-parser)
//! [. The only difference is the
//! verification of constraints *during parsing*.
//!
//! ## Rust version requirements
//!
//! The 7.0 series of `der-parser` requires **Rustc version 1.53 o... | //! - macros: these are generally previous (historic) versions of parsers, kept for compatibility.
//! They can sometime reduce the amount of code to write, but are hard to debug.
//! Parsers should be preferred when possible.
//!
//! ## Misc Notes | random_line_split |
lib.rs | //! Shared code for EZO sensor chips. These chips are used for sensing aquatic
//! media.
//!
//! > Currently, only __I2C Mode__ is supported.
#[macro_use]
extern crate failure;
extern crate i2cdev;
#[macro_use]
mod macros;
pub mod command;
pub mod errors;
pub mod response;
use std::ffi::{CStr, CString};
use std::th... | (code_byte: u8) -> ResponseCode {
use self::ResponseCode::*;
match code_byte {
x if x == NoDataExpected as u8 => NoDataExpected,
x if x == Pending as u8 => Pending,
x if x == DeviceError as u8 => DeviceError,
x if x == Success as u8 => Success,
_ => UnknownError,
}
}
... | response_code | identifier_name |
lib.rs | //! Shared code for EZO sensor chips. These chips are used for sensing aquatic
//! media.
//!
//! > Currently, only __I2C Mode__ is supported.
#[macro_use]
extern crate failure;
extern crate i2cdev;
#[macro_use]
mod macros;
pub mod command;
pub mod errors;
pub mod response;
use std::ffi::{CStr, CString};
use std::th... |
#[test]
fn process_pending_response_code() {
assert_eq!(response_code(254), ResponseCode::Pending);
}
#[test]
fn process_error_response_code() {
assert_eq!(response_code(2), ResponseCode::DeviceError);
}
#[test]
fn process_success_response_code() {
assert_eq!(... | {
assert_eq!(response_code(255), ResponseCode::NoDataExpected);
} | identifier_body |
lib.rs | //! Shared code for EZO sensor chips. These chips are used for sensing aquatic
//! media.
//!
//! > Currently, only __I2C Mode__ is supported.
#[macro_use]
extern crate failure;
extern crate i2cdev;
#[macro_use]
mod macros;
pub mod command;
pub mod errors;
pub mod response;
use std::ffi::{CStr, CString};
use std::th... | assert_eq!(data, flipped_data);
}
#[test]
fn converts_valid_response_to_string() {
// empty nul-terminated string
assert_eq!(string_from_response_data(&b"\0"[..]).unwrap(), "");
// non-empty nul-terminated string
assert_eq!(string_from_response_data(&b"hello\0"[..])... | #[test]
fn turns_off_high_bits() {
let data: [u8; 11] = [63, 73, 44, 112, 72, 44, 49, 46, 57, 56, 0];
let mut flipped_data: [u8; 11] = [63, 73, 172, 112, 200, 172, 49, 46, 57, 56, 0];
turn_off_high_bits(&mut flipped_data); | random_line_split |
mod.rs | // Copyright 2018 ETH Zurich. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
//... | return Ok(());
}
}
}
}
/// Sends `msg` to all connected subscribers.
fn broadcast(&self, msg: MessageBuf) -> io::Result<()> {
if self.subscribers.len() == 0 {
// nothing to do here
return Ok(());
}
let ... | // all still connected subscribers | random_line_split |
mod.rs | // Copyright 2018 ETH Zurich. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
//... | <'a>(&'a self) -> (::std::sync::MutexGuard<'a, usize>, &'a Condvar) {
let AtomicCounter(ref inner) = *self;
(
inner.0.lock().expect("publisher thread poisioned counter"),
&inner.1,
)
}
fn increment(&self) {
let (mut count, nonzero) = self.lock();
... | lock | identifier_name |
lib.rs | ::api) with the generic Kubernetes [`Api`](crate::Api)
//! - [`derive`](kube_derive) with the [`CustomResource`](crate::CustomResource) derive for building controllers types
//! - [`runtime`](crate::runtime) with a [`Controller`](crate::runtime::Controller) / [`watcher`](crate::runtime::watcher()) / [`reflector`](crate... | else {
Api::all_with(client.clone(), &ar)
};
api.list(&Default::default()).await?;
}
}
// cleanup
crds.delete("testcrs.kube.rs", &DeleteParams::default()).await?;
Ok(())
}
#[tokio::test]
#[ignore = "needs clus... | {
Api::default_namespaced_with(client.clone(), &ar)
} | conditional_block |
lib.rs | crate::api) with the generic Kubernetes [`Api`](crate::Api)
//! - [`derive`](kube_derive) with the [`CustomResource`](crate::CustomResource) derive for building controllers types
//! - [`runtime`](crate::runtime) with a [`Controller`](crate::runtime::Controller) / [`watcher`](crate::runtime::watcher()) / [`reflector`](... | #[cfg(test)]
#[cfg(all(feature = "derive", feature = "client"))]
mod test {
use crate::{
api::{DeleteParams, Patch, PatchParams},
Api, Client, CustomResourceExt, Resource, ResourceExt,
};
use kube_derive::CustomResource;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
... | pub use kube_core as core;
// Tests that require a cluster and the complete feature set
// Can be run with `cargo test -p kube --lib --features=runtime,derive -- --ignored` | random_line_split |
lib.rs | ::api) with the generic Kubernetes [`Api`](crate::Api)
//! - [`derive`](kube_derive) with the [`CustomResource`](crate::CustomResource) derive for building controllers types
//! - [`runtime`](crate::runtime) with a [`Controller`](crate::runtime::Controller) / [`watcher`](crate::runtime::watcher()) / [`reflector`](crate... | {
#[allow(dead_code)]
image: String,
}
type PodSimple = Object<PodSpecSimple, NotUsed>;
// use known type information from pod (can also use discovery for this)
let ar = ApiResource::erase::<Pod>(&());
let client = Client::try_default().await?;
... | ContainerSimple | identifier_name |
lib.rs | ::api) with the generic Kubernetes [`Api`](crate::Api)
//! - [`derive`](kube_derive) with the [`CustomResource`](crate::CustomResource) derive for building controllers types
//! - [`runtime`](crate::runtime) with a [`Controller`](crate::runtime::Controller) / [`watcher`](crate::runtime::watcher()) / [`reflector`](crate... |
let is_fully_ready = await_condition(
pods.clone(),
"busybox-kube4",
conditions::is_pod_running().and(is_each_container_ready()),
);
let _ = timeout(Duration::from_secs(10), is_fully_ready).await?;
// Delete it - and wait for deletion to complete
| {
|obj: Option<&Pod>| {
if let Some(o) = obj {
if let Some(s) = &o.status {
if let Some(conds) = &s.conditions {
if let Some(pcond) = conds.iter().find(|c| c.type_ == "ContainersReady") {
... | identifier_body |
cartesian.rs | // Copyright 2017 Nico Madysa.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you
// may not use this file except in compliance with the License. You may
// obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wri... | ator<Item = Self>>(iter: I) -> Self {
iter.fold(SizeHint(0, Some(0)), |acc, x| acc + x)
}
}
impl ::std::iter::Product for SizeHint {
fn product<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.fold(SizeHint(1, Some(1)), |acc, x| acc * x)
}
}
#[cfg(test)]
mod tests {
mod lengths {
... | ter | identifier_name |
cartesian.rs | // Copyright 2017 Nico Madysa.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you
// may not use this file except in compliance with the License. You may
// obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wri... | 1 + self
.iterators
.iter()
.enumerate()
.map(|(i, iterator)| {
iterator.len()
* self.collections[i + 1..]
.iter()
.map(|c| c.into_iter().len())
.product::<usize>()
... | return 0;
}
| conditional_block |
cartesian.rs | // Copyright 2017 Nico Madysa.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you
// may not use this file except in compliance with the License. You may
// obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wri... | ::std::iter::Sum for SizeHint {
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.fold(SizeHint(0, Some(0)), |acc, x| acc + x)
}
}
impl ::std::iter::Product for SizeHint {
fn product<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.fold(SizeHint(1, Some(1)), |acc, x| acc * x)
}... | let lower = self.0 * other.0;
let upper = match (self.1, other.1) {
(Some(left), Some(right)) => Some(left * right),
_ => None,
};
SizeHint(lower, upper)
}
}
impl | identifier_body |
cartesian.rs | // Copyright 2017 Nico Madysa.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you
// may not use this file except in compliance with the License. You may
// obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wri... | (Some(left), Some(right)) => Some(left * right),
_ => None,
};
SizeHint(lower, upper)
}
}
impl ::std::iter::Sum for SizeHint {
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.fold(SizeHint(0, Some(0)), |acc, x| acc + x)
}
}
impl ::std::iter::Product... | type Output = Self;
fn mul(self, other: Self) -> Self {
let lower = self.0 * other.0;
let upper = match (self.1, other.1) { | random_line_split |
rsqf.rs | use block;
use logical;
use murmur::Murmur3Hash;
#[allow(dead_code)] // for now
pub struct RSQF {
meta: Metadata,
logical: logical::LogicalData,
}
#[allow(dead_code)] // for now | struct Metadata {
n: usize,
qbits: usize,
rbits: usize,
nblocks: usize,
nelements: usize,
ndistinct_elements: usize,
nslots: usize,
noccupied_slots: usize,
max_slots: usize,
}
/// Standard filter result type, on success returns a count on error returns a message
/// This should prob... | #[derive(Default, PartialEq)] | random_line_split |
rsqf.rs | use block;
use logical;
use murmur::Murmur3Hash;
#[allow(dead_code)] // for now
pub struct RSQF {
meta: Metadata,
logical: logical::LogicalData,
}
#[allow(dead_code)] // for now
#[derive(Default, PartialEq)]
struct Metadata {
n: usize,
qbits: usize,
rbits: usize,
nblocks: usize,
nelements:... | () {
RSQF::new(10000, 8);
}
#[test]
fn computes_valid_metadata() {
let filter = RSQF::new(10000, 9);
assert_eq!(filter.meta.n, 10000);
assert_eq!(filter.meta.rbits, 9);
assert_eq!(filter.meta.qbits, 14);
assert_eq!(filter.meta.nslots, 1usize << 14);
... | panics_on_invalid_r | identifier_name |
rsqf.rs | use block;
use logical;
use murmur::Murmur3Hash;
#[allow(dead_code)] // for now
pub struct RSQF {
meta: Metadata,
logical: logical::LogicalData,
}
#[allow(dead_code)] // for now
#[derive(Default, PartialEq)]
struct Metadata {
n: usize,
qbits: usize,
rbits: usize,
nblocks: usize,
nelements:... | }
#[test]
fn computes_valid_metadata_for_n_and_r() {
let test_data = [
// (n, r, expected_qbits, expected_nslots)
(10_000_usize, 9_usize, 14, 1usize << 14),
];
for (n, r, expected_qbits, expected_nslots) in test_data.into_iter() {
let meta = Met... | {
// Test data data values were computed from a Google Sheet using formulae from the RSQF
// paper
let test_data = [
// (n, r, expected_q)
(100_000_usize, 6_usize, 17),
(1_000_000_usize, 6_usize, 20),
(10_000_000_usize, 6_usize, 24),
(1... | identifier_body |
lpc55_flash.rs |
/// Erases all non-secure flash. This MUST be done before writing!
#[clap(name = "flash-erase-all")]
FlashEraseAll,
/// Erases a portion of non-secure flash. This MUST be done before writing!
FlashEraseRegion {
#[arg(value_parser = parse_int::parse::<u32>)]
start_address: u32,
... | (prop: BootloaderProperty, params: Vec<u32>) {
match prop {
BootloaderProperty::BootloaderVersion => {
println!("Version {:x}", params[1]);
}
BootloaderProperty::AvailablePeripherals => {
println!("Bitmask of peripherals {:x}", params[1]);
}
Bootloader... | pretty_print_bootloader_prop | identifier_name |
lpc55_flash.rs |
/// Erases all non-secure flash. This MUST be done before writing!
#[clap(name = "flash-erase-all")]
FlashEraseAll,
/// Erases a portion of non-secure flash. This MUST be done before writing!
FlashEraseRegion {
#[arg(value_parser = parse_int::parse::<u32>)]
start_address: u32,
... | BootloaderProperty::CRCStatus => {
println!("CRC status = {}", params[1]);
}
BootloaderProperty::VerifyWrites => {
println!("Verify Writes (bool) {}", params[1]);
}
BootloaderProperty::MaxPacketSize => {
println!("Max Packet Size = {}", params[... | {
match prop {
BootloaderProperty::BootloaderVersion => {
println!("Version {:x}", params[1]);
}
BootloaderProperty::AvailablePeripherals => {
println!("Bitmask of peripherals {:x}", params[1]);
}
BootloaderProperty::FlashStart => {
println... | identifier_body |
lpc55_flash.rs |
/// Erases all non-secure flash. This MUST be done before writing!
#[clap(name = "flash-erase-all")]
FlashEraseAll,
/// Erases a portion of non-secure flash. This MUST be done before writing!
FlashEraseRegion {
#[arg(value_parser = parse_int::parse::<u32>)]
start_address: u32,
... |
0x0b38f300 => {
println!("DICE failure. Check:");
println!("- Key store is set up properly (UDS)");
}
0x0d70f300 => {
println!("Trying to boot a TZ image on a device that doesn't have TZ!");
}
0x0d71f300 => {
... | {
println!("Application entry point and/or stack is invalid");
} | conditional_block |
lpc55_flash.rs | },
/// Erases all non-secure flash. This MUST be done before writing!
#[clap(name = "flash-erase-all")]
FlashEraseAll,
/// Erases a portion of non-secure flash. This MUST be done before writing!
FlashEraseRegion {
#[arg(value_parser = parse_int::parse::<u32>)]
start_address: u32,
... | file: PathBuf,
},
/// Erase the CMPA region (use to boot non-secure binaries again)
#[clap(name = "erase-cmpa")]
EraseCMPA,
/// Save the CMPA region to a file
ReadCMPA {
/// Write to FILE, or stdout if omitted
file: Option<PathBuf>,
},
/// Save the CFPA region to ... | },
/// Write a file to the CMPA region
#[clap(name = "write-cmpa")]
WriteCMPA { | random_line_split |
mod.rs | Item = (PathBuf, u64)>> {
let mut files: Vec<_> = WalkDir::new(path.as_ref())
.into_iter()
.filter_map(|e| {
e.ok().and_then(|f| {
// Only look at files
if f.file_type().is_file() {
// Get the last-modified time, size, and the full path.
... | }
fn insert_by<K: AsRef<OsStr>, F: FnOnce(&Path) -> io::Result<()>>(
&mut self,
key: K,
size: Option<u64>,
by: F,
) -> Result<()> {
if let Some(size) = size {
if!self.can_store(size) {
return Err(Error::FileTooLarge);
}
... | {
if !self.can_store(size) {
return Err(Error::FileTooLarge);
}
let rel_path = match addfile_path {
AddFile::AbsPath(ref p) => p.strip_prefix(&self.root).expect("Bad path?").as_os_str(),
AddFile::RelPath(p) => p,
};
//TODO: ideally LRUCache::in... | identifier_body |
mod.rs | <Q:?Sized>(&self, _: &Q, v: &u64) -> usize
where
K: Borrow<Q>,
{
*v as usize
}
}
/// Return an iterator of `(path, size)` of files under `path` sorted by ascending last-modified
/// time, such that the oldest modified file is returned first.
fn get_all_files<P: AsRef<Path>>(path: P) -> Box<... | measure | identifier_name | |
mod.rs | <Item = (PathBuf, u64)>> {
let mut files: Vec<_> = WalkDir::new(path.as_ref())
.into_iter()
.filter_map(|e| {
e.ok().and_then(|f| {
// Only look at files
if f.file_type().is_file() {
// Get the last-modified time, size, and the full path.... | set_mtime_back(f.create_file("file1", 10), 5);
set_mtime_back(f.create_file("file2", 10), 10);
let mut c = LruDiskCache::new(f.tmp(), 25).unwrap();
assert_eq!(c.size(), 20);
c.insert_bytes("file3", &[0; 10]).unwrap();
assert_eq!(c.size(), 20);
// The oldest file o... | let f = TestFixture::new();
// Create files explicitly in the past. | random_line_split |
lib.rs | use bevy::{
prelude::*,
render::camera::Camera,
render::color::Color,
render::mesh::{VertexAttribute, VertexAttributeValues},
render::pipeline::PrimitiveTopology,
window::CursorMoved,
};
pub struct PickingPlugin;
impl Plugin for PickingPlugin {
fn build(&self, app: &mut AppBuilder) {
... |
}
impl Default for PickState {
fn default() -> Self {
PickState {
cursor_event_reader: EventReader::default(),
ordered_pick_list: Vec::new(),
topmost_pick: None,
}
}
}
/// Holds the entity associated with a mesh as well as it's computed intersection from a ... | {
&self.topmost_pick
} | identifier_body |
lib.rs | use bevy::{
prelude::*,
render::camera::Camera,
render::color::Color,
render::mesh::{VertexAttribute, VertexAttributeValues},
render::pipeline::PrimitiveTopology,
window::CursorMoved,
};
pub struct PickingPlugin;
impl Plugin for PickingPlugin {
fn build(&self, app: &mut AppBuilder) {
... | // Find the maximum signed z value
let max_z = triangle
.iter()
.fold(-1.0, |max, x| if x.z() > max { x.z() } else { max });
// If the maximum z value is less than zero, all vertices are behind the camera
max_z < 0.0
} | fn triangle_behind_cam(triangle: [Vec3; 3]) -> bool { | random_line_split |
lib.rs | use bevy::{
prelude::*,
render::camera::Camera,
render::color::Color,
render::mesh::{VertexAttribute, VertexAttributeValues},
render::pipeline::PrimitiveTopology,
window::CursorMoved,
};
pub struct PickingPlugin;
impl Plugin for PickingPlugin {
fn build(&self, app: &mut AppBuilder) {
... | (&self) -> &Vec<PickIntersection> {
&self.ordered_pick_list
}
pub fn top(&self) -> &Option<PickIntersection> {
&self.topmost_pick
}
}
impl Default for PickState {
fn default() -> Self {
PickState {
cursor_event_reader: EventReader::default(),
ordered_pick... | list | identifier_name |
lib.rs | use bevy::{
prelude::*,
render::camera::Camera,
render::color::Color,
render::mesh::{VertexAttribute, VertexAttributeValues},
render::pipeline::PrimitiveTopology,
window::CursorMoved,
};
pub struct PickingPlugin;
impl Plugin for PickingPlugin {
fn build(&self, app: &mut AppBuilder) {
... | else {
*current_color = initial_color;
}
}
// Query highlightable entities that have changed
for (mut highlightable, _pickable, material_handle, entity) in &mut query_picked.iter() {
let current_color = &mut materials.get_mut(material_handle).unwrap().albedo;
let initia... | {
*current_color = highlight_params.selection_color;
} | conditional_block |
lib.rs | // Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any late... |
}
/// A per-relay-parent job for the provisioning subsystem.
pub struct ProvisioningJob {
relay_parent: Hash,
receiver: mpsc::Receiver<ProvisionerMessage>,
backed_candidates: Vec<CandidateReceipt>,
signed_bitfields: Vec<SignedAvailabilityBitfield>,
metrics: Metrics,
inherent_after: InherentAfter,
awaiting_inhe... | {
match *self {
InherentAfter::Ready => {
// Make sure we never end the returned future.
// This is required because the `select!` that calls this future will end in a busy loop.
futures::pending!()
},
InherentAfter::Wait(ref mut d) => {
d.await;
*self = InherentAfter::Ready;
},
}
} | identifier_body |
lib.rs | // Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any late... | for bitfield in bitfields {
let validator_idx = bitfield.validator_index().0 as usize;
match availability.get_mut(validator_idx) {
None => {
// in principle, this function might return a `Result<bool, Error>` so that we can more clearly express this error condition
// however, in practice, that would ju... | ) -> bool {
let mut availability = availability.clone();
let availability_len = availability.len();
| random_line_split |
lib.rs | // Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any late... | (
relay_parent: Hash,
metrics: Metrics,
receiver: mpsc::Receiver<ProvisionerMessage>,
) -> Self {
Self {
relay_parent,
receiver,
backed_candidates: Vec::new(),
signed_bitfields: Vec::new(),
metrics,
inherent_after: InherentAfter::new_from_now(),
awaiting_inherent: Vec::new(),
}
}
asyn... | new | identifier_name |
lib.rs | // Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any late... |
}
#[tracing::instrument(level = "trace", skip(self), fields(subsystem = LOG_TARGET))]
fn note_provisionable_data(&mut self, span: &jaeger::Span, provisionable_data: ProvisionableData) {
match provisionable_data {
ProvisionableData::Bitfield(_, signed_bitfield) => {
self.signed_bitfields.push(signed_bitfie... | {
self.metrics.on_inherent_data_request(Ok(()));
} | conditional_block |
types.rs | use crate::{encode_section, Encode, Section, SectionId};
/// Represents a subtype of possible other types in a WebAssembly module.
#[derive(Debug, Clone)]
pub struct SubType {
/// Is the subtype final.
pub is_final: bool, | pub structural_type: StructuralType,
}
/// Represents a structural type in a WebAssembly module.
#[derive(Debug, Clone)]
pub enum StructuralType {
/// The type is for a function.
Func(FuncType),
/// The type is for an array.
Array(ArrayType),
/// The type is for a struct.
Struct(StructType)... | /// The list of supertype indexes. As of GC MVP, there can be at most one supertype.
pub supertype_idx: Option<u32>,
/// The structural type of the subtype. | random_line_split |
types.rs | use crate::{encode_section, Encode, Section, SectionId};
/// Represents a subtype of possible other types in a WebAssembly module.
#[derive(Debug, Clone)]
pub struct SubType {
/// Is the subtype final.
pub is_final: bool,
/// The list of supertype indexes. As of GC MVP, there can be at most one supertype.
... | {
/// The `i8` type.
I8,
/// The `i16` type.
I16,
/// A value type.
Val(ValType),
}
/// The type of a core WebAssembly value.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Ord, PartialOrd)]
pub enum ValType {
/// The `i32` type.
I32,
/// The `i64` type.
I64,
/// The `f3... | StorageType | identifier_name |
types.rs | use crate::{encode_section, Encode, Section, SectionId};
/// Represents a subtype of possible other types in a WebAssembly module.
#[derive(Debug, Clone)]
pub struct SubType {
/// Is the subtype final.
pub is_final: bool,
/// The list of supertype indexes. As of GC MVP, there can be at most one supertype.
... |
/// Define an explicit subtype in this type section.
pub fn subtype(&mut self, ty: &SubType) -> &mut Self {
// In the GC spec, supertypes is a vector, not an option.
let st = match ty.supertype_idx {
Some(idx) => vec![idx],
None => vec![],
};
if ty.is_fi... | {
self.bytes.push(0x5f);
fields.len().encode(&mut self.bytes);
for f in fields.iter() {
self.field(&f.element_type, f.mutable);
}
self.num_added += 1;
self
} | identifier_body |
bid.rs | //! Auctions and bidding during the first phase of the deal.
use std::fmt;
use std::str::FromStr;
use serde::{Deserialize, Serialize};
use strum_macros::EnumIter;
use super::cards;
use super::deal;
use super::pos;
/// Goal set by a contract.
///
/// Determines the winning conditions and the score on success.
#[deriv... | (&self) -> &Vec<cards::Hand> {
&self.players
}
/// The current player passes his turn.
///
/// Returns the new auction state :
///
/// * `AuctionState::Cancelled` if all players passed
/// * `AuctionState::Over` if 5 players passed in a row
/// * The previous state otherwise
... | hands | identifier_name |
bid.rs | //! Auctions and bidding during the first phase of the deal.
use std::fmt;
use std::str::FromStr;
use serde::{Deserialize, Serialize};
use strum_macros::EnumIter;
use super::cards;
use super::deal;
use super::pos;
/// Goal set by a contract.
///
/// Determines the winning conditions and the score on success.
#[deriv... |
Ok(())
}
fn get_player_status(&self, pos: pos::PlayerPos) -> BidStatus {
self.players_status[pos.to_n()]
}
fn set_player_status(&mut self, pos: pos::PlayerPos, status: BidStatus) {
self.players_status[pos.to_n()] = status;
}
/// Returns the player that is expected to... | {
if target.multiplier() <= contract.target.multiplier() {
return Err(BidError::NonRaisedTarget);
}
} | conditional_block |
bid.rs | //! Auctions and bidding during the first phase of the deal.
use std::fmt;
use std::str::FromStr;
use serde::{Deserialize, Serialize};
use strum_macros::EnumIter;
use super::cards;
use super::deal;
use super::pos;
/// Goal set by a contract.
///
/// Determines the winning conditions and the score on success.
#[deriv... |
}
impl Auction {
/// Starts a new auction, starting with the player `first`.
pub fn new(first: pos::PlayerPos) -> Self {
let count = first.count as usize;
let (hands, dog) = super::deal_hands(count);
Auction {
contract: None,
players_status: vec![BidStatus::Todo... | {
match *self {
BidError::AuctionClosed => write!(f, "auctions are closed"),
BidError::TurnError => write!(f, "invalid turn order"),
BidError::NonRaisedTarget => write!(f, "bid must be higher than current contract"),
BidError::AuctionRunning => write!(f, "the auct... | identifier_body |
bid.rs | //! Auctions and bidding during the first phase of the deal.
use std::fmt;
use std::str::FromStr;
use serde::{Deserialize, Serialize};
use strum_macros::EnumIter;
use super::cards;
use super::deal;
use super::pos;
/// Goal set by a contract.
///
/// Determines the winning conditions and the score on success.
#[deriv... |
let contract = Contract::new(pos, target, slam);
self.contract = Some(contract);
self.set_player_status(pos, BidStatus::Bid);
// If we're all the way to the top, there's nowhere else to go
if self.no_player_left() || target == Target::GardeContre {
self.state = Auct... |
// Reset previous bidder status
if let Some(contract) = self.contract.clone() {
self.set_player_status(contract.author, BidStatus::Todo);
} | random_line_split |
mod.rs | caller
/// cannot know ahead of time which type to use, `peek_message_type` can be used
/// to peek at the header first to figure out which static type should be used
/// in a subsequent call to `parse`.
///
/// Note that `peek_message_type` only inspects certain fields in the header,
/// and so `peek_message_type` su... |
c.add_bytes(&[header.prefix.msg_type, header.prefix.code]);
c.add_bytes(&header.prefix.checksum);
c.add_bytes(header.message.as_bytes());
for p in message_body.iter_fragments() {
c.add_bytes(p);
}
Some(c.checksum())
}
impl<I: IcmpIpExt, B: ByteSlice, M: IcmpMessage<I, B>> IcmpPacket<I,... | {
c.add_bytes(src_ip.bytes());
c.add_bytes(dst_ip.bytes());
let icmpv6_len = mem::size_of::<Header<M>>() + message_body.len();
let mut len_bytes = [0; 4];
NetworkEndian::write_u32(&mut len_bytes, icmpv6_len.try_into().ok()?);
c.add_bytes(&len_bytes[..]);
c.add_byt... | conditional_block |
mod.rs | caller
/// cannot know ahead of time which type to use, `peek_message_type` can be used
/// to peek at the header first to figure out which static type should be used
/// in a subsequent call to `parse`.
///
/// Note that `peek_message_type` only inspects certain fields in the header,
/// and so `peek_message_type` su... | <S: Into<A>, D: Into<A>>(src_ip: S, dst_ip: D) -> IcmpParseArgs<A> {
IcmpParseArgs { src_ip: src_ip.into(), dst_ip: dst_ip.into() }
}
}
impl<B: ByteSlice, I: IcmpIpExt, M: IcmpMessage<I, B>> ParsablePacket<B, ()>
for IcmpPacketRaw<I, B, M>
{
type Error = ParseError;
fn parse_metadata(&self) ->... | new | identifier_name |
mod.rs | so the caller
/// cannot know ahead of time which type to use, `peek_message_type` can be used
/// to peek at the header first to figure out which static type should be used
/// in a subsequent call to `parse`.
///
/// Note that `peek_message_type` only inspects certain fields in the header,
/// and so `peek_message_t... | ParseMetadata::from_packet(self.header.bytes().len(), self.message_body.len(), 0)
}
fn parse<BV: BufferView<B>>(buffer: BV, args: IcmpParseArgs<I::Addr>) -> ParseResult<Self> {
IcmpPacketRaw::parse(buffer, ()).and_then(|p| IcmpPacket::try_from_raw_with(p, args))
}
}
impl<I: IcmpIpExt, B: B... | {
type Error = ParseError;
fn parse_metadata(&self) -> ParseMetadata { | random_line_split |
remote_cache.rs | use std::collections::{BTreeMap, HashSet, VecDeque};
use std::ffi::OsString;
use std::path::Component;
use std::sync::Arc;
use std::time::Instant;
use async_trait::async_trait;
use bazel_protos::gen::build::bazel::remote::execution::v2 as remexec;
use bazel_protos::require_digest;
use fs::RelativePath;
use futures::Fu... | else {
tree.children.push(directory)
}
}
Ok(Some(tree))
}
pub(crate) async fn extract_output_file(
root_directory_digest: Digest,
file_path: RelativePath,
store: &Store,
) -> Result<Option<FileNode>, String> {
// Traverse down from the root directory digest to find the dir... | {
tree.root = Some(directory);
} | conditional_block |
remote_cache.rs | use std::collections::{BTreeMap, HashSet, VecDeque};
use std::ffi::OsString;
use std::path::Component;
use std::sync::Arc;
use std::time::Instant;
use async_trait::async_trait;
use bazel_protos::gen::build::bazel::remote::execution::v2 as remexec;
use bazel_protos::require_digest;
use fs::RelativePath;
use futures::Fu... |
Ok(())
}
fn log_cache_error(&self, err: String, err_type: CacheErrorType) {
let err_count = {
let mut errors_counter = match err_type {
CacheErrorType::ReadError => self.read_errors_counter.lock(),
CacheErrorType::WriteError => self.write_errors_counter.lock(),
};
let cou... | .map_err(status_to_str)?; | random_line_split |
remote_cache.rs | use std::collections::{BTreeMap, HashSet, VecDeque};
use std::ffi::OsString;
use std::path::Component;
use std::sync::Arc;
use std::time::Instant;
use async_trait::async_trait;
use bazel_protos::gen::build::bazel::remote::execution::v2 as remexec;
use bazel_protos::require_digest;
use fs::RelativePath;
use futures::Fu... | (&self, req: &MultiPlatformProcess) -> Option<Process> {
self.underlying.extract_compatible_request(req)
}
}
| extract_compatible_request | identifier_name |
bare_index.rs | /// Creates a bare index from a provided URL, opening the same location on
/// disk that cargo uses for that registry index.
pub fn from_url(url: &str) -> Result<Self, Error> {
let (dir_name, canonical_url) = url_to_local_dir(url)?;
let mut path = home::cargo_home().unwrap_or_default();
... | (&mut self) -> Result<(), Error> {
{
let mut origin_remote = self
.rt
.repo
.find_remote("origin")
.or_else(|_| self.rt.repo.remote_anonymous(&self.inner.url))?;
origin_remote.fetch(
&[
"HEAD... | retrieve | identifier_name |
bare_index.rs |
path.push("registry/index");
path.push(dir_name);
Ok(Self {
path,
url: canonical_url,
})
}
/// Creates a bare index at the provided path with the specified repository URL.
#[inline]
pub fn with_path(path: PathBuf, url: &str) -> Self {
Se... | {
let krate = repo
.crate_("sval")
.expect("Could not find the crate sval in the index");
let version = krate
.versions()
.iter()
.find(|v| v.version() == "0.0.1")
.expect("Version 0.0.1 of sval does... | identifier_body | |
bare_index.rs | /// Creates a bare index from a provided URL, opening the same location on
/// disk that cargo uses for that registry index.
pub fn from_url(url: &str) -> Result<Self, Error> {
let (dir_name, canonical_url) = url_to_local_dir(url)?;
let mut path = home::cargo_home().unwrap_or_default();
... | pub fn with_path(path: PathBuf, url: &str) -> Self {
Self {
path,
url: url.to_owned(),
}
}
/// Creates an index for the default crates.io registry, using the same
/// disk location as cargo itself.
#[inline]
pub fn new_cargo_default() -> Self {
//... | /// Creates a bare index at the provided path with the specified repository URL.
#[inline] | random_line_split |
encode.rs | use std::collections::{HashMap, HashSet, BTreeMap};
use std::fmt;
use std::str::FromStr;
use regex::Regex;
use rustc_serialize::{Encodable, Encoder, Decodable, Decoder};
use package::Package;
use package_id::PackageId;
use source::SourceId;
use util::{CraftResult, Graph, Config, internal, ChainError, CraftError};
use... | {
let source = if id.source_id().is_path() {
None
} else {
Some(id.source_id().with_precise(None))
};
EncodablePackageId {
name: id.name().to_string(),
version: id.version().to_string(),
source: source,
}
} | identifier_body | |
encode.rs | use std::collections::{HashMap, HashSet, BTreeMap};
use std::fmt;
use std::str::FromStr;
use regex::Regex;
use rustc_serialize::{Encodable, Encoder, Decodable, Decoder};
use package::Package;
use package_id::PackageId;
use source::SourceId;
use util::{CraftResult, Graph, Config, internal, ChainError, CraftError};
use... | (s: &str) -> CraftResult<EncodablePackageId> {
let regex = Regex::new(r"^([^ ]+) ([^ ]+)(?: \(([^\)]+)\))?$").unwrap();
let captures = regex.captures(s).ok_or_else(|| internal("invalid serialized PackageId"))?;
let name = captures.at(1).unwrap();
let version = captures.at(2).unwrap();
... | from_str | identifier_name |
encode.rs | use std::collections::{HashMap, HashSet, BTreeMap};
use std::fmt;
use std::str::FromStr;
use regex::Regex;
use rustc_serialize::{Encodable, Encoder, Decodable, Decoder};
use package::Package;
use package_id::PackageId;
use source::SourceId;
use util::{CraftResult, Graph, Config, internal, ChainError, CraftError};
use... | }
}
}
g
};
let replacements = {
let mut replacements = HashMap::new();
for &(ref id, ref pkg) in live_pkgs.values() {
if let Some(ref replace) = pkg.replace {
assert!(pkg.dependencies... | for edge in deps.iter() {
if let Some(to_depend_on) = lookup_id(edge)? {
g.link(id.clone(), to_depend_on); | random_line_split |
technique.rs | use serde::{Deserialize, Serialize};
use serde_json::Value;
use crate::error::*;
use std::fs;
use std::path::Path;
use regex::Regex;
use lazy_static::lazy_static;
use toml;
use nom::combinator::*;
use nom::sequence::*;
use nom::bytes::complete::*;
use nom::character::complete::*;
use nom::branch::alt;
use nom::multi::m... | (json_file: &Path, rl_file: &Path) -> Result<()> {
let config_data = fs::read_to_string("data/config.toml").expect("Cannot read config.toml file");
let config: toml::Value = toml::from_str(&config_data).expect("Invalig config.toml file");
// we use if let for error conversion
// we don't use match for ... | translate_file | identifier_name |
technique.rs | use serde::{Deserialize, Serialize};
use serde_json::Value;
use crate::error::*;
use std::fs;
use std::path::Path;
use regex::Regex;
use lazy_static::lazy_static;
use toml;
use nom::combinator::*;
use nom::sequence::*;
use nom::bytes::complete::*;
use nom::character::complete::*;
use nom::branch::alt;
use nom::multi::m... |
fn translate_arg(config: &toml::Value, arg: &str) -> Result<String> {
let var = match parse_cfstring(arg) {
Err(_) => return Err(Error::User(format!("Invalid variable syntax in '{}'", arg))),
Ok((_,o)) => o
};
map_strings_results(var.iter(), |x| Ok(format!("\"{}\"",x.to_string()?)), ",")
}... | // empty string
value(vec![CFStringElt::Static("".into())], not(anychar)),
))
)(i)
} | random_line_split |
SignalDef.rs | /* Return frame for iretq */
pub rip: u64,
pub cs: u64,
pub eflags: u64,
pub rsp: u64,
pub ss: u64,
/* top of stack page */
}
impl PtRegs {
pub fn Set(&mut self, ctx: &SigContext) {
self.r15 = ctx.r15;
self.r14 = ctx.r14;
self.r13 = ctx.r13;
self.r12 = ct... |
}
return 64
}
pub fn MakeSignalSet(sigs: &[Signal]) -> Self {
let mut res = Self::default();
for sig in sigs {
res.Add(*sig)
}
return res;
}
pub fn ForEachSignal(&self, mut f: impl FnMut(Signal)) {
for i in 0..64 {
if s... | {
return idx
} | conditional_block |
SignalDef.rs | /* Return frame for iretq */
pub rip: u64,
pub cs: u64,
pub eflags: u64,
pub rsp: u64,
pub ss: u64,
/* top of stack page */
}
impl PtRegs {
pub fn Set(&mut self, ctx: &SigContext) {
self.r15 = ctx.r15;
self.r14 = ctx.r14;
self.r13 = ctx.r13;
self.r12 = ct... | (sig: Signal) -> Self {
return SignalSet(1 << sig.Index())
}
pub fn Add(&mut self, sig: Signal) {
self.0 |= 1 << sig.Index()
}
pub fn Remove(&mut self, sig: Signal) {
self.0 &=!(1 << sig.0)
}
pub fn TailingZero(&self) -> usize {
for i in 0..64 {
let... | New | identifier_name |
SignalDef.rs |
/* Return frame for iretq */
pub rip: u64, | pub rsp: u64,
pub ss: u64,
/* top of stack page */
}
impl PtRegs {
pub fn Set(&mut self, ctx: &SigContext) {
self.r15 = ctx.r15;
self.r14 = ctx.r14;
self.r13 = ctx.r13;
self.r12 = ctx.r12;
self.rbp = ctx.rbp;
self.rbx = ctx.rbx;
self.r11 = ctx.r11... | pub cs: u64,
pub eflags: u64, | random_line_split |
SignalDef.rs | .field("Signo", &self.Signo)
.field("Errno", &self.Errno)
.field("Code", &self.Code)
.finish()
}
}
impl SignalInfo {
pub fn SignalInfoPriv(sig: Signal) -> Self {
return Self {
Signo: sig.0,
Code: Self::SIGNAL_INFO_KERNEL,
..Default:... | {
let mask : SigMask = task.CopyInObj(addr)?;
return Ok((mask.addr, mask.len))
} | identifier_body | |
lib.rs | , event: Self::TimerEvent);
fn access_device(&mut self) -> &mut Device;
}
pub struct MinstrelTimer {
timer: wlan_common::timer::Timer<()>,
current_timer: Option<common::timer::EventId>,
}
impl minstrel::TimerManager for MinstrelTimer {
fn schedule(&mut self, from_now: Duration) {
self.current_... |
const MINSTREL_UPDATE_INTERVAL: std::time::Duration = std::time::Duration::from_millis(100);
// Remedy for fxbug.dev/8165 (fxbug.dev/33151)
// See |DATA_FRAME_INTERVAL_NANOS|
// in //src/connectivity/wlan/testing/hw-sim/test/rate_selection/src/lib.rs
// Ensure at least one probe frame (generated every 16 data frames)... | {
mac_sublayer.device.tx_status_report_supported && !mac_sublayer.rate_selection_offload.supported
} | identifier_body |
lib.rs | t mode.
// TODO(fxbug.dev/45464): Remove when tests are all in Rust.
pub fn advance_fake_time(&mut self, nanos: i64) {
match &mut self.internal {
Some(MlmeHandleInternal::Real {.. }) => {
panic!("Called advance_fake_time on a real MLME")
}
Some(MlmeHa... | handle_eth_frame_tx | identifier_name | |
lib.rs | , event: Self::TimerEvent);
fn access_device(&mut self) -> &mut Device;
}
pub struct MinstrelTimer {
timer: wlan_common::timer::Timer<()>,
current_timer: Option<common::timer::EventId>,
}
impl minstrel::TimerManager for MinstrelTimer {
fn schedule(&mut self, from_now: Duration) {
self.current_... |
};
let channel = zx::Channel::from(mlme_protocol_handle_via_iface_creation);
let server = fidl::endpoints::ServerEnd::<fidl_mlme::MlmeMarker>::new(channel);
let (mlme_request_stream, control_handle) = match server.into_stream_and_control_handle() {
Ok(res) => res,
... | {
// Failure to unwrap indicates a critical failure in the driver init thread.
startup_sender.send(Err(anyhow!("device.start failed: {}", e))).unwrap();
return;
} | conditional_block |
lib.rs | EventId, event: Self::TimerEvent);
fn access_device(&mut self) -> &mut Device;
}
pub struct MinstrelTimer {
timer: wlan_common::timer::Timer<()>,
current_timer: Option<common::timer::EventId>,
}
impl minstrel::TimerManager for MinstrelTimer {
fn schedule(&mut self, from_now: Duration) {
self.c... | startup_receiver
.try_recv()
.unwrap()
.expect("Test MLME setup stalled.")
.expect("Test MLME setup failed.");
MlmeHandle {
driver_event_sink,
internal: Some(MlmeHandleInternal::Fake { executor, future }),
}
}
async fn... | ));
let _ = executor.run_until_stalled(&mut future.as_mut()); | random_line_split |
lib.rs | // Copyright (C) 2021 Subspace Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
// 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
//
// Unle... | (&self) -> Weight {
T::WeightInfo::message()
}
fn message_response(
&self,
dst_chain_id: ChainId,
message_id: MessageIdOf<T>,
req: EndpointRequest,
resp: EndpointResponse,
) -> DispatchResult {
// ensure request... | message_weight | identifier_name |
lib.rs | // Copyright (C) 2021 Subspace Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
// 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
//
// Unle... | ChainId,
Identity,
MessageIdOf<T>,
Transfer<BalanceOf<T>>,
OptionQuery,
>;
/// Events emitted by pallet-transporter.
#[pallet::event]
#[pallet::generate_deposit(pub (super) fn deposit_event)]
pub enum Event<T: Config> {
/// Emits when there is a new o... | _,
Identity, | random_line_split |
local.rs | use super::{EntryType, ShrinkBehavior, GIGABYTES};
use std::collections::BinaryHeap;
use std::path::Path;
use std::sync::Arc;
use std::time::{self, Duration};
use bytes::Bytes;
use digest::{Digest as DigestTrait, FixedOutput};
use futures::future;
use hashing::{Digest, Fingerprint, EMPTY_DIGEST};
use lmdb::Error::Not... |
}).await
}
pub fn all_digests(&self, entry_type: EntryType) -> Result<Vec<Digest>, String> {
let database = match entry_type {
EntryType::File => self.inner.file_dbs.clone(),
EntryType::Directory => self.inner.directory_dbs.clone(),
};
let mut digests = vec![];
for &(ref env, ref d... | {
Err(format!("Got hash collision reading from store - digest {:?} was requested, but retrieved bytes with that fingerprint had length {}. Congratulations, you may have broken sha256! Underlying bytes: {:?}", digest, bytes.len(), bytes))
} | conditional_block |
local.rs | use super::{EntryType, ShrinkBehavior, GIGABYTES};
use std::collections::BinaryHeap;
use std::path::Path;
use std::sync::Arc;
use std::time::{self, Duration};
use bytes::Bytes;
use digest::{Digest as DigestTrait, FixedOutput};
use futures::future;
use hashing::{Digest, Fingerprint, EMPTY_DIGEST};
use lmdb::Error::Not... | .begin_rw_txn()
.and_then(|mut txn| {
let key = VersionedFingerprint::new(
aged_fingerprint.fingerprint,
ShardedLmdb::schema_version(),
);
txn.del(database, &key, None)?;
txn
.del(lease_database, &key, None)
... | env | random_line_split |
local.rs | use super::{EntryType, ShrinkBehavior, GIGABYTES};
use std::collections::BinaryHeap;
use std::path::Path;
use std::sync::Arc;
use std::time::{self, Duration};
use bytes::Bytes;
use digest::{Digest as DigestTrait, FixedOutput};
use futures::future;
use hashing::{Digest, Fingerprint, EMPTY_DIGEST};
use lmdb::Error::Not... | <T: Send +'static, F: Fn(&[u8]) -> T + Send + Sync +'static>(
&self,
entry_type: EntryType,
digest: Digest,
f: F,
) -> Result<Option<T>, String> {
if digest == EMPTY_DIGEST {
// Avoid I/O for this case. This allows some client-provided operations (like merging
// snapshots) to work wit... | load_bytes_with | identifier_name |
runtime.rs | //#![allow(dead_code)]
use std::sync::{Arc};
use std::path::{PathBuf};
use cgmath::{Vector2, Point2};
use input::{Input, Button, Key, ButtonState, ButtonArgs};
use window::{Window, WindowSettings};
use slog::{Logger};
use calcium_flowy::FlowyRenderer;
use flowy::{Ui, Element};
use flowy::style::{Style, Position, Size... |
}
pub fn render(&mut self, batches: &mut Vec<RenderBatch<R>>) {
//let mut batches = Vec::new();
let mut normaltexture = RenderBatch::new(
ShaderMode::Texture(self.tex.clone()), UvMode::YDown
);
normaltexture.push_rectangle_full_texture(
// position is cen... | {
if pinput.w {self.position.y -= self.speed * delta;}
if pinput.a {self.position.x -= self.speed * delta;}
if pinput.s {self.position.y += self.speed * delta;}
if pinput.d {self.position.x += self.speed * delta;}
} | conditional_block |
runtime.rs | //#![allow(dead_code)]
use std::sync::{Arc};
use std::path::{PathBuf};
use cgmath::{Vector2, Point2};
use input::{Input, Button, Key, ButtonState, ButtonArgs};
use window::{Window, WindowSettings};
use slog::{Logger};
use calcium_flowy::FlowyRenderer;
use flowy::{Ui, Element};
use flowy::style::{Style, Position, Size... | (&mut self) -> Point2<f32> {
self.position
}
pub fn get_name(&mut self) -> &String {
&self.name
}
}
struct PlayerInput {
pub w: bool,
pub a: bool,
pub s: bool,
pub d: bool,
pub tab: bool,
}
pub struct StaticRuntime {
pub log: Logger,
}
impl Runtime for StaticRuntim... | get_position | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.