text
stringlengths
3.09k
13.9k
// Copyright 2019 The Grin 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 t...
use crate::goals::{Goal, GoalEnum}; use crate::state::constraints::{Constraint, ResolveFn, TwoOfThree, VarWatch}; use crate::state::State; use crate::value::{IntoVal, Val}; use crate::DomainType; use crate::UnifyIn; use std::fmt; use std::fmt::Debug; use std::rc::Rc; /** Create a [projection goal](super) that allows d...
// Copyright 2022 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 { futures::{ future::Future, task::{Context, Poll}, }, log::warn, pin_project::pin_project, std::pin::Pin, }; /// ...
use std::net::IpAddr; use std::net::ToSocketAddrs; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::thread; use std::time::Duration; use std::time::Instant; use clap::{self, value_t_or_exit, Arg}; use colored::{self, Colorize}; use pretty_ping::Pinger; use rand::random; // Package meta info...
use abscissa_core::clap::Parser; use abscissa_core::{Command, Runnable}; use clap::AppSettings; use ibc::core::ics02_client::client_state::ClientState; use ibc::core::ics03_connection::connection::IdentifiedConnectionEnd; use ibc::core::ics04_channel::channel::Order; use ibc::core::ics24_host::identifier::{ChainId, Co...
use crate::http; use crate::settings::global_user::GlobalUser; use crate::settings::toml::Target; use crate::terminal::{emoji, interactive, message}; use serde::{Deserialize, Serialize}; #[derive(Serialize)] pub struct Subdomain { subdomain: String, } impl Subdomain { pub fn get(account_id: &str, user: &Glob...
use log::{trace, warn}; use std::{ collections::BTreeMap, fs::{read_dir, DirBuilder, File, OpenOptions}, io::{self, Read, Seek, Write}, mem::transmute, str, }; const DELETE_FILE_INTERVAL: u64 = 3; pub(crate) struct Wal { height_fs: BTreeMap<u64, File>, dir: String, current_height: u64...
mod cli; mod quantum_annealing; mod unicorn; use crate::quantum_annealing::dwave_api::sample_quantum_annealer; use crate::unicorn::bitblasting::bitblast_model; use crate::unicorn::bitblasting_dimacs::write_dimacs_model; use crate::unicorn::bitblasting_printer::write_btor2_model; use crate::unicorn::builder::generate_m...
use crate::operators_validator::OperatorValidator; use crate::{BinaryReader, Result, Type}; use crate::{FunctionBody, Operator, WasmFeatures, WasmModuleResources}; /// Validation context for a WebAssembly function. /// /// This structure is created by /// [`Validator::code_section_entry`](crate::Validator::code_sectio...
use crate::clients::{Parameters, ReadRequest, VoteClient, WriteRequest}; use clap; use failure::{bail, ResultExt}; use memcached; use memcached::proto::{MultiOperation, ProtoType}; use std::future::Future; use std::task::{Context, Poll}; use tokio::sync::{mpsc, oneshot}; use tower_service::Service; enum Req { Popu...
use std::ptr; use bindings::Windows::Win32::{ Foundation::{BOOL, HWND, LPARAM, LRESULT, POINT, PWSTR, RECT, WPARAM}, Graphics::Gdi, System::LibraryLoader, UI::{HiDpi, WindowsAndMessaging}, }; use windows::*; use crate::pwstr; fn check_h_wnd(h_wnd: HWND) -> Result<HWND> { if h_wnd.is_invalid() { ...
// This file is part of network. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/network/master/COPYRIGHT. No part of network, including this file, may be copied, modified, propagated, or distributed except...
// Copyright 2019 Contributors to the Parsec project. // SPDX-License-Identifier: Apache-2.0 //! Persistent mapping between key triples and key information //! //! This module declares a [`ManageKeyInfo`](https://parallaxsecond.github.io/parsec-book/parsec_service/key_info_managers.html) //! trait to help providers to ...
use std::cell::RefCell; use std::collections::HashMap; use std::fmt::Debug; use std::hash::Hash; use std::rc::Rc; use rand::seq::SliceRandom; pub struct Node<Move> { wins: f32, simulations: f32, children: HashMap<Move, Rc<RefCell<Node<Move>>>>, parent: Option<Rc<RefCell<Node<Move>>>>, mv: Option<M...
//! Configures and runs the inbound proxy. //! //! The inbound proxy is responsible for terminating traffic from other network //! endpoints inbound to the local application. #![deny(warnings, rust_2018_idioms)] #![forbid(unsafe_code)] mod accept; mod detect; pub mod direct; mod http; mod metrics; pub mod policy; mod...
/* * Copyright (c) 2021, <NAME>. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following discla...
extern crate mio; extern crate promising_future; extern crate x11_dl; mod key_code; pub use self::key_code::KeyCode; use self::x11_dl::xlib::{Display, GrabModeAsync, KeyPress, KeyPressMask, Mod2Mask, XErrorEvent, XKeyEvent, Xlib}; use std::{mem, ptr}; use std::collections::hash_map::{Entry, H...
pub const HEAP_START: usize = 0x_000A_0000_0000; /// 64 MB Heap pub const HEAP_SIZE: usize = 64 << 20; // in src/allocator.rs #[global_allocator] static LINKED_LIST_ALLOCATOR: LockedHeap = LockedHeap::empty(); use core::{alloc::Layout, panic, ptr::NonNull}; use bit_field::BitField; use bootloader::{boot_info::Memor...
// Most of this file is forked from source codes of [Matter Labs's zkSync](https://github.com/matter-labs/zksync) use crate::circom_circuit::CircomCircuit; use crate::transpile::{transpile_with_gates_count, ConstraintStat, TranspilerWrapper}; use bellman_ce::{ kate_commitment::{Crs, CrsForLagrangeForm, CrsForMonomi...
use std::{convert::TryInto, error::Error as StdError, rc::Rc}; use actix_web::{ body::{AnyBody, MessageBody}, dev::{Service, ServiceRequest, ServiceResponse}, error::{Error, Result}, http::{ header::{self, HeaderValue}, Method, }, HttpResponse, }; use futures_util::future::{ok, ...
use crate::{ connector::{ButtplugConnector, ButtplugConnectorError, ButtplugConnectorResultFuture}, core::{ errors::ButtplugError, messages::{ButtplugCurrentSpecClientMessage, ButtplugCurrentSpecServerMessage}, }, server::{ButtplugServer, ButtplugServerOptions}, util::async_manager, }; use futures::{ ...
use std::fmt::Formatter; use std::sync::Arc; use crate::{ chunk_metadata::{ChunkAddr, ChunkId}, partition_metadata::PartitionAddr, }; /// Metadata associated with a set of background tasks /// Used in combination with TrackerRegistry #[derive(Debug, Clone, Eq, PartialEq)] pub enum Job { Dummy { db...
use std::error; use std::fs::File; use std::io::Read; use std::process::{Command, Stdio}; use chrono::{Local}; // configuration // the optional battery device name const BATTERY_NAME_OVERRIDE: Option<&str> = None; // the optional wifi device name const WIFI_DEVICE_OVERRIDE: Option<&str> = None; // the separ...
use super::{ errors::Result as StoragePoolResult, DiskOffset, StoragePoolConfiguration, StoragePoolLayer, NUM_STORAGE_CLASSES, }; use crate::{ bounded_future_queue::BoundedFutureQueue, buffer::Buf, checksum::Checksum, vdev::{self, Block, Dev, Error as VdevError, Vdev, VdevRead, VdevWrite}, }; us...
//! Horizon error response. use serde::{Deserialize, Serialize}; const BAD_REQUEST_TYPE: &str = "https://stellar.org/horizon-errors/bad_request"; const TRANSACTION_FAILED_TYPE: &str = "https://stellar.org/horizon-errors/transaction_failed"; const TRANSACTION_MALFORMED_TYPE: &str = "https://stellar.org/horizon-errors/t...
#![allow( clippy::needless_pass_by_value, clippy::new_ret_no_self, clippy::redundant_closure, clippy::single_char_pattern )] #![deny(unused_must_use)] use failure::ResultExt; use log::{error, warn, trace}; use std::cmp; use std::ffi::OsString; use std::path::PathBuf; use std::process; use structopt::St...
mod ui; use bevy::{ input::mouse::{MouseScrollUnit, MouseWheel}, prelude::*, }; use bevy_kira_audio::Audio; use crate::{ game::{ self, level::{CameraMarker, PlayerMarker}, BOX_ENTITY_OFFSET, ENTITY_ON_TOP_OFFSET, ENTITY_SURFACE, MAP_HEIGHT, MAP_WIDTH, SPRITE_SIZE, }, ...
//! FIXME: write short doc here mod analysis_stats; mod analysis_bench; mod help; use std::{error::Error, fmt::Write, io::Read}; use flexi_logger::Logger; use pico_args::Arguments; use ra_ide_api::{file_structure, Analysis}; use ra_prof::profile; use ra_syntax::{AstNode, SourceFile}; type Result<T> = std::result::R...
use alloc::sync::Arc; use clap::{App, Arg}; use easy_fs::vfs::Inode; use easy_fs::{BlockDevice, EasyFileSystem}; use spin::Mutex; use std::fs::{read_dir, File, OpenOptions}; use std::io::{Read, Seek, SeekFrom, Write}; extern crate alloc; const BLOCK_SZ: usize = 512; struct BlockFile(Mutex<File>); impl BlockDevice f...
use opentelemetry::api::{self, Provider, Span, Tracer}; use std::fmt; use tracing_core::span::{self, Attributes, Id, Record}; use tracing_core::{field, Event, Subscriber}; use tracing_subscriber::layer::Context; use tracing_subscriber::registry::LookupSpan; use tracing_subscriber::Layer; /// OpenTelemetry layer for us...
mod canister_manager; mod canister_settings; mod common; mod execution_environment; mod execution_environment_metrics; mod history; mod hypervisor; mod ingress_filter; mod metrics; mod query_handler; mod scheduler; mod types; mod util; pub use execution_environment::{ExecutionEnvironment, ExecutionEnvironmentImpl}; pu...
use chrono::NaiveDateTime; use crate::{ forum::Forum, schema::threads, user::User, }; use diesel::{ self, BelongingToDsl, ExpressionMethods, PgConnection, QueryDsl, RunQueryDsl, }; use error::BackendResult; use identifiers::{ forum::ForumUuid, thread::ThreadUuid, user::Us...
use super::LanguageServerState; use crate::{from_lsp, handlers, lsp_utils::apply_document_changes, state::RequestHandler}; use dispatcher::{NotificationDispatcher, RequestDispatcher}; use lsp_types::notification::{ DidChangeTextDocument, DidChangeWatchedFiles, DidCloseTextDocument, DidOpenTextDocument, }; use std::...
//! Reading proc-macro rustc version information from binary data use std::{ fs::File, io::{self, Read}, }; use memmap2::Mmap; use object::read::{File as BinaryFile, Object, ObjectSection}; use paths::AbsPath; use snap::read::FrameDecoder as SnapDecoder; #[derive(Debug)] pub struct RustCInfo { pub versio...
/* Copyright (c) Fortanix, Inc. * * 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 http://mozilla.org/MPL/2.0/. */ use core::arch::x86_64::*; use crate::avx2::*; /// # Safety /// The caller sh...
use crate::shared; #[repr(C)] pub struct ValidatorOptions { _unused: [u8; 0], } #[derive(Copy, Clone, Debug)] #[repr(C)] pub enum ValidatorLimits { StructMembers, StructDepth, LocalVariables, GlobalVariables, SwitchBranches, FunctionArgs, ControlFlowNestingDepth, AccessChainIndexes...
use super::LENGTH_BYTES; #[derive(Debug, PartialEq)] pub enum DecodeError { TooShort, TooLong, Invalid, } pub trait Decodable: Sized { fn ssz_decode(bytes: &[u8], index: usize) -> Result<(Self, usize), DecodeError>; } /// Decode the given bytes for the given type /// /// The single ssz encoded value ...
use std::{char, fmt, io::{Write, stdout}}; fn main() { let crate_version: &'static str = env!("CARGO_PKG_VERSION"); println!("Brainfuck Interpreter v{}", crate_version); // Take input print!("> "); let _ = stdout().flush().unwrap(); let stdin = std::io::stdin(); let mut buffer = String::ne...
use self::flag_register::FlagRegister; use self::program_counter::ProgramCounter; use self::register::*; use self::stack_pointer::StackPointer; use crate::util::savestate::{ read_savestate_byte, read_savestate_u16, write_savestate_u16, LoadSavestateError, Savestate, SavestateStream, }; pub mod flag_register; p...
use async_io::block_on; use futures_util::{ future::{select, Either}, stream::StreamExt, }; use std::{convert::TryInto, future::ready}; use zbus::{fdo, CacheProperties, SignalContext}; use zbus_macros::{dbus_interface, dbus_proxy, DBusError}; #[test] fn test_proxy() { #[dbus_proxy( interface = "org...
// Copyright 2017 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. //! Type-safe bindings for Zircon processes. use crate::ok; use crate::{object_get_info, ObjectQuery, Topic}; use crate::{AsHandleRef, Handle, HandleBased...
use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering}; use crate::disk::fs::FileSystem; use crate::disk::{IDiskMessage, ODiskMessage}; use crate::disk::tasks; use crate::disk::tasks::context::DiskManagerContext; use crate::disk::builder::DiskManagerBuilder; use crossbeam::sync::MsQueue; use futures::task...
//! Core module. //! //! Core types and traits. use async_trait::async_trait; use chrono::{DateTime, Utc}; use std::error::Error; use std::fmt; /// Message representation. /// /// This type represent a message in a chat. #[derive(Eq, PartialEq, PartialOrd, Clone, Debug)] pub struct Message { /// The message's au...
//! Some item definitions used in instances to provide a virtual representative //! structure of `.cnf` or `.sat` files and their associated clauses or formula. /// Represents a variable within a SAT instance. #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub struct Var(pub u64); impl Var { /// Converts a varia...
use parity_wasm::elements::{Deserialize, Module}; use crate::errors::{Result, ValidationErr}; /// Lists all imports we provide upon instantiating the instance in Instance::from_module() /// This should be updated when new imports are added static SUPPORTED_IMPORTS: &[&str] = &[ "env.read_db", "env.write_db", ...
//! This crate contains structures and routines for context switching //! when AVX extensions are enabled. #![no_std] #![feature(asm, naked_functions)] extern crate zerocopy; #[macro_use] extern crate context_switch_regular; use context_switch_regular::ContextRegular; use zerocopy::FromBytes; /// The registers s...
/* tag::catalog[] Title:: Basic system health test Goal:: Start an IC with 2 subnets, 4 nodes per subnet. Install canisters and make update and query calls that require cross-subnet communication to succeed. While this is happening, ensure the IC finalizes rounds correctly across all nodes in each subnet. No real load...
use crate::constants::*; use crate::hasher::HashChain; use crate::lm_ots; use crate::lm_ots::definitions::LmotsPrivateKey; use crate::lm_ots::parameters::{LmotsAlgorithm, LmotsParameter}; use crate::lms::helper::get_tree_element; use crate::lms::parameters::LmsAlgorithm; use crate::lms::MutableExpandedAuxData; use crat...
// Copyright 2021 Twitter, Inc. // Licensed under the Apache License, Version 2.0 // http://www.apache.org/licenses/LICENSE-2.0 //! Easily registered distributed metrics. //! //! More docs todo... //! //! # Creating a Metric //! Registering a metric is straightforward. All that's needed is to declare a //! static with...
use std::collections::HashMap; use std::collections::HashSet; use regex::Regex; #[derive(Clone)] struct Food { allergens: HashSet<String>, ingredients: HashSet<String>, } #[aoc_generator(day21)] fn generate_input(input: &str) -> Vec<Food> { // Create empty vector to store food list, being listed allergen...
use crate::simd::{LaneCount, Simd, SimdElement, SupportedLaneCount}; use core::ops::{Add, Mul}; use core::ops::{BitAnd, BitOr, BitXor}; use core::ops::{Div, Rem, Sub}; use core::ops::{Shl, Shr}; mod assign; mod deref; mod unary; impl<I, T, const LANES: usize> core::ops::Index<I> for Simd<T, LANES> where T: SimdEl...
// Copyright 2021 Siemens AG // SPDX-License-Identifier: MIT mod types; mod dpend; use std::sync::Mutex; use once_cell::sync::Lazy; use dtasm_rs::interface::DtasmIf; use dtasm_rs::model_description::{ModelDescription}; use dtasm_rs::types::{DoStepResponse, DtasmVarValues, GetValuesResponse, Status}; use dtasm_rs::e...
//! Gets all Twitch emotes for one or more specific emote sets. //! [`get-emote-sets`](https://dev.twitch.tv/docs/api/reference#get-emote-sets) //! //! # Accessing the endpoint //! //! ## Request: [GetEmoteSetsRequest] //! //! To use this endpoint, construct a [`GetEmoteSetsRequest`] with the [`GetEmoteSetsRequest::bui...
use bytes::{BufMut, BytesMut}; use failure; use futures::{Async, Poll, Sink, StartSend, Stream, sync::mpsc}; use futures::future::{Future, FutureResult, lazy, Loop, loop_fn}; use message::message_codec::MessageCodec; use message::request::*; use message::response::*; use std::{error::Error, fmt, io, net::SocketAddr, ti...
use newtut::utilities::get_app_name_prog_type::get_app_name_prog_type; use newtut::utilities::get_folder_name::get_folder_name; use newtut::utilities::make_name_valid::make_name_valid; use newtut::{ get_creating_gitignore_file_message, get_creating_workflow_file_message, get_generate_application_message, get_gi...
//! `Hints` allow you to pass extra information to the server. //! //! Many of these are standardized by either: //! //! * http://www.galago-project.org/specs/notification/0.9/x344.html //! * https://developer.gnome.org/notification-spec/#hints //! //! Which of these are actually implemented depends strongly on the Not...
// MIT License // Copyright (c) 2018-2021 The orion Developers // 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, cop...
use core::ptr::null_mut; use crate::windows::pwstr_to_string; use crate::windows::to_wstring; use std::path::{ Path }; use winapi::{ um::{ fileapi::{ GetTempFileNameW, GetTempPathW, DeleteFileW, CreateDirectoryW, RemoveDirectoryW }, shellapi::{ SHFILEOPSTRUCTW, SHFileOperatio...
//! Node filters. use std::collections::HashSet; use std::convert::AsRef; use std::iter::{Iterator, FromIterator}; use glob::Pattern as GlobPattern; use super::{ColmenaError, ColmenaResult, NodeName, NodeConfig}; /// A node filter containing a list of rules. pub struct NodeFilter { rules: Vec<Rule>, } /// A fi...
use error::InputPos; pub use lexer::TokenValue::*; #[derive(PartialEq, Clone, Debug)] pub enum TokenValue { LeftParen, RightParen, LeftBrace, RightBrace, LeftBracket, RightBracket, Let, Const, Assignment, RightArrow, Comma, Colon, SemiColon, Dot, Star, ...
extern crate itertools; use std::collections::HashMap; use itertools::Itertools; enum Event { Start { time: i32, id: i32 }, Sleep { time: i32 }, Wake { time: i32 } } impl Event { fn from_input(line: &str) -> Option<Event> { let time_sep = line.find(":")?; let msg_sep = line.find("] ")...
#![cfg_attr(feature = "as_crate", no_std)] // We are std! #![cfg_attr( feature = "as_crate", feature(platform_intrinsics), feature(portable_simd) )] #[cfg(not(feature = "as_crate"))] use core::simd; #[cfg(feature = "as_crate")] use core_simd::simd; use simd::{LaneCount, Simd, SupportedLaneCount}; #[cfg(fe...
use readers::prelude::{RAReader, Value, Index}; use crate::alignments::AlignmentFunc; use readers::iterators::IndexIterator; #[derive(Debug)] pub struct AlignsIter<'a0: 'a, 'a> { pub readers: &'a [&'a0 Box<dyn RAReader + 'a0>], // final target pub target_index: &'a mut [Index], // list of align functions: [...
#[cfg(not(feature = "std"))] use alloc::boxed::Box; use core::fmt; use crate::ast::types::ObjectName; /// SQL data types #[derive(Clone, Debug, Eq, PartialEq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum DataType { /// Boolean Boolean, // ==================...
use std::collections::{BTreeMap, BTreeSet, HashMap}; use std::convert::TryFrom; use std::ops::Deref; use std::sync::Arc; use log::{debug, error, info}; use tokio::sync::Mutex; use kubelet::container::{Container, ContainerKey, Handle as ContainerHandle}; use kubelet::pod::{Handle, PodKey}; use kubelet::provider::Provi...
use lazy_static::lazy_static; use ash::vk; use gsvk::prelude::common::*; use gsvk::prelude::pipeline::*; use gsma::{ offset_of, vk_format, vertex_rate }; use nalgebra::{ Point3, Vector3, Matrix4 }; use super::program::OBJECT_INSTANCE; lazy_static! { pub static ref VERTEX_DATA: [Vertex; 8] = [ Vertex {...
use crate::connection::{Authentication, Connection}; use crate::error::ConnectionError; use crate::executor::{PulsarExecutor, TaskExecutor}; use futures::{ future::{self, Either}, sync::{mpsc, oneshot}, Future, Stream, }; use std::collections::HashMap; use std::net::SocketAddr; use std::sync::Arc; /// hold...
// wengwengweng use super::*; #[derive(Clone)] pub struct Circle { center: Vec2, radius: f32, segments: Option<u32>, stroke: Option<Stroke>, fill: Option<Color>, range: (f32, f32), } impl Circle { pub fn new(center: Vec2, radius: f32) -> Self { return Self { center, radius, segments: None, strok...
//! An example of how to use an `InstanceArray` with a `Canvas`. //! //! You really want to run this one in release mode. use ggez::event; use ggez::graphics::{self, Color}; use ggez::{Context, GameResult}; use std::env; use std::f32::consts::TAU; use std::path; type Point2 = glam::Vec2; type Vector2 = glam::Vec2; s...
// Copyright (c) 2019-2021 <NAME>. Licensed under the Apache License, // Version 2.0 <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> // or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at // your option. This file may not be copied, modified, or distributed except // according to ...
use std::{ error::Error, net::{IpAddr, SocketAddr}, sync::{Arc, Mutex}, time::Instant, }; use tokio::{ net::UdpSocket, time::{sleep, timeout, Duration}, }; use buf_view::BufViewMut; use crate::cli::CliArgs; #[derive(Debug)] struct Stats { rtt_min: u32, rtt_max: u32, rtt_total: u64...
/* Copyright 2021 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
use crate::{ cmd, cmd::Cell, config::GunSigner, database::{ProtocolKind, StringDescriptor}, eitem, keychain::ProtocolSecret, wallet::GunWallet, }; use bdk::{blockchain::AnyBlockchainConfig, KeychainKind}; use std::path::{Path, PathBuf}; use structopt::StructOpt; use super::CmdOutput; #[der...
use std::str::from_utf8; use std::cmp::min; use std::net::{IpAddr, SocketAddr}; use std::sync::mpsc::Sender; use std::sync::Arc; use std::time::Duration; use std::io::{Error as IOError, Result as IOResult, ErrorKind}; use tokio::net::UdpSocket; use tokio::time::sleep; use tokio::select; use tokio::sync::watch::Receiver...
use crate::progress::PROGRESS_BAR; use console::{measure_text_width, pad_str, style, Alignment, Term}; use indicatif::ProgressDrawTarget; use regex::Regex; /// Data container for a command entered by the user interactively #[derive(Debug)] pub enum MenuCmd { /// user wants to add a url to be scanned Add(String...
use std::error::Error; use std::fs::File; use std::io::prelude::*; use std::collections::VecDeque; use std::collections::BTreeSet; use indexmap::IndexMap; use indexmap::IndexSet; use super::input; use super::instruction::*; #[derive(Copy, Clone, Debug, PartialEq)] enum ItemType { OpCode(OpCode), Literal(i64), ...
// Copyright 2019-2020 // by Centrality Investments Ltd. // and 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 ...
use std::collections::{HashMap, HashSet}; use image::{ImageBuffer, Rgb, RgbImage}; use crate::{area::Area, chunk::Chunk, chunk_loader::ChunkLoader}; struct Vein { blocks: HashSet<(i64, i32, i64)>, /// Smallest coordinate in the vein. /// Priority: x y z location: (i64, i32, i64), } const MAX_VEIN_S...
// // // use lib::Vec; use sync::Spinlock; use lib::LazyStatic; use super::fdt_devices; use super::gic; pub type BindError = (); #[derive(Debug)] pub struct IRQHandle(u32); impl Default for IRQHandle { fn default() -> IRQHandle { IRQHandle(!0) } } struct Binding { handler: fn ( *const() ), info: *const (), } unsa...
use crate::math::{Isometry, Real, Vector}; use crate::query::{ContactManifold, TrackedContact}; #[cfg(feature = "dim2")] use crate::shape::SegmentPointLocation; use crate::shape::{Capsule, Shape}; use approx::AbsDiffEq; use na::Unit; /// Computes the contact manifold between two capsules given as `Shape` trait-objects...
use serde::{Deserialize, Serialize}; use std::collections::hash_map::DefaultHasher; use std::fmt; use std::hash::{Hash, Hasher}; #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum CommandType { Invalid, Set, GetAnswer, GetAnswers, GetSource, Believe, Configure, TestEquality, }...
use color_eyre::eyre::Result; use sitegen::*; use std::io::ErrorKind::{AlreadyExists, PermissionDenied}; use std::{ env, fs::{self, File}, io, path::Path, process, }; struct Args(Vec<String>); impl Args { fn new() -> Args { let mut c: Vec<String> = env::args().collect(); c.remo...
/* * Copyright 2020 Nuclei Studio OÜ * * 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...
use bevy::{AlphaMode, PbrPipeline, EffectMaterialFlags}; use bevy_app::{App, Plugin}; use bevy_asset::{AddAsset, Handle, HandleUntyped}; use bevy_ecs::system::{lifetimeless::SRes, SystemParamItem}; use bevy_math::Vec4; use bevy_reflect::TypeUuid; use bevy_render::{ color::Color, render_asset::{PrepareAssetError...
extern crate sdl2; #[cfg(target_os = "emscripten")] #[macro_use] extern crate stdweb; use std::process; use std::thread::sleep; use std::time::{Instant, Duration}; use sdl2::pixels::Color; use sdl2::event::Event; use sdl2::mouse::MouseButton; use sdl2::rect::{Rect, Point}; use sdl2::keyboard::Keycode; #[cfg(not(targ...
use env::{Env, EnvConvert, EnvInputRepr, EnvRepr, Action, DiscreteAction, Response, OnlineAveraged, Discounted}; use operator::prelude::*; use rand::{Rng}; use rand::distributions::{IndependentSample}; use rand::distributions::range::{Range}; use std::f32::consts::{PI}; use std::cell::{Cell, RefCell}; // XXX: This v...
//! An implementation of the AGCWD algorithm. //! //! AGCWD is described in the paper ["Efficient Contrast Enhancement Using Adaptive Gamma Correction With Weighting Distribution"][AGCWD]. //! //! [AGCWD]: https://ieeexplore.ieee.org/abstract/document/6336819/ //! //! # Examples //! //! ``` //! // An example image cont...
//! # Optimized Merkle proof verifier and bundle hasher //! //! This pallet provides functionality of verifying optimized merkle proofs and bundle hasher. // Ensure we're `no_std` when compiling for WebAssembly. #![cfg_attr(not(feature = "std"), no_std)] use codec::{Decode, Encode}; use sp_std::{fmt::Debug, vec::Vec}...
use codec::{Encode, Decode}; use sp_runtime::RuntimeDebug; use sp_std::{result, prelude::*}; use super::{Module, Config as ListenConfig}; use frame_system::{self as system}; use listen_primitives::Balance; use listen_constants::currency::*; pub type SessionIndex = u32; pub type RoomId = u64; /// The cost of creatin...
// (c) <NAME> <http://mimosa-pudica.net>, under MIT License. use crate::playout; use crate::search; use crate::tile::*; use crate::uct; use std::*; pub fn analyze_hand(hand: &mut TileSet) { println!("Hand: {}", format_tile_set(hand)); let n_tiles = hand.count(); if n_tiles % 3 != 2 { println!(" #...
use cannyls::deadline::Deadline; use cannyls::device::{self, DeviceHandle}; use cannyls::lump::{LumpData, LumpHeader, LumpId}; use cannyls::storage::StorageUsage; use cannyls::Result; use fibers_rpc::{Call, ProcedureId}; use std::ops::Range; use crate::device::DeviceId; use crate::protobuf::{ DeleteLumpRequestDeco...
//! Data types. /// Represents a time tag. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] pub struct TimeTag(pub u64); /// Represents single data in OSC packet. #[derive(Debug, Clone, PartialEq, PartialOrd)] pub enum Value { /// Nil `N`. Nil, /// Infinitum `I`. Infinitum...
use std::fmt::{self, Formatter, Debug}; use syntax::token::Op; use vm::{ TySymbol, FunctionSymbol, VariableSymbol, Storage, Bc, Ty, BuiltinTy, }; #[derive(EnumIsA, Debug, Clone, PartialEq)] pub enum Function { // TODO : BuiltinFunction, FunctionSymbol // similar to how types are han...
use bytes::{BufMut, BytesMut}; use codecs::{encoding::SerializerConfig, JsonSerializerConfig, TextSerializerConfig}; use serde::{Deserialize, Serialize}; use syslog::{Facility, Formatter3164, LogFormat, Severity}; use crate::{ codecs::Encoder, config::{ log_schema, AcknowledgementsConfig, GenerateConfi...
use std::collections::HashMap; use std::convert::TryInto; use rmpv::Value; use nvim_rs::Neovim; use nvim_rs::compat::tokio::Compat; use flexi_logger::{Logger, Criterion, Naming, Cleanup}; use tokio::process::ChildStdin; use parking_lot::Mutex; use log::warn; use crate::error_handling::ResultPanicExplanation; lazy_st...
extern crate clap; extern crate colored; use clap::{Arg, App}; use std::fs::File; use std::io::{BufRead, BufReader}; use std::mem; use colored::*; fn main() { let input_arguments = App::new("Advent Day Two") .version("0.1.0") .author("<NAME>") .arg(Arg::with_name("input") .shor...
use raytracer::camera::Camera; use raytracer::material::{Dielectric, Diffuse, DiffuseLight, DiffuseMetal, Metal}; use raytracer::scene::{Scene, SceneBuilder}; use raytracer::shapes::mesh::STLMesh; use raytracer::shapes::sphere::Sphere; use raytracer::utils::{Color, Vec3}; use raytracer::{render, Config}; #[allow(dead_...
// Copyright 2021 <NAME> // Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applic...
use crate::generator::utils::{filter_type_name, sanitize, split_comment_line, split_name}; use crate::parser::types::TypeModifier; use inflector::cases::pascalcase::to_pascal_case; use inflector::cases::snakecase::to_snake_case; use roxmltree::Namespace; use std::borrow::Cow; pub fn default_format_comment(doc: Option<...
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under both the MIT license found in the * LICENSE-MIT file in the root directory of this source tree and the Apache * License, Version 2.0 found in the LICENSE-APACHE file in the root directory * of this source tree. */ use...