text
stringlengths
3.09k
13.9k
//! An implementation of WebSockets base bytes streams use std::{any, cell::Cell, cmp, io, task::Context, task::Poll}; use crate::codec::{Decoder, Encoder}; use crate::io::{Base, Filter, FilterFactory, Io, IoRef, ReadStatus, WriteStatus}; use crate::util::{BufMut, BytesVec, PoolRef, Ready}; use super::{CloseCode, Clo...
// Copyright 2015-2016 <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...
//! Preprocessor parsing #[cfg(test)] mod test; use toc_syntax::{InfixOp, PrefixOp}; use super::*; /// Preprocessor parsing, in stmt position /// /// Only preprocessor conditionals and 'include' are allowed pub(super) fn stmt_preproc(p: &mut Parser) -> Option<CompletedMarker> { match_token!(|p| match { T...
use tensors::*; use graph_models::*; use optimization::accumulators::*; use optimization::optim_traits::Optimizer; pub struct ParamState<T: TensorType> { step: i32, // Exponential moving average of gradient values exp_avg: DenseTensor<T>, // Exponential moving average of squared gradient values exp...
use anyhow::{bail, Context, Result}; use io::Status::*; use kani_io as io; use serde::{Deserialize, Serialize}; use std::sync::mpsc::{sync_channel, SyncSender}; use std::sync::Arc; use std::sync::Mutex; use std::thread; #[derive(Debug, Default, Copy, Clone, Serialize, Deserialize)] pub struct PlayerInfo { pub fram...
// Copyright (c) 2017-present PyO3 Project and Contributors use crate::defs; use crate::method::{FnSpec, FnType}; use crate::proto_method::impl_method_proto; use crate::pymethod; use proc_macro2::{Span, TokenStream}; use quote::quote; use quote::ToTokens; use std::collections::HashSet; pub fn build_py_proto(ast: &mut...
//! Linux Bluetooth device functionality controller methods //! //! These are functions that are used to control the interface to the bluetooth devices on the //! system. This isn't a complete implemenation of control commands/operations, it is just the //! functionality used by this libary. These are linux specific an...
#[repr(u32)] pub enum VAttrib { Position = 0, Normal = 1, Tangent = 2, BiTangent = 3, Color = 4, Uv = 5, } static VS_SRC: &'static [u8] = b" #version 450 core uniform mat4 u_proj_matrix; uniform mat4 u_modelview_matrix; uniform mat4 u_normal_matrix; layout(location = 0) in vec4 a_position; la...
use std::num::NonZeroU32; use cookie::Cookie; use diesel::dsl as sql; use diesel::prelude::*; use json::json; use ring::digest as hasher; use ring::pbkdf2; use ring::rand::{SecureRandom, SystemRandom}; use serde::{Deserialize, Serialize}; use tide::cookies::ContextExt as CookieExt; use tide::forms::ContextExt as FormE...
use std::convert::TryFrom; use std::string::FromUtf8Error; use svm_types::Type; use crate::tracking; /// FFI representation for a byte-array /// /// # Examples /// /// ```rust /// use svm_runtime_ffi::svm_byte_array; /// use svm_types::Type; /// /// use std::convert::TryFrom; /// use std::string::FromUtf8Error; /// ...
//! Implementation of conjugate gradient //! following [lecture notes](http://www.math.psu.edu/shen_w/524/CG_lecture.pdf) //! by Shen. Thanks Shen! //! //! Pseudo code: //! Set r_0 = A*x_0 - b and p_0 =-r_0, k=0 //! while r_k != 0: //! alpha_k = ||r_k||^2 / ||p_k||^2_A //! x_{k+1} = x_k + alpha_k*p_k //! r_{k+1}...
use tree_sitter::{Node, Parser, Query, QueryCursor}; use guarding_core::domain::code_file::CodeFile; use guarding_core::domain::code_class::CodeClass; use crate::code_ident::CodeIdent; const JAVA_QUERY: &'static str = " (package_declaration (scoped_identifier) @package-name) (import_declaration (scoped_identifier)...
extern crate pua_lang; extern crate rustyline; extern crate rustyline_derive; use pua_lang::evaluator::builtins::new_builtins; use pua_lang::evaluator::env::Env; use pua_lang::evaluator::Evaluator; use pua_lang::lexer::{is_whitespace, Lexer}; use pua_lang::parser::{ParseError, Parser}; use pua_lang::token::Token; use ...
#![allow(dead_code)] /// This module defines types for the syntax description DSL. use itertools::{join}; use std::fmt; pub enum FieldType { Name, Associativity, Precedence, Meaningful, Syntax, Parse, Fullform, Error, } /// Given a field name as a FieldName enum value, returns its &st...
use crate::endpoint::Endpoint; use crate::filter::{Filter, Next}; use crate::router::{RouteTarget, Router}; use crate::state::State; use crate::static_files::StaticFiles; use crate::ws::WebSocket; use crate::{Request, Responder, Response, Result}; use async_trait::async_trait; use hyper::server::conn::{AddrIncoming, Ad...
use ffi::*; use bin::Bin; use bus::Bus; use error::Error; use error::Result; use util::*; use reference::Reference; use std::ops::{Deref, DerefMut}; /** A GstPipeline is a special GstBin used as the toplevel container for the filter graph. The GstPipeline will manage the selection and distribution of a global GstClo...
//! Configuration module //! //! This is the global plugin configuration. //! //! Configuration options should be split out into different sections: //! //! * network //! * look //! * color //! * server //! //! The server config options are added in the server.rs file. //! //! The config options created here will be al...
#[doc = "Reader of register SIS"] pub type R = crate::R<u32, super::SIS>; #[doc = "Reader of field `RxFIFOFul`"] pub type RXFIFOFUL_R = crate::R<bool, bool>; #[doc = "Reader of field `TxEm`"] pub type TXEM_R = crate::R<bool, bool>; #[doc = "Reader of field `LockLoss`"] pub type LOCKLOSS_R = crate::R<bool, bool>; #[doc ...
use core::str::{Chars}; use std::{collections::{VecDeque}, process::id}; static BACK_LEN:usize = 3usize; #[derive(Debug)] pub struct LexString<'a> { source:&'a str, pub chars:Chars<'a>, cache_list:VecDeque<char>, ahead_count:usize, cur_index:usize, char_count:usize, line:u64, col:...
use std::fmt; use std::io::Write as _; use std::time::Duration; use anyhow::{anyhow, Context as _}; use serde::Serialize; use structopt::StructOpt; use tokio::time::Instant; use crate::atcoder::AtcoderActor; use crate::cmd::Outcome; use crate::judge::{Judge, StatusKind, TotalStatus}; use crate::model::{AsSamples, Con...
use proptest::prelude::*; use rdftk_iri::{Normalize, Scheme, ValidateStr}; use std::str::FromStr; // ------------------------------------------------------------------------------------------------ // API Tests // ------------------------------------------------------------------------------------------------ #[test]...
// Copyright (c) 2018 10x Genomics, Inc. All rights reserved. //! Utility methods. use std::collections::HashMap; use std::fmt::Debug; use std::fs::{File}; use std::io::{self, Write, BufRead, BufReader, BufWriter}; use std::path::Path; use std::sync::{Arc, Mutex}; use bincode::{self, deserialize_from, serialize_into}...
use crate::{ configs::parsing::{self, edges}, defaults::capacity::DimVec, helpers::err, network::{EdgeBuilder, NodeBuilder, ProtoEdge, ProtoNode, StreetCategory}, }; use kissunits::geo::Coordinate; use log::info; use osmpbfreader::{reader::OsmPbfReader, OsmObj}; use smallvec::smallvec; use std::fs::Open...
//! Common metrics for regression //! //! This module implements common comparison metrices for continuous variables. use ndarray::prelude::*; use ndarray::IntoNdProducer; use ndarray::{Data, NdFloat}; use num_traits::FromPrimitive; use std::ops::Sub; /// Regression metrices trait pub trait Regression< 'a, A:...
use std::path::PathBuf; use structopt::StructOpt; #[derive(StructOpt, Debug)] #[structopt( name = "kmeans-colors", about = "Simple k-means clustering to find dominant colors in images" )] pub struct Opt { /// Input file(s), separated by commas. #[structopt( short, long, parse(f...
use crate::chumfile::ChumFile; use crate::reader::ChumReader; use crate::util; use gdnative::api::{ArrayMesh, Material, Mesh}; use gdnative::prelude::*; use libchum::common; use libchum::reader::mesh; /// Each instance represents one surface in an array mesh. /// This is NOT the same thing as Totem's SURFACE. /// Each...
use std::sync::Arc; use wgpu::util::DeviceExt; use winit::{dpi::PhysicalSize, window::Window}; /// pub struct RenderContext { size: PhysicalSize<u32>, sc_desc: wgpu::SwapChainDescriptor, swap_chain: wgpu::SwapChain, accessor: ContextAccessor, } impl RenderContext { /// pub async fn new(desc: R...
#![allow(clippy::ptr_arg)] // Canonical 32-bit and 64-bit NaN values from cranelift-codegen can be found at // https://github.com/bytecodealliance/cranelift/blob/60ab06981ff9ab234d1a5fa4ffe30baeb9879319/cranelift-codegen/src/nan_canonicalization.rs#L14 static CANON_32BIT_NAN: u32 = 0b0111_1111_1100_0000_0000_0000_0000_...
use largeint::*; use multiplication::multiplication_1; pub fn division(large1: &str, large2: &str) -> Vec<String> { let mut divided = String::from(""); let mut remainder_largeint: LargeInt; let mut remainder_str = String::from(""); let output_vec: Vec<String>; let sign = Sign::Positive; let lar...
extern crate proc_macro; use std::collections::HashSet; use proc_macro::TokenStream; use quote::{format_ident, quote}; use syn::{parse_macro_input, parse_quote, FnArg, ItemTrait, PatType, TraitItem}; const SERVER_STREAMING: &str = "server_streaming"; const CLIENT_STREAMING: &str = "client_streaming"; #[proc_macro_a...
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // 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 ...
use crossbeam_channel::Sender; #[cfg(feature = "tracing")] use crate::tracing::{Trace, TraceHolder}; use crate::{ ClientIdentifier, ReplyMessage, RequestMessage, Result, RpcOnWire, ServerIdentifier, }; // Client interface, used by the RPC client. pub struct Client { pub(crate) client: ClientIdentifier, ...
use crate::constants::*; use crate::error::*; use crate::graphics::*; use crate::mapping::*; use crate::rom::*; pub struct MapLayout { pub width: u32, pub height: u32, pub border_blocks_addr: usize, pub map_blocks_addr: usize, pub pri_tileset_addr: usize, pub sec_tileset_addr: usize, pub bo...
use cgmath::{vec2, Vector2}; use options; use player_state::PlayerState; use screen::Screen; use sdl2::event::Event; use sdl2::EventPump; use sdl2::keyboard::{Keycode, Scancode}; use sdl2::pixels::Color; use std::time; use std::time::{Duration, SystemTime}; use sdl2::rect::Rect; pub struct Game { ps: PlayerState, ...
use std::env; use std::fs::{create_dir, read_dir, File, ReadDir}; use std::io::{stdin, stdout, BufReader, Write}; use std::path::Path; use colored::Colorize; use humanesort::prelude::*; use regex::Regex; use semver::{BuildMetadata, Prerelease, Version}; use crate::consts::{CONFIG_FILE, DATA_PATH}; use crate::modules:...
use std::sync::{Arc, Mutex}; use neon::event::EventQueue; use neon::prelude::*; use neon::register_module; use once_cell::sync::{Lazy, OnceCell}; use sniper_common::{ client::{init_client, tarpc_context, tokio}, service::SniperServiceClient, }; //static INSTANCE: OnceCell<SniperNode>=OnceCell::new(); /* impl ...
#[doc = "Reader of register DC9"] pub type R = crate::R<u32, super::DC9>; #[doc = "Reader of field `ADC0DC0`"] pub type ADC0DC0_R = crate::R<bool, bool>; #[doc = "Reader of field `ADC0DC1`"] pub type ADC0DC1_R = crate::R<bool, bool>; #[doc = "Reader of field `ADC0DC2`"] pub type ADC0DC2_R = crate::R<bool, bool>; #[doc ...
use std::fmt::{self, Write}; use chrono::{DateTime, Utc}; use eyre::Report; use hashbrown::HashMap; use rosu_v2::prelude::{Beatmap, Beatmapset, GameMode, GameMods, Score, User}; use crate::{ commands::osu::TopOrder, core::Context, custom_client::OsuTrackerMapsetEntry, embeds::{osu, Author, Footer}, ...
// This file is part of Substrate. // Copyright (C) 2020 Parity Technologies (UK) Ltd. // 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 published by // the Free S...
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
use core::sync::atomic::{AtomicU64, Ordering}; use alloc::sync::Arc; use twizzler_abi::device::{CacheType, MMIO_OFFSET}; use x86_64::{PhysAddr, VirtAddr}; use crate::{ arch::memory::phys_to_virt, memory::frame::{self, Frame, PhysicalFrameFlags}, }; use super::{Object, PageNumber}; bitflags::bitflags! { ...
//! A thread-safe tiny implementation of a *lock-free* interval/timer structure. //! //! ## Example //! ``` //! use atomic_interval::AtomicIntervalLight; //! use std::time::Duration; //! use std::time::Instant; //! //! let period = Duration::from_secs(1); //! let atomic_interval = AtomicIntervalLight::new(period); //! ...
//! A splittable pseudorandom generator based on the [TwoLCG //! algorithm](http://on-demand.gputechconf.com/gtc/2016/presentation/s6665-guy-steele-fast-splittable.pdf). //! //! ## References //! //! * <NAME>. 2016. "Fast Splittable Pseudorandom Number //! Generators." Slide set at: http://on-demand.gputechconf.co...
//! Provides the implementation of [`crate::transform()`]. use proc_macro2::{Group, TokenStream, TokenTree}; use quote::{ToTokens, TokenStreamExt}; use std::mem::replace; use syn::{ self, parse::{Parse, ParseStream}, parse2, parse_macro_input, spanned::Spanned, token, AttrStyle, Attribute, DeriveInp...
use std::str; // Test if the account number has a valid checksum pub fn is_checksum_valid(account_number : &str) -> bool { assert!(is_numeric(account_number), "account_number must be numeric."); if account_number.len() != 9 { return false; } let mut checksum = 0; let mut coefficient : u32 ...
// Copyright 2020-2021 The Datafuse Authors. // // SPDX-License-Identifier: Apache-2.0. use std::collections::HashSet; use std::sync::Arc; use common_arrow::arrow::error::Result as ArrowResult; use common_datavalues::DataField; use common_datavalues::DataSchema; use common_datavalues::DataSchemaRef; use common_except...
use serde::{Deserialize, Serialize}; use serde_json::error::Error as JsonError; use tungstenite::Message as WsMessage; use owned_subslice::OwnedSubslice; pub const MESSAGE_HEADER: char = '4'; pub const BINARY_HEADER: u8 = 4; #[derive(Debug, Clone, PartialEq)] pub enum Packet { Open(Open), Close, Ping, ...
#![no_std] extern crate alloc; pub mod console_msgs; use linux_kernel_module::mutex::LinuxMutex; use linux_kernel_module::sync::Mutex; use linux_kernel_module::{c_types, println}; use rust_kernel_rdma_base::linux_kernel_module; use rust_kernel_rdma_base::*; use alloc::vec::Vec; use lazy_static::lazy_static; struc...
use std::{collections::HashMap, task::Poll}; use crate::{ chess::{Game, Move, MoveError, PieceColor, PlayedMove}, utils::SerdePeerId, }; use futures::Stream; use libp2p::PeerId; use serde::Serialize; use thiserror::Error; use super::challenge_service::{ChallengeRandomBytes, FulfilledChallenge}; #[derive(Debu...
extern crate ferrous_threads; extern crate bit_vec; use ferrous_threads::task_runner::TaskRunner; use std::sync::mpsc::{Sender, Receiver, channel}; use bit_vec::BitVec; use std::env; // http://home.math.au.dk/himsen/Project1_parallel_algorithms_Torben.pdf fn main() { let mut args = env::args(); if args.len(...
use franklin_crypto::{ bellman::{ plonk::better_better_cs::cs::{ConstraintSystem, PlonkConstraintSystemParams}, Engine, }, bellman::{Field, PrimeField, SynthesisError}, plonk::circuit::allocated_num::AllocatedNum, plonk::circuit::{ allocated_num::Num, custom_rescue_gate::appl...
/* * // Copyright 2021 BlockPuppets. * // * // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or * // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license * // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your * // option. This file may not be copied, modified, or distribute...
//! Solution to [AoC 2018 Day 4](https://adventofcode.com/2018/day/4) use counter::Counter; use regex::Regex; use std::cmp::Reverse; use std::collections::BinaryHeap; use std::default::Default; use std::iter::Iterator; #[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, Default)] struct Guard(usize); /// Like Counter:...
//! Kitsune Config Tuning Params use ghost_actor::dependencies::tracing; use std::collections::HashMap; /// Network tuning parameters. /// This is serialized carefully so all the values can be represented /// as strings in YAML - and we will be able to proceed with a printed /// warning for tuning params that are rem...
use std::fs::File; use std::io::prelude::*; use std::collections::VecDeque; #[derive(Debug)] enum ParameterMode { Position, Immediate } #[derive(Debug)] enum OperationType { Add, Multiply, Input, Output, JumpIfTrue, JumpIfFalse, LessThan, Equals, Halt } #[derive(Debug)] struct Instruction { o...
mod token; pub use token::{Token, TokenKind}; #[derive(Default)] pub struct Lexer { input: Vec<char>, pos: usize, read_pos: usize, } impl Lexer { pub fn new(input: &str) -> Self { Self { input: input.chars().collect(), ..Default::default() } } pub fn n...
use std::{ iter::FromIterator, ops::{Index, IndexMut}, }; use crate::internal_prelude::*; use super::common::QListIterator; use crate::QVariant; cpp_class!( /// Wrapper around [`QVariantList`][type] typedef. /// /// [type]: https://doc.qt.io/qt-5/qvariant.html#QVariantList-typedef pub unsafe ...
use std::str::FromStr; use std::time::Duration; use reqwest::header::{HeaderMap, HeaderName, HeaderValue}; use serde::{Deserialize, Serialize}; use serde_with::{serde_as, DurationSeconds}; use url::Url; use super::IncompatibleSourceSettingsError; use crate::phases::collection::flink::MetricOrder; #[serde_as] #[deriv...
use crate::error::*; use crate::{Dimension, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, IxDyn}; /// Calculate the common shape for a pair of array shapes, that they can be broadcasted /// to. Return an error if the shapes are not compatible. /// /// Uses the [NumPy broadcasting rules] // (https://docs.scipy.org/doc/numpy/user...
//! Provides window setup logic specific to the Windows platform. use std::{ convert::TryInto, sync::{Arc, Mutex, Weak}, }; use raw_window_handle::{HasRawWindowHandle, RawWindowHandle, Win32Handle}; use winapi::{ shared::{minwindef, ntdef, windef, winerror}, um::{libloaderapi, winuser}, }; use crate:...
use crate::prelude::*; use rome_formatter::write; use rome_js_syntax::{ JsAnyExpression, JsCallExpression, JsCallExpressionFields, JsComputedMemberExpression, JsComputedMemberExpressionFields, JsIdentifierExpression, JsImportCallExpression, JsNewExpression, JsStaticMemberExpression, JsStaticMemberExpression...
use std::fs::File; use std::io::{self, ErrorKind, Read}; use std::net::{SocketAddr, TcpStream}; use std::path::Path; use log::*; use snafu::{ensure, ResultExt, Snafu}; use ssh2::{Channel, ExtendedData, Session}; // TODO: Probably want to do this more `struct`ured // TODO: Add time to log pub type Log = Vec<(String, S...
//! A stream generator such as a `Collection` or a mapping or aggregation of its items use async_trait::async_trait; use destream::en; use futures::future::{self, TryFutureExt}; use futures::stream::{StreamExt, TryStreamExt}; use log::debug; use safecast::{CastInto, TryCastFrom, TryCastInto}; use tc_btree::BTreeInsta...
use std::time::Duration; struct InterpolationState { /// The start value of this change start: f32, /// The value we're moving towards target: f32, /// The increment over current value per tick tick_increment: f32, } /// Wraps a certain numeric value with linear interpolation. /// /// Whenever...
//! [`Path`] utilities. #[cfg(test)] mod test; use dirs; use std::{ env, error, fmt, io, ops::Deref, path::{Component, Path, PathBuf}, }; /// Finds the first [ancestor](`Path::ancestors`) of `path` matching `base`, if any. /// /// The comparisons between the ancestors of `path` and `base` /// take some n...
use pear::{parse_error, parsers::*}; use pear::combinators::*; use pear::macros::{parse, parser, switch}; use pear::input::{Pear, Text}; use crate::value::{Value, Dict, escape::escape}; type Input<'a> = Pear<Text<'a>>; type Result<'a, T> = pear::input::Result<T, Input<'a>>; #[inline(always)] fn is_whitespace(&byte: ...
extern crate chrono; use super::shell; use chrono::Utc; use std::fmt; use std::path::Path; type Result<T> = std::result::Result<T, GitDriveError>; #[derive(Debug)] pub enum GitDriveError { NoSuchDir { path: String }, NoGitRepo { path: String }, RemoteNotFound { remote: String }, BranchNotFound { bra...
#[macro_use] extern crate assert_approx_eq; extern crate clap; extern crate priority_queue; extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_json; extern crate termion; extern crate uuid; mod card; mod ledger; mod supermemo; use ledger::{append_to_ledger, read_ledger}; use card::{Card, ...
#![forbid(unsafe_code)] // #![forbid(warnings)] use std::fs::{self, File}; use std::io::{copy, BufReader, Write}; use std::path::PathBuf; use std::process::{Command, Stdio}; use anyhow::{anyhow, Result}; use atom_syndication::{Entry, Feed}; use log::{info, warn}; use select::document::Document; use select::predicate:...
//! This reader composes frames of bytes for Redis protocol //! use std::io::{self, Read, Error, ErrorKind}; use std::collections::VecDeque; //use help; use value::Value; #[derive(Debug)] pub struct FrameReader { frames: Frames } impl FrameReader { pub fn new(max_frame_size: u32) -> FrameReader { F...
use std::fmt; use chrono::{DateTime, Local, NaiveDateTime, TimeZone}; use chrono_humanize::HumanTime; use json::JsonValue; #[derive(Debug)] struct TimeStamp(Option<DateTime<Local>>); impl<'a> From<&'a JsonValue> for TimeStamp { fn from(jv: &JsonValue) -> Self { let parse_naive = |s: &str| s.parse::<Naive...
// Copyright 2015-2018 <NAME> <<EMAIL>> // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according...
use std::time::Duration; use std::collections::{HashMap, VecDeque}; use memmem::{Searcher, TwoWaySearcher}; use byteorder::{WriteBytesExt, BigEndian}; use crate::instance::{InstState, StatusServer}; use crate::map_database::MapDatabase; use crate::spatial::{Area, Vec3}; pub fn query_keys( db: &mut MapDatabase, st...
use crate::{ app::App, canvas::{drawing_utils::calculate_basic_use_bars, Painter}, constants::*, }; use tui::{ backend::Backend, layout::{Constraint, Direction, Layout, Rect}, terminal::Frame, text::{Span, Spans}, widgets::{Block, Borders, Paragraph, Row, Table, Tabs}, }; use unicode_se...
//! Subscribe to events in the compiler pipeline use crate::{CompilerInput, CompilerOutput, Solc}; use semver::Version; use std::{ error::Error, fmt, path::Path, sync::{ atomic::{AtomicUsize, Ordering}, Arc, }, }; /// Install this `Reporter` as the global default if one is /// not ...
use serde::{Deserialize, Serialize}; use std::fs::read_to_string; #[derive(Serialize, Deserialize, Debug)] struct Ticker { ticker: String, shares: f32, apply_drip: bool, } #[derive(Serialize, Deserialize, Debug)] struct Tickers { tickers: Vec<Ticker>, dividend_projection_in_years: u8, // Makes no ...
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // 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 ...
// Copyright 2016 <NAME>, <NAME> and <NAME>. // See the README.md file at the top-level directory of this // distribution. // // Licensed under the MIT license <LICENSE or // http://opensource.org/licenses/MIT>, at your option. // This file may not be copied, modified, or distributed // except according to those terms....
// SPDX-License-Identifier: Apache-2.0 // This file is part of Frontier. // // Copyright (c) 2020 Parity Technologies (UK) Ltd. // // 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...
use timely::order::TotalOrder; use timely::dataflow::*; use timely::dataflow::operators::probe::Handle as ProbeHandle; use differential_dataflow::operators::*; use differential_dataflow::lattice::Lattice; use {Arrangements, Experiment, Collections}; // -- $ID$ // -- TPC-H/TPC-R Minimum Cost Supplier Query (Q2) // --...
use std::collections::BTreeMap; use std::io; use chrono::{DateTime, Utc}; use rand::{CryptoRng, Rng}; use crate::armor; use crate::composed::key::{PublicKey, PublicSubkey}; use crate::composed::signed_key::SignedKeyDetails; use crate::crypto::public_key::PublicKeyAlgorithm; use crate::crypto::HashAlgorithm; use crate...
use super::value_assertion::{Assertion, AssertionConflict}; use std::path::Path; use token_search::{TokenSearchResult, TokenSearchResults}; #[derive(Clone)] pub struct ProjectConfiguration { pub name: String, pub application_file: Vec<PathPrefix>, pub test_file: Vec<PathPrefix>, pub config_file: Vec<Pa...
use super::decompress; use super::index::SkipIndex; use crate::common::VInt; use crate::common::{BinarySerializable, HasLen}; use crate::directory::{FileSlice, OwnedBytes}; use crate::schema::Document; use crate::space_usage::StoreSpaceUsage; use crate::store::index::Checkpoint; use crate::DocId; use lru::LruCache; use...
use std::env; use std::time::Duration; use once_cell::sync::OnceCell; use reqwest::{ self, header::{HeaderValue, CONTENT_TYPE}, }; use thiserror::Error; use crate::feed::Rss; static RESP_SIZE_LIMIT: OnceCell<u64> = OnceCell::new(); static CLIENT: OnceCell<reqwest::Client> = OnceCell::new(); #[derive(Error, ...
//! Module containing the implementation of the [`Process`] trait for //! [`Actor`]s. use std::pin::Pin; use std::task::{self, Poll}; use heph_inbox::{Manager, Receiver}; use crate::actor::{self, Actor, NewActor}; use crate::rt::access::PrivateAccess; use crate::rt::process::{Process, ProcessId, ProcessResult}; use ...
use cargo::{ core::{ compiler::{CompileKind, CompileTarget, TargetInfo}, Workspace, }, ops::{compile, CleanOptions, CompileFilter, CompileOptions, Packages}, Config, }; use cargo_show_asm::{ asm::{self, Item}, color, llvm, mir, opts::{self, Focus}, }; use std::collections::BT...
use std::fmt; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde::de::{Error, Visitor, MapAccess}; use ethereum_types::H256; /// Represents rpc api block number param. #[derive(Debug, PartialEq, Clone, Hash, Eq)] pub enum BlockNumber { /// Hash Hash { /// block hash hash: H256, /// only r...
#[repr(C)] pub struct BoundingBox { range_sum: f64, min_values: Vec<f32>, max_values: Vec<f32>, } impl BoundingBox { pub fn new(first_values: &[f32], second_values: &[f32]) -> Self { assert!(first_values.len() == second_values.len()); let minv: Vec<f32> = first_values .iter(...
// Copyright (c) Facebook, Inc. and its affiliates. use anyhow::{anyhow, Result}; use log::error; use serde::{Deserialize, Serialize}; use std::fmt::Write as FmtWrite; use std::fs; use std::io::Write; #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] #[serde(default)] pub struct IoCostModelParams { ...
use std::fmt; use std::io; use blake2::Params as Blake2Params; use byteorder::{ByteOrder, LittleEndian}; use crate::{node_data, NodeData, MAX_NODE_DATA_SIZE}; fn blake2b_personal(personalization: &[u8], input: &[u8]) -> [u8; 32] { let hash_result = Blake2Params::new() .hash_length(32) .personal(p...
//! # `md5` hashsum of files use std::{fmt, io::Write, str::FromStr}; use serde::{ser::SerializeTuple, Deserialize, Serialize}; pub mod io; pub mod padded; /// # MD5 hashsum of a file /// /// The game uses md5 hashes of the content to identify a specific version of a file. /// /// *Note*: Currently, this doesn't ac...
use crate::helpers::{basic_success_assert, basic_success_with_global_types_assert}; #[test] fn compile_query_with_variables() { basic_success_assert( " query TestQuery($meetingId: ID!) { meeting: node(id: $meetingId) { id } } ", "TestQuery.ts", r#" export type TestQuery_meet...
//! The `packet` module defines data structures and methods to pull data from the network. use { crate::{ recvmmsg::{recv_mmsg, NUM_RCVMMSGS}, socket::SocketAddrSpace, }, paychains_metrics::inc_new_counter_debug, std::{io::Result, net::UdpSocket, time::Instant}, }; pub use { paychain...
use crate::{config::ResourceType, model::CachedMessage, InMemoryCache, UpdateCache}; use std::borrow::Cow; use twilight_model::gateway::payload::incoming::{ MessageAck, MessageCreate, MessageDelete, MessageDeleteBulk, MessageUpdate, ReadState, }; impl UpdateCache for MessageAck { fn update(&self, cache: &InMem...
/// Code snippet formatting error. #[derive(Debug, PartialEq, Copy, Clone)] pub enum FormatError { /// An `io::Error` occurred. /// /// This usually occurs when the stdio redirection fails. Io, /// Converting `stdout` to `str` failed. StrConvertFailed, /// `rustfmt` failed in formatting. ...
/* * Copyright 2019 Comcast Cable Communications Management, 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 applicab...
// Copyright (c) 2018-2021 The MobileCoin Foundation use crate::server::DbPollSharedState; use fog_recovery_db_iface::RecoveryDb; use fog_types::view::QueryRequestAAD; use fog_view_enclave::{Error as ViewEnclaveError, ViewEnclaveProxy}; use fog_view_enclave_api::UntrustedQueryResponse; use grpcio::{RpcContext, RpcStat...
//! OpenType tags. use crate::{DeserializationError, Deserialize, ReaderContext, SerializationError, Serialize}; use std::{borrow::Borrow, ops::Deref, str::FromStr}; pub use otspec_macros::tag; /// An OpenType tag. /// /// A tag is a 4-byte array where each byte is in the printable ascii range /// (0x20..=0x7E). #[d...
use std::error::Error; use std::sync::{Arc, Mutex}; use crate::{ arp, buffer, ethernet, ip::{self, dgram, route}, packet, protocol::ProtocolType, util, }; #[derive(Debug)] pub struct InterfaceImpl { pub device: ethernet::Device, pub unicast: ip::Addr, pub netmask: ip::Addr, pub gat...
// A token that represents a single unit of Hinton code. #[derive(Clone)] pub struct Token { /// The token's line number pub line_num: usize, /// The token's column start pub column_start: usize, /// The token's column end pub column_end: usize, /// The token's type pub token_type: TokenType, ...