text
stringlengths
3.09k
13.9k
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 mod access; pub use access::Access; use move_binary_format::normalized::Type; use move_core_types::{ account_address::AccountAddress, language_storage::{ResourceKey, TypeTag}, }; use std::{ collections::btree_map::BTreeMap...
//! Database used for testing `hir_def`. use std::{ fmt, panic, sync::{Arc, Mutex}, }; use base_db::{salsa, CrateId, FileId, FileLoader, FileLoaderDelegate, Upcast}; use base_db::{AnchoredPath, SourceDatabase}; use hir_expand::db::AstDatabase; use hir_expand::diagnostics::Diagnostic; use hir_expand::diagnosti...
extern crate rtt; extern crate rand; use std::cmp::{min, max}; use std::collections::HashSet; use rand::Rng; use rtt::util::rtt::vec_slist::{EmptyRandomTree, RandomTree, NodeRef}; type Map<'a> = &'a [&'a [u8]]; fn main() { let maze: Map = &[b"###############", b"# * # ##########", ...
#![allow(clippy::needless_pass_by_value, clippy::if_not_else)] extern crate proc_macro; use proc_macro::TokenStream; use proc_macro2::{Span, TokenStream as TokenStream2, TokenTree}; use quote::quote; use syn::parse::{Nothing, ParseStream}; use syn::punctuated::Punctuated; use syn::{ parse_macro_input, token, Data...
use std::{sync::Mutex, time::Duration}; use crossbeam::channel::unbounded; use once_cell::sync::Lazy; use tracing::error; use mayastor::{ bdev::nexus_lookup, core::{MayastorCliArgs, MayastorEnvironment, Mthread, Reactor}, rebuild::{RebuildJob, RebuildState}, }; use rpc::mayastor::ShareProtocolNexus; pub ...
use std::sync::Arc; use tbot::{contexts::Command, types::parameters, Bot}; use tokio::sync::Mutex; use crate::data::Database; mod export; mod rss; mod start; mod sub; mod unsub; macro_rules! add_handlers { ($event_loop: ident, $opt: ident, $env: ident, [$( $cmd: ident),*]) => { $({ let env =...
use std::borrow::Cow; use bytes::{ByteOrder, BytesMut}; use nom::{IResult, be_i16, be_i32}; use errors::Result; use protocol::{parse_response_header, parse_string, ApiVersion, Encodable, ErrorCode, NodeId, ParseTag, PartitionId, Record, RequestHeader, ResponseHeader, WriteExt, ARRAY_LEN_SIZE, STR_LEN_...
use crate::{AuthorMap, VersionTag}; use handlebars::Handlebars; use std::collections::BTreeMap; use std::fs; use std::path::Path; pub fn render( by_version: BTreeMap<VersionTag, AuthorMap>, all_time_map: AuthorMap, ) -> Result<(), Box<dyn std::error::Error>> { copy_public()?; index(&all_time_map, &by_v...
extern crate birl; use std::env::args; use std::process::exit; use birl::context::Context; use birl::compiler::CompilerHint; use birl::context::BIRL_GLOBAL_FUNCTION_ID; pub const SHELL_COPYRIGHT : &'static str = "© 2019 <NAME>, <NAME>"; fn start_interactive_console(c: &mut Context) { /* Print heading info. */ epri...
// Copyright 2021 TiKV Project Authors. Licensed under Apache-2.0. use std::collections::HashMap; use std::marker::PhantomData; use crate::decode_properties::DecodeProperties; use crate::{RocksEngine, UserProperties}; use api_version::{APIVersion, KeyMode, RawValue}; use engine_traits::{Range, Result, TtlProperties, ...
use std::io::Error as IoError; use std::io::ErrorKind; use std::io::SeekFrom; #[cfg(unix)] use std::os::unix::io::AsRawFd; use async_trait::async_trait; use futures_lite::AsyncSeekExt; use log::trace; #[cfg(unix)] use crate::file_slice::AsyncFileSlice; use super::File; /// Utilites for dealing with Async file #[a...
use crate::prelude::*; impl ZipMapElements<f32, usize> for Cpu { /// TODO make this private to this module somehow /// NOTE: This is extremely specific to [gather_last_dim()]. This is used for setting the /// derivative in that function. fn zip_map_assign<F: FnMut(&mut f32, &usize)>(l: &mut f32, _: &us...
mod dir; mod error; use cargo_tally::Crate; use chrono::{NaiveDateTime, Utc}; use flate2::write::GzEncoder; use flate2::Compression; use git2::{Commit, Repository}; use indicatif::{ProgressBar, ProgressDrawTarget, ProgressStyle}; use lazy_static::lazy_static; use regex::Regex; use semver::Version; use structopt::Struc...
// Copyright 2013 <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 writing, ...
// See: https://raw.githubusercontent.com/srijs/rust-tokio-retry/master/src/strategy/fibonacci_backoff.rs // This has been adapted to work with futures_retry, which offers no out of the box strategies. // base example: https://gitlab.com/mexus/futures-retry/-/blob/d3ba6a80578ebf5a2a996664902d18e048cd55f5/examples/tcp-c...
#[cfg(test)] macro_rules! test_cases { ($($(#[$m:meta])* $c:ident { $($a:tt)* } { $($s:tt)* } { $($d:tt)* };)*) => { $( $(#[$m])* #[test] fn $c() { let embedder = crate::Embedder::new(crate::Config::default()); let attrs: crate::AttributeAr...
use crate::murder_mystery::predicate::*; use serde_json::{Value, json}; pub struct PredicateSignatureSmallRegistry { names: Vec<String>, } impl PredicateSignatureSmallRegistry { pub fn new() -> PredicateSignatureSmallRegistry { PredicateSignatureSmallRegistry { names: vec![], } ...
#![allow(dead_code, non_camel_case_types, non_snake_case, non_upper_case_globals, unused_variables, unused_imports)] #[macro_use] extern crate winapi; extern crate user32; use winapi::{GUID, REFGUID, REFIID, LPVOID, REFCLSID, HRESULT, BOOL, S_FALSE, S_OK, NOERROR, CLASS_E_CLASSNOTAVAILABL...
use derive_more::{From, Into}; use std::f64::consts; #[derive(Debug, Clone, PartialEq)] pub struct Range { start: f64, stop: f64, min: f64, max: f64, diff: f64, reverse: bool, } impl Range { pub fn new(start: f64, stop: f64) -> Self { if start <= stop { Self { ...
use std::convert::TryInto; use nom::{IResult, bytes::complete::tag, number::complete::le_u32}; const GT_MAGIC: &[u8; 4] = &[0x47, 0x54, 0x32, 0x30]; // "GT20" pub struct GTHeader { pub gt_signature: [u8;4], pub gt_uncompressed_size: u32, pub gt_overlap: u32, // Overlap for in-situ decompression pub gt_skip: ...
//! Persist compacted data to parquet files in object storage use arrow::record_batch::RecordBatch; use bytes::Bytes; use iox_object_store::ParquetFilePath; use object_store::DynObjectStore; use parquet_file::metadata::{IoxMetadata, IoxParquetMetaData}; use snafu::{ResultExt, Snafu}; use std::sync::Arc; #[derive(Debu...
use fltk::{app, button::Button, group::*, frame::Frame, enums::*, group::Pack, prelude::*, window::Window}; use state::Storage; use std::collections::HashMap; use std::sync::Mutex; //convience macro for extracting value of an enum #[macro_use] macro_rules! as_variant { ($value:expr, $variant:path) => { mat...
use crate::git::GitRepo; use crate::inode::InodeGen; use anyhow::Result; use fuse::{ FileAttr, FileType, Filesystem, ReplyAttr, ReplyData, ReplyDirectory, ReplyEntry, Request, }; use git2::{ObjectType, Oid}; use lazy_static::lazy_static; use libc::ENOENT; use log::{debug, error}; use std::convert::TryFrom; use std:...
use midi_control::consts; use midi_control::sysex::USysExDecoder; use midi_control::vendor::arturia; use midi_control::{MidiMessage, ControlEvent}; use std::sync::mpsc::{channel, Sender, Receiver}; use std::sync::{Arc, Mutex}; type ArcMutex<T> = Arc<Mutex<T>>; use super::{SharedState, SelectionMode}; use super::event...
// بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم // This file is part of Setheum. // Copyright (C) 2019-2021 <NAME>. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as publ...
/* * Copyright 2017-2018 <NAME> * * Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or * http://www.apache.org/licenses/LICENSE-2.0> or the MIT license * <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your * option. This file may not be copied, modified, or distributed * except according ...
use crate::changelogs::{Migration, Query}; use crate::configuration_properties::DatasourceProperties; use crate::driver::{DatasourceWrapper, Driver, DriverFactory, RmigEmptyResult}; use crate::error::Error; use crate::tera_manager::TeraManager; use async_trait::async_trait; use log::{debug, error, info}; use r2d2_oracl...
use crate::convert::FruityTryFrom; use crate::introspect::FieldInfo; use crate::introspect::IntrospectObject; use crate::introspect::MethodInfo; use crate::resource::resource::Resource; use fruity_any::*; use std::collections::HashMap; use std::io::Read; use yaml_rust::Yaml; use yaml_rust::YamlLoader; /// Settings col...
// Traits pub use crate::traits::{Configurable, Plotable, Saveable}; use core::fmt::Display; use core::ops::Add; /// Compare various ``Sequence``s. pub mod comparison; pub use comparison::SequenceViolins; /// Sequence of violin plots. /// /// # Examples /// /// Quick plot. /// ```no_run /// use preexplorer::prelude:...
//! Build script. //! //! The script takes static data obtained from the API and generates some code //! for inclusion in the library source, including e.g. the `Currency` enum. extern crate itertools; #[macro_use] extern crate lazy_static; #[macro_use] extern crate maplit; extern crate serde...
extern crate parity_wasm; use std::env; use std::fmt; use std::rc::Rc; use parity_wasm::elements::Module; use parity_wasm::interpreter::{ Error as InterpreterError, HostModule, HostModuleBuilder, ModuleInstance, UserError, HostState, StateKey }; #[derive(Debug)] pub enum Error { OutOfRange, AlreadyOccupied, Inte...
use crate::context::CmpContext; use crate::context::ValidationContext; use crate::core::Type; use crate::core::TypeRef; use crate::identifier::Identifier; use crate::metadata::Meta; use crate::metadata::MetadataSetter; use crate::metadata::WithMetadata; use crate::schema_builder::{BaseTypeSchemaBuilder, SchemaBuilder};...
use crate::channels::SlotRequestReceiver; use crate::ConnectedSocket; use crossbeam_utils::thread::Scope; use log::{debug, error, info, warn}; use rav1e::prelude::*; use rav1e_by_gop::*; use serde::de::DeserializeOwned; use serde::Serialize; use std::cmp; use std::collections::VecDeque; use std::sync::{Arc, Mutex}; use...
pub(super) fn run() -> Result<(), super::Error> { let line = super::read_input_lines::<String>("day19")?.next().ok_or("file is empty")??; let ram: crate::intcode::Ram = line.parse()?; // Sanity test that beam starts at (0, 0) if !test_beam(0, 0, &ram)? { return Err("beam does not start at (0, 0)".into()); } {...
use std::convert::TryFrom; use std::fmt; use std::fmt::{Display, Formatter}; use std::hash::Hash; use std::str::FromStr; use arcstr::ArcStr; use nanoid::nanoid; use serde::{Deserialize, Serialize}; // Char set used to create the codes. // We do not use the default because it is not correctly sorted in DB. const ALPHA...
use std::cell::RefCell; use std::mem; use std::slice; use libc::c_void; use thread_local::ThreadLocal; use once_cell::sync::Lazy; use parking_lot::{Mutex, RwLock, const_mutex, const_rwlock}; // data, len, game player, unique player, orig pub type IngameCommandHook = unsafe extern fn(*const u8, u32, u32, u32, unsa...
use crate::error::{GeozeroError, Result}; use std::collections::HashMap; use std::fmt; /// Feature property value. #[derive(PartialEq, Debug)] pub enum ColumnValue<'a> { Byte(i8), UByte(u8), Bool(bool), Short(i16), UShort(u16), Int(i32), UInt(u32), Long(i64), ULong(u64), Float(f...
use std::collections::HashMap; use std::fmt::Debug; use crate::errors::{FhttpError, Result}; use deno_core::{RuntimeOptions, Snapshot}; static FHTTP_SNAPSHOT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/FHTTP_SNAPSHOT.bin")); #[derive(Debug, Eq, PartialEq, Clone)] pub enum ResponseHandler { Json { json...
use std::f64; use luster::{Lexer, Token}; fn test_tokens(source: &str, tokens: &[Token<Box<[u8]>>]) { let mut lexer = Lexer::new(source.as_bytes(), |s| s.to_vec().into_boxed_slice()); let mut i = 0; while let Some(token) = lexer.read_token().unwrap() { assert!(i < tokens.len(), "too many tokens");...
use alloc::{string::String, vec::Vec}; use alloc::format; use crate::arch::i386::cmos::CMOS; use crate::{clear, print, println, sys::{self, mem}}; use crate::run; mod cmd; use super::keyboard; use super::ustar::metadata::Metadata; pub type ShellProgram = fn(&Vec<&str>) -> usize; pub fn start() { ...
// Copyright © 2020 <NAME> and Rajeswari // [This program is licensed under the "MIT License"] // Please see the file LICENSE in the source // distribution of this software for license terms. use coordinates::*; use std::env; use std::error::Error; use std::fs::File; use std::{thread, time}; /// The below function ch...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 // Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 //! This file defines ledger store APIs that are related to the main ledger accumulator, from the //! root(LedgerInfo) to leaf(TransactionInfo). u...
extern crate libc; use libc::{c_char, c_float, c_int, c_void}; #[repr(C)] pub struct ohmd_context { __private: c_void, } #[repr(C)] pub struct ohmd_device { __private: c_void, } #[repr(C)] #[allow(non_camel_case_types)] #[derive(Clone, Copy)] pub enum ohmd_float_value { OHMD_ROTATION_QUAT = 1, OHMD_LEF...
// Copyright (c) 2022, Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 use async_trait::async_trait; use bytes::Bytes; use futures::stream::futures_unordered::FuturesUnordered; use futures::stream::StreamExt; use futures::SinkExt; use std::net::SocketAddr; use std::time::Duration; use sui_network::transport::...
use super::*; pub(super) fn write( mut buf: String, node: Node, fmts: &[Fmt], col: usize, map: KeyedIter, field_name: Option<&str>, ) -> String { let fmt = fmts.get(node.index()).unwrap(); let id = node.kserd().id(); let prefix = |mut buf| { maybe_write_nonprim_ident(&mut ...
use memflow::os::process::*; use memflow::prelude::v1::*; use libc::pid_t; use procfs::KernelModule; use itertools::Itertools; pub mod mem; use mem::ProcessVirtualMemory; pub mod process; use process::LinuxProcess; pub struct LinuxOs { info: OsInfo, cached_modules: Vec<KernelModule>, } impl LinuxOs { ...
// 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 carnelian::input::{self}; const HID_USAGE_KEY_ENTER: u32 = 0x28; const HID_USAGE_KEY_ESC: u32 = 0x29; const HID_USAGE_KEY_BACKSPACE: u32 = 0x2a; const...
use p256::elliptic_curve::{ group::{ff::PrimeField, GroupEncoding}, ops::{LinearCombination, Reduce}, sec1::{FromEncodedPoint, ToEncodedPoint}, Field, Group, IsHigh, }; use std::ops::Neg; use zeroize::Zeroize; #[derive(Copy, Clone, Eq, PartialEq, Zeroize)] pub struct Scalar { s: p256::Scalar, } im...
//! The loader handles the different loader implementations and manage //! them for the `DownloadManager`. pub mod so; pub mod filer; use crate::error::*; use crate::models::{DownloadFile, FileStatus, SmartDownloadList}; use self::so::ShareOnline; use self::filer::Filer; use crate::config::Config; use std::thread; us...
use clap::{App, Arg}; use futures::stream::{self, StreamExt}; use std::time::Duration; use tokio::net::TcpStream; use tokio::time::timeout; #[derive(Debug, Clone, PartialOrd, PartialEq, Eq, Ord)] enum PortResult { Open(String, u16), Closed(String, u16), } impl PortResult { pub fn is_open(&self) -> bool { ...
use nalgebra::{ DMatrix, DMatrixSlice }; use num_integer::Integer; type M = DMatrix<isize>; type MSlice<'a> = DMatrixSlice<'a, isize>; /// to_slice converts DMatrix to DMatrixSlice fn to_slice(m: &M) -> MSlice { m.slice((0, 0), (m.nrows(), m.ncols())) } /// Quadrants /// /// Input: reference to matrix sl...
extern crate conrod; extern crate glium; extern crate glutin; extern crate rusttype; use conrod::{color, Borderable, Colorable, Positionable}; use conrod::widget::*; mod glutin_glue; // -- // In a real app, App would likely be split out into its own module, as would the layout code. // // Things are kept together in...
use crate::{Dictionary, Document, Object, ObjectId}; use crate::{Error, Result}; impl Document { /// Create new PDF document with version. pub fn with_version<S: Into<String>>(version: S) -> Document { let mut document = Self::new(); document.version = version.into(); document } ...
pub mod load; pub use self::load::*; use std::any::Any; use std::fmt; use module::{event, ModuleData, Sample}; use util::{NOTES, BinaryRead}; use ::*; pub struct StmData { pub name: String, pub speed: u8, pub num_patterns: u8, pub global_vol: u8, pub instruments: Vec<StmInstrument>, pub orde...
use crate::locale::Locale; use crate::road::Designated; use crate::tag::{TagKey, Tags}; use crate::transform::tags_to_lanes::access_by_lane::Access; use crate::transform::tags_to_lanes::{ Infer, LaneBuilder, LaneBuilderError, Oneway, RoadBuilder, TagsToLanesMsg, }; use crate::transform::RoadWarnings; mod busway; u...
use std::collections::HashMap; use std::fs; use std::path::Path; use amethyst::config::ConfigError; use amethyst::prelude::*; use amethyst::renderer::palette::Srgba; use amethyst::renderer::resources::Tint; use serde::{Deserialize, Serialize}; use crate::components::{MapCursor, Pos}; use crate::levels::{load_asset_fr...
use std::fmt; use rand::{rngs::{StdRng}, RngCore, Rng, SeedableRng, distributions::{Distribution, Uniform}}; struct Ising2DContext<const L: usize> { adj : [[[(usize, usize); 4]; L]; L], range : Uniform<usize>, rand_rng : StdRng } impl<const L: usize> fmt::Debug for Ising2DContext<L> { fn fmt(&self, f:...
use crate::constants; use crate::metric; use crate::protocols::native::{AggregationMethod, Payload}; use crate::source::{BufferedPayload, PayloadErr, TCPConfig, TCPStreamHandler, TCP}; use crate::util; use mio; use protobuf; use std::net; use std::str; use std::sync::atomic::{AtomicUsize, Ordering}; /// Total payloads...
/* * error.rs is part of slaps. * Copyright (C) 2020 rd <<EMAIL>> * License: WTFPL */ pub use crate::clap::{Error as ClapError, ErrorKind}; pub use crate::shlex::MismatchedQuotes; use std::fmt::{Display, Formatter}; use std::{error, fmt, io}; /// Variant of all sub-types of errors returned by the library. #[allow(...
use std::f32::consts::PI; use bevy::prelude::*; use bevy_prototype_lyon::prelude::*; use rand::Rng; use rand_distr::{Distribution, Normal}; use crate::selection::Selectable; const BAND_SIZE_MIN: f32 = 170.0; const BAND_SIZE_MAX: f32 = 200.0; const BAND_Z_INDEX_START: f32 = -10.0; const EMPTY_AREA_SIZE_MIN: f32 = 250...
//! This module provides the the [`StateMachine`]'s `Request`, `RequestSender` and `RequestReceiver` //! types. //! //! [`StateMachine`]: crate::state_machine::StateMachine use std::{ pin::Pin, task::{Context, Poll}, }; use derive_more::From; use futures::Stream; use thiserror::Error; use tokio::sync::{mpsc, o...
use imgui::*; use std::path::*; use std::fs; use super::util::get_absolute_path; pub struct OpenFileDialog { current_dir : String, item_list : Vec<String>, selected : usize, open : bool, } impl OpenFileDialog { pub fn new() -> OpenFileDialog { OpenFileDialog { curre...
use super::utils::assert_render_template_eq; use temple::error::Result; use temple::value::{Value, ValuesMap}; #[test] fn basic_math_expression() -> Result<()> { assert_render_template_eq("{{10 + 1}}", "11", None)?; assert_render_template_eq("{{ -1 }}", "-1", None)?; assert_render_template_eq("{{ 1 - 10}}"...
use tetra::{ graphics::{ self, Drawable, Color, Rectangle, }, Context, math::{ Vec2, Vec3, Mat4, }, }; use super::{ DrawParams, Drawables, }; use std::cmp::Ordering; use shipyard::{ self, *, }; #[derive(Default)] pub struct Dra...
use rustls::{ AllowAnyAnonymousOrAuthenticatedClient, AllowAnyAuthenticatedClient, KeyLogFile, NoClientAuth, RootCertStore, ServerConfig, }; // use webpki::{TLSServerTrustAnchors, TrustAnchor}; use webpki_roots::TLS_SERVER_ROOTS; // use openssl::ssl::{SslAcceptor, SslFiletype, SslMethod}; // use actix_server::s...
use std::{ fs, path::{Path, PathBuf}, process, time::Instant, }; mod build; mod config; mod error; mod tool; use crate::{ build::Build, config::{ BuildType, Cli, Command, Config, Project, ProjectConfig, ProjectType, }, error::{Error, Result}, }; use clap::Parser; use console::...
use crate::{Context, Result, RuntimeError}; use crate::exchange::{handler::ExchangeCommandSink, handler::ExchangeCommand, manager::ExchangeManager}; use crate::message; use crate::queue::{manager::QueueManager}; use ironmq_codec::frame::{self, AMQPFrame, Channel}; use log::info; use std::collections::HashMap; use std::...
//! The matrix holds all modules in a QR code. //! //! They're organized in a 2-dimensional grid but held in //! a vector internally. //! //! The implementation uses assertions heavily to ensure correctness. //! If interfacing with the matrix directly take care not to violate //! assumptions, like overwriting existing ...
extern crate ansi_term; extern crate regex; use std::env; use std::io::BufRead; use std::io::BufReader; use std::fs::File; use ansi_term::Colour; use ansi_term::Style; use regex::Regex; // Constants /// Error exit code. const EXIT_ERROR: i32 = 1; /// Regex enum containing either a `regex::Regex` and a `ansi_term::C...
// Copyright 2019 <NAME>, 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 to in wri...
use bevy_app::App; use bevy_doryen::doryen::{AppOptions, TextAlign}; use bevy_doryen::{DoryenPlugin, DoryenPluginSettings, Input, RenderSystemExtensions, RootConsole}; use bevy_ecs::bundle::Bundle; use bevy_ecs::entity::Entity; use bevy_ecs::system::{Commands, IntoSystem, Query, Res, ResMut}; const CONSOLE_WIDTH: u32 ...
use crate::sequence::Sequence; use ndarray::arr2; use std::f64::consts::E; use rand::distributions::{Uniform, Distribution}; pub trait Mutator { fn mutate(&self, s: &Sequence, v: f64) -> Sequence; fn random(&self, l: usize) -> Sequence; } pub struct HKY { nuc_frequencies: [f64; 4], bases: [u8; 4], ...
// Copyright 2022 <NAME>. Licensed under Apache-2.0. //! Utilities to vectorize scalar functions use std::marker::PhantomData; use anyhow::{anyhow, Result}; use super::Expression; use crate::array::{Array, ArrayBuilder, ArrayImpl}; use crate::scalar::Scalar; use crate::TypeMismatch; /// A trait over all binary sca...
//! Growing tree implementation //! //! 1. Let C be a list of cells, initially empty. Add one cell to C, at random. //! 2. Choose a cell from C, and carve a passage to any unvisited neighbor of //! that cell, adding that neighbor to C as well. If there are no unvisited //! neighbors, remove the cell from C. //! 3...
use super::*; use petgraph::algo; use petgraph::prelude::{Outgoing, StableDiGraph}; use petgraph::visit::IntoEdgeReferences; use quickcheck::TestResult; use std::collections::HashMap; use std::hash::Hash; use std::iter::FromIterator; /// Tests that `slice` returns an acyclic graph and a topological ordering. #[quickc...
use chrono::NaiveDateTime; use diesel::prelude::*; use malvolio::prelude::*; use mercutio::Apply; use portia::form::{FormSubmitInputStyle, FormTextInputStyle}; use portia::{form::FormStyle, render::Render}; use rocket::serde::json::Json; use crate::{ catch_database_error, class::{get_user_role_in_class, tasks:...
// Copyright 2020 Parity Technologies (UK) Ltd. // This file is part of Polkadot. // Polkadot is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any late...
extern crate serde_json; extern crate ureq; use super::Candle; use crate::{client::Client, helpers::make_params, with_param}; use chrono::{NaiveDate, NaiveDateTime}; use serde::{Deserialize, Serialize}; use std::{ collections::HashMap, io::{self, Error, ErrorKind} }; #[derive(Debug, Deserialize, Serialize)] #[ser...
use std::collections::BTreeMap; use abstutil::Timer; use geom::Distance; use map_gui::tools::{CityPicker, DrawRoadLabels, Navigator, URLManager}; use map_model::osm::RoadRank; use map_model::{Block, Perimeter}; use widgetry::mapspace::{ObjectID, World, WorldOutcome}; use widgetry::{ Color, EventCtx, GfxCtx, Horizo...
use proc_macro2::{Span, TokenStream}; use quote::ToTokens; use std::iter; use syn::{Data, DataEnum, DeriveInput, Field, Fields, Ident, Index}; use utils::{ add_extra_type_param_bound_op_output, field_idents, named_to_vec, numbered_vars, unnamed_to_vec, }; pub fn expand( input: &DeriveInput, trait_name: &st...
use gio::prelude::*; use gio::{ActionMapExt, SimpleActionGroup}; use std::cell::Ref; use std::ops::Deref; use std::rc::Rc; use std::sync::Arc; use crate::app::components::{labels, PlaylistModel, SelectionTool, SelectionToolsModel}; use crate::app::dispatch::ActionDispatcher; use crate::app::models::*; use crate::app::...
// TODO - remove once schemars stops causing warning. #![allow(clippy::field_reassign_with_default)] use alloc::vec::Vec; #[cfg(feature = "std")] use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use crate::{ bytesrepr::{self, FromBytes, ToBytes}, system::auction::EraId, CLType, CLTyped, Pub...
//! configuration for network rent #[repr(C)] #[derive(Serialize, Deserialize, PartialEq, Clone, Copy, Debug)] pub struct Rent { /// Rental rate pub lamports_per_byte_year: u64, /// exemption threshold, in years pub exemption_threshold: f64, // What portion of collected rent are to be destroyed, ...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ account_config::AccountEvent, event::EventKey, language_storage::TypeTag, ledger_info::LedgerInfo, proof::EventProof, transaction::Version, }; use failure::prelude::*; use libra_crypto::{ hash::{CryptoHash, Cry...
use crate::ty::{self, FloatVarValue, IntVarValue, Ty, TyCtxt, InferConst}; use crate::mir::interpret::ConstValue; use rustc_data_structures::unify::{NoError, EqUnifyValue, UnifyKey, UnifyValue, UnificationTable}; use rustc_data_structures::unify::InPlace; use syntax_pos::{Span, DUMMY_SP}; use syntax::symbol::InternedSt...
use bitflags::bitflags; use serde::{Deserialize, Serialize}; #[cfg(feature = "client")] use wasm_bindgen::prelude::*; #[cfg_attr(feature = "client", wasm_bindgen)] #[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Copy, Hash, Ord, PartialOrd)] pub enum Pattern { #[serde(rename = "s")] Spade, #[...
#![no_std] #![feature(llvm_asm)] #![feature(linkage)] #![feature(panic_info_message)] #![feature(alloc_error_handler)] #[macro_use] pub mod console; pub mod ch8; mod lang_items; mod syscall; extern crate alloc; extern crate core; #[macro_use] extern crate bitflags; use buddy_system_allocator::LockedHeap; pub use con...
use common::convert::ToCapnp; use futures::{future, Future}; use capnp::capability::Promise; use common::convert::FromCapnp; use common::id::DataObjectId; use server::graph::{DataObjectRef, DataObjectState}; use datastore_capnp::{data_store, read_reply, reader}; use server::state::StateRef; use errors::{Error, ErrorK...
use lazy_static::lazy_static; use regex::{Captures, Regex}; fn main() { let input = include_str!("input.txt"); let answer = part_one(input).expect("no solution for part one"); println!("part 1: {}", answer); let answer = part_two(input).expect("no solution for part two"); println!("part 2: {}", a...
use std::collections::BTreeMap; use std::path::{Path, PathBuf}; use cargo::core::{dependency::Kind as DependencyKind, Package, PackageId, SourceId}; use serde::Serialize; use crate::manifest::TomlProfile; use crate::{platform, BoolExpr, Feature as FeatureStr, Optionality, ResolvedPackage, Result}; #[derive(Debug, Se...
// 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 ...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Comparator Control Register 0"] pub cex_ctl0: CEXCTL0, #[doc = "0x02 - Comparator Control Register 1"] pub cex_ctl1: CEXCTL1, #[doc = "0x04 - Comparator Control Register 2"] pub cex_ctl2: CEXCTL2, #[doc = "0x06 ...
use crate::{ kv::tables::{self, CumulativeData, PlainStateFusedValue}, models::*, InMemoryState, MutableCursor, MutableTransaction, }; use ethereum_types::*; #[derive(Clone, Debug)] pub struct GenesisState { chain_spec: ChainSpec, } impl GenesisState { pub fn new(chain_spec: ChainSpec) -> Self { ...
use std::fmt::Formatter; use num_derive::FromPrimitive; use serde::{Deserialize, Serialize}; use thiserror::Error; /// ExitCode defines the exit code from the VM invocation. #[derive(PartialEq, Eq, Debug, Clone, Copy, Serialize, Deserialize)] #[serde(transparent)] #[repr(transparent)] pub struct ExitCode { value:...
use serde::{Deserialize, Serialize}; use serde_json::value::Value; use lsp_types::{Range as LSRange, Url}; use super::interner::Interner; use super::types::*; use lazy_static::lazy_static; use std::collections::HashMap; type Deserializer = fn(&[u8]) -> Result<Payload>; lazy_static! { static ref VERTEX_DESERIA...
use azure_core::headers::{HeaderName, Headers}; use azure_core::{Context, Policy, PolicyResult, Request}; use azure_storage::{core::storage_shared_key_credential::StorageSharedKeyCredential, hmac::sign}; use http::{HeaderValue, Method}; use std::sync::Arc; #[derive(Debug, Clone, PartialEq, Eq)] pub struct SharedKeyAut...
use super::*; use std::io::{BufRead, BufReader}; use std::path::PathBuf; // Notes: // * Particle & constraint vectors are kept private to prevent mismatch between // zero-based and one-based indexing. // * These private vectors are zero-based (no dummy element at zero index). // * Everything here that is called 'num...
//! SyscallDriver for an I2C Master interface. use enum_primitive::enum_from_primitive; use kernel::grant::{AllowRoCount, AllowRwCount, Grant, GrantKernelData, UpcallCount}; use kernel::hil::i2c; use kernel::processbuffer::{ReadableProcessBuffer, WriteableProcessBuffer}; use kernel::syscall::{CommandReturn, SyscallDr...
use crate::metastore::{Column, ColumnType, ImportFormat, MetaStore}; use crate::sql::timestamp_from_string; use crate::store::{DataFrame, WALDataStore}; use crate::table::{Row, TableValue}; use crate::CubeError; use async_std::io::SeekFrom; use async_trait::async_trait; use bigdecimal::{BigDecimal, Num}; use core::mem;...
use std::fmt::Write; const LANGUAGES: [&str; 47] = [ "awk", "c", "cabal", "clojure", "coffee", "cpp", "css", "cucumber", "d", "diff", "dockerfile", "fish", "gas", "go", "haml", "haskell", "html", "ini", "java", "javascript", "json", ...