text
stringlengths
3.09k
13.9k
#![feature(test)] #[macro_use] extern crate criterion; extern crate rand; #[macro_use] extern crate lazy_static; use criterion::{Criterion, Benchmark}; use rand::Rng; extern crate snipper; use snipper::{Snipper, Point, Polygon, Path, Bounds, Coordinate, IntersectionAlgorithm}; use std::collections::HashMap; static N...
use core::marker::PhantomData; use core::mem; use core::ops::Add; use core::fmt; /// Represents a pointer to a field of type `U` within the type `T` pub struct FieldOffset<T, U>( /// Offset in bytes of the field within the struct usize, /// A pointer-to-member can be thought of as a function from /// `...
use amethyst::assets::{AssetStorage, Loader}; use amethyst::core::cgmath::{Matrix4, Vector3}; use amethyst::core::transform::{GlobalTransform, Transform}; use amethyst::ecs::prelude::{Component, DenseVecStorage}; use amethyst::prelude::*; use amethyst::renderer::{ Camera, MaterialTextureSet, PngFormat, Projection, ...
// Copyright (c) 2017-2020, The rav1e contributors. All rights reserved // // This source code is subject to the terms of the BSD 2 Clause License and // the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License // was not distributed with this source code in the LICENSE file, you can // obtain it at ...
use crate::components::*; use bevy_ecs::{Commands, Entity, IntoQuerySystem, Query, System, Without}; use smallvec::SmallVec; use std::collections::HashMap; pub fn missing_previous_parent_system( mut commands: Commands, mut query: Query<Without<PreviousParent, (Entity, &Parent)>>, ) { // Add missing `Previo...
// Copyright 2019 The Kepler 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 agr...
//! Custom handlers service for responses. use std::rc::Rc; use std::task::{Context, Poll}; use actix_service::{Service, Transform}; use futures::future::{ok, FutureExt, LocalBoxFuture, Ready}; use hashbrown::HashMap; use crate::dev::{ServiceRequest, ServiceResponse}; use crate::error::{Error, Result}; use crate::htt...
use crate::{common::ensure_dir_exists, VALIDATOR_DIR_FLAG}; use account_utils::{ eth2_keystore::Keystore, read_password_from_user, validator_definitions::{ recursively_find_voting_keystores, ValidatorDefinition, ValidatorDefinitions, CONFIG_FILENAME, }, }; use clap::{App, Arg, ArgMatches...
/* * Copyright (c) 2017-2018 Boucher, Antoni <<EMAIL>> * * 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, mod...
// Zinc, the bare metal stack for rust. // Copyright 2014 <NAME> <<EMAIL>> // // 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 // // Unles...
// 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 lazy_static::lazy_static; use openssl::ec::{Asn1Flag, EcGroup, EcKey}; use openssl::hash::MessageDigest; use openssl::nid::Nid; use openssl::pkey::{self, PKey}; use openssl::rsa::Rsa; use openssl::stack::Stack; use openssl::x509::extension::SubjectAlternativeName; use openssl::x509::{X509Req, X509ReqBuilder, X509};...
// Copyright 2021 <NAME>. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writ...
// cli: Handle command line parsing #![forbid(unsafe_code)] #![forbid(missing_docs)] use super::products::PRODUCTS_LIST; use clap::{ crate_description, crate_name, crate_version, App, AppSettings, Arg, ArgMatches, }; use std::env; use std::ffi::{ OsStr, OsString, }; use std::path::Pa...
use prost_types::Any; use thiserror::Error; use ibc_proto::ibc::core::client::v1::MsgCreateClient as RawMsgCreateClient; use ibc_proto::ibc::core::client::v1::MsgUpdateClient as RawMsgUpdateClient; use ibc::ics02_client::header::Header; use ibc::ics02_client::msgs::create_client::MsgCreateAnyClient; use ibc::ics02_cl...
use color::ColoredString; use flags::Flags; use std::io::Write; use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use terminal_size::terminal_size; use unicode_width::UnicodeWidthStr; const EDGE: &str = "\u{251c}\u{2500}\u{2500}"; // "├──" const LINE: &str = "\u{2502} "; // "├ " const CORNER: &str = "\u{...
use renderer::assets::{ DescriptorSetArc, AssetLookup, ResourceArc, LoadQueues, GenericLoader, ResourceManager, }; use renderer::vulkan::VkBufferRaw; use crate::game_asset_lookup::{GameAssetLookupSet, GameAssetMetrics}; use atelier_assets::loader::handle::Handle; use atelier_assets::loader::handle::AssetHandle; use...
use crate::common::{ configuration::jormungandr_config::JormungandrParams, jormungandr::starter::{Starter, StartupError}, jormungandr::JormungandrProcess, }; use chain_impl_mockchain::header::HeaderId; use jormungandr_lib::interfaces::{Log, LogEntry, LogOutput, NodeConfig}; use jormungandr_testing_utils::te...
use dominator::{clone, html, with_node, Dom, EventOptions}; use futures_signals::{ map_ref, signal::{Signal, SignalExt}, }; use std::rc::Rc; use utils::{events, unwrap::UnwrapJiExt}; use web_sys::HtmlInputElement; use super::super::{ actions::{fetch_data, search}, state::State, }; #[allow(dead_code)] ...
// Copyright 2021 <NAME>. All rights reserved. // Copyright (C) 2021 Alibaba Cloud. All rights reserved. // // SPDX-License-Identifier: Apache-2.0 //! Chunk or data readiness state tracking drivers. //! //! To cache data from remote backend storage onto local storage, a cache state tracking mechanism //! is needed to ...
//! Serves an HTTP/1.1. admin server. //! //! * `/metrics` -- reports prometheus-formatted metrics. //! * `/ready` -- returns 200 when the proxy is ready to participate in meshed traffic. use crate::{ proxy::http::{ClientHandle, SetClientHandle}, svc, trace, transport::{io, tls}, }; use futures::future; us...
//! A set of objects which automatically change their register or coil value when they go out of scope //! //! # Examples //! //! When the `auto` object goes out of scope and is dropped, the value of coil `10` is switched `On`: //! //! ``` //! # extern crate modbus; //! # extern crate test_server; //! # use test_server...
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
use libc::{ getgrent, setgrent, endgrent, getgrnam, group, c_void }; use std::{ ptr, ffi::CStr }; use std::collections::HashSet; use objc::runtime::{ Class, Object }; use objc_foundation::{ INSArray, NSArray, NSObject, INSObject }; use objc_id::Id; use crate::tab...
use std::error::Error; use std::fmt; use std::fs; use std::io::Write; use std::path::{Path, PathBuf}; use insta::_cargo_insta_support::SnapshotContents; use proc_macro2::TokenTree; use syn; use syn::spanned::Spanned; #[derive(Debug)] pub struct InlineSnapshot { start: (usize, usize), end: (usize, usize), ...
use clippy_utils::{ diagnostics::span_lint_and_sugg, get_async_fn_body, is_async_fn, source::{snippet_with_applicability, snippet_with_context, walk_span_to_context}, visitors::visit_break_exprs, }; use rustc_errors::Applicability; use rustc_hir::intravisit::FnKind; use rustc_hir::{Block, Body, Expr, Ex...
use crate::{ guild::{ DefaultMessageNotificationLevel, Emoji, ExplicitContentFilter, MfaLevel, NSFWLevel, Permissions, PremiumTier, Role, SystemChannelFlags, VerificationLevel, }, id::{ApplicationId, ChannelId, GuildId, UserId}, }; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug,...
use super::{ProtocolError, Result}; use futures::io::{AsyncReadExt, AsyncWriteExt}; use futures::{AsyncRead, AsyncWrite}; pub const DEFAULT_BUF_SIZE: usize = 8 * 1024; /// A Read buffer to provide `read_exact` and `read_line` methods. /// /// Amazingly there isn't an `AsyncBuffer` for latest futures! The implementati...
pub mod popups; pub mod statics; use chrono::offset::Local; use tui::{ backend::Backend, layout::{Constraint, Direction, Layout}, style::{Color, Modifier, Style}, terminal::Frame, text::{Span, Spans}, widgets::{Block, Borders, Clear, Paragraph, Row, Table}, }; use crate::{ handlers::{ ...
use crate::*; use near_sdk::{ext_contract, Gas}; const GAS_FOR_NFT_APPROVE: Gas = Gas(10_000_000_000_000); const NO_DEPOSIT: Balance = 0; pub trait NonFungibleTokenCore { //approve an account ID to transfer a token on your behalf fn nft_approve(&mut self, token_id: TokenId, account_id: AccountId, msg: Option<...
//! JS Number parsing. use std::str::FromStr; pub use num_bigint::BigInt; fn split_into_radix_and_number(num: &str) -> (u32, String) { match num.get(0..2) { Some("0x") | Some("0X") => (16, num.get(2..).unwrap().replace("_", "")), Some("0b") | Some("0B") => (2, num.get(2..).unwrap().replace("_", "...
use std::vec::IntoIter; use std::collections::VecDeque; use std::thread; use std::time::Duration; use crate::responses::listing; use crate::client::RedditClient; use crate::structures::submission::Submission; use crate::traits::{Content, PageListing}; use crate::errors::APIError; /// A paginated listing of posts that...
use std::sync::mpsc::{self, RecvTimeoutError, TryRecvError}; use std::sync::{Arc, Mutex}; use std::thread; use std::time::Duration; use neon::context::{Context, TaskContext}; use neon::object::Object; use neon::result::JsResult; use neon::task::Task; use neon::types::{JsFunction, JsUndefined, JsValue}; use neon::{clas...
// Copyright 2020 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { anyhow::Error, fidl::endpoints::RequestStream, fidl_fuchsia_fs::{AdminRequestStream, QueryRequestStream}, fuchsia_async as fasync, ...
#![cfg_attr(release, windows_subsystem = "windows")] use core::mem::MaybeUninit; use std::{ sync::{ atomic::{AtomicBool, AtomicUsize, Ordering}, Arc, Mutex, }, thread::sleep, time::Duration, }; use trayicon::*; use winapi::um::winuser::{self}; use winreg::RegKey; mod cpu_usage; #[allow...
#![feature(llvm_asm)] extern crate syscall; extern crate byteorder; use std::{env, usize}; use std::fs::File; use std::io::{ErrorKind, Read, Write}; use std::os::unix::io::{FromRawFd, RawFd}; use syscall::error::{Error, ENODEV}; use syscall::data::{Event, Packet}; use syscall::flag::{CloneFlags, EVENT_READ, PHYSMAP_...
use std::{ error, fmt::{self, Debug, Display}, io, result, }; /// Local Result type def pub type Result<T> = result::Result<T, Error>; pub struct Error { inner: Box<Err>, } impl Error { pub fn categorize(&self) -> Category { match self.inner.err { ErrorKind::Io(_) => Category:...
use console_backend::Color; use crate::map::{Map, move_by}; use std::cmp; use crate::widgets::scrolling_message_console::ScrollingMessageConsole; use num::clamp; use crate::theme::theme; pub fn mut_two<T>(first_index: usize, second_index: usize, items: &mut [T]) -> (&mut T, &mut T) { assert_ne!(first_index, second...
//! Relay for TCP server that running on the server side use std::io::{self, ErrorKind}; use std::rc::Rc; use std::time::Duration; use config::ServerConfig; use relay::{boxed_future, BoxIoFuture}; use relay::Context; use relay::dns_resolver::resolve; use relay::socks5::Address; use relay::tcprelay::crypto_io::{Decry...
use std::{ collections::hash_map::DefaultHasher, fs::File, hash::{Hash, Hasher}, io::{Read, Write}, net::TcpStream, sync::mpsc::{self, channel, Sender}, thread, }; use aes_gcm::aead::{Aead, NewAead}; use aes_gcm::{Aes128Gcm, Key, Nonce}; use egui::{epaint, FontDefinitions}; use epi::Frame; ...
//! The point in this Library is to provide useful helper methods for cases where you really do //! need the templates to be capable. //! My personal use case was to be able to generate specific svg layouts from numbers in card //! files. This meant doing more maths in the template than is common. //! I've broken up th...
// 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 crate::SolutionType; pub fn day4(input: &str) -> SolutionType { let mut input = input.split("\n\n"); let mut extracted = input.next().unwrap().trim().split(','); let mut boards = input.map(Board::new).collect::<Vec<_>>(); let mut last_number; let winner_board = loop { let i = extracted...
use multiaddr::{Multiaddr, Protocol}; use rand::Rng; use secio::{self, PeerId}; use serde::{Deserialize, Serialize}; use std::fs; use std::io::{Error, ErrorKind, Read, Write}; use std::path::PathBuf; // Max data size in send buffer: 24MB (a little larger than max frame length) const DEFAULT_SEND_BUFFER: usize = 24 * 1...
/*! This crate is a client for [Yandex Speller Api] and a binary tool that allows to check spelling in texts, paths and web-pages. # Usage This crate is on [crates.io] and can be used by adding `ryaspeller` to your dependencies in your project's `Cargo.toml`. ```toml [dependencies] ryaspeller = "0.1.3" ``` See [exa...
use peekmore::PeekMoreIterator; use codemap::{Span, Spanned}; use crate::error::SassResult; use crate::scope::Scope; use crate::selector::Selector; use crate::utils::{devour_whitespace, devour_whitespace_or_comment, eat_ident}; use crate::value::Value; use crate::{Expr, Token}; /// A style: `color: red` #[derive(Clo...
use clap::Clap; use skim::prelude::*; use std::collections::HashMap; use std::sync::Mutex; mod kubectl; use kubectl::*; mod bindings; use bindings::*; #[derive(Clap)] #[clap(version = "0.1", author = "Jacobious52")] struct Opts { #[clap(short, long)] namespace: Option<String>, #[clap(short, long)] w...
use crate::checkout::CheckoutConflicts; use crate::merge::MergeConflicts; use crate::obj::{BitId, BitObjType, Oid, PartialOid}; use crate::refs::SymbolicRef; use crate::status::BitStatus; use owo_colors::OwoColorize; use std::fmt::{self, Display, Formatter}; pub type BitResult<T> = Result<T, BitGenericError>; pub type...
#![no_std] #![no_main] use aya_bpf::{ bindings::xdp_action, macros::{map, xdp}, maps::{HashMap, PerfMap}, programs::XdpContext, }; use core::mem; use memoffset::offset_of; use wiretap_common::{PacketLog, UDP_PROTOCOL, TCP_PROTOCOL}; mod bindings; use bindings::{ethhdr, iphdr, tcphdr, udphdr, ipv6hdr}...
use serde::{de, Deserialize}; use serde_json::Value as JsonValue; use serde_repr::Deserialize_repr; use std::fmt; use thiserror::Error as ThisError; /// A response that is returned from the Philips Hue API. #[derive(Clone, Debug, Eq, PartialEq, Hash, Deserialize)] #[serde(rename_all = "lowercase")] pub enum Response<T...
use std::{ sync::{ atomic::{AtomicBool, Ordering}, mpsc::channel, Arc, Mutex, }, thread, time::Duration, }; use crate::{ config::{ExtraOpts, TaskName}, metrics::Metric, utils::calculate_hash, }; use anyhow::{Context, Result}; use log::error; use prometheus::core::At...
use core::convert::TryInto; use core::ptr::write_volatile; use crate::flash::Error; use crate::pac; pub(crate) unsafe fn lock() { #[cfg(any(flash_wl, flash_wb, flash_l4))] pac::FLASH.cr().modify(|w| w.set_lock(true)); #[cfg(any(flash_l0))] pac::FLASH.pecr().modify(|w| { w.set_optlock(true); ...
/* <NAME> * Advent of Code day 7 */ extern crate regex; use std::fs::File; use std::io::{Error, BufReader, BufRead}; use std::collections::HashMap; use regex::Regex; //to be used as data for a hash map. // key will be string value bag color #[derive(Clone, Default)] struct BagRules { number_of_bags: Vec<usize>...
#![feature(exclusive_range_pattern)] #![cfg_attr(debug_assertions, allow(dead_code, unused_variables))] #[macro_use] extern crate log; use winit::window::WindowBuilder; use winit::event_loop::{EventLoop, ControlFlow}; use winit::dpi::PhysicalSize; use winit::event::{Event, WindowEvent}; use std::time::Instant; use cr...
use super::*; use std::{ collections::HashMap, ops::{Index,IndexMut}, rc::Rc, }; /** This is a map from type parameters to some value. If you put this in a type,and use Default to initialize it, you must remember to replace the `TypeParamMap` using either `TypeParamMap::defaulted` or `TypeParamMap::with...
//! # Substrate Enterprise Sample - Product Registry example pallet #![cfg_attr(not(feature = "std"), no_std)] use codec::{Decode, Encode}; use core::result::Result; use frame_support::{ decl_error, decl_event, decl_module, decl_storage, dispatch, ensure, sp_runtime::RuntimeDebug, sp_std::prelude::*, }; use f...
use { super::*, crate::{ app::Selection, path, }, ahash::AHashMap, regex::Captures, std::path::{Path, PathBuf}, }; /// a temporary structure gathering selection and invocation /// parameters and able to generate an executable string from /// a verb's execution pattern pub struct...
mod sync; use self::sync::FrameSync; use crate::application::triangle::UniformBufferObject; use crate::rendering::{ buffer::{Buffer, CpuBuffer, StaticBuffer}, command_pool::TransientCommandPool, Device, }; use anyhow::{Context, Result}; use ash::{version::DeviceV1_0, vk}; use std::sync::Arc; type Mat4 = ...
extern crate docopt; extern crate fnv; extern crate rusoto_core; extern crate rusoto_sqs; #[macro_use] extern crate serde_json; use docopt::Docopt; use docopt::Value::Plain; use fnv::FnvHashMap; use rusoto_core::Region; use rusoto_sqs::{ DeleteMessageRequest, GetQueueAttributesRequest, GetQueueAttributesRe...
// //! Copyright 2021 Alibaba Group Holding 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 appl...
/** * [993] Cousins in Binary Tree * * In a binary tree, the root node is at depth 0, and children of each depth k node are at depth k+1. * * Two nodes of a binary tree are cousins if they have the same depth, but have different parents. * * We are given the root of a binary tree with unique values, and...
use std::collections::HashMap; use std::path::Path; use std::str; use serde_json; use semver::Version; use core::dependency::Dependency; use core::{SourceId, Summary, PackageId}; use sources::registry::{RegistryPackage, INDEX_LOCK}; use sources::registry::RegistryData; use util::{CargoError, CargoResult, internal, Fi...
use dslite_parser; use header_parser; use inflector::Inflector; use svd; trait StringEx { fn fix_name(&self) -> String; } impl StringEx for String { fn fix_name(&self) -> String { self.to_screaming_snake_case() // Some fixups to make the names look nicer .replace("RTC_REAL_TIME...
use std::fmt::Display; use super::{style, Attribute, Color, ContentStyle, StyledContent}; macro_rules! stylize_method { ($method_name:ident Attribute::$attribute:ident) => { calculated_docs! { #[doc = concat!( "Applies the [`", stringify!($attribute), ...
// Copyright 2022 TiKV Project Authors. Licensed under Apache-2.0. use std::ffi::CStr; use libc::{c_char, c_void}; use tirocks_sys::{ crocksdb_sst_partitioner_factory_t, rocksdb_PartitionerRequest, rocksdb_PartitionerResult, rocksdb_Slice, rocksdb_SstPartitioner, rocksdb_SstPartitioner_Context, s, }; pub typ...
use std::cell::RefCell; use std::fmt; use std::rc::Rc; use crate::comp::Comp; use crate::err::InkErr; pub type NativeFn = fn(Vec<Val>) -> Result<Val, InkErr>; #[derive(Debug, Clone)] pub enum Val { Empty, Number(f64), Str(Vec<u8>), Bool(bool), Null, Comp(Rc<RefCell<Comp>>), Func(usize, Ve...
use crate::Matrix; /// Generates 3d points /// /// # Input /// /// * `xmin`, `xmax` -- range along x /// * `ymin`, `ymax` -- range along y /// * `nx` -- is the number of points along x (must be `>= 2`) /// * `ny` -- is the number of points along y (must be `>= 2`) /// * `calc_z` -- is a function of (xij, yij) that cal...
mod ascii_bit_set; mod fivegram; use ascii_bit_set::AsciiBitSet; use bitvec_simd::BitVec; use fivegram::Fivegram; use itertools::iproduct; use lazy_static::lazy_static; use rayon::prelude::*; type WordBitMap = BitVec; type Letter = u8; type Word = [Letter; 5]; type Pos = u8; type Pattern = [Predicate; 5]; const PATT...
// Copyright 2016 Mozilla // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software...
// Copyright 2018 The Synthesizer IO Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law ...
use crate::{ components::transform::{Transform, TransformRaw}, renderer::{ bindgroupcontainer::BindGroupContainer, bindgroups::{ deferred::DeferredBindGroup, lighting::LightBindGroup, uniforms::UniformBindGroup, }, model::{DrawModel, HorizonModel}, pipelines::...
use std::{ cell::RefCell, env::current_dir, fmt::{self, Display}, fs::File, io::{BufWriter, Write}, rc::Rc, str::{self, FromStr}, }; use aoc2018::{load, AoCError, Result}; use lazy_static::lazy_static; use regex::Regex; lazy_static! { static ref RE: Regex = Regex::new(r"positio...
use dash_rs::{ model::{ comment::{ level::{CommentUser, LevelComment}, profile::ProfileComment, }, user::{Color, IconType, ModLevel}, }, Base64Decoded, Thunk, }; use std::borrow::Cow; #[macro_use] mod helper; // A few of the most liked comments from "Ode to ...
extern crate db; use crate::{ForkChoice, ForkChoiceError}; use db::{ stores::{BeaconBlockStore, BeaconStateStore}, ClientDB, }; use log::{debug, trace}; use std::collections::HashMap; use std::sync::Arc; use types::{BeaconBlock, ChainSpec, Hash256, Slot}; //TODO: Pruning and syncing pub struct SlowLMDGhost<T...
use std::fmt::Debug; use std::hash::Hash; /// The "facts" which are the basis of the NLL borrow analysis. #[derive(Clone, Debug)] pub struct AllFacts<T: FactTypes> { /// `loan_issued_at(origin, loan, point)` indicates that the `loan` was "issued" /// at the given `point`, creating a reference with the `origin`...
use std::{mem, fs, thread, sync}; use std::io::{self, Read, BufReader}; use std::collections::VecDeque; use config::{Config, Container}; use reqwest; use prebuffer::PreBuffer; use serde_json as serde; use serde_json::Map; use serde_json::Value as JSON; use tc_queue; use kaeru; pub struct Queue { entries: VecDeque<...
// Copyright 2020 Netwarps Ltd. // // 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, dis...
use super::game::{Action, CurrentTurn, Event, Game, GameState, PassError, PlayError}; use cards::Card; use std::collections::HashMap; use uuid::Uuid; use super::client::ClientHandler; use super::Server; use data::{ErrorCode, PlayerData, Request, Response, SuccessCode}; pub struct Instance { pub id: Uuid, pub ...
use crate::world::block::Block; use crate::world::chunk::{CHUNK_SIZE, CHUNK_BLOCKS}; use crate::datatype::{Position, ChunkUnit}; use crate::world::block::registry::BlockRegistry; use crate::world::terrain::noise::PerlinNoise2D; use oorandom::Rand64; use std::sync::Arc; mod noise; #[derive(Clone)] pub struct Terrai...
#[cfg(target_os="windows")] use crate::windows::OpenGraphicsLibrary; use core::mem::{ MaybeUninit, transmute, }; use std::ffi::CStr; // Shader types const FRAGMENT_SHADER:u32=0x8B30; const VERTEX_SHADER:u32=0x8B31; const GEOMETRY_SHADER :u32=0x8DD9; /// Shader parameters const SHADER_TYPE:u32=0x8B4F; const ...
use crate::{ models::{ClientCredentialsRequest, Snowflake}, routes::{AuthenticateClientCredentialsGrant, DiscordRouteInfo}, }; use derive_more::{Display, Error}; use futures::{future::BoxFuture, ready, FutureExt}; use http::StatusCode; use reqwest::Response; use serde::{Deserialize, Serialize}; use std::{ f...
use super::CrateVersion; use std::path::Path; use serde_json; use git2::build::RepoBuilder; use git2::{Object, Oid, Reference, Delta, DiffFormat, ObjectType, Tree, Repository, ErrorClass, Error as GitError}; use std::str; static INDEX_GIT_URL: &'static str = "https://github.com/rust-lang/crates.io-index"; ...
//! Defines the standard named color spaces as unit structs #![allow(non_camel_case_types)] use std::marker::PhantomData; use crate::alpha::{Rgba, Xyza}; use crate::channel::{ChannelFormatCast, FreeChannelScalar, PosNormalChannelScalar}; use crate::color::Color; use crate::color_space::{ColorSpace, EncodedColorSpace...
use std::net::SocketAddr; use cashweb::bitcoin::Network; use clap::App; use config::{Config, ConfigError, File}; use serde::Deserialize; const FOLDER_DIR: &str = ".relay"; const DEFAULT_BIND: &str = "127.0.0.1:8080"; const DEFAULT_RPC_ADDR: &str = "http://127.0.0.1:18443"; const DEFAULT_RPC_USER: &str = "user"; const...
use image::{Rgb, ImageBuffer, RgbImage}; use std::cmp::{max, min}; use nanorand::{WyRand, RNG}; use gumdrop::Options; use smallvec::{smallvec, SmallVec}; type R16Image = ImageBuffer<Rgb<u16>, Vec<u16>>; // convert HSL to RGB, wrapping the hsl crate fn hsl_to_rgb(h: f64, s: f64, l: f64) -> Rgb<u8> { let (r, g, b) ...
use crate::{binary_put_uvariant_to_bufmut, binary_put_uvariant_to_vec, binary_uvarint}; use alloc::vec::Vec; use bytes::{BufMut, Bytes, BytesMut}; /// Maximum possible size of the header. The maximum size of header struct will be 18 but the /// maximum size of variant encoded header will be 21. pub const MAX_HEADER_SI...
#[macro_use] extern crate clap; extern crate ansi_term; extern crate nix; #[cfg(target_os = "freebsd")] extern crate pmc; extern crate separator; mod error; mod event; mod runner; #[cfg(all(debug_assertions, not(target_os = "freebsd")))] use event::MockEvent; #[cfg(target_os = "freebsd")] use event::{PmcEvent, RSDPri...
use std::f64::consts::PI; use rayon::prelude::*; use clap::Clap; use geo::Point; use geo::Polygon; use geo::intersects::Intersects; use geo::polygon; use geo::*; use geo::prelude::BoundingRect; use geo::prelude::Contains; use gre::*; use rand::prelude::*; use svg::node::element::path::Data; use svg::node::element::*; ...
use super::curve::*; use super::basis::*; use super::super::geo::*; use super::super::consts::*; use std::cell::*; /// /// Represents a subsection of a bezier curve /// #[derive(Clone)] pub struct CurveSection<'a, C: 'a+BezierCurve> { /// Full curve curve: &'a C, /// Value to add to a t value to convert...
extern crate semver; extern crate conduit; use std::collections::HashMap; use std::io::prelude::*; use std::io::Cursor; use std::net::{SocketAddr, Ipv4Addr, SocketAddrV4}; use semver::Version; use conduit::{Method, Scheme, Host, Extensions, Headers, TypeMap}; pub struct MockRequest { path: String, method: Me...
use futures::sync::mpsc::{self, Receiver, Sender}; use futures::{Async, AsyncSink, Future, Poll, Sink, Stream}; use super::{QuicError, QuicResult}; use conn_state::ConnectionState; use crypto::Secret; use packet::{LongType, PartialDecode}; use parameters::ServerTransportParameters; use handshake; use types::Connection...
#![allow(dead_code)] use anyhow::{anyhow, bail, Context, Result}; use lazy_static::lazy_static; use std::{ collections::{HashMap, HashSet}, fmt::Debug, io::Write, process::Command, }; use tempfile::NamedTempFile; use flowistry::{Direction, FlowistryResult, FunctionIdentifier, Range}; fn parse_ranges( prog:...
use std::cmp::Ordering; use std::io::{stdin, BufRead}; use hashbrown::{HashMap, HashSet}; use itertools::Itertools; use nalgebra::{Matrix4, Point3, Transform3, Vector3}; type Vec3f = Vector3<f32>; type Pt3f = Point3<f32>; const MIN_EQUAL_DIST: usize = 10; #[derive(Debug, Clone)] struct ScannerPoints { points: Ve...
use bevy::{ ecs::{component::ComponentDescriptor, schedule::ShouldRun}, prelude::*, transform::TransformSystem, utils::HashSet, window::WindowMode, }; use bevy_retrograde::{prelude::*, ui::raui::prelude::widget}; use super::*; mod game_init; mod map_loading; mod pause_menu; mod gameplay; use game...
//! # [Day 4: Security Through Obscurity](https://adventofcode.com/2016/day/4) //! //! Finally, you come across an information kiosk with a list of rooms. Of course, the list //! is encrypted and full of decoy data, but the instructions to decode the list are barely hidden //! nearby. Better remove the decoy data first...
use super::*; use binpack::pack_rects; use image::{self, GenericImage, RgbaImage as Image}; use std::path::PathBuf; type Rect = binpack::Rect<(usize, usize)>; #[derive(Debug, Clone)] pub struct Sprite { pub width: f32, pub height: f32, pub texcoords_x: (f32, f32), pub texcoords_y: (f32, f32), pub ...
use bevy::{ asset::{AssetLoader, LoadContext, LoadedAsset}, prelude::*, reflect::TypeUuid, utils::BoxedFuture, }; use roxmltree::*; use thiserror::Error; #[derive(Error, Debug)] pub enum TiledError { #[error("No width provided for map")] NoMapWidth, #[error("No height provided for map")] ...
use serde::Serialize; use serde::de::DeserializeOwned; use std::error::Error; use std::env; use openssl::sign::{Verifier, Signer}; use openssl::pkey::{PKey}; use openssl::ec::EcKey; use openssl::hash::MessageDigest; use libreauth::oath::{TOTPBuilder, TOTP}; use libreauth::hash::HashFunction::Sha256; use jsonwebtoken::{...
use regex::Regex; use std::str; use crate::constants::{INSTRUCTION_TABLE, ZERO_REGISTER, AT_REGISTER, SP_REGISTER, RA_REGISTER}; use crate::datum::{find_datum, Datum}; use crate::instruction::{convert_opcode_to_format, Instruction, InstructionFormat}; use crate::label::{find_label, Label}; use crate::utils::{conv...
//! Implement a concrete type to build channels. use crate::Error; use tor_linkspec::{ChanTarget, OwnedChanTarget}; use tor_llcrypto::pk; use tor_rtcompat::{tls::TlsConnector, Runtime, TlsProvider}; use async_trait::async_trait; use futures::task::SpawnExt; use std::sync::Arc; /// TLS-based channel builder. /// ///...