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 |
|---|---|---|---|---|
main.rs | fn main() {
//Rust deals with stack and heaps for memory managment no gc or direct memory management
//The stack memory is a first in last off type queue
//Stack data must take up a known and fixed size
//In rust the heap is used for when we don't know the size of the vector at compile time
//or if ... | {
some_string.push_str(", world");
}
//The below code creates a dangling pointer/reference.
//So when the data goes out of scope at the end of the function
//our reference now points to memory that has been freed.
//The compiler catches this and errors out on us.
// fn dangle() -> &String {
// let s = String:... | tring) | identifier_name |
main.rs | fn main() {
//Rust deals with stack and heaps for memory managment no gc or direct memory management
//The stack memory is a first in last off type queue
//Stack data must take up a known and fixed size
//In rust the heap is used for when we don't know the size of the vector at compile time
//or if ... |
//Note: In C++, this pattern of deallocating resources at the end of an item’s lifetime is sometimes
//called Resource Acquisition Is Initialization (RAII). The drop function in Rust will be familiar
//to you if you’ve used RAII patterns.
let x = 5;
let y = x;// y is just a copy of x since they ... |
println!("{}", s); | random_line_split |
mod.rs | // Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity Ethereum.
// Parity Ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or |
// Parity Ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
... | // (at your option) any later version. | random_line_split |
mod.rs | // Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity Ethereum.
// Parity Ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at yo... | (&self) -> &Self::Target {
match *self {
WithToken::No(ref v) => v,
WithToken::Yes(ref v, _) => v,
}
}
}
impl<T: Debug> WithToken<T> {
/// Map the value with the given closure, preserving the token.
pub fn map<S, F>(self, f: F) -> WithToken<S> where
S: Debug,
F: FnOnce(T) -> S,
{
match self {
Wi... | deref | identifier_name |
mod.rs | use std::collections::{HashMap, HashSet};
use std::process::exit;
use ansi_term::Colour::{Red, Green, Cyan};
use petgraph::{
graph::{EdgeIndex, NodeIndex},
Directed, Graph, Incoming, Outgoing,
};
/// The edge of a DelfGraph is a DelfEdge
pub mod edge;
/// The node of a DelfGraph is a DelfObject
pub mod object... | (&self, object_name: &String) -> &object::DelfObject {
let object_id = self.nodes.get(object_name).unwrap();
return self.graph.node_weight(*object_id).unwrap();
}
/// Given the object name and the id of the instance, delete the object
pub fn delete_object(&self, object_name: &String, id: &S... | get_object | identifier_name |
mod.rs | use std::collections::{HashMap, HashSet};
use std::process::exit;
use ansi_term::Colour::{Red, Green, Cyan};
use petgraph::{
graph::{EdgeIndex, NodeIndex},
Directed, Graph, Incoming, Outgoing,
};
/// The edge of a DelfGraph is a DelfEdge
pub mod edge;
/// The node of a DelfGraph is a DelfObject
pub mod object... | for (_, node_id) in self.nodes.iter() {
let obj = self.graph.node_weight(*node_id).unwrap();
match obj.deletion {
object::DeleteType::ShortTTL
| object::DeleteType::Directly
| object::DeleteType::DirectlyOnly
| object::Delet... | // Starting from a directly deletable (or excepted) node, ensure all ndoes are reached.
fn reachability_analysis(&self) -> Result<(), String> {
let mut visited_nodes = HashSet::new(); | random_line_split |
mod.rs | use std::collections::{HashMap, HashSet};
use std::process::exit;
use ansi_term::Colour::{Red, Green, Cyan};
use petgraph::{
graph::{EdgeIndex, NodeIndex},
Directed, Graph, Incoming, Outgoing,
};
/// The edge of a DelfGraph is a DelfEdge
pub mod edge;
/// The node of a DelfGraph is a DelfObject
pub mod object... | edges_to_insert.push((obj_name.clone(), delf_edge));
}
}
// add all the edges to the graph
for (from, e) in edges_to_insert.iter_mut() {
if!nodes.contains_key(&e.to.object_type) {
eprintln!("Error creating edge {:#?}: No object with name {... | {
let schema = &yamls.schema;
let config = &yamls.config;
let mut edges_to_insert = Vec::new();
let mut nodes = HashMap::<String, NodeIndex>::new();
let mut edges = HashMap::<String, EdgeIndex>::new();
let mut graph = Graph::<object::DelfObject, edge::DelfEdge>::new();
... | identifier_body |
context.rs | // Copyright (C) 2018-2020 Sebastian Dröge <sebastian@centricular.com>
// Copyright (C) 2019-2022 François Laignel <fengalin@free.fr>
//
// Take a look at the license at the top of the repository in the LICENSE file.
use futures::prelude::*;
use gst::glib::once_cell::sync::Lazy;
use std::collections::HashMap;
use st... | /// of a [`Context`].
///
/// # Panic
///
/// This will block current thread and would panic if run
/// from the [`Context`].
#[track_caller]
pub fn enter<'a, F, O>(&'a self, f: F) -> O
where
F: FnOnce() -> O + Send + 'a,
O: Send + 'a,
{
if let Some(cur) =... |
/// Executes the provided function relatively to this [`Context`].
///
/// Usefull to initialize i/o sources and timers from outside | random_line_split |
context.rs | // Copyright (C) 2018-2020 Sebastian Dröge <sebastian@centricular.com>
// Copyright (C) 2019-2022 François Laignel <fengalin@free.fr>
//
// Take a look at the license at the top of the repository in the LICENSE file.
use futures::prelude::*;
use gst::glib::once_cell::sync::Lazy;
use std::collections::HashMap;
use st... | } else {
gst::debug!(RUNTIME_CAT, "Entering Context {}", self.name());
}
self.0.enter(f)
}
pub fn spawn<Fut>(&self, future: Fut) -> JoinHandle<Fut::Output>
where
Fut: Future + Send +'static,
Fut::Output: Send +'static,
{
self.0.spawn(future)
... | gst::warning!(
RUNTIME_CAT,
"Entering Context {} within {}",
self.name(),
cur.name()
);
}
| conditional_block |
context.rs | // Copyright (C) 2018-2020 Sebastian Dröge <sebastian@centricular.com>
// Copyright (C) 2019-2022 François Laignel <fengalin@free.fr>
//
// Take a look at the license at the top of the repository in the LICENSE file.
use futures::prelude::*;
use gst::glib::once_cell::sync::Lazy;
use std::collections::HashMap;
use st... |
pub fn spawn<Fut>(&self, future: Fut) -> JoinHandle<Fut::Output>
where
Fut: Future + Send +'static,
Fut::Output: Send +'static,
{
self.0.spawn(future)
}
pub fn spawn_and_unpark<Fut>(&self, future: Fut) -> JoinHandle<Fut::Output>
where
Fut: Future + Send +'static... | if let Some(cur) = Context::current().as_ref() {
if cur == self {
panic!(
"Attempt to enter Context {} within itself, this would deadlock",
self.name()
);
} else {
gst::warning!(
R... | identifier_body |
context.rs | // Copyright (C) 2018-2020 Sebastian Dröge <sebastian@centricular.com>
// Copyright (C) 2019-2022 François Laignel <fengalin@free.fr>
//
// Take a look at the license at the top of the repository in the LICENSE file.
use futures::prelude::*;
use gst::glib::once_cell::sync::Lazy;
use std::collections::HashMap;
use st... | andle: Handle) -> Self {
Context(handle)
}
}
#[cfg(test)]
mod tests {
use futures::channel::mpsc;
use futures::lock::Mutex;
use futures::prelude::*;
use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket};
use std::sync::Arc;
use std::time::{Duration, Instant};
use super::supe... | om(h | identifier_name |
google_spreadsheets.rs | use std::collections::{HashMap, HashSet};
use std::convert::TryFrom;
use std::sync::Arc;
use datafusion::arrow::array::{ArrayRef, BooleanArray, PrimitiveArray, StringArray};
use datafusion::arrow::datatypes::{DataType, Field, Schema};
use datafusion::arrow::datatypes::{Float64Type, Int64Type};
use datafusion::arrow::r... |
let uri = URIReference::try_from(uri_str)?;
let spreadsheet_id = uri.path().segments()[2].as_str();
let opt = t
.option
.as_ref()
.ok_or(ColumnQError::MissingOption)?
.as_google_spreadsheet()?;
let token = fetch_auth_token(opt).await?;
let token_str = token.as_str();
... | {
return Err(ColumnQError::InvalidUri(uri_str.to_string()));
} | conditional_block |
google_spreadsheets.rs | use std::collections::{HashMap, HashSet};
use std::convert::TryFrom;
use std::sync::Arc;
use datafusion::arrow::array::{ArrayRef, BooleanArray, PrimitiveArray, StringArray};
use datafusion::arrow::datatypes::{DataType, Field, Schema};
use datafusion::arrow::datatypes::{Float64Type, Int64Type};
use datafusion::arrow::r... | let fields: Vec<Field> = col_names
.iter()
.map(|col_name| {
let set = col_types.entry(col_name).or_insert_with(|| {
// TODO: this should never happen, maybe we should use panic instead?
let mut set = HashSet::new();
set.insert(DataType::Utf8... | random_line_split | |
google_spreadsheets.rs | use std::collections::{HashMap, HashSet};
use std::convert::TryFrom;
use std::sync::Arc;
use datafusion::arrow::array::{ArrayRef, BooleanArray, PrimitiveArray, StringArray};
use datafusion::arrow::datatypes::{DataType, Field, Schema};
use datafusion::arrow::datatypes::{Float64Type, Int64Type};
use datafusion::arrow::r... |
fn coerce_type(l: DataType, r: DataType) -> DataType {
match (l, r) {
(DataType::Boolean, DataType::Boolean) => DataType::Boolean,
(DataType::Date32, DataType::Date32) => DataType::Date32,
(DataType::Date64, DataType::Date64)
| (DataType::Date64, DataType::Date32)
| (DataT... | {
Client::builder()
.build()
.map_err(|e| {
ColumnQError::GoogleSpreadsheets(format!(
"Failed to initialize HTTP client: {}",
e.to_string()
))
})?
.get(url)
.bearer_auth(token)
.send()
.await
.map... | identifier_body |
google_spreadsheets.rs | use std::collections::{HashMap, HashSet};
use std::convert::TryFrom;
use std::sync::Arc;
use datafusion::arrow::array::{ArrayRef, BooleanArray, PrimitiveArray, StringArray};
use datafusion::arrow::datatypes::{DataType, Field, Schema};
use datafusion::arrow::datatypes::{Float64Type, Int64Type};
use datafusion::arrow::r... | (s: &str) -> bool {
s.eq_ignore_ascii_case("true")
}
fn sheet_values_to_record_batch(values: &[Vec<String>]) -> Result<RecordBatch, ColumnQError> {
let schema = infer_schema(values);
let arrays = schema
.fields()
.iter()
.enumerate()
.map(|(i, field)| {
// skip head... | parse_boolean | identifier_name |
pm.rs | //! Implementation of the power manager (PM) peripheral.
use bpm;
use bscif;
use core::cell::Cell;
use core::sync::atomic::Ordering;
use flashcalw;
use gpio;
use kernel::common::VolatileCell;
use scif;
#[repr(C)]
struct PmRegisters { | pbbsel: VolatileCell<u32>,
pbcsel: VolatileCell<u32>,
pbdsel: VolatileCell<u32>,
_reserved2: VolatileCell<u32>,
cpumask: VolatileCell<u32>, // 0x020
hsbmask: VolatileCell<u32>,
pbamask: VolatileCell<u32>,
pbbmask: VolatileCell<u32>,
pbcmask: VolatileCell<u32>,
pbdmask: VolatileCe... | mcctrl: VolatileCell<u32>,
cpusel: VolatileCell<u32>,
_reserved1: VolatileCell<u32>,
pbasel: VolatileCell<u32>, | random_line_split |
pm.rs | //! Implementation of the power manager (PM) peripheral.
use bpm;
use bscif;
use core::cell::Cell;
use core::sync::atomic::Ordering;
use flashcalw;
use gpio;
use kernel::common::VolatileCell;
use scif;
#[repr(C)]
struct PmRegisters {
mcctrl: VolatileCell<u32>,
cpusel: VolatileCell<u32>,
_reserved1: Volati... | {
/// 16 MHz external oscillator
Frequency16MHz,
}
/// Configuration for the startup time of the external oscillator. In practice
/// we have found that some boards work with a short startup time, while others
/// need a slow start in order to properly wake from sleep. In general, we find
/// that for systems... | OscillatorFrequency | identifier_name |
main.rs | exe_name = &format!("local_quadratic_regression{}", ext);
let sep: String = path::MAIN_SEPARATOR.to_string();
let s = r#"
local_quadratic_regression Help
This tool is an implementation of the constrained quadratic regression algorithm
using a flexible window size described in Wood (1996)
The ... | for c in 0..num_cells {
zi = input[((row + dy[c] as isize), (col + dx[c] as isize))];
if zi!= nodata {
xs.push(dx[c] as f64 * resolution);
ys.push(dy[c] as f64 * resolution);
... | let mut zs = vec![];
| random_line_split |
main.rs | keyval = true;
}
let flag_val = vec[0].to_lowercase().replace("--", "-");
if flag_val == "-d" || flag_val == "-dem" {
if keyval {
input_file = vec[1].to_string();
} else {
input_file = args[i + 1].to_string();
}
}... | {
0f64
} | conditional_block | |
main.rs | // The filter dimensions must be odd numbers such that there is a middle pixel
if (filter_size as f64 / 2f64).floor() == (filter_size as f64 / 2f64) {
filter_size += 1;
}
if configurations.verbose_mode {
let welcome_len = format!("* Welcome to {} *", tool_name).len().max(28);
// 2... | min_prof_convexity | identifier_name | |
main.rs | _name = &format!("local_quadratic_regression{}", ext);
let sep: String = path::MAIN_SEPARATOR.to_string();
let s = r#"
local_quadratic_regression Help
This tool is an implementation of the constrained quadratic regression algorithm
using a flexible window size described in Wood (1996)
The foll... | ));
}
for i in 0..args.len() {
let mut arg = args[i].replace("\"", "");
arg = arg.replace("\'", "");
let cmd = arg.split("="); // in case an equals sign was used
let vec = cmd.collect::<Vec<&str>>();
let mut keyval = false;
if vec.len() > 1 {
k... | {
let tool_name = get_tool_name();
let sep: String = path::MAIN_SEPARATOR.to_string();
// Read in the environment variables and get the necessary values
let configurations = whitebox_common::configs::get_configs()?;
let mut working_directory = configurations.working_directory.clone();
if !work... | identifier_body |
mod.rs | mod fifo;
mod background_fifo;
mod sprite_fifo;
use crate::bus::*;
use crate::cpu::{interrupt, InterruptType};
use crate::clock::ClockListener;
use std::fmt;
use std::cell::RefCell;
use std::rc::Rc;
use crate::graphics_driver::GraphicsDriver;
use crate::ppu::background_fifo::BackgroundFifo;
use crate::ppu::sprite_fi... |
self.clock += cycles as u16;
use Mode::*;
match self.mode {
OAM => {
for _ in 0..(cycles << 1) {
self.spfifo.scan_next_oam_table_entry(&self.OAM, &self.registers);
}
if self.clock < OAM_CYCLES {
... | self.registers.dma_counter += 1;
self.registers.dma_active = self.registers.dma_counter < DISPLAY_WIDTH;
} | random_line_split |
mod.rs | mod fifo;
mod background_fifo;
mod sprite_fifo;
use crate::bus::*;
use crate::cpu::{interrupt, InterruptType};
use crate::clock::ClockListener;
use std::fmt;
use std::cell::RefCell;
use std::rc::Rc;
use crate::graphics_driver::GraphicsDriver;
use crate::ppu::background_fifo::BackgroundFifo;
use crate::ppu::sprite_fi... | () -> Self {
Self {
on: false,
mode: Mode::VBlank,
clock: 0,
pixel_buffer: [0x00; PITCH],
palette_buffer: [0xFFFFFF, 0xC0C0C0, 0x404040, 0x000000],
render_flag: true,
VRAM: [0; 0x2000],
OAM: [0; 0x100],
... | new | identifier_name |
metadata.rs | "duration" for clarity.
/// The minimum block size (in inter-channel samples) used in the stream.
///
/// This number is independent of the number of channels. To get the minimum
/// block duration in seconds, divide this by the sample rate.
pub min_block_size: u16,
/// The maximum block size (... | if self.done {
None
} else {
let block = self.read_next();
// After a failure, no more attempts to read will be made,
// because we don't know where we are in the stream.
if !block.is_ok() {
self.done = true;
}
... | identifier_body | |
metadata.rs | Error, Result, fmt_err};
use input::ReadBytes;
use std::str;
use std::slice;
#[derive(Clone, Copy)]
struct MetadataBlockHeader {
is_last: bool,
block_type: u8,
length: u32,
}
/// The streaminfo metadata block, with important information about the stream.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub st... | R) -> MetadataBlockReader<R> {
MetadataBlockReader {
input: input,
done: false,
}
}
#[inline]
fn read_next(&mut self) -> MetadataBlockResult {
let header = try!(read_metadata_block_header(&mut self.input));
let block = try!(read_metadata_block(&mut se... | t: | identifier_name |
metadata.rs | ::{Error, Result, fmt_err};
use input::ReadBytes;
use std::str;
use std::slice;
#[derive(Clone, Copy)]
struct MetadataBlockHeader {
is_last: bool,
block_type: u8,
length: u32,
}
/// The streaminfo metadata block, with important information about the stream.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub... | 2 => {
let (id, data) = try!(read_application_block(input, length));
Ok(MetadataBlock::Application {
id: id,
data: data,
})
}
3 => {
// TODO: implement seektable reading. For now, pretend it is padding.
try!(inp... | try!(read_padding_block(input, length));
Ok(MetadataBlock::Padding { length: length })
}
| conditional_block |
metadata.rs | error::{Error, Result, fmt_err};
use input::ReadBytes;
use std::str;
use std::slice;
#[derive(Clone, Copy)]
struct MetadataBlockHeader {
is_last: bool,
block_type: u8,
length: u32,
}
/// The streaminfo metadata block, with important information about the stream.
#[derive(Clone, Copy, Debug, PartialEq, Eq... | /// The number of padding bytes.
length: u32,
},
/// An application block with application-specific data.
Application {
/// The registered application ID.
id: u32,
/// The contents of the application block.
data: Vec<u8>,
},
/// A seek table block.
... | pub enum MetadataBlock {
/// A stream info block.
StreamInfo(StreamInfo),
/// A padding block (with no meaningful data).
Padding { | random_line_split |
offline_replica.rs | // Copyright 2023 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTI... | (&mut self, entry: &[u8]) -> Result<()> {
let children = self.register.read();
if children.len() > 1 {
return Err(Error::ContentBranchDetected(children));
}
self.write_atop(entry, children.into_iter().map(|(hash, _)| hash).collect())
}
/// Write a new value onto the... | write | identifier_name |
offline_replica.rs | // Copyright 2023 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTI... |
// If not all were Ok, we will return the first error sent to us.
for resp in responses.iter().flatten() {
if let Response::Cmd(CmdResponse::EditRegister(result)) = resp {
result.clone()?;
};
}
// If there were no success or fail to the expected... | {
return Ok(());
} | conditional_block |
offline_replica.rs | // Copyright 2023 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTI... |
/// Return the number of items held in the register
pub fn size(&self) -> u64 {
self.register.size()
}
/// Return a value corresponding to the provided 'hash', if present.
pub fn get(&self, hash: EntryHash) -> Result<&Entry> {
let entry = self.register.get(hash)?;
Ok(entry... | {
self.register.tag()
} | identifier_body |
offline_replica.rs | // Copyright 2023 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTI... | }
self.write_atop(entry, children.into_iter().map(|(hash, _)| hash).collect())
}
/// Write a new value onto the Register atop latest value.
/// If there are branches of content/entries, it automatically merges them
/// all leaving the new value as a single latest value of the Register.... | /// required to merge/resolve the branches, invoke the `write_merging_branches` API.
pub fn write(&mut self, entry: &[u8]) -> Result<()> {
let children = self.register.read();
if children.len() > 1 {
return Err(Error::ContentBranchDetected(children)); | random_line_split |
main.rs | use anyhow::{anyhow, Context};
use atty::Stream;
use rhc::args::Args;
use rhc::config::Config;
use rhc::environment::Environment;
use rhc::files::{get_all_toml_files, load_file};
use rhc::http;
use rhc::interactive;
use rhc::interactive::SelectedValues;
use rhc::keyvalue::KeyValue;
use rhc::request_definition::RequestD... | () -> anyhow::Result<()> {
// CombinedLogger::init(
// vec![
// WriteLogger::new(LevelFilter::Debug, LogConfig::default(), File::create("rhc.log").unwrap()),
// ]
// ).unwrap();
let args: Args = Args::from_args();
let output_file = args
.output_file
.map(|path_... | run | identifier_name |
main.rs | use anyhow::{anyhow, Context};
use atty::Stream;
use rhc::args::Args;
use rhc::config::Config;
use rhc::environment::Environment;
use rhc::files::{get_all_toml_files, load_file};
use rhc::http;
use rhc::interactive;
use rhc::interactive::SelectedValues;
use rhc::keyvalue::KeyValue;
use rhc::request_definition::RequestD... | match &args.file {
Some(path) => {
let def: RequestDefinition =
load_file(&path, RequestDefinition::new, "request definition")?;
let env_path: Option<PathBuf> = args.environment;
let env: Option<Environment> = env_path
... | // the file names for the request definition that's either provided or selected, as well as the
// environment being used (if any), as these are required for the prompt_for_variables
// function.
let result: anyhow::Result<Option<SelectedValues>> = { | random_line_split |
main.rs | use anyhow::{anyhow, Context};
use atty::Stream;
use rhc::args::Args;
use rhc::config::Config;
use rhc::environment::Environment;
use rhc::files::{get_all_toml_files, load_file};
use rhc::http;
use rhc::interactive;
use rhc::interactive::SelectedValues;
use rhc::keyvalue::KeyValue;
use rhc::request_definition::RequestD... |
})?;
// Load the config file using this priority:
// 1. The file specified with the --config arg, if present
// 2. $XDG_CONFIG_HOME/rhc/config.toml, if XDG_CONFIG_HOME is defined
// 3. ~/.config/rhc/config.toml, if present
// If none of the above exist, use the default Config.
let raw_conf... | {
Err(anyhow!("No config file found at `{}`", c.to_string_lossy()))
} | conditional_block |
main.rs | use anyhow::{anyhow, Context};
use atty::Stream;
use rhc::args::Args;
use rhc::config::Config;
use rhc::environment::Environment;
use rhc::files::{get_all_toml_files, load_file};
use rhc::http;
use rhc::interactive;
use rhc::interactive::SelectedValues;
use rhc::keyvalue::KeyValue;
use rhc::request_definition::RequestD... |
type OurTerminal = Terminal<TermionBackend<AlternateScreen<RawTerminal<Stdout>>>>;
/// Set up/create the terminal for use in interactive mode.
fn get_terminal() -> anyhow::Result<OurTerminal> {
let stdout = std::io::stdout().into_raw_mode()?;
let stdout = AlternateScreen::from(stdout);
let backend = Term... | {
if let Err(e) = run() {
// If an error was raised during an interactive mode call while the alternate screen is in
// use, we have to flush stdout here or the user will not see the error message.
std::io::stdout().flush().unwrap();
// Seems like this initial newline is necessary o... | identifier_body |
jwt.rs | , Permission, Result, User};
use crate::application::Config;
const SUPPORTED_ALGORITHMS: [Algorithm; 3] = [Algorithm::RS256, Algorithm::RS384, Algorithm::RS512];
/// JSON Web Key. A cryptographic key used to validate JSON Web Tokens.
#[derive(Debug, PartialEq, Deserialize, Serialize)]
struct Key {
alg: Algorithm,... | .kid
.as_ref()
.ok_or_else(|| Error::Input("Token does not specify the key id".to_string()))?;
let key = self
.jwks
.find(key_id)
.filter(|key| key.alg == header.alg && key.r#use == "sig")
... | jsonwebtoken::decode_header(token).map_err(|err| Error::Input(err.to_string()))?;
let key = match header.alg {
Algorithm::RS256 | Algorithm::RS384 | Algorithm::RS512 => {
let key_id = header | random_line_split |
jwt.rs | Permission, Result, User};
use crate::application::Config;
const SUPPORTED_ALGORITHMS: [Algorithm; 3] = [Algorithm::RS256, Algorithm::RS384, Algorithm::RS512];
/// JSON Web Key. A cryptographic key used to validate JSON Web Tokens.
#[derive(Debug, PartialEq, Deserialize, Serialize)]
struct Key {
alg: Algorithm,
... | (&self, key_id: &str) -> Option<&Key> {
self.keys.iter().find(|key| key.kid == key_id)
}
}
/// A set of values encoded in a JWT that the issuer claims to be true.
#[derive(Debug, Deserialize)]
struct Claims {
/// Audience (who or that the token is intended for). E.g. "https://api.xsnippet.org".
#[a... | find | identifier_name |
jwt.rs | Permission, Result, User};
use crate::application::Config;
const SUPPORTED_ALGORITHMS: [Algorithm; 3] = [Algorithm::RS256, Algorithm::RS384, Algorithm::RS512];
/// JSON Web Key. A cryptographic key used to validate JSON Web Tokens.
#[derive(Debug, PartialEq, Deserialize, Serialize)]
struct Key {
alg: Algorithm,
... | }
alg => return Err(Error::Input(format!("Unsupported algorithm: {:?}", alg))),
};
match jsonwebtoken::decode::<Claims>(token, &key, &self.validation) {
Ok(data) => Ok(User::Authenticated {
name: data.claims.sub,
permissions: data.clai... | {
let header =
jsonwebtoken::decode_header(token).map_err(|err| Error::Input(err.to_string()))?;
let key = match header.alg {
Algorithm::RS256 | Algorithm::RS384 | Algorithm::RS512 => {
let key_id = header
.kid
.as_ref()
... | identifier_body |
patterns.rs | //! This module contains the data pertaining to Noise handshake patterns. For more information on
//! these patterns, consult the
//! [Noise specification](https://noiseprotocol.org/noise.html#handshake-patterns).
use failure::Fail;
use std::str::FromStr;
use HandshakePattern::*;
/// Role in the handshake process.
#[d... |
pattern!(NK {
[],
[S],
...
[E, ES],
[E, EE],
});
pattern!(NX {
[],
[],
...
[E],
[E, EE, S, ES],
});
pattern!(KN {
[S],
[],
...
[E],
[E, EE, SE],
});
pattern!(KK {
... | }); | random_line_split |
patterns.rs | //! This module contains the data pertaining to Noise handshake patterns. For more information on
//! these patterns, consult the
//! [Noise specification](https://noiseprotocol.org/noise.html#handshake-patterns).
use failure::Fail;
use std::str::FromStr;
use HandshakePattern::*;
/// Role in the handshake process.
#[d... | (s: &str) -> Result<Self, Self::Err> {
if s.starts_with("psk") {
let n: u8 = s[3..].parse().map_err(|_| PatternError::InvalidPsk)?;
Ok(Self::Psk(n))
} else if s == "fallback" {
Ok(Self::Fallback)
} else {
Err(PatternError::UnsupportedModifier)
... | from_str | identifier_name |
patterns.rs | //! This module contains the data pertaining to Noise handshake patterns. For more information on
//! these patterns, consult the
//! [Noise specification](https://noiseprotocol.org/noise.html#handshake-patterns).
use failure::Fail;
use std::str::FromStr;
use HandshakePattern::*;
/// Role in the handshake process.
#[d... |
/// Returns the number of psks used in the handshake.
pub fn number_of_psks(&self) -> usize {
self.modifiers
.0
.iter()
.filter(|modifier| {
if let HandshakeModifier::Psk(_) = modifier {
return true;
}
... | {
&self.pattern
} | identifier_body |
lib.rs | //! ZStandard compression format encoder and decoder implemented in pure Rust
//! without unsafe.
// Reference: https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#frame_header
#![doc(
html_logo_url = "https://raw.githubusercontent.com/facebook/zstd/dev/doc/images/zstd_logo86.png",
html_f... | 3 => {
let did = dec.u32()?;
Some(did)
},
_ => unreachable!(),
};
// Check frame content size.
let window_size: u64 = if let Some(window_size) = window_size {
window_size
} else {
let window_size... | Some(did)
}, | random_line_split |
lib.rs | //! ZStandard compression format encoder and decoder implemented in pure Rust
//! without unsafe.
// Reference: https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#frame_header
#![doc(
html_logo_url = "https://raw.githubusercontent.com/facebook/zstd/dev/doc/images/zstd_logo86.png",
html_f... | () -> Self {
Self {
literal: 0,
list: Vec::new(),
}
}
/// Add a weight for the next literal.
pub fn weight(&mut self, weight: u8) {
if weight!= 0 {
self.list.push((weight, self.literal));
}
self.literal += 1;
}
// FIXME ht... | new | identifier_name |
vr.rs | use nalgebra::{self as na, Similarity3, Transform3, Matrix4, Vector3, Point3, Vector2, Point2, Isometry3, Quaternion, Translation3, Unit};
use webvr::*;
use draw::EyeParams;
use fnv::FnvHashMap;
use gfx::{Rect};
use ::NativeRepr;
const VEL_SMOOTHING: f64 = 1e-90;
/// Provides access to VR hardware.
pub struct VrConte... | (&self) -> Isometry3<f32> {
self.pose
}
}
/// Instantaneous information about a controller. This can be used directly
/// or to update some persistent state.
#[derive(Clone, Debug)]
pub struct ControllerMoment {
id: u32,
/// The textual name of the controller
pub name: String,
/// The locat... | pose | identifier_name |
vr.rs | use nalgebra::{self as na, Similarity3, Transform3, Matrix4, Vector3, Point3, Vector2, Point2, Isometry3, Quaternion, Translation3, Unit};
use webvr::*;
use draw::EyeParams;
use fnv::FnvHashMap;
use gfx::{Rect};
use ::NativeRepr;
const VEL_SMOOTHING: f64 = 1e-90;
/// Provides access to VR hardware.
pub struct VrConte... | proj: right_projection,
clip_offset: 0.5,
clip: Rect {
x: data.left_eye_parameters.render_width as u16,
y: 0,
w: data.right_eye_parameters.render_width as u16,
... | right: EyeParams {
eye: moment.inverse_stage * right_view.try_inverse().unwrap() * Point3::origin(),
view: right_view * moment.stage, | random_line_split |
vr.rs | use nalgebra::{self as na, Similarity3, Transform3, Matrix4, Vector3, Point3, Vector2, Point2, Isometry3, Quaternion, Translation3, Unit};
use webvr::*;
use draw::EyeParams;
use fnv::FnvHashMap;
use gfx::{Rect};
use ::NativeRepr;
const VEL_SMOOTHING: f64 = 1e-90;
/// Provides access to VR hardware.
pub struct VrConte... |
}
fn pose_transform(ctr: &VRPose, inverse_stage: &Similarity3<f32>) -> Option<Isometry3<f32>> {
let or = Unit::new_normalize(Quaternion::upgrade(
match ctr.orientation { Some(o) => o, None => return None }));
let pos = Translation3::upgrade(
match ctr.position { Some(o) => o, None => return No... | {
self.pose
} | identifier_body |
mod.rs | //! An iterator over incoming signals.
//!
//! This provides a higher abstraction over the signals, providing
//! the [`SignalsInfo`] structure which is able to iterate over the
//! incoming signals. The structure is parametrized by an
//! [`Exfiltrator`][self::exfiltrator::Exfiltrator], which specifies what informatio... | /// let handle = signals.handle();
/// thread::spawn(move || {
/// for signal in signals.forever() {
/// match signal {
/// SIGUSR1 => {},
/// SIGUSR2 => {},
/// _ => unreachable!(),
/// }
/// }
/// });
/// handle.cl... | /// use signal_hook::iterator::Signals;
///
/// # fn main() -> Result<(), Error> {
/// let mut signals = Signals::new(&[SIGUSR1, SIGUSR2])?; | random_line_split |
mod.rs | //! An iterator over incoming signals.
//!
//! This provides a higher abstraction over the signals, providing
//! the [`SignalsInfo`] structure which is able to iterate over the
//! incoming signals. The structure is parametrized by an
//! [`Exfiltrator`][self::exfiltrator::Exfiltrator], which specifies what informatio... | /// Waits for some signals to be available and returns an iterator.
///
/// This is similar to [`pending`][SignalsInfo::pending]. If there are no signals available, it
/// tries to wait for some to arrive. However, due to implementation details, this still can
/// produce an empty iterator.
///
... | loop {
match read.read(&mut [0u8]) {
Ok(num_read) => break Ok(num_read > 0),
// If we get an EINTR error it is fine to retry reading from the stream.
// Otherwise we should pass on the error to the caller.
Err(error) => {
... | identifier_body |
mod.rs | //! An iterator over incoming signals.
//!
//! This provides a higher abstraction over the signals, providing
//! the [`SignalsInfo`] structure which is able to iterate over the
//! incoming signals. The structure is parametrized by an
//! [`Exfiltrator`][self::exfiltrator::Exfiltrator], which specifies what informatio... | lf, fmt: &mut Formatter) -> FmtResult {
fmt.debug_tuple("Signals").field(&self.0).finish()
}
}
impl<'a, E: Exfiltrator> IntoIterator for &'a mut SignalsInfo<E> {
type Item = E::Output;
type IntoIter = Forever<'a, E>;
fn into_iter(self) -> Self::IntoIter {
self.forever()
}
}
/// An ... | &se | identifier_name |
windows.rs | // Copyright (c) Jørgen Tjernø <jorgen@tjer.no>. All rights reserved.
use anyhow::{anyhow, bail, Context, Result};
use log::{debug, info, trace, warn};
use mail_slot::{MailslotClient, MailslotName};
use simplelog::*;
use std::{
fs::{File, OpenOptions},
io,
path::{Path, PathBuf},
process::{Command, Stdio... | .get_value("command")
.with_context(|| format!("command not registered when trying to handle url {}", url))?;
let could_send = {
let slot = MailslotName::local(&format!(r"bitSpatter\Hermes\{}", protocol));
trace!("Attempting to send URL to mailslot {}", slot.to_string());
if l... | let protocol_command: Vec<_> = config | random_line_split |
windows.rs | // Copyright (c) Jørgen Tjernø <jorgen@tjer.no>. All rights reserved.
use anyhow::{anyhow, bail, Context, Result};
use log::{debug, info, trace, warn};
use mail_slot::{MailslotClient, MailslotName};
use simplelog::*;
use std::{
fs::{File, OpenOptions},
io,
path::{Path, PathBuf},
process::{Command, Stdio... | rl: &url::Url) -> String {
let mut path = url.path().to_owned();
if let Some(query) = url.query() {
path += "?";
path += query;
}
path
}
/// Dispatch the given URL to the correct mailslot or launch the editor
fn open_url(url: &str) -> Result<()> {
let url = url::Url::parse(url)?;
... | t_path_and_extras(u | identifier_name |
windows.rs | // Copyright (c) Jørgen Tjernø <jorgen@tjer.no>. All rights reserved.
use anyhow::{anyhow, bail, Context, Result};
use log::{debug, info, trace, warn};
use mail_slot::{MailslotClient, MailslotName};
use simplelog::*;
use std::{
fs::{File, OpenOptions},
io,
path::{Path, PathBuf},
process::{Command, Stdio... | lse {
trace!("Could not connect to Mailslot, assuming application is not running");
false
}
};
if!could_send {
let (exe_name, args) = {
debug!(
"registered handler for {}: {:?}",
protocol, protocol_command
);
... | if let Err(error) = client.send_message(full_path.as_bytes()) {
warn!("Could not send mail slot message to {}: {} -- assuming application is shutting down, starting a new one", slot.to_string(), error);
false
} else {
trace!("Delivered using Mailsl... | conditional_block |
lib.rs | //! # `uc8159`
//!
//! This is a driver crate for accessing the `uc8159` E-Ink display controller. For now, most of
//! the options are hard-coded for the
//! [Pimoroni Inky Impression](https://shop.pimoroni.com/products/inky-impression) display as that's
//! the only one I own, so proposing changes to add more featur... |
}
/// Displays the contents of the internal buffer to the screen.
///
/// This operation blocks until the contents are completely shown.
pub fn show(&mut self) -> Result<(), ERR> {
self.setup()?;
let ptr = &self.buffer as *const _ as *const u8;
let len = mem::size_of_val(&... | {
*cell = (*cell & 0b11110000) | color as u8;
} | conditional_block |
lib.rs | //! # `uc8159`
//!
//! This is a driver crate for accessing the `uc8159` E-Ink display controller. For now, most of
//! the options are hard-coded for the
//! [Pimoroni Inky Impression](https://shop.pimoroni.com/products/inky-impression) display as that's
//! the only one I own, so proposing changes to add more featur... |
}
impl Color {
pub fn all() -> [Self; 8] {
[
Color::Black,
Color::White,
Color::Green,
Color::Blue,
Color::Red,
Color::Yellow,
Color::Orange,
Color::Clean,
]
}
pub fn all_significant() -> [Self... | {
dc.set_low()?;
spi.write(&[command as u8])?;
if !data.is_empty() {
dc.set_high()?;
for chunk in data.chunks(SPI_CHUNK_SIZE) {
spi.write(chunk)?;
}
}
Ok(())
} | identifier_body |
lib.rs | //! # `uc8159`
//!
//! This is a driver crate for accessing the `uc8159` E-Ink display controller. For now, most of
//! the options are hard-coded for the
//! [Pimoroni Inky Impression](https://shop.pimoroni.com/products/inky-impression) display as that's
//! the only one I own, so proposing changes to add more featur... | {
/// Creates a new display instance.
///
/// The provided `spi` bus will be used for most of the communication. The `delay` instance
/// is used when waiting for reset and drawing operations to complete. The `reset` pin can be
/// provided to make sure the device is reset before each new draw com... | ERR: From<SPI::Error> + From<RESET::Error> + From<BUSY::Error> + From<DC::Error>, | random_line_split |
lib.rs | //! # `uc8159`
//!
//! This is a driver crate for accessing the `uc8159` E-Ink display controller. For now, most of
//! the options are hard-coded for the
//! [Pimoroni Inky Impression](https://shop.pimoroni.com/products/inky-impression) display as that's
//! the only one I own, so proposing changes to add more featur... | (&mut self, color: &[Color]) {
for (idx, cell) in color.chunks(2).enumerate() {
self.buffer[idx] = ((cell[0] as u8) << 4) | cell[1] as u8;
}
}
/// Sets a specific pixel color.
pub fn set_pixel(&mut self, x: usize, y: usize, color: Color) {
let cell = &mut self.buffer[y *... | copy_from | identifier_name |
args_info.rs | // Copyright (c) 2023 Google LLC 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::{
enum_only_single_field_unnamed_variants,
errors::Errors,
help::require_description,
parse_attrs::{check_enum_type_attrs, FieldAttrs,... | commands: the_subcommands,
..Default::default()
}
} // end of get_args_ifo
} // end of impl ArgsInfo
}
}
fn impl_args_info_data<'a>(
name: &proc_macro2::Ident,
errors: &Errors,
type_attrs: &TypeAttrs,
fields: &'a [StructField<'a>],
)... | /// A short description of the command's functionality.
description: " enum of subcommands", | random_line_split |
args_info.rs | // Copyright (c) 2023 Google LLC 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::{
enum_only_single_field_unnamed_variants,
errors::Errors,
help::require_description,
parse_attrs::{check_enum_type_attrs, FieldAttrs,... | // An enum variant like `<name>(<ty>)`. This is used to collect
// the type of the variant for each subcommand.
struct ArgInfoVariant<'a> {
ty: &'a syn::Type,
}
let variants: Vec<ArgInfoVariant<'_>> = de
.variants
.iter()
.filter_map(|variant| {
let name = &... | {
// Validate the enum is OK for argh.
check_enum_type_attrs(errors, type_attrs, &de.enum_token.span);
// Ensure that `#[argh(subcommand)]` is present.
if type_attrs.is_subcommand.is_none() {
errors.err_span(
de.enum_token.span,
concat!(
"`#![derive(ArgsI... | identifier_body |
args_info.rs | // Copyright (c) 2023 Google LLC 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::{
enum_only_single_field_unnamed_variants,
errors::Errors,
help::require_description,
parse_attrs::{check_enum_type_attrs, FieldAttrs,... |
syn::Data::Union(_) => {
errors.err(input, "`#[derive(ArgsInfo)]` cannot be applied to unions");
TokenStream::new()
}
};
errors.to_tokens(&mut output_tokens);
output_tokens
}
/// Implement the ArgsInfo trait for a struct annotated with argh attributes.
fn impl_arg_i... | {
impl_arg_info_enum(errors, &input.ident, type_attrs, &input.generics, de)
} | conditional_block |
args_info.rs | // Copyright (c) 2023 Google LLC 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::{
enum_only_single_field_unnamed_variants,
errors::Errors,
help::require_description,
parse_attrs::{check_enum_type_attrs, FieldAttrs,... | <'a> {
ty: &'a syn::Type,
}
let variants: Vec<ArgInfoVariant<'_>> = de
.variants
.iter()
.filter_map(|variant| {
let name = &variant.ident;
let ty = enum_only_single_field_unnamed_variants(errors, &variant.fields)?;
if VariantAttrs::parse(errors,... | ArgInfoVariant | identifier_name |
command.rs | use std::process::{Command, Stdio};
use std::io::{BufReader, BufRead, Read, Write}; // Read is used for read_to_string
use std::fs::File;
use std::path::Path;
pub struct Commander {path: String}
impl Commander {
pub fn new<P: AsRef<Path>>(save_path: P) -> Commander {
Commander {
path: save_pat... | debug!("{:?}", res);
assert_eq!(
(&mut res.lines()).next().unwrap(),
"高知県\t江川崎"
)
}
fn print_usage(program: &str, opts: Options) {
let brief = format!("Usage: {} FILE [options]", program);
print!("{}", opts.usage(&brief));
}
/// with carg... |
let file1 = parent.join("col1.txt");
let file2 = parent.join("col2.txt");
let res = Commander::merge(&file1, &file2); | random_line_split |
command.rs | use std::process::{Command, Stdio};
use std::io::{BufReader, BufRead, Read, Write}; // Read is used for read_to_string
use std::fs::File;
use std::path::Path;
pub struct Commander {path: String}
impl Commander {
pub fn new<P: AsRef<Path>>(save_path: P) -> Commander {
Commander {
path: save_pat... |
let res = tr.wait_with_output().unwrap().stdout;
String::from_utf8(res).expect("contain invalid utf-8 character")
}
/// preparation to ch02_12
pub fn extract_row(&self, n: usize) -> String {
let res = Command::new("cut")
.args(&["-f", &format!("{}", n + 1)]) // start at ... | {
if let Some(ref mut stdin) = tr.stdin {
let mut buf: Vec<u8> = Vec::new();
stdout.read_to_end(&mut buf).unwrap();
stdin.write_all(&buf).unwrap();
}
} | conditional_block |
command.rs | use std::process::{Command, Stdio};
use std::io::{BufReader, BufRead, Read, Write}; // Read is used for read_to_string
use std::fs::File;
use std::path::Path;
pub struct Commander {path: String}
impl Commander {
pub fn new<P: AsRef<Path>>(save_path: P) -> Commander {
Commander {
path: save_pat... | vec!["program", "-n", "5", "./data/ch02/hightemp.txt"];
let program = args[0].clone();
let mut opts = Options::new();
opts.optopt("n", "num", "set first ${num} rows", "NUMBER");
opts.optflag("h", "help", "print this help menu");
let matches = opts.parse(&args[1..]).unwrap();
... | et args = | identifier_name |
command.rs | use std::process::{Command, Stdio};
use std::io::{BufReader, BufRead, Read, Write}; // Read is used for read_to_string
use std::fs::File;
use std::path::Path;
pub struct Commander {path: String}
impl Commander {
pub fn new<P: AsRef<Path>>(save_path: P) -> Commander {
Commander {
path: save_pat... |
/// helper for ch02. 14&15
fn take(&self, n: usize, pos: &str)->String {
let res = Command::new(pos)
.args(&["-n", format!("{}", n).as_str()])
.arg(&self.path)
.output().expect("fail to execute head command");
String::from_utf8_lossy(&res.stdout).trim().to_str... | {
let res = Command::new("paste")
.args(&[file1.as_ref(), file2.as_ref()])
.output().expect("fail to execute paste command");
String::from_utf8_lossy(&res.stdout).trim().to_string()
} | identifier_body |
lib.rs | // Copyright 2020 Netwarps Ltd.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, dis... | (req: Request<Control>) -> tide::Result {
let addr = req.local_addr().unwrap();
let mut available = "<h3>Available Endpoints:</h3></br>".to_string();
for item in NON_PARAM_ROUTE.iter() {
let route = addr.to_owned() + item;
available = available + &format!("<a href=//{}>{}</a></br>", route, ... | get_all | identifier_name |
lib.rs | // Copyright 2020 Netwarps Ltd.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, dis... |
let result_body = Body::from_json(&ResponseBody {
status: 0,
message: "".to_string(),
result: vec![serde_json::to_string(&spec_info).unwrap()],
})?;
let response = Response::builder(200).body(result_body).build();
Ok(response)
}
/// Get sent&received package bytes by peer_id
a... | {
spec_info.package_out = value
} | conditional_block |
lib.rs | // Copyright 2020 Netwarps Ltd.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, dis... | extern crate lazy_static;
lazy_static! {
static ref NON_PARAM_ROUTE: Vec<String> = {
vec![
"".to_string(),
"/recv".to_string(),
"/send".to_string(),
"/peer".to_string(),
"/connection".to_string(),
]
};
static ref PARAM_ROUTE: Vec<S... | use std::str::FromStr;
use tide::http::mime;
use tide::{Body, Request, Response, Server};
#[macro_use] | random_line_split |
linux.rs | use std::ffi::OsStr;
use std::io;
use std::os::unix::io::AsRawFd;
use std::path::Path;
use nix::sys::signal::{Signal};
use crate::ffi_util::ToCString;
use crate::{Command, Namespace};
use crate::idmap::{UidMap, GidMap};
use crate::stdio::dup_file_cloexec;
use crate::namespace::to_clone_flag;
use crate::caps::Capabili... |
/// Reassociate child process with a namespace specified by a file
/// descriptor
///
/// `file` argument is an open file referring to a namespace
///
/// 'ns' is a namespace type
///
/// See `man 2 setns` for further details
///
/// Note: using `unshare` and `setns` for the sa... | {
for ns in iter {
self.config.namespaces |= to_clone_flag(*ns);
}
self
} | identifier_body |
linux.rs | use std::ffi::OsStr;
use std::io;
use std::os::unix::io::AsRawFd;
use std::path::Path;
use nix::sys::signal::{Signal};
use crate::ffi_util::ToCString;
use crate::{Command, Namespace};
use crate::idmap::{UidMap, GidMap};
use crate::stdio::dup_file_cloexec;
use crate::namespace::to_clone_flag;
use crate::caps::Capabili... | pub fn pivot_root<A: AsRef<Path>, B:AsRef<Path>>(&mut self,
new_root: A, put_old: B, unmount: bool)
-> &mut Command
{
let new_root = new_root.as_ref();
let put_old = put_old.as_ref();
if!new_root.is_absolute() {
panic!("New root must be absolute");
};
... | /// # Panics
///
/// Panics if either path is not absolute or new_root is not a prefix of
/// put_old. | random_line_split |
linux.rs | use std::ffi::OsStr;
use std::io;
use std::os::unix::io::AsRawFd;
use std::path::Path;
use nix::sys::signal::{Signal};
use crate::ffi_util::ToCString;
use crate::{Command, Namespace};
use crate::idmap::{UidMap, GidMap};
use crate::stdio::dup_file_cloexec;
use crate::namespace::to_clone_flag;
use crate::caps::Capabili... | <P: AsRef<Path>>(&mut self, dir: P) -> &mut Command
{
let dir = dir.as_ref();
if!dir.is_absolute() {
panic!("Chroot dir must be absolute");
}
self.chroot_dir = Some(dir.to_path_buf());
self
}
/// Moves the root of the file system to the directory `put_ol... | chroot_dir | identifier_name |
linux.rs | use std::ffi::OsStr;
use std::io;
use std::os::unix::io::AsRawFd;
use std::path::Path;
use nix::sys::signal::{Signal};
use crate::ffi_util::ToCString;
use crate::{Command, Namespace};
use crate::idmap::{UidMap, GidMap};
use crate::stdio::dup_file_cloexec;
use crate::namespace::to_clone_flag;
use crate::caps::Capabili... |
let mut old_cmp = put_old.components();
for (n, o) in new_root.components().zip(old_cmp.by_ref()) {
if n!= o {
panic!("The new_root is not a prefix of put old");
}
}
self.pivot_root = Some((new_root.to_path_buf(), put_old.to_path_buf(),
... | {
panic!("The `put_old` dir must be absolute");
} | conditional_block |
lib.rs | // Copyright 2018-2022 argmin developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according... | pub trait ArgminSub<T, U> {
/// Subtract a `T` from `self`
fn sub(&self, other: &T) -> U;
}
/// (Pointwise) Multiply a `T` with `self`
pub trait ArgminMul<T, U> {
/// (Pointwise) Multiply a `T` with `self`
fn mul(&self, other: &T) -> U;
}
/// (Pointwise) Divide a `T` by `self`
pub trait ArgminDiv<T, U... | fn add(&self, other: &T) -> U;
}
/// Subtract a `T` from `self` | random_line_split |
main.rs | #![allow(dead_code)]
extern crate doom_iow;
use doom_iow::*;
use std::f32;
use std::process::Command;
use minifb;
// returns the RGBA color corresponding to UV(hitx, hity) on tex_walls
fn wall_x_texcoord(hitx: f32, hity: f32, tex_walls: &Texture) -> i32 {
let x = hitx - f32::floor(hitx + 0.5);
let y = hity ... |
for frame in 0..360 {
// for frame in 0..5 {
// for frame in 0..1 {
let output_path = "./out/";
let ss = format!("{}{:05}.ppm", output_path, frame);
// player.a -= 2. * std::f32::consts::PI / 360.;
player.set_a( player.get_a() - (2. * std::f32::consts::PI / 360.) );
... | .arg("out")
.output()
.expect("failed to create directory"); | random_line_split |
main.rs | #![allow(dead_code)]
extern crate doom_iow;
use doom_iow::*;
use std::f32;
use std::process::Command;
use minifb;
// returns the RGBA color corresponding to UV(hitx, hity) on tex_walls
fn wall_x_texcoord(hitx: f32, hity: f32, tex_walls: &Texture) -> i32 {
let x = hitx - f32::floor(hitx + 0.5);
let y = hity ... |
}
| {
let r = 2;
let g = 4;
let b = 8;
let a = 255;
let color = utils::pack_color_rgba(r, g, b, a);
let (rc, gc, bc, ac) = utils::unpack_color(color);
assert_eq!(vec![r, g, b, a], vec![rc, gc, bc, ac]);
} | identifier_body |
main.rs | #![allow(dead_code)]
extern crate doom_iow;
use doom_iow::*;
use std::f32;
use std::process::Command;
use minifb;
// returns the RGBA color corresponding to UV(hitx, hity) on tex_walls
fn wall_x_texcoord(hitx: f32, hity: f32, tex_walls: &Texture) -> i32 {
let x = hitx - f32::floor(hitx + 0.5);
let y = hity ... |
let rect_x = i as usize * rect_w;
let rect_y = j as usize * rect_h;
let texid = map.get(i, j).expect("i, j not in map range");
fb.draw_rectangle(
rect_x,
rect_y,
rect_w,
rect_h,
tex_walls.get... | {
continue; //skip empty spaces
} | conditional_block |
main.rs | #![allow(dead_code)]
extern crate doom_iow;
use doom_iow::*;
use std::f32;
use std::process::Command;
use minifb;
// returns the RGBA color corresponding to UV(hitx, hity) on tex_walls
fn wall_x_texcoord(hitx: f32, hity: f32, tex_walls: &Texture) -> i32 {
let x = hitx - f32::floor(hitx + 0.5);
let y = hity ... | () {
let packed = 0b0001_0000_0000_1000_0000_0100_0000_0010;
let (r, g, b, a) = utils::unpack_color(packed);
assert_eq!(vec![2, 4, 8, 16], vec![r, g, b, a]);
}
#[test]
fn packs_ints_idempotently() {
let r = 2;
let g = 4;
let b = 8;
let a = 255;
... | unpacks_ints | identifier_name |
container.rs | // Copyright 2021-2022 Sony Group Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
use crate::cgroup::{freeze, remove_cgroup_dir};
use crate::status::{self, get_current_container_state, Status};
use anyhow::{anyhow, Result};
use cgroups;
use cgroups::freezer::FreezerState;
use cgroups::hierarchies::is_cgroup2_... | use rustjail::container::EXEC_FIFO_FILENAME;
use std::path::PathBuf;
#[test]
fn test_get_config_path() {
let test_data = PathBuf::from(TEST_BUNDLE_PATH).join(CONFIG_FILE_NAME);
assert_eq!(get_config_path(TEST_BUNDLE_PATH), test_data);
}
#[test]
fn test_get_fifo_path() {
... |
#[cfg(test)]
mod tests {
use super::*;
use crate::utils::test_utils::*; | random_line_split |
container.rs | // Copyright 2021-2022 Sony Group Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
use crate::cgroup::{freeze, remove_cgroup_dir};
use crate::status::{self, get_current_container_state, Status};
use anyhow::{anyhow, Result};
use cgroups;
use cgroups::freezer::FreezerState;
use cgroups::hierarchies::is_cgroup2_... | (&self) -> Result<()> {
if self.state!= ContainerState::Running && self.state!= ContainerState::Created {
return Err(anyhow!(
"failed to pause container: current status is: {:?}",
self.state
));
}
freeze(&self.cgroup, FreezerState::Frozen)?... | pause | identifier_name |
container.rs | // Copyright 2021-2022 Sony Group Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
use crate::cgroup::{freeze, remove_cgroup_dir};
use crate::status::{self, get_current_container_state, Status};
use anyhow::{anyhow, Result};
use cgroups;
use cgroups::freezer::FreezerState;
use cgroups::hierarchies::is_cgroup2_... |
freeze(&self.cgroup, FreezerState::Thawed)?;
Ok(())
}
pub fn destroy(&self) -> Result<()> {
remove_cgroup_dir(&self.cgroup)?;
self.status.remove_dir()
}
}
/// Used to run a process. If init is set, it will create a container and run the process in it.
/// If init is not se... | {
return Err(anyhow!(
"failed to resume container: current status is: {:?}",
self.state
));
} | conditional_block |
event_queue.rs | use {Implementable, Proxy};
use std::any::Any;
use std::io::{Error as IoError, Result as IoResult};
use std::io::Write;
use std::ops::{Deref, DerefMut};
use std::os::raw::{c_int, c_void};
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, AtomicPtr};
pub use token_store::{Store as State, StoreProxy as StateProxy, ... | Some(evtq) => ffi_dispatch!(
WAYLAND_CLIENT_HANDLE,
wl_display_prepare_read_queue,
self.display,
evtq
),
None => ffi_dispatch!(WAYLAND_CLIENT_HANDLE, wl_display_prepare_read, self.display),
... | match self.handle.wlevq { | random_line_split |
event_queue.rs | use {Implementable, Proxy};
use std::any::Any;
use std::io::{Error as IoError, Result as IoResult};
use std::io::Write;
use std::ops::{Deref, DerefMut};
use std::os::raw::{c_int, c_void};
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, AtomicPtr};
pub use token_store::{Store as State, StoreProxy as StateProxy, ... |
}
/// An event queue managing wayland events
///
/// Each wayland object can receive events from the server. To handle these events
/// you must associate to these objects an implementation: a struct defined in their
/// respective module, in which you provide a set of functions that will handle each event.
///
/// Y... | {
&mut self.state
} | identifier_body |
event_queue.rs | use {Implementable, Proxy};
use std::any::Any;
use std::io::{Error as IoError, Result as IoResult};
use std::io::Write;
use std::ops::{Deref, DerefMut};
use std::os::raw::{c_int, c_void};
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, AtomicPtr};
pub use token_store::{Store as State, StoreProxy as StateProxy, ... | (&mut self) -> &mut State {
&mut self.state
}
}
/// An event queue managing wayland events
///
/// Each wayland object can receive events from the server. To handle these events
/// you must associate to these objects an implementation: a struct defined in their
/// respective module, in which you provide ... | state | identifier_name |
main.rs | #![feature(core)]
extern crate sdl2;
use std::rc::Rc;
use std::hash::{Hash, Hasher, Writer};
use std::cell::RefCell;
use std::collections::HashMap;
use std::collections::HashSet;
use std::ops::Add;
use std::num::ToPrimitive;
use self::sdl2::render::RenderDrawer;
use self::sdl2::rect::{Rect, Point};
use self::sdl2::pi... |
}
fn test_gathering_resources() {
let mut player = Player{ id: PlayerId(1), resources: Resources::new() };
let mut universe = Starmap::generate_universe();
player.gather_resources(&universe);
assert!(player.resources == Resources::new());
assert!(universe.set_homeworlds(&[PlayerId(1), PlayerId(2... | {
let (x1, y1) = self.first.borrow().center();
let (x2, y2) = self.second.borrow().center();
drawer.draw_line(
Point{x: x1, y: y1},
Point{x: x2, y: y2});
} | identifier_body |
main.rs | #![feature(core)]
extern crate sdl2;
use std::rc::Rc;
use std::hash::{Hash, Hasher, Writer};
use std::cell::RefCell;
use std::collections::HashMap;
use std::collections::HashSet;
use std::ops::Add;
use std::num::ToPrimitive;
use self::sdl2::render::RenderDrawer;
use self::sdl2::rect::{Rect, Point};
use self::sdl2::pi... | }
self.ships.get_mut(&ship.class).unwrap().push(ship);
}
fn merge(&mut self, fleet: Box<Fleet>) {
for (ship_class, ships) in fleet.ships.into_iter() {
for ship in ships.into_iter() {
self.add(ship);
}
}
}
fn size(&self) -> u32 {
... |
fn add(&mut self, ship: Ship) {
match self.ships.get(&ship.class) {
None => { self.ships.insert(ship.class, Vec::new()); },
Some(_) => () | random_line_split |
main.rs | #![feature(core)]
extern crate sdl2;
use std::rc::Rc;
use std::hash::{Hash, Hasher, Writer};
use std::cell::RefCell;
use std::collections::HashMap;
use std::collections::HashSet;
use std::ops::Add;
use std::num::ToPrimitive;
use self::sdl2::render::RenderDrawer;
use self::sdl2::rect::{Rect, Point};
use self::sdl2::pi... | (self, other:Resources) -> Resources {
Resources {
food: self.food + other.food,
technology: self.technology + other.technology,
gold: self.gold + other.gold
}
}
}
impl Resources {
fn new() -> Resources {
Resources{food: 0, technology: 0, ... | add | identifier_name |
value.rs | use crate::css::CallArgs;
use crate::error::Error;
use crate::ordermap::OrderMap;
use crate::output::{Format, Formatted};
use crate::sass::Function;
use crate::value::{Color, ListSeparator, Number, Numeric, Operator, Quotes};
use std::convert::TryFrom;
/// A css value.
#[derive(Clone, Debug, Eq, PartialOrd)]
pub enum ... | (Value::UnaryOp(a, av), Value::UnaryOp(b, bv)) => {
a == b && av == bv
}
(
Value::BinOp(aa, _, ao, _, ab),
Value::BinOp(ba, _, bo, _, bb),
) => ao == bo && aa == ba && ab == bb,
(Value::UnicodeRange(a), Value::Un... | random_line_split | |
value.rs | use crate::css::CallArgs;
use crate::error::Error;
use crate::ordermap::OrderMap;
use crate::output::{Format, Formatted};
use crate::sass::Function;
use crate::value::{Color, ListSeparator, Number, Numeric, Operator, Quotes};
use std::convert::TryFrom;
/// A css value.
#[derive(Clone, Debug, Eq, PartialOrd)]
pub enum ... | (&self, other: &Value) -> bool {
match (&self, other) {
(Value::Bang(a), Value::Bang(b)) => a == b,
(Value::Numeric(a, _), Value::Numeric(b, _)) => a == b,
(Value::Literal(a, aq), Value::Literal(b, bq)) => {
if aq == bq {
a == b
... | eq | identifier_name |
main.rs | use lazy_static;
use permutator::Combination;
use serde::Deserialize;
use std::collections::{BTreeSet, HashMap, VecDeque};
use std::error::Error;
fn mushes() -> Result<Vec<Mush>, Box<Error>> {
let f = std::fs::File::open("assets/agaricus-lepiota.data")?;
let mut rdr = csv::ReaderBuilder::new().has_headers(fals... | () {
let q = Question {
facet: 0,
vals: ['a', 'b', 'c'].iter().cloned().collect(),
};
let mushs = [
Mush {
poison: 'p',
attrs: ['a'; 22],
},
Mush {
poison: 'p',
attrs: ['b'; 22],
},
Mush {
poi... | test_answer | identifier_name |
main.rs | use lazy_static;
use permutator::Combination;
use serde::Deserialize;
use std::collections::{BTreeSet, HashMap, VecDeque};
use std::error::Error;
fn mushes() -> Result<Vec<Mush>, Box<Error>> {
let f = std::fs::File::open("assets/agaricus-lepiota.data")?;
let mut rdr = csv::ReaderBuilder::new().has_headers(fals... | ("gill-size" ,"broad=b,narrow=n"),
("gill-color" ,"black=k,brown=n,buff=b,chocolate=h,gray=g,green=r,orange=o,pink=p,purple=u,red=e,white=w,yellow=y"),
("stalk-shape" ,"enlarging=e,tapering=t"),
... | ("cap-color" ,"brown=n,buff=b,cinnamon=c,gray=g,green=r,pink=p,purple=u,red=e,white=w,yellow=y"),
("bruises?" ,"bruises=t,no=f"),
("odor" ,"almond=a,anise=l,creosote=c,fishy=y,foul=f,mu... | random_line_split |
main.rs | use lazy_static;
use permutator::Combination;
use serde::Deserialize;
use std::collections::{BTreeSet, HashMap, VecDeque};
use std::error::Error;
fn mushes() -> Result<Vec<Mush>, Box<Error>> {
let f = std::fs::File::open("assets/agaricus-lepiota.data")?;
let mut rdr = csv::ReaderBuilder::new().has_headers(fals... | else { None })
.cloned()
.collect::<Vec<_>>()
.join(", ");
write!(
f,
"Examine '{}'. Is it {}{}?",
facet_name,
if self.vals.len() > 1 { "one of " } else { "" },
choices
)
}
}
#[test]
fn test_question_fmt(... | { Some(v) } | conditional_block |
main.rs | use lazy_static;
use permutator::Combination;
use serde::Deserialize;
use std::collections::{BTreeSet, HashMap, VecDeque};
use std::error::Error;
fn mushes() -> Result<Vec<Mush>, Box<Error>> {
let f = std::fs::File::open("assets/agaricus-lepiota.data")?;
let mut rdr = csv::ReaderBuilder::new().has_headers(fals... |
}
#[test]
fn test_question_fmt() {
use std::iter::FromIterator;
let q = Question {
facet: 0,
vals: BTreeSet::from_iter(['b', 'c', 'x'].iter().cloned()),
};
format!("{}", q);
}
lazy_static::lazy_static! {
static ref FACETS: Vec<(&'static str,HashMap<char,&'static str>)> = {
... | {
let (facet_name, facet_map) = &FACETS[self.facet];
let choices = facet_map
.iter()
.filter_map(|(k, v)| if self.vals.contains(k) { Some(v) } else { None })
.cloned()
.collect::<Vec<_>>()
.join(", ");
write!(
f,
... | identifier_body |
mod.rs | //
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the Licen... |
fn remove_alias(&self, host: &Host) {
let mut aliases = self.aliases.write();
aliases.remove(host);
}
fn add_aliases(&self, node: Arc<Node>) {
let mut aliases = self.aliases.write();
for alias in node.aliases() {
aliases.insert(alias, node.clone());
}
... | {
let mut aliases = self.aliases.write();
node.add_alias(host.clone());
aliases.insert(host, node);
} | identifier_body |
mod.rs | //
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the Licen... |
} else {
// Node not responding. Remove it.
remove_list.push(tnode);
}
}
}
}
}
remove_list
}
fn add_nodes_and_aliases(&self, friend_list: &[A... | {
remove_list.push(tnode);
} | conditional_block |
mod.rs | 0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the Lic... |
fn remove_nodes(&self, nodes_to_remove: &[Arc<Node>]) {
if nodes_to_remove.is_empty() {
return;
}
let nodes = self.nodes();
let mut node_array: Vec<Arc<Node>> = vec![];
for node in &nodes {
if!nodes_to_remove.contains(node) {
node_ar... | } | random_line_split |
mod.rs | //
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the Licen... | (&self) -> bool {
let seed_array = self.seeds.read();
info!("Seeding the cluster. Seeds count: {}", seed_array.len());
let mut list: Vec<Arc<Node>> = vec![];
for seed in &*seed_array {
let mut seed_node_validator = NodeValidator::new(self);
if let Err(err) = see... | seed_nodes | identifier_name |
session.rs | //! Handle a game.
use std::num::NonZeroU8;
use std::fmt;
use derive_getters::Getters;
use rand::{rngs, Rng};
use crate::game::{self, Tree, Board, Players, Player, Choice, Action, Consequence, Holding};
fn roll_d6s<T: Rng>(d6s: u8, random: &mut T) -> usize {
(0..d6s)
.fold(0, |sum, _| -> usize {
... | choices,
);
};
Ok(state)
}
/// A game in progress. The `traversals` indicate how many turns have passed. Maintains
/// all state of the game.
///
/// ## Invariants
/// 1. The `Tree` will always be valid.
/// 2. The first `State` in the `turns` is the starting position sans any inital trave... | traversal.as_slice(),
current_board, | random_line_split |
session.rs | //! Handle a game.
use std::num::NonZeroU8;
use std::fmt;
use derive_getters::Getters;
use rand::{rngs, Rng};
use crate::game::{self, Tree, Board, Players, Player, Choice, Action, Consequence, Holding};
fn roll_d6s<T: Rng>(d6s: u8, random: &mut T) -> usize {
(0..d6s)
.fold(0, |sum, _| -> usize {
... | turns: vec![first_turn],
tree,
move_limit,
rand: rand::thread_rng(),
}
}
pub fn reset(self) -> Self {
let first = self.turns.first().unwrap().board.to_owned();
Session::new(
first.clone(),
game::start_tree_horizon_... | {
// The start may contain pass move. Cycle to get at the first true turn.
// This code is a copy of what's happening in `advance` below. TODO: Refactor me.
let mut tree = Some(tree);
let first_turn = loop {
match state_from_board(
start.clone(), tree... | identifier_body |
session.rs | //! Handle a game.
use std::num::NonZeroU8;
use std::fmt;
use derive_getters::Getters;
use rand::{rngs, Rng};
use crate::game::{self, Tree, Board, Players, Player, Choice, Action, Consequence, Holding};
fn roll_d6s<T: Rng>(d6s: u8, random: &mut T) -> usize {
(0..d6s)
.fold(0, |sum, _| -> usize {
... | (
attacker_dice: u8, attacker_rolled: usize, defender_dice: u8, defender_rolled: usize
) -> Self {
LastAttack { attacker_dice, attacker_rolled, defender_dice, defender_rolled }
}
}
impl fmt::Display for LastAttack {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if self.atta... | new | identifier_name |
circuit.rs | use ff::{Field, PrimeField, PrimeFieldRepr, BitIterator};
use bellman::{Circuit, ConstraintSystem, SynthesisError};
use zcash_primitives::jubjub::{FixedGenerators, JubjubEngine, edwards, PrimeOrder, JubjubParams};
use zcash_primitives::constants;
use zcash_primitives::primitives::{PaymentAddress, ProofGenerationKey... |
let mut lhs: Vec<bool> = BitIterator::new(lhs.into_repr()).collect();
let mut rhs: Vec<bool> = BitIterator::new(rhs.into_repr()).collect();
lhs.reverse();
rhs.reverse();
cur = pedersen_hash::pedersen_hash::<Bls12, _>(
pedersen_hash::Personalization::MerkleTree(i),... | {
::std::mem::swap(&mut lhs, &mut rhs);
} | conditional_block |
circuit.rs | use ff::{Field, PrimeField, PrimeFieldRepr, BitIterator};
use bellman::{Circuit, ConstraintSystem, SynthesisError};
use zcash_primitives::jubjub::{FixedGenerators, JubjubEngine, edwards, PrimeOrder, JubjubParams};
use zcash_primitives::constants;
use zcash_primitives::primitives::{PaymentAddress, ProofGenerationKey... | <'a, E: JubjubEngine> { // TODO: name
// Jubjub curve parameters.
pub params: &'a E::Params,
// The secret key, an element of Jubjub scalar field.
pub sk: Option<E::Fs>,
// The VRF input, a point in Jubjub prime order subgroup.
pub vrf_input: Option<edwards::Point<E, PrimeOrder>>,
// The... | Ring | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.