text
stringlengths
3.09k
13.9k
extern crate rust_music_theory as theory; use theory::chord::{Chord, Number, Number::*, Quality, Quality::*}; use theory::note::{PitchClass, PitchClass::*}; fn assert_chords(table: Vec<(&str, PitchClass, Quality, Number)>) { for (string, pitch, quality, number) in table { let chord = Chord::from_regex(stri...
// // Copyright (C) 2018 Kubos Corporation // // 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 agree...
#[cfg(test)] mod test; use std::{collections::HashMap, io::Write}; use bson::{oid::ObjectId, spec::ElementType, Bson}; use serde::Serialize; use crate::{ bson::doc, bson_util, cmap::{Command, StreamDescription}, error::{BulkWriteFailure, Error, ErrorKind, Result}, operation::{Operation, Retryabil...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::shared::unique_map::UniqueMap; use crate::{ expansion::ast::Fields, naming::ast::{BaseType, FunctionSignature, SingleType, StructDefinition, Type, Type_}, parser::ast::{ BinOp, Field, FunctionName, Functi...
/* Copyright (C) 2017 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARR...
use aoc_utils::PuzzleInput; const DAY: u8 = 24; fn main() { let input = PuzzleInput::get_input(DAY); println!("A: {}", solve_a(&input)); println!("B: {}", solve_b(&input)); } enum Value { Literal(i64), Variable(char), } impl Value { fn get(&self, state: &State) -> i64 { match self { ...
use chrono::prelude::*; use serde::Deserialize; #[derive(Deserialize, Debug)] pub struct GameImage { pub original_url: Option<String>, pub super_url: Option<String>, pub screen_url: Option<String>, pub screen_large_url: Option<String>, pub medium_url: Option<String>, pub small_url: Option<String>, pub th...
use std::time::{Duration, Instant}; use lazy_static::*; use sdl2::event::Event; use sdl2::render::Canvas; use sdl2::ttf::Sdl2TtfContext; use sdl2::video::Window; use sdl2::Sdl; use crate::ecs::World; use crate::error::{AnyhowContext, Result, Sdl2Error}; use crate::graphics::{self, Color, GraphicsContext}; use crate::...
#[macro_use] extern crate glium; use anyhow::Result; use clap::{crate_description, crate_name, crate_version, App, AppSettings, Arg}; use font::FontConfiguration; use glium::glutin::dpi::LogicalSize; use glium::glutin::event::Event; use glium::glutin::event::StartCause; use glium::glutin::event::WindowEvent; use glium...
//! Contains the [`hash`] and typed (e.g. [`hash_primitive`]) operators. //! // multiversion does not copy documentation, causing a false positive #![allow(missing_docs)] use ahash::{CallHasher, RandomState}; use multiversion::multiversion; use std::hash::Hash; macro_rules! new_state { () => { RandomState:...
// Using code from: https://github.com/nfarnan/cs1666_examples/blob/main/sdl/examples/sdl08_rect_collision.rs extern crate street_code_fighter as scf; use std::collections::HashSet; use sdl2::pixels::Color; use sdl2::rect::Rect; use sdl2::event::Event; use sdl2::keyboard::Keycode; use std::{thread, time}; u...
use ggez::{ graphics::{self, Drawable, Image}, Context, GameResult, }; use tower::core::{Character, Game, Position}; pub struct Rendering; #[derive(Default)] pub struct RenderingParam { dest: Option<Destination>, rect: Option<RectSetting>, target: Option<TargetSize>, } struct Destination { pub...
use std::convert::TryInto; use std::io::Read; pub struct Disk { pub extended: bool, pub creator: String, pub num_tracks: u8, pub num_sides: u8, pub track_size: u16, pub tracks: Vec<Track>, } impl Disk { pub fn load(filename: &str) -> std::io::Result<Disk> { log::debug!("Loading DSK...
use macros::create_option_copy; use pore_core::FileIndexOptionsShape; use pore_core::FileSearchOptions; use serde::Deserialize; use std::env; use std::fs; use std::path::Path; use std::path::PathBuf; use toml::Value; use crate::color_mode::ColorMode; const CONFIG_FILE: &str = "pore.toml"; #[create_option_copy(SearchC...
use homotopy_core::{DiagramN, Generator}; use ultraviolet::{Mat4, Vec3}; use crate::{ clay::{geom::simplicial::SimplicialMesh, layout::CubicalMeshExtractor}, draw, gl::{ array::VertexArray, buffer::ElementKind, frame::{Draw, Frame}, shader::Program, GlCtx, Result, ...
// Copyright (C) 2021 <NAME> <<EMAIL>> // SPDX-License-Identifier: MIT OR Apache-2.0 use bytes::Bytes; use rtsp_types::{Method, Request}; use url::Url; use super::{ResponseMode, RtspConnection, SessionOptions}; use crate::{error::ErrorInt, Error}; const EXISTING_CONN_TIMEOUT: std::time::Duration = std::time::Duratio...
//! Reading configuration and command line issues in arti-testing. use crate::rt::badtcp::ConditionalAction; use crate::{Action, Job, TcpBreakage}; use anyhow::{anyhow, Result}; use clap::{App, AppSettings, Arg, SubCommand}; use std::str::FromStr; use std::time::Duration; use tor_config::ConfigurationSources; /// H...
// Copyright 2018-2020 argmin developers // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according...
use std::thread; use std::sync::mpsc; use std::sync::Arc; use std::sync::Mutex; use std::collections::HashMap; use std::fs; use std::net::TcpListener; use std::net::TcpStream; use std::io::prelude::*; use std::env; /// Specifies the message type sent to workers. /// /// NewJob type contains the job to execute. /// ...
use std::collections::HashMap; use std::path::Path; use crate::types::{PayloadKeyType, PayloadType, PointOffsetType, TheMap, PayloadSchemaType}; use rocksdb::{DB, IteratorMode, Options}; use crate::entry::entry_point::{OperationResult, OperationError}; use crate::payload_storage::payload_storage::PayloadStorage; ///...
use ndarray::Array1; use pyo3::prelude::*; use pyo3::types::PyTuple; use numpy::convert::IntoPyArray; use std::thread; use std::sync::mpsc::{channel, Sender, Receiver}; use rand::SeedableRng; use rand::rngs::SmallRng; use rand::seq::SliceRandom; use catan::game::Game; use catan::state::State; use catan::player::Random...
//! `darwinia` namespace use crate::api::{Namespace, Eth}; use crate::helpers::{self, CallFuture, BatchCallFuture}; use crate::types::{Address, Block, BlockId, BlockNumber, Bytes, CallRequest, H256, H520, H64, U128, Index, SyncState, Transaction, TransactionId, TransactionReceipt, TransactionRequest, U256, Work, Filte...
use itertools::{chain, iproduct}; use rand::seq::SliceRandom; use rand::thread_rng; use serde::{Deserialize, Serialize}; use strum::IntoEnumIterator; use strum_macros::{Display, EnumIter, EnumString}; pub const NUMBER_OF_TEAMS: usize = 2; pub const PLAYERS_PER_TEAM: usize = 2; pub const NUMBER_OF_PLAYERS: usize = NUMB...
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::components::editor::EchidnaCoreEditor; use crate::prelude::*; use std::{error::Error, fmt}; use glib:...
#![recursion_limit = "512"] mod helper; use std::path::Path; use std::time::Duration; use ggez::event; use ggez::graphics; use ggez::graphics::spritebatch; use ggez::nalgebra as na; use ggez::timer; use neat::network::Network; use neat::{innovation_record::InnovationRecord, network::feedforward::Feedforward, pool::P...
//! Communication with device ports/interfaces. //! //! `lib.rs` deals with general device-level configuration, while this module deals with claiming //! and communicating with individual ports/interfaces of a device. use std::any::type_name; use std::cell::RefMut; use std::fmt; use std::marker::PhantomData; use std::...
// Copyright 2021 The BMW 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 // // Unless required by applicable law or agreed...
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ account, deploy, shared::{self, MAIN_PKG_PATH}, }; use anyhow::{anyhow, Context, Result}; use diem_config::config::NodeConfig; use diem_crypto::PrivateKey; use diem_sdk::{ client::{AccountAddress, BlockingClient...
use super::{ physics::{Collider, ColliderShape, Hitbox, RigidBody}, Model, ToBeRemoved, Transform, }; use crate::graphics::{MeshId, MeshManager}; use crate::item::{GameItem, Inventory}; use cgmath::{prelude::*, Vector3}; use specs::{prelude::*, world::LazyBuilder, Component}; use std::collections::HashMap; ///...
//! Data structures and implementations for union-of-patterns. use std::mem; use std::usize; use std::cmp::Ordering; use std::iter::FromIterator; use itertools::Itertools; use util::set::{self, IsSubsetOf}; use super::{Atom, Element}; #[cfg(feature = "pattern_class")] use super::Class; use super::build::*; use super...
// Copyright 2021 <NAME> // SPDX-License-Identifier: Apache-2.0 use crate::{ discovery::messages::{DiscoveryRequest, VerificationRequest}, hash, hash::message_hash, local::Local, packet::MessageType, peer::peer_id::PeerId, peering::messages::PeeringRequest, task::Repeat, time::{self...
//! Move commits and subtrees from one place to another. //! //! Under the hood, this makes use of Git's advanced rebase functionality, which //! is also used to preserve merge commits using the `--rebase-merges` option. use std::convert::TryFrom; use std::fmt::Write; use std::time::SystemTime; use eden_dag::DagAlgor...
// TODO: Add control flow hoisting. use fxhash::{FxHashMap, FxHashSet}; use crate::{ cfg::ControlFlowGraph, ir::{ func_cursor::{CursorLocation, FuncCursor, InsnInserter}, Block, Function, Insn, InsnData, Value, }, loop_analysis::{Loop, LoopTree}, TargetIsa, }; #[derive(Debug)] pub ...
/* * Copyright 2018 Fluence Labs Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
use crate::egui; use bevy::prelude::*; use bevy::utils::HashSet; use crate::{KbgpCommon, KbgpInput}; /// Handle for /// [`kbgp_pending_input_manual`](crate::KbgpEguiResponseExt::kbgp_pending_input_manual). pub struct KbgpInputManualHandle<'a> { pub(crate) state: &'a mut KbgpPendingInputState, } impl<'a> KbgpInpu...
use aoc_2019_intcode::Intcode; use std::{collections::HashSet, error::Error, io::Read}; fn part_one(program: Vec<isize>, phase_setting: Vec<isize>) -> isize { (0..5).fold(0isize, |acc, x| { Intcode::load(program.clone()) .run(vec![phase_setting[x], acc]) .output[0] }) } fn part...
use proc_macro::TokenStream; use quote::{quote, quote_spanned}; use syn::{ parse_macro_input, spanned::Spanned, DataStruct, DeriveInput, Field, Fields, FieldsNamed, GenericArgument, Ident, Lit, PathArguments, PathSegment, Type, }; #[proc_macro_derive(Builder, attributes(builder))] pub fn derive(input: TokenStr...
//! [GET /_matrix/client/r0/rooms/{roomId}/messages](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-rooms-roomid-messages) use js_int::{uint, UInt}; use ruma_api::ruma_api; use ruma_events::{AnyRoomEvent, AnyStateEvent, EventJson}; use ruma_identifiers::RoomId; use serde::{Deserialize, Serializ...
use std::io; use ui::{ backend::Backend, events::{EventIterator, KeyCode, KeyEvent}, style::Color, widgets::{self, Text}, Prompt, Validation, Widget, }; use super::{Choice, Filter, Transform, Validate}; use crate::{Answer, Answers, ListItem}; pub use builder::MultiSelectBuilder; mod builder; #[...
//! TypeScript specific functions. mod types; use super::expr::{parse_assignment_expression_or_higher, parse_lhs_expr, parse_name}; use crate::parser::ParserProgress; #[allow(deprecated)] use crate::parser::SingleTokenParseRecovery; use crate::syntax::expr::{parse_identifier, parse_unary_expr, ExpressionContext}; use...
/* * @Date: 2021-11-03 01:10:58 * @Author: <NAME> * @LastEditors: <NAME> * @LastEditTime: 2021-11-03 01:45:14 */ use std::cmp::{max, Ordering}; use std::collections::BinaryHeap; struct Solution; struct Node { row: usize, col: usize, hei: i32, } impl Eq for Node {} impl Ord for Node { fn cmp(&s...
#![deny(clippy::all)] #![warn( clippy::pedantic, clippy::cargo, clippy::nursery, clippy::clone_on_ref_ptr, clippy::else_if_without_else, clippy::float_cmp_const, clippy::let_underscore_must_use, clippy::mem_forget, clippy::multiple_inherent_impl, clippy::rest_pat_in_fully_bound_s...
use { crate::{ dcc_send::{self, DccSend}, packs_ranges::PacksRanges, }, lazy_static::lazy_static, rand::Rng, regex::Regex, std::{ io::{self, Read, Write}, net::{Shutdown, TcpStream}, thread, time::Duration, }, }; lazy_static! { static ref ...
use std::sync::Arc; use tracing::debug; use tracing::trace; use tracing::warn; use tracing::error; use futures_util::io::AsyncRead; use futures_util::io::AsyncWrite; use tokio::select; use event_listener::Event; use tokio::sync::broadcast::RecvError; use fluvio_future::zero_copy::ZeroCopyWrite; use fluvio_future::tas...
//! Checks to make sure that the platform can be used concurrently. //! //! This generally fails on NVidia hardware. #![allow(unused_imports, unused_variables, dead_code, unused_mut)] use std::thread::{self, JoinHandle}; use std::sync::mpsc; use std::time::Duration; use tests::rand::{self, Rng}; use core::{self, Plat...
extern crate alloc; use alloc::boxed::Box; use core::alloc::Layout; use core::fmt; use core::panic::PanicInfo; use linked_list_allocator::LockedHeap; use spin::Mutex; use crate::hal::{Clint, HTIFConsole, HTIFPowerDown}; pub const CLINT_BASE: usize = 0x02000000; #[global_allocator] static ALLOCATOR: LockedHeap = Loc...
use wasm_bindgen::prelude::*; use std::sync::Arc; use once_cell::sync::Lazy; use futures::stream::StreamExt; use futures_signals::map_ref; use futures_signals::signal::{Mutable, SignalExt}; use futures_signals::signal_vec::MutableVec; use gloo_timers::future::IntervalStream; use dominator::{Dom, html, clone, events, cl...
use super::{Bdd, BddValuation, BddValuationIterator, BddVariable}; use crate::{BddNode, BddPointer}; use std::fmt::{Display, Error, Formatter}; use std::ops::Index; impl BddValuation { /// Create a new valuation from a vector of variables. pub fn new(values: Vec<bool>) -> BddValuation { BddValuation(va...
#![feature(step_trait)] pub mod core; pub mod exclude; mod traits { /// Trait for pow-supported numbers. pub trait Pow<RHS> { type Output; fn pow(self, exp: RHS) -> Self::Output; } /// Defines a additive identity element for Self. pub trait Zero: Sized + std::ops::Add<Self...
use super::Diagnostic; use crate::util::{def_to_name, ItemIdent, ItemMeta}; use proc_macro2::{Span, TokenStream as TokenStream2}; use quote::{quote, quote_spanned, ToTokens}; use std::collections::HashSet; use syn::{parse_quote, spanned::Spanned, Attribute, AttributeArgs, Ident, Item, Meta, NestedMeta}; fn meta_to_vec...
use crate::common::{self, *}; struct WindowsMessageAction { title: Vec<u16>, id: i32, cb: callbacks::Action, } impl From<(String, callbacks::Action)> for WindowsMessageAction { fn from(a: (String, callbacks::Action)) -> Self { WindowsMessageAction { id: { ...
#![cfg_attr(not(feature = "std"), no_std)] #![allow(clippy::unused_unit)] use codec::{Decode, Encode}; use frame_support::{ dispatch::DispatchResult, ensure, sp_runtime::{ traits::{DispatchInfoOf, SignedExtension}, transaction_validity::{InvalidTransaction, TransactionValidity, TransactionValidityError, ValidT...
use crate::WSClient; use std::collections::HashMap; use std::sync::mpsc::Sender; use super::utils::ensure_frame_size; use super::ws_client_internal::{MiscMessage, WSClientInternal}; use super::{Candlestick, Level3OrderBook, OrderBook, OrderBookTopK, Ticker, Trade, BBO}; use log::*; use serde_json::Value; pub(super) ...
#![feature(label_break_value)] use std::io::Write; use std::str::FromStr; use std::fmt::Display; use std::path::{Path, PathBuf}; use cpython::{Python, PyDict, PyResult, PyModule}; use serde::{Serialize, Deserialize}; use futures::executor::block_on; #[derive(Serialize, Deserialize, Debug)] struct Message { conte...
use crate::{error::Error, util::next_different_sizes, Va}; use segsource::TryFromSegment; pub const IMAGE_GUARD_CF_FUNCTION_TABLE_SIZE_SHIFT: u32 = 28; #[derive(TryFromSegment, Debug, Clone)] #[from_seg(error(crate::Error), also_needs(is_32_plus: bool))] pub struct LoadConfig { /// Flags that indicate attributes ...
use std::collections::HashMap; use std::fs::{self, OpenOptions}; use std::io::prelude::*; use std::path::{Path, PathBuf}; use std::str; use flate2::read::ZlibDecoder; use flate2::write::ZlibEncoder; use flate2::Compression; use crate::index; use crate::util::*; pub mod blob; pub mod commit; pub mod object; pub mod t...
use std::collections::HashMap; use std::hash::Hash; use std::hash::Hasher; use std::rc::Rc; use itertools::Itertools; use std::cell::RefCell; use transport_mode::TransportMode; use agent::Agent; // TODO: Is supportiveness the same as capacity /// A Neighbourhood #[derive(Clone, Serialize, Deserialize)] pub struct Neig...
//! Module containing [`RegistryServer`] to run the registry HTTP server. use std::{collections::HashMap, str::FromStr, sync::Arc}; use axum::{ body::Body, extract::{Path, Query}, http::{HeaderMap, Response}, routing, Extension, Router, }; use bitcoinsuite_core::{Hashed, LotusAddress, LotusAddressErro...
use std::net::TcpStream; use std::io::Read; use std::io::Write; use std::os::unix::io::RawFd; use std::os::unix::io::AsRawFd; use std::collections::HashMap; use std::str::from_utf8; use std::ops::Deref; use std::mem::swap; use std::fs::read; use crate::ProtocolEvent::ReplaceWith; use crate::ProtocolEvent::Remove; use ...
use crate::data::{ApplicationError, LogStream, ParsedLine, StreamEntry}; use core::pin::Pin; use core::task::Context; use futures::stream::{Stream, StreamExt}; use futures::task::Poll; use log::*; use std::vec::Vec; #[derive(PartialEq)] enum SourceState { NeedsPoll, Delivered, Finished, Failed, } #[de...
use std::{fmt::Debug, fs::File}; use serde::Serialize; use tracing::{self, debug, span, trace, Level}; use yaml_rust::Yaml; use crate::{ udev::UdevEvent, usb::{UsbDevice, UsbDevices, UsbEvent, UsbPort, UsbPorts}, }; #[derive(Serialize, PartialEq, Debug)] pub struct Match { on: UsbEvent, devices: Vec<...
use regex::Regex; use std::collections::HashMap; use std::collections::HashSet; use rand::{seq::SliceRandom, thread_rng}; #[derive(Debug, Clone, Default)] pub struct WordSet { pub words: Vec<&'static Word>, pub chars: usize, pub missing: Vec<char>, } impl WordSet { /// Shuffles all `words` in the Wo...
use async_std::{ sync::{Arc, RwLock}, task, }; use serde_json::{json, Value}; use std::collections::HashMap; use std::time::Duration; use tide::{Body, Error, Request, Response}; use ckb_testtool::{builtin::ALWAYS_SUCCESS, context::Context}; use ckb_tool::ckb_types::{bytes::Bytes, core::Capacity, packed::*, pre...
#[macro_use] extern crate log; use crate::constants::*; use anyhow::Context; use netlink_packet_generic::{GenlFamily, GenlHeader}; use netlink_packet_utils::{nla::NlasIterator, traits::*, DecodeError}; use nlas::WgDeviceAttrs; use std::convert::{TryFrom, TryInto}; pub mod constants; pub mod nlas; mod raw; #[derive(C...
use std::vec::Vec; struct Coordinates { x: i32, y: i32, } fn get_new_position(x: i32, y: i32, direction: char) -> Coordinates { match direction { '^' => Coordinates { x, y: y + 1 }, '>' => Coordinates { x: x + 1, y }, 'v' => Coordinates { x, y: y - 1 }, '<' => Coordinates {...
use std::{ boxed::Box, collections::HashMap, sync::{Arc, RwLock}, }; use std::net::SocketAddr; use rpcx_protocol::*; use std::{ io::{BufReader, BufWriter, Write}, net::{Shutdown, TcpListener, TcpStream}, }; use std::{ os::unix::io::{AsRawFd, RawFd}, thread, }; use scoped_threadpool::Pool...
use crate::ast::{Expr, SubqueryExpr}; use nom::branch::alt; use nom::bytes::complete::tag; use nom::combinator::{map, opt}; use nom::sequence::{delimited, preceded, tuple}; use nom::{IResult, Parser}; pub use binary::*; pub use error::*; pub use func::*; pub use group::*; pub use helper::*; pub use literal::*; pub use...
use bevy::prelude::*; use bevy::window::WindowMode; use bevy::diagnostic::{Diagnostics, FrameTimeDiagnosticsPlugin}; use crate::map::shader::MapMaterial; use crate::loading::LoadRomeAssets; use crate::map::{RomeMapPlugin, LIGHT_POS, LatLong}; use goshawk::{RtsCamera, ZoomSettings, PanSettings, TurnSettings}; use bevy::...
use rand::seq::SliceRandom; use rocket_contrib::json::JsonValue; use std::collections::HashMap; use log::info; use crate::{Battlesnake, Board, Game, Coord}; pub fn get_info() -> JsonValue { info!("INFO"); // Personalize the look of your snake per https://docs.battlesnake.com/references/personalization r...
use crate::*; use log::{error, info}; use nes::*; use rand::prelude::*; use std::cell::RefCell; use std::collections::VecDeque; use std::rc::Rc; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use web_sys::{ HtmlCanvasElement, Request, RequestInit, WebGl2RenderingContext, WebGlContextAttributes, WebGlP...
extern crate log; extern crate xml; extern crate yaserde; #[macro_use] extern crate yaserde_derive; use std::io::Write; use yaserde::ser::to_string; use yaserde::YaSerialize; macro_rules! convert_and_validate { ($type: ty, $value: expr, $content: expr) => {{ #[derive(YaSerialize, PartialEq, Debug)] #[yaserd...
//! Bindings for `unicornafl` //! use core::marker::PhantomData; use alloc::{boxed::Box, vec::Vec}; use libc::{c_int, c_void}; use crate::{ffi::uc_handle, uc_error, Unicorn}; /// FFI for the forkserver extern "C" { fn uc_afl_forkserver_start( engine: uc_handle, exits: *const u64, exit_co...
mod error; mod parser; use core::fmt; pub use error::Error; pub use parser::{Parser, VALUE_SEPARATOR}; use std::cmp::Ordering; use std::collections::HashMap; use std::fmt::Display; const TYPES_NO_VALUE: &[&str] = &["bool"]; // TODO: Arg type that can take stdin? < file redirected into? // use std::io::{self, stdin, ...
use crate::packet_info::PacketInfo; use crate::plugin::{Plugin, PluginResult, PLUGIN_L4}; use crate::{output, plugin_builder}; use libpcap_tools::{FiveTuple, Packet}; use rusticata::tls::*; use rusticata::*; use serde_json::{self, json}; use std::collections::HashMap; use tls_parser::TlsVersion; struct Stats<'a> { ...
use value::*; use eval; use std::fmt::Debug; use Interpreter; /// Generic helper method to simplify testing. fn test_runs<'a, T: PartialEq + Debug, U, I: Iterator<Item = (&'a str, U)>, F: Fn(Result<Expr, String>) -> T, G: Fn(U) -> T> (runs: I, a...
use std::cmp::{max, min}; use std::io; use std::io::Read; use std::str::FromStr; type Error = Box<dyn std::error::Error>; type Result<T> = std::result::Result<T, Error>; fn main() -> Result<()> { let mut input = String::new(); io::stdin().read_to_string(&mut input)?; let lines: Vec<Vec<Movement>> = input...
use std::marker::PhantomData; /// The audio buffers used during processing. This contains the output audio output buffers with the /// inputs already copied to the outputs. You can either use the iterator adapters to conveniently /// and efficiently iterate over the samples, or you can do your own thing using the raw ...
/* Copyright 2021 Integritee AG and Supercomputing Systems AG 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...
use super::*; #[derive(Copy, Clone, Debug)] pub struct Point { pub x: f32, // horizontal distance from origin in meters pub y: f32, // vertical distance from origin in meters pub z: f32, } impl From<(&Point, &Location)> for Location { // Convert point with respect to origin to location fn from((po...
pub mod ui; use ggez; use ggez::error::GameResult; use ggez::{event, Context}; pub(crate) use ui::{palette::Pal, Ui}; const FONT_PATH: &'static str = "/roguelike-font-16.png"; const FONT_MAP: &'static str = "\ ABCDEFGHIJKLMNOPQRSTUVWXYZ\ ÀÁÂÄÇÈÉÊËÒòÔÖÙùÛÜ\ abcdefghijklmnopqrstuvwxyz\ àáâäçè\ #%&@$.,!?:;'\"()[]*/\\+-...
use nannou::geom::Vec3; use std::f32::consts::PI; pub struct SphericalHarmonics { levels: usize, pub terms: Vec<f32>, } impl SphericalHarmonics { pub fn from_terms(levels: usize, terms: Vec<f32>) -> SphericalHarmonics { SphericalHarmonics { levels, terms } } pub fn evaluate(&self, directi...
#![warn(missing_docs)] /*! # Sap Sap is a testing library that provides abstractions on top of [`wasm_bindgen`] for testing DOM nodes. The main feature of this crate is using `queries` to find elements in the DOM and perform actions that simulate user behaviour to assert that your application behaves correctly. The ...
use num_traits::Zero; use std::hash::Hash; /// Compute a shortest path using the [IDA* search /// algorithm](https://en.wikipedia.org/wiki/Iterative_deepening_A*). /// /// The shortest path starting from `start` up to a node for which `success` returns `true` is /// computed and returned along with its total cost, in ...
use std::{ borrow::Borrow, ffi::OsStr, path::{Path, PathBuf}, }; use log::{debug, warn}; use snapshot::{Snapshot, SnapshotPreview}; use crate::result::IntegrityCheckResult; mod snapshot; type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>; pub struct Backup { location: PathBuf, ...
//! Build progress tracking and reporting, for the purpose of display to the //! user. use std::collections::VecDeque; use std::time::Duration; use std::time::Instant; use crate::graph::Build; use crate::graph::BuildId; use crate::work::BuildState; use crate::work::StateCounts; #[allow(clippy::uninit_assumed_init)] ...
#![cfg(test)] use super::*; use frame_support::{ord_parameter_types, parameter_types, weights::Weight, PalletId}; use frame_system::{self as system}; use hex_literal::hex; use sp_core::H256; use sp_runtime::{ testing::Header, traits::{AccountIdConversion, BlakeTwo256, IdentityLookup}, Perbill, }; use cra...
use std::{ ffi::CStr, io::{self, ErrorKind}, mem, ptr, }; use log::{error, trace}; use tun::{platform::Device as TunDevice, Device}; /// These numbers are used by reliable protocols for determining /// retransmission behavior and are included in the routing structure. #[repr(C)] #[allow(non_camel_case...
use std::result; use colour::Rgb24; #[derive(Debug)] pub enum Error { // Indicates value for a field is too high AnsiRangeError, } pub type Result<T> = result::Result<T, Error>; #[derive(Clone, Copy, Debug)] pub enum NormalColour { Black, Red, Green, Yellow, Blue, Magenta, Cyan, ...
//! Provides userspace with the UART API that the nRF51822 serialization library //! requires. //! //! This capsule handles interfacing with the UART driver, and includes some //! nuances that keep the Nordic BLE serialization library happy. //! //! Usage //! ----- //! //! ```rust //! let nrf_serialization = static_ini...
use std::fs; use std::io::{self, Write as _}; use std::path::{Path, PathBuf}; use crossterm::style::{Attribute, Color, ResetColor, SetAttribute, SetForegroundColor}; use serde::Serialize; use crate::config::{Config, Settings}; use crate::output::{Block, Line, LineContent, Output}; use crate::{cli, git}; pub struct E...
//! Write some text for your users to read. use crate::{ layout, Color, Element, Hasher, HorizontalAlignment, Layout, Length, Point, Rectangle, Size, VerticalAlignment, Widget, }; pub use iced_core::text::Hit; use std::hash::Hash; /// A paragraph of text. /// /// # Example /// /// ``` /// # type Text = iced_...
// Copyright 2016 PingCAP, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
use chrono::{Local, NaiveDateTime}; use fast_common::{common::orm_config::RB, utils::redis_util::{self, RedisUtil}}; use fast_common::models::user::{User, UserLoginVo, UserVo, UserRoleMenuVo}; use fast_common::utils::crypt_util; use rbatis::core::db::DBExecResult; use rbatis::core::Result; use rbatis::crud::CRUD; use r...
// TODO: in the next breaking change, this should possibly become its own module use crate::{ geom::{Rectangle, Vector, Transform}, input::MouseButton, graphics::{Background, Font, FontStyle, GpuTriangle, Image, Mesh, Vertex, View}, lifecycle::Window, }; use immi::{Draw, DrawContext, GlyphInfos, Matrix}...
use crate::errors::{ErrorKind, Result}; use simple_asn1::{BigUint, OID}; /// Supported PEM files for EC and RSA Public and Private Keys #[derive(Debug, PartialEq)] enum PemType { EcPublic, EcPrivate, RsaPublic, RsaPrivate, } #[derive(Debug, PartialEq)] enum Standard { // Only for RSA Pkcs1, ...
//! Output data structure. use crate::{ access, clone, data::Histogram, err::Error, fmt_report, fs::Save, geom::Cube, img::Image, ord::{Register, X, Y, Z}, util::fmt::DataCube, }; use ndarray::Array3; use std::{ fmt::{Display, Formatter}, ops::AddAssign, path::Path, }; ...
use socket2::SockAddr; use std::ffi::{CStr, CString}; use std::io; use std::mem; use std::net::SocketAddr; use std::ptr; #[cfg(unix)] use libc::{getaddrinfo as c_getaddrinfo, freeaddrinfo as c_freeaddrinfo, addrinfo as c_addrinfo}; #[cfg(windows)] use winapi::shared::ws2def::{ADDRINFOA as c_addrinfo}; #[cfg(windows)]...
use acpi::{ handler::{AcpiHandler, PhysicalMapping}, Acpi, AcpiError, }; use aml::{ AmlContext, AmlName, }; use x86_64::{ structures::paging::{ mapper, PageTable, OffsetPageTable, Page, PageSize, PhysFrame, Mapper, Size4KiB, F...
// -*- mode: rust; -*- // // This file is part of curve25519-dalek. // Copyright (c) 2016-2019 <NAME>, <NAME> // See LICENSE for licensing information. // // Authors: // - <NAME> <<EMAIL>> // - <NAME> <<EMAIL>> //! Various constants, such as the Ristretto and Ed25519 basepoints. //! //! Most of the constants are given...
use crate::{ arbitraries::queries::{ input_info_strategies::input_info_strategies::{ create_and_retrieve_object, get_input_info_strategies }, queries::{ ArbitraryResult, generate_arbitrary_result, InputInfo, MutationType...