text
stringlengths
3.09k
13.9k
//! HMAC-SHA1 based hash. // // Copyright (c) 2016 <NAME> <<EMAIL>> // // Licensed under the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>. This file may not be copied, // modified, or distributed except according to the terms of this // license. //! //! This algorithm was developed for NetBSD. It'...
use std::prelude::v1::*; use super::super::{op, DebouncedEvent}; use std::collections::VecDeque; use std::ops::DerefMut; use std::path::PathBuf; use std::sync::mpsc; use std::sync::{ atomic::{self, AtomicBool}, Arc, SgxCondvar as Condvar, SgxMutex as Mutex, }; use std::thread; use std::time::{Duration, Instan...
//! # Driver application //! //! This module defines a top-level "driver" application which takes a path to a //! Wasm binary, as a command-line argument, and executes the binary under the //! Supervisionary kernel's supervision. //! //! # Authors //! //! [<NAME>], Systems Research Group, [Arm Research] Cambridge. //! ...
use crate::fatal; use super::*; use std::collections::BTreeMap; use std::ffi::{OsStr, OsString}; pub type Map = BTreeMap<OsString, InstallState>; #[repr(u8)] #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[non_exhaustive] pub enum InstallState { Enabled = 1, Disabled = 2, A...
//! Simple containers to track images and perform operations on them. use std::io::{Read, Write}; #[derive(Debug, Clone, Copy, PartialEq, Eq)] enum ImageFormat { Rgba8, } impl ImageFormat { fn stride(&self) -> u32 { match self { ImageFormat::Rgba8 => 4, } } } #[derive(Debug, ...
use crate::cluster::ClusterConnection; use crate::cmd::{cmd, Cmd}; use crate::types::{from_redis_value, ErrorKind, FromRedisValue, RedisResult, ToRedisArgs, Value}; use std::collections::HashSet; pub(crate) const UNROUTABLE_ERROR: (ErrorKind, &str) = ( ErrorKind::ClientError, "This command cannot be safely rou...
// Example adapted from "Hello Triangle", available at the following URL: // https://www.khronos.org/assets/uploads/books/openglr_es_20_programming_guide_sample.pdf use aureum::{Api, ContextBuilder}; use gl::types::*; use std::ffi::{CStr, CString}; use std::{mem, ptr}; use stdweb::js; use stdweb::unstable::TryInto; us...
use crate::proto::services as pb_service; use std::cell::Cell; use tokio::sync::Mutex; pub struct SystemService { stop_tx: Mutex<Cell<Option<futures::channel::oneshot::Sender<()>>>>, reload_tx: Mutex<Cell<futures::channel::mpsc::Sender<()>>>, pool: sqlx::PgPool, } impl SystemService { pub fn new( ...
#[derive(Serialize,Deserialize,Copy,Clone,Debug,PartialEq)] pub enum U2fRequestType { #[serde(rename="u2f_register_request")] RegisterRequest, #[serde(rename="u2f_sign_request")] SignRequest, } #[derive(Serialize, Deserialize,Clone,Debug,PartialEq)] #[serde(tag="type")] pub enum U2fRequest { #[se...
use std::{ env, net::{AddrParseError, IpAddr, Ipv4Addr}, num::ParseIntError, }; use tokio::net; #[derive(Debug)] pub struct CliArgumentError { kind: String, } impl CliArgumentError { pub fn new(msg: &str) -> Self { CliArgumentError { kind: msg.to_string(), } } } i...
use bytes::Bytes; use crate::messages::submessages::submessage_elements::parameter_list::ParameterList; use crate::messages::submessages::submessage_elements::serialized_payload::SerializedPayload; use crate::messages::submessages::submessages::*; use crate::structure::guid::EntityId; use crate::structure::sequence_num...
use std::collections::HashMap; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Operator { name: String, symbol: String, fix: OperatorFix, precedence: OperatorPrecedence, } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum OperatorFix { Infix, Prefix, Post...
use crate::prelude::*; use std::collections::VecDeque; /// [Merkle Tree](https://en.wikipedia.org/wiki/Merkle_tree) used to validate and prove data at /// each block height. /// Our implementation uses binary hash tree. #[derive(Debug)] pub struct MerkleTree { root_node: Node, } impl MerkleTree { pub fn new()...
//! Functions and types relating to color. use crate::error::{Result, TetraError}; /// An RGBA color. /// /// The components are stored as `f32` values in the range of 0.0 to 1.0. /// If your data is made up of bytes or hex values, this type provides /// constructors that will carry out the conversion for you. /// //...
use std::io; use std::io::Write; use std::sync::mpsc::{channel, Receiver, Sender}; use std::thread; use crossterm::event::KeyEvent; use crossterm::terminal::{size, ClearType}; use crossterm::tty::IsTty; use crossterm::{ cursor::{MoveTo, RestorePosition, SavePosition}, event::{KeyCode, KeyModifiers}, execut...
use crate::{ key::ed25519::PublicKey, passport::block::{ entry::{DeregisterMasterKeySlice, RegisterMasterKeySlice, SetSharedKeySlice}, BlockSlice, ContentSlice, EntrySlice, Hash, HeaderSlice, Previous, Time, }, }; use std::{ collections::{BTreeMap, HashSet}, sync::Arc, }; use thiserr...
use crate::{ TaskBase64Hash, AGENT_ID, COUNTER_ID, COUNTER_WASM_BYTES, CRON_MANAGER_WASM_BYTES, MANAGER_ID, USER_ID, }; use near_primitives_core::account::Account as PrimitiveAccount; use near_sdk::json_types::Base64VecU8; use near_sdk::serde_json; use near_sdk::serde_json::json; use near_sdk_sim::account::Acce...
//! A simple demonstration of how to construct and use Canvasses by splitting up the window. #[macro_use] extern crate conrod; extern crate find_folder; extern crate piston_window; use piston_window::{EventLoop, OpenGL, PistonWindow, UpdateEvent, WindowSettings}; fn main() { const WIDTH: u32 = 800; const HEI...
use advent_lib::cases::{GenericPuzzleCase, PuzzleCase, PuzzleRunner}; use std::collections::HashMap; use std::ops::{Add, AddAssign}; use std::str::FromStr; use std::{cmp, fmt}; #[derive(Debug)] pub struct Part2; impl PuzzleRunner for Part2 { type Input = (&'static str, usize); type Output = usize; fn nam...
#![deny(unused_must_use)] use futures::stream::StreamExt; use signal_hook::consts::signal::*; use signal_hook_tokio::Signals; use sorock_core::*; use std::path::Path; use std::time::Duration; mod fd_app_out_impl; #[derive(serde::Deserialize, Debug)] struct Config { #[serde(with = "http_serde::uri")] uri: toni...
// Copyright Rivtower Technologies 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 // // Unless required by applicable law or agreed ...
extern crate andrew; extern crate smithay_client_toolkit as sctk; use std::io::{Read, Seek, SeekFrom, Write}; use std::sync::{Arc, Mutex}; use std::time::{Duration, Instant}; use sctk::utils::{DoubleMemPool, MemPool}; use sctk::window::{ConceptFrame, Event as WEvent, Window}; use sctk::Environment; use sctk::reexpor...
// An interval extension of exp(x), exp2(x) and exp10(x). Not tightest, but simple. #![allow(clippy::approx_constant)] use inari::*; // To compute exp(x), change the base to 2 using the relation: // // exp(x) = 2^(lg(e) x). // // Now consider computing 2^x. Let D = [-1/2, 1/2]. // Decompose x into an integer and a...
//! A UI framework for Rust based on the KISS principle: "Keep It Simple, Stupid!" //! //! Built on top of the [IUP GUI library for C.][iup] //! //! ##Note: "valid KISS-UI context" //! All KISS-UI static widget methods will panic if called before `kiss_ui::show_gui()` is invoked or //! after it returns. //! //! This i...
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; #[cfg(feature = "rustls-native-roots")] use tokio_rustls::rustls::Certificate; #[cfg(feature = "rustls-webpki-roots")] use tokio_rustls::rustls::OwnedTrustAnchor; #[cfg(feature = "__rustls")] use tokio_rustls::rustls::{ClientConfig, RootCertStore, ServerName}; #[cfg(fea...
/** * [0529] Minesweeper * * Let's play the minesweeper game (<a href="https://en.wikipedia.org/wiki/Minesweeper_(video_game)" target="_blank">Wikipedia</a>, <a href="http://minesweeperonline.com" target="_blank">online game</a>)! * You are given an m x n char matrix board representing the game board where: * * ...
// 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
use std::marker::PhantomData; use crate::kernel::decl::{WinResult, WString}; use crate::msg::cb; use crate::prelude::UserHwnd; use crate::user::decl::HWND; /// Exposes item methods of a [`ComboBox`](crate::gui::ComboBox) control. /// /// You cannot directly instantiate this object, it is created internally b...
//! An [`ErasureCode`] implementation based on [openstack/liberasurecode]. //! //! [`ErasureCode`]: ../trait.ErasureCode.html //! [openstack/liberasurecode]: https://github.com/openstack/liberasurecode use crate::libec; use std::num::NonZeroUsize; use trackable::error::ErrorKindExt; use crate::{BuildCoder, ErasureCode...
extern crate proc_macro; #[macro_use] extern crate quote; use proc_macro::TokenStream; use proc_macro2::{Ident, Span}; use syn::parse::{Parse, ParseStream, Result}; use syn::punctuated::Punctuated; use syn::Token; use syn::{parse_macro_input, Error}; #[proc_macro_attribute] pub fn derive_io(args: TokenStream, input: ...
// Copyright 2018 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 fuchsia_async as fasync; use fuchsia_zircon as zx; use futures::{channel::mpsc, FutureExt, Stream, StreamExt}; use crate::sink::UnboundedSink; // TOD...
//! The primary implementation of the `zebra_state::Service` built upon sled use super::{RequestBlock, Response, QueryType}; use crate::Config; // use std::path::{Path, PathBuf}; use futures::prelude::*; use std::sync::Arc; use std::{ error, future::Future, pin::Pin, task::{Context, Poll}, }; use tower:...
//! This module contains the logic to style an object that contains some 'content' which can be styled. use std::fmt::{self, Display, Formatter}; use std::result; use crate::queue; use super::{Attribute, Color, Colorize, ObjectStyle, ResetColor, SetAttr, SetBg, SetFg, Styler}; /// A styled object. /// /// # Example...
use crate::core::{Card, Hand, Suit, Value}; /// Enum to represent how the suits of a hand correspond to each other. /// `Suitedness::Suited` will mean that all cards have the same suit /// `Suitedness::OffSuit` will mean that all cards have the different suit /// `Suitedness::Any` makes no promises. #[derive(Debug, Eq...
extern crate bmp; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use common; use common::AocResultType; use common::AocResult; // TODO: dynamically allocate memory, this causes stack overflow otherwise struct LedMatrix { // matrix: [[bool; 1000]; 1000], matrix: Vec<Vec<bool>>, // tun...
// Copyright Materialize, Inc. and contributors. All rights reserved. // // Use of this software is governed by the Business Source License // included in the LICENSE file. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by ...
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use diem_types::trusted_state::TrustedState; use std::{ convert::Infallible, sync::{Arc, RwLock}, }; /// A `StateStore` provides persistent, durable storage for /// [`VerifyingClient`](crate::VerifyingClient)s' latest [`Trusted...
use std::collections::HashSet; use std::convert::TryInto; use std::fs::File; use std::{io, mem, str}; use meilisearch_tokenizer::token::SeparatorKind; use meilisearch_tokenizer::{Analyzer, AnalyzerConfig, Token, TokenKind}; use roaring::RoaringBitmap; use serde_json::Value; use super::helpers::{concat_u32s_array, cre...
pub use crate::mqtt::packets::connack::ConnAckPacket; pub use crate::mqtt::packets::connect::ConnectPacket; pub use crate::mqtt::packets::disconnect::DisconnectPacket; use crate::mqtt::packets::puback::PubAckPacket; use crate::mqtt::packets::pubcomp::PubCompPacket; pub use crate::mqtt::packets::publish::PublishPacket; ...
// Copyright 2018 Syn Developers // // 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 according ...
use std::{path::Path, sync::Arc}; const SAMPLE_COUNT: rend3::types::SampleCount = rend3::types::SampleCount::One; /// The application data, can only be obtained at `setup` time, so it's under an /// Option in the main struct. struct InitializedData { loaded_scene: rend3_gltf::LoadedGltfScene, loaded_instance:...
/// This macro will set up your plugin's actual callability from HexChat. /// /// # Example /// /// ```rust /// use hexchat::{Plugin, plugin} /// struct MyPlugin; /// impl Plugin for MyPlugin { /// //... /// # const NAME: &'static str = "myplugin"; /// # fn new() -> Self { /// # Self /// # } /// } /...
use std::io::{Read, Write}; use ahash::AHashMap; use cfg_if::cfg_if; use compact_str::CompactStr; use wasmtime::{ AsContext, AsContextMut, Caller, Config, Engine, Extern, Instance, Linker, Memory, MemoryType, Module, OptLevel, Store, StoreContext, StoreContextMut, }; use crate::wasm::rt::context::Context;...
use std::{ io::{self, Error, ErrorKind}, mem, net::SocketAddr, os::unix::io::AsRawFd, }; use async_trait::async_trait; use log::warn; use shadowsocks::net::{is_dual_stack_addr, set_tcp_fastopen, AcceptOpts}; use socket2::SockAddr; use tokio::net::{TcpListener, TcpSocket, TcpStream}; use crate::{ c...
use quick_xml::events::{Event, BytesDecl}; use quick_xml::Writer; use std::io; use ::structs::Worksheet; use super::driver::*; use super::XlsxError; const SUB_DIR: &'static str = "xl/worksheets/_rels"; pub(crate) fn write<W: io::Seek + io::Write>( worksheet: &Worksheet, p_worksheet_id: &str, drawing_id: ...
use control_code::nom::{ErrorKind, IResult}; use control_code::C1::ControlSequence; use control_code::CSI; use control_code::SGR; use control_code::{Control, C0}; use crate::rgb_color::RgbColor; use crate::xcowsay::{DrawString, EraseMode, SetCursor, SetDisplay}; use control_code::CSI::Erase; use std::collections::Has...
use anyhow::{bail, Result}; use genco::prelude::*; use serde::{de, Deserialize}; use std::borrow::Cow; use std::collections::HashMap; #[derive(Debug, Deserialize)] struct Base { variant: String, names: Vec<String>, unit: String, prefix_bias: Option<i32>, } #[derive(Debug, Deserialize)] struct Derived ...
use std::thread; use crate::{ backend::{RevisionEntry, RevisionInfo}, mode::{Filter, ModeContext, ModeResponse, ModeStatus, Output, SelectMenu, SelectMenuAction}, platform::Key, ui::{Drawer, RESERVED_LINES_COUNT}, }; pub enum Response { Info(RevisionInfo), Diff(String), } enum State { Idl...
use chrono::{Duration, NaiveDate, Utc}; use humantime; use simple_error::{bail, SimpleError, SimpleResult}; use std::error::Error; use std::fmt; use std::num::ParseFloatError; static DATE_FORMAT: &str = "%Y-%m-%d"; static TODAY: &str = "today"; #[derive(Debug, Clone)] pub struct Record { pub date: NaiveDate, ...
use cairo; use proto; #[derive(Clone, Copy, Debug)] pub struct Color { r: u8, g: u8, b: u8, a: u8, } impl Color { pub const WHITE: Color = Color{r: 255, g: 255, b: 255, a: 255}; pub const BLACK: Color = Color{r: 0, g: 0, b: 0, a: 255}; pub fn from_u8s(r: u8, g: u8, b: u8, a: u8) -> Color ...
use std::path::Path; /// 解析 `*.lc` 文件中的一条日线数据,即其 32 个字节所代表的所有信息。 /// /// 注意:这个类型只对 `*.lc` 文件进行了初步解析, /// 所以日期 `date` 和股票代码 `code` 都是 `u32` 类型, #[derive(Debug, Clone, Copy)] pub struct Lc { pub date: u16, pub min: u16, pub code: u32, pub open: f32, pub high: f32, pub low: f32, ...
use dotenv; use rocket::fairing::AdHoc; use rocket::{ignite, Rocket, State}; use rocket::http::{Cookies, Method}; use rocket_contrib::{Json, Template}; use rocket_cors::{Cors, AllowedOrigins, AllowedHeaders}; use serde_json::Value; use db::{init_db_pool, DbConn, Pagination}; use email::{Emailer, init_emailer, dummy_em...
use amethyst::{ core::{Parent, Transform, SystemDesc, bundle::SystemBundle}, derive::SystemDesc, ecs::{World, Entities, Entity, Join, Read, System, SystemData, Write, WriteStorage, DispatcherBuilder}, renderer::resources::Tint, renderer::SpriteRender, shrev::{EventChannel, ReaderId}, Result,...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use crate::reason::Reason; use crate::typing_defs::tyvar::Tyvar; use hcons::Hc; use ocamlrep::{Allocator, OpaqueValue, ToOcamlRep}; use ...
//! Decoder for lap data packets sent by F1 2019 //! //! The lap data packets by F1 2018 and F1 2019 differ only in their packet headers, the rest of the //! packet format is identical. use std::io::{Cursor, Error, ErrorKind}; use std::time::Duration; use bytes::{Buf, BytesMut}; use crate::nineteen::header::decode_h...
use bevy::prelude::*; use bevy::render::texture::{SamplerDescriptor, FilterMode}; const SHIP_ROTATION: f32 = std::f32::consts::PI; const SHIP_ACCELERATION: f32 = 25.0; const SPRITE_HEIGHT: f32 = 34.0; const SPRITE_WIDTH: f32 = 16.0; const SPRITE_DELAY: f32 = 0.2; struct Materials { ship_material: Handle<ColorMate...
// 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::common::{ extract_expected, extract_min_length, extract_unique_items, gen_visit_seq, ident_from_path, }, proc_macro2::Toke...
/* DVI op codes */ pub const SET_CHAR_0: u8 = 0; pub const SET_CHAR_1: u8 = 1; /* etc. */ pub const SET_CHAR_127: u8 = 127; pub const SET1: u8 = 128; /* Typesets its single operand between 128 and 255 */ pub const SET2: u8 = 129; /* Typesets its single two byte unsigned operand */ pub const SET3: u8 = 130; /* Typesets ...
//! Manipulate lines of text and groups of lines. use crate::positions::SingleLineSpan; use lazy_static::lazy_static; use regex::Regex; use std::{cmp::max, fmt}; /// A distinct number type for line numbers, to prevent confusion with /// other numerical data. /// /// Zero-indexed internally. #[derive(Clone, Copy, Part...
//! Provide the means to persist a Supervisor's own incarnation //! number across restarts. use crate::{error::{Error, Result}, member::Incarnation}; use habitat_core::fs::atomic_write; use std::{fs::File, io::{self, Read}, num, path::{Path, ...
use core::ptr; use core::u16; use interrupts::{self, HandlerFn}; use io::irq::{self, Interrupt}; const TIMER_BASE: u32 = 0x10003000u32; #[derive(Clone, Copy)] #[allow(non_camel_case_types)] enum Reg { VAL_0 = 0x00, VAL_1 = 0x04, VAL_2 = 0x08, VAL_3 = 0x0C, CNT_0 = 0x02, CNT_1 = 0x06, CNT...
use async_std::io; use async_tls::TlsAcceptor; use clap::{App, Arg}; use daemonize::Daemonize; use rustls::{ internal::pemfile::{certs, pkcs8_private_keys}, Certificate, NoClientAuth, PrivateKey, ServerConfig, }; use std::{fs::File, io::BufReader, path::Path, sync::Arc}; #[derive(Debug, Clone)] pub struct Con...
use std::sync::Arc; use dacite::core::{Pipeline, PipelineBindPoint, PipelineLayout, PrimitiveTopology, CullModeFlags, FrontFace, CommandBuffer, Extent2D, Offset2D, Rect2D, SpecializationInfo, SpecializationMapEntry, PushConstantRange, ShaderSt...
use super::AudioMeta; use super::AudioReaderError; use fon::mono::Mono16; use fon::stereo::Stereo16; use fon::{Audio, Sink, Stream}; use lewton::VorbisError; use lewton::audio::AudioReadError; use lewton::inside_ogg::OggStreamReader; use log::{debug, warn}; use std::{convert::AsRef, iter::Zip}; use std::fs::File; use s...
// 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 std::collections::HashSet; use std::convert::TryFrom; use std::fs::File; use std::io::Read; use std::path::Path; use std::time::{SystemTime, UNIX_EPOCH...
#![crate_name = "factor"] #![feature(collections, core, io, rustc_private)] /* * This file is part of the uutils coreutils package. * * (c) <NAME> <<EMAIL>> * * For the full copyright and license information, please view the LICENSE file * that was distributed with this source code. */ extern crate getopts; extern cr...
use std::fmt; use super::nes::KILOBYTE; use super::cart::Cartridge; const LAST_VISIBLE: u8 = 239; // 240 Total, 0 indexed const LAST_VBLANK: u8 = 20; pub struct Ppu { registers: Registers, cycles: usize, current_scanline: Scanline, pixel_shift_register: [u8; 2], ram: [u8; 2 * KILOBYTE], oam: ...
pub const GDBM_READER: ::std::os::raw::c_uint = 0; pub const GDBM_WRITER: ::std::os::raw::c_uint = 1; pub const GDBM_WRCREAT: ::std::os::raw::c_uint = 2; pub const GDBM_NEWDB: ::std::os::raw::c_uint = 3; pub const GDBM_FAST: ::std::os::raw::c_uint = 16; pub const GDBM_SYNC: ::std::os::raw::c_uint = 32; pub const GDBM_N...
#![allow(dead_code)] pub const BOOTBOOT_MAGIC: &'static [u8; 5usize] = b"BOOT\0"; pub const PROTOCOL_MINIMAL: u32 = 0; pub const PROTOCOL_STATIC: u32 = 1; pub const PROTOCOL_DYNAMIC: u32 = 2; pub const PROTOCOL_BIGENDIAN: u32 = 128; pub const LOADER_BIOS: u32 = 0; pub const LOADER_UEFI: u32 = 4; pub const LOADER_RPI: u...
extern crate clap; #[macro_use] extern crate glium; extern crate rand; mod grid; mod screen; mod types; use glium::Surface; use glium::glutin::{ContextBuilder, WindowBuilder, EventsLoop}; use glium::glutin::{Event, WindowEvent, ElementState, KeyboardInput, MouseButton, VirtualKeyCode}; use grid::*; use screen::*; /...
use crate::runner::{AocRunner, AocResult}; pub mod aoc1; pub mod aoc2; pub mod aoc3; pub mod aoc4; pub mod aoc5; pub mod aoc6; pub mod aoc7; pub mod aoc8; pub mod aoc9; pub mod aoc10; pub mod aoc11; pub mod aoc12; pub mod aoc13; pub mod aoc14; pub mod aoc15; pub mod aoc16; pub mod aoc17; pub mod aoc18; pub mod aoc19; ...
//! This module provides builders for integrating the [`annotate-snippets`] crate with Mun. //! //! [`annotate-snippets`]: https://docs.rs/annotate-snippets/0.6.1/annotate_snippets/ use annotate_snippets::snippet::{Annotation, AnnotationType, Slice, Snippet, SourceAnnotation}; use mun_hir::line_index::LineIndex; use ...
/* Render font texture * * Controls: * Escape quit * mouse wheel zoom in/out */ #[macro_use] extern crate glium; extern crate sdf_text; use std::env; use std::time; use glium::{glutin, Surface}; use glium::glutin::{Event, WindowEvent, ElementState, VirtualKeyCode, MouseScrollDelta, TouchP...
use std::fmt::{self, Display, Formatter}; use std::mem; use std::pin::Pin; use std::task::{Context, Poll}; use bytes::{Buf, Bytes}; use futures_core::{ready, Stream}; use http_body::Body; use pin_project_lite::pin_project; use crate::error::Error; /// Creates an enum with `AsRef<str>` impl. macro_rules! str_enum { ...
#[derive(Parser)] #[grammar = "ts_interface.pest"] pub struct TsInterfaceParser; use pest::{error::Error, iterators::Pair, Parser}; use proc_macro2::TokenStream; #[derive(Debug, PartialEq, Eq)] pub struct TsAttribute { pub name: String, pub ts_type: String, } #[derive(Debug, PartialEq, Eq)] pub struct TsInte...
use std::cmp::{min, max}; use std::collections::HashSet; use std::fmt; use std::io::{self, Read}; struct Image { x_min: isize, x_max: isize, y_min: isize, y_max: isize, lit_infinite: bool, lit_pixels: HashSet<[isize; 2]>, // [x, y] } impl Image { fn parse(s: &str) -> Image { let wi...
use crate::bitbucket::types::Repo; use crate::types::GitOpts; use crate::util::{bail, exec}; use generic_error::Result; use std::path::Path; #[derive(Clone)] pub struct SingleGit<'a, 'b> { repo: &'a Repo, opts: &'b GitOpts, } impl SingleGit<'_, '_> { pub fn new<'a, 'b>(repo: &'a Repo, opts: &'b GitOpts) -...
//! Process HTTP connections on the server. use std::pin::Pin; use std::time::Duration; use async_std::future::{pending, timeout, Future, TimeoutError}; use async_std::io::{self, BufReader, Read, Write}; use async_std::prelude::*; use futures_util::io::AsyncBufReadExt; use http_types::headers::{CONNECTION, UPGRADE}; ...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00..0x20 - Description collection: Task for writing to pin specified in CONFIG\\[n\\].PSEL. Action on pin is configured in CONFIG\\[n\\].POLARITY."] pub tasks_out: [crate::Reg<tasks_out::TASKS_OUT_SPEC>; 8], _reserved1: [u8; 0x10], ...
// Copyright Rivtower Technologies 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 // // Unless required by applicable law or agreed ...
extern crate kmpsearch; use crate::parser::PdfObject; use crate::parser::XrefTable; use crate::PdfError; use crate::{ recognize_pdf_cross_reference, recognize_pdf_startxref, recognize_pdf_version, NameMap, PdfVersion, }; use kmpsearch::Haystack; use nom::AsBytes; /// State of understanding of the organization...
//! Implementation of the plugin trait for running the plugin within a separate //! process. use crate::{ common::{ channel::SimulatorChannel, error::{err, inv_op, ErrorKind, Result}, log::{stdio::proxy_stdio, thread::LogThread}, protocol::{PluginToSimulator, SimulatorToPlugin}, ...
///! In double speed mode the following will operate twice as fast: ///! ```text ///! The CPU (8 MHz, 1 Cycle = approx. 0.5us) ///! Timer and Divider Registers ///! Serial Port (Link Cable) ///! DMA Transfer to OAM ///! ``` use crate::hardware::mmu::cgb_mem::HdmaMode::{GDMA, HDMA}; use crate::hardware::mmu::INVALID...
use itertools::iproduct; use ndarray::Array2; use std::collections::hash_map::DefaultHasher; use std::hash::Hash; use std::hash::Hasher; #[allow(unused_macros)] macro_rules! function_name { () => {{ fn f() {} fn type_name_of<T>(_: T) -> &'static str { std::any::type_name::<T>() ...
use crate::traits::Undirected; use crate::V; use std::cmp::Ordering; use std::collections::{HashMap, VecDeque}; use std::iter::FusedIterator; /// Lexicographic depth-first search structure. /// /// This structure contains the `predecessor` map. /// pub struct LexicographicDepthFirstSearch<'a, T> where T: Undirecte...
use std::time::Instant; use colored::Colorize; use rayon::prelude::*; use regex::Regex; use structopt::StructOpt; mod reg_str; use reg_str::str_to_reg; mod cli; use cli::CLIOpts; mod checksec_fmt; #[macro_use] extern crate lazy_static; fn main() { let cli = CLIOpts::from_args(); let mut filter_matches = ...
//! Sends an ephemeral message to a user in a channel. use crate::attachment::attachment::Attachment; use crate::block::blocks::Block; use crate::error::Error; use crate::http_client::{get_slack_url, ResponseMetadata, SlackWebAPIClient}; use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none; #[...
use crate::{ expr::scope::LocalScopeId, expr::BodySourceMap, ids::DefWithBodyId, resolver_for_scope, Body, ExprId, ExprScopes, FileId, HirDatabase, InFile, InferenceResult, Resolver, Ty, }; use mun_syntax::{ast, AstNode, SyntaxNode, TextRange, TextSize}; use std::sync::Arc; /// A `SourceAnalyzer` is a wrapper ...
use crate::vm; use crate::vm::ast::{AstBranch, IsValid, Valid}; use crate::vm::token; use crate::vm::token::Token; use crate::vm::transform::token_to_ast; use crate::vm::{ast, transform}; use crate::Path; use std::collections::HashSet; use std::fmt::Debug; use std::path::PathBuf; #[derive(Debug)] enum ToAstTaskState<T...
#![deny(missing_docs)] //! A library for fast, offline reverse geocoding. The location data are from [GeoNames](http://www.geonames.org/). //! //! # Usage //! ``` //! use reverse_geocoder::{Locations, ReverseGeocoder, SearchResult}; //! //! fn main() { //! let loc = Locations::from_memory(); //! let geocoder = ...
use crate::multivector::Multivector; /// Intersect two lines by taking their wedge (outer) product. This is sometimes /// called the "meet" operator, as it (unconditionally) calculates the point where /// the two lines meet. Note that this works even if the lines are parallel: the /// result will be an ideal point (i....
//! A trait that can be used to parse an item from an input. #[cfg(feature = "alloc")] use alloc::vec::Vec; use crate::error; use crate::format_description::{well_known, FormatItem}; use crate::parsing::{Parsed, ParsedItem}; /// Seal the trait to prevent downstream users from implementing it, while still allowing it...
use super::{ AllowedSlots, AuthorityId, AuthorityIndex, AuthoritySignature, BabeAuthorityWeight, BabeEpochConfiguration, SlotNumber, BABE_ENGINE_ID, }; use codec::{Codec, Decode, Encode}; use sp_std::vec::Vec; use sp_runtime::{generic::OpaqueDigestItemId, DigestItem, RuntimeDebug}; use sp_consensus_vrf::schnorrkel::...
// Copyright (c) 2017-2018, The rav1e contributors. All rights reserved // // This source code is subject to the terms of the BSD 2 Clause License and // the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License // was not distributed with this source code in the LICENSE file, you can // obtain it at ...
// Copyright 2018 The Grin Developers // Copyright 2019 The Libercoin Developers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // //...
// Service to clean up dead slots in accounts_db // // This can be expensive since we have to walk the append vecs being cleaned up. use crate::{ bank::{Bank, BankSlotDelta}, bank_forks::{BankForks, SnapshotConfig}, snapshot_package::AccountsPackageSender, snapshot_utils, }; use crossbeam_channel::{Rec...
use std::{fs::File, path::PathBuf, str::FromStr}; use anyhow::{anyhow, Result}; use clap::Parser; mod change; mod examine; mod export; mod import; mod merge; #[derive(Parser, Debug)] #[clap(about = "Automerge CLI")] struct Opts { #[clap(subcommand)] cmd: Command, } #[derive(Debug)] enum ExportFormat { J...
//! resources module //! //! This module exposes various elements of the //! stripe api depending on the features exposed. //! //! Some of these modules are hand-written, and //! some are generated. mod currency; mod generated; mod placeholders; mod types; #[path = "resources"] mod core { pub mod balance_transact...
use tch::{Kind, Reduction, Tensor}; use crate::TransformerError; trait Reduce { type Error; fn reduce(&self, t: &Tensor) -> Result<Tensor, Self::Error>; } impl Reduce for Reduction { type Error = TransformerError; fn reduce(&self, t: &Tensor) -> Result<Tensor, Self::Error> { match self { ...
use na::Matrix3; #[test] #[rustfmt::skip] fn lu_simple() { let m = Matrix3::new( 2.0, -1.0, 0.0, -1.0, 2.0, -1.0, 0.0, -1.0, 2.0); let lu = m.lu(); assert_eq!(lu.determinant(), 4.0); let (p, l, u) = lu.unpack(); let mut lu = l * u; p.inv_permute_rows(&mut lu); ...