text
stringlengths
3.09k
13.9k
//! A path type exposed from the configuration crate //! //! This type allows the user to specify paths as strings, with some //! support for tab expansion and user directory support. use std::path::{Path, PathBuf}; use directories::{BaseDirs, ProjectDirs}; use once_cell::sync::Lazy; use serde::Deserialize; /// A pa...
use rustyline::error::ReadlineError; use rustyline::Editor; use std::fmt; use std::{collections::HashMap, num::ParseFloatError}; #[derive(Clone)] enum RispExp { Symbol(String), Number(f64), List(Vec<RispExp>), Func(fn(&[RispExp]) -> Result<RispExp, RispErr>), } #[derive(Debug)] enum RispErr { Reas...
use crate::api::isuxportal::proto::resources::BenchmarkResult; use crate::api::isuxportal::proto::services::bench::benchmark_report_client::BenchmarkReportClient; use crate::api::isuxportal::proto::services::bench::receive_benchmark_job_response::JobHandle; use crate::api::isuxportal::proto::services::bench::ReportBenc...
use std::path::PathBuf; use gtk::glib; use gtk::prelude::*; use crate::ui; use crate::ui::icons; impl super::App { pub fn import_files(&self, uris: Vec<String>, dest: lb::Uuid) { let prog_bar = gtk::ProgressBar::new(); let status_lbl = gtk::Label::new(Some("Preparing to import files...")); ...
use crate::{ consts::NOTE_HEIGHT, data::{ sheet::{Index, Sheet}, Frame2, Point, Rect, }, state::{sheet_editor::Message, Message as RootMessage}, util::coord::Coord, }; use iced_graphics::{Backend, Color, Defaults, Primitive, Renderer}; use iced_native::{event, keyboard, layout, mouse, Clipboard, Element, Event...
use super::{ generator::{Level, TileType, WallType}, settings::LevelSettings, LevelLoader, LevelState, LevelTag, }; use crate::systems::PhysicsLayers; use bevy::prelude::*; use bevy_ecs_tilemap::prelude::*; use heron::prelude::*; // pub fn despawn_player(mut player_state: ResMut<State<PlayerState>>) { // playe...
// 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. //! Implements applying keymaps to hardware keyboard key events. //! //! See [Handler] for details. use crate::input_device; use crate::input_handler::Inp...
use crate::atomic::{Packable}; use crate::state::AcquireState::{Available, Queued}; use crate::state::ReleaseState::{LockedDirty, Locked, Unlocked}; use std::ops::{AddAssign, Add, Sub, SubAssign}; use std::fmt::{Debug, Formatter}; use std::fmt; use std::ptr::null; use std::cell::UnsafeCell; use crate::Semaphore; use c...
use std::collections::HashMap; use engine::Uuid; use resources::Handle; use crate::{ Scene, SceneCollection, SceneRuntime, }; use { crate::{ Component, ComponentVariant, ComponentVariantId, ComponentsContainer, Entity, EntityContainer, EntityInfo, ReadStorage, ScheduleBlock, WriteStorage, },...
// 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...
use std::collections::{HashMap, HashSet}; use itertools::Itertools; use ordered_float::OrderedFloat; use crate::{ graph::{Chunk, Graph}, layout::{ChunkId, StandardChunkId}, music::Breakdown, Query, }; /// How many chunks will be searched to determine which chunk patterns generate the required music c...
use crate::{ errors::ParrotError, guild::cache::GuildCacheMap, handlers::track_end::ModifyQueueHandler, strings::{ QUEUE_EXPIRED, QUEUE_NOTHING_IS_PLAYING, QUEUE_NOW_PLAYING, QUEUE_NO_SONGS, QUEUE_PAGE, QUEUE_PAGE_OF, QUEUE_UP_NEXT, }, utils::get_human_readable_timestamp, }; use ...
use rand::{ Rng, seq::SliceRandom, }; use std::{ time::SystemTime, collections::HashMap, }; use crate::{ Error, Jwk, crypto::{ CryptoAlgorithm, SignatureAlgorithm }, }; use base64_url::{encode, decode}; use super::{MessageType, PriorClaims}; #[derive(Serialize, Deseriali...
use crate::util; use generic_json::JsonBuild; use std::convert::TryFrom; use std::fmt; /// JSON-LD keywords. #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] pub enum Keyword { /// `@base`. /// Used to set the base IRI against which to resolve those relative IRI references /// which are otherwise...
#![deny(warnings, rust_2018_idioms)] #![forbid(unsafe_code)] use futures_core::TryFuture; use linkerd_identity as identity; use linkerd_proxy_transport::{ClientAddr, Remote}; use linkerd_stack as svc; use linkerd_tls as tls; use linkerd_tracing::access_log::TRACE_TARGET; use pin_project::pin_project; use std::{ fu...
use tuix::*; pub mod inspector; pub use inspector::*; use femtovg::{Canvas, renderer::OpenGl, Path, Paint}; #[derive(Default)] struct Overlay { selected: Entity, } impl Widget for Overlay { type Ret = Entity; fn on_build(&mut self, state: &mut State, entity: Entity) -> Self::Ret { entity }...
// //! 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...
use std::collections::hash_map::Entry::*; use std::collections::HashMap; use std::convert::TryFrom; use crate::TokenId; use crate::Tokenization; #[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Copy, Hash)] struct Coord { next_lcs: usize, next_seq: usize, } #[derive(Debug)] struct Context { seq_ind...
use std::hash::{Hash, Hasher}; #[cfg(feature = "ahash")] use ahash::AHasher as DefaultHasher; #[cfg(not(feature = "ahash"))] use std::collections::hash_map::DefaultHasher; #[cfg(feature = "ahash")] macro_rules! new_hasher { () => { DefaultHasher::new_with_keys(0, 0) }; } #[cfg(not(feature = "ahash"))]...
extern crate clap; extern crate rand; extern crate serde; extern crate serde_json; #[macro_use] extern crate serde_derive; mod agent; mod market; use std::collections::HashMap; use std::io::{self, BufRead, Write}; use clap::{Arg, App}; use agent::{Agent, Style}; use market::{cda, call}; #[derive(Deserialize)] st...
//! Channel multiplexer configuration. use std::time::Duration; use super::msg::MAX_MSG_LENGTH; /// Behavior when ports are exhausted and a connect is requested. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[non_exhaustive] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deseria...
use super::AuthorizationToken; const PERMISSION_TYPE_PREFIX: &str = "type="; const VERSION_PREFIX: &str = "ver="; const SIGNATURE_PREFIX: &str = "sig="; /// The token field of a [`Permission`](super::Permission) object. /// /// This field is a url encoded string with the type of permission, the signature, and the ver...
//! Types which have no functional effect on the system, such as airport geometry. use std::collections::HashMap; use serde::{Deserialize, Serialize}; use crate::domain::{Airport, Airspace, Airway, Point, Runway}; use crate::domain::coords::calculate_aabb; #[derive(Debug, Clone, Default, Serialize, Deserialize)] pub...
use smoltcp::socket::{TcpSocket, TcpSocketBuffer}; use smoltcp::iface::{SocketHandle}; use std::str; use syscall::{Error as SyscallError, Result as SyscallResult}; use syscall; use port_set::PortSet; use super::socket::{DupResult, SchemeFile, SchemeSocket, SocketFile, SocketScheme}; use super::{parse_endpoint, Smolnet...
//! Intel's Restricted Transactional Memory (RTM). //! //! This CPU feature is available on Intel Broadwell or later CPUs (and some Haswell). //! //! The reference is [Intel 64 and IA-32 Architectures Software Developer's //! Manual Volume 2: Instruction Set Reference, A-Z][intel64_ref]. //! //! [Wikipedia][wikipedia_r...
//Copyright 2020 WHTCORPS 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 to in writing, soft...
/* tag::catalog[] Title:: Boundary nodes integration test end::catalog[] */ use crate::{ driver::{ boundary_node::{BoundaryNode, BoundaryNodeVm}, ic::{InternetComputer, Subnet}, pot_dsl::get_ic_handle_and_ctx, test_env::{HasIcPrepDir, TestEnv}, test_env_api::{ re...
use crates::{Crate, GitHubRepo}; use errors::*; use ex::{ex_dir, Experiment}; use file; use log; use serde_json; use std::collections::HashMap; use std::fmt::{self, Display, Formatter}; use std::fs; use std::path::PathBuf; use std::str::FromStr; use std::sync::{Arc, Mutex}; use toolchain::Toolchain; use util; pub trai...
extern crate proc_macro; use proc_macro::TokenStream; use quote::quote; use syn::export::ToTokens; use syn::{parse2, Generics, Type, TypeParamBound}; use proc_macro2::Ident; use syn::{ parse_macro_input, ConstParam, DeriveInput, GenericParam, ItemImpl, Lifetime, LifetimeDef, TypeParam, }; // struct RenameLif...
//! A single execution unit in the runestick virtual machine. //! //! A unit consists of a sequence of instructions, and lookaside tables for //! metadata like function locations. use crate::collections::HashMap; use crate::{ Call, ConstValue, DebugInfo, Hash, Inst, Rtti, StaticString, VariantRtti, VmError, VmErro...
#![allow(unused_variables)] use ash; use relevant::Relevant; use smallvec::SmallVec; use std::{ collections::LinkedList, fmt::Debug, marker::PhantomData, ops::Add, ptr::null, sync::Arc, }; use crate::raw::command::{buffer::*, capability::*, fence::*, QueueId}; use crate::raw::device::DeviceTracker; use crate::raw...
use crate::private_key::ETHEREUM_SALT; use crate::Error; use crate::Uint256; use serde::{ de::{Deserialize, Deserializer}, ser::Serializer, }; use sha3::{Digest, Keccak256}; use std::str; /// Takes a signature payload of arbitrary size and creates a proper payload /// for an ethereum_msg signature. /// /// In...
use crate::prelude::*; use dml::ReferentialAction; use once_cell::sync::OnceCell; use std::{ fmt::Debug, sync::{Arc, Weak}, }; pub type RelationRef = Arc<Relation>; pub type RelationWeakRef = Weak<Relation>; /// A relation between two models. Can be either using a `RelationTable` or /// model a direct link be...
// Code from https://github.com/rust-rocksdb/rust-rocksdb/blob/eb2d302682418b361a80ad8f4dcf335ade60dcf5/librocksdb-sys/build.rs // License: https://github.com/rust-rocksdb/rust-rocksdb/blob/master/LICENSE use std::env::var; use std::path::PathBuf; fn link(name: &str, bundled: bool) { let target = var("TARGET").un...
#![cfg(all(feature = "read", feature = "write"))] use std::env; use std::fs::File; use std::io::Read; use std::path::PathBuf; use gimli::read; use gimli::write::{self, Address, EndianVec}; use gimli::LittleEndian; fn read_section(section: &str) -> Vec<u8> { let mut path = PathBuf::new(); if let Ok(dir) = env...
#![deny(warnings)] extern crate arg_parser; extern crate extra; use std::env; use std::str; use std::fs::File; use std::process::exit; use std::io::{stdout, stderr, stdin, Error, Write, BufRead, BufReader, BufWriter}; use arg_parser::ArgParser; use extra::option::OptionalExt; const HELP_INFO: &'static str = "T...
use crate::ast::Node; use crate::str::SqlError; macro_rules! must { ($expr:expr) => { $expr .as_ref() .ok_or_else(|| SqlError::Missing(stringify!($expr).into()))? }; } macro_rules! node { ($expr:expr, $ty:path) => { match &$expr { $ty(elem) => elem, ...
use std::path::PathBuf; use std::process::{Child, Command, Stdio}; use std::sync::{Arc, RwLock}; use std::thread; use std::{io::{Read, BufReader}, time::Duration}; use failure::Fail; use nix::sys::signal::{self, Signal}; use nix::unistd::Pid; use wait_timeout::ChildExt; use warp::reject; use itertools::Itertools; #[d...
//! Public file system in-memory representation. use std::{ io::{Cursor, Read, Seek}, rc::Rc, result, }; use anyhow::{bail, Result}; use chrono::{DateTime, Utc}; use libipld::{cbor::DagCborCodec, codec::Decode, Cid}; use super::{Id, PublicDirectory, PublicFile}; use crate::{common::BlockStore, FsError, U...
use std::{ collections::VecDeque, convert::TryInto, future::Future, pin::Pin, task::{Context, Poll, Waker}, vec::IntoIter, }; use async_zmq::{request, Message, MultipartIter, Request}; use futures::ready; use tokio::{ io::{self, AsyncRead, AsyncWrite}, sync::Mutex, }; /// Temporary bri...
use crate::db::handler; use crate::schema::todo; use crate::schema::todo::dsl::*; use diesel::prelude::*; use rocket::serde::Serialize; use std::cmp::{max, min}; /// Struct who represent a to-do #[derive(Queryable, Serialize, AsChangeset, Identifiable, Insertable)] #[table_name = "todo"] pub struct TodoEntity { pu...
use html5ever::serialize; use html5ever::serialize::{SerializeOpts, TraversalScope}; use html5ever::QualName; use html5ever::{parse_document, parse_fragment}; use markup5ever::{local_name, namespace_url, ns}; use nipper::{Document, SerializableNodeRef}; use tendril::SliceExt; use tendril::StrTendril; use tendril::Tendr...
use std::fs::File; use std::rc::Rc; use std::sync::{Arc, Mutex}; use std::thread; use arrow::datatypes::{DataType, Field, Schema, TimeUnit}; use arrow::record_batch::RecordBatch; use arrow::record_batch::RecordBatchReader; use crossbeam::channel::{unbounded, Receiver, SendError, Sender}; use datafusion; use datafusion...
extern crate redis; use std::collections::HashMap; const KEYLIST: &str = "##__INTERNAL::keylist"; const NAMESPACES: &str = "##__INTERNAL::namespaces"; const LASTSYNC: &str = "##__INTERNAL::lastsync"; pub type Connection = redis::Connection; // TODO: ssl, ssh, etc pub fn connect(host: String, port: u16, tls: bool, p...
use erl_tokenize::tokens::{AtomToken, SymbolToken, VariableToken}; use erl_tokenize::values::Symbol; use erl_tokenize::{LexicalToken, Position, PositionRange}; use trackable::error::ErrorKindExt; use super::commons::parts::{BinaryOp, UnaryOp}; use super::guard_tests; use super::Literal; use crate::traits::{Parse, Toke...
// Internal module for division. use super::{Integer, Block, LongBlock, BLOCK_SIZE, SignedLongBlock}; use super::internal::{dbl_to_bl, div_by_zero, pos_integer}; impl Integer { /// Checks whether the integer is a multiple of the argument. pub fn is_multiple_of(&self, i : &Integer) -> bool { i.divides( self) } ...
use orbclient::{Color, Renderer}; use std::cell::{Cell, RefCell}; use std::sync::Arc; use orbtk::cell::{CloneCell, CheckSet}; use orbtk::event::Event; use orbtk::point::Point; use orbtk::rect::Rect; use orbtk::traits::{Click, Place, Text}; //Border use orbtk::widgets::Widget; use orbtk::theme::{Theme}; pub struct Ma...
use itertools::Itertools; use std::collections::{HashMap, VecDeque}; fn main() { let input = include_str!("../../input/19.txt"); println!("Part 1: {}", run(input, false)); println!("Part 2: {}", run(input, true)); } #[derive(Debug, Clone)] enum Rule { Char(char), Seq(Vec<usize>), Alt(Vec<usize...
use alloc::rc::Rc; use core::fmt::{Debug, Formatter}; use core::future::Future; use core::pin::Pin; use core::task::{Context, Poll}; use crate::utils::{TimerClock, TimingGroup, Ucw}; /// Helper for equally dividing time slots across multiple tasks. Implements `Future`. /// /// This struct can be used as a wrapper for ...
use anyhow::Result; use gltf::import; use itertools::izip; use std::{mem::size_of, path::Path}; use ash::vk::{ Buffer, BufferUsageFlags, Format, VertexInputAttributeDescription, VertexInputBindingDescription, VertexInputRate, }; use memoffset::offset_of; use super::{buffers::MappedDeviceBuffer, Base}; #[repr...
//! # iso_iec_7064::system //! //! Trait implemented by all _Check Character Systems_, both pure and hybrid. /// There are five _Alphabets_ used by the _Check Character Systems_ defined in The Standard. While /// The Standard does not specify a character encoding, we will be using the ASCII subset of Unicode. /// In t...
use alloc::vec::Vec; use core::convert::TryInto; use core::ptr; use core::sync::atomic::{AtomicUsize, Ordering}; use core::time::Duration; use log::{error, info}; use spin::Mutex; use x86::bits64::paging::{PAddr, VAddr, BASE_PAGE_SIZE}; use lineup::threads::ThreadId; use lineup::tls2::{Environment, SchedulerControlBl...
use std::env; use std::process::Command; use std::io::{Read, Write}; use std::fs::File; fn parse_u16(data: &[u8]) -> u16 { data[0] as u16 | ((data[1] as u16) << 8) } fn parse_i16(data: &[u8]) -> i16 { parse_u16(data) as i16 } fn parse_u32(data: &[u8]) -> u32 { data[0] as u32 | ((data[1] as ...
use std::mem; use tch::nn::ModuleT; use tch::Tensor; use tch::vision::{ resnet, imagenet }; use tch::{nn, nn::Conv2D, nn::FuncT, nn::SequentialT, nn::seq_t}; use std::path::{ Path, PathBuf }; #[derive(Debug)] struct Layers { pub layers: std::vec::Vec<std::boxed::Box<(dyn tch::nn::ModuleT)>>, } impl ModuleT for L...
//! Thread support using rt-thread API //! //! # Example //! ``` //! use rtt_rs::thread::Thread; //! for i in 0..2 { //! let th = Thread::new().name("th").stack_size(4096).start(move ||{ //! for _ in 0..10 //! { //! print!("hello thread"); //! Thread::delay(100); //! } //! }); //! } //! ``` //! u...
use crate::EntryKind; use std::borrow::Cow; use std::collections::btree_map::{BTreeMap, Iter}; use std::collections::vec_deque::VecDeque; use std::ffi::{OsStr, OsString}; use std::path::{Path, PathBuf}; /// Directory tree node. /// Contains a list of file entries (leaf nodes), and directories (child nodes). struct No...
//! # Router module. //! //! The Router module forward sources to sinks. use std::collections::{HashMap, HashSet}; use std::path::PathBuf; use std::process::abort; use std::sync::Arc; use std::thread::sleep; use std::time::Duration; use uuid::Uuid; use failure::{format_err, Error}; use futures::future::ok; use tokio::...
//! `pbjson-build` consumes the descriptor output of [`prost-build`][1] and generates //! [`serde::Serialize`][2] and [`serde::Deserialize`][3] implementations //! that are compliant with the [protobuf JSON mapping][4] //! //! # Usage //! //! _It is recommended you first follow the example in [prost-build][1] to famili...
use crate::{commands::*, theme::*}; use audio_program::get_help; use druid::{ kurbo::{BezPath, Line}, piet::{FontFamily, PietText, Text, TextLayout, TextLayoutBuilder}, Event, Point, Rect, RenderContext, Size, TimerToken, }; use sound_garden_types::*; use std::{collections::HashMap, time::Duration}; pub st...
use std::ops::Deref; use std::sync::{ atomic::{AtomicBool, AtomicU8, Ordering}, Arc, }; use crate::backend::allocator::{Allocator, Buffer, Fourcc, Modifier}; use crate::utils::user_data::UserDataMap; pub const SLOT_CAP: usize = 4; /// Swapchain handling a fixed set of re-usable buffers e.g. for scan-out. ///...
#![allow(unused_imports)] #![allow(dead_code)] use std::path::Path; use bellperson::{util_cs::bench_cs::BenchCS, util_cs::test_cs::TestConstraintSystem, Circuit}; use blstrs::Scalar as Fr; use filecoin_hashers::{Domain, HashFunction, Hasher}; use generic_array::typenum::{Unsigned, U0, U2, U4, U8}; use merkletree::stor...
use crate::{ graph::{EdgeIterator, Graph, NodeIterator}, mapping::DoubleMapping, }; use std::collections::{HashMap, HashSet}; use std::fmt::{Debug, Display, Formatter}; use std::hash::Hash; /** * Adjacency list implementation of [`Graph`]. */ pub struct AdjListGraph<N: Hash + Eq + Debug> { identifiers: D...
#![cfg_attr(feature = "docs", feature(doc_cfg))] #![deny( single_use_lifetimes, missing_debug_implementations, large_assignments, exported_private_dependencies, absolute_paths_not_starting_with_crate, anonymous_parameters, explicit_outlives_requirements, keyword_idents, macro_use_ext...
// Copyright 2019 Authors of Red Sift // // 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 t...
/* * @lc app=leetcode.cn id=588 lang=rust * * [588] 设计内存文件系统 */ // @lc code=start use std::cell::RefCell; use std::collections::BTreeMap; use std::rc::Rc; #[derive(Debug)] enum FSNode { Directory { children: BTreeMap<String, Rc<RefCell<FSNode>>>, }, File { address: usize, }, } imp...
use anyhow::Result; use anyhow::{anyhow, bail}; use std::collections::HashMap; use xml::attribute::OwnedAttribute; use xml::reader::XmlEvent; const FIX40_XML: &[u8] = include_bytes!("xml/FIX40.xml"); const FIX41_XML: &[u8] = include_bytes!("xml/FIX41.xml"); const FIX42_XML: &[u8] = include_bytes!("xml/FIX42.xml"); co...
use std::os::raw::c_char; use std::os::raw::c_void; use std::os::raw::c_int; use std::mem; use std::ffi::CString; use std::ffi::CStr; use std::str; use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Result; pub struct Worksheet { pointer : *const c_void, } pub struct Worksheets<'a> { workbook : &'a ...
#[derive(Clone, Debug)] struct Point { x: i64, y: i64, z: i64, } #[derive(Clone, Debug)] struct Box { // Bottom "left" min: Point, // Top "right" max: Point, } fn overlap(x1min: i64, x1max: i64, x2min: i64, x2max: i64) -> bool { return x2max >= x1min && x1max >= x2min; } impl Point { ...
#![warn(clippy::all, clippy::pedantic)] use std::{ fs::File, io::{prelude::*, BufReader}, path::Path, }; #[derive(Debug, PartialEq)] pub struct Floor { map: Vec<Vec<u8>>, } impl Floor { pub fn new(filename: impl AsRef<Path>) -> Floor { let file = File::open(filename).expect("file doesn't exist"); le...
/* * Copyright (c) Facebook, Inc. and its affiliates. * * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ use super::fd::{AsyncFd, Fd}; use syscalls::Errno; use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}...
use nom::{ branch::alt, bytes::complete::tag, bytes::complete::take_until, character::complete::{char, digit1, line_ending, space1, tab}, combinator::cut, error::{context, ErrorKind, ParseError}, sequence::{preceded, terminated, tuple}, AsChar, IResult, InputTakeAtPosition, }; use crate...
// Copyright 2021 <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...
use std::fmt; /// Kinds of Swift metadata records. #[repr(transparent)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct MetadataKind(u32); /// Non-type metadata kinds have this bit set. const NON_TYPE_FLAG: u32 = 0x400; /// Non-heap metadata kinds have this bit set. const NON_HEAP_FLAG: u32 =...
//! This module contains the configuration of the application. //! //! All options are passed individually to each function and are not bundled together. //! //! # Examples //! //! ```no_run //! # use feembox::options::{Verbosity, Options}; //! let options = Options::parse(); //! if options.verbosity >= Verbosity::Huma...
mod common; #[cfg(test)] mod tests { mod broker_tests; mod bus_tests; mod future_tests; mod mem_tests; mod msg_tests; mod options_tests; mod pair_tests; mod pipe_tests; mod pubsub_tests; mod pushpull_tests; mod reqrep_tests; mod stats_tests; mod stream_tests; u...
pub mod base; mod flag; use self::base::{BaseRand, RAND_MAX}; use self::flag::Flag; use std::f64::consts::PI; pub enum Style { Normal, Pythagoras, Gauss(u32), BMgauss(f64, f64, bool), Marsaglia(f64, f64, f64, bool), } pub enum JumpStyle { Static, Next, Jump, DoubleJump, } /// Sol...
// Rust version of the game described in: // https://medium.com/unraveling-the-ouroboros/coin-flipping-with-discrete-logarithms-91c563d38d2 extern crate num_bigint; extern crate rand; #[macro_use] extern crate lazy_static; #[macro_use] extern crate num_derive; extern crate num_traits; extern crate num_integer; use num...
pub mod behavior; pub mod object; pub mod strategy; // pub mod table; use std::{ error::Error, fmt::{self, Display, Formatter}, }; use crate::data::abap_table::{AbapTable, SoapResponse}; pub use crate::net::SAPClient; use async_trait::async_trait; use reqwest::StatusCode; pub trait LockHandles { fn get_l...
use super::EmbeddedObjectProperties; use super::StringValue; use quick_xml::events::{BytesStart, Event}; use quick_xml::Reader; use quick_xml::Writer; use reader::driver::*; use std::io::Cursor; use structs::drawing::spreadsheet::TwoCellAnchor; use structs::raw::RawRelationships; use structs::vml::Shape; use writer::dr...
//! Bit level parsers and combinators //! //! In byte level parsing, the input is generally a `&[u8]` passed from combinator //! to combinator as the slices are manipulated. //! //! Bit parsers take a `(I, usize)` as input. This type is a helper for doing bit manipulation //! that wraps the input type. Use the `bits` f...
// Core module // // Where all the core parts of the Sha2 hash function family reside. // This can be done because most parts are shared between the different // hash functions. pub mod message; pub mod functions; use std::ops::{ Add, Rem, BitXor, BitAnd, Not, Shr }; use std::convert::TryFrom; pub trait HashEngi...
use std::{collections::VecDeque, fmt::{Debug, Formatter, Result as FResult}}; use dyn_uint::{UintFactory, ClassFactory, SlabFactory}; use time::run_millis; use crate::frame_wheel::{FrameWheel}; use crate::item::{TimeoutItem}; /// 任务轮实现的延时任务管理 /// * `T` 延时任务的数据类型 /// * `N1` 一级粒度轮的槽位数 <任务轮分4级粒度> /// * `N2` ...
use std::cell::RefCell; use std::thread; use std::time::{Duration, Instant}; use crate::bus::Bus; use crate::types::*; #[derive(PartialEq, Copy, Clone)] enum Mode { READ, ID, PROGRAM, WRITING, COMMAND1, COMMAND2, ERASE1, ERASE2, ERASE3, } pub struct ROM { start: u32, size:...
use crate::ast::expression::*; use crate::ast::statement::*; use crate::ast::Ast; pub struct PrettyPrintAst; impl PrettyPrintAst { pub fn pprint_ast(ast: &Ast) -> String { let mut buffer = Vec::<String>::new(); for stmt in &ast.statements { Self::do_pprint_stmt(&mut buffer, stmt); ...
use minicbor::{ decode::{self, Tokenizer}, encode::{self, write::EndOfSlice, Encode, Encoder}, }; use serde_json::{Map, Value}; pub fn decode_cbor(buf: &[u8]) -> Result<Value, decode::Error> { let mut tokens = Tokenizer::new(buf); decode_cbor_inner(&mut tokens) } fn decode_cbor_inner(tokenizer: &mut T...
use async_graphql::{Context, Object, Result, ID}; use async_graphql::guard::Guard; // use nanoid::nanoid; // use serde::ser::SerializeStruct; // use bson::doc; use crate::authorization::{PermissionGuard, Permission}; use crate::models::{Coffee, CreateCoffeeInput, UpdateCoffeeInput}; // use futures::{Stream, StreamExt};...
use interface::{HunksTrait, HunksEmitter, HunksList}; use implementation::diffs::Diffs; use utils::MAX_U32_INT; #[derive(Default, Clone)] pub struct HunksItem { pub hunk: String, pub hunk_max_line_length: u64, pub lines: u64, pub lines_origin: Vec<u8>, pub lines_old: Vec<u8>, pub lines_old_cols...
use crate::common::api_client::ApiClient; use crate::common::errors::api_errors::{ApiClientError, ApiResponseError}; use crate::common::models::sirius_proxima_api::{ SiriusProximaErrorResponse, SiriusProximaSuccessResponse, }; use crate::constants::default_values::DefaultValues; use crate::constants::environment::A...
use std::cmp::Ordering; use std::fmt::Debug; pub struct PriorityQueue<K, P> where P: PartialOrd, { ord: Ordering, keys: Vec<K>, priorities: Vec<P>, } impl<K, P> PriorityQueue<K, P> where P: PartialOrd + Debug, { // pub fn new() -> PriorityQueue<K, P> { // PriorityQueue { // ...
extern crate png; use std::default::Default; use std::ptr; use android_glue; use egl; use egl::{Config, Context, Display, NativeWindowType, Surface}; // RAII managed EGL pointers. Cleaned up automatically via Drop. pub struct EglContext { display: Display, surface: Surface, context: Context, pub width: i32,...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Bias and suspend configuration"] pub hrbsc: crate::Reg<hrbsc::HRBSC_SPEC>, _reserved1: [u8; 0x04], #[doc = "0x08 - Module identification register"] pub midr: crate::Reg<midr::MIDR_SPEC>, _reserved2: [u8; 0x08], ...
// PA1 に接続されたLEDをゆっくりと点滅させる。 // TIMの割り込みごとにPWMのDUTY書き換え #![no_std] #![no_main] use core::cell::RefCell; use cortex_m::interrupt::Mutex; use stm32f4::stm32f446::interrupt; use stm32f4::stm32f446::{self}; // pick a panicking behavior use panic_halt as _; // you can put a breakpoint on `rust_begin_unwind` to catch p...
//! Defines a convenient to use API for making calls to the Discord API. //! //! Most of the types defined here are not useful on their own, and are obtained by calling //! methods on [`DiscordContext`]. use crate::context::*; use minnie_model::types::*; // TODO: Create iterators based on the various get_* functions....
extern crate cgmath; extern crate image; #[macro_use] extern crate glium; use cgmath::{ vec2 as v2, vec3 as v3, vec4 as v4, ElementWise, InnerSpace, Matrix, Matrix3, Matrix4, SquareMatrix, Vector2, Vector3, Vector4, }; type V2 = Vector2<f64>; type V3 = Vector3<f64>; type V4 = Vector4<f64>; type M3 = Matrix3<f...
use enum_primitive::cast::FromPrimitive; use enum_primitive::enum_from_primitive; use crate::gpt; use crate::prcm; enum_from_primitive! { #[derive(Debug, PartialEq, Clone, Copy)] pub enum Timer { GPT0A = 0, GPT0B = 1, GPT1A = 2, GPT1B = 3, GPT2A = 4, GPT2B = 5, GPT3A = 6, GPT3B = 7 } }...
use std::io::Write; use std::path::{Path, PathBuf}; use std::process::{Command, Output, Stdio}; use clap::{App, Arg}; use serde_json as json; use sha2::{Digest, Sha256}; static DESCR: &str = " Given a Rust toolchain path and a vendor directory, this program vendors Rust std dependencies in the given vendor directory....
use super::dmmf; use crate::{ context::PrismaContext, request_handlers::{ graphql::{GraphQLSchemaRenderer, GraphQlBody, GraphQlRequestHandler}, PrismaRequest, RequestHandler, }, PrismaResult, }; use datamodel::{Configuration, Datamodel}; use hyper::header; use hyper::service::{make_servi...
use fall_tree::{File, TextEdit, TextRange, TextUnit, tu, AstNode, TextSuffix, FileEdit}; use fall_tree::search::{find_leaf_at_offset, ancestors}; use fall_tree::search::ast; use fall_tree::visitor::{visitor, process_node, process_subtree_bottom_up}; use fall_editor::{EditorFileImpl, gen_syntax_tree, FileStructureNode};...
//! The template module owns the finding and rendering of parameter templates that used to generate //! SSM parameter names and values. use super::{BuildContext, SsmKey, SsmParameters}; use crate::aws::ami::Image; use log::trace; use rusoto_core::Region; use serde::{Deserialize, Serialize}; use snafu::{ensure, ResultE...
//! A `forc` plugin for running the fuel block explorer. //! //! Once installed and available via `PATH`, can be executed via `forc explore`. use anyhow::{anyhow, Context, Result}; use clap::Parser; use forc_util::init_tracing_subscriber; use forc_util::println_green; use serde::Deserialize; use std::{ fs::{self, ...