text
stringlengths
3.09k
13.9k
// Copyright (c) 2021 The Lutino Projects // // Use of this source code is governed by an MIT-style // license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. use std::collections::HashSet; use std::iter::FusedIterator; use crate::base::quad_tree::{Entry, EntryId, QuadTreeNode, Qua...
use serde::{Deserialize, Serialize}; use serialport::{DataBits, FlowControl, Parity, SerialPort, SerialPortSettings, StopBits}; use std::iter::FromIterator; use std::mem::transmute; use std::time::{Duration, SystemTime}; mod error; pub use error::*; const HEAD: u8 = b'\xaa'; const TAIL: u8 = b'\xab'; const CMD_ID: u8...
use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] pub struct DerivativeSecurityList { /// MsgType = AA #[serde(flatten)] pub standard_message_header: super::super::standard_message_header::StandardMessageHeader<'A', 'A'>, /// ApplicationSequenceControl #[ser...
use std::{ borrow::Cow, collections::BTreeMap, fmt::{self, Debug, Formatter}, }; use markup5ever::tendril::{StrTendril, TendrilSink}; use yarte_html::{ driver, interface::{ Attribute as HtmlAttribute, ElementFlags, ExpandedName, NodeOrText as HtmlNodeOrText, QualName, TreeSink, ...
use std::process; use std::sync::Arc; use arrow::array::{Float64Array, Int32Array, UInt32Array}; use arrow::datatypes::{DataType, Field, Schema}; use arrow::record_batch::RecordBatch; extern crate ballista; use ballista::cluster; use ballista::error::BallistaError; use ballista::plan::{Action, TableMeta}; use ballis...
// This file is part of Substrate. // Copyright (C) 2019-2021 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // 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 // // ht...
use crate::agent::{Agent, MioMapType}; use crate::intrinsics::promise::promise_resolve_i; use crate::linked_list::LinkedList; use crate::value::{Args, Value, ValueType}; use lazy_static::lazy_static; use mio::{PollOpt, Ready, Registration, SetReadiness}; use num::ToPrimitive; use std::collections::HashMap; use std::syn...
// Copyright 2017-2019 Parity Technologies (UK) Ltd. // This file is part of Substrate. // Substrate is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) a...
/// Stores statistics for aggregated metric. #[derive(Debug, PartialEq, Default)] pub struct Stats { /// Sampled value. pub(crate) value: f64, /// Minimum value of the aggregated metric. pub(crate) min: f64, /// Maximum value of the aggregated metric. pub(crate) max: f64, /// Count of mea...
use crate::pathfind::node_map::{deserialize_nodemap, NodeMap}; use crate::{Lane, LaneID, Map, Path, PathConstraints, PathRequest, PathStep, Turn, TurnID}; use fast_paths::{FastGraph, InputGraph, PathCalculator}; use geom::Distance; use serde_derive::{Deserialize, Serialize}; use std::cell::RefCell; use thread_local::Th...
use crate::util::{remove_parens, CollectToResult}; use proc_macro2::{Span, TokenStream}; use quote::{quote, ToTokens}; use syn::{ parse::Parse, spanned::Spanned, Attribute, AttributeArgs, Error, ItemTrait, LitStr, Meta, NestedMeta, PredicateType, Result, TraitItem, WherePredicate }; struct TraitItemAttrs { openapi_...
//! Dag Engine is dagrs's main body use super::{ env_variables::EnvVar, error_handler::{DagError, RunningError}, graph::Graph, }; use crate::task::{ExecState, Inputval, Retval, TaskWrapper, YamlTask}; use log::*; use std::{collections::HashMap, sync::Arc}; /// dagrs's function is wrapped in DagEngine stru...
use std::{ ffi::c_void, fmt::{self, Display}, fs, path::{Path, PathBuf}, time::Duration, }; use anyhow::Result; use imgui::im_str; use log::info; use sdl2::{event::Event, keyboard::Keycode, Sdl, VideoSubsystem}; use crate::{ define_gl_primitive, draw, model::{create_simple_vertex, GLPrimit...
use super::pipeline::RenderPipeline; use crate::{internal::UpdateMessage, state::InitError, Game, GameState}; use std::sync::mpsc::{channel, Receiver}; use vulkano::{ device::{Device, DeviceExtensions, Features}, instance::{ debug::{DebugCallback, MessageSeverity}, Instance, InstanceExtensions, ...
use zenith_utils::postgres_backend::AuthType; use zenith_utils::zid::{ZTenantId, ZTimelineId}; use std::path::PathBuf; use std::time::Duration; use lazy_static::lazy_static; use zenith_metrics::{register_int_gauge_vec, IntGaugeVec}; pub mod basebackup; pub mod branches; pub mod http; pub mod layered_repository; pub ...
mod macro_expr; mod transform; use proc_macro::TokenStream; use proc_macro_error::{abort, emit_error, proc_macro_error}; use quote::{format_ident, quote}; use syn::{parse_macro_input, Item, Pat, ReturnType}; use transform::{Dependencies, Function, Scope, Var}; #[proc_macro_error] #[proc_macro_attribute] pub fn comp...
use crate::app; use ash::version::DeviceV1_0; use ash::vk; fn allocate_command_buffer( device: &ash::Device, command_pool: vk::CommandPool, ) -> Result<vk::CommandBuffer, String> { let allocate_info = vk::CommandBufferAllocateInfo::builder() .command_pool(command_pool) .level(vk::CommandBuf...
// Copyright 2022 <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 writ...
use std::collections::HashMap; use std::path::PathBuf; use syn::{self, UseTree}; pub fn concat_module_parts(prefix: &[String], suffix: &[String], crate_name: &str) -> Vec<String> { let mut full_parts = prefix.to_vec(); for part in suffix { match part { _ if part == "crate" || part == crate_...
#![forbid(unsafe_code)] #![warn( rustdoc::missing_crate_level_docs, missing_docs, nonstandard_style, unused_qualifications )] /*! Welcome to the trillium logger! */ pub use crate::formatters::{apache_combined, apache_common, dev_formatter}; use std::fmt::Display; use trillium::{async_trait, Conn, Handle...
//! *Texas Instruments DAC5578 Driver for Rust Embedded HAL* //! This is a driver crate for embedded Rust. It's built on top of the Rust //! [embedded HAL](https://github.com/rust-embedded/embedded-hal) //! It supports sending commands to a TI DAC5578 over I2C. //! //! The driver can be initialized by calling create an...
use glfw::{WindowEvent, Action}; use cgmath::{Matrix3, Transform, Matrix4}; use crate::rendering::prelude::{Position, Rectangle}; use crate::editor; use crate::command_buffer::{Command, CommandBuffer}; use crate::editor::tools::{Tool, get_transformed_mouse_position, EditorWindow}; use crate::editor::image_operation::{...
extern crate gullery; #[macro_use] extern crate gullery_macros; extern crate glutin; extern crate png; mod helper; use gullery::{ buffer::*, framebuffer::{render_state::*, *}, geometry::D2, geometry::{GLSLFloat, GLVec2, GLVec3, Normalized}, image_format::*, program::*, texture::{types::Arr...
//! Compares the decoding results with reference renderings. extern crate crc32fast; extern crate glob; extern crate image; use std::fs; use std::io; use std::path::PathBuf; use std::u32; use crc32fast::Hasher as Crc32; const BASE_PATH: [&str; 2] = [".", "tests"]; const IMAGE_DIR: &str = "images"; const OUTPUT_DIR:...
#[macro_use] mod actions; mod conditions; mod lexeme; use crate::base::{Align, Range}; use crate::html::{LocalNameHash, Namespace, TextType}; use crate::parser::state_machine::{ ActionError, ActionResult, FeedbackDirective, StateMachine, StateResult, }; use crate::parser::{ ParserDirective, ParsingAmbiguityEr...
#[macro_use] mod macros; mod app; mod exit; mod shell; mod tilde; mod workspace; use clap::ArgMatches; use colored::Colorize; use failure::Fail; use std::env; use std::fs; use std::io::Write; use std::path; use std::process; use crate::exit::Exit; use crate::tilde::Tilde; use crate::workspace::Workspace; pub static...
use std::fs::{self, DirEntry, File, OpenOptions}; use std::io::{self, BufReader, Read, Write, Error}; use std::path::Path; use std::process::Command; use fs_extra::dir::{self, copy}; use fs_extra::{copy_items, remove_items}; #[cfg(windows)] use winapi; #[cfg(windows)] use winreg::enums::*; #[cfg(windows)] use winreg:...
#![allow(non_snake_case)] use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug)] pub struct VTJourneySearchResult { pub soluzioni: Vec<VTTrainSolution>, pub origine: String, pub destinazione: String, pub errore: Option<String>, } #[derive(Serialize, Deserialize, Debug)] pub stru...
use crate::open_input::{open_input, Input}; use crate::{MediaType, Pseudonym}; use clap::TryFromOsArg; use io_streams::StreamReader; use layered_io::{Bufferable, LayeredReader, ReadLayered, Status}; use std::ffi::OsStr; use std::fmt::{self, Debug, Formatter}; use std::io::{self, IoSliceMut, Read}; use terminal_io::Neve...
use sdl2::pixels::Color; use sdl2::rect::Point as SDLPoint; use sdl2::rect::Rect as SDLRect; use specs::prelude::*; use super::TILE_SIZE; use crate::after_image::prelude::*; use crate::atlas::prelude::*; use crate::clash::{ShortInfo, StatusInfo, StatusKind}; use crate::props::LifeBar; pub struct CharacterOverlay { ...
/*************************************************************************************************** * Copyright (c) 2019 by the authors * * Author: <NAME> * License: Apache License 2.0 **************************************************************************************************/ //! # Device Inquiry thou...
use periph::adc::*; use bobbin_common::bits::*; use bobbin_hal::analog::AnalogRead; use gclk; #[derive(Debug, PartialEq, Eq, Clone, Copy)] #[repr(u8)] pub enum Resolution { Bits12 = 0x0, Bits16 = 0x1, Bits10 = 0x2, Bits8 = 0x3, } impl AdcPeriph { pub fn init(&self) { while gclk::GCLK.stat...
use crate::{issues, metadatas, validators}; use serde::Serialize; use std::collections::BTreeMap; use std::convert::TryFrom; use std::error::Error; fn create_unloadable_model_error(error: gtfs_structures::Error) -> issues::Issue { let msg = if let Some(inner) = error.source() { format!("{}: {}", error, inn...
extern crate postgres; extern crate time; extern crate num_cpus; extern crate threadpool; extern crate flate2; extern crate yaml_rust; extern crate postgres_binary_copy; extern crate rustc_serialize; mod sd_batch_uploader; mod sd_parser; use postgres::{Connection, SslMode, ConnectParams, ConnectTarget, UserInfo}; use...
use std::cell::RefCell; use std::rc::Weak; use crate::*; use wasmuri_core::*; pub struct MouseManager { area_click_listeners: WeakMetaVec<dyn ComponentBehavior, Region>, full_click_listeners: WeakVec<dyn ComponentBehavior>, area_scroll_listeners: WeakMetaVec<dyn ComponentBehavior, Region>, full_scr...
#![no_std] pub use arrayvec::ArrayString; use core::fmt::Write; #[derive(Debug, PartialEq, Eq)] pub enum Error { CmdFailure, BufferOverflow, CmdNotFound, EmptyCmd, NotEnoughArgs, InvalidArgType, } impl Error { fn to_str(&self) -> &'static str { match self { Error::CmdF...
use std::fmt; use tracing::{debug, error, warn}; use futures_util::stream::StreamExt; use tracing::instrument; use fluvio_storage::OffsetInfo; use fluvio_socket::{FlvSink, FlvSocketError, FlvStream}; use dataplane::api::RequestMessage; use fluvio_types::SpuId; use crate::{ core::DefaultSharedGlobalContext, r...
use std::cell::RefCell; use std::collections::{HashMap, HashSet}; use ichiran::romanize::*; use imgui::*; use super::deepl::DeepLView; use super::mixins::*; use super::settings::{DisplayRubyText, SettingsView}; use crate::backend::renderer::Env; use crate::gloss::Gloss; use crate::translation::Translation; use crate:...
extern crate libc; use std::panic; use std::panic::AssertUnwindSafe; use std::sync::mpsc::{channel, Sender, Receiver, SyncSender, sync_channel, RecvError}; use std::sync::{Arc, Mutex}; use std::thread::{self, JoinHandle}; mod mutex; pub use mutex::{ReentrantMutex, ReentrantMutexGuard}; trait FnBox { fn call_box...
use crate::{error::ProofError, expression::SingleSubstitution, Identifier, Theorem}; use std::collections::HashMap; #[derive(Debug, PartialEq, Eq)] pub struct Database { names: HashMap<String, (usize, usize)>, theorems: Vec<(Theorem, Proof<usize>, Option<String>)>, last_name: usize, } #[derive(Debug, Part...
// Copyright 2018 <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 ...
#![cfg(feature = "web")] use crate::platform::{HaPlatformInterface, HaPlatformInterfaceProcessResult}; use glow::*; #[cfg(target_arch = "wasm32")] use std::collections::HashMap; use std::{cell::RefCell, rc::Rc}; use wasm_bindgen::{closure::Closure, *}; use web_sys::*; #[derive(Debug, Clone, PartialEq, Eq)] pub enum W...
use crate::browser::url::Url; use serde::{Deserialize, Serialize}; use std::{borrow::Cow, collections::BTreeMap, fmt}; #[allow(clippy::module_name_repetitions)] #[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct UrlSearch { search: BTreeMap<String, Vec<String>>, pub(super) invalid_c...
use std::{path::PathBuf, time::Duration}; use anyhow::{Context, Result}; use dirs_next::config_dir; use druid::{ widget::{prelude::*, Controller}, Data, Point, Size, TimerToken, Widget, WindowDesc, WindowHandle, }; use futures::{ channel::mpsc::{self, UnboundedReceiver}, StreamExt, }; use serde::{Deser...
fn main() { where_pattern_matching_happens(); pattern_matching_syntax(); } fn where_pattern_matching_happens() { if_let_expressions(); while_let_conditional_loops(); for_loops(); let_statements(); function_parameters(); } fn if_let_expressions() { let favorite_color: Option<&str> = Non...
use proc_macro2::{Span, TokenStream}; use quote::{quote, quote_spanned, ToTokens}; use syn::spanned::Spanned; use syn::{Attribute, Data, DeriveInput, Field, Ident, Lit, Meta, NestedMeta, Type}; use crate::util::ErrorLog; pub fn expand_derive_resources(input: &DeriveInput) -> Result<TokenStream, String> { if let D...
//! semi-implicit schemes use ndarray::*; use ndarray_linalg::*; use super::traits::*; /// Linear ODE with diagonalized matrix (exactly solvable) #[derive(Debug, Clone)] pub struct Diagonal<F: SemiImplicit> { exp_diag: Array<F::Scalar, F::Dim>, diag: Array<F::Scalar, F::Dim>, dt: <F::Scalar as Scalar>::R...
// Copyright 2013 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-MIT or ...
// Copyright 2021 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use crate::*; use base::{info, validate_raw_descriptor, RawDescriptor, Tube, UnixSeqpacket}; use remain::sorted; use thiserror::Error; use std::fs::Ope...
use solana_gossip::cluster_info::{ClusterInfo, MAX_SNAPSHOT_HASHES}; use solana_runtime::{ snapshot_archive_info::SnapshotArchiveInfoGetter, snapshot_package::PendingSnapshotPackage, snapshot_utils, }; use solana_sdk::{clock::Slot, hash::Hash}; use std::{ sync::{ atomic::{AtomicBool, Ordering}, ...
/// Returns true if there are no elements in `x` in `arr` /// such that `x <= 0.0` or `x` is `f64::NAN` and `sum(arr) > 0.0`. /// IF `incl_zero` is true, it tests for `x < 0.0` instead of `x <= 0.0` pub fn is_valid_multinomial(arr: &[f64], incl_zero: bool) -> bool { let mut sum = 0.0; for &elt in arr { ...
use super::{deserialise_blocking, Mastodon, Result}; use crate::entities::itemsiter::ItemsIter; use hyper_old_types::header::{parsing, Link, RelationType}; use reqwest::{header::LINK, Response}; use serde::Deserialize; use url::Url; macro_rules! pages { ($($direction:ident: $fun:ident),*) => { $( ...
// Copyright 2019-2022 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT use super::Result; // https://github.com/multiformats/unsigned-varint#practical-maximum-of-9-bytes-for-security const VARINT_MAX_BYTES: usize = 9; /// A `BitReader` allows for efficiently reading bits from a byte buffer, up to a byt...
#![no_std] mod taranis; pub use taranis::TaranisX7SBusPacket; use arraydeque::{ArrayDeque, Wrapping}; // The flag by should start with 4 0s const SBUS_FLAG_BYTE_MASK: u8 = 0b11110000; const SBUS_HEADER_BYTE: u8 = 0x0F; const SBUS_FOOTER_BYTE: u8 = 0b00000000; const SBUS_PACKET_SIZE: usize = 25; #[derive(Debug, Or...
//! Lint on use of `size_of` or `size_of_val` of T in an expression //! expecting a count of T use clippy_utils::diagnostics::span_lint_and_help; use clippy_utils::{match_def_path, paths}; use if_chain::if_chain; use rustc_hir::BinOpKind; use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; us...
// Copyright (c) SimpleStaking and Tezedge Contributors // SPDX-License-Identifier: MIT use std::collections::HashMap; use std::str::FromStr; use enum_iterator::IntoEnumIterator; use serde::{Deserialize, Serialize}; use lazy_static::lazy_static; use crate::ffi::{GenesisChain, ProtocolOverrides}; lazy_static! { ...
// 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 { anyhow::{format_err, Context as _, Error}, fidl_fuchsia_net, fidl_fuchsia_net_stack::StackMarker, fidl_fuchsia_net_stack_ext::FidlRet...
//! Handles reading files, and annotating tokens with line and column numbers use crate::lexer::*; use crate::parser::{parse_datum, Datum}; use crate::*; use anyhow::Result; use std::{ fs::File, io::{BufRead, BufReader, Lines}, iter::{Enumerate, Peekable}, path::PathBuf, }; /// `FileLexer` can be turne...
//! kdirect kdhash type use crate::*; use futures::future::{BoxFuture, FutureExt}; use kitsune_p2p::*; pub use kitsune_p2p_direct_api::KdHash; /// Extension trait to augment the direct_api version of KdHash pub trait KdHashExt: Sized { /// convert to kitsune space fn to_kitsune_space(&self) -> Arc<KitsuneSpa...
use crate::Transformation; use iced_graphics::font; use glow_glyph::ab_glyph; use std::{cell::RefCell, collections::HashMap}; pub use iced_native::text::Hit; #[derive(Debug)] pub struct Pipeline { draw_brush: RefCell<glow_glyph::GlyphBrush>, draw_font_map: RefCell<HashMap<String, glow_glyph::FontId>>, m...
use ckb_fixed_hash::H256; use gw_jsonrpc_types::{ blockchain::{CellDep, Script}, godwoken::{ChallengeTargetType, L2BlockCommittedInfo, RollupConfig}, }; use serde::{Deserialize, Serialize}; use std::{ collections::{HashMap, HashSet}, path::PathBuf, }; #[derive(Clone, Default, Debug, PartialEq, Serializ...
//! AccountInfo represents a reference to AccountSharedData in either an AppendVec or the write cache. //! AccountInfo is not persisted anywhere between program runs. //! AccountInfo is purely runtime state. //! Note that AccountInfo is saved to disk buckets during runtime, but disk buckets are recreated at startup. us...
use rpi::common::MMIO_BASE; pub const EMMC_ARG2: u32 = MMIO_BASE + 0x00300000; pub const EMMC_BLKSIZECNT: u32 = MMIO_BASE + 0x00300004; pub const EMMC_ARG1: u32 = MMIO_BASE + 0x00300008; pub const EMMC_CMDTM: u32 = MMIO_BASE + 0x0030000C; pub const EMMC_RESP0: u32 = MMIO_BASE + 0x00300010; pub const EMMC_RESP1: u32 = ...
use super::*; #[derive(Debug)] pub struct ObjectTypeBuilder<'a> { internal_data_model: InternalDataModelRef, with_relations: bool, capabilities: &'a SupportedCapabilities, filter_object_type_builder: Weak<FilterObjectTypeBuilder<'a>>, object_type_cache: TypeRefCache<ObjectType>, } impl<'a> InputBu...
use std::collections::HashMap; use super::scancode::Scancode; /// Current state of a key #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] pub enum KeyState { /// The key is not currently pressed None, /// The key was pressed down on this frame Down, /// The key is being held d...
use std::{ collections::{HashMap, HashSet, VecDeque}, path::PathBuf, }; use crate::AdventOfCode; const DAY: &str = "day12"; #[derive(Debug, Default, PartialEq)] struct Cave { name: String, connections: Vec<String>, small: bool, } #[derive(Debug, Default)] pub struct Data { input: HashMap<Str...
use crate::operand::{Borrowed, Operand, Owned}; use crate::{file, full, gen}; use anyhow::Result; use proc_macro2::{Ident, Span, TokenStream}; use quote::{format_ident, quote}; use syn::Index; use syn_codegen::{Data, Definitions, Features, Node, Type}; const VISIT_MUT_SRC: &str = "../src/gen/visit_mut.rs"; fn simple_...
use crate::error::Error; use crate::hash::Merge; const USIZE_BITS: u32 = 0usize.count_zeros(); #[inline] pub(crate) fn bit_length(v: usize) -> u32 { USIZE_BITS - v.leading_zeros() } /// Computes the bagging for an iterator over peak positions. /// The peaks must be iterated in reverse. pub(crate) fn bagging<H: M...
#![allow(clippy::many_single_char_names)] use clap::{value_t_or_exit, App, Arg}; use hdrhistogram::Histogram; use noria::{Builder, DurabilityMode, FrontierStrategy, PersistenceParameters}; use std::time::{Duration, Instant}; const RECIPE: &str = "# base tables CREATE TABLE Article (id int, title varchar(255), PRIMARY...
use crate::{auth, channel, environment::Environment, handlers, metrics, problem, settings}; use serde::{Deserialize, Serialize}; use tracing::error; use tracing::{debug, trace}; use warp::{Filter, Rejection, Reply}; const MAX_MESSAGE_SIZE: usize = 1024 * 512; const BEARER: &str = "Bearer "; #[derive(Deserialize, Seri...
use crate::workdir::Workdir; macro_rules! select_test { ($name:ident, $select:expr, $select_no_headers:expr, $expected_headers:expr, $expected_rows:expr) => { mod $name { use super::data; use crate::workdir::Workdir; #[test] fn headers() { ...
use std::{ cell::{Ref, RefCell, RefMut}, fmt, mem, pin::Pin, task::{Context, Poll}, time::{Duration, Instant}, }; use actix_http::{ error::PayloadError, header::HeaderMap, BoxedPayloadStream, Extensions, HttpMessage, Payload, ResponseHead, StatusCode, Version, }; use actix_rt::time::{sleep,...
use crate::db::{ServerSoftBans, SoftBans}; use chrono::offset::Utc; use futures_util::{stream, TryStreamExt}; use serenity::{ framework::standard::{macros::command, Args, CommandResult}, model::{ channel::Message, id::{GuildId, RoleId, UserId}, }, CacheAndHttp, }; use std::sync::Arc; use...
use atomic::Atomic; use dbus::arg::{OwnedFd, RefArg, Variant}; use dbus::blocking::{Connection, Proxy}; use dbus_udisks2::DiskDevice; use futures::executor; use libc; use popsicle::{Progress, Task}; use std::cell::Cell; use std::collections::HashMap; use std::fmt::{self, Debug, Display, Formatter}; use std::fs::File; u...
use constructors::*; use parse::{ get_grammar_grammar, parse_grammar, parse_grammar_with_grammar, Parser, }; use test::Bencher; #[test] fn ident() { let g = get_grammar_grammar(); Parser::parse(&g, "ident", "a").unwrap(); Parser::parse(&g, "ident", "A").unwrap(); Parser::parse(&g, "ide...
use common::*; use intcode::intcode::*; use itertools::Itertools; fn main() { let program_spec = first_line(file_to_vec("input.txt".to_string()).unwrap()); let mut max_signal = std::i32::MIN; let mut max_combo = vec![0,0,0,0,0]; for combo in (0..=4).permutations(5) { let signal = run_amp_s...
use std::env; use std::error::Error; use std::path::PathBuf; use nix::unistd::gethostname; pub const RESET: &str = "\x01\x1B[0m\x02"; pub const BOLD: &str = "\x01\x1B[1m\x02"; pub const UNDERLINED: &str = "\x01\x1B[4m\x02"; pub const BLUE: &str = "\x01\x1B[34m\x02"; pub const YELLOW: &str = "\x01\x1B[33m\x02"; pub c...
use clams::prelude::{Config as ClamsConfig}; use clap::{App, Arg, ArgMatches, SubCommand}; use centerdevice::{CenterDevice, Client, ClientCredentials, Token}; use centerdevice::client::AuthorizedClient; use centerdevice::client::auth::{Code, CodeProvider, IntoUrl}; use centerdevice::errors::{Result as CenterDeviceResul...
//! Types for error handling. #![allow(deprecated)] use std::error::Error as StdError; use std::fmt; use std::io; /// All possible types of errors that can be returned from Isahc. #[derive(Debug)] pub enum Error { /// The request was aborted before it could be completed. Aborted, /// A problem occurred w...
use std::hash::Hasher; use twox_hash::XxHash64; pub struct Decodebuffer { pub buffer: Vec<u8>, pub dict_content: Vec<u8>, pub window_size: usize, total_output_counter: u64, pub hash: XxHash64, } impl std::io::Read for Decodebuffer { fn read(&mut self, target: &mut [u8]) -> std::result::Result...
//! Merge already sorted files. //! //! We achieve performance by splitting the tasks of sorting and writing, and reading and parsing between two threads. //! The threads communicate over channels. There's one channel per file in the direction reader -> sorter, but only //! one channel from the sorter back to the reade...
// Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 //! This module provides `Pruner` which manages a thread pruning old data in the background and is //! meant to be triggered by other threads as they commit new data to the DB. mod db_pruner; pub(crate) mod db_sub_pruner; pub(crate) mod event_store; mod le...
// Copyright 2020-2022 <NAME> // SPDX-License-Identifier: Apache-2.0 #[cfg(feature = "stronghold")] use std::path::PathBuf; use std::sync::Arc; #[cfg(feature = "stronghold")] use zeroize::Zeroize; use identity_account_storage::storage::MemStore; use identity_account_storage::storage::Storage; #[cfg(feature = "strong...
use std::io::BufRead; use std::path::PathBuf; use glob::glob; use structopt::StructOpt; use log::{debug, info, error}; use pretty_env_logger::env_logger as logger; mod exhaust; mod db; #[derive(StructOpt, Debug)] struct Args { #[structopt(short, long, help = "DONOT execute SQL statements")] check: bool, ...
use crate::message::commands::IRCMessageParseExt; use crate::message::{IRCMessage, ServerMessageParseError}; use chrono::{DateTime, Utc}; use std::convert::TryFrom; use std::str::FromStr; use std::time::Duration; /// Timeout, Permaban or when a chat is entirely cleared. /// /// This represents the `CLEARCHAT` IRC comm...
// Copyright (c) 2016 The Rouille 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. All files in the project carrying such // notice may not be co...
use { crate::{Chunk, Compiler, CompilerError, CompilerSettings}, koto_parser::{format_error_with_excerpt, Parser, ParserError}, std::{collections::HashMap, error, fmt, path::PathBuf, sync::Arc}, }; /// Errors that can be returned from [Loader] operations #[derive(Clone, Debug)] pub enum LoaderErrorType { ...
//! [Middle Square Weyl Sequence][1] pseudorandom number generator (`no_std`). //! //! [1]: https://en.wikipedia.org/wiki/Middle-square_method#Middle_Square_Weyl_Sequence_PRNG //! //! # Example //! //! ``` //! use msws::Rand; //! //! // This will always return the same seed. //! msws::seed(0); // => 0xb5ad4eceda1ce2a9 ...
#![cfg_attr(not(feature = "std"), no_std)] /// Edit this file to define custom logic or remove it if it is not needed. /// Learn more about FRAME and the core library of Substrate FRAME pallets: /// <https://docs.substrate.io/v3/runtime/frame> pub use pallet::*; #[cfg(test)] mod mock; #[cfg(test)] mod tests; #[cfg(...
use crate::error::Errors; use quote::quote; use serde::Deserialize; use serde_tokenstream::from_tokenstream; use std::path::PathBuf; use std::str::FromStr; #[derive(Default, Deserialize)] struct ImportAttributes { pub canister: Option<String>, pub canister_id: Option<String>, pub candid_path: Option<PathBu...
use anyhow::Context; use chrono::NaiveDateTime; use sea_orm::prelude::DbConn; use sea_orm::{ ActiveModelBehavior, ActiveModelTrait, ActiveValue, ColumnTrait, DeriveEntityModel, DeriveIntoActiveModel, DerivePrimaryKey, DeriveRelation, EntityTrait, EnumIter, IdenStatic, IntoActiveModel, PrimaryKeyTrait, Q...
#![deny(warnings)] use core::{fmt, u32}; use std::{ fs::File, io::{self, Read, StdoutLock, Write}, }; use clap::{App, Arg}; use exitfailure::ExitFailure; use itm::{ packet::{ExceptionTrace, Function}, Packet, Stream, }; fn main() -> Result<(), ExitFailure> { run().map_err(|e| e.into()) } // spec...
use crate::server::{ AddVersionResult, GetVersionResult, HistorySegment, Server, Snapshot, SnapshotUrgency, VersionId, }; use std::time::Duration; use uuid::Uuid; use super::crypto::{Cryptor, Sealed, Secret, Unsealed}; pub struct RemoteServer { origin: String, client_key: Uuid, cryptor: Cryptor, ...
use itertools::Either; use nu_engine::CallExt; use nu_protocol::ast::{Call, RangeInclusion}; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ Category, Example, FromValue, IntoInterruptiblePipelineData, PipelineData, PipelineIterator, Range, ShellError, Signature, Span, Spanned, Syntax...
use crate::board::*; // An evaluator that knows nothing but the rules, and maximally explores the tree. pub struct DumbEvaluator; impl minimax::Evaluator for DumbEvaluator { type G = Rules; fn evaluate(&self, _: &Board) -> minimax::Evaluation { 0 } } // An evaluator that counts movable pieces and...
use flume::{Receiver, RecvError, Sender}; use log::{debug, error, info}; use serde::{Deserialize, Serialize}; use thiserror::Error; use tokio::io::AsyncWriteExt; use tokio::net::{TcpListener, TcpStream}; use tokio::{select, time}; use tokio_stream::StreamExt; use tokio_util::codec::Framed; use tokio_util::codec::{Lines...
// Copyright (c) 2021, <NAME>, <NAME> 10, bus 2452, B-3001 Leuven-Heverlee, Belgium. // Copyright (c) 2021, Cosmian Tech SAS, 53-55 rue La Boétie, Paris, France. use crate::compiler::Compiler; use crate::{errors::ArgNotFound, substr_offset}; use std::convert::{TryFrom, TryInto}; #[derive(Copy, Clone, Debug, Eq, Part...
use std::{ ops::{Range, RangeBounds}, sync::Arc, }; use druid::{ piet::TextStorage as PietTextStorage, piet::{PietTextLayoutBuilder, TextLayoutBuilder}, text::{Attribute, AttributeSpans, Link}, text::{EnvUpdateCtx, TextStorage}, ArcStr, Color, Command, Data, Env, FontDescriptor, FontFamily,...
use d3dx12::*; use dxsample::*; use windows::{ core::*, Win32::{ Foundation::*, Graphics::{Direct3D12::*, Dxgi::Common::*, Dxgi::*}, }, }; mod d3d12_hello_window { use std::convert::TryInto; use super::*; const FRAME_COUNT: usize = 2; pub struct Sample { dxgi_fact...
use line_reader::read_file_to_lines; use std::collections::HashMap; pub(crate) fn day10_part1() -> usize { let input = read_file_to_lines("input/day10.txt"); let mut bot_traders = BotTraders::from(input); bot_traders.bot_responsible_for_handling(61, 17) } pub(crate) fn day10_part2() -> usize { let inp...