text
stringlengths
3.09k
13.9k
use serde::Deserialize; use std::convert::{TryFrom, From}; use std::fmt::{Display, Formatter}; use num_derive::FromPrimitive; use num_traits::FromPrimitive; use chrono::{Datelike, DateTime, Local, NaiveTime, Weekday}; #[derive(FromPrimitive)] pub enum Day { Sunday = 0, Monday, Tuesday, Wednesday, T...
// 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 ...
/* The function of this file is to make the main ui that is used in the app and it also combines the map into it */ use crate::common_traits::*; use crate::ui_ext::popups::{ask, err, note}; use fltk::{ app, app::wait_for, button::Button, enums::*, frame::Frame, group::Pack, input::Input, output::MultilineOutp...
use core; pub type Prob = u16; pub const BLEND_FIXED_POINT_PRECISION : i8 = 15; #[allow(dead_code)] pub const LOG2_SCALE : i32 = 15; #[derive(Debug,Copy, Clone)] pub struct Weights { model_weights: [i32;2], mixing_param: u8, normalized_weight: Prob, } impl Default for Weights { fn default() -> Self { ...
//! 2D and 3D grid rendering. use glium::glutin::event::ModifiersState; use send_wrapper::SendWrapper; use std::cell::RefCell; use ndcell_core::prelude::*; use crate::commands::DragCmd; use crate::mouse::MouseState; mod generic; mod gl_ndtree; mod ibos; mod picker; mod render2d; mod render3d; mod resizing; mod shad...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Timer0_A5 Control"] pub ta0ctl: crate::Reg<ta0ctl::TA0CTL_SPEC>, #[doc = "0x02 - Timer0_A5 Capture/Compare Control 0"] pub ta0cctl0: crate::Reg<ta0cctl0::TA0CCTL0_SPEC>, #[doc = "0x04 - Timer0_A5 Capture/Compare Control...
use log::warn; use std::cmp::{min, Ord, Ordering}; use std::fmt::{Display, Formatter}; #[cfg(test)] use super::VersionMatcher; use super::{Version, VersionComponent}; impl Ord for Version { fn cmp(&self, other: &Version) -> Ordering { let end = min(self.parts.len(), other.parts.len()); for i in 0....
// Copyright 2020 <NAME> // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writi...
/// An enum representing all the keys of a keyboard (normally) #[derive(Debug, PartialEq)] #[allow(missing_docs)] pub enum Key { Unknow = 0, BackSpace = 8, Tab = 9, Enter = 13, Shift = 16, Ctrl = 17, Alt = 18, Pause = 19, CapsLock = 20, Escape = 27, PageUp = 33, PageDown ...
// Copyright 2020 The Matrix.org Foundation C.I.C. // // 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...
use std::fmt::{Display, Formatter}; use ogg_pager::PageError; /// Alias for `Result<T, LoftyError>` pub type Result<T> = std::result::Result<T, LoftyError>; /// Errors that could occur within Lofty #[derive(Debug)] pub enum LoftyError { // File extension/format related errors /// Unsupported file extension BadExt...
use crate::*; use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; use near_sdk::json_types::{ValidAccountId, U128}; use near_sdk::{env, near_bindgen, AccountId}; pub const PIXEL_COST: Balance = 1_000_000_000_000_000_000; pub const ONE_NEAR: Balance = 1_000_000_000_000_000_000_000_000; pub const DEFAULT_POT...
use crate::types::*; use hyper::StatusCode; use ic_metrics::{ buckets::{add_bucket, decimal_buckets}, MetricsRegistry, }; use ic_types::time::{current_time_and_expiry_time, Time}; use prometheus::{HistogramVec, IntCounter, IntCounterVec, IntGauge}; use std::sync::Arc; use std::time::Duration; use tokio::time::I...
use regex::Regex; use std::env; use std::fs; use std::fs::File; use std::io; use std::io::prelude::*; use std::path::Path; use subprocess::{Popen, PopenConfig, Redirection}; use chrono::{DateTime, Utc}; use chrono_tz::Asia::Seoul; use chrono_tz::Tz; pub enum ChromeType { GOOGLE, CHROMIUM, MSEDGE, } pub en...
use anyhow::{anyhow, Result}; use reqwest::Url; use std::{ collections::HashMap, path::{Path, PathBuf}, process::{Child, Command}, sync::Arc, time::Duration, }; use tokio::time::sleep; use rsnano::{ get_node_toml_config_path, get_rpc_toml_config_path, unique_path, DaemonConfig, NetworkConst...
// 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...
// Copyright 2018 Google 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
// // GLM-COLOR // // Copyright (c) 2015 The glm-color authors. // // 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, c...
use futures::future::join_all; use integration_test_commons::test::prelude::*; use std::{fmt, time::Duration}; #[test] fn service_should_be_started_successfully() { let mut client = TestKubeClient::new(); client.timeouts().delete = Duration::from_secs(60); setup_repository(&client); let pod = Tempora...
use crate::matcher::{Matcher, MatcherFailure, MatcherRef, MatcherSuccess}; use crate::parser_context::ParserContextRef; use crate::scope::VariableType; use crate::scope_context::ScopeContextRef; pub enum FetchableType { String(String), Matcher(MatcherRef), } pub trait Fetchable { fn fetch_value(&self, context: ...
// Copyright 2018 The Grin Developers // // 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 agree...
mod controller; use gl; use glfw; use glfw::Context; use controller::Controller; use cuboid::components::{ Camera, PerspectiveCamera, Material, Renderer3D, Shape, }; use cuboid::core::Shader; use cuboid::io::CameraController; use cuboid::utils::{init, math::linalg, types}; const WINDOW_TITLE: &st...
use image::{ImageBuffer, ImageEncoder, RgbaImage}; use serde::{Deserialize, Serialize}; use std::io::Cursor; use wasm_bindgen::prelude::*; // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global // allocator. #[cfg(feature = "wee_alloc")] #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_al...
#![crate_name = "mml"] #![crate_type = "lib"] #![doc(html_root_url = "https://docs.rs/mml/0.1.41")] #![cfg_attr(feature = "nightly", feature(plugin))] #![cfg_attr(feature = "lints", plugin(clippy))] #![cfg_attr(feature = "lints", deny(warnings))] #![cfg_attr(not(any(feature = "lints", feature = "nightly")), deny())] #!...
use core::convert::TryInto; use super::compare_bytes; #[allow(clippy::upper_case_acronyms)] #[derive(Debug, Eq, PartialEq)] enum DocType { DOC, DOCX, XLS, XLSX, PPT, PPTX, OOXML, } /// Returns whether a buffer is Microsoft Word Document (DOC) data. pub fn is_doc(buf: &[u8]) -> bool { ...
use std::iter::{Chain, Rev}; use std::slice::Iter; // First, we make a struct to represent the circular buffer. // We'll give it a type parameter, so we can use it for floating point or integer samples. #[derive(Default)] pub struct VecCircBuf<T> { buf: Vec<T>, write_idx: usize, } // Next, we'll add some meth...
use std::marker::PhantomData; use mina_hasher::{Hashable, ROInput}; use mina_signer::{create_legacy, CompressedPubKey, Keypair, NetworkId, Signature, Signer}; use super::{Keys, KeysError}; /// A keypair used for signing and verifying messages in the Mina signature /// scheme. Note that the signature scheme needs to ...
use alloc::string::String; use alloc::vec; use alloc::vec::Vec; use memchr::memchr; use crate::impl_reader; use crate::parsers::common::NewLine; use crate::parsers::extract_opt; use crate::parsers::FromSlice; use crate::record::{StateMetadata, Value}; use crate::EtError; pub(crate) fn split<'a>( buffer: &mut Vec...
use std::{ sync::{ mpsc::channel, Arc, RwLock, RwLockReadGuard, }, error::Error, fs::File, path::Path, str::FromStr, time::Duration, thread, panic, }; use notify::{Watcher, RecursiveMode, watcher}; use walkdir::{WalkDir, DirEntry}; use crate::{ e...
use std::fs::File; use std::io::{self, BufWriter, Write}; use std::path::{Path, PathBuf}; use std::process::Command; use crate::ast::DefCircuit; use crate::ast::ToDoc; fn path_to_string(path: &Path) -> String { match path.to_str() { Some(s) => String::from(s), None => panic!("failed to convert pat...
use std::collections::HashMap; use serde::{Deserialize, Serialize}; /// Newtype for bot ids. #[derive(Debug)] pub struct BotId(pub u64); /// Newtype for user ids. #[derive(Debug)] pub struct UserId(pub u64); /// Newtype for guild ids. #[derive(Debug)] pub struct GuildId(pub u64); /// Basic user information returned ...
use std::path::PathBuf; use std::sync::Arc; use anyhow::Result; use serde::{Deserialize, Serialize}; use crate::{ResourceManager, Service}; use trigger_system::{ iface_impl::config::{ datastore::DatastoreTriggerConfigLoader, embedded::EmbeddedTriggerConfigLoader, file::FileTriggerConfigLoader, ...
use std::fs::{File, OpenOptions, create_dir}; use std::io; use std::io::{BufReader, prelude::*, Error}; use std::path::Path; use std::env; use std::{thread, time}; use chrono::prelude::*; mod connection; use crate::connection::{Connection, TotalConnections}; mod input; use crate::input::{Input}; fn main() { let...
//! The `helper` module contains helper constructs for general workflow. extern crate bitvec; extern crate rand; extern crate serde; use rand::{Rng, thread_rng}; use serde::{Deserialize, Serialize}; use std::convert::TryFrom; /// Randomly returns one of the specified values. /// /// # Parameters /// /// * `a` - the f...
use camino::{Utf8Path, Utf8PathBuf}; use crate::{anyhow, error::RoverError, Context, Result, Suggestion}; use std::{fmt, io::Read}; #[derive(Debug, PartialEq)] pub enum FileDescriptorType { Stdin, File(Utf8PathBuf), } impl FileDescriptorType { pub fn read_file_descriptor( &self, file_des...
use std::fmt::Debug; use std::mem; use std::ops::{ Deref, DerefMut, }; use std::sync::{Arc, Mutex}; use futures::{ Async, Future, Poll, }; use futures::task::{ self, Task, }; use futures::executor::{Notify, NotifyHandle, spawn}; use serde_json; use event::{AsyncOutcome, SpanId, TraceEvent}; ...
use super::{systems::cleanup_system, GameState}; use bevy::{app::AppExit, prelude::*}; const TEXT_COLOR: Color = Color::rgb(0.9, 0.9, 0.9); pub struct MenuPlugin; impl Plugin for MenuPlugin { fn build(&self, app: &mut App) { app .add_state(MenuState::Disabled) .add_system_set(SystemSet::on_enter(G...
use analyze::{AnalyzerResult, HostAnalysisSummary, PortAnalysisReason, PortAnalysisResult}; use prettytable::cell::Cell; use prettytable::row::Row; use prettytable::{color, format, Attr, Table}; use serde_json; use std::io::Write; use std::net::IpAddr; use std::str::FromStr; error_chain! { errors { Invali...
use chrono::{DateTime, Duration, Local, Utc}; use serde::{Deserialize, Serialize}; use serde_json::Value; use sqlx::{database::HasValueRef, mysql::MySqlTypeInfo, Database, Decode, FromRow, MySql, Type}; use crate::{ database::DSP_POOL, error::Error, model::{BidType, Status}, }; #[derive(Debug, Clone, Seri...
//! A simple naive bayes classifier //! with glass identification as example. //! //! ### Todo //! At the moment this is taken as exactly as possible //! from the python source without the magic of panda. //! This results in complex functions and an unstructered data flow. use std::io::{self, BufRead, BufReader}; use s...
use orbclient::{self, EventIter, Renderer, WindowFlag}; use std; use interpolate::Interpolator; use model::mesh::Mesh; use primitive::edge::Edge; use primitive::matrix::Matrix4f32; use primitive::vertex::Vertex; use texture::bitmap::BitmapTexture; pub struct RenderContext { window: orbclient::Window, } impl Rend...
//! Cut the input stream in chunks for batch processing. use crate::as_mut_slice_no_borrow_check; use crate::options::ARGS; use std::fs::File; use std::io; use std::io::Read; use std::iter::Peekable; use std::path::Path; use std::path::PathBuf; use std::slice; use std::slice::Iter; /// This is the type used to count ...
use crate::shared::AwsCredentials; use crate::shared::{NitroKeygenConfig, NitroKeygenResponse, NitroRequest, NitroResponse}; use ed25519_dalek::PublicKey; use std::{fs::OpenOptions, io::Write, os::unix::fs::OpenOptionsExt, path::Path}; use tmkms_light::utils::{read_u16_payload, write_u16_payload}; use vsock::SockAddr;...
//! This is a board support crate for the [EFM32GG-STK3700] Starter Kit. //! //! State and quick-start //! --------------------- //! //! Right now, it is very minimal; LEDs and buttons are exposed in a board struct, but that's about //! it. It will grow as the underlying [HAL implementation] does. //! //! Thus, the lar...
use std::{collections::HashMap, str::FromStr}; use anyhow::Result; use bytes::Bytes; use hyper::{ header::{HeaderName, HeaderValue}, Body, StatusCode, }; use itertools::Itertools; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use smr::types::{BaseRequest, Request, Response}; use std::convert::TryF...
// Copyright (c) 2021 Quark Container 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 ...
/* Copyright 2021 Integritee AG and Supercomputing Systems AG Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or...
use super::InferenceModel; use super::*; use crate::prelude::*; use std::borrow::BorrowMut; use std::collections::{BTreeSet, HashMap}; /// A graph analyser, along with its current state. #[derive(new)] pub struct Analyser<M: BorrowMut<InferenceModel>> { model: M, } impl<M: BorrowMut<InferenceModel>> Analyser<M> {...
#![allow(unused_imports, dead_code)] use async_trait::async_trait; use ate::loader::DummyLoader; use ate::prelude::*; use ate::utils::LoadProgress; use ate_auth::prelude::*; use ate_files::codes::*; use ate_files::prelude::*; use derivative::*; use std::io::Write; use std::sync::Arc; use std::ops::Deref; use tokio::syn...
use base32::Alphabet; use hmac::{Hmac, Mac}; use sha1::Sha1; use sha2::{Sha256, Sha512}; use std::collections::HashMap; use url::Url; use crate::hotp::HOTP; use crate::totp::TOTP; /// The digest to use with TOTP. /// /// All three digests referenced in [RFC6238] are supported: /// - SHA1 /// - SHA256 /// - SHA512 ///...
use core::convert::TryInto; use core::fmt; use bytes::{Buf, BufMut, Bytes, BytesMut}; use super::markers::{self, has_entropy, has_length}; use crate::encoder::{EncodeAt, ImageEncoder}; use crate::util::{read_checked, split_to_checked}; use crate::{Error, Result, EXIF_DATA_PREFIX}; const ICC_DATA_PREFIX: &[u8] = b"IC...
#![no_main] #![no_std] use black_pill as _; // global logger + panicking-behavior + memory layout use defmt::Format; use hal::blocking::delay::DelayMs; use stm32f4xx_hal::gpio::gpiob::{PB6, PB7}; use stm32f4xx_hal::gpio::{Alternate, OpenDrain}; use stm32f4xx_hal::hal; use stm32f4xx_hal::i2c::{I2c, Mode}; use stm32f4xx...
use crate::devices::uart::Uart; use crate::utils::error::OsError; use crate::utils::NullTerminatedStr; use crate::{print, println}; use core::mem::size_of; const FDT_BEGIN_NODE: u8 = 1; const FDT_END_NODE: u8 = 2; const FDT_PROP: u8 = 3; const FDT_NOP: u8 = 4; const FDT_END: u8 = 9; #[derive(Debug)] #[repr(C)] struct...
#![warn(unsafe_op_in_unsafe_fn)] #![warn(clippy::unwrap_used)] #![warn(clippy::expect_used)] #![feature(asm)] #![feature(abi_x86_interrupt)] #![feature(alloc_error_handler)] #![feature(const_mut_refs)] #![feature(custom_test_frameworks)] #![feature(lang_items)] #![feature(naked_functions)] #![no_std] #![no_main] #![tes...
//! Error related functionality of wasm3. use core::cmp; use core::fmt; use crate::utils::cstr_to_str; lazy_static::lazy_static! { /// Out of bounds memory access error static str pub static ref OUT_OF_BOUNDS_MEMORY_ACCESS_STR:&'static str= unsafe { cstr_to_str(ffi::m3Err_trapOutOfBoundsMemoryAccess) }; /// Division ...
#[derive(PartialEq, Eq, Clone, Debug)] pub enum PersonClass { Villager, Mafiosi, Medic, Necromancer, Priest, Dead, Zombie, } #[derive(PartialEq, Eq, Clone, Debug)] pub enum QuantumMafiaError { WrongLengthAction, WrongTime, BadPersonAssignments, WrongGameSize, } use QuantumM...
#![doc = include_str!("../README.md")] #![cfg_attr(not(test), no_std)] use riscv::{self, register::mcause}; #[allow(missing_docs)] #[repr(C)] #[derive(Debug)] pub struct TrapFrame { pub pc: usize, // pc, x0 is useless pub ra: usize, // x1 pub sp: usize, // x2 pub gp: usize, // x3 pub tp: usize...
use rafx::api::*; use rafx::framework::*; use rafx::api::ash; use ash::vk; use ash::version::InstanceV1_0; use rafx::api::vulkan::RafxRawImageVulkan; /// Handles setting up skia to use the same vulkan instance we initialize pub struct VkSkiaContext { pub context: skia_safe::gpu::DirectContext, } impl VkSkiaContex...
use std::fs; use imagefmt::{self, ColFmt, ColType}; use palette::{Rgb, Rgba}; use palette::blend::PreAlpha; use rand::{Rng, StdRng}; use config::Config; use Eu4TargetData; pub fn generate(config: &Config, data: &Eu4TargetData) { println!("Generating flags..."); // Set up the directory to output flags to l...
use seed::prelude::*; use serde::{Deserialize, Serialize}; use crate::{locations::*, requests}; use db_models::models::{posts, users}; #[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct Name { pub first: String, pub last: String, pub nickname: String, } impl Name { ...
use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] pub struct FillsGrp { /// Specifies the number of partial fills included in this Execution Report. #[serde(skip_serializing_if = "Option::is_none")] #[serde(rename = "1362")] pub fills: Option<fix_common::Repe...
use std::cmp::Ordering; use std::ops::{Mul, Sub, Add}; const LOW_BITS: u64 = ((1 as u64) << 32) - 1; const HIGH_BITS: u64 = LOW_BITS << 32; fn big_prod(first: u64, second: u64) -> (u64, u64) { let flow: u64 = first & LOW_BITS; let slow: u64 = second & LOW_BITS; let fhigh: u64 = (first & HIGH_BITS) >> ...
use crate::config::dfinity::{ConfigDefaults, ConfigDefaultsBootstrap}; use crate::lib::environment::Environment; use crate::lib::error::DfxResult; use crate::lib::network::network_descriptor::NetworkDescriptor; use crate::lib::provider::get_network_descriptor; use crate::lib::webserver::webserver; use crate::util::get_...
mod camera; mod import; mod interface; mod points; mod state; use camera::{Camera, CameraController}; use eyre::Result; use futures_lite::future::block_on; use interface::Interface; use std::path::PathBuf; use structopt::StructOpt; use winit::{ event::{Event, WindowEvent}, event_loop::ControlFlow, }; const IN...
/*! --- Day 2: I Was Told There Would Be No Math --- The elves are running low on wrapping paper, and so they need to submit an order for more. They have a list of the dimensions (length l, width w, and height h) of each present, and only want to order exactly as much as they need. Fortunately, every present is a box...
use std::sync::{Arc, atomic::AtomicU64}; use ton_block::{ Serializable, Deserializable, ShardAccount, ShardAccounts, AccountBlock, Transaction, Transactions, HashUpdate, LibDescr, Augmentation, HashmapAugType, Libraries, StateInitLib, Account, }; use ton_types::{Result, AccountId, Cell, HashmapRemover, fail...
// This file is licensed under the terms of Apache-2.0 License. #[cfg(test)] mod tests; use std::{ fmt, mem, }; use regex::RegexSet; use crate::{ ast::{ Capture, Pattern, Segment, }, parser::{ self, Quantifier, }, Error, }; /// A compiled command that can be used to match text. #[derive(Clone, Deb...
use crate::Solution; /// Skyline object for implementing solution to LC problem: /// https://leetcode.com/problems/the-skyline-problem/ /// /// Wrapper struct with a generic function pointer object /// to pass as ProblemFunc type to the Solution trait pub struct Skyline<T: Fn(Vec<Vec<i32>>) -> Vec<Vec<i32>>> { _fn...
mod args; mod data; mod util; mod itemset; use std::{ cmp, collections::HashMap, io::{self, Write}, time }; use dci::DataSet; use onehot::OneHot; use crate::{ args::Command, data::{ Record, distribution::Distribution as DataDistribution }, itemset::ItemSet, }; fn read_records<R: io::BufRead>( reader:...
use super::document::Document; use super::term::{Term, TermMetaData}; use super::utils::{inverse_document_frequency, tf_idf_score}; use std::borrow::{Borrow, BorrowMut}; use std::collections::HashMap; /// data container for the TF-IDF model #[derive(Debug, Default)] pub(crate) struct TfIdf { /// collection of `Ter...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2 use anyhow::{anyhow, ensure, format_err, Result}; use async_std::{io::BufReader, net::TcpStream, prelude::*, task}; use config::MinerConfig; use futures::channel::mpsc; use futures::{SinkExt, StreamExt}; pub use jsonrpc_core::types::{...
use crate::com::api::{FetchError, MiningInfoResponse}; use crate::com::client::{Client, ProxyDetails, SubmissionParameters}; use crate::future::prio_retry::PrioRetry; use futures::future::Future; use futures::stream::Stream; use futures::sync::mpsc; use std::collections::HashMap; use std::error::Error; use std::sync::A...
// Animation System // [ ] make a module (animations/{animator, animation_container}) // [ ] rename to animation_container.rs // [ ] rename to AnimationContainer /* Usage let texture = app.get_texture("assets/gfx/template-anim-128x32-4frames.png"); let mut build_frame = |x, y| { app.build_frame( ...
// TODO: get num cols of terminal dynamically // TODO: care about the given print options use super::{Report, ReportKind, RemarkKind, Snippet}; use code::{FileMap, LineIdx, Span}; use term_painter::ToStyle; use term_painter::Color::*; use std::default::Default; /// Options for printing on the terminal. By `default()`...
mod error; pub use self::error::UpdateConnectionsError; pub use self::error::UpdateConnectionsResult; use crate::config; use crate::config::ConnectionSettings; use crate::config::DynamicConnectionsSettings; use crate::manager::DynamicConnectionsRef; use std::collections::HashMap; use std::io::BufRead; use std::io::Bu...
use std::{convert::TryFrom, fmt}; use thiserror::Error; use num_enum::{TryFromPrimitive, TryFromPrimitiveError}; use crate::raw; use crate::typed::types::{BlockId, FormId, Point2D}; use crate::typed::record::{RecordType, RecordTypeError}; #[repr(u32)] #[derive( Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Or...
use crate::renderer::{Vertex, OrtographicCamera}; use crate::Color; use glam::{Mat4, Quat, Vec3}; use glium::backend::Facade; use glium::index::PrimitiveType; use glium::texture::RawImage2d; use glium::uniforms::{MagnifySamplerFilter, MinifySamplerFilter}; use glium::{Display, Frame, IndexBuffer, Program, Surface, Text...
use graph::{GraphDef, Result, Dependencies}; use id::{NodeID, DataID, NodeTag}; use ndarray::ArrayD; use rand::thread_rng; use rand::distributions::{Normal, Distribution}; use indexmap::IndexMap; pub fn normal_fill(v: &mut [f32], mean: f32, std_dev: f32){ let rng = &mut thread_rng(); let norm = Normal::new(mean as f...
//! API for the integrated timers //! //! This only implements basic functions, a lot of things are missing use cortex_m::peripheral::syst::SystClkSource; use cortex_m::peripheral::SYST; use crate::scu::{Clocks, Scu}; use crate::time::Hertz; use core::ops::Deref; use embedded_hal::timer::{CountDown, Periodic}; use nb...
use super::traits::KV; use crate::{kv::CustomTable, Cursor, CursorDupSort, Transaction}; use async_trait::async_trait; use bytes::Bytes; use ethereum_interfaces::{ remotekv::{Op, Pair, StateChange}, types::VersionReply, }; use futures_core::Stream; use std::{convert::TryFrom, pin::Pin, sync::Arc}; use tokio::sy...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 #![forbid(unsafe_code)] use crate::Executor; use anyhow::{ensure, format_err, Result}; use executor_types::BlockExecutor; use libra_crypto::{hash::PRE_GENESIS_BLOCK_ID, HashValue}; use libra_logger::prelude::*; use libra_state_view::{...
use crate::fdentry::FdEntry; use crate::sys::{dev_null, errno_from_ioerror}; use crate::{host, Result}; use std::borrow::Borrow; use std::collections::HashMap; use std::ffi::CString; use std::fs::File; use std::path::{Path, PathBuf}; pub struct WasiCtxBuilder { fds: HashMap<host::__wasi_fd_t, FdEntry>, preopen...
//! Drop-down list. This is control which shows currently selected item and provides drop-down //! list to select its current item. It is build using composition with standard list view. use crate::core::algebra::Vector2; use crate::message::{MessageData, MessageDirection}; use crate::{ border::BorderBuilder, ...
mod event; mod input; use std::cell::Cell; use crate::{ lexer::Token, parser_api::Parser, parser_impl::{ event::{Event, EventProcessor}, input::{InputPosition, ParserInput}, }, SmolStr, syntax_node::syntax_error::{ ParseError, SyntaxError, }, }; use crate::...
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] #![cfg_attr(debug_assertions, windows_subsystem = "console")] use std::env; use std::path::PathBuf; use regex::Regex; #[macro_use] extern crate log; use crossbeam::channel::unbounded as channel; mod sound; mod ui; mod message; /// How SoundSense-RS w...
//! HTTP REST API Server //! //! Launch the server daemon using either the `--daemon={listen_addr}` command line argument or the //! `LS_DAEMON={listen_addr}` environment variable. use error::*; use iron::prelude::*; use iron::Handler; use iron::Listening; use persistence::prelude::*; use api::middleware...
use chrono::Duration; use clap::{ crate_authors, crate_description, crate_version, App, Arg, ArgMatches, }; use colored::*; use budget::*; fn main() { let matches = get_cli_matches(); let no_color = matches.occurrences_of("plain") > 0; let force_color = matches.occurrences_of("force-color") > 0; let consider_ow...
// s-DPF (i.e. keys = s > 2) based on any seed-homomorphic PRG G(.). use std::fmt::Debug; use std::iter::repeat_with; use serde::{Deserialize, Serialize}; use super::Dpf; use crate::algebra::{Field, SpecialExponentMonoid}; use crate::prg::{Prg, SeedHomomorphicPrg}; use crate::sharing::Shareable; #[cfg(any(test, feat...
// Copyright (c) 2019 E.S.R.Labs. All rights reserved. // // NOTICE: All information contained herein is, and remains // the property of E.S.R.Labs and its suppliers, if any. // The intellectual and technical concepts contained herein are // proprietary to E.S.R.Labs and its suppliers and may be covered // by German a...
#![allow(dead_code)] extern crate chain_addr; extern crate chain_crypto; extern crate rand; extern crate rand_chacha; extern crate serde_derive; use self::serde_derive::{Deserialize, Serialize}; use jormungandr_lib::interfaces::Value; use std::path::PathBuf; use std::vec::Vec; use self::chain_addr::{Address, Discrimi...
//! libfuse3 bindings. #![allow(nonstandard_style)] pub mod helpers; use libc::{c_char, c_double, c_int, c_void, off_t, size_t, stat, statvfs}; #[repr(C)] pub struct fuse_conn_info { _unused: [u8; 0], } #[repr(C)] pub struct fuse_ctx { _unused: [u8; 0], } #[repr(C)] pub struct fuse_entry_param { _unus...
// Copyright (c) Facebook, Inc. and its affiliates. // // 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 applicabl...
// 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. //! The special-purpose event loop used by the reachability monitor. //! //! This event loop receives events from netstack. Thsose events are used by the r...
use crate::*; use super::*; macro_rules! def_op { ($x:ident, $o:tt, $e:expr, $t: expr) => { pub static $x: &Operation = &Operation{ name: stringify!($o), execute: $e, typ: $t }; }; } macro_rules! def_bin_op { ($x:ident, $o:tt, $t:ty, $r:ty) => { def_op!($x, $o, |_, args| bin_op...
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. //! A simple task queue. //! //! The instant when the task cell is pushed into the queue is recorded //! in the extras. use super::{Pop, TaskCell}; use crossbeam_deque::{Injector, Steal, Stealer, Worker}; use rand::prelude::*; use std::iter; use std:...
#![warn(rust_2018_idioms)] use linkerd_channel::{channel, error::TrySendError, Receiver, Sender}; use std::sync::Arc; use tokio_test::task; use tokio_test::{assert_err, assert_ok, assert_pending, assert_ready, assert_ready_ok}; trait AssertSend: Send {} impl AssertSend for Sender<i32> {} impl AssertSend for Receiver<...
#![feature(fs_walk)] #![feature(slice_patterns)] extern crate rustc_serialize; extern crate time; extern crate eve; use std::env; use std::fs::{OpenOptions, walk_dir}; use std::io::prelude::*; use rustc_serialize::json::{ToJson, Json}; use eve::server::*; use eve::flow::*; use eve::compiler::*; use eve::value::*; f...
pub use secp256kfun_parity_backend::scalar::Scalar; use secp256kfun_parity_backend::{ ecmult::{ECMultContext, ECMultGenContext}, field::Field, group::{Affine, Jacobian, JACOBIAN_INFINITY}, }; mod constant_time; mod variable_time; pub use constant_time::ConstantTime; pub use variable_time::VariableTime; pub...
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. //! This module is the low-level mechanisms for getting timestamps from a PD //! cluster. It should be used via the `get_timestamp` API in `PdClient`. //! //! Once a `TimestampOracle` is created, there will be two futures running in a background workin...
use std::collections::HashMap; use serde::{Serialize, Deserialize}; use super::{Map, TileType}; use crate::components::{Position, Viewshed, OtherLevelPosition}; use crate::map_builders::level_builder; use specs::prelude::*; use rltk::Point; #[derive(Default, Serialize, Deserialize, Clone)] pub struct MasterDungeonMap ...