text
stringlengths
3.09k
13.9k
use std::fmt::{Debug, Error, Formatter}; use slog::{o, trace, Drain, Logger}; use crate::protocol::{Channel, DiscoveryKey, Key, Message, MessageType}; use crate::schema; use crate::wire_format::{self, write_msg}; pub trait FeedStream { fn _push(&mut self, bytes: &[u8]); fn _onhandshake(&mut self, handshake: ...
//! Rust bindings to libbitcoinconsensus //! //! ```rust //! use hex::FromHex; //! use bitcoin_consensus::{verify_script, ScriptVerificationFlags}; //! //! fn main() { //! let pubkey: Vec<u8> = Vec::from_hex("76a9144621d47f08fcb1e6be0b91144202de7a186deade88ac").unwrap(); //! let tx: Vec<u8> = Vec::from_hex("010...
//#![feature(test)] extern crate webassembly_benchmarks_rust; extern crate wasm_bindgen; //extern crate test; use webassembly_benchmarks_rust::benchmarks::{fibonacci, sort}; use webassembly_benchmarks_rust::benchmarks::base64; use webassembly_benchmarks_rust::benchmarks::hanoi; use webassembly_benchmarks_rust::benchm...
use std::fmt; use std::fmt::{Debug, Formatter}; use track::{Span, Posn, Untrack}; use word::{Reserved, Name}; #[derive(Debug, PartialEq, Clone)] pub struct Token { pub location: Span, pub newline: bool, // was there a newline between the preceding token and this one? pub value: TokenData } impl Token {...
// MIT License // // Copyright (c) 2021 <NAME> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merg...
use rocket::http::Header; use rocket::http::Status; use rocket::outcome::try_outcome; use rocket::request::FromRequest; use rocket::request::Outcome; use rocket::Request; use rocket::State; use std::fmt; use std::str; use std::string::FromUtf8Error; use void::Void; /// A request guard that can be included in handler d...
//! Implementation of the Java Random Number generator. #[cfg(test)] mod test; #[cfg(test)] mod test_data; use std::num::Wrapping; /// Modulus pub const M: Wrapping<i64> = Wrapping((1 << 48) - 1); /// Multiplier pub const A: Wrapping<i64> = Wrapping(0x5DEECE66D); /// Increment pub const C: Wrapping<i64> = Wrapping...
use log::warn; use std::sync::atomic::{AtomicBool, AtomicU32, Ordering}; use std::sync::{Arc, Mutex}; use std::thread; use std::thread::JoinHandle; use std::time::Duration; #[derive(Debug)] pub struct TimingsReport { pub ten_s: f32, pub one_m: f32, pub five_m: f32, pub fifteen_m: f32, } pub struct Tim...
use super::{Error, Path, PathBuf, PathList}; use crate::fs; use crate::fs::{DirDescriptorList, FileSystemAccess, FileSystemCrawler}; use application::ApplicationInfo; use notification::{LogLevel, MessageLength, Notifier}; use std; use std::fmt::Debug; #[derive(PartialEq, Debug)] pub struct Config { pub exclude_dir...
use lang_data::data::*; use descr_common::util::SortedHashMap; use std::collections::HashSet; pub struct CodegenAst<'a, 'd: 'a> { data: &'a LangData<'d>, } impl<'a, 'd> CodegenAst<'a, 'd> { pub fn new(data: &'a LangData<'d>) -> CodegenAst<'a, 'd> { CodegenAst { data } } pub fn gen(&self) -> St...
use alumina_core::{ base_ops::{OpInstance, OpSpecification}, errors::{ExecutionError, GradientError, OpBuildError, ShapePropError}, exec::ExecutionContext, grad::GradientContext, graph::{Graph, Node, NodeID}, shape::{NodeAxis, NodeShape}, shape_prop::ShapePropContext, util::wrap_dim, }; use indexmap::{indexset,...
mod control_command; mod monitor; pub(crate) use self::control_command::{ControlCommand, Reply}; pub use self::{control_command::WatchdogQuery, monitor::WatchdogMonitor}; use crate::service::{ServiceError, ServiceIdentifier, StatusReport}; use async_trait::async_trait; use std::{any::Any, fmt}; use thiserror::Error; u...
#![deny(warnings)] #[macro_use] extern crate log; #[macro_use] extern crate failure; use failure::Error; use futures_util::StreamExt; use serde::Deserialize; use std::{ fs::File, io::{prelude::*, BufReader}, path::{Path, PathBuf}, }; use structopt::StructOpt; use walkdir::{DirEntry, WalkDir}; #[derive(D...
use std::fmt::{Display, Formatter}; use Tile::*; const INPUT: &str = include_str!("../input/day25.txt"); pub(crate) fn day25_part1() -> usize { SeaCucumbers::from(INPUT).first_step_no_cucumbers_moved() } impl SeaCucumbers { fn first_step_no_cucumbers_moved(&mut self) -> usize { let mut steps = 1; ...
//! Power management use crate::rcc::{Clocks, Enable, APB1R1}; use crate::stm32::{pwr, PWR}; use bitfield::{bitfield, BitRange}; use cortex_m::peripheral::SCB; use fugit::RateExtU32; /// PWR error #[non_exhaustive] #[derive(Debug)] pub enum Error { /// Power regulator con not be switched to the low-power voltage ...
//! PNG encoder has Bug some case //! use crate::draw::*; use crate::error::*; use crate::png::header::*; use crate::png::utils::*; use bin_rs::io::*; type Error = Box<dyn std::error::Error>; pub fn encode(image: &mut EncodeOptions<'_>) -> Result<Vec<u8>,Error> { let profile = image.drawer.encode_start(None)?; ...
// Copyright (c) 2012 <NAME> (<EMAIL>) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publi...
use xsd_codegen::{Struct, XMLElement}; use xsd_types::{XsdIoError, XsdName, XsdParseError, XsdType}; use super::{ annotation::Annotation, attribute::Attribute, attribute_group::AttributeGroup, choice::Choice, complex_content::ComplexContent, general_xsdgen, group::Group, sequence::Sequence, simple_co...
extern crate clap; extern crate soundkid; use soundkid::config; use soundkid::reader; use clap::{crate_version, App}; use config::Config; use gpio_cdev::{Chip, EventRequestFlags, LineRequestFlags}; use log::{debug, info}; use nix::sys::signal::{self, Signal}; use nix::unistd::Pid; use std::env; use std::path::Path; ...
extern crate futures; #[macro_use] extern crate log; extern crate rand; extern crate pretty_env_logger; extern crate tokio_timer; use futures::{Future, Poll, Async}; use futures::task::{self, EventSet, UnparkEvent}; use rand::Rng; use std::collections::VecDeque; use std::sync::{Arc, Mutex}; use std::time::{Duration, I...
use std::fs::File; use std::io::Write; use std::path::{Path, PathBuf}; use serde::{Deserialize, Serialize}; use super::path::ConfigPath; use super::FileError; use crate::config::Permission; use crate::defaults; #[inline(always)] fn cache_dir_default() -> ConfigPath { defaults::cache_dir().expect("cache dir") } ...
use std::ffi::{OsString, OsStr}; use ops::{self, Compilation}; use util::{self, CargoTestError, Test, ProcessError}; use util::errors::{CargoResult, CargoErrorKind, CargoError}; use core::Workspace; pub struct TestOptions<'a> { pub compile_opts: ops::CompileOptions<'a>, pub no_run: bool, pub no_fail_fast:...
/// Trait for types that we can compute a maximum cover for. /// /// Terminology: /// * `item`: something that implements this trait /// * `element`: something contained in a set, and covered by the covering set of an item /// * `object`: something extracted from an item in order to comprise a solution /// See: https:/...
use cosmwasm_bignumber::{Decimal256, Uint256}; use cosmwasm_std::{ attr, from_binary, to_binary, Addr, BankMsg, Binary, Coin, CosmosMsg, Empty, Response, Uint128, WasmMsg, }; use cw20::Cw20ExecuteMsg; use cw20::Cw20ReceiveMsg; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use terra_multi_test::...
use chunk::Chunk; use gc::object::Object; use gc::value::Value; use broom::Heap; pub struct Disassembler<'c> { offset: usize, line: usize, chunk: &'c Chunk, heap: &'c Heap<Object>, } impl<'c> Disassembler<'c> { pub fn new(chunk: &'c Chunk, heap: &'c Heap<Object>) -> Self { Disassembler { ...
//! Functionality for preparing the input to `funcmap` derive macros use crate::{ ident::{CRATE_IDENT, TRAIT_IDENT}, ident_collector::IdentCollector, opts::{self, FuncMapOpts, Param}, result::{self, Error, IteratorExt, ResultExt}, syn_ext::{IsTypish, ToNonEmptyTokens}, }; use std::{collections::Ha...
// Copyright 2021 <NAME> // SPDX-License-Identifier: Apache-2.0 use iota_client::{ bee_message::prelude::{ Ed25519Signature, Essence, IndexationPayload, Input, MessageId, Output, Payload, ReferenceUnlock, RegularEssence, SignatureUnlock, TransactionPayload, UnlockBlock, UnlockBlocks, UtxoInput, ...
use std::{thread, time}; pub use spacepacket::SpacePacket; pub use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use std::net::{ UdpSocket}; use std::net::{ SocketAddr, Ipv4Addr, TcpStream}; use std::collections::HashMap; use Config; use std::io::prelude::*; pub enum TlmCmds { ShutdownCommand, Destina...
//! A table with a potentially different type for each entry. use error::{Error, Result}; use iter::TableIterator; use serde::de::DeserializeOwned; use serde::ser::Serialize; use serde_msgpack; use std::cell::RefCell; use std::fs::{OpenOptions, File}; use std::io::{Read, Write, Seek, SeekFrom}; use std::path::Path;...
use std::collections::HashMap; use quote::{quote, ToTokens}; use syn::__private::TokenStream2; use syn::parse::Parse; use syn::spanned::Spanned; use syn::Expr; #[derive(Debug)] pub enum Scope { /// # Args /// /// observable ident Observable(Vec<TokenStream2>), Constant, } impl PartialEq for Scope...
use futures::TryFutureExt; use serde::Deserialize; use std::net::SocketAddr; use std::path::{Path, PathBuf}; use tokio::fs::OpenOptions; use tokio::io::{AsyncReadExt, BufReader}; #[derive(Debug, Clone, Deserialize, Default)] pub struct IndexConfig { pub remote_url: String, #[serde(default = "IndexConfig::local...
use std::error::Error; use crate::templates::{DEFAULT_TEMPLATE_DIR, Context, Engines}; use rocket::Rocket; use rocket::fairing::{Fairing, Info, Kind}; pub(crate) use self::context::ContextManager; type Callback = Box<dyn Fn(&mut Engines) -> Result<(), Box<dyn Error>>+ Send + Sync + 'static>; #[cfg(not(debug_assert...
use std::sync::{Arc, RwLock}; use std::collections::HashMap; use std::time::Duration; mod model; pub use model::{ComponentResultsModel, ComponentState}; use crate::components::{ComponentDescription, ComponentId, ComponentType}; use crate::results::ComponentResult; pub struct RunStateModel { component_result_stat...
use serde_json::{self, Value as SJsonValue}; use super::new_request_id; use crate::common::error::prelude::*; use crate::ledger::constants::READ_REQUESTS; use crate::ledger::TxnAuthrAgrmtAcceptanceData; use crate::pool::ProtocolVersion; use crate::state_proof::{ constants::REQUEST_FOR_FULL, parse_key_from_request_...
use std::{ fmt::{Debug, Formatter, Result as FmtResult}, str::CharIndices, }; /// An iterator over command arguments. #[derive(Clone)] pub struct Arguments<'a> { buf: &'a str, indices: CharIndices<'a>, idx: usize, } impl<'a> Arguments<'a> { /// Returns a new iterator of arguments from a buffer...
// Copyright 2019 The xi-editor 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 or ag...
use std::env; use proc_macro2::{Ident, Span, TokenStream}; use sqlx::runtime::fs; use syn::parse::{Parse, ParseStream}; use syn::punctuated::Punctuated; use syn::spanned::Spanned; use syn::token::Group; use syn::{Expr, ExprLit, ExprPath, Lit}; use syn::{ExprGroup, Token}; use quote::{format_ident, quote, ToTokens}; ...
use std::convert::TryInto; use anyhow::Context; use crate::{ geometry::Geometry, geometry_buffers::GeometryBuffers, render_context::RenderContext, texture::Texture, vertex::HudVertex, }; pub const DX: f32 = 20.0 / 640.0; pub const DY: f32 = 20.0 / 360.0; #[rustfmt::skip] const CHARACTER_WIDTHS: [i32; 16 * 8...
use anyhow::Context as _; use proptest::collection::size_range; use proptest::prelude::*; use std::collections::HashSet; use tokio::io::{AsyncRead, AsyncWrite}; use tokio::net::{TcpListener, TcpStream}; use transport::{Transport, WebSocketStream}; /// For sane Debug display #[derive(PartialEq, Eq, PartialOrd, Ord, Clo...
use ordered_float::OrderedFloat; use railplotlib::model::{Shape}; use crate::convert_lua::{polyline_from_lua, point_from_lua}; use crate::convert_lua::{shape_from_string}; use rlua; use log::trace; type Pt = (f64,f64); /// TikZ coordinate string "(x,y)" fn coords(x:f64,y:f64) -> String { format!("({},{})",x,y) } fn a...
// 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 { anyhow::{Context as _, Error}, fidl_fuchsia_ui_input as ui_input, fidl_fuchsia_ui_input3::{self as ui_input3, KeyMeaning, NonPrintableKey...
//! The `~/.cargo/audit.toml` configuration file use rustsec::warning; use rustsec::{ advisory, database::scope, platforms::target::{Arch, OS}, report, Error, ErrorKind, }; use serde::{Deserialize, Serialize}; use std::path::PathBuf; use std::str::FromStr; /// `cargo audit` configuration: /// /// An o...
use iced::{ window, Align, Application, Clipboard, Color, Column, Command, Container, Element, Length, Settings, Subscription, }; use iced_native::{ window::Event::{FileDropped, Resized}, Event, }; use async_std::sync::{Arc, RwLock}; use log::{error, info}; use std::path::PathBuf; use fuzzr::{ dat...
use crate::p_ops; use nsi_3delight as nsi_3dl; fn nsi_camera<'a>( c: &nsi::Context<'a>, name: &str, open: nsi::output::OpenCallback, write: nsi::output::WriteCallback, finish: nsi::output::FinishCallback, ) { // Setup a camera transform. c.create("camera_xform", nsi::NodeType::Transform, &[...
use std::ops::Deref; use crate::errors::ANTLRError; use crate::int_stream::{EOF, IntStream, IterWrapper}; use crate::token::{Token, TOKEN_DEFAULT_CHANNEL, TOKEN_INVALID_TYPE}; use crate::token_source::TokenSource; use crate::token_stream::{TokenStream, UnbufferedTokenStream}; pub struct CommonTokenStream<T: TokenSour...
use std::collections::HashMap; use itertools::Itertools; use nalgebra::DMatrix; use super::{EvaluationMetric, PVA}; /// Construct a confusion matrix for the PVA data. /// /// The confusion matrix is defined to have entry i, j equal to the number of observations /// known to be in group i but predicted to be in group...
//file is needed for curve25519xsalsa20poly1305 //obtained from https://github.com/goldenMetteyya/microsalt/blob/master/src/shared.rs //Internal Shared Functions use std::num::Wrapping as W; ///Typedef: Gf -> i64 [16], representing 256-bit integer in radix 2^16 pub type Gf = [i64;16]; //const gf0 = {0} const GF0 : Gf...
use std::net::SocketAddr; use std::io::{Result, Error, ErrorKind}; use std::sync::Arc; use log::{debug, info, warn}; use async_trait::async_trait; use bytes::Bytes; use http::{StatusCode, Request, Response}; use tokio::io::{AsyncRead, AsyncWrite}; use h2::RecvStream; use h2::server::{self, SendResponse}; use super::H...
// Copyright (c) 2016 <NAME> // SPDX-License-Identifier: MIT use super::{bitmask::BitMask, EMPTY}; use core::{mem, ptr}; // Use the native word size as the group size. Using a 64-bit group size on // a 32-bit architecture will just end up being more expensive because // shifts and multiplies will need to be emulated....
use crate::{SecretKey, Signature}; use blake2::Blake2b; use bls12_381_plus::{G1Affine, G1Projective, Scalar}; use core::convert::TryFrom; use digest::Digest; use group::Curve; use hmac_drbg::HmacDRBG; use serde::{ de::{Error as DError, SeqAccess, Visitor}, ser::SerializeTuple, Deserialize, Deserializer, Ser...
use serde::{Serialize, Deserialize}; use super::{servers, info}; #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Document { #[serde(default = "default_openapi")] pub openapi: String, pub info: info::Info, pub servers: Vec<servers::Server> } fn default_openapi() -> String { "3.0.0".to_ow...
use std::{ borrow::Borrow, cell::RefCell, collections::{BTreeMap, BTreeSet}, io::Result, rc::Rc, sync::Arc, }; use super::record::GbamRecord; use bam_tools::record::fields::Fields; use byteorder::{LittleEndian, ReadBytesExt}; use flate2::write::GzDecoder; use lz4::Decoder; use memmap2::Mmap; ...
#![recursion_limit = "128"] /// serializes a type as a different repr type using the given conversion functions #[macro_export] macro_rules! serde_conv { ($m:ident, $t:ty, /*$ser:expr,*/ $de:expr) => { pub mod $m { use ::serde::{/*Serialize, Serializer,*/ Deserialize, Deserializer}; use super::*; /* pub fn...
// Copyright 2018 astonbitecode // // 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 wr...
//! Reading of the WOFF font format. use flate2::bufread::ZlibDecoder; use crate::binary::read::{ReadArray, ReadBinary, ReadBuf, ReadCtxt, ReadFrom, ReadScope}; use crate::binary::U32Be; use crate::error::ParseError; use crate::tables::FontTableProvider; use std::borrow::Cow; use std::convert::TryFrom; use std::io::...
#![allow(dead_code)] use std::io::{self, Write}; use std::collections::LinkedList as List; use std::mem; /// Abstraction for writing frame buffered data to non-blocking sockets. /// /// Note that an individual frame writer should only write to one socket, since it tracks whether or /// not the socket is writable dir...
// Copyright 2021, 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 // di...
use { async_std::{ fs::File, future::timeout, io::WriteExt, task::{spawn, JoinHandle}, }, futures::stream::{futures_unordered, FuturesUnordered}, http::{Method, Uri}, isahc::{config::VersionNegotiation, prelude::*, Request}, mime::Mime, serde::Deserialize, ...
use super::state_prelude::*; const UI_RON_PATH: &str = "ui/main_menu.ron"; #[derive(Default)] pub struct MainMenu { ui_entities: Vec<Entity>, ui_reader_id: Option<ReaderId<UiEvent>>, } impl MainMenu { fn handle_keys<'a, 'b>( &self, data: &StateData<CustomGameData<CustomData>>, ) -> O...
use std::collections::{HashMap, HashSet}; use std::sync::Arc; use iced_x86::{BlockEncoder, BlockEncoderOptions, Instruction, InstructionBlock}; use crate::context::Context; use crate::generate::{Relative, Section}; use crate::node::{FunctionPath, Size, Variable}; use crate::query::Key; use crate::span::Span; use sup...
use crate::context::Context; #[cfg(not(any(target_arch = "wasm32", target_os = "ios", target_os = "android",)))] use crate::input::gamepad::GamepadId; pub use crate::input::keyboard::KeyMods; pub use crate::input::MouseButton; #[cfg(not(any(target_arch = "wasm32", target_os = "ios", target_os = "android",)))] use gilr...
use core::num::NonZeroU32; use std::collections::HashSet; use regex::Regex; use uuid::Uuid; use crate::entities::{ContentId, PartialAuthor, UserId}; use crate::usecases::content::{AuthorQuery, ContentContentMutation, ContentQuery, PostedQuery}; use crate::usecases::user::{UserMutation, UserQuery}; use crate::utils::L...
// Copyright (c) 2021-present, Cruise LLC // // This source code is licensed under the Apache License, Version 2.0, // found in the LICENSE-APACHE file in the root directory of this source tree. // You may not use this file except in compliance with the License. use crate::zerde::*; use crate::*; pub(crate) fn parse_...
use nanoserde::DeRon; use std::collections::HashMap; use crate::grunt::Grunt; use crate::lua::stdlib::ValidationResult; use crate::pipe_contents::PipeContents; use crate::pipeline::action::PipelineAction as PA; use crate::pipeline::step_handler::{ StepCompletion, StepError, StepHandler, StepHandlerInit, StepResul...
use crate::{ common::{ error::{inv_arg, Result}, log::{callback::LogCallback, tee_file::TeeFileConfiguration, LoglevelFilter}, types::PluginType, }, host::configuration::{PluginConfiguration, ReproductionPathStyle, Seed}, }; /// The complete configuration for a DQCsim run. #[derive(...
use std::time::Duration; use clap::ArgMatches; use semver::Version; use crate::prelude::*; use service::{main::*, terminal::disable_raw_mode, terminal::reset_terminal_state}; use simplelog::{TermLogger, TerminalMode}; use crate::bus::MainBus; use message::main::{MainRecv, MainShutdown}; use lifeline::dyn_bus::DynB...
use std::time::SystemTime; use pancake_db_idl::dml::field_value::Value; use pancake_db_idl::dml::RepeatedFieldValue; use prost_types::Timestamp; /// Re-export for the purpose of [`make_row`]. pub use pancake_db_idl::dml::{FieldValue, Row}; /// Trait used by [`make_row`] to convert native types to Pancake IDL types. ...
use super::Director; use crate::fs; use crate::fs::Stub; use getset::Getters; use nu_glob::glob; use std::path::{Path, PathBuf}; use std::str; use tempfile::{tempdir, TempDir}; #[derive(Default, Clone, Debug)] pub struct EnvironmentVariable { pub name: String, pub value: String, } impl EnvironmentVariable { ...
use std::str::FromStr; use chrono::{DateTime, FixedOffset}; #[cfg(test)] use std::fmt::{Display, Formatter}; #[cfg(test)] use mockall::Any; #[cfg(test)] use serde_json::{json, Value}; #[derive(Clone, PartialEq, Debug)] #[repr(u8)] pub(crate) enum Operation { Added = b'A', Modified = b'M', Deleted = b'D', ...
/* Copyright 2017 <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, software distribu...
//! The PDFium library is not thread safe so all types in `pdfium_rs` are `!Send` and `!Sync`. //! Trying to use these types across threads will not compile. //! //! Example: //! ```compile_fail //! use pdfium_rs::Library; //! //! let mut library = Library::init().unwrap(); //! //! // Fails to compile because Library i...
use std::io; //use io from the standard libraries use colored::*; //use for terminal colors use std::cmp::Ordering; //use for checking order use rand::Rng; //use random numbers fn main() { loop { println!("\n\nPlease input a corresponding number: "); println!("0: Quit\n1: Guessing game\n2: Fizzbuzz...
pub mod commands { // Common commands. pub const GET_VERSION: u8 = 0xf1; pub const JTAG_COMMAND: u8 = 0xf2; pub const DFU_COMMAND: u8 = 0xf3; pub const SWIM_COMMAND: u8 = 0xf4; pub const GET_CURRENT_MODE: u8 = 0xf5; pub const GET_TARGET_VOLTAGE: u8 = 0xf7; pub const GET_VERSION_EXT: ...
//! Includes manual `GarbageCollected` implementations for various types. //! //! Since unsafe code and third-party libraries can't have an automatically derived `GarbageCollected` implementation, //! we need to manually provide them here. //! This is done for all stdlib types and some feature gated external libraries....
use std::{any::Any, sync::Arc}; use async_trait::async_trait; use datafusion::{ arrow::{ array::{Array, ArrayRef, BooleanBuilder, StringBuilder, UInt16Builder, UInt32Builder}, datatypes::{DataType, Field, Schema, SchemaRef}, record_batch::RecordBatch, }, datasource::{datasource::Tab...
use std::collections::HashMap; use bellframe::{AnnotBlock, Mask, Row, RowBuf}; use index_vec::IndexVec; use itertools::Itertools; use super::{check_duplicate_shorthand, Result, SNAP_FINISH_LABEL, SNAP_START_LABEL}; use crate::layout::{BlockIdx, BlockVec, Layout, Link, LinkVec, RowIdx, StartOrEnd}; /// Creates a `Lay...
//! Calculates a look-up table of albedo boost needed to achieve energy //! preservation when blending between dielectric and metal attributes //! in a physically-based energy-conserving BRDF. //! //! The calculations are done for F0, but remain correct through F90. use std::fs::File; use std::io::prelude::*; use plo...
use ansi_term::{ ANSIGenericString, Colour::{Blue, Green, Purple, Red}, }; use scraper::{Html, Selector}; use serde_json::Value; use std::error::Error; use std::fs; use std::io; use std::process::{Command, Output}; pub fn fetch_page(url: &str) -> io::Result<Output> { Command::new("curl").arg("-s").arg("-S"...
//! Defines the Scope type and parsing/formatting according to the rfc. use std::{cmp, fmt, str}; use std::collections::HashSet; /// Scope of a given grant or resource, a set of scope-tokens separated by spaces. /// /// Scopes are interpreted as a conjunction of scope tokens, i.e. a scope is fulfilled if all of /// i...
#![allow(dead_code, non_camel_case_types, non_upper_case_globals, non_snake_case)] use std::os::raw::{c_char, c_double, c_float, c_int, c_short, c_uchar, c_uint, c_ushort, c_void}; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct alc_device { _unused: [u8; 0], } #[repr(C)] #[derive(Debug, Copy, Clone)] pub st...
use super::io_constants::{*}; use super::gpu::{*}; use super::memory::{*}; use super::timer::{*}; use super::cartridge::{*}; use super::joypad::{*}; use super::cpu::registers::Response; use super::cpu::registers::Value; pub use super::interrupt::{*}; #[derive(Default)] pub struct Bus { memory: Memory, pub gpu...
//! The user-configurable portion of the type checker. use std::str; use std::ascii::AsciiExt; use std::path::{Path, PathBuf, MAIN_SEPARATOR}; use kailua_env::{Spanned, WithLoc}; use kailua_diag::{Report, Stop}; use kailua_syntax::Chunk; /// Options for customizing the type checker. /// /// All of those methods retu...
use std::cell::Cell; use sdl2::controller::{Axis, Button, GameController}; use sdl2::event::Event; use sdl2::keyboard::Keycode; use sdl2::Sdl; use ui::ButtonState; pub struct Controller { buttons: Cell<::ui::Buttons>, #[allow(dead_code)] controller: Option<GameController>, x_axis_state: Cell<AxisStat...
use crate::{ circuit::{ cs::{RCS, WitnessCS, CS}, lc::{Index} }, core::signal::Signal, ff_uint::{Num, PrimeField}, }; use bit_vec::BitVec; use bellman::{ConstraintSystem, SynthesisError}; #[cfg(feature = "borsh_support")] use borsh::{BorshSerialize, BorshDeserialize}; use bellman::...
use std::collections::VecDeque; use flatbuffers::FlatBufferBuilder; use super::{Bytes, LevelId, Timestamp}; use crate::error::Result; use crate::file::FileManager; #[derive(Default, PartialEq, Eq, Debug, Clone, Copy)] pub struct LevelDesc { start: Timestamp, end: Timestamp, id: LevelId, } impl From<prot...
use crate::ic::ma702::{Ma702, StreamingPolling}; use core::f32::consts::PI; use third_party::ang::{AbsoluteDist, Angle}; const TWO_PI: f32 = PI * 2.; struct PllObserverRadians { kp: f32, ki: f32, min_d_theta: Angle, angle: Option<Angle>, velocity: Angle, d_theta: Angle, } struct PllObserverSt...
use bcc::BccError; use bcc::{Kprobe, BPF}; use clap::{App, Arg}; use core::sync::atomic::{AtomicBool, Ordering}; use std::collections::HashMap; use std::sync::Arc; use std::{cmp, ptr, thread, time}; // A simple tool for reporting on time spent in hardirq handlers // // Based on: https://github.com/iovisor/bcc/blob/ma...
use std::cmp::Ordering; use std::collections::HashMap; use std::collections::HashSet; use walkdir::WalkDir; mod platform; use self::platform::*; pub fn simplify_dir_names(filenames: Vec<&str>) -> HashSet<String> { let mut top_level_names: HashSet<String> = HashSet::new(); for t in filenames { let to...
// Optimizations for windows and the windows webdav mini-redirector. // // The main thing here is case-insensitive path lookups, // and caching that. // use std::ffi::{OsStr, OsString}; use std::fs; use std::io::ErrorKind; use std::path::{Path, PathBuf}; use std::sync::Arc; use std::thread; use std::time::{Duration, Sy...
//! Math helpers use num_traits::ToPrimitive; use stable_swap_client::fees::Fees; const MAX: u64 = 1 << 32; const MAX_BIG: u64 = 1 << 48; const MAX_SMALL: u64 = 1 << 16; /// Multiplies two u64s then divides by the third number. /// This function attempts to use 64 bit math if possible. #[inline(always)] pub fn mul_d...
use std::time::Duration; use std::cell::RefCell; use std::env; use std::collections::VecDeque; use fate::main_loop::{MainSystem, Tick as MainLoopTick, Draw as MainLoopDraw}; use fate::lab::duration_ext::DurationExt; use fate::lab::fps::{FpsManager, FpsCounter}; use fate::mt; use g::G; use system::{System, Tick, Draw}...
use std::ops::Deref; use crate::gui::*; pub(crate) enum CharacterSelectionResult { SelectCharacter(Box<Character>), CreateCharacter, Cancel, } pub(crate) async fn draw_character_selection() -> CharacterSelectionResult { let mut result = None; let mut characters = Vec::new(); let mut should_r...
/* * Copyright 2019 Cargill Incorporated * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
use std::{ path::{Path, PathBuf}, fs::{self, File}, io::{self, Read}, env, marker::PhantomData, }; use checked_command::CheckedCommand; use failure::Fail; use futures::IntoFuture; use headers::header_components::{ MediaType, FileMeta }; use crate::{ iri::IRI, utils::{ Send...
extern crate bio; extern crate clap; extern crate debruijn; extern crate boomphf; extern crate pretty_env_logger; #[macro_use] extern crate log; #[macro_use] extern crate lazy_static; use std::io; use std::io::Write; use std::sync::Arc; use bio::io::{fasta}; use clap::{App, Arg}; use debruijn::*; use debruijn::filt...
use std::any::Any; use std::io; use std::cell::RefCell; use std::rc::Rc; use anymap::AnyMap; use core::reactor::Handle; use c3po::{ConnFuture, Conn, Pool, Config}; use futures::{IntoFuture, Future, future, Stream, stream}; use futures_cpupool::{CpuPool, CpuFuture}; use num_cpus; use tokio::NewService; use Error; use ...
use std::borrow::Cow; use std::collections::HashMap; use std::hash::BuildHasherDefault; use std::rc::Rc; use auto_enums::auto_enum; use derive_more::{AsRef, Display, From}; use enum_as_inner::EnumAsInner; use ustr::{IdentityHasher, Ustr}; pub const POINTER_SIZE: usize = 8; pub const MAX_ALIGN: usize = 8; #[derive(De...
//use std::cmp; use core::ops::Range; use std::collections::VecDeque; /// 在有序集合上查找元素第一次出现的索引 pub fn search_first<T: Ord>(array: &[T], elem: &T) -> Result<usize, usize> { let mut index = array.binary_search(elem)?; for e in array[0..index].iter().rev() { if e == elem { index -= 1; } ...
// https://doc.rust-lang.org/stable/book/ch05-01-defining-structs.html struct User { active: bool, username: String, email: String, sign_in_count: u64, } // let's see if we can change from String to str struct UserWithStr { // we cannot use the type &str since it will give the error // "expect...
/*! ## FIR filter This module implements **Finite Impulse Response** (FIR) filter. The parameters of filter can be found using different analytical methods and it's non-trivial. See also [Finite impulse response](https://en.wikipedia.org/wiki/Finite_impulse_response). */ use crate::{Cast, DelayLine, Transducer}; ...