text
stringlengths
3.09k
13.9k
//! Implementation of the abstract clock for the linux platform use super::{Clock, Watch}; use crate::{ clock::TimeProperties, datastructures::common::ClockQuality, time::{Duration, Instant}, }; use fixed::traits::LossyInto; use std::{collections::HashMap, sync::mpsc}; mod raw; mod timex; pub use raw::Ra...
use std::fmt; use diagnostic::{DiagnosticMessage, Label, Note, Urls}; use value::Value; use crate::{ compiler::Diagnostics, expression::{Expr, Resolved}, parser::Node, state::{ExternalEnv, LocalEnv}, value::Kind, Context, Expression, Span, TypeDef, }; pub(crate) type Result = std::result::Res...
#![deny(clippy::all)] mod builtin; mod env; pub mod global; mod io; mod math; mod regexp; mod support; use env::env_module; use global::create_std_core; use io::add_io_package; use laythe_core::{ hooks::GcHooks, managed::Gc, module::{ModuleError, Package}, utils::IdEmitter, }; use math::add_math_module; use re...
use serenity::async_trait; use serenity::client::{Client, Context, EventHandler}; use serenity::framework::standard::StandardFramework; use serenity::model::{ channel::{Channel, ChannelType, GuildChannel}, gateway::Ready, id::GuildId, interactions::{ application_command::{ Applicatio...
/* * Tool statically unpacking HotS binaries. * * The MIT License (MIT) * * Copyright (c) 2015 athre0z * * 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, includ...
use chrono::offset::Utc; use scrypt::{scrypt_check, scrypt_simple, ScryptParams}; use sqlx::postgres::PgPool; use getrandom; use hex; use sha2::{Digest, Sha256}; use std::error::Error; pub mod api; pub mod models; pub type Db = PgPool; fn hash_password(password: &str) -> String { let params = ScryptParams::r...
use imagine::{BoxConstraint, LayoutContext, Position, Size, Widget, WidgetId}; use std::any::Any; #[derive(Copy, Clone)] pub enum FlexDirection { Horizontal, Vertical, } pub enum FlexEvent { AddChild(FlexItem), RemoveChild, } impl FlexDirection { pub fn major_axis(self, size: Size) -> f32 { ...
//! Provides the `Project` type, which represents a Node project tree in //! the filesystem. use std::env; use std::ffi::OsStr; use std::path::{Path, PathBuf}; use std::rc::Rc; use lazycell::LazyCell; use semver::Version; use crate::distro::node::{load_default_npm_version, NodeVersion}; use crate::distro::package::B...
#[cfg(test)] mod signature_hash_algorithm_test; use anyhow::Result; use std::fmt; use crate::crypto::*; use crate::error::*; // HashAlgorithm is used to indicate the hash algorithm used // https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-18 // Supported hash hash algorithms #[deriv...
use std::env; use std::error::Error; use std::fs; use std::fs::File; use std::io; use std::io::{BufRead, BufReader}; use std::path::PathBuf; use std::sync::mpsc; use std::sync::Arc; use std::thread; pub struct Config { verbose: bool, filename: Option<String>, ignore_filename_case: bool, content: Opti...
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ use std::sync::Arc; use common::{Diagnostic, DiagnosticsResult, FeatureFlag, Named, NamedItem, WithLocation}; use graphql_ir::{ ...
/// This function is where the kernel sets up IRQ handlers /// It is increcibly unsafe, and should be minimal in nature /// It must create the IDT with the correct entries, those entries are /// defined in other files inside of the `arch` module use core::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, AtomicUsize, ATOMI...
extern crate byteorder; use byteorder::{BigEndian, ByteOrder}; use std::str; /// Returns whether a buffer is JPEG image data. pub fn is_jpeg(buf: &[u8]) -> bool { return buf.len() > 2 && buf[0] == 0xFF && buf[1] == 0xD8 && buf[2] == 0xFF; } /// Returns whether a buffer is jpg2 image data. pub fn is_jpeg2000(buf:...
use std::path::PathBuf; use clap::Parser; use crate::AnyResult; /// A CLI intended for use by humans and machines to build GameMakerStudio 2 projects. #[derive(Parser, Debug)] #[clap(version = clap::crate_version!(), author = clap::crate_authors!())] pub struct InputOpts { #[clap(subcommand)] pub subcmd: Cla...
//! Lexing. use ::std::str; use super::env::Value; use super::op::Operator; //---------------------------------------------------------------- /// Token types. #[derive(Clone, Debug, PartialEq)] pub enum Token<'a> { /// Unknown token. /// /// It’s the caller’s responsibility to handle this with an error of some k...
use std::{convert::TryInto, error::Error as StdError, str::FromStr}; use super::Hmc; use derive_more::{Display, From, Into, IntoIterator}; use derive_new::new; use hrpc::exports::http::Uri; use http::HeaderValue; use serde::{Deserialize, Serialize}; /// Kind of the file downloaded. #[derive(Debug, Clone, Copy, Partia...
/** * [987] Vertical Order Traversal of a Binary Tree * * Given the root of a binary tree, calculate the vertical order traversal of the binary tree. * For each node at position (row, col), its left and right children will be at positions (row + 1, col - 1) and (row + 1, col + 1) respectively. The root of the tree ...
// BSD 3-Clause License // // Copyright © 2020-2021 <NAME> // Copyright © 2020-2021 VTIL Project // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must re...
/// This module defines the main traits used to dynamically operate and reflect on Rust types using Interact. use std::sync::Arc; use crate::deser::Deser; use crate::{deser, ClimbError, Climber, NodeTree, Reflector}; /// The indirect Reflect allows indirect climber or reflector access, and meant to be used as a /// t...
use std::thread; use std::sync::{Arc, Mutex, MutexGuard}; use std::time::{Duration, Instant}; use connection::{Event, Writer}; use message::Prefix; #[derive(Clone)] enum MonitorStatus { // Last activity, timespec is when. Activity(Instant), // Ping was sent, timespec is when. Ping(Instant), } #[deri...
use crate::component::datatype::DataType; use crate::index::tree::{NodeType, PagePtr, RowPtr, Tree}; use crate::storage::page::{INDEX_INTERNAL_HEADER_SIZE, INDEX_LEAF_HEADER_SIZE}; use std::cmp::PartialOrd; /// B+ Tree /// /// Internal Node /// ``` /// +---------------------------+ /// |P0|K1||P1|K1|| ... ||Pn|Kn| //...
use libc; use crate::other::*; #[derive(Copy, Clone)] #[repr(C)] pub struct clistcell { pub data: *mut libc::c_void, pub previous: *mut clistcell, pub next: *mut clistcell, } #[derive(Clone)] #[repr(C)] pub struct clist { pub first: *mut clistcell, pub last: *mut clistcell, pub count: libc::c...
use std::thread; use std::time::Duration; use std::time::Instant; use image::ColorType; use image::ImageEncoder; use image::Rgba; use image::png::PngEncoder; use log::error; use log::info; use qrcode::QrCode; use tiny_http::Method; use crate::app; use crate::config::Config; use crate::downloader; use crate::downloader...
//! Provides facilities for generating error enums representing a subset of the //! kernel's error codes (defined at //! https://github.com/tock/tock/blob/master/kernel/src/returncode.rs). To make //! conversions more efficient, they have the same numeric values as the //! ReturnCode values. They have fewer possibilite...
//! Natives/platform specific interactions. /// Basic definition of some running process. #[derive(Debug)] pub struct Process { pub pid : usize, pub name : String } #[cfg(windows)] mod natives { #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] const ...
use crate::useful; /* Structs and methods for solutions and candidate solutions to be used throughout the program */ pub mod solutions{ use std::hash::{Hash, Hasher}; use std::cmp::Ordering; use std::cmp::max; use std::mem::swap; use super::useful::{companion_id, Orientation}; //NOT oriented ...
// pathfinder/partitioner/src/builder.rs // // Copyright © 2018 The Pathfinder Project Developers. // // 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 fil...
use std::borrow::Borrow; use std::error::Error as StdError; use std::fmt::{self, Debug}; use std::hash::{Hash, Hasher}; use std::io::Write; use std::ops::Deref; use std::str; use rustc_hash::FxHashSet; use gc_arena::{Collect, Gc, GcCell, MutationContext}; use crate::Value; #[derive(Debug, Clone, Copy, Collect)] #[c...
// // Copyright 2020, <NAME>, LLC. // // 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...
use std::sync::atomic::{AtomicPtr, AtomicUsize, AtomicBool}; use std::sync::atomic::Ordering::{SeqCst}; use std::sync::{Mutex, Condvar}; use std::{mem, ptr}; use std::cell::{Cell}; use select::{_Selectable, WaitQueue, Payload}; use {Error, Sendable}; pub struct Packet<'a, T: Sendable+'a> { // The id of this chann...
// Generated by yaww-vkey, licensed under MIT/Apache2 License use gluten_keyboard::Key; use winapi::{ctypes::c_int, um::winuser}; #[inline] pub fn convert_vkey_to_key(vk: c_int, extended: bool) -> Option<Key> { match (vk, extended) { (winuser::VK_BACK, _) => Some(Key::Backspace), (winuser::VK_TAB,...
use async_trait::async_trait; use std::collections::HashMap; use tokio_tungstenite::tungstenite::Message; use super::EXCHANGE_NAME; use crate::{ clients::common_traits::{ Candlestick, Level3OrderBook, OrderBook, OrderBookTopK, Ticker, Trade, BBO, }, common::{ command_translator::CommandTran...
use serde::Deserialize; use std::{ cell::RefCell, process::Command, }; use crate::orientation::{Orientation,Rotation}; use crate::backend::{Backend,BackendError,Result}; /// struct Representing the Sway Backend pub struct Sway { orientation: Orientation, keyboards: Option<Vec<SwayInput>>, displ...
use openmls_rust_crypto::OpenMlsRustCrypto; use crate::{ ciphersuite::Secret, config::Config, test_utils::*, tree::secret_tree::SecretTreeError, tree::sender_ratchet::*, }; // Test the maximum forward ratcheting #[apply(ciphersuites_and_backends)] fn test_max_forward_distance( ciphersuite: &'static Cipher...
// // 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 // //! The Index...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Version ID Register"] pub verid: crate::Reg<verid::VERID_SPEC>, #[doc = "0x04 - Parameter Register"] pub param: crate::Reg<param::PARAM_SPEC>, _reserved2: [u8; 0x08], #[doc = "0x10 - Control Register"] pub cr: c...
use std::convert::TryFrom; use indexmap::IndexMap; use serde::{Deserialize, Serialize}; use toml::value::Value as TomlValue; use crate::{ config::{ DataType, GenerateConfig, Input, Output, TransformConfig, TransformContext, TransformDescription, }, event::{Event, Value}, internal_event...
use super::*; use std::marker::PhantomData; /// Intercom type system. #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] pub enum TypeSystem { /// Type system compatible with COM automation types. Automation, /// Type system using raw C types. Raw, } /// An incoming COM interface pointer...
use super::{Extractor, HashResult}; use crate::color::{average, Region, WhitePoint}; use crate::persist::ExtractionConfig; use crate::theme::{Colors, Palette, Theme}; use color_eyre::eyre::{Result, WrapErr}; use log::{info, trace}; use num_traits::{Float, Signed}; use palette::{FromColor, IntoColor, Srgb}; use rayon::p...
use relative_path::RelativePathBuf; use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard}; use libsyntax2::{ File, ast::{self, AstNode, NameOwner}, SyntaxNode, SmolStr, }; use {FileId, FileResolver}; type SyntaxProvider<'a> = dyn Fn(FileId) -> &'a File + 'a; #[derive(Clone, Copy, PartialEq, Eq, Ha...
use assert_approx_eq::assert_approx_eq; use statistics::distributions::*; use statistics::functions::*; use statistics::stats::*; // The exact floating point numbers are derived externally from SymPy, // Which is then rounded at 16 decimal places // Basically, though it may seem like the tests are just asserting the /...
use crate::server::api::request_ext::RequestExt; use crate::server::api::types::{period_from_string, Job, Trigger}; use crate::server::api::{auth, State}; use chrono::{DateTime, Utc}; use highnoon::{Json, Request, Responder}; use serde::{Deserialize, Serialize}; use sqlx::{Postgres, Transaction}; use std::str::FromStr;...
// Copyright © 2021-present <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 // https://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in w...
use std::collections::HashMap; use serde::ser::SerializeStruct; use serde::{Deserialize, Deserializer, Serialize, Serializer}; const PANDOC_API_VERSION: [i32; 2] = [1, 22]; #[derive(Debug, Clone, PartialEq)] pub struct Pandoc(pub Meta, pub Vec<Block>); impl Serialize for Pandoc { fn serialize<S>(&self, serializ...
use core::time::Duration; use std::str; use std::collections::HashMap; extern crate ctrlc; use libc::{access, mount, rlimit, setrlimit, perror}; use chrono::{Local, SecondsFormat}; use anyhow::{Result, bail}; use libbpf_rs::PerfBufferBuilder; use plain::Plain; use structopt::StructOpt; mod bpf; use bpf::*; #[derive(...
extern crate gl; extern crate glfw; extern crate chrono; #[macro_use] extern crate scan_fmt; mod gl_utils; mod graphics_math; mod obj_parser; use glfw::{Action, Context, Key}; use gl::types::{GLfloat, GLsizeiptr, GLvoid, GLsizei}; use std::mem; use std::ptr; use gl_utils::*; use graphics_math as math; use math:...
use crate::cli::cli::{pre_exec, Colors, Palette}; use clap::{App, AppSettings, Arg, ArgMatches}; use fancy_regex::Regex; pub struct Cmd {} impl Cmd { pub fn new() -> App<'static> { App::new("fdisk") .args(&[ Arg::new("FILE").about(r#"[FILE]"#), Arg::new("sector-...
extern crate minifb; extern crate structopt; #[macro_use] extern crate structopt_derive; extern crate gba_compression; extern crate byteorder; use minifb::{Key, WindowOptions, Window, Scale}; use structopt::StructOpt; use std::num::ParseIntError; use std::str::FromStr; use std::io::{Read, Cursor}; use std::fs::File; u...
use plastic_core::{ nes_controller::{StandardNESControllerState, StandardNESKey}, nes_display::{Color as NESColor, TV_HEIGHT, TV_WIDTH}, BackendEvent, UiEvent, UiProvider, }; use std::collections::HashSet; use std::io; use std::sync::{ mpsc::{Receiver, Sender}, Arc, Mutex, }; use std::thread; use st...
// (C) Copyright 2019-2020 Hewlett Packard Enterprise Development LP use std::convert::TryInto; use std::fmt; use crate::parser::Pair; use crate::dockerfile_parser::Dockerfile; /// An offset used to adjust proceeding Spans after content has been spliced #[derive(Debug)] struct SpliceOffset { position: usize, off...
use tracing::debug; use async_trait::async_trait; use crate::store::*; use crate::core::*; use crate::partition::store::*; use crate::partition::*; use super::*; pub type TopicMetadata<C> = MetadataStoreObject<TopicSpec, C>; pub type TopicLocalStore<C> = LocalStore<TopicSpec, C>; pub type DefaultTopicMd = TopicMetada...
//! Date and time utils for HTTP. //! //! Multiple HTTP header fields store timestamps. //! For example a response created on May 15, 2015 may contain the header //! `Date: Fri, 15 May 2015 15:34:21 GMT`. Since the timestamp does not //! contain any timezone or leap second information it is equvivalent to //! writing 1...
use crate::linalg::distance::{PairwiseDistance}; use crate::linalg::utils::get_rng; use rand::seq::SliceRandom; use std::cmp::Ordering; use std::collections::{HashMap, HashSet, BTreeSet}; #[derive(Debug)] pub struct VectorNode { pub id: usize, pub vec: Vec<f32>, } #[derive(Debug)] struct CostedItem { pub ...
/* * Copyright (c) 2020 <NAME> <<EMAIL>> */ //! Parse and validate command line arguments. use crate::logfile::{Pattern, ProblemType, file_modified}; use directories::ProjectDirs; use regex::Regex; use std::env::temp_dir; use std::fs::read_dir; use std::path::PathBuf; use std::time::SystemTime; /// Processed and t...
extern crate custom_error; extern crate goblin; extern crate regex; extern crate yaml_rust; use itertools::Itertools; use std::io::Read; pub struct FilteredSymbols { export: Vec<String>, strip: Vec<String>, } impl FilteredSymbols { fn new() -> Self { FilteredSymbols { export: Vec::new...
use crate::pgp::AsciiArmorKind; use byteorder::{BigEndian, ReadBytesExt}; use nom::bits::bits; use nom::bits::complete::take as take_bits; use nom::branch::alt; use nom::bytes::complete::tag; use nom::bytes::complete::take; use nom::bytes::complete::take_while; use nom::character::complete::{alphanumeric1, char, newlin...
#![feature(decl_macro)] #[macro_use] extern crate rocket; extern crate reqwest; //use reqwest::blocking::Response; use rocket::response::content::Html; use rocket::http::RawStr; use rocket_contrib::serve::StaticFiles; extern crate url; use url::Url; extern crate serde; struct Index { name : String, url : U...
use std::collections::{BTreeSet, HashSet}; use std::fs::create_dir_all; use std::marker::PhantomData; use std::ops::Deref; use std::path::Path; use std::sync::Arc; use heed::{EnvOpenOptions, RoTxn}; use milli::obkv_to_json; use serde::{de::Deserializer, Deserialize}; use serde_json::{Map, Value}; use crate::helpers::...
//! Shared types internal to transport crate use crate::metrics::{ControlPlaneMetrics, DataPlaneMetrics, SendQueueMetrics}; use ic_crypto_tls_interfaces::TlsHandshake; use ic_interfaces::transport::AsyncTransportEventHandler; use ic_logger::ReplicaLogger; use ic_types::transport::{ FlowId, FlowTag, TransportClient...
//============================================================================== // Open crates and libraries //============================================================================== use rayon::prelude::*; use fractal::definitions::*; //=========================================================================...
// Additional parameters for Android build of BoringSSL. const CMAKE_PARAMS_ANDROID: &[(&str, &[(&str, &str)])] = &[ ("aarch64", &[ ("ANDROID_TOOLCHAIN_NAME", "aarch64-linux-android-4.9"), ("ANDROID_NATIVE_API_LEVEL", "21"), ( "CMAKE_TOOLCHAIN_FILE", "${ANDROID_NDK_HO...
//! Moving average convergence divergence //! An rust implementation for the algorithm presented in https://github.com/woonhulktin/HETSA //! //! ## Context //! //! This is a computation used in the financial sector to show the relationship between two //! moving averages of a security's price. See [0] for more informa...
use std::cmp::Ordering; use std::collections::HashSet; use std::iter::Sum; use std::ops::{Add, AddAssign}; use std::str::FromStr; fn cmp(x: i64, y: i64) -> i64 { match x.cmp(&y) { Ordering::Greater => -1, Ordering::Less => 1, Ordering::Equal => 0, } } fn gcd(x: u64, y: u64) -> u64 { ...
/* * Copyright 2018 Intel Corporation * * 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 agre...
// Copyright 2017 TiKV Project Authors. Licensed under Apache-2.0. use std::error::Error as StdError; use std::fmt::Display; use std::io; use std::num::ParseFloatError; use std::str::Utf8Error; use std::string::FromUtf8Error; use std::{error, str}; use quick_error::quick_error; use regex::Error as RegexpError; use se...
use crate::avm1::Object as Avm1Object; use crate::avm2::{ Activation as Avm2Activation, Error as Avm2Error, Namespace as Avm2Namespace, Object as Avm2Object, QName as Avm2QName, StageObject as Avm2StageObject, TObject as Avm2TObject, }; use crate::backend::render::ShapeHandle; use crate::context::{RenderCon...
// // Copyright 2019 The Project Oak Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law o...
// Copyright (c) 2021 <NAME> // // This software is released under the MIT License. // https://opensource.org/licenses/MIT use std::f64; use std::ops::Index; #[macro_use] mod macros { /// Creates a new double-double from another number or from a string. /// /// The argument can be any expression that eval...
use crate::svg::get_svg; use druid::{ BoxConstraints, Command, Cursor, Env, Event, EventCtx, LayoutCtx, LifeCycle, LifeCycleCtx, PaintCtx, Point, RenderContext, Size, Target, UpdateCtx, Widget, }; use lapce_data::{ command::{CommandKind, LapceCommand, LapceWorkbenchCommand, LAPCE_COMMAND}, config::Lapce...
#![macro_use] use core::future::Future; use core::task::Poll; use embassy::interrupt::{Interrupt, InterruptExt}; use embassy::util::{AtomicWaker, OnDrop}; use futures::future::poll_fn; use crate::dma::{Channel, Request}; use crate::interrupt; use crate::pac; use crate::pac::bdma::vals; use crate::rcc::sealed::RccPer...
//! Token values. /// Keyword (a.k.a., reserved word). /// /// Reference: [Erlang's Reserved Words][Reserved Words] /// /// [Reserved Words]: http://erlang.org/doc/reference_manual/introduction.html#id61721 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)] pub enum Keyword { ...
use crate::core::compiler::{CompileMode, Kind}; use crate::core::{profiles::Profile, Package, Target}; use crate::util::hex::short_hash; use std::cell::RefCell; use std::collections::HashSet; use std::fmt; use std::hash::{Hash, Hasher}; use std::ops::Deref; /// All information needed to define a unit. /// /// A unit i...
use handlebars::Handlebars; use palette::{Hsl, RgbHue}; use palette::rgb::Rgb; use palette::FromColor; use std::iter; pub fn render(template: &str, source: &str, hue: Hsl, verbose: u16) { let (red, green, blue) = hsl_to_rgb(hue); let mut reg = Handlebars::new(); handlebars_helper!(hex2: |v: i64| format!("{...
use super::*; use crate::util::memory; use crate::util::Address; use crate::util::{ constants::{BITS_IN_WORD, BYTES_IN_PAGE, LOG_BITS_IN_BYTE}, heap::layout::vm_layout_constants::LOG_ADDRESS_SPACE, }; use std::io::Result; /// Performs address translation in contiguous metadata spaces (e.g. global and policy-sp...
//! # Stopwatch //! //! A stopwatch that mimics iOS's stopwatch. //! //! ## Usage //! //! - Use `Stopwatch::new()` to initialise a new stopwatch instance. The stopwatch is paused //! at `00:00` and will **not** run until you call `.resume()` or `.pause_or_resume()`. //! - While running: //! - Call `.lap()` to recor...
use crate::{bitmap::Bitmap, buffer::Buffer, datatypes::DataType}; use super::{ display_fmt, display_helper, specification::check_offsets, specification::Offset, Array, GenericBinaryArray, }; mod ffi; mod iterator; pub use iterator::*; mod from; mod mutable; pub use mutable::*; /// A [`BinaryArray`] is a null...
use crate::PeerId; use crate::{Error, ErrorKind}; use bytes::Bytes; use libp2p::core::{AddrComponent, Multiaddr}; use libp2p::multiaddr::ToMultiaddr; use libp2p::secio; use log::info; use rand; use rand::Rng; use std::fs; use std::io::Read; use std::io::Write; use std::io::{Error as IoError, ErrorKind as IoErrorKind}; ...
extern crate checksums; extern crate libc; extern crate madato; extern crate num_format; extern crate subprocess; extern crate tempfile; use num_format::ToFormattedString; fn main() -> Result<(), Box<dyn std::error::Error>> { let args = std::env::args().collect::<Vec<_>>(); if args.len() != 2 { Err("u...
// Copyright 2019, The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following // disclai...
#![allow(unused_assignments)] extern crate proc_macro; use std::collections::HashMap; use syn::{parse_macro_input, AttributeArgs, ItemFn}; use crate::proc_macro::TokenStream; use crate::macros::crud_table_impl::{impl_crud_driver, impl_crud}; use crate::macros::sql_impl::impl_macro_sql; use crate::macros::py_sql_impl...
use crate::Solid; use cgmath::{prelude::*, Vector3}; use std::iter::repeat; /// Build a binary axis-aligned bounding box tree in `O(n^2)` where `n = solids.len()` // TODO: Mark root-ness externally and allow combining nodes/final_tree pub fn build_tree(solids: &[Solid]) -> Vec<Node> { let mut nodes: Vec<Option<Nod...
// Copyright 2015 <NAME>. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. // // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARR...
use std::fs::File; use std::io::{BufRead, BufReader}; use std::collections::{HashMap, HashSet}; type IgredientName = String; type Allergen = String; // ------------------ Information ------------------ struct Information { lines : Vec<(HashSet<Allergen>, HashSet<IgredientName>)>, possibilities : HashMap<Aller...
//! wrapper for x86 target #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] use crate::*; use libc::c_int; //Registrers pub const UNW_TDEP_IP: u32 = x86_regnum_t_UNW_X86_EIP; pub const UNW_TDEP_SP: u32 = x86_regnum_t_UNW_X86_ESP; pub const UNW_TDEP_BP: u32 = x86_regnum_t_UN...
use std::error; use std::net::{IpAddr, SocketAddr}; use std::sync::Arc; use failure::Fallible; use futures::future; use futures::{Future, Stream}; use http::{Request, Response}; use hyper; use hyper::body::Payload; use hyper::server::conn::AddrIncoming; use hyper::Body; use tokio::io::{AsyncRead, AsyncWrite}; use toki...
use std::collections::HashSet; use syntax::ast::*; use syntax::ptr::P; use syntax::symbol::Symbol; use crate::ast_manip::{FlatMapNodes, MutVisitNodes}; use crate::command::{CommandState, Registry}; use crate::driver::{parse_ty}; use crate::path_edit::fold_resolved_paths_with_id; use crate::transform::Transform; use cr...
use crate::{ error::*, type_engine::*, CallPath, CompileResult, Ident, TypeInfo, TypedDeclaration, TypedFunctionDeclaration, }; use crate::semantic_analysis::{ ast_node::TypedStorageDeclaration, declaration::TypedStorageField, TypeCheckedStorageAccess, }; use sway_types::span::Span; use std::collections:...
use crate::util::*; use crate::Generator; use bytes::Bytes; use pecan::prelude::*; use pecan::reflection::*; use pecan_types::google::protobuf; use std::collections::HashMap; #[derive(Clone, Debug, Default)] pub struct File { module_prefix: String, target: String, proto: FileDescriptorProto, proto3: bo...
// Copyright (c) 2021 Harry [Majored] [<EMAIL>] // MIT License (https://github.com/Majored/rs-async-zip/blob/main/LICENSE) //! A module which supports writing ZIP files. use crate::error::Result; use crate::header::{CentralDirectoryHeader, GeneralPurposeFlag, LocalFileHeader, EndOfCentralDirectoryHeader}; use crate::...
use smol::lock::Mutex; use std::cmp::Eq; use std::convert::TryInto; use std::fmt; use std::sync::Arc; use std::time::{Duration, Instant}; use arc_swap::ArcSwapOption; use smol::Timer; /// `std::Vec` representing one major timeframe of `duration` length, /// divided in `size` slots of which each may contain one MAVLin...
/// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // * Redistributions of source code must retain the above copyright // notice, this list of condi...
// Copyright 2016 TiKV Project Authors. Licensed under Apache-2.0. use chrono::{DateTime, Duration, Utc}; use std::fs::{self, File, OpenOptions}; use std::io::{self, ErrorKind, Write}; use std::path::{Path, PathBuf}; /// Adds `Duration` to the initial date and time. fn compute_rotation_time(initial: &DateTime<Utc>, t...
// Copyright (c) 2015 const-cstr developers // Copyright (c) 2017 const-cstr-fork developers // 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. All files in t...
// Copyright 2015 <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 writi...
use std::collections::HashMap; use regex::Regex; use tera::{Tera, Context, Value, to_value}; use errors::{Result, ResultExt}; lazy_static!{ // Does this look like a shortcode? pub static ref SHORTCODE_RE: Regex = Regex::new( r#"\{(?:%|\{)\s+(\w+?)\((\w+?="?(?:.|\n)+?"?)?\)\s+(?:%|\})\}"# ).unwrap...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. //! Contains STARK proof struct and associated components. use crate::{ProofOptions, TraceInfo}; use core::cmp; use fri::FriProof; use ma...
//! Manage BigQuery streaming API. use crate::auth::ServiceAccountAuthenticator; use crate::error::BQError; use crate::model::data_format_options::DataFormatOptions; use crate::model::table_data_insert_all_request::TableDataInsertAllRequest; use crate::model::table_data_insert_all_response::TableDataInsertAllResponse; ...
//tag::parse[] /// parse input into integers /// return bit-length of values in addition pub fn parse(input: &str) -> (Vec<usize>, usize) { let len = input .lines() .map(|line| line.len()) .next() .expect("No lines"); let values = input .lines() .map(|line| usize:...
//! Multi producer single customer remote channel. //! //! The sender and receiver can both be sent to remote endpoints. //! The channel also works if both halves are local. //! Forwarding over multiple connections is supported. //! //! This has similar functionality as [tokio::sync::mpsc] with the additional //! abili...
use yaml_rust::{Yaml}; use crossterm::{Color, style}; #[derive(Debug, Clone)] pub struct TextStyle { pub text: String, pub background: Option<Color>, pub color: Option<Color>, pub highlighted_color: Option<Color>, pub highlighted_background: Option<Color>, } impl TextStyle { pub fn get_console...