text
stringlengths
3.09k
13.9k
use std::{collections::BTreeMap, sync::Arc}; use quill_common::{ diagnostic::{Diagnostic, DiagnosticResult, ErrorMessage, Severity}, location::{Location, ModuleIdentifier, SourceFileIdentifier, SourceFileType}, name::QualifiedName, }; use quill_mir::ProjectMIR; use quill_source_file::{find_all_source_files...
// Copyright 2015-2020 Parity Technologies (UK) Ltd. // This file is part of Open Ethereum. // Open Ethereum is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your o...
// (C) Copyright 2019-2020 Hewlett Packard Enterprise Development LP use std::collections::HashSet; use std::fmt; use std::iter::FromIterator; use super::expression::Expression; use super::misc::{PromDuration, Span, Subquery}; use super::return_value::{LabelSetOp, ReturnKind, ReturnValue}; /// Label equality operato...
use std::collections::{HashMap, HashSet}; use std::fmt::{Debug, Display, Formatter}; type X = usize; type Y = usize; #[derive(PartialEq, Eq, Hash, Clone)] struct Loc { x: X, y: Y, } impl<T: AsRef<str>> From<T> for Loc { fn from(s: T) -> Self { if let Some((x, y)) = s.as_ref().split_once(", ") { ...
use crate::{ core::{errors::ButtplugError, messages::RawReading, ButtplugResultFuture}, device::{ configuration_manager::{DeviceSpecifier, ProtocolDefinition, SerialSpecifier}, BoundedDeviceEventBroadcaster, ButtplugDeviceEvent, ButtplugDeviceImplCreator, DeviceImpl, DeviceReadCmd, Devic...
use crate::co; use crate::comctl::decl::LVCOLUMN; use crate::gui::native_controls::list_view::ListView; use crate::gui::privs::multiply_dpi; use crate::kernel::decl::WString; use crate::msg::{hdm, lvm}; use crate::prelude::{GuiWindow, UserHwnd}; use crate::user::decl::SIZE; /// Exposes column methods of a [`L...
// Based on the data sourced from https://html.spec.whatwg.org/entities.json: // - Entity names can have [A-Za-z0-9] characters, and are case sensitive. // - Some character entity references do not end with a semicolon. // - All of these entities also have a corresponding entity with semicolon. // - The longest name ...
use crate::color::RGB; use std::ops::Range; use std::str::FromStr; use hashbrown::HashMap; use log::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Default, PartialEq, Clone)] pub struct Tags(HashMap<String, String>); impl Tags { pub fn new(input: &str) -> Self { if !input.starts_with('@') { ...
//! The map::select Module //! //! It provides the [Selector] type which can be used to query //! what entities match certain criteria via a powerful select system. use super::*; /// Module containing common selectors for convenience. pub mod common_selectors; /// The selector is the top level unit of a query, every...
use egui_web::fetch::Response; use std::sync::mpsc::Receiver; struct Resource { /// HTTP response response: Response, /// If set, the response was an image. image: Option<Image>, } impl Resource { fn from_response(response: Response) -> Self { let image = if response.header_content_type.s...
//! //! cargo-download //! extern crate ansi_term; #[macro_use] extern crate clap; extern crate conv; #[macro_use] extern crate derive_error; extern crate exitcode; extern crate flate2; extern crate isatty; #[macro_use] extern crate lazy_static; #[macro_...
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use comm::StreamHandler; use gdal::Dataset; use geocode::Geocode; use num_derive::FromPrimitive; use num_traits::FromPrimitive; use crate::album::AlbumManager; use std::error::Error; use std::io::{Read, Write}; use std::net::{TcpStream, SocketAddr}; use std::pa...
#[derive(Clone, Copy, Debug, Eq, PartialEq)] struct Element { value: u32, depth: u32, } fn parse_line(l: &str) -> Vec<Element> { let mut d = 0; let mut res = Vec::new(); for c in l.chars() { match c { '[' => d += 1, ']' => d -= 1, '0'..='9' => res.push(El...
use pretty_assertions::assert_eq; use std::{ fs, path::{Path, PathBuf}, }; use thiserror::Error; use uuid::Uuid; use yy_boss::{StartupError, YypBoss}; #[allow(dead_code)] const PATH_TO_TEST_PROJ: &str = "tests/examples/test_proj"; #[allow(dead_code)] const TEST_PROJECT_NAME: &str = "test_proj.yyp"; #[allow(d...
use amethyst::core::ecs::{Entity, WorldExt, World, WriteStorage}; use amethyst::{SimpleState, StateData, GameData, StateEvent, SimpleTrans, Trans}; use amethyst::ui::{UiCreator, UiFinder, UiEvent, UiEventType, UiText}; use amethyst::input::{is_close_requested, is_key_down, VirtualKeyCode}; use crate::state::main_menu::...
use std::collections::BTreeMap; use quill_common::{ location::{Range, Ranged}, name::QualifiedName, }; use quill_parser::{ definition::DefinitionBodyP, expr_pat::{ConstantValue, ExprPatP}, identifier::NameP, }; use quill_type::{PrimitiveType, Type}; use crate::type_resolve::TypeVariableId; use su...
use std::any::Any; use std::collections::HashMap; /// Packet Trait. Can be serialized and deserialized from and into TCP Packets pub trait Packet { /// Gets self as the Any type fn as_any(&self) -> &dyn Any; /// Gets the packet's name fn get_name(&self) -> &'static str; /// Gets the field names ...
use std::time::Duration; use chrono::{DateTime, Local}; use std::fs::{self, File, OpenOptions}; use std::io::{self, Error, ErrorKind, Write}; use std::path::{Path, PathBuf}; use std::thread::LocalKey; use std::time::SystemTime; /// Open log file with append mode. Creates a new log file if it doesn't exist fn open_log...
// Copyright (C) 2019, Cloudflare, Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list...
use crate::*; use std::sync::Arc; use tracing::Instrument; type InnerInvoke<T> = Box<dyn FnOnce(&mut T) + 'static + Send>; type SendInvoke<T> = futures::channel::mpsc::Sender<InnerInvoke<T>>; /// GhostActor manages task efficient sequential mutable access /// to internal state data (type T). /// GhostActors are `'sta...
use std::{ cmp::Ordering, fmt::{self, Write as _}, fs::File, io::Write, path::{Path, PathBuf}, }; use anyhow::Context as _; use indexmap::IndexMap; use serde::{Deserialize, Serialize}; use time::Date; use walkdir::WalkDir; use crate::util::toml::load; /// Collection of all contacts #[derive(Debug...
/*! A generic async HTTP request create. It is meant to be a thin wrapper around various HTTP clients and handles TLS, serialisation and parsing. The main goal is to allow binaries (that pull in some libraries that make use of a HTTP client) to specify what implementation should be used. And if there is a Proxy. If ...
// Copyright 2015 <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, ...
#![feature(lang_items)] #![no_std] use core::panic::PanicInfo; const BOTTOM: u8 = 63; const RIGHT_END: u8 = 127; const CHAR_WIDTH: u8 = 6; const CHAR_HEIGHT: u8 = 8; const MSG: *const c_char = b"Hello, Rust!\0" as *const u8 as *const c_char; struct Environment { x: u8, y: u8, msg_len: u8 } impl Enviro...
#![doc(html_root_url = "https://docs.rs/unquote/0.0.6")] #![warn(clippy::pedantic)] #[cfg(doctest)] mod readme { doc_comment::doctest!("../README.md"); } // This crate is quite obviously intended as inverse of the `quote` crate. // However, I frankly don't understand how that one works, so it's proc-macro time. use...
use std::collections::{HashMap, HashSet}; use std::error::Error; use std::fs; #[derive(Clone, Debug, Eq, PartialEq)] struct Floor { tiles: HashSet<(i64, i64)>, } impl Floor { fn new_from_flip_directions(directions: &str) -> Self { let mut tiles: HashMap<(i64, i64), bool> = HashMap::new(); for ...
use codespan_reporting::files::Files; use fnv::FnvHashMap; use std::ops::Range; use std::path::{Path, PathBuf}; pub type FileIndex = usize; pub type SpanIndex = u32; #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub struct SourceSpan { pub file: FileIndex, pub start: usize, pub end: usize, } impl So...
// Copyright (C) 2017 <NAME> <<EMAIL>> // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except acco...
use consts::JNI_NULL; use ffi::*; use types::*; /// macro to simplify exception checks and return value validation macro_rules! check_exception_and_result( ($jni:expr, $pointer:expr) => { match check_exception_and_result($jni, $pointer) { true => { println!("classpath exception: Invalid return ...
// 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 super::*; use crate::packets::VendorCommand; #[derive(Debug, PartialEq)] pub enum PeerChannel<T> { Connected(Arc<T>), Connecting, Disconne...
use std::{thread, time}; pub use spacepacket::SpacePacket; pub use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use Config; use std::net::{ UdpSocket}; use std::net::{ SocketAddr, Ipv4Addr}; pub enum PayloadCmds { ShutdownCommand, SleepCommand{interval: u16}, RawCommand{raw: Vec<u8>}, } enum Pa...
// Copyright 2017 <NAME> <<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...
//! Tests `StrishIterSourceStream` similar to how it would be used with a //! streaming source. use std::{ rc::Rc, sync::Arc, str::Split, iter::{Map, once, Once}, vec, fmt::Debug, }; use kul::{ Parser, Datum, source_stream::StrishIterSourceStream, parser::{BoxDatumAllocator, SliceDatum...
use std::{io::Write, path::PathBuf, time::Duration}; use anyhow::{bail, Context, Result}; use tokio::{ process::{Child, Command}, signal::unix::{signal, SignalKind}, }; use super::{configure::Configuration, ChildBinary}; const ALL_DAEMON_BINARIES: &[ChildBinary] = &[ ChildBinary::ManufacturingServer, ...
use ash::prelude::VkResult; use ash::version::DeviceV1_0; use ash::{vk, Device}; use std::collections::VecDeque; use std::num::Wrapping; pub type VkPoolResourceAllocatorAllocFn<T> = dyn Fn(&ash::Device) -> VkResult<T> + Send + Sync; /// Implement to customize how VkPoolAllocator resets and destroys pools pub trait Vk...
use std::ops::Range; use crate::types::*; use itertools::Itertools; use serde::{Deserialize, Serialize}; use super::engine::composition::PosMatcher; #[derive(Serialize, Deserialize, Clone, Debug)] pub struct PosFilter { pub matcher: PosMatcher, } impl PosFilter { fn is_word_data_match(&self, data: &WordData...
use std::io::{Error, ErrorKind}; #[derive(Debug, Clone, PartialEq)] pub enum RequestMethod { CONNECT, DELETE, GET, HEAD, OPTIONS, POST, PUT, PATCH, TRACE, } impl RequestMethod { pub fn parse<S>(input: S) -> Result<Self, Error> where S: std::fmt::Display, { match format!("{}", input).as...
use crate::game::*; use async_trait::async_trait; use std::sync::Arc; /// A game with its history. #[derive(Clone, Debug)] pub struct WithHistory<G: Base> { prec: Option<Arc<Self>>, /// Current game state. pub state: G, // TODO: create accessor history_len: usize, } impl<G: Base + Clone> Base for With...
use super::prelude::{ButtonMaterial, GUI_STYLE}; use super::GameState; use crate::loading::FontAssets; use bevy::prelude::*; pub struct DocumentPlugin; mod page; pub use page::{Document, Page}; impl Plugin for DocumentPlugin { fn build(&self, app: &mut AppBuilder) { info!("building document plugin"); ...
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>,...
mod commands; mod database; mod runners; use crate::commands::blackbox::BLACKBOX_GROUP; use crate::commands::help::MY_HELP; use crate::commands::protip::PROTIP_GROUP; use crate::commands::send_message; use crate::database::{Database, DatabaseConnection}; use serenity::futures::io::ErrorKind; use serenity::prelude::*; ...
use std::sync::{Mutex, MutexGuard}; use anyhow::{format_err, Result}; use hwloc::{Bitmap, ObjectType, Topology, TopologyObject, CPUBIND_THREAD}; use lazy_static::lazy_static; use log::{debug, info, warn}; use storage_proofs_core::settings::SETTINGS; type CoreGroup = Vec<CoreIndex>; lazy_static! { pub static ref T...
//! Implementation of the `#[assert_instr]` macro //! //! This macro is used when testing the `stdarch` crate and is used to generate //! test cases to assert that functions do indeed contain the instructions that //! we're expecting them to contain. //! //! The procedural macro here is relatively simple, it simply app...
// Copyright (c) 2017 Chef Software Inc. and/or applicable contributors // // 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 r...
use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] pub struct LegEvntGrp { /// NoLegEvents #[serde(skip_serializing_if = "Option::is_none")] #[serde(rename = "2059")] pub leg_events: Option<fix_common::RepeatingValues<LegEvent>>, } #[derive(Serialize, Deseria...
//! Platform Level Interrupt Control peripheral driver. use crate::interrupts; use kernel::utilities::cells::VolatileCell; use kernel::utilities::registers::interfaces::{Readable, Writeable}; use kernel::utilities::registers::{ register_bitfields, register_structs, LocalRegisterCopy, ReadWrite, }; use kernel::util...
// 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 { crate::{ errors::Errors, parse_attrs::{ Description, FieldKind, TypeAttrs, }, ...
#![allow(dead_code, unused_mut, unused_variables)] // Copyright 2020 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 // // http://www.apache.org/licenses/LICENSE-2.0 // //...
use std::{ fs::File, io::{BufWriter, Read, Write}, path::PathBuf, process::exit, }; use assembly::{irq_address, nmi_address}; use clap::StructOpt; use clap_derive::{ArgEnum, Parser, Subcommand}; use inkwell::{context::Context, passes::PassManager}; use llvm::Compiler; use mapper::{apple::Apple, mapper0...
use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sso::SsoHashSet; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_middle::mir::TerminatorKind; use rustc_middle::ty::TypeFoldable; use rustc_middle::ty::{self, subst::SubstsR...
use crate::window::WindowState; use once_cell::sync::OnceCell; use std::cell::{Cell, Ref, RefCell, RefMut}; use std::collections::HashMap; use std::rc::Rc; use tokio::sync::{mpsc, oneshot, watch, Mutex}; use windows::Win32::{ Foundation::*, System::{Com::*, Threading::*}, UI::{HiDpi::*, WindowsAndMessaging:...
/* * Copyright (C) 2020-2021 <NAME> */ pub static ENGINE_NAME: &str = "FoxSEE"; pub static VERSION: &str = "7.32.1"; pub static AUTHOR: &str = "<NAME>"; pub const DEFAULT_HASH_SIZE_MB: usize = 128; pub const DEFAULT_HASH_SIZE_UNIT: usize = 4194304; pub const MIN_HASH_SIZE_MB: usize = 1; pub const MIN_HASH_SIZE_UNIT...
//! //! Default windows for easy setup and event handling. //! Currently [glutin](https://crates.io/crates/glutin/main.rs) for cross-platform desktop //! and canvas using [wasm-bindgen](https://rustwasm.github.io/wasm-bindgen/) for web, but //! can be replaced by any other window with similar functionality. Also contai...
//! `Error` and `Result` types for this crate. use std::io::Error as IOError; use pest::error::Error as PestError; use thiserror::Error; use pest::Span; use crate::ast::*; use crate::syntax::Rule; /// An error for cardinality violation. /// /// This error is highly dependent on the function that returns it: the `n...
use anyhow::*; use serenity::{ client, model::{id::ChannelId, misc::EmojiIdentifier}, }; use std::env; /// return with an error value immediately. #[macro_export] macro_rules! abort_with { ($err:literal) => { return Err(UserErr::other($err).into()) }; ($err:expr) => { return Err($er...
use std::marker; use std::mem; use std::ffi::CString; use std::ptr; use libc::{c_uint, c_int}; use {raw, Repository, Error, Buf}; use util::Binding; /// The result of a `describe` operation on either an `Describe` or a /// `Repository`. pub struct Describe<'repo> { raw: *mut raw::git_describe_result, _marker...
use dependencies::specs; use dependencies::specs_derive; use dependencies::rocksdb; use dependencies::secp256k1; use wire::AnnouncementNode; use wire::Color; use wire::Address; use wire::NodeAlias; use secp256k1::{PublicKey, Error as SignError}; use specs::prelude::*; use specs_derive::Component; use serde_derive::...
use super::{PledgeData, VestingPeriod}; use crate::errors::ContractError; use crate::storage::{ load_balance, load_bond_pledge, load_gateway_pledge, remove_bond_pledge, remove_delegation, remove_gateway_pledge, save_account, save_balance, save_bond_pledge, save_gateway_pledge, DELEGATIONS, KEY, }; use cosmw...
use std::collections::{HashMap, HashSet}; use std::convert::{TryFrom, TryInto}; use std::fs::File; use std::io::{BufRead, BufReader}; type Pos = (i32, i32); type TileMap = HashMap<Pos, Tile>; type PortalMap = HashMap<(char, char), Vec<Pos>>; #[derive(Debug, Clone, Copy, PartialEq)] enum Tile { Passage, Wall, ...
use super::{Solver, SolverError, SolverResult}; use regex::Regex; use std::fmt; use std::fmt::Write; #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] struct Point { x: u64, y: u64, } #[derive(Debug)] struct Line { start: Point, end: Point, } #[derive(Debug)] struct Diagram { points: Vec<u...
// Copyright 2020 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 Archivist collects and stores diagnostic data from components. #![warn(missing_docs)] use { anyhow::{Context, Error}, archivist_lib::{ ...
use super::Matrix; use crate::prime::ValidPrime; use crate::vector::{FpVector, Slice, SliceMut}; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use std::io::{Read, Write}; /// A subspace of a vector space. /// # Fields /// * `matrix` - A matrix in reduced row echelon, whose number of columns is the dime...
use crate::*; use windows::core::{Abi, IUnknown, Interface}; use windows::Win32::Graphics::{Direct3D11::*, Direct3D11on12::*, Direct3D12::*, Dxgi::*}; #[derive(Clone, PartialEq, Eq)] pub struct RenderTarget { wrapper: ID3D11Resource, bitmap: ID2D1Bitmap1, } unsafe impl Send for RenderTarget {} unsafe impl Syn...
#![deny(clippy::all)] #![forbid(unsafe_op_in_unsafe_fn)] //! High level Node.js [N-API](https://nodejs.org/api/n-api.html) binding //! //! **napi-rs** provides minimal overhead to write N-API modules in `Rust`. //! //! ## Feature flags //! //! ### napi1 ~ napi8 //! //! Because `Node.js` N-API has versions. So there ar...
// //! Copyright 2020 Alibaba Group Holding Limited. //! //! 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 appl...
//! WASM runtime. use oasis_contract_sdk_types::message::Reply; use oasis_runtime_sdk::context::Context; use super::{ abi::{oasis::OasisV1, Abi, ExecutionContext, ExecutionResult}, types, Config, Error, MODULE_NAME, }; /// Everything needed to run a contract. pub struct Contract<'a> { pub code_info: &'a t...
// Copyright 2015-2019 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
use crossbeam_channel::{self, Receiver, Sender}; use log::{error, info}; use std::cmp::min; use std::fs; use std::path::{Path, PathBuf}; use std::str::FromStr; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; use std::thread; use std::time::Duration; use crate::app::index::metadata::{self, SongTags}...
use crate::util::AsyncReader; use std::error::Error; use std::ffi::OsStr; use std::fmt; use std::fmt::{Display, Formatter}; use std::fs::{File, Metadata}; use std::path::PathBuf; /// The FileHandler structure is a helper struct /// to manage files, contents and extensions also /// to decide their mime types accordingl...
use std::str::FromStr; use std::collections::HashMap; use std::cmp; use std::ops; pub fn main(input: &str) -> Result<(usize, usize), String> { let data = parse_input(input)?; let mut map1: HashMap<Point, usize> = HashMap::new(); let mut map2: HashMap<Point, usize> = HashMap::new(); for segm in &data {...
use crate::{tds::Collation, xml::XmlSchema, Error, SqlReadBytes}; use std::{convert::TryFrom, sync::Arc}; #[derive(Debug)] pub enum TypeInfo { FixedLen(FixedLenType), VarLenSized(VarLenType, usize, Option<Collation>), VarLenSizedPrecision { ty: VarLenType, size: usize, precision: u8...
use { crate::{ pos::*, }, rayon::prelude::*, super::*, }; pub const FIRING_RANGE: Int = 7; pub struct WorldPlayer<'t> { board: &'t Board, seed: usize, } impl<'t> WorldPlayer<'t> { pub fn new(board: &'t Board, seed: usize) -> Self { Self { board, see...
use clap::{App, Arg}; use std::{fs, str::FromStr}; #[derive(Debug, Clone)] enum Degrees { D90, D180, D270, } #[derive(Debug, Clone)] enum Rotation { Left(Degrees), Right(Degrees), } #[derive(Clone, Debug)] enum Heading { North, South, East, West, } #[derive(Debug, Clone)] enum Act...
use std::{ ptr }; use winapi::{ shared::{ minwindef::{ DWORD, PDWORD, LPBYTE, LPDWORD, PUCHAR, FALSE, BOOL }, winerror::{ ERROR_MORE_DATA, ERROR_INSUFFICIENT_BUFFER }, ...
//! Módulo com todas as funcionalidades necessárias para a //! representação de dia no contrato. //! //! Usamos um inteiro u8 para representar um dia. Mas //! precisamos garantir que este valor é válido. //! //! Devido a isso, o tipo Day é representado por um struct //! tupla Day(u8). //! //! Quando serializado p...
use super::{BackupFile, BackupMemoryInterface}; use num::FromPrimitive; use serde::{Deserialize, Serialize}; use std::path::PathBuf; #[derive(Serialize, Deserialize, Clone, Debug)] enum FlashWriteSequence { Initial, Magic, Command, Argument, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq...
use std::fs::{File, OpenOptions}; use std::io::{Read, Write}; use std::os::unix::fs::OpenOptionsExt; use std::os::unix::io::AsRawFd; use std::sync::Arc; use std::thread::spawn; use crossbeam_channel::{Receiver, Sender}; use libc; use mio::{Events, Interest, Poll, Token, Waker}; use mio::unix::SourceFd; use crate::Sta...
use std::ptr::null_mut; use std::hash::{Hash, Hasher}; use std::marker::PhantomData; use std::fmt::{Debug, Display, Result as FmtResult}; use crate::common::Formatter; const SLAB_SIZE: usize = u16::MAX as usize; #[derive(Clone)] pub struct StringRef<'a> { data: *const u8, length: usize, _phantom: PhantomD...
use crate::consts::IO_BASE; use crate::timer::delay; use core::marker::PhantomData; use volatile::{ReadOnly, Volatile, WriteOnly}; /// The base address of the `GPIO` registers. const GPIO_BASE: usize = IO_BASE + 0x200000; /// An alternative GPIO function. (ref: peripherals 6.1, page 92) #[repr(u8)] pub enum Function ...
//use bls12_381::{G1Affine, G1Projective, G2Affine, G2Projective}; use crate::zkfr::blsScalar; // Gal naudot crate::zkfr::blsScalar;? //use bls12_381::*; use kzg::Fr; use blst::blst_fr as BlstFr; use blst::blst_fp as BlstFp; use blst::blst_p1 as BlstP1; use std::fmt; use core::fmt::Error; pub use crate::curve::g1::G1...
mod utils; use std::fmt; use wasm_bindgen::prelude::*; extern crate fixedbitset; use fixedbitset::FixedBitSet; // 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_alloc::WeeAlloc::INIT; #[was...
use std::ops::{Index, IndexMut, Range}; #[repr(C)] union Register { bytes: (u8, u8), value: u16, } impl Register { fn new() -> Self { Register { value: 0 } } } pub struct RegisterArray { wz: Register, bc: Register, // Pair B (B and C) de: Register, // Pair D (D and E) hl: Regi...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Node Control Register"] pub ncr: NCR, #[doc = "0x04 - Node Status Register"] pub nsr: NSR, #[doc = "0x08 - Node Interrupt Pointer Register"] pub nipr: NIPR, #[doc = "0x0c - Node Port Control Register"] pub n...
#[macro_use] extern crate clap; extern crate regex; use clap::{App, Arg}; use regex::Regex; use std::collections::{BTreeSet, BTreeMap}; use std::io::BufRead; #[derive(Debug)] enum GroupId<'a> { Name(&'a str), Index(usize), None, } impl<'a> From<&'a str> for GroupId<'a> { fn from(s: &'a str) -> Self {...
use alloc::sync::Arc; use alloc::string::String; use alloc::collections::BTreeMap; use crate::vtx::Register; use crate::fuzz_session::Worker; use page_table::VirtAddr; /// Windows enlightenment #[derive(Default)] pub struct Enlightenment { /// Address of the kernel module list (flink, blink) kernel_modlist_add...
// Copyright 2020 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::model::{ error::ModelError, events::{ error::EventsError, event::SyncMode, registry::{...
use super::glsl_compiler; use crate::model; use wgpu::Device; use wgpu::{BindGroup, BindGroupLayout, RenderPass, TextureFormat}; pub struct ArrowGpu { vertex_buf: wgpu::Buffer, index_buf: wgpu::Buffer, index_count: usize, instance_buf: wgpu::Buffer, instance_count: u32, pipeline: wgpu::RenderPi...
mod ast; mod calc; mod graph; mod parser; mod solver; pub use crate::ast::Number; use crate::ast::Statement; use crate::calc::{calc_operand, CalcError, TopLevelEnv}; use crate::graph::GraphError; pub use crate::graph::{Area, Graph, Range}; use crate::parser::{parse, ParserError}; use crate::solver::{solve_for, SolverE...
//! Streams are used to send data between operators. //! //! In the `Operator::connect` function, operators return the streams on which //! they intend to send messages as [`WriteStream`]s. //! Any number of operators can be connected to those streams to read //! data via the `erdos::connect` macros; however, only the ...
//! # hpke //! **WARNING:** This code has not been audited. Use at your own discretion. //! //! This is a pure Rust implementation of the //! [HPKE](https://datatracker.ietf.org/doc/draft-irtf-cfrg-hpke/) hybrid encryption scheme. The //! purpose of hybrid encryption is to use allow someone to send secure messages to a...
// Copyright (c) 2020 Huawei Technologies Co.,Ltd. All rights reserved. // // StratoVirt is licensed under Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan // PSL v2. // You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 // THIS SOFTWA...
/* * Provides mocked responses from TerraSwap pools for testing * * Contents mostly from a file I originally found in Mirror protocol repo. All * due credit to them! * * https://github.com/Mirror-Protocol/mirror-contracts/blob/main/contracts/mirror_collateral_oracle/src/testing/mock_querier.rs * Apache License ...
use crate::lib::*; use std::collections::HashMap; #[derive(Debug, PartialEq)] struct Field { name: String, rule1: (u32, u32), rule2: (u32, u32), } impl Field { pub fn is_valid(&self, value: u32) -> bool { let (a, b) = self.rule1; let (c, d) = self.rule2; (a <= value && value <=...
#![deny(unused_must_use)] pub mod channels; pub mod commands; pub mod config; pub mod daemons; pub mod delayed_tasks; pub mod util; pub use self::daemons::DaemonManager; use crate::config::Config; use serenity::{ framework::standard::{ help_commands, macros::{help, hook}, Args, CommandGrou...
//! A datastructure for holding key map entries use std::fmt::Debug; #[derive(Debug, Clone)] struct Node<Value: Debug> { label: u8, children: Vec<Node<Value>>, value: Option<Value>, } impl<Value: Debug> Node<Value> { fn new(label: u8) -> Self { Self { label, children: V...
//! list of old kernel versions. use anyhow::{anyhow, Result}; use log::{info, warn}; use serde_derive::Deserialize; use std::fmt; use std::fs; use std::io::{Cursor, Read, Write}; use std::path::{Path, PathBuf}; pub const URL_BASE: &'static str = "https://mirrors.kernel.org/pub/linux/kernel"; const KERNELS: &'static ...
/* This is an example demonstrating how to use an AABB tree to detect collisions. The example is visual, it uses piston to show a screen with random blue circles moving around, whenever these circles collide, they change color. */ extern crate aabb_tree; extern crate glm; extern crate rand; extern crate chrono; exter...
use crate::io::binary::{Binary, Endian}; use crate::io::result::Result; use crate::property::Storage; use crate::property::{ConstructableProperty, Property, ResizeableProperty, StorageFor}; use crate::property::{ItemHandle, Size, Value, INVALID_INDEX}; use crate::util::index::{IndexSet, IndexSetUnchecked, IndexUnchecke...
use crate::{ StorageAlloc, cell_db::CellDb, /*dynamic_boc_diff_writer::{DynamicBocDiffFactory, DynamicBocDiffWriter},*/ types::{CellId, StorageCell}, db::traits::KvcTransaction, TARGET, }; #[cfg(feature = "telemetry")] use crate::StorageTelemetry; use adnl::{declare_counted, common::{CountedObject, Counter...
// https://googleprojectzero.blogspot.com/2016/02/the-definitive-guide-on-win32-to-nt.html #![cfg(windows)] use std::path::Path; use normpath::PathExt; #[macro_use] mod common; #[test] fn test_drive_absolute() { test!(r"X:\ABC\DEF", SAME, SAME); test!(r"X:\", SAME, SAME); test!(r"X:\ABC\", SAME, SAME);...