text
stringlengths
3.09k
13.9k
use yew::services::storage::{StorageService, Area}; use yew::prelude::worker::*; use base64::decode_config as b64_dec; use serde_json::Value as JsonValue; use serde_json; use failure::Error; use base64; use wire::user::{UserRole, Jwt}; use chrono::NaiveDateTime; use identifiers::user::UserUuid; use std::collections...
use serde::{Serialize, Deserialize}; use super::*; use crate::block::{Block, generate_rand_block}; use crate::crypto::hash::{H256, Hashable, H160}; use std::collections::{HashMap, HashSet}; use crate::transaction::{Transaction, SignedTrans, Output, verify}; use crate::state::State; use std::hash::Hash; // use crate::bl...
use super::super::argparse::ParsedArgs; use super::super::config::models::ConfigFile; use super::super::execute; use super::super::util; use crate::subcommands::subcommand::MrtSubcommand; use clap::SubCommand; use colored::{ColoredString, Colorize}; use std::cmp::max; use std::path::PathBuf; use std::process::Command; ...
// Salah // // See LICENSE for more details. // Copyright (c) 2019-2021 <NAME>. All rights reserved. // use crate::astronomy::unit::{Angle, Coordinates}; pub struct Qiblah(f64); impl Qiblah { pub fn new(location_coordinates: Coordinates) -> Self { // Equation from "Spherical Trigonometry For the use ...
/* * From https://www.redblobgames.com/x/2003-rust-network-game/ * Copyright 2020 <NAME> <<EMAIL>> * License: Apache-2.0 <http://www.apache.org/licenses/LICENSE-2.0.html> * * Example game server * * Each connection is handle by a network thread, which both listens * to the network and listens to a message queue...
/* * Copyright (c) 2018 by the author(s) * * ============================================================================= * * Licensed under either of * - Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) * - MIT License (http://opensource.org/licenses/MIT) * at your option. * * ==...
// Copyright 2022, The Tremor Team // // 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 t...
use crossbeam_deque::{Steal, Stealer, Worker}; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::sync::{Mutex, TryLockError}; use std::thread::yield_now; use crate::current_num_threads; use crate::iter::plumbing::{bridge_unindexed, Folder, UnindexedConsumer, UnindexedProducer}; use crate::iter::Par...
use super::PyMethod; use crate::{ builtins::{PyBaseExceptionRef, PyList, PyStr}, function::{FuncArgs, IntoFuncArgs}, object::{AsObject, PyObject, PyObjectRef, PyPayload, PyResult}, vm::VirtualMachine, }; /// Trace events for sys.settrace and sys.setprofile. enum TraceEvent { Call, Return, } im...
use std::path::{Path, PathBuf}; use std::fs::File; use std::io::Read; pub fn render_playpen(s: &str, path: &Path) -> String { // When replacing one thing in a string by something with a different length, the indices // after that will not correspond, we therefore have to store the difference to correct this ...
use crate::config::EngineConfig; use bson::Document; use std::collections::BTreeMap; use std::path::PathBuf; use std::sync::Arc; use std::time::{Duration, SystemTime}; use tokio::fs; use tokio::sync::RwLock; use uuid::Uuid; pub type RusDbCollection = Arc<RwLock<BTreeMap<Uuid, Document>>>; struct RusCollecti...
use std::collections::{HashMap, HashSet, VecDeque}; use std::convert::From; use std::fs::Metadata; use std::path::PathBuf; use std::process::abort; use std::sync::{Arc, Mutex}; use std::thread::sleep; use std::time::{Duration, SystemTime}; use failure::Error; use futures::future::ok; use futures::Stream; use prometheu...
//! git-style registered tempfiles that are removed upon typical termination signals. //! //! This crate installs signal handlers the first time its facilities are used. //! These are powered by [`signal-hook`] to get notified when the application is told to shut down //! using signals to assure these are deleted. The ...
/*! `npm` support. */ use std::{ io::{self}, path::{Path, PathBuf}, process::{Command, Stdio}, }; use super::resource_dir::ResourceDir; #[cfg(not(windows))] const NPM_CMD: &str = "npm"; #[cfg(windows)] const NPM_CMD: &str = "npm.cmd"; /// Generate resources with run of `npm install` prior to collecting ...
//! Point cloud triangulation. use std::collections::HashMap; use std::collections::hash_map::Entry; use alga::general::Real; use na::Point3; use na; use math::Point; use utils; use bounding_volume; use procedural::{IndexBuffer, TriMesh}; struct Triangle<N: Real> { idx: Point3<usize>, circumcircle_center: Po...
//! //! Adds functionality for physically based rendering (PBR). //! mod material; #[doc(inline)] pub use material::*; mod deferred_pipeline; #[doc(inline)] pub use deferred_pipeline::*; mod mesh; #[doc(inline)] pub use mesh::*; mod instanced_mesh; #[doc(inline)] pub use instanced_mesh::*; use crate::camera::*; us...
use std::collections::HashMap; use std::path::PathBuf; use num_rational::Ratio; use psutil::disk; use size::Size; use tui::buffer::Buffer; use tui::layout::{Constraint, Rect}; use tui::style::Modifier; use tui::widgets::{Row, Table, Widget}; use crate::colorscheme::Colorscheme; use crate::update::UpdatableWidget; use...
use ndarray::prelude::*; use tsuga::prelude::*; use minifb::{Key, ScaleMode, Window, WindowOptions}; use mnist::*; use ndarray_stats::QuantileExt; use rand::prelude::*; const LABELS: &[&'static str] = &["0 ", "1 ", "2 ", "3 ", "4 ", "5 ", "6 ", "7 ", "8 ", "9 "]; fn main() { let (input, output, test_input, test_...
use std::{ collections::{BTreeMap, BTreeSet, HashMap}, env::{self, VarError}, fs::{self, File}, io::{self, BufReader, Cursor, Read, Seek, SeekFrom, Write}, marker::PhantomData, ops::RangeInclusive, path::{Path, PathBuf}, }; use bytes::{Buf, Bytes}; use itertools::iproduct; use path_macro::p...
use crate::{ gui::{BuildContext, Ui, UiMessage, UiNode}, load_image, Message, }; use rg3d::{ core::{color::Color, pool::Handle}, engine::resource_manager::ResourceManager, gui::{ brush::Brush, button::ButtonBuilder, grid::{Column, GridBuilder, Row}, image::ImageBuilde...
use crate::db::errors::{DError, DResult}; use crate::db::format::{SequenceNumber, ValueType}; use crate::db::log_writer::HEADER_SIZE; use crate::db::memory_table::MemoryTable; use crate::utils::coding::{ decode_u32_le, decode_u64_le, encode_u32_le, encode_u64_le, get_length_prefixed_slice, put_length_prefixed_s...
use bio::io::fasta; use std::collections::HashMap; use std::io; use crate::read_correction::CorrectionResults; /// This is a wrapper for the bio::io::fasta::Writer that forces reads to be written in a specified order. /// Reads that are not ready to be written are stored until the reads before it are written. /// # ...
mod asof; mod groups; use crate::prelude::*; use crate::utils::slice_slice; use asof::*; use num::Bounded; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use std::borrow::Cow; #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde"...
// Copyright 2019 <NAME> // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writi...
//! data_file_scan_mod use crate::review_mod::*; use crate::*; use std::{fs, path::Path, path::PathBuf}; use unwrap::unwrap; #[derive(Clone, Debug)] pub struct ReviewPk { pub crate_name: String, pub reviewer_id: String, pub version: String, } #[derive(Clone, Debug)] pub struct OneFileReviewsPk { pub ...
use crate::{error::{Error, MajorFlags, gss_error}, name::Name, oid::{OidSet, NO_OID_SET}}; use libgssapi_sys::{ gss_OID_set, gss_acquire_cred, gss_cred_id_struct, gss_cred_id_t, gss_cred_usage_t, gss_name_struct, gss_name_t, gss_release_cred, gss_inquire_cred, OM_uint32, GSS_C_ACCEPT, GSS_C_BOTH, GSS_C_INIT...
use failure::Error; use reqwest::{self, blocking::Client, blocking::Response}; use serde::{Deserialize, Serialize}; use crate::Commit; #[derive(Serialize, Deserialize, Debug)] struct GithubCommitElem { commit: GithubCommit, sha: String, } #[derive(Serialize, Deserialize, Debug)] struct GithubCommit { auth...
use amethyst::{ assets::LoaderBundle, core::transform::TransformBundle, ecs::*, renderer::{ plugins::{RenderPbr3D, RenderToWindow}, rendy::hal::command::ClearColor, types::DefaultBackend, RenderingBundle, }, utils::application_root_dir, Application, GameData, ...
use std::collections::BTreeSet; use map_gui::load::FileLoader; use map_gui::tools::{checkbox_per_mode, PopupMsg}; use synthpop::{Scenario, TripMode}; use widgetry::{ Drawable, EventCtx, GeomBatch, GfxCtx, HorizontalAlignment, Key, Line, Panel, SimpleState, Slider, State, Text, TextExt, Toggle, VerticalAlignmen...
//! Galmon integration. //! //! This module contains a reader for the //! [Galmon transport protocol](https://github.com/berthubert/galmon#internals). //! The reader can be used to obtain INAV frames and OSNMA data from the //! [Galmon](https://github.com/berthubert/galmon) tools, such as `ubxtool`. pub mod navmon { ...
// Backup of the main.rs (2022/01/19) use lycaon::booster::Booster; use lycaon::booster::LPBoost; // use lycaon::base_learner::DStump; use lycaon::read_csv; use std::time::Instant; use std::fs::OpenOptions; use std::io::Write; pub mod stump; pub mod ltf; pub mod average; // pub mod zdd_softboosting; // use zdd_soft...
extern crate nalgebra as na; use crate::{activation_function::ActivationFunction, dataset::DatasetNxN, cost_function::CostFunction}; use std::{error, fmt, ops}; use na::DMatrix; use rand::{Rng, prelude::StdRng, SeedableRng}; use rand_distr::{StandardNormal, Standard}; use rayon::prelude::*; pub const STEP_SIZE: f32 ...
#![allow(missing_docs)] pub(crate) mod disposal; pub mod error; mod events; pub mod message; pub mod mixer; pub(crate) mod udp_rx; pub(crate) mod udp_tx; pub(crate) mod ws; use super::{ connection::{error::Error as ConnectionError, Connection}, Config, }; use crate::events::CoreContext; use flume::{Receiver, ...
use ndarray::{s, Array, ArrayBase, Axis, Data, Dimension, Ix3, Zip}; use num_traits::{Float, ToPrimitive}; use crate::{array_like, dim_minus_1, Mask}; /// Binary median filter. /// /// A 3x3 structuring element (`Kernel3d::Full`) is used except on the borders, where a smaller /// structuring element is used. pub fn m...
//! A rust implementation of i3_vim_focus //! //! //! Original version from //! https://faq.i3wm.org/question/3042/change-the-focus-of-windows-within-vim-and-i3-with-the-same-keystroke/ //! //! Usage: //! i3-vim-focus [left|right|up|down] //! //! Requires that libxdo is installed extern crate jwilm_xdo as xdo; exte...
// Copyright (c) 2016 <NAME> // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, subli...
//! Agents of the simulation. use super::{ sensors::{Constraint, Sensor}, Point, Reward, State, Vector, }; use nalgebra as na; use std::{ rc::Rc, sync::atomic::{AtomicUsize, Ordering}, }; static ID_COUNTER: AtomicUsize = AtomicUsize::new(0); /// A rover; contains an [optional](Option) [sensor](Sensor...
extern crate printpdf; extern crate clap; extern crate glob; use clap::{Arg, App}; use printpdf::*; use glob::{glob, Paths}; use std::env; use std::path::{PathBuf}; use std::fs::File; use std::process; use std::io::prelude::*; use std::io::{self, BufReader, BufWriter}; fn read_file(file_location: &Pat...
use std::cell::RefCell; use std::collections::HashMap; use std::fmt::{Display, Formatter}; use std::ops::Range; use std::rc::Rc; use crate::interpreter::InterpreterError::*; use crate::parser::{Context, Expression, ExpressionWithMetadata, Function, Value}; #[derive(Debug)] pub struct InterpreterErrorWithSpan { pu...
use std::fs; use std::collections::{HashMap, HashSet, VecDeque}; use crate::trees::common::SearchBuffer; #[derive(Debug)] /// Structure representing a look-up tree with String as node names pub struct NamedLuTree { names: Vec<Box<String>>, name2idx: HashMap<String, usize>, parents: Vec<Option<usize>>, ...
// calculations inspired by // https://github.com/AcademySoftwareFoundation/openexr/blob/master/OpenEXR/IlmImf/ImfTiledMisc.cpp //! Simple math utilities. use std::convert::TryFrom; use crate::error::{i32_to_usize}; use crate::error::Result; use std::ops::{Add, Sub, Div, Mul}; use std::fmt::Debug; /// Simple two-di...
#[macro_use] extern crate glium; extern crate arcball; extern crate cgmath; use arcball::ArcballCamera; use cgmath::{Vector2, Vector3}; use glium::index::PrimitiveType; use glium::{glutin, Surface}; #[derive(Copy, Clone)] struct Vertex { pos: [f32; 3], color: [f32; 3], } implement_vertex!(Vertex, pos, color);...
#![no_std] //! Generic SPI interface for display drivers pub mod buffered_graphics; mod command; mod consts; mod display; mod error; use core::cmp::min; use display_interface::{DisplayError, WriteOnlyDataCommand}; use embedded_hal::{blocking::delay::DelayMs, digital::v2::OutputPin}; use consts::{ssd1320, ssd1320z2}...
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. // Modified from https://github.com/rust-lang/cargo/blob/426fae51f39ebf6c545a2c12f78bc09fbfdb7aa9/src/cargo/util/cpu.rs // TODO: Maybe use https://github.com/heim-rs/heim is better after https://github.com/heim-rs/heim/issues/233 is fixed. use derive_m...
#![feature(test)] #![deny(warnings)] extern crate futures; extern crate hyper; extern crate pretty_env_logger; extern crate test; extern crate tokio; use std::io::{Read, Write}; use std::net::{TcpListener, TcpStream}; use std::sync::mpsc; use futures::{stream, Future, Stream}; use futures::sync::oneshot; use hyper:...
use num::Integer; use slice_deque::SliceDeque; use std::cmp::Ordering; use std::collections::{BTreeMap, HashSet}; use std::f64; type AsteroidLocation = (i64, i64); fn is_asteroid_obstructed( current_asteroid: &AsteroidLocation, target_asteroid: &AsteroidLocation, asteroids: &HashSet<AsteroidLocation>, ) -...
//! ## Language server protocol //! //! Specification can be found at //! <https://microsoft.github.io/language-server-protocol/specifications/specification-current/>. //! //! We're not interested in supporting or even parsing the whole protocol, we only want a subset //! that will allow us to mupltiplex messages betwe...
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. use crate::blob::url::redact_query_sas_sig; use anyhow::{Context, Result}; use backoff::{self, future::retry_notify, ExponentialBackoff}; use std::{ ffi::{OsStr, OsString}, fmt, path::Path, process::Stdio, sync::atomic::{Ato...
//! Kerberos 5 structures //! //! - [RFC1510](https://tools.ietf.org/html/rfc1510) The Kerberos Network Authentication Service (V5) //! - [RFC3961](https://tools.ietf.org/html/rfc3961) Encryption and Checksum Specifications for Kerberos 5 //! - [RFC3962](https://tools.ietf.org/html/rfc3962) Advanced Encryption Standard...
use std::sync::Arc; use rosu_v2::prelude::{GameMode, OsuError, Username}; use twilight_model::application::interaction::{ application_command::CommandOptionValue, ApplicationCommand, }; use crate::{ commands::{ check_user_mention, osu::{option_discord, option_name}, parse_discord, Doub...
use std::rc::Rc; use std::{thread, time}; use clap::{App, Arg}; use emulator::asci::*; use emulator::bus::Bus; use emulator::cpu::{Mode, Register, CPU}; use emulator::dma::*; use emulator::prt::*; use emulator::ram::*; use emulator::rom::*; use emulator::sdcard::*; fn print_cpu(cpu: &mut CPU, bus: &mut Bus) { le...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Timer control register"] pub ctrl: crate::Reg<ctrl::CTRL_SPEC>, #[doc = "0x04 - Current Value"] pub value: crate::Reg<value::VALUE_SPEC>, #[doc = "0x08 - Reload value. A write to this register sets the current value"] ...
use clap::{App, AppSettings, Arg, ArgMatches}; use crate::config::Config; use crate::error::Result; // TODO --add-site (in addition to defaults) // TODO set_api_key should probably just be a bool, since we have config pub struct Opts { pub list_sites: bool, pub print_config_path: bool, pub update_sites: b...
use std::path::PathBuf; use sabi_math::{is_point_in_triangle, Vector2, Vector3, Vector4}; use sabi_serialize::{generate_uid_from_string, Deserialize, Serialize, SerializeFile, Uid}; use crate::{create_quad, MeshDataRef, VertexData}; pub const DEFAULT_MESH_CATEGORY_IDENTIFIER: &str = "SABI_Default"; #[repr(C)] #[der...
use super::{ExecutionError, Felt, ProgramInputs, Word}; use vm_core::{utils::IntoBytes, AdviceSet, StarkField}; use winter_utils::collections::{BTreeMap, Vec}; // ADVICE PROVIDER // ================================================================================================ /// An advice provider supplies non-det...
mod blosum; use std::process; use bio::io::fasta; use bio::io::fasta::Record; use blosum::{blosum45, blosum50, blosum62, blosum80, blosum90, BlosumMatrix, MinScore}; use indicatif::{ProgressBar, ProgressStyle}; use structopt::StructOpt; #[derive(StructOpt, Debug)] enum Method { /// Output percent identities. ...
use super::event_builder::{ TYPE_ADDRESS, TYPE_BOOL, TYPE_BYTEARRAY, TYPE_H256, TYPE_INT, TYPE_STRING, }; use super::Error; use super::Source; use super::{VmValueBuilderCommon, VmValueDecoder, VmValueEncoder}; use crate::abi::event_builder::TYPE_LIST; use crate::prelude::*; use core::ops::{Deref, DerefMut}; pub st...
/*! # fltk-build Allows creating native C/C++ fltk/cfltk modules to be used from Rust. This is done by exposing the include paths and lib paths from the built fltk-sys crate on your system. ## Usage ```toml,ignore [dependencies] # or [dev-dependencies] fltk = "1.2.17" # this won't work with flt...
use crate::loading::LoadCompleteEvent; use crate::lobby::LobbyEvent; use crate::states::ServerState; use bevy::prelude::*; use bevy::utils::HashMap; use bevy_networking_turbulence::{NetworkEvent, NetworkResource, NetworkingPlugin}; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use wizardwars_shared::components::{Client...
//! Convert lottie animations to GIF files. #![warn(rust_2018_idioms)] #![deny(elided_lifetimes_in_paths, unreachable_pub)] use gif::{DisposalMethod, Encoder, EncodingError, Frame, Repeat}; use rgb::{alt::BGRA8, RGBA8}; use rlottie::Surface; use std::{ fmt::{self, Display, Formatter}, io::Write, slice }; pub use ...
//! Types specific to Lucky that are used throughout the app use indexmap::IndexMap; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use strum_macros::{AsRefStr, EnumString, EnumVariantNames}; use crate::rpc::ScriptStatus as RpcScriptStatus; use crate::rpc::ScriptStatus_state as RpcScriptState; ...
use super::{AsyncReadBody, DEFAULT_CAPACITY}; use bytes::Bytes; use http::{header, HeaderValue, Response}; use http_body::{combinators::BoxBody, Body}; use std::{ future::Future, io, pin::Pin, task::{Context, Poll}, }; use tower_service::Service; /// A file. #[derive(Clone, Debug)] pub struct File { ...
use serde_derive::{Deserialize, Serialize}; use std::{fmt, fs::File, io::Write, sync::Mutex}; use tracing::*; /// Thread safe json logger that rights records of `ChaseStepRecord` into a given log file. pub struct JsonLogger { log_file: Mutex<File>, chase_step_record: Mutex<ChaseStepRecord>, } impl JsonLogger ...
use anyhow::{anyhow, bail, Result}; use clap::Parser; use crate::{meta, socket::ipv4_capturer, utils::AppProtocol}; use byteorder::{self, NetworkEndian, WriteBytesExt}; use ipconfig; use packet::{ ip::{v4, Protocol}, tcp, udp, Packet, }; use std::{ fmt::Display, io::{self, Read, Write}, net::Sock...
use crate::Number; // Imports used only for the documentation #[allow(unused_imports)] use crate::Bell; /// The maximum stage allowed before the masking code causes undefined behaviour. pub const MAX_STAGE: usize = 64; /// A string containing all the [Bell] names in order. pub static BELL_NAMES: &str = "1234567890ET...
#![deny(warnings)] #![feature(asm)] #![feature(const_fn)] extern crate mio; extern crate tokio; extern crate tokio_reactor; #[cfg(not(target_os = "redox"))] extern crate libc; #[cfg(target_os = "redox")] extern crate syscall; #[cfg(target_os = "redox")] extern crate redox_termios; use mio::{Poll as MioPoll, Token, ...
extern crate rand; extern crate sdl2; extern crate rayon; extern crate num; mod vec3; mod vec3d; mod point3; mod point3d; mod particle; mod physic_property; mod world; mod rectangle; mod drawable; use vec3::Vec3; use point3::Point3; use particle::ParticleBuilder; use physic_property::{Gravity, GravityWell, AirResista...
//! A temporary file in a [`cap_std::fs::Dir`] that may or may not be persisted. //! //! At the current time, this API is only implemented on Linux kernels. //! //! [`cap_std::fs::Dir`]: https://docs.rs/cap-std/latest/cap_std/fs/struct.Dir.html use cap_std::fs::{Dir, File, Permissions}; use rustix::fd::{AsFd, FromFd};...
// Copyright (c) 2022, Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 use debug_ignore::DebugIgnore; use narwhal_config::{ Authority, Committee as ConsensusCommittee, PrimaryAddresses, Stake, WorkerAddresses, }; use rand::rngs::OsRng; use std::{ num::NonZeroUsize, path::{Path, PathBuf}, }; use su...
use crate::{ packet::{CheckedPacket, Kind}, parser::Parser, Error, }; use std::{ io::{prelude::*, BufReader}, mem, net::{TcpListener, TcpStream, ToSocketAddrs}, }; pub const BUF_SIZE: usize = 8 * 1024; pub struct GdbServer<R, W> where R: BufRead, W: Write, { pub reader: R, pub...
#![allow(clippy::many_single_char_names)] use num_traits::cast::NumCast; use num_traits::float::Float; use num_traits::identities::one; use num_traits::identities::zero; use std::ops::{Add, Mul, Sub}; use crate::linear_space::traits::IndexableLinearSpace; use super::bas_utils::{max, shft3, sign, swap}; pub fn brent<...
//! Frame rotation for the LED Matrix screen use super::PixelFrame; /// A counter-clockwise angle, multiple of `90°`, used to create rotated `PixelFrame`s. #[derive(Copy, Clone)] pub enum Rotate { None, Ccw90, Ccw180, Ccw270, } /// Methods enabled by the `rotate` feature. // TODO: Put this under `Rota...
//! UDP relay client use std::{ io, io::{Cursor, Read}, net::{IpAddr, Ipv4Addr, SocketAddr}, sync::Arc, }; use bytes::{Bytes, BytesMut}; use log::{debug, error, warn}; use tokio::net::{ udp::{RecvHalf, SendHalf}, UdpSocket, }; use crate::{ config::{ServerAddr, ServerConfig}, context::...
mod expression; mod function; mod program; mod statement; use crate::c_str; use crate::parser::program::Program; use crate::Result; use libc::c_char; use llvm_sys::analysis::LLVMVerifierFailureAction; use llvm_sys::prelude::{LLVMBuilderRef, LLVMContextRef, LLVMModuleRef, LLVMTypeRef, LLVMValueRef}; use llvm_sys::targe...
use cosmwasm_std::{Addr, Decimal, Uint128}; use cw_storage_plus::{Item, Map}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; pub const CONFIG: Item<Config> = Item::new("config"); pub const STATE: Item<State> = Item::new("state"); pub const USERS: Map<&Addr, UserInfo> = Map::new("users"); //-----------...
use api::{serde::Deserialize, Address}; use std::sync::Arc; use std::time::Duration; use tokio::net::{ToSocketAddrs, UdpSocket}; struct Component; #[allow(dead_code)] #[derive(Debug, Deserialize)] #[serde(crate = "api::serde")] struct Config { #[serde(default)] addr: api::Argument, port: Option<u16>, ...
extern crate rusoto_dynamodb; extern crate base64; use morocco::{MoroccoError, PutResult, DeletionResult}; use aws::Item; use self::rusoto_dynamodb::*; use self::base64::{encode, decode}; pub struct DynamoOps { table_name: String, dynamo_client: Box<DynamoDb> } impl DynamoOps { pub fn new(table_name: S...
//! Deals with configuring the I/O APIC. use super::super::memory::map_page_at; use super::IRQ_INTERRUPT_NUMS; use core::fmt; use crate::memory::{PageFlags, PhysicalAddress, VirtualAddress}; use x86_64::instructions::port::outb; /// The physical base address of the memory mapped I/O APIC. const IO_APIC_BASE: Physical...
use crate::ui::boundaries::boundary_type; use ansi_term::Colour::{Fixed, RGB}; use ansi_term::Style; use zellij_utils::pane_size::Viewport; use zellij_utils::zellij_tile::prelude::PaletteColor; use unicode_width::{UnicodeWidthChar, UnicodeWidthStr}; fn color_string(character: &str, color: Option<PaletteColor>) -> Str...
use std::slice::{Iter, IterMut}; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; #[cfg(feature = "serde")] use serde_big_array::big_array; #[cfg(feature = "serde")] #[cfg(not(doc))] big_array! { BigArray; } use nom::number::complete::be_u24; use crate::sector::{ SectorHeaderSize, SECTOR_DATA_SIZE,...
//! `BloomFilter` is a probabilistic data structure that can quickly and definitively conclude that it does //! *not* contain an item. On the other hand, it can only conclude that it *probably* contains an //! item, i.e., the data structure has an inherent false-positive rate greater than 0%. //! //! Items can be added...
/* * Copyright 2020 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 std::collections::BinaryHeap; use std::ops::Range; pub struct MatchFinder { suffixes: Vec<i32>, rev_suffixes: Vec<u32>, lcp: Vec<u32>, max_queue_size: usize, max_matches_per_length: usize, patience: usize, max_length_diff: usize, queue: BinaryHeap<usize> } impl MatchFinder { ...
use std::collections::HashSet; use std::net::SocketAddr; use std::sync::Arc; use std::time::Instant; use tokio::io::AsyncWriteExt; use tokio::net::{TcpListener, TcpSocket, TcpStream}; use tokio::time::{timeout, Duration}; use crate::defaults::DATA_TIMEOUT; use crate::errors::ConnectionError; use crate::fragmenter::Rel...
use super::{ containers, core::{Position, Scenario, Velocity}, entities::{Canvas, Integration, Integrator, StepSize}, integrators, misc::UserLabel, scenarios, ui_import::{ egui::{self, CentralPanel, SidePanel}, epi, Color32, Hsva, Rgba, Stroke, Vec2, }, World, }; use ...
use crate::core::{DtnPeer, PeerType}; use crate::ipnd::{beacon::Beacon, services::*}; use crate::routing::RoutingNotifcation; use crate::DTNCORE; use crate::{peers_add, routing_notify, CONFIG}; use anyhow::Result; use log::{debug, error, info}; use net2::UdpBuilder; use std::collections::HashMap; use std::io; use std::...
extern crate structopt; use structopt::StructOpt; use std::path::PathBuf; use std::path::Path; #[macro_use] extern crate lazy_static; use nix::fcntl::{open, OFlag}; use nix::libc::{atexit, winsize, STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO}; use nix::pty::*; use nix::sys::select::{select, FdSet}; use nix::sys::stat:...
extern crate raster; use std; use geometric::{Geometric2D, Point2D, Line2D, interpolate_barycentric}; use raster::Color; /// Represents a 2D Triangle #[derive(Debug)] pub struct Triangle2D { /// Point of Triangle a: Point2D, /// Point of Triangle b: Point2D, /// Point of Triangle c: Point2D } ...
use itertools::Itertools; use super::*; use crate::axis::Axis; use crate::dim::Dim; use crate::ndrect::BigRect; use crate::ndtree::{Layer, NdTree, NodeRef, NodeRefTrait, Region, SharedNodePool}; use crate::ndvec::{BigVec, BigVec6D}; use crate::num::{BigInt, Zero}; use crate::HashMap; impl CaFormatTrait for Macrocell ...
use serde::Deserialize; use serde::Serialize; use std::path::PathBuf; use super::grid::Grid; use super::property::Property; use super::terrain::Terrain; use super::tile::Tile; use super::tile_offset::TileOffset; use super::utils; use super::wang_set::WangSet; use crate::tme::color::color_serde; use crate::tme::color...
#![deny(warnings)] #[macro_use] extern crate clap; extern crate extra; extern crate syscall; extern crate redox_users; extern crate userutils; use std::process::exit; use extra::option::OptionalExt; use redox_users::{AllGroups, AllUsers}; use userutils::create_user_dir; const _MAN_PAGE: &'static str = /* @MANSTART{...
use wasm_bindgen::prelude::*; use wasm_bindgen::{JsCast, JsValue}; use web_sys::{ WebGlShader, WebGlProgram, }; use web_sys::WebGlRenderingContext; use js_sys::{ Uint8Array }; use emulator::Emulator; use emulator::DisplaySize; use std::time::{Duration, SystemTime, UNIX_EPOCH}; mod shaders; #[wasm_bindgen]...
use std::result::{Result}; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, UdpSocket}; use std::thread::{self, JoinHandle}; use std::string::ToString; use std::any::Any; use std::str; use regex::Regex; use multicast; use helper::*; use plugin_mngt::{PluginManager}; use dynamic_reload::{DynamicReload, Lib, Symbol...
use flate2::read::GzDecoder; use flate2::write::GzEncoder; use flate2::Compression; use protobuf::descriptor::{FileDescriptorProto, FileDescriptorSet}; use protobuf::error::ProtobufError; use protobuf::error::ProtobufResult; use protobuf::error::WireError; use protobuf::Message; use protobuf::{CodedInputStream, CodedOu...
// This file is part of Substrate. // Copyright (C) 2021 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program 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 S...
use hecs::*; use rand::{thread_rng, Rng}; use std::io; /* Simple simulation Spawn multiple entities. They have health, damage, position and other components. On every tick every entity/unit: 1. Moves in random direction. 2. Finds closest entity to itself. 3. Fires at it and applies damage. 4. Ge...
use ekvproto::span as span_timeshare; use minitrace::{Link, Span, SpanSet}; pub fn encode_spans(span_sets: Vec<SpanSet>) -> impl Iteron<Item = span_timeshare::SpanSet> { span_sets .into_iter() .map(|span_set| { let mut _timeshare_set = span_timeshare::SpanSet::default(); _ti...
use std::iter::successors; use macroquad::prelude::*; use macroquad::ui::*; // This is the function that matters to us: Euler's method for approximating a differential equation // fn forward_euler_step(last_x: f32, last_y: f32, f: fn(f32, f32) -> f32, delta: f32) -> (f32, f32) { let next_y = last_y + delta * f(l...
use super::*; use std::{cmp::*, collections::VecDeque}; use tui::buffer::Buffer; #[derive(Clone)] pub struct Outputs { items: VecDeque<Output>, limit: usize, cached_width: u16, scroll: u16, } #[derive(Clone)] struct Output { cached: Text<'static>, value: String, } impl Outputs { pub fn ne...
// Copyright 2021 The Matrix.org Foundation C.I.C. // // 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...