text
stringlengths
7.05k
33.9k
/* lib.rs contains all the logic of the program */ use rand::{Rng, prelude::thread_rng}; //rng use std::error::Error; //better errors use std::io::{self, Write}; //io interactions use std::{str::FromStr, fmt::Display}; //traits //DATA const COLORS: [&str;8] = ["Black ", "White ","Red ","Green ","Orange ","Yellow ", "...
use bindings::{ data_set_t, hostname_g, plugin_dispatch_values, plugin_log, value_list_t, value_t, ARR_LENGTH, DS_TYPE_ABSOLUTE, DS_TYPE_COUNTER, DS_TYPE_DERIVE, DS_TYPE_GAUGE, LOG_DEBUG, LOG_ERR, LOG_INFO, LOG_NOTICE, LOG_WARNING, }; use chrono::prelude::*; use chrono::Duration; use errors::{ArrayError, Su...
// translation of Lua 5.2 string pattern code use errors::*; use std::ptr::null; pub const LUA_MAXCAPTURES: usize = 32; /* maximum recursion depth for 'match' */ const MAXCCALLS: usize = 200; const L_ESC: u8 = b'%'; fn add(p: CPtr, count: usize) -> CPtr { unsafe {p.offset(count as isize)} } fn sub(p: CPtr, cou...
//! Functions for generating Java glue code. mod jni; mod types; use common::{ self, append_output, check_no_mangle, is_array_arg, is_user_data_arg, parse_attr, retrieve_docstring, Outputs, }; use inflector::Inflector; use java::types::{callback_name, java_type_to_str, rust_to_java, struct_to_java_classname};...
use std::ops::Index; use std::ops::IndexMut; use std::ops::{ Mul, MulAssign, }; use crate::Quat; use crate::Vec3; use crate::Vec4; use crate::PI; use serde::{ Deserialize, Serialize, }; #[derive(Copy, Clone, PartialEq, PartialOrd, Debug, Serialize, Deserialize)] pub struct Mat4 { pub x_column: Vec4, pub y_colu...
use crate::configuration::delta::{DeltaStoreConfig, FlushMode}; use crate::configuration::service::ServiceConfig; use crate::service::{ auth::*, deltas::{DeltaStore, DeltaStoreState}, report::*, }; use anyhow::*; use log::{debug, info}; use proxy_wasm::{ hostcalls::{dequeue_shared_queue, register_shared...
use crate::input::Input; use std::collections::HashMap; use std::ops::{Add, Mul, Sub}; // Based on the following nice solution: // - https://github.com/Mesoptier/advent-of-code-2021/blob/master/src/days/day19.rs // - https://www.reddit.com/r/adventofcode/comments/rjpf7f/comment/hp8btm1/?utm_source=share&utm_medium=web...
/* This tool is part of the WhiteboxTools geospatial analysis library. Authors: Dr. <NAME> Created: March 1, 2018 Last Modified: 12/10/2018 License: MIT */ use crate::raster::*; use crate::rendering::html::*; use crate::rendering::LineGraph; use crate::structures::Array2D; use crate::tools::*; use crate::vector::{Shap...
use crate::config::Config; use crate::lang::Translations; use crate::screens::get_dots_icons; use crate::screens::{Community, Home, Info, Partners, RoadMap, UseCases}; use crate::store::{RequestCoingecko, TokenInfo, TokenInfoStore}; use crate::utils::{set_scroll_style, ScrollStyle}; use gloo::timers::callback::{Interva...
use crate::common::{Color, VERSION_BANNER}; use crate::components::background::Background; use crate::components::nikumaru::NikumaruCounter; use crate::entity::GameEntity; use crate::frame::Frame; use crate::framework::context::Context; use crate::framework::error::GameResult; use crate::input::combined_menu_controller...
use advancer::Advancer; #[derive(Debug, Clone, PartialEq)] pub enum Tok { Indent, Space, LineEnd, DoubleAsterisk, DoubleEquals, ExclamationEquals, LessThanEquals, GreaterThanEquals, PlusEquals, MinusEquals, AsteriskEquals, SlashEquals, DoubleFullStop, FullStop, Equals, P...
use aoc_common::*; use nalgebra::{vector, Matrix3, Vector3}; use std::fmt; use std::str::FromStr; fn main() { run_progressive_vec(parse, part1, part2); } static ROTATION_MATRICES: [Matrix3<i32>; 24] = [ Matrix3::new(1, 0, 0, 0, 1, 0, 0, 0, 1), Matrix3::new(1, 0, 0, 0, 0, 1, 0, -1, 0), Matrix3::new(1, ...
use super::{exec::BuildResultChannel, model::*, utils::convert_code, JobFailure, ProcessInfo}; use crate::{client::config::DockerConfig, prelude::*, sh}; use anyhow::Result; use async_trait::async_trait; use bollard::{ container::UploadToContainerOptions, exec::StartExecResults, models::Mount, network::ConnectN...
use crate::*; use alloc::borrow::Cow; #[cfg(not(feature = "std"))] use alloc::format; use alloc::string::{String, ToString}; use alloc::vec::Vec; use core::{ convert::TryFrom, fmt, iter::FusedIterator, marker::PhantomData, ops::Shl, str::FromStr, }; #[cfg(feature = "bigint")] use num_bigint::BigUint; use num_trait...
use anyhow::{Error, Result}; use git::Config; use super::utils::get_input; use crate::utils::map_single_ascii_to_lower; /// Represents the key binding configuration options. #[derive(Clone, Debug)] pub struct KeyBindings { /// Key bindings for aborting. pub abort: Vec<String>, /// Key bindings for the break action...
use aoc::solver::Solver; use std::collections::{HashMap, HashSet, VecDeque}; pub struct Day19; enum Axis { X, Y, Z, } type TriangleHash = (i64, i64, i64); type Rotation = (u8, u8, u8); type Transform = (Point, Rotation); #[derive(Debug)] struct Scanner { points: HashSet<Point>, hashes: HashMap<Tr...
#![allow(dead_code)] use glium::Surface; use glium_text_rusttype::{self, TextSystem, FontTexture, TextDisplay}; use glium::glutin::{Event, ElementState, MouseButton, VirtualKeyCode}; use ui::{Vertex, Shape2d, HandlerOption, UiRequest, KeyboardState, MouseEventHandler, KeyboardEventHandler, EventRemainder}; use uti...
//! This is a very simple compositor, like //! <https://github.com/sardemff7/not-a-wm/blob/master/main.c> //! but in Rust and with a little bit more stuff (e.g. window movement) #![feature(nll)] extern crate libc; extern crate loginw; #[macro_use] extern crate weston_rs; #[macro_use] extern crate lazy_static; extern ...
use crate::annotations::{Association, FieldAnnotation, IndexMethod}; use crate::association::FakeEntity; use crate::definitions::{ AssociationDefinition, ColumnDefinition, ColumnType, FieldDefinition, ForeignKeyDefinition, IndexDefinition, }; use crate::query::ast::error::{SyntaxError, SyntaxErrorWithPos}; use ...
use crate::{ aggregator::BlockSignatureAggregator, data_io::{refresh_best_chain, AlephData, AlephDataFor, DataIO, DataStore}, default_aleph_config, finalization::chain_extension_step, justification::{ AlephJustification, ChainCadence, JustificationHandler, JustificationNotification, }, ...
// SPDX-License-Identifier: Apache-2.0 // Some flags are unused, but may be at some point. Silence warnings of unused // flags. #![allow(dead_code)] pub mod build; pub mod show; pub mod update; use super::*; use std::collections::HashMap; use std::convert::TryInto; use std::fmt; use std::fmt::Write; use std::fs; us...
//! Dynamically typed property maps (for all IO primitive types). Mainly used //! for [`AnyMesh`][super::AnyMesh]. use cgmath::{Point3, Vector3}; use crate::{ prelude::*, cast, handle::hsize, map::DenseMap, io::{ColorType, Primitive, PrimitiveType, PrimitiveColorChannelType}, util::downcast_as...
use crate::types::InputCellInfo; use crate::{ rpc_client::{CollectedCustodianCells, RPCClient, WithdrawalsAmount}, types::CellInfo, }; use anyhow::{anyhow, Result}; use gw_common::{CKB_SUDT_SCRIPT_ARGS, H256}; use gw_config::BlockProducerConfig; use gw_generator::RollupContext; use gw_types::{ bytes::Bytes...
//! Personal System/2 (PS/2) is a connector designed for keyboards and mouses. //! It has now been deprecated in favor of USB keyboards/mouses. // TODO Externalize this into a kernel module when the interface for loading them will be ready use crate::device::DeviceManager; use crate::device::keyboard::Keyboard; use c...
mod common; use cryptopals::gauss::*; fn print_matrix(matrix: &[u8]) { println!("["); for (i, row) in matrix[..8].iter().enumerate() { print!( "{} {} {} {} {} {} {} {}", (row & (1 << 7)) >> 7, (row & (1 << 6)) >> 6, (row & (1 << 5)) >> 5, (ro...
// surfman/surfman/src/platform/generic/egl/context.rs // //! Functionality common to backends using EGL contexts. use super::device::EGL_FUNCTIONS; use super::error::ToWindowingApiError; use super::ffi::EGL_CONTEXT_OPENGL_PROFILE_MASK; use super::ffi::{EGL_CONTEXT_MINOR_VERSION_KHR, EGL_CONTEXT_OPENGL_COMPATIBILITY_P...
// Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0. use std::sync::atomic::*; use std::sync::{mpsc, Arc, Mutex}; use std::time::Duration; use std::{mem, thread}; use kvproto::metapb::{Peer, Region}; use raft::eraftpb::MessageType; use pd_client::PdClient; use raftstore::store::Callback; use test_rafts...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 mod contract_call; mod node_api_types; pub mod pubsub; pub use contract_call::*; use jsonrpc_core_client::RpcChannel; pub use node_api_types::*; use scs::SCSCodec; use serde::Deserialize; use serde::Serialize; use serde_helpers::{de...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 #![forbid(unsafe_code)] use crate::{ boogie_wrapper::BoogieWrapper, bytecode_translator::BoogieTranslator, cli::{Options, INLINE_PRELUDE}, prelude_template_helpers::StratificationHelper, }; use abigen::Abigen; use anyh...
use crate::prelude::*; use arrayvec::ArrayVec; use bitvec::prelude::*; use std::{cell::Cell, collections::hash_map::Entry, num::NonZeroUsize}; day!(20, parse => pt1, pt2); type Image = u128; // 10x10 image with 100 bits set to 0 or 1 #[derive(Clone, PartialEq, Eq)] pub struct Tile { id: u32, image: Image, } ...
use std::io::{Cursor, Read}; use std::iter::Iterator; use anyhow::Result; use blstrs::Scalar as Fr; use filecoin_proofs::{ add_piece, commitment_from_fr, pieces::{ compute_comm_d, get_piece_alignment, get_piece_start_byte, piece_hash, verify_pieces, zero_padding, EmptySource, PieceAlignment, ...
use std::{ convert::TryFrom, ffi::CString, io::{self, Write}, mem, }; use byteorder::{LittleEndian, WriteBytesExt}; use noodles_sam::{ self as sam, header::ReferenceSequences, record::{Cigar, Data, QualityScores, Sequence}, }; use crate::record::sequence::Base; // § 4.2 The BAM format (20...
// Copyright 2020 GFX developers // // 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 to tho...
#![allow(clippy::cognitive_complexity, clippy::unreadable_literal)] use crate::avm1::opcode::OpCode; use crate::avm1::types::*; use crate::string::SwfStr; use crate::write::SwfWriteExt; use byteorder::{LittleEndian, WriteBytesExt}; use std::io::{self, Result, Write}; #[allow(dead_code)] pub struct Writer<W: Write> { ...
/* * Licensed to <NAME> 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 not use this file except in co...
//! Transaction types use super::{extract_chain_id, rlp_opt, NUM_TX_FIELDS}; use crate::{ types::{Address, Bytes, NameOrAddress, Signature, H256, U256, U64}, utils::keccak256, }; use rlp::{Decodable, RlpStream}; use serde::{Deserialize, Serialize}; /// Parameters for sending a transaction #[derive(Clone, Defa...
/* This tool is part of the WhiteboxTools geospatial analysis library. Authors: Dr. <NAME> Created: 21/10/2019 Last Modified: 24/10/2019 License: MIT */ use crate::raster::*; use crate::rendering::html::*; use crate::rendering::LineGraph; use crate::tools::*; use rand::prelude::*; use std::cmp::Ordering::Equal; use st...
use log::{debug, error}; use sc_client_api::backend::Backend; use sp_consensus::SelectChain; use sp_runtime::{ generic::BlockId, traits::{Block, Header}, }; use std::{marker::PhantomData, sync::Arc}; use crate::{ config::Config, hash::Hash, messages::{sign_unit, ConsensusMessage, FullUnit, NetworkM...
use std::cmp::max; use std::collections::BTreeMap; use either::Either; use super::decl::check_declaration; use super::read_back::generate_value; use super::subtype::check_subtype; use super::tcm::{update_gamma, TCE, TCM, TCS}; use crate::ast::{Branch, Closure, Expression, GenericCase, Level, Typed, Value}; /// $$ //...
use std::{borrow::Cow, mem}; use proc_macro2::TokenStream; use quote::{quote, ToTokens}; use syn::{ parse_quote, punctuated::Punctuated, token, Block, FnArg, GenericArgument, GenericParam, Generics, Ident, ImplItem, ImplItemMethod, ItemImpl, ItemTrait, Path, PathArguments, Signature, Stmt, Token, TraitItem...
// Copyright 2017 click2stream, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
#![cfg(not(feature = "bert"))] use tokenizers::models::bpe::{BpeTrainerBuilder, BPE}; use tokenizers::normalizers::{Sequence, Strip, NFC}; use tokenizers::pre_tokenizers::byte_level::ByteLevel; use tokenizers::{AddedToken, TokenizerBuilder}; use tokenizers::{DecoderWrapper, NormalizerWrapper, PostProcessorWrapper, Pre...
use ansible_task::AnsibleTask; use message::RefType; use make_task::MakeTask; use std::collections::BTreeMap; use std::error::Error as StdError; use std::fmt; use std::cmp::{Ordering, Ord, PartialOrd}; use std::fs::File; use std::io::Read; use std::path::Path; use std::string::ToString; use regex::Regex; use toml::{sel...
// TODO: remove this #![allow(clippy::unwrap_used)] #![allow(clippy::todo)] #![allow(dead_code)] use std::{ collections::{HashMap, HashSet}, path::{Path, PathBuf}, }; use gleam_core::{ ast::SrcSpan, build::{self, Package, ProjectCompiler}, diagnostic::{self, Level}, io::{CommandExecutor, FileS...
//! Abstracts kernels so we can build generic methods to test them. //! Kernel also defines a function generate_dump that is used to dump the list of actions taken for //! a specific implementation of a kernel, which in turn allows to run tests on this specific //! implementation. generate_dump is only used in binary s...
// Copyright 2019 The Chromium OS 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 std::cmp::min; use std::convert::TryFrom; use std::fmt::{self, Debug, Display}; use std::fs::File; use std::io::{self, Read, Seek, SeekFrom, Write}...
//! Implementations of the MessageEventContent and StateEventContent derive macro. use std::borrow::Cow; use proc_macro2::{Span, TokenStream}; use quote::{format_ident, quote}; use syn::{ parse::{Parse, ParseStream}, DeriveInput, Ident, LitStr, Token, }; use crate::event_parse::{EventKind, EventKindVariation...
//! Manager that is called when a seat is created or destroyed. //! Pass a struct that implements this trait to the `Compositor` during //! initialization. use libc; use std::{env, panic}; use std::process::abort; use super::{KeyboardHandler, KeyboardWrapper, PointerHandler, PointerWrapper, TabletPadHandler, ...
//! # inline-spirv //! //! //! The first string is always your shader path or the source code, depending on //! the macro you use. Other following parameters give you finer control over //! the compilation process: //! //! `inline-spirv` currently support two source languages: //! //! - `glsl`: The shader source is in ...
use parser::{AST, Expr, Operation}; use std::{ cell::RefCell, collections::HashMap, io, result::Result as StdResult }; use types::Value; #[derive(Debug, Fail)] pub enum Error { #[fail(display = "attempt to divide by zero")] DivideByZero, #[fail(display = "cannot cast value to that type")] ...
use std::collections::HashMap; use chrono::serde as chrono_serde; use rust_decimal::Decimal; use serde::{Deserialize, Serialize}; use crate::common::*; use crate::v2::rest::api_impl::*; // ======== // Requests // ======== /// GET /api/v2/k /// /// Get OHLC(k line) of a specific market #[derive(Serialize, Debug)] pu...
use std::cmp::max; use std::cmp::min; use std::collections::HashMap; use std::env::var; use std::io::{self, Write}; use std::str; use ordered_float::OrderedFloat; use palette; use read_color; use termcolor::{self, WriteColor}; use vec_map::VecMap; #[cfg(target_family = "unix")] use pager::Pager; use cfg; use error::...
use prelude::*; #[derive(Debug)] pub struct MerkleTreeSimple<D, A> where A: MTAlgorithm, D: MTHash { data: Vec<D>, tree: Vec<Vec<A::Value>>, } impl <A, D> Default for MerkleTreeSimple<D, A> where A: MTAlgorithm, D: MTHash { fn default() -> Self { MerkleTreeSimple::new() } } impl <A, D> Merkl...
#![no_main] #![no_std] use defmt_rtt as _; // global logger use panic_probe as _; use rtic::app; use stm32f4xx_hal as hal; pub mod custom_action; pub mod dispatcher; pub mod keyboard; pub mod keymap; pub(crate) mod multi; pub mod rotary; pub mod serial; #[app(device = crate::hal::stm32, peripherals = true, dispatc...
#![allow(non_upper_case_globals)] use crate::{ commands::checks::*, database::MapsetTagWrapper, util::{globals::HOMEPAGE, MessageExt}, BgVerified, MySQL, }; use rand::RngCore; use rosu::models::GameMode; use serenity::{ framework::standard::{macros::command, Args, CommandResult}, model::{ ...
#![allow(clippy::len_without_is_empty)] use std::marker::PhantomData; use std::path::PathBuf; use anyhow::ensure; use generic_array::typenum; use log::trace; use merkletree::hash::Algorithm; use merkletree::merkle; use merkletree::merkle::{ get_merkle_tree_leafs, get_merkle_tree_len, is_merkle_tree_size_valid, ...
use std::default::Default; use std::fmt; use std::ops::{Mul, Div}; use std::sync::Arc; use crate::typesetting::math_box::Vector; use crate::typesetting::MathLayout; /// An identifier of a glyph inside a font. pub type GlyphCode = u32; #[derive(Debug, Default, Clone)] pub struct MathExpression { pub(crate) item: ...
//! API to retrieve some semantic information about standard elements and their //! properties from a PLY file. //! //! Just like the `raw` module, you probably don't need to use any of this. The //! "entry point" is [`ElementInfo`]. use std::convert::TryInto; use crate::{ handle::hsize, io::{Error, ErrorKind...
#![allow(unused_variables)] #![allow(unused)] use crate::imgui_wgpu::Renderer; use crate::nes; use futures::executor::block_on; use glob::glob; use imgui::*; use imgui_winit_support; use std::path::PathBuf; use std::rc::Rc; use std::time::Instant; use wgpu::{Device, Queue}; use winit::{ dpi::LogicalSize, event...
// Copyright 2020 the Deno authors. All rights reserved. MIT license. use crate::diagnostic::{LintDiagnostic, Position, Range}; use crate::rules::LintRule; use crate::scopes::{analyze, Scope}; use crate::swc_util::get_default_ts_config; use crate::swc_util::AstParser; use crate::{control_flow::ControlFlow, swc_util::Sw...
extern crate argparse; extern crate env_logger; extern crate humantime; extern crate lithos; extern crate quire; extern crate scan_dir; extern crate serde_json; #[macro_use] extern crate log; #[macro_use] extern crate matches; use std::collections::BTreeMap; use std::collections::{HashSet, HashMap}; use std::collectio...
#![allow(non_snake_case)] use std::collections::HashMap as Map; use std::collections::HashSet as Set; use std::f64::consts::PI; use cpython::{PyDict, Python}; use ndarray::{Array, Axis, Ix2, Ix4}; use serde::{Deserialize, Deserializer}; use crate::integrals; use crate::shell; #[derive(Debug, Deserialize)] struct BS...
use std::error::Error; use crate::datastore::history::{History, HistoryEntry, Price}; use crate::util::datetime::LocalDate; use crate::util::price_type::price_zero; // Volume Weighted Average Price pub fn entries_vwap(entries: &[HistoryEntry]) -> Result<Price, Box<dyn Error>> { let mut notional: Price = 0.0; l...
//! Handles ELF files. use alloc::boxed::Box; use core::fmt; use core::mem; use core::mem::size_of; use crate::file_handle::FileHandle; use crate::initramfs; use crate::memory::address_space; use crate::memory::address_space::{AddressSpace, Segment}; use crate::memory::{Address, MemoryArea, PageFlags, PhysicalAddress,...
//! Functions and structures for defining and activating function hooks use crate::backend::Backend; use crate::demangling; use crate::error::*; use crate::hooks; use crate::layout; use crate::project::Project; use crate::return_value::*; use crate::state::State; use either::Either; use llvm_ir::{Name, Operand, Type, ...
#[cfg(test)] mod tests; use crate::{ kindchecker::{ self, merge_references, Env, EnvType, EnvTypeVariable, EnvTypes, State, TypeReferences, }, module::common::extract_doc_comments, result::{Result, TypeError, Warnings}, supply::Supply, }; use ditto_ast::{ graph::{toposort, toposort_dete...
use std::sync::{Arc, RwLock}; use std::task::{Context, Poll}; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use web_sys; use std::cmp; use std::collections::HashMap; use std::io::{self, Read, Seek, SeekFrom, Write}; use std::path::Path; use std::pin::Pin; #[derive(Default, Debug, Serialize, Deserialize)] ...
use std::{collections::HashMap, str::FromStr}; pub mod aws; pub trait DescribeInstances { fn describe_instances(&self) -> Result<Vec<InstanceDescriptor>>; } pub trait DescribeInstance { fn describe_instance(&self, instance_id: &str) -> Result<InstanceDescriptor>; } pub enum InstanceDescriptorFields { Bl...
use cgmath::prelude::*; use cgmath::{Point3, Vector3}; use crate::camera::PTCamera; use crate::color::Color; use crate::config::*; use crate::consts; use crate::float::*; use crate::intersect::{Interaction, Ray}; use crate::light::Light; use crate::pt_renderer::PathType; use crate::sample; use crate::scene::Scene; fn...
use std::fs; use std::io::{BufRead, BufReader, Read, Write}; use std::process::{Child, ChildStdin, ChildStdout, Command}; use std::thread::sleep; use std::time::Duration; const XSM_PAGE_LEN: usize = 512; pub struct XSM { xsm: Child, stdin: ChildStdin, stdout: crossbeam_channel::Receiver<String>, mode:...
extern crate clap; use clap::{App, Arg}; use dioslib::*; fn main() { let matches = App::new("Diospyros Rewriter") .arg( Arg::with_name("INPUT") .help("Sets the input file") .required(true) .index(1), ) .arg( Arg::with_n...
// Copyright 2021 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 crate::config as image_assembly_config; use crate::{ config::{product_config::AssemblyInputBundle, FileEntry}, util, }; use anyhow::{anyhow, Co...
//! Implements the range encoder. use crate::math::ilog; use crate::range_coder::{ get_lapace_freq, Tell, CODE_BITS, CODE_BOT, CODE_SHIFT, CODE_TOP, SYM_BITS, SYM_MAX, UINT_BITS, WINDOW_SIZE, }; use crate::OpusError; /// The range encoder. pub(crate) struct RangeEncoder<'e> { /// Buffered output. buffe...
#![no_std] #![no_main] #![feature(alloc_error_handler)] #[macro_use] extern crate keypad; extern crate alloc; extern crate arrayvec; extern crate chess_engine; extern crate embedded_hal; extern crate hd44780_driver; extern crate numtoa; extern crate stellaris_launchpad; extern crate tm4c123x_hal; use alloc::string::...
//! The compression algorithm. //! //! We make use of hash tables to find duplicates. This gives a reasonable compression ratio with a //! high performance. It has fixed memory usage, which contrary to other approachs, makes it less //! memory hungry. use byteorder::{NativeEndian, ByteOrder}; /// Duplication dictiona...
//! Configurator for the platform. Initializes config files for the modules and sets up //! the initial environment for platform runtime. #![feature(plugin)] #![plugin(indoc)] extern crate cursive; extern crate serde_json; extern crate termion; use std::process::{Command, Stdio}; use std::path::Path; use std::rc::R...
// Copyright 2021 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 ...
use rand::{seq::SliceRandom, thread_rng}; use serde::Deserialize; use std::{convert::TryInto, fs::File, path::Path}; use tensorflow::{ ops, train, train::Optimizer, DataType, Scope, Session, SessionOptions, SessionRunArgs, Shape, Tensor, Variable, }; type BoxedError = Box<dyn std::error::Error>; /// A struct ...
//! Simple resampling library in pure Rust. //! //! # Examples //! //! ``` //! use resize::Pixel::RGB24; //! use resize::Type::Lanczos3; //! //! // Downscale by 2x. //! let (w1, h1) = (640, 480); //! let (w2, h2) = (320, 240); //! // Don't forget to fill `src` with image data (RGB24). //! let src = vec![0;w1*h1*3]; //!...
// Copyright 2012-2014 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-MI...
//! GPIO and GPIOTE (task and events), nRF5x-family //! //! ### Author //! * <NAME> <<EMAIL>> //! * Date: August 18, 2016 use core::{cell::Cell, ops::{Index, IndexMut}}; use kernel::{common::regs::{FieldValue, ReadWrite}, hil}; #[cfg(feature = "nrf51")] const NUM_GPIOTE: usize = 4; #[cfg(featu...
//! This module contains logic for generating random Sudoku. //! //! Generation of Sudoku puzzles is done by first generating a full grid with a //! [Generator] and then removing some clues using a [Reducer]. use crate::{Sudoku, SudokuGrid}; use crate::constraint::Constraint; use crate::error::{SudokuError, SudokuResu...
// This file is dual licensed under the terms of the Apache License, Version // 2.0, and the BSD License. See the LICENSE file in the root of this repository // for complete details. use crate::asn1::{py_oid_to_oid, py_uint_to_big_endian_bytes, PyAsn1Error}; use crate::x509; use crate::x509::{certificate, crl, oid, sc...
#![recursion_limit = "1024"] // Copyright 2019. The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of conditions...
use std::io::Write; use std::rc::Rc; use num_bigint::{BigUint, ToBigUint}; use crate::charsets::Charset; use crate::mask::{parse_mask, validate_charsets, validate_wordlists, MaskOp}; use crate::stackbuf::StackBuf; use crate::wordlists::{Wordlist, WordlistIterator}; use crate::{BoxResult, MAX_WORD_SIZE}; pub trait Wo...
// Copyright 2018, Erlang Solutions Ltd, and S2HC Sweden AB // // 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 appli...
use chrono::{Date, DateTime, Datelike, Duration, TimeZone, Utc, Weekday}; use log::{debug, info, warn}; use mongodb::bson::{doc, Bson}; use mongodb::options::{FindOneOptions, FindOptions}; use rayon::prelude::*; use rocket_okapi::JsonSchema; use serde::{Deserialize, Serialize}; use std::cmp::PartialEq; use std::sync::M...
/// src/chatlog_tools.rs /// Contains functions to manipulate Pokémon Showdown chatlogs stored in SQLite /// /// Written by Annika use std::time::{SystemTime, UNIX_EPOCH}; use std::collections::HashMap; use chrono::prelude::NaiveDateTime; use fallible_iterator::FallibleIterator; use rusqlite::{Connection, params}; p...
use crate::common::CliError; use capstone::Capstone; use num_traits::Num; use probe_rs::architecture::arm::Dump; use probe_rs::debug::{DebugInfo, Registers, VariableCache, VariableName}; use probe_rs::{Core, CoreRegisterAddress, MemoryInterface}; use std::fs::File; use std::{io::prelude::*, time::Duration}; use pars...
// 资源管理器, 管理多个资源表。有总内存上限的控制。 // 初始化时,设置的每个资源表内的LRU的max_capacity和min_capacity的差,就是每个LRU的权重。 // 如果有LRU有空闲, 则会减少其max_capacity, 按权重提高那些满的LRU的max_capacity use std::any::TypeId; use hash::XHashMap; use share::Share; use super::res_map::{Res, ResCollect, ResMap, StateInfo}; pub static CAPACITY: usize = 16 * 102...
use abstutil::prettyprint_usize; use geom::{Circle, Distance, Duration, Polygon, Pt2D, Time}; use map_gui::tools::PopupMsg; use map_gui::ID; use sim::AlertLocation; use widgetry::{ Choice, Color, ControlState, DrawWithTooltips, EdgeInsets, EventCtx, GeomBatch, GfxCtx, HorizontalAlignment, Key, Line, Outcome, Pa...
use std::collections::HashMap; use std::fs; use std::fs::{DirEntry, File}; use std::io::Read; use brawllib_rs::brawl_mod::BrawlMod as BrawllibMod; use brawllib_rs::fighter::ModType; use brawllib_rs::high_level_fighter::HighLevelFighter; use crate::cli::CLIResults; use crate::page::NavLink; pub struct BrawlMods { ...
//Copyright 2019 <NAME> <<EMAIL>> <<EMAIL>> // //Licensed under the Apache License, Version 2.0 (the "License"); //you may not use this file except in compliance with the License. //You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // //Unless required by applicable law or agre...
//! 32-bit specific definitions for linux-like values use pthread_mutex_t; pub type c_long = i32; pub type c_ulong = u32; pub type clock_t = i32; pub type time_t = i32; pub type suseconds_t = i32; pub type ino_t = u32; pub type off_t = i32; pub type blkcnt_t = i32; pub type __fsword_t = i32; pub type fsblkcnt_t = ::...
pub mod ffs; // pub mod misc; // pub mod rad; // mod rad_expv; mod rad_impv; mod rad_par; mod rad_ref; mod rad_simdeez; // mod rad_stdsimd; pub mod rads { // pub use super::rad_stdsimd::*; // pub use super::rad_impv::*; // pub use super::rad_par::*; pub use super::rad_simdeez::*; } pub mod util; use st...
use super::*; pub use runtime_gladios_node::{ constants::currency::{Balance, CENTS}, network::{ part_elections::MAX_NOMINATIONS, part_session::SessionKeys, part_staking::StakerStatus, }, Block, AccountId, AuthorityDiscoveryConfig, BabeConfig, BalancesConfig, CouncilConfig, DemocracyConfig, ...
use std::{ env, fs, path::{Path, PathBuf}, process::Command, }; fn main() { let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); let target_triple = env::var("TARGET").unwrap(); let target_os = env::var("CARGO_...
use crate::{ config::Config, network::{self, Recipient}, runway::{self, Request, Response, RunwayIO, RunwayNotificationIn, RunwayNotificationOut}, signed::Signature, units::{UncheckedSignedUnit, UnitCoord}, Data, DataProvider, FinalizationHandler, Hasher, MultiKeychain, Network, NodeCount, NodeI...
use std::cmp::{Ord, Ordering}; use std::fmt::Debug; use std::hash::BuildHasher; use std::vec::Vec; use crate::mediator::MediatorIndex; /// Wrapper around usize that can be used only as index of `BinaryHeap` /// Mostly needed to statically check that /// Heap is not indexed by any other collection index #[derive(Copy,...
use crate::{bytes, cds, error::MpcError, AdditiveShare, InMessage, OutMessage}; use algebra::{ fields::PrimeField, fixed_point::{FixedPoint, FixedPointParameters}, fp_64::{Fp64, Fp64Parameters}, BigInteger64, FpParameters, UniformRandom, }; use crypto_primitives::{ gc::{ fancy_garbling, ...