text
stringlengths
3.09k
13.9k
/* * Copyright 2020 Fluence Labs Limited * * 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 a...
//! This module provides the Data Management Layer //! which handles user-defined objects and incldues caching and write back. use crate::allocator::{Action, SegmentAllocator, SegmentId}; use crate::cache::AddSize; use crate::size::{Size, StaticSize}; use crate::storage_pool::DiskOffset; use crate::vdev::Block; use se...
mod config; use config::Config; use rand::{self, Rng}; use structopt::StructOpt; const VALID_CHARS: [char; 26] = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ]; const SPECIAL_CHARS: [char; 28] = [ '~', '`', '!', '@', '...
#![allow(non_camel_case_types)] use libc::{c_int, c_void, c_long, c_ulong, c_char}; use bio; use x509; pub type SSL_CTX = c_void; pub type SSL_METHOD = c_void; pub type COMP_METHOD = c_void; pub type SSL = c_void; pub type CRYPTO_EX_DATA = c_void; pub type CRYPTO_EX_new = extern "C" fn(parent: *mut c_void, ptr: *mu...
#![feature(test)] use std::collections::HashSet; use std::error::Error; use std::fs::File; use std::io::{BufRead, BufReader}; #[macro_use] extern crate scan_fmt; #[macro_use] extern crate test; const PATTERN_LENGTH: usize = 5; struct Note { num: i32, pattern: u8, output: bool } struct Problem { st...
extern crate rmp; extern crate rmp_serde as rmps; extern crate serde; use std::error::Error; use std::fmt; use std::fs; use std::fs::File; use std::io::prelude::*; use std::path::Path; #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] pub struct Subscription { pub url: String, pub original_url: Strin...
//! Module for finding the base address of a misaligned 8051 firmware use crate::instr::{InsType, Instructeam}; use rustfft::num_complex::Complex; use rustfft::FftPlanner; /// Finds the base address of a misaligned 8051 firmware image. /// /// This works by counting how many times an address is the target /// of an lc...
//! This crate wraps Typeform's REST API. //! Main entry-point is [`Typeform`] - once build it can be used to receive responses. #![warn( anonymous_parameters, missing_copy_implementations, missing_debug_implementations, missing_docs, rust_2018_idioms, private_doc_tests, trivial_casts, ...
use crate::wallet::WalletProxyController; use crate::VitStationController; use crate::{legacy::LegacyNodeController, test::Result}; use crate::{node::NodeController, scenario::Controller}; use chain_impl_mockchain::vote::Choice; use jormungandr_lib::interfaces::Value; use jormungandr_testing_utils::{ testing::{Frag...
use ggez::{graphics, mint::Point2}; use semeion::*; use std::{any::Any, rc::Rc}; use crate::{ context::{Context, Kind}, env, }; #[derive(Debug)] pub struct Cell<'a> { id: Id, location: Location, lifespan: Lifespan, state: State, is_frozen: bool, age: u64, offspring: Offspring<'a, K...
use super::*; use rand::prelude::*; /// This is the Forwarder, the Swiss Army Knife of machines. It implements the TestMessage instruction set. /// This allows it to be an accumulator of messages (fanin), a distributor of messages (fanout), a forwarder, /// a notifier, and for extra credit, it can randomly forward a m...
// // Copyright (c) Dell Inc., or its subsidiaries. All Rights Reserved. // // 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 // #![deny( c...
mod config; use std::{ env, error::Error, fs::{create_dir, write}, path::Path, process, }; use chrono::{DateTime, NaiveDateTime, Utc}; use serde_derive::{Deserialize, Serialize}; use teart::{ image_parsing::{get_palette, get_raw_buffer, parse_image, save_image, InputData}, reservation_con...
use std::io::{self, Read}; use std::cmp::Ordering; type Error = Box<dyn std::error::Error + Send + Sync>; type Result<T, E = Error> = std::result::Result<T, E>; type Vec3 = [i64; 3]; fn main() -> Result<()> { let mut input = String::new(); io::stdin().read_to_string(&mut input)?; println!("p1: {}", solve_part1(&...
use super::DELIMITER; use super::schema::SchemaId; use super::super::ledger::request::ProtocolVersion; use utils::validation::Validatable; use ursa::cl::{ CredentialPrimaryPublicKey, CredentialRevocationPublicKey, CredentialPrivateKey, CredentialKeyCorrectnessProof }; use std::collections::HashMap; u...
#![cfg_attr(not(feature = "std"), no_std)] /// Edit this file to define custom logic or remove it if it is not needed. /// Learn more about FRAME and the core library of Substrate FRAME pallets: /// <https://substrate.dev/docs/en/knowledgebase/runtime/frame> use sp_std::prelude::*; use sp_runtime::{DispatchResult, tr...
use thiserror::Error; use crate::image::Image; use crate::pattern; use crate::pattern::Pattern; use matches::Matches; pub fn parse(input: &str) -> impl Iterator<Item = (Image, Result<Pattern, CheckError>)> + '_ { Matches::iter(input).map(|matches| { let image = matches.image(); let pattern = match...
use std::string::String; use std::process::{Command, Stdio}; use std::io::{BufRead, BufReader}; use std::path::Path; use std::fs; use clap::{Arg, App}; mod video; use video::Video; mod dolpy_vision; fn main() { let matches = App::new(env!("CARGO_PKG_NAME")) .version(env!("CARGO_PKG_VERSION")) .a...
use std::ops::Range; use combine::char::alpha_num; use combine::error::ParseError; use combine::parser::choice::{choice, optional}; use combine::parser::combinator::{attempt, not_followed_by}; use combine::parser::item::{eof, token}; use combine::parser::repeat::{many, many1, sep_by1}; use combine::parser::sequence::b...
#![allow(non_upper_case_globals)] use { anyhow::Result, bitflags::bitflags, crossterm::{ cursor, event::{self, Event, KeyCode}, execute, style, terminal, }, std::{fmt, io::stdout, mem::ManuallyDrop, time::Duration}, }; pub const NUM_COLUMNS: u16 = 50; pub const NUM_ROWS: u1...
#![feature(core_intrinsics)] #![type_length_limit="1120927"] extern crate rand; use std::intrinsics::type_name; use std::marker::*; use std::hash::Hash; use std::collections::*; use differential_datalog::record::IntoRecord; use rand::{Rng, SeedableRng, StdRng}; use num::*; use serde::{Serialize, Deserialize}; use dif...
use crate::core::application::target::matches; use crate::core::term; use crate::utility::location::Location; use config::File; use std::collections::HashMap; use std::path::{Path, PathBuf}; const PUBLISHER_OPTIONS: &[&str] = &["system", "package_app", "upload_app"]; #[derive(Debug, Deserialize)] // If you add an att...
use cblas; use ndarray::{ Data, Dim, Ix, ShapeBuilder, }; use ndarray::prelude::*; use std::slice; use crate::{ Error, GramSchmidt, Result, utils::{ as_slice_with_layout, get_layout, } }; /// A reorthogonalized Gram Schmidt factorization, also known as `CGS2` in the...
use crate::{executor::path_resolver::PathResolver, interactive_debug::Suspender}; use anyhow::Context as _; use invoker_api::{ debug::AttachRequest, invoke::{SandboxSettings, SharedDirectoryMode}, }; use minion::{SharedItem, SharedItemKind}; use std::{ os::unix::fs::PermissionsExt, path::{Path, PathBuf}...
#[macro_use] extern crate serde_derive; #[macro_use] extern crate hyper; extern crate app_dirs; extern crate cursive; extern crate openssl; extern crate reqwest; extern crate rand; extern crate serde; extern crate serde_json; extern crate base64; extern crate chrono; extern crate chrono_humanize; extern crate textwrap...
use super::forked::parser::*; use super::forked::scanner::{Marker, ScanError, TokenType}; use crate::Byml; use std::collections::BTreeMap; use std::error::Error; use std::f64; use std::i64; use std::mem; impl Byml { /// Read a BYML document from a YAML string. The input YAML format is the same as that used ///...
use crate::ui::color::Color; #[derive(Default)] pub struct Animation { start: (f64, f64), end: (f64, f64), start_time: i64, end_time: i64, } #[derive(Default)] pub struct Cursor { /// Position, (row, col). pub pos: Option<(f64, f64)>, /// Flag for disabling the movement animation. pub ...
use std::{any::Any, marker::PhantomData}; use async_trait::async_trait; use clap::ArgMatches; use i18n_codegen::i18n; use sap_bindings::{ config::AppConfig, net::{ behavior::{CopyTo, CopyToSys, Create, Delete}, object::{Class, Program, Table}, SendWith, }, }; // use sap_adt_binding...
use std::str::FromStr; use chrono::FixedOffset; use regex::{Captures, Regex}; use thiserror::Error; use crate::validate::{validate_number, IntoValidationError}; #[derive(Error, Debug, PartialEq)] pub enum OffsetError { #[error("Wrong hms text: '{0}'. text must be in `Hmmss` or `HH:mm:ss` format.")] WrongForm...
/*! Connects and paths between different connected Nodes. */ use super::*; use std::io::{self, Error, ErrorKind}; /** Weighted Node */ struct WNodes { nodes: Vec<Node>, weight: u32, } /** Paths between two different points that are connected. ## Errors The provided A and B don't exist in the network. T...
use std::mem; use std::os::raw::{c_char, c_int, c_void}; use private::webview_private; mod private; #[inline] pub fn runtime_size_check() { unsafe { assert_eq!( mem::size_of::<webview>(), struct_webview_size(), "size of `webview` does not match C library." ); ...
use crate::schema::{imdb_movies, imdb_names, imdb_ratings, imdb_title_principals}; #[derive(Debug, Clone, Identifiable, Associations, Serialize, Deserialize, Queryable)] #[serde(rename_all = "camelCase")] #[table_name = "imdb_movies"] #[primary_key(imdb_title_id)] pub struct ImdbMovie { pub imdb_title_id: String, ...
use std::cell::RefCell; use std::hash::Hash; use std::rc::Rc; use super::Observer; use super::{Value, get_int, get_float}; use super::{Printer, Widget, WidgetProperties}; type BarRef<Key> = Rc<RefCell<Bar<Key>>>; /** A horizontal bar representing a value. * * Can have logarithmic scaling to improve visibility of s...
//! Rewrites which hoist let-expressions. use crate::{ ast_node::{Arity, AstNode}, teachable::{BindingExpr, Teachable}, }; use egg::{ Analysis, Applier, EGraph, Id, Language, PatternAst, Rewrite, SearchMatches, Searcher, Subst, Symbol, Var, }; use lazy_static::lazy_static; use std::{collections::HashMa...
#[macro_use] extern crate fdec; // 160-bit numbers with 25 decimal places. fdec32! { module dec, name Decimal, length 5, scale 25 } use std::str::FromStr; use dec::*; /// Shows various methods to create numbers. fn main() { println!("Predefined constants"); // These constants always present ...
extern crate getopts; extern crate glob; extern crate hyper; extern crate json; #[macro_use] extern crate log; extern crate lua; extern crate num_cpus; extern crate regex; extern crate term; use getopts::Options; use runner::Runner; use std::env; use std::path; use std::process; mod graph; mod logger; mod modules; mo...
mod common; mod emitter; mod macros; mod material; mod sensor; mod shape; mod transform; use crate::{ bvh::{BoundingVolumeHierarchy, SplitMethod}, film::FilmSettings, find_attr, lights::Light, materials::Material, math::{Ray, Spectrum}, scene::{ply::PlyResult, CameraParameters, Result, Scen...
use std::vec; use libprofiling; use super::postentry::PostEntry; struct PostChunk { e: PostEntry, m: vec::IntoIter<PostEntry>, size: usize, } impl PostChunk { pub fn new(v: Vec<PostEntry>) -> Option<PostChunk> { let size = v.len(); if size == 0 { None } else { ...
// SPDX-License-Identifier: Apache-2.0 //! Shared `sallyport` item definitions. use crate::iter::{IntoIterator, Iterator}; use crate::Error; use core::convert::{TryFrom, TryInto}; use core::mem::{align_of, size_of}; use libc::EINVAL; /// `sallyport` item kind. #[derive(Clone, Copy, Debug, PartialEq)] #[repr(usize)]...
// This file is part of yash, an extended POSIX shell. // Copyright (C) 2021 <NAME> // // This program 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) ...
/* raylib-rs raiiwrap.rs - RAII versions of raylib structs Copyright (c) 2018-2019 <NAME> (@deltaphc) This software is provided "as-is", without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to us...
// Library of database functions // extern crate serde; use std::path::{Path, PathBuf}; use crate::models; // Create a database table pub fn create_table(config: &models::Config) -> rusqlite::Result<()> { let conn = rusqlite::Connection::open(config.database.file.as_path())?; conn.execute(&config.dat...
use crate::content_hash::ContentHash; use crate::interns::{FileId, Interns}; use std::collections::HashMap; use std::fs::{self, Metadata}; use std::io; use std::path::Path; /// File metadata key, based on https://apenwarr.ca/log/20181113 /// /// TODO: Define a different structure for this on Windows. #[derive(Copy, Cl...
use proc_macro2::{Delimiter, Group, Literal, Spacing, TokenStream, TokenTree}; use std::{fmt::Write, iter::Peekable}; use syn::LitStr; pub fn parse_to_js(input: TokenStream) -> String { let mut code = String::new(); add(&mut code, input, Hint::None); code } fn parse_raw_literal(lit: &Literal) -> Option<St...
use crate::debug::TableEntry; use crate::durability::Durability; use crate::plumbing::DerivedQueryStorageOps; use crate::plumbing::LruQueryStorageOps; use crate::plumbing::QueryFunction; use crate::plumbing::QueryStorageMassOps; use crate::plumbing::QueryStorageOps; use crate::runtime::local_state::QueryInputs; use cra...
//! Our Patch enum is intentionally kept in it's own file for easy inclusion into //! The Percy Book. use std::collections::HashMap; pub use apply_patches::patch; use crate::event::{EventHandler, EventName}; use crate::{AttributeValue, VText, VirtualNode}; mod apply_patches; type NodeIdx = u32; /// A Patch encode...
// Copyright 2018 <NAME> // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE-2.0 or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to t...
use async_trait::async_trait; pub use codec; use codec::Decode; use core::future::Future; use frame_metadata::v12::{StorageEntryType, StorageHasher}; pub use frame_metadata::RuntimeMetadataPrefixed; use futures_lite::AsyncRead; use hasher::hash; use meta_ext::MetaExt; use once_cell::sync::OnceCell; use std::{ conve...
#![no_main] use std::ops::Deref; use arbitrary::{ Arbitrary, Result, Unstructured, }; use indoc::formatdoc; use libfuzzer_sys::fuzz_target; use petgraph::{ graph::NodeIndex, stable_graph::StableGraph, Directed, Direction, }; use tracing_rc::rc::{ count_roots, *, }; #[derive(Debug, ...
// Copyright 2022 - <NAME> <<EMAIL>> // SPDX-License-Identifier: Apache-2.0 use std::collections::{HashMap, HashSet}; use std::sync::Arc; use std::time::{Duration, SystemTime}; use serde::Serialize; use tokio::sync::RwLock; use mixnet_contract_common::MixNodeBond; use crate::mix_node::models::{MixnodeStatus, Pretty...
use git2::{Commit, Oid, Error, DiffOptions, Repository}; use std::path::PathBuf; use crate::format_patches::format::{CommitMessage, InvalidCommitMessage}; use std::fmt::{Display, Formatter}; use std::fmt; use slog::{Logger, info}; use crate::utils::SimpleParser; mod format; pub struct FormatOptions { pub diff_opt...
//! BL602 Simulator for WebAssembly // Import the serde crate for JSON Serialization use serde::{Serialize, Deserialize}; /// Event to be simulated by the BL602 Simulator #[derive(Serialize, Deserialize, Debug)] #[allow(non_camel_case_types)] enum SimulationEvent { /// GPIO Set Output: /// `{ "gpio_output_s...
//! Keep stats, and dispaly them to the user. Usually used in a broker, or main node, of some sort. use alloc::{string::String, vec::Vec}; use core::{time, time::Duration}; use crate::utils::current_time; const CLIENT_STATS_TIME_WINDOW_SECS: u64 = 5; // 5 seconds /// A simple struct to keep track of client stats #[...
use std::cmp; use std::iter::repeat; use proc_macro2::{Ident, Literal, Span, TokenStream}; use protocol::*; use util::null_terminated_byte_string_literal; pub(crate) fn generate_interfaces_prefix(protocol: &Protocol) -> TokenStream { let longest_nulls = protocol.interfaces.iter().fold(0, |max, interface| { ...
// Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0. use super::column::{Column, ColumnEncoder}; use super::Result; use crate::codec::Datum; use std::io::Write; #[cfg(test)] use tikv_util::codec::BytesSlice; use tipb::FieldType; /// `Chunk` stores multiple rows of data in Apache Arrow format. /// See ht...
use gura::{ errors::ParseError, object, parser::{dump, parse, GuraType}, }; use std::f64::{INFINITY, NAN, NEG_INFINITY}; mod common; fn get_expected() -> GuraType { object! { a_string: "test string", int1: 99, int2: 42, int3: 0, int4: -17, int5: 1000, ...
use std::collections::{HashMap, HashSet}; use std::collections::hash_map::Entry; use std::fs; use std::io; use std::path::Path; use csv; use regex::Regex; use CliResult; use config::{Config, Delimiter}; use select::SelectColumns; use util::{self, FilenameTemplate}; static USAGE: &'static str = " Partitions the given...
use std::{ future::Future, time::{Duration, Instant}, }; use futures::{channel::mpsc::Sender, SinkExt}; use zksync::{error::ClientError, operations::SyncTransactionHandle, RpcProvider, Wallet}; use zksync_eth_signer::PrivateKeySigner; use zksync_types::{Token, H256}; use crate::{ account_pool::{AddressPo...
/* lib.rs contains all the logic of the program */ use std::{error::Error, fmt::Display, str::FromStr, io::{self, Write}}; /// handles setup for the game pub struct Config { diamond_size: isize, } impl Config { /// creates and returns a new Config from user input pub fn new() -> Result<Config, Box<dyn Er...
// Copyright Materialize, Inc. and contributors. All rights reserved. // // Use of this software is governed by the Business Source License // included in the LICENSE file. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by ...
use anyhow::{anyhow, Result}; use mio::Interest; use mio_serial::SerialPortBuilderExt; use serialport::SerialPortBuilder; use std::{ io, io::ErrorKind, io::Write, ops, sync::{ atomic::{AtomicBool, Ordering}, Arc, }, time::Duration, }; const LOW_BAUD: u32 = 1200; const HIGH_B...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::account_address::AccountAddress; use anyhow::{ensure, Error, Result}; #[cfg(any(test, feature = "fuzzing"))] use proptest_derive::Arbitrary; #[cfg(any(test, feature = "fuzzing"))] use rand::{rngs::OsRng, RngCore}; use serde:...
pub mod implref; pub mod nonone; pub mod traitmethodconflict; pub fn proxy_enum_for_trait(positive: bool) -> impl Iterator<Item = i64> { enum ProxyIterator<T, U> { Range(T), Map(U), } impl<T: Iterator<Item = i64>, U: Iterator<Item = i64>> Iterator for ProxyIterator<T, U> { type Ite...
// Copyright 2021 <NAME>. // // 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 writ...
use indexmap::indexmap; use ndarray; use smartnoise_validator::{Float, Integer, proto}; use smartnoise_validator::base::{ReleaseNode, Value}; use smartnoise_validator::errors::*; use smartnoise_validator::utilities::take_argument; use crate::components::Evaluable; use crate::NodeArguments; use proto::privacy_definiti...
use std::time::Duration; use crate::components::{ BookEnd, ComponentDescription, ComponentId, ComponentLocation, ComponentType, ConcurrencyMode, Test, TestParameters, }; #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct SuiteAttributes { /// Indicates that this entire suite should not be run. pu...
use std::collections::HashMap; use crate::apiproto::api::{AuthRequest, DataSourceResponse, AuthResponse}; use crate::apiproto::api_grpc::*; use crate::config::PostgresConfig; use crate::policy_evaluator::evaluator::PolicyEvaluator; use crate::postgres_driver::conn::PostgresConn; use crate::postgres_driver::errors::Dec...
use support::{decl_module, decl_storage, decl_event, StorageValue, StorageMap, dispatch::Result, Parameter, ensure}; use runtime_primitives::traits::{CheckedAdd, CheckedMul, As}; use system::ensure_signed; pub trait Trait: cennzx_spot::Trait { type Item: Parameter; type ItemId: Parameter + CheckedAdd + Default + Fro...
/*! # Introduction shibaken is called by sundog as a setting generator. shibaken will fetch and populate the admin container's user-data with authorized ssh keys from the AWS instance metadata service (IMDS). (The name "shibaken" comes from the fact that Shiba are small, but agile, hunting dogs.) */ #![deny(rust_20...
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. //! This module provides file formating utilities using //! [`dprint`](https://github.com/dsherret/dprint). //! //! At the moment it is only consumed using CLI but in //! the future it can be easily extended to provide //! the same functions as...
/* tag::catalog[] Title:: Upgrade Reject on a Hash Mismatch Goal:: Ensure an NNS subnet does not upgrade if the hash of the release package does not match. Runbook:: . Setup a single-node subnet with NNS canisters . Trigger an upgrade of the NNS subnet with a broken hash. To that end, we first submit a BlessReplicaVe...
#[cfg(test)] use std::collections::HashMap; use std::env; use std::io::prelude::*; use std::os::unix::net::{UnixListener, UnixStream}; use std::sync::{Arc, Mutex}; use std::thread; use crate::{ActionEvents, Settings}; static SOCKET_PATH: &'static str = "/tmp/lillinput_socket"; static MSG_COMMAND: u32 = 0; static MSG_...
use crate::entry::MftEntry; use crate::err::{self, Result}; use crate::{EntryHeader, ReadSeek}; use log::{debug, trace}; use snafu::ResultExt; use lru::LruCache; use std::fs::{self, File}; use std::io::{BufReader, Cursor, SeekFrom}; use std::path::{Path, PathBuf}; pub struct MftParser<T: ReadSeek> { data: T, ...
use std::convert::TryInto; use super::Array; use parquet::{ encoding::{bitpacking, uleb128, Encoding}, error::{ParquetError, Result}, metadata::ColumnDescriptor, read::levels::{get_bit_width, split_buffer_v1, RLEDecoder}, read::{Page, PageHeader, PrimitivePageDict}, types::NativeType, }; fn r...
// Copyright 2021 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use crate::{FemuEngine, QemuEngine, SERIALIZE_FILE_NAME}; use anyhow::{anyhow, Context, Result}; use ffx_emulator_config::EmulatorEngine; use serde::{Deser...
use group::{ ff::{BatchInvert, Field}, Curve, }; use super::super::Error; use super::{Params, MSM}; use crate::transcript::{EncodedChallenge, TranscriptRead}; use crate::arithmetic::{best_multiexp, CurveAffine}; /// A guard returned by the verifier #[derive(Debug, Clone)] pub struct Guard<'a, C: CurveAffine,...
use math::Vector3; use raytracing::Ray; #[derive(Debug)] pub struct Sphere { pub origin: Vector3, pub radius: f64, pub color: Vector3, } impl Sphere { pub fn new(origin: Vector3, radius: f64, color: Vector3) -> Sphere { Sphere { origin, radius, color, ...
//! The MIMA simulator. //! //! The simulator needs a firmware and a program to simulate. You can generate a //! firmware with [`mimar-fwc`](../mimar_fwc/index.html) and assemble programs //! with [`mimar-asm`](../mimar_asm/index.html). //! //! The default firmware is compatible with the output of cbdevnet's //! [mimas...
/* Memo * A memo is an immutable message. */ pub mod serde; use std::collections::HashMap; use std::{fmt}; use std::sync::Arc; use crate::subject::{SubjectId}; use crate::slab::MemoRef; use crate::network::{SlabRef,SlabPresence}; use super::*; //pub type MemoId = [u8; 32]; pub type MemoId = u64; // All portions of...
// Memento - A Whisper implementation in Rust // // Copyright 2017-2018 TSH Labs // // 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 copie...
use crate::ctx::ReconcileCtx; use crate::element_tree::{Element, ElementExt, VirtualDom}; use crate::flex::FlexParams; use crate::glue::{Action, GlobalEventCx, WidgetId}; use crate::metadata::{Metadata, NoState}; use crate::widgets::TextBoxWidget; use tracing::{instrument, trace}; // TODO - Handle the anti-pattern wh...
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { crate::{Event, EventSource}, futures::{ compat::{Compat01As03, Future01CompatExt, Stream01CompatExt}, stream::Stream, ...
// Copyright 2018-2020 Cargill Incorporated // // 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...
use crate::common::Map; use crate::protocol::key::DaskKey; use crate::protocol::protocol::{ map_from_transport, Frames, FromDaskTransport, SerializedMemory, SerializedTransport, }; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug)] pub struct IdentityMsg { //pub reply: bool, } #[der...
use candid::parser::{ types::IDLProg, typing::{check_prog, TypeEnv}, value::{IDLArgs, IDLField, IDLValue}, }; use candid::types::Label; use candid::{decode_args, decode_one, Decode}; #[test] fn test_parser() { parse_check("(true,42,+42,-42)"); parse_check("(\"test\", variant {5})"); parse_check...
// Copyright 2015-2020 Aerospike, Inc. // // 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 t...
// Copyright (c) 2017-present PyO3 Project and Contributors use proc_macro2::{Span, TokenStream}; use quote::{quote, ToTokens}; use syn::Token; // TODO: // Add lifetime support for args with Rptr #[derive(Debug)] pub struct MethodProto { pub name: &'static str, pub args: &'static [&'static str], pub prot...
use std::convert::TryFrom; use crate::{ functions::FractalFunction, model::FractalModel, structs::FractalAudioMessage, effect::EffectId, structs::PresetBlockStatus, structs::FractalU14}; use crate::FractalProtocolError; use super::{parse_sysex_message, MessageHelper}; use crate::packed_struct::PackingError; us...
use std::{mem, slice}; #[allow(non_snake_case)] pub fn lua_bind_hash(data_bytes: &[u8]) -> u64 { let mut len = data_bytes.len() as u64; let mut hash_vals: [u64; 4] = [ 0x60ea27eeadc0b5d5, 0xc2b2ae3d27d4eb4e, 0xffffffffffffffff, 0x61c8864e7a143578, ]; let mut hash_vals_...
//! A type that can be treated as a difference. //! //! Differential dataflow most commonly tracks the counts associated with records in a multiset, but it //! generalizes to tracking any map from the records to an Abelian group. The most common generalization //! is when we maintain both a count and another accumulati...
use crate::packetizer::{Depacketizer, Payloader}; use std::io::Read; use byteorder::ReadBytesExt; use util::Error; #[cfg(test)] mod vp8_test; const VP8HEADER_SIZE: isize = 1; pub struct VP8Payloader; impl Payloader for VP8Payloader { fn payload<R: Read>(&self, mtu: isize, reader: &mut R) -> Result<Vec<Vec<u8>...
use std::fmt; use std::time::Duration; use hid; use super::super::AvailableDevice; use transport::error::Error; use transport::protocol::{Link, Protocol, ProtocolV1}; use transport::{derive_model, AvailableDeviceTransport, ProtoMessage, Transport}; mod constants { ///! A collection of constants related to the HID p...
use quick_xml::events::Event; use quick_xml::Reader; use std::path::PathBuf; use crate::println_verbose; use crate::roco::{get_choco_sources, get_chocolatey_dir, NuspecTag, Package}; pub fn get_local_packages() -> Result<Vec<Package>, Box<dyn std::error::Error>> { let mut pkgs: Vec<Package> = Vec::new(); let...
use crate::highlighting::{ Lexer, Parsed, Row, Color, get_color, Attribute, Logos, LogosLexer, JsonValue }; fn trim_function(token: &mut LogosLexer<CToken>) -> String { let mut string = token.slice().to_string(); string.pop(); string } #[derive(Debug, Logos, PartialEq)] enum CToken { #[regex("\"([^\"]*)...
use super::*; use polars_utils::flatten; #[cfg(feature = "chunked_ids")] unsafe fn apply_mapping(idx: Vec<IdxSize>, chunk_mapping: &[ChunkId]) -> Vec<ChunkId> { idx.iter() .map(|idx| *chunk_mapping.get_unchecked(*idx as usize)) .collect() } #[cfg(feature = "chunked_ids")] unsafe fn apply_opt_mappi...
// Copyright Materialize, Inc. and contributors. All rights reserved. // // 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 in the LICENSE file at the // root of this repository, or online at // /...
// Copyright (c) Microsoft. All rights reserved. use std::sync::Arc; use bytes::Bytes; use failure::Fail; use edgelet_core::crypto::{ Activate, GetHsmVersion as CoreGetHsmVersion, KeyIdentity, KeyStore as CoreKeyStore, Sign, SignatureAlgorithm, }; use edgelet_core::{Error as CoreError, ErrorKind as CoreError...
//! This module makes low-level structs available in the medium-level API if necessary. This is done //! using different strategies, depending on the characteristics of the struct. Sometimes it's just //! a type alias, sometimes a wrapper. use crate::{CommandId, SectionId}; use reaper_low::raw; use std::fmt; use st...
use connector::error::*; use failure::{Error, Fail}; use prisma_models::prelude::DomainError; #[cfg(feature = "sqlite")] use rusqlite; #[cfg(feature = "sqlite")] use libsqlite3_sys as ffi; #[derive(Debug, Fail)] pub enum SqlError { #[fail(display = "Unique constraint failed: {}", field_name)] UniqueConstrain...
extern crate chrono; use std::string::String; use std::fmt; use self::chrono::Local; /// HTTP Response pub struct Response { kind: ResponseType, headers: Vec<String>, body: Option<String>, file: Option<Vec<u8>>, } /// The HTTP response status represented as an enum. pub enum ResponseType { NotFo...