text
stringlengths
3.09k
13.9k
use pyo3::prelude::*; use pyo3::types::PyList; use yrs::types::text::TextEvent; use yrs::{Subscription, Text, Transaction}; use crate::shared_types::SharedType; use crate::type_conversions::ToPython; use crate::y_transaction::YTransaction; /// A shared data type used for collaborative text editing. It enables multipl...
#[doc = "Reader of register EM23PERNORETAINSTATUS"] pub type R = crate::R<u32, super::EM23PERNORETAINSTATUS>; #[doc = "Reader of field `ACMP0LOCKED`"] pub type ACMP0LOCKED_R = crate::R<bool, bool>; #[doc = "Reader of field `ACMP1LOCKED`"] pub type ACMP1LOCKED_R = crate::R<bool, bool>; #[doc = "Reader of field `PCNT0LOC...
use crate::components::modal::Question; use crate::data_exchange::SetlistDeserializeService; use crate::helpers::window; use cqrs::prelude::AsyncRepositoryTrait; use libchordr::prelude::{Catalog, Setlist, SetlistEntry, SongData}; use log::{error, info}; use std::rc::Rc; use std::sync::Arc; use wasm_bindgen_futures::spa...
// This file is part of Sulis, a turn based RPG written in Rust. // Copyright 2018 <NAME> // // Sulis 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 opt...
#![allow(clippy::upper_case_acronyms)] use crate::macos::keyboard::Keyboard; use crate::rdev::{Button, Event, EventType, Key}; use cocoa::base::id; use core_graphics::event::{CGEvent, CGEventFlags, CGEventTapLocation, CGEventType, EventField}; use lazy_static::lazy_static; use std::convert::TryInto; use std::os::raw::c...
use clap::Clap; use std::path::PathBuf; use std::env; use glob::glob; use simple_logger::SimpleLogger; use log::{LevelFilter, error, info, debug, trace}; use indicatif::{ProgressBar, ProgressStyle}; use regex::Regex; mod processor; mod view; mod common; #[derive(Debug)] #[derive(Clap)] #[clap(version = clap::crate_ve...
use crate::actors::message::ActionMessage; use crate::command::Command; use crate::metrics::{ ActionMeter, ACTION_ID_LABEL_KEY, ACTION_RESULT_KEY, RESULT_FAILURE, RESULT_SUCCESS, }; use actix::{Actor, Addr, Context, Handler}; use log::*; use std::rc::Rc; use std::sync::Arc; use tornado_common_api::Action; use torna...
use std::mem; #[derive(Clone)] pub struct Node<T> { item: T, order: usize, next: Option<Box<Node<T>>>, child: Option<Box<Node<T>>>, } pub fn append<T: Ord>(root: &mut Box<Node<T>>, other: Option<Box<Node<T>>>) { if let Some(other) = other { merge(root, other); coalesce(root); }...
use regex::Regex; use std::collections::{HashMap, HashSet}; type Registers = [i32; 4]; type Operation = (i32, usize, usize, usize); type Record = (Registers, Operation, Registers); static MNEMONICS: &'static [&'static str] = &[ "addr", "addi", "mulr", "muli", "banr", "bani", "borr", "bori", "setr", "seti", "gtir"...
use regex::Regex; use sheet_music_format::kifu_kif::kif_move::*; use sheet_music_format::kifu_kif::kif_tape::*; use std::ffi::OsStr; use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::Path; use std::*; use studio::application::Application; /* Example # ---- 柿木将棋 V1.89 棋譜ファイル ---- # ファイル名:kifu\morit...
//! # warp-range //! //! A Rust library for creating a warp filter for serving file content with range like mp3 audio or mp4 video. //! This warp filter can be used in a HTTP server based on warp. //! //! The content is served like streaming. If you view a movie served by this filter, you can seek through it even if...
//! Displays a shaded sphere to the user. use amethyst::{ assets::{PrefabLoader, PrefabLoaderSystemDesc, Processor, RonFormat}, audio::{output::init_output, Source}, core::{frame_limiter::FrameRateLimitStrategy, transform::TransformBundle, Time}, derive::SystemDesc, ecs::prelude::{Entity, System, S...
use crate::eos::association::{ assoc_site_frac_a, assoc_site_frac_ab, helmholtz_energy_density_cross_association, }; use crate::parameters::PcSaftParameters; use feos_core::EosError; use feos_dft::{ FunctionalContributionDual, WeightFunction, WeightFunctionInfo, WeightFunctionShape, }; use ndarray::*; use num_d...
use assembly_data::{ fdb::{ common::{self, Latin1String}, core, store, }, xml::{ common::{expect_decl, expect_end}, database::{ expect_column_or_end_columns, expect_columns, expect_database, expect_row_or_end_rows, expect_rows, expect_table, ValueType,...
#![no_std] use cortexm4::generic_isr; pub use stm32f4xx::{adc, chip, dbg, dma1, exti, gpio, nvic, rcc, spi, syscfg, tim2, usart}; pub mod interrupt_service; pub mod stm32f429zi_nvic; // STM32F42xxx and STM32F43xxx has total of 91 interrupts #[cfg_attr(all(target_arch = "arm", target_os = "none"), link_section = ".i...
use std::collections::HashMap; use std::fmt::Write; use rustc_middle::mir::interpret::{Allocation, Pointer, PointerArithmetic}; use rustc_middle::ty::Instance; use rustc_mir::interpret::AllocId; use rustc_target::abi::Size; use crate::*; mod stack_trace; #[derive(Debug)] pub struct Traces<'tcx> { alloc_traces: ...
//! A libfuzzer-like fuzzer with llmp-multithreading support and restarts //! The example harness is built for libmozjpeg. use std::{env, path::PathBuf}; use libafl::{ bolts::{ current_nanos, rands::StdRand, tuples::{tuple_list, Merge}, }, corpus::{Corpus, InMemoryCorpus, OnDiskCor...
use crate::{ mutable::FullName, store::file::{self, loose::Reference}, }; use bstr::ByteSlice; use git_features::fs::walkdir::DirEntryIter; use os_str_bytes::OsStrBytes; use std::{ io::Read, path::{Path, PathBuf}, }; /// An iterator over all valid loose reference paths as seen from a particular base di...
use filetree::FileTreeNode; use filetree::DirectoryNode; use std::collections::HashMap; use std::fs::File; use std::path::PathBuf; use std::io::Read; #[derive(Debug)] pub struct TestEnvironments { pub environments: Vec<TestEnvironment> } #[derive(Debug)] pub struct TestEnvironment { pub name: String, pub...
use std::fmt; #[derive(Copy, Clone)] #[allow(dead_code)] pub enum Register { A, B, C, D, E, F, H, L, AF, BC, DE, HL, SP, PC } impl fmt::Display for Register { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { Register::...
use crate::prelude::*; use csv::WriterBuilder; use indexmap::{indexset, IndexSet}; use nu_errors::ShellError; use nu_protocol::{Primitive, ReturnSuccess, UntaggedValue, Value}; use nu_source::Spanned; use nu_value_ext::{as_string, get_data_by_key}; fn from_value_to_delimited_string( tagged_value: &Value, separ...
// Copyright (c) Microsoft. All rights reserved. pub(crate) struct Route<M> where M: edgelet_core::ModuleRuntime + Send + Sync, { runtime: std::sync::Arc<futures_util::lock::Mutex<M>>, pid: libc::pid_t, module: String, start: Option<String>, } #[async_trait::async_trait] impl<M> http_common::serve...
use serde::Deserialize; use crate::{ DateTime, Utc, Url, }; use super::{ Emoji, Entity, Privacy, }; /// Represents a user of Mastodon and their associated profile. #[derive(Debug, Clone, Deserialize, mastors_derive::Entity)] pub struct Account { // Base attributes #[mastors(identifier)]...
//! Implementation of Rust panics via process aborts //! //! When compared to the implementation via unwinding, this crate is *much* //! simpler! That being said, it's not quite as versatile, but here goes! #![no_std] #![unstable(feature = "panic_abort", issue = "32837")] #![doc(issue_tracker_base_url = "https://githu...
use std::path::PathBuf; use actix::prelude::*; use actix_web::middleware::identity::{CookieIdentityPolicy, IdentityService, RequestIdentity}; use actix_web::middleware::{Middleware, Started}; use actix_web::{ self, middleware, App, AsyncResponder, Form, FutureResponse, HttpRequest, HttpResponse, State, }; use aska...
use super::{command::CommandError, Attribute, Command, Game, Position, Target, TurnKind}; use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] pub struct Character { pub id: i32, pub crowd_controls: CharacterCrowdControl, pub position: Position, pub controller: Controller, ...
use super::*; use arrayvec::ArrayVec; #[cfg(feature = "std")] use nom::error::{ VerboseError, VerboseErrorKind::{Context, Nom}, }; use nom::{ error::ErrorKind::TooLarge, Err::{Error, Incomplete}, }; use num_traits::{AsPrimitive, PrimInt, Signed, Unsigned}; // TODO: when https://github.com/rust-lang/rus...
// 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 fidl::endpoints::ServiceMarker; use fidl_fuchsia_settings::{ LightError, LightGroup, LightMarker, LightRequest, LightState, LightWatchLightGroupRes...
use std::cell::RefCell; use std::collections::HashMap; use std::fs::File; use std::io::BufReader; use std::path::Path; use std::thread_local; use std::time::{Duration, Instant}; use anyhow::Result; use ggez::{ event::{self, EventHandler, EventsLoop, KeyCode, KeyMods}, graphics::Color, }; use ggez::{timer, Cont...
use serde::{Deserialize, Serialize}; use crate::config::ConfigOptions; // https://de.wikipedia.org/wiki/M3U // https://siptv.eu/howto/playlist.html #[derive(Debug, Clone, Serialize, Deserialize)] pub struct PlaylistItemHeader { pub id: String, pub name: String, pub logo: String, pub logo_small: String,...
//! The module containing [`Searcher`] presenter. See [`crate::presenter`] documentation to know //! more about presenters in general. pub mod provider; use crate::prelude::*; use crate::controller::searcher::Notification; use crate::controller::searcher::UserAction; use crate::executor::global::spawn_stream_handler...
mod attribute; mod attribute_schema; mod attribute_type; mod error; mod fragment1; mod fragment2; mod holder; mod issuer; mod offer; mod presentation; mod presentation_manifest; mod request; mod schema; mod util; mod verifier; pub use attribute::*; pub use attribute_schema::*; pub use attribute_type::*; pub use error:...
use anyhow::Error; use futures::{future::join, StreamExt}; use lazy_static::lazy_static; use log::debug; use stack_string::StackString; use std::collections::HashSet; use telegram_bot::{types::refs::UserId, Api, CanReplySendMessage, MessageKind, UpdateKind}; use tokio::{ sync::{ mpsc::{channel, Receiver}, ...
//! //! A collection of light types. //! Currently implemented light types are ambient light, directional light, spot light and point light. //! Directional and spot lights can cast shadows. //! mod directional_light; #[doc(inline)] pub use directional_light::*; mod spot_light; #[doc(inline)] pub use spot_light::*; ...
#![allow(non_snake_case, non_upper_case_globals)] #![allow(non_camel_case_types)] //! ETH_DMA //! //! Used by: stm32mp153, stm32mp157 #[cfg(not(feature = "nosync"))] pub use crate::stm32mp::peripherals::eth_dma::Instance; pub use crate::stm32mp::peripherals::eth_dma::{ ETH_DMAA4RxACR, ETH_DMAA4TxACR, ETH_DMAC0CARx...
//! Http server use std::net::Shutdown; use std::{io, time}; use bytes::BytesMut; use futures::{Async, Poll}; use tokio_io::{AsyncRead, AsyncWrite}; use tokio_tcp::TcpStream; mod channel; pub(crate) mod encoding; pub(crate) mod h1; pub(crate) mod h1decoder; mod h1writer; mod h2; mod h2writer; pub(crate) mod helpers; ...
#[macro_use] extern crate log; use std::sync::{Arc}; use std::sync::mpsc::{channel, Sender, Receiver}; use std::sync::atomic::{AtomicUsize, AtomicBool, Ordering}; use std::thread; use std::time::Duration; pub type Handler<T> = Fn(T) -> Result<(),()>; pub struct WorkerPool<T: 'static + Send + ?Sized, H: 'static + S...
// Copyright 2020 The Druid Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
use ggez::graphics::{Color as ggezColor, DrawParam, Point2, Rect}; use std::{ collections::{BinaryHeap, HashMap}, i32::MAX, }; use config::Config; use draw::Drawable; use geometry::{OrdPosition, Position}; use port::Port; use ship::Ship; use tile::{Tile, TileKind}; use world::World; mod routebuilder; mod shap...
use colored::Colorize; use rayon::prelude::*; pub mod config; pub mod room; use roomservice::room::RoomBuilder; use std::path::Path; use util::fail; #[derive(Debug)] pub struct RoomserviceBuilder { pub before_all: Option<String>, pub rooms: Vec<room::RoomBuilder>, pub after_all: Option<String>, projec...
use crate::render_features::render_features_prelude::*; use fnv::{FnvHashMap, FnvHasher}; use std::hash::{BuildHasherDefault, Hash}; /// The `FramePacket` is the data that must be extracted from either the `AssetManager` or the game's /// `World` during the `Extract` step. After the `Extract` step has finished, there ...
//! Helpers for writing pools for objects that don't support async and need to //! be run inside a thread. pub mod reexports { //! This module contains all things that should be reexported //! by backend implementations in order to avoid direct //! dependencies on the `deadpool` crate itself. //! /...
mod lib; use futures::channel::mpsc::{channel, Receiver, Sender}; use futures::executor::block_on; use futures::join; use lib::*; use log; use signal_hook::{consts::SIGINT, iterator::Signals}; use std::thread; use std::sync::Arc; use clap::ArgMatches; use env_logger::{Builder, Env, Target}; use crate::lib::configur...
// // This file is part of monitaringu-rei // // Copyright (C) 2021 <NAME> <<EMAIL>> // // SPDX-License-Identifier: MIT // use gettextrs::gettext; use gio::{self, prelude::*, subclass::prelude::*}; use glib::subclass; use glib::translate::*; use glib::{clone, glib_object_impl, glib_object_subclass, glib_wrapper}; use ...
use std::str::Utf8Error; use std::{borrow::Cow, io, result}; use thiserror::Error; use url::ParseError; use crate::types::SqlType; #[derive(Debug, Error, Clone, Eq, PartialEq)] #[error("{} {} {}", name, code, message)] pub struct Exception { pub name: String, pub code: u32, pub message: String, #[cfg...
use crate::app::components::EventListener; use crate::app::AppEvent; use crate::settings::SpotSettings; use gtk::prelude::*; use gtk::subclass::prelude::*; use gtk::CompositeTemplate; use libadwaita::prelude::*; use super::SettingsModel; const SETTINGS: &str = "dev.alextren.Spot"; mod imp { use super::*; u...
//! Mocks for the evm-bridge module. #![cfg(test)] use super::*; use frame_support::{construct_runtime, ord_parameter_types, parameter_types}; use frame_system::EnsureSignedBy; use module_evm::GenesisAccount; use primitives::{evm::EvmAddress, mocks::MockAddressMapping}; use sp_core::{bytes::from_hex, crypto::AccountI...
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] #[macro_use] extern crate num_derive; #[macro_use] extern crate strum_macros; use config::{rule::Rule, Config}; use crossbeam_channel::select; use display::Display; use event::Event; use event::EventChannel; use hot_reload::update_config; use lazy_sta...
//! ioctl show helpers use core::fmt; use nix::unistd::Pid; use std::collections::HashMap; use std::convert::TryFrom; /// ioctl requests: only a subset is defined #[derive(Clone, Copy, Debug)] enum IoctlRequest { /* termios */ TCGETS = 0x5401, TCSETS = 0x5402, TCSETSW = 0x5403, TCSETF = 0x5404, ...
//! Wrap an io::Read instance in a background thread. use std::mem::replace; use std::io::{self, Read, Write}; use std::sync::mpsc::{channel, Receiver, Sender}; use super::crossbeam; #[derive(Debug)] struct Buffer { data: Box<[u8]>, pos: usize, end: usize, // read returned n = 0 -> EOF eof: bool, ...
use std::marker::PhantomData; use crate::dwarf::DwarfUnwinderError; use crate::{arch::Arch, unwind_rule::UnwindRule}; use macho_unwind_info::UnwindInfo; #[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Eq)] pub enum CompactUnwindInfoUnwinderError { #[error("Bad __unwind_info format: {0}")] BadFormat(...
use chrono::naive::{NaiveDate, NaiveTime}; use crate::types::{ coordinate, coordinate::{latitude, longitude, U_DEGREE}, }; #[derive(Debug, Copy, Clone, Default, PartialEq)] pub struct Valid(u8); impl Valid { pub fn valid_date(self) -> bool { self.0 & (1 << 0) > 0 } pub fn valid_time(self...
use crate::harness::suites::html5lib_tests::{ get_test_cases, TestCase, TestToken, TestTokenList, }; use crate::harness::{TestFixture, Input}; use lol_html::{ LocalNameHash, TokenCaptureFlags, LocalName, Token, StartTagHandlingResult, TransformController, TransformStream, Namespace, TransformStreamSettings,...
use crate::render::ExtraShapeID; use crate::ui::PerMapUI; use abstutil::Timer; use ezgui::Color; use geom::Pt2D; use map_model::{AreaID, BuildingID, BusStopID, IntersectionID, LaneID, RoadID, TurnID}; use serde_derive::{Deserialize, Serialize}; use sim::{AgentID, CarID, PedestrianID}; use std::collections::{BTreeMap, H...
//! This module is supposed to handle reporting of problems during compilation. use file_handle::FileHandle; use std::sync::Arc; use std::sync::Mutex; use std::cmp::{max, min}; /// Resets the visual appearance of text in a terminal. const RESET: &str = "\x1B[0m"; /// Sets the text to bold text. const BOLD: &str = "\...
use std::net::SocketAddr; use crate::common::{Id, TransactionId}; use crate::packets::{Message, MessageType}; use std::time::{Duration, Instant}; use log::debug; use tokio::sync::mpsc; pub struct OutboundRequestStorage { requests: std::collections::HashMap<TransactionId, RequestInfo>, } impl OutboundRequestSto...
use std::fs::File; use std::io::Read; use std::net::{IpAddr, SocketAddr}; use std::path::Path; use std::sync::Arc; use std::time::Duration; use anyhow::{Context, Result}; use log::{error, info}; use tokio::net::TcpListener; use tokio::runtime::Runtime; use crate::config::ProxyConfiguration; use crate::transport::{Tra...
use crate::lang::Language; use crate::StdErr; use clap::ArgMatches; use std::collections::HashMap; use std::env; use std::io; use std::path::{Path, PathBuf}; fn path_str(p: &PathBuf) -> &str { p.to_str().expect("path did not contain valid unicode") } #[derive(Debug)] pub struct Problem { name: String, pat...
extern crate image; extern crate squish; extern crate xnb; use image::{DynamicImage, ImageBuffer}; use squish::{decompress_image, CompressType}; use std::env; use std::fs::File; use std::io::BufReader; use std::process; use xnb::{/*tide,*/ SurfaceFormat, Texture2d, XNB}; fn usage() { println!("xnbdump [file.xnb] ...
// wengwengweng use dirty::*; use math::*; use gfx::shapes; use input::Key; use input::Mouse; struct Viewer { shader: gfx::Shader<()>, model: gfx::Model, rot: Vec2, pos: Vec2, scale: f32, resetting: bool, draw_wireframe: bool, run_anim: bool, draw_bound: bool, } impl State for Viewer { fn init(d: &mut Ctx...
/* Copyright 2021 The MiniModelarDB 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 required by applicable l...
//! Handles how to build the project. use super::*; /// Type of the build. #[derive(Copy, Clone, Debug)] pub enum Type { /// Debug build. Debug, /// Release build. Release, } impl ::std::str::FromStr for Type { type Err = String; fn from_str(s: &str) -> ::std::result::Result<Self, Self::Err> ...
use crate::html_page::HtmlPage; use std::collections; use std::fs; use std::io; use std::io::Write; use std::path; pub struct StaticSite { input_root_path: path::PathBuf, directory_paths: Vec<path::PathBuf>, file_paths: Vec<path::PathBuf>, include_index: bool, } impl StaticSite { pub fn from_direc...
use { crate::{get_validator_rpc_addr, get_validator_start_time}, console::style, indicatif::{ProgressBar, ProgressDrawTarget, ProgressStyle}, solana_client::{ client_error, rpc_client::RpcClient, rpc_request, rpc_response::RpcContactInfo, }, solana_sdk::{ clock::{Slot, DEFAULT_TI...
use anyhow::{Error, Result}; use futures::future::{join_all, BoxFuture, FutureExt, TryFutureExt}; use m3u8_rs::{ parse_playlist, playlist::{MasterPlaylist, MediaPlaylist, Playlist}, }; use once_cell::sync::Lazy; use reqwest::{Client, Response}; use std::{ env, io::SeekFrom, mem::take, path::{Pat...
use std::mem::MaybeUninit; use std::ptr; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use super::{EpollCtl, EpollEvent, EpollFlags}; use crate::fs::{HostFd, IoEvents}; use crate::prelude::*; /// An epoll-based helper type to poll the states of a set of host files. #[derive(Debug)] pub struct HostFileEp...
use std::collections::HashMap; type Coordinate = (isize, isize); #[derive(Debug, PartialEq)] pub enum Offset { FRONT, } #[derive(Debug, PartialEq, Clone)] pub enum Tile { WALL, WALKABLE, OXYGEN, FOG, } #[derive(Debug, PartialEq, Clone)] pub enum Direction { NORTH, SOUTH, EAST, WE...
use std::fmt::{self, Display, Formatter}; use std::io::{ErrorKind, Result, Write}; use std::{cmp, io}; use ansi_term::Style; use unicode_width::UnicodeWidthStr; use crate::cmd::style; pub trait AsRow<'a> { fn as_row(&'a self, columns: &[Column]) -> Row<'a>; } #[derive(Debug, Clone, Copy, Ord, PartialOrd, Eq, Pa...
//! Various `Block`- and `Chunk`-related data structures. use crate::texture::TextureRegistry; use crate::{Vertex, CHUNK_SIZE}; use serde_derive::{Deserialize, Serialize}; use std::collections::HashMap; /// Block representation pub trait Block { /// Append the block's vertices to the current Vertex Buffers //...
#![recursion_limit="128"] #![cfg_attr(feature = "nightly", feature(proc_macro_diagnostic))] extern crate syn; extern crate proc_macro; extern crate proc_macro2; extern crate quote; use proc_macro::TokenStream; use proc_macro2::{TokenStream as SynTokenStream, Literal}; use syn::*; use syn::export::Span; use syn::spann...
//! Asynchronous tasks executor. use super::time::{TimeHandle, TimeRuntime}; use async_task::Runnable; pub use async_task::Task; use std::{ collections::HashMap, future::Future, net::SocketAddr, ops::Deref, pin::Pin, sync::{ atomic::{AtomicBool, Ordering}, mpsc, Arc, Mutex, ...
use crate::{ config::Config, database::{db_insert_signed_outpoint, db_signed_outpoint, DatabaseError}, }; use revault_net::message::cosigner::{SignRequest, SignResponse}; use revault_tx::{ bitcoin::{secp256k1, PublicKey as BitcoinPubkey, SigHashType}, error::InputSatisfactionError, transactions::Re...
use rand::prelude::*; use yansi::Paint; extern crate chrono; use chrono::{DateTime, Utc}; use crate::parse_args::AppConfig; use crate::utils::csleep; use crate::BOOTLOG_LIST; use crate::EXCEPTIONS_LIST; use crate::EX_LIST; use crate::MOTOR_LIST; use crate::TIMER_LIST; fn get_one_entry<'a>(source: Vec<&'static str>, d...
//! This example demonstrates a basic but rather tolerant ini parser, which most //! certainly does not obey to the standard. //! //! ``` //! echo 'hello = world' | cargo run --example ini //! ``` use std::io::{self, Read}; use dangerous::{BytesReader, Error, Expected, Input}; fn main() { let mut input_data = Vec...
use js_sys::Array; use wasm_bindgen::{prelude::wasm_bindgen, JsValue}; const STEP_DISTANCE: f64 = 1.0; const GROW_DISTANCE: f64 = 1.0; #[wasm_bindgen] #[derive(Debug, Clone, PartialEq)] pub struct Point { pub x: f64, pub y: f64, } #[wasm_bindgen] impl Point { pub fn new(x: i32, y: i32) -> Self { ...
use std::borrow::Cow; use std::collections::HashMap; use serde_json::Value; use context::get_json_pointer; use renderer::for_loop::ForLoop; use template::Template; pub type Val<'a> = Cow<'a, Value>; pub type FrameContext<'a> = HashMap<&'a str, Val<'a>>; /// Gets a value within a value by pointer, keeping lifetime #...
//! Garbage collection of long clauses. use partial_ref::{partial, PartialRef}; use crate::{ context::{parts::*, Context}, prop::Reason, }; use super::{ClauseAlloc, Tier}; /// Perform a garbage collection of long clauses if necessary. pub fn collect_garbage( mut ctx: partial!( Context, mu...
// 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. // // @generated SignedSource<<484e48550d2b64b348a4a295ae401d07>> // // To regenerate this file, run: // hphp/hack/src/oxidized_by_ref/...
use crate::Error; pub const VARINT_MAX_LEN: usize = 10; /// Decodes a varint from a slice, returning the remainder of the slice and the value. #[inline] pub fn read_varint(buf: &[u8]) -> Result<(&[u8], u64), Error> { if let Some(&byte) = buf.get(0) { if byte <= 0x7f { return Ok((&buf[1..], byt...
// 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, ...
fn main() { assert_eq!(Solution::max_number(vec![6,7],vec![6,0,4],5),vec![6,7,6,0,4]); } struct Solution {} impl Solution { /// O(kn) by using more space pub fn max_number(n1: Vec<i32>, n2: Vec<i32>, k: i32) -> Vec<i32> { let k = k as usize; let mut i = if k <= n2.len() { 0 } else { k - n2...
// vim: tw=80 use crate::types::IoVec; /// A Cursor type that can iterate over `SGList`s. /// /// This structure can be used to iterate through an `SGList` as a series of /// `IoVec`s, but not necessarily with the same boundaries as the `SGList` is /// composed of. It has two main purposes: /// /// - Immutably itera...
// -*- mode: rust; -*- // // This file is part of `fancy-garbling`. // Copyright © 2019 Galois, Inc. // See LICENSE for licensing information. use crate::{ errors::{EvaluatorError, FancyError}, fancy::{Fancy, FancyReveal, HasModulus}, util::{output_tweak, tweak, tweak2}, wire::Wire, }; use scuttlebutt:...
use std::slice::{Iter, IterMut}; use std::option::*; use crate::component::component::*; use crate::common::generational_id::*; #[macro_use] use downcast_rs::*; ///ComponentManager methods that do not rely on the specific Component type. /// ///A trait specifically for the methods all ComponentManagers must implement...
use super::util::hex_bytes; use nom::{ branch::alt, bytes::complete::{tag, take_until, take_while}, character::complete::char, combinator::{all_consuming, opt, peek}, error::ErrorKind, multi::separated_list1, number::complete::hex_u32, sequence::preceded, IResult, }; #[derive(Debug,...
//! Cryptostream types which operate over [`BufRead`](std::io::BufRead) streams, providing both //! encryption and decryption facilities. //! //! Note that unlike the situation with `Read` and `Write`, there's no need for a `bufwrite` //! counterpart to this flavor of `Cryptostream` as there is no issue with simply wra...
use clap; use std::fs; use futures::{Future, Stream}; use tokio_core::reactor::Core; use bincode::{serialize, Infinite}; use nanomsg_multi_server::{MultiServer, MultiServerFutures}; use nanomsg_multi_server::proto::{PeerReply, PeerRequest, PeerError}; use nanomsg_multi_server::config::{GcInterval, SessionTimeout}; us...
use qiniu_http::{ Error as HTTPError, ErrorKind as HTTPErrorKind, HTTPCaller, HTTPCallerErrorKind, Headers, Method, Request, Response, ResponseBuilder, Result, StatusCode, }; use rand::{thread_rng, Rng}; use rand_core::RngCore; use regex::Regex; use serde::Serialize; use std::{ borrow::Cow, boxed::Box, ...
use super::{ resources::{GPUResourceManager, RenderTarget}, SimplePipeline, SimplePipelineDesc, }; use crate::AssetManager; use legion::systems::resource::Resources; use solvent::DepGraph; use std::collections::HashMap; use crossbeam::queue::ArrayQueue; pub struct CommandQueueItem { pub name: String, ...
// Copyright (c) 2015, 2018, 2020 <NAME> <<EMAIL>> #![deny(dead_code)] #![deny(missing_docs)] #![deny(unreachable_patterns)] #![deny(unused_extern_crates)] #![deny(unused_imports)] #![deny(unused_qualifications)] //! This crate contains the parsing functionality for the **arpabet** crate. //! This crate is split into...
/* Reference [1] <NAME>., & <NAME>. (1997). Finding even cycles even faster. SIAM Journal on Discrete Mathematics, 10(2), 209-222. Description G: 単純無向グラフ n: |V(G)| G の偶数長のサイクルの内、最小のものを発見する。 時間計算量: Θ(n^2) 最小の偶数長サイクルを C とすると、C にはある頂点 v が存在して、v から C の各頂点への距離は C 上での距離 より高々 1 小さい、というのが重要な補題である。 この証明はいくらか込み入っ...
pub mod data { use anyhow::{anyhow, Context, Result}; use prost::Message; include!(concat!(env!("OUT_DIR"), "/instantbible.data.rs")); impl VerseKey { pub const fn get_byte_size() -> usize { std::mem::size_of::<u8>() * 3 } pub fn to_be_bytes(&self) -> Vec<u8> { ...
// LNP/BP Core Library implementing LNPBP specifications & standards // Written in 2020 by // Dr. <NAME> <<EMAIL>> // // To the extent possible under law, the author(s) have dedicated all // copyright and related and neighboring rights to this software to // the public domain worldwide. This software is distributed...
use std::cmp::Ordering; use std::convert::TryFrom; use bitvec::prelude as bv; /// Calculates the suffix array for a given text in `O(n)` runtime. /// /// This function calculates the suffix array in linear runtime using the /// suffix array induced sorting (SAIS) algorithm. /// /// Make sure that the text contains a ...
use std::convert::{Into, TryFrom}; use std::str::FromStr; /// An OCI image reference /// /// Parsing references in the following formats is supported: /// - `<registry>/<repository>` /// - `<registry>/<repository>:<tag>` /// - `<registry>/<repository>@<digest>` /// - `<registry>/<repository>:<tag>@<digest>` /// /// # ...
// Don't create a new standard console window when launched from the windows GUI. #![windows_subsystem = "windows"] #[macro_use] extern crate failure; #[macro_use] extern crate failure_derive; #[macro_use] pub mod log; use failure::Error; use std::ffi::OsString; use structopt::StructOpt; use std::rc::Rc; use std::syn...
use ark_serialize::*; use serde_json::json; use std::env; use std::path::PathBuf; use zkp_curve::Curve; mod circuits; use circuits::{CliCircuit, Publics}; use circuits::hash::Hash; use circuits::mini::Mini; const PROOFS_DIR: &'static str = "./proof_files"; const SETUP_DIR: &'static str = "./setup_files"; macro_rule...
use criterion::measurement::WallTime; use criterion::BenchmarkGroup; use criterion::{black_box, criterion_group, criterion_main, Criterion}; use pprof::criterion::{Output, PProfProfiler}; use rand::Rng; use spiral_rs::aligned_memory::AlignedMemory64; use spiral_rs::client::*; use spiral_rs::params::*; use spiral_rs::p...
use std::collections::{BTreeMap, BTreeSet}; use std::mem::size_of; use crate::page::{Page, PageID}; #[derive(Clone)] pub(crate) struct Freelist { free_pages: BTreeSet<PageID>, pending_pages: BTreeMap<u64, Vec<PageID>>, } const HEADER_SIZE: u64 = size_of::<Page>() as u64; const PAGE_ID_SIZE: u64 = size_of::<P...
use crate::types::field::Field; use crate::types::{LongField, PacketResult}; use async_std::io::prelude::*; use async_trait::async_trait; use std::fmt::{Display, Formatter}; /// < is pre-1.14 and uses old format, >= is post-1.14 and uses new format const NEW_FORMAT_CUTOFF: u32 = 477; #[derive(Debug)] pub struct Posit...