text
stringlengths
3.09k
13.9k
/// Algebra - Matrix use crate::algebra::ring::*; #[derive(Debug, Clone, PartialEq)] pub struct Matrix<K> { data: Vec<Vec<K>>, } #[macro_export] macro_rules! mat { ( $( $( $x:expr ),* );* ) => ( Matrix::new( vec![ $( vec![ $( $x ),* ] ),* ] ) ) } impl<K: Copy + Ring> Matrix<K> { pub fn new(data: Vec<Vec<K>...
use super::*; use alloc::{string::ToString, vec}; use ritelinked::LinkedHashMap; mod directive; mod grammar; /// The option of [`Parser::take_while`]. pub enum TakeOpt { /// Match once. One, /// Match in range. Same as regex `{a,b}`. /// `Range(0, 1)` is same as regex `?`. Range(usize, usize), ...
#![allow(missing_docs)] use cgmath; use cgmath::{Point3, EuclideanSpace, InnerSpace, ElementWise}; use collision::{Aabb3}; use rand::Rng; use stopwatch; use time; use common::color::Color4; use common::protocol; use audio_loader; use audio_thread; use client; use terrain; use vertex::ColoredVertex; use view; const ...
use std::io; use std::net::{IpAddr, Ipv4Addr}; use std::os::raw::{c_void, c_char}; use std::mem; use std::collections::VecDeque; use futures::{Stream, Sink, Poll, Async, AsyncSink, StartSend}; use futures::task::{self, Task}; use addr::{ip_addr_t, ip4_addr_t, ip6_addr_t}; use error::{err_t}; use pbuf::{pbuf, Pbuf}; ...
use crate::{DescriptorSetWrite, UpdateDescriptorSet}; use { super::{ DescriptorBindingFlags, DescriptorSet, DescriptorSetInfo, DescriptorSetLayout, DescriptorSetLayoutBinding, DescriptorSetLayoutFlags, DescriptorSetLayoutInfo, Descriptors, DescriptorsAllocationError, DescriptorsInstance, De...
/*-------------------------------------------------------------------------- black The MIT License (MIT) Copyright (c) 2019 <NAME> (sinclair) <<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 So...
// LNP Node: node running lightning network protocol and generalized lightning // channels. // Written in 2020 by // Dr. <NAME> <<EMAIL>> // // To the extent possible under law, the author(s) have dedicated all // copyright and related and neighboring rights to this software to // the public domain worldwide. This ...
// Copyright 2022 The Engula 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 or agreed to...
//! Axis-aligned bounding box. //! //! Represented by a cuboid defined by two points. As long as the //! `set_*` functions are used, the `lower` point will be less than or equal to the `upper` point //! for any axis. use cgmath::Point3; // local min/max funcs for f32 since it isn't Ord and doesn't work with std::mi...
// This loads the games from disk into memory. use std::env; use std::fs; use std::io::Result; use std::path::Path; use lemmings::models::*; use lemmings::parsers::*; // Load a ground file and its associated vga graphics. fn load_ground_and_sprites(dir: &str, index: i32) -> Result<GroundCombined> { let vga_file:...
use idroid::geometry::plane::Plane; use idroid::{node::ImageNodeBuilder, node::ImageViewNode, MVPUniformObj}; use nalgebra_glm as glm; use wgpu::Extent3d; use zerocopy::{AsBytes, FromBytes}; pub struct SDFRenderNode { extent: Extent3d, scale: f32, view_node: ImageViewNode, mvp_buf: MVPUniformObj, } #...
use eventio::fluentd::{Entry, ForwardMode}; use serde_bytes::ByteBuf; use std::collections::HashMap; use thiserror::Error; #[derive(Debug, Error)] pub enum SerializationError { #[error("too long (expected <= {})", u32::max_value())] TooLong, } const EMPTY_FORWARD_MODE_SIZE: usize = 4; // fixarray[fixstr, fixa...
#[cfg(not(feature = "std"))] use alloc::vec::Vec; #[cfg(not(feature = "std"))] use core as std; use std::{ptr, u32}; /// This is a pretty naive implementation of a BigUint abstracting all /// math out to a vector of `u32` chunks. /// /// It can only do a few things: /// - Be instantiated from an arbitrary big-endian...
// consumer_state.rs // // Internal handlers for managing static-scope (singleton) server state in a thread-safe manner. // // Static server state is guarded for thread-safe access using a blocking RwLock. This is definitely not optimal, and it'd probably be better to use tokio async locks and keep everything async, bu...
use crate::{ core::{ geometry::{Bounds2i, Point2f, Point2i}, lowdiscrepancy::{ compute_radical_inverse_permutations, inverse_radical_inverse, radical_inverse, scramble_radical_inverse, PRIME_SUMS, PRIME_TABLE_SIZE, }, pbrt::Float, rng::RNG, sam...
//! Types used to describe bitfields. These describe structure and do not hold any actual values. use std::collections::HashMap; /// The size of a single bit field. pub type FieldSize = usize; /// The name of a bit field. pub type FieldName = String; /// A mapping between enum values and descriptions pub type EnumMap...
use std::collections::{BTreeMap, BTreeSet}; use serde::{Deserialize, Serialize}; use geom::{Duration, Time}; use map_model::{LaneID, Map, Path, PathConstraints, PathRequest, PathStep, TurnID}; use crate::mechanics::IntersectionSimState; use crate::{CarID, SimOptions, VehicleType}; // Note this only indexes into the...
// This file is part of libc-extra. 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/libc-extra/master/COPYRIGHT. No part of libc-extra, including this file, may be copied, modified, propagated, or distribut...
#[macro_use] extern crate rustler; extern crate strsim; use rustler::{Encoder, Env, Error, NifResult, Term}; use strsim::{ damerau_levenshtein as _damerau_levenshtein, // generic_damerau_levenshtein as _generic_damerau_levenshtein, generic_hamming as _generic_hamming, generic_jaro as _generic_jaro, ...
// This file is part of yash, an extended POSIX shell. // Copyright (C) 2021 <NAME> // // 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 Software Foundation, either version 3 of the License, or // (at your option) ...
use bytes::Bytes; use model::command::*; use model::controll::*; use model::response::SmtpReply; use std::collections::VecDeque; use std::net::SocketAddr; #[derive(Clone)] pub struct Session { state: State, name: String, peer: Option<SocketAddr>, local: Option<SocketAddr>, helo: Option<SmtpHelo>, ...
// vim: tw=80 //! Common utility functions used throughout BFFFS use crate::types::*; use divbuf::DivBufShared; use lazy_static::lazy_static; use std::{ hash::Hasher, ops::{Add, Div, Sub}, }; /// LBAs always use 4K LBAs, even if the underlying device supports smaller. pub const BYTES_PER_LBA: usize = 4096; ...
use crate::{relay::*, service::*, Error, Vaults}; use async_trait::async_trait; use bitcoin::{BitcoinCore, BitcoinCoreApi}; use clap::Clap; use futures::executor::block_on; use git_version::git_version; use runtime::{ cli::parse_duration_ms, pallets::sla::UpdateRelayerSLAEvent, PolkaBtcProvider, PolkaBtcRuntime, Ut...
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 use crate::{ interop::Testcase, server::{h09, h3}, tls, tls::TlsProviders, Result, }; #[cfg(unix)] use s2n_quic::provider::tls::s2n_tls; use s2n_quic::{ provider::{ endpoint_limi...
use crate::{ error::KatzeError, model::{GenericError, MessageContext, Response, ResponseReaction}, table::Emoji, }; use chrono::{Duration, Utc}; use http::uri::Uri; use hyper::{ body::{self, Body}, Request, }; use lazy_static::lazy_static; use rand::seq::SliceRandom; use regex::Regex; use std::{coll...
use std::cell::RefCell; use std::collections::HashSet; use std::marker::PhantomData; use std::rc::Rc; use actix::{Actor, Addr, Syn}; use actix_web::dev::{AsyncResult, Handler, Resource}; use actix_web::{HttpMessage, HttpRequest, HttpResponse}; use futures::future::Either; use http::{header, Method}; use md5; use rand:...
pub mod g786; pub mod modbus; use std::fmt; use std::io::{prelude::*, Error as IoError, ErrorKind as IoErrorKind}; use std::num::ParseIntError; use std::ops::Deref; use std::path::{Path, PathBuf}; use std::result::Result as StdResult; use std::str::FromStr; use std::sync::Mutex; use std::thread; use std::time::Duratio...
use crate::context::*; use spark::{vk, Builder}; use std::slice; struct CommandBufferSemaphores { image_available: vk::Semaphore, rendering_finished: vk::Semaphore, } struct CommandBufferSet { pool: vk::CommandPool, pre_swapchain_cmd: vk::CommandBuffer, post_swapchain_cmd: vk::CommandBuffer, f...
// Copyright 2021 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 fidl_fuchsia_diagnostics as fdiagnostics; use std::{borrow::Cow, fmt::Debug}; /// Severity #[derive(Clone, Debug, Eq, PartialEq)] pub enum Severity { ...
/*! Totsu ([凸](http://www.decodeunicode.org/en/u+51F8) in Japanese) means convex. <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> This crate for Rust provides **a first-order conic...
use crate::{ api::{browser::ContextBuilder, browser_type::PersistentContextLauncher}, imp::{ browser_type::BrowserType, core::*, impl_future::*, prelude::*, selectors::Selectors, utils::Viewport } }; use serde::Deserialize; use std::{sync::TryLockError, time::Instant}; #[derive(Debug)] pub(...
#![warn(clippy::all)] #![warn(clippy::pedantic)] #![warn(clippy::nursery)] #![allow(clippy::cast_possible_wrap)] #![allow(clippy::cast_sign_loss)] use itertools::Itertools; use rand::rngs::SmallRng; use rand::seq::SliceRandom; use rand::{Rng, SeedableRng}; use staticvec::StaticVec; use std::fmt; use std::ops::{Index...
#![feature(plugin, register_attr, proc_macro_hygiene, decl_macro)] #[macro_use] extern crate rocket; use rocket::{uri, Data, response::{status::Custom, content::Html, Redirect}, http::{Status, ContentType}}; use multipart::server::{Multipart, ReadEntry, MultipartField, save::SaveResult::*, save::SavedData::File}; us...
extern crate image; extern crate time; use image::{GenericImage, RgbImage}; use time::PreciseTime; fn get_gray_pixels(file_name: &str) -> (Vec<u8>, usize, usize) { let img = image::open(file_name).unwrap().grayscale(); (img.raw_pixels(), img.width() as usize, img.height() as usize) } fn get_min_diff_index(lef...
use crate::ir::*; use crate::map::IdHashSet; use crate::{ActiveDataLocation, Data, DataId, DataKind, Element, ExportItem, Function, InitExpr}; use crate::{FunctionId, FunctionKind, Global, GlobalId}; use crate::{GlobalKind, ImportKind, Memory, MemoryId, Table, TableId}; use crate::{Module, TableKind, Type, TypeId}; //...
use std::ptr; use std::slice; use lazy_static::lazy_static; use hdf5_sys::h5p::{H5Pget_chunk, H5Pget_filter_by_id2, H5Pmodify_filter}; use hdf5_sys::h5t::H5Tget_size; use hdf5_sys::h5z::{H5Z_class2_t, H5Z_filter_t, H5Zregister, H5Z_CLASS_T_VERS, H5Z_FLAG_REVERSE}; use crate::globals::{H5E_CALLBACK, H5E_CANTREGISTER,...
// Copyright 2021 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT // https://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD // https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied, // modified, or d...
use crate::common::{CommonState, SpeedControls}; use crate::game::{State, Transition}; use crate::ui::UI; use abstutil::prettyprint_usize; use ezgui::{ hotkey, layout, EventCtx, EventLoopMode, GeomBatch, GfxCtx, Key, Line, ModalMenu, Slider, Text, }; use geom::{Circle, Distance, Duration, PolyLine}; use map_model::...
use std::cmp; use std::collections::VecDeque; use std::ffi::c_void; use std::io; use std::io::{Read, Write}; use std::ptr; type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>; type ProtoBridgeHandle = *mut c_void; pub const WAIT_INFINITE_CYCLES: usize = 0xffffffff; #[repr(C)] struct DataStatus { ...
// // line_shape2.rs // Copyright (C) 2019 <NAME> <<EMAIL>> // Distributed under terms of the MIT license. // use std::f64::consts::PI; use std::fmt; use std::slice; use std::vec; use anyhow::{bail, Error}; use itertools::{iproduct, Itertools}; use nalgebra::{distance, Point2}; use serde::{Deserialize, Serialize}; u...
//! A module that represents tables and columns //! //! A table is a collection of columns and some metadata. Creating //! a table gives you access to the metadata fields that can only //! be set when creating the table. //! //! You can also change existing tables with a closure that can //! then access individual colu...
use std::collections::HashSet; #[cfg(debug_assertions)] use itertools::Itertools; fn q1(bugs: &str) -> usize { let mut bugs: Vec<char> = bugs.chars().collect(); let mut ratings = HashSet::new(); while ratings.insert(rating(&bugs)) { bugs = bugs .iter() .enumerate() ...
mod child; mod id; use crate::command::Command; use crate::image::Image; use crate::STACK_SIZE; use child::Child; use id::{IdType, MappingId}; use libc::{grantpt, unlockpt}; use nix::sched::{clone, setns, CloneFlags}; use nix::sys::wait::wait; use nix::unistd::{geteuid, Pid}; use retry::{delay::Fixed, retry}; use std:...
#![feature(futures_api, async_await, await_macro, arbitrary_self_types)] use futures::{ future::{Future, FutureObj}, task::{local_waker, LocalWaker, Spawn, SpawnError, Wake}, Poll, }; use log::{debug, trace}; use std::{cell::RefCell, io, ops::Deref, pin::Pin, rc::Rc, sync::Arc, thread_local}; mod leak_sto...
// Copyright 2020-2021, 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 agr...
use std::{ collections::HashSet, path::{Path, PathBuf}, }; use super::{ ast::{ComponentDef, NamespaceDef}, parser, }; use crate::{ errors::{CalyxResult, Error}, ir, }; /// A Workspace represents all Calyx files transitively discovered while trying to compile a /// top-level file. /// /// # Exa...
use std::net::{IpAddr, Ipv4Addr, SocketAddr, SocketAddrV4}; use std::path::{Path, PathBuf}; use anyhow::{Context, Result}; use http::uri::PathAndQuery; use nekoton_utils::*; use secstr::SecUtf8; use serde::{Deserialize, Serialize}; pub use self::eth_config::*; pub use self::stored_keys::*; use self::temp_keys::*; pub...
use todo_lib::{todo, todotxt}; fn init_tasks() -> todo::TaskVec { let mut t = Vec::new(); let now = chrono::Local::now().date().naive_local(); t.push(todotxt::Task::parse("call mother +family @parents", now)); t.push(todotxt::Task::parse( "x (C) 2018-10-05 2018-10-01 call to car service and sc...
use crate::config::BucketIndexType; use crate::hashes::{ExtendableHashTraitType, HashFunction, HashFunctionFactory, HashableSequence}; use std::mem::size_of; pub struct ForwardSeqHashIterator<N: HashableSequence> { seq: N, mask: HashIntegerType, fh: HashIntegerType, k_minus1: usize, } #[inline(always)...
use std::collections::HashMap; use std::convert::TryInto; use std::fmt::{Display, Formatter}; use ed25519_dalek::Digest; use failure::bail; use ton_block::{ CatchainConfig, ConfigParams, UnixTime32, ValidatorDescr, ValidatorSet, WorkchainDescr, Workchains, }; use ton_types::Result; use crate::proofs::Signatur...
use anyhow::{anyhow, Result}; use egg_mode::{ list::{List, ListID}, tweet::{Timeline, Tweet}, }; use tokio::time::{sleep, Duration}; use crate::{ui::UI, MyConfig}; const AUTH_TOKENS_FILE: &'static str = ".twitter_cli_oauth"; //const CONSUMER_KEY: &'static str = include_str!("consumer_key.in"); //const CONSUME...
use std::marker; use std::ptr; use libc::{c_int, c_void}; use crate::util::{Binding, IntoCString}; use crate::{panic, raw, tree, Error, Oid, Repository, TreeEntry}; /// Constructor for in-memory trees pub struct TreeBuilder<'repo> { raw: *mut raw::git_treebuilder, _marker: marker::PhantomData<&'repo Reposito...
use std::error::Error; use std::collections::HashMap; // Cache managment use std::fs::{File, create_dir_all}; use std::io::prelude::*; /// Filename for list of supported languages const CACHE_LANGS_FILE: &str = "bliss_langs"; /// Commands to cleanup git repositories pub struct Ignorance { } impl Ignorance { //...
use erased_serde::serialize_trait_object; use futures::executor; use crate::{ characteristic::{ accessory_flags::AccessoryFlagsCharacteristic, hardware_revision::HardwareRevisionCharacteristic, HapCharacteristic, }, pointer, service::{accessory_information::AccessoryInformationS...
use { crate::*, std::{ num::ParseIntError, str::FromStr, }, thiserror::Error, }; #[derive(Debug, Error)] pub enum LogParseError { #[error("invalid log line {0:?}")] InvalidLogLine(String), #[error("character not found {0:?}")] CharNotFound(char), #[error("date parse ...
use std::env; use std::fs::{DirBuilder, File, OpenOptions}; use std::io::prelude::*; use std::path::{Path, PathBuf}; use std::process::Command; use dirs::home_dir; use failure::ResultExt; use tempdir::TempDir; use toml; use errors::*; use service::Service; const TOML_TEMPLATE: &str = r#"# Example devbox project conf...
use crate::error::{ArrayStringError, ByteDecodeError}; use crate::Coin; use cosmos_sdk_proto::cosmos::base::abci::v1beta1::TxResponse; use prost_types::Any; use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Result as FmtResult; use std::{str, usize}; /// A function that takes a hexadecimal representation o...
use glfw::{WindowEvent, Action}; use cgmath::{Matrix3, Transform, Matrix4}; use crate::rendering::prelude::{Position, Rectangle}; use crate::{editor}; use crate::command_buffer::{Command, CommandBuffer}; use crate::editor::tools::{Tool, get_transformed_mouse_position, EditorWindow}; use crate::editor::image_operation:...
use crate::{CircuitHeader, Witness, ConstraintSystem, Variables, Message}; use std::collections::HashMap; use num_bigint::BigUint; type Var = u64; type Field = BigUint; #[derive(Copy, Clone, PartialEq)] enum Status { Undefined, Defined, Used, } use Status::*; #[derive(Clone, Default)] pub struct Valid...
// Copyright 2020 The xi-editor 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 or ag...
use crate::*; use std::panic; use lib0::any::Any; use updates::decoder::UpdateDecoder; const BLOCK_GC_REF_NUMBER: u8 = 0; const BLOCK_ITEM_DELETED_REF_NUMBER: u8 = 1; const BLOCK_ITEM_JSON_REF_NUMBER: u8 = 2; const BLOCK_ITEM_BINARY_REF_NUMBER: u8 = 3; const BLOCK_ITEM_STRING_REF_NUMBER: u8 = 4; const BLOCK_ITEM_EMBED...
//! Types and functions related to bindgen annotation comments. //! //! Users can add annotations in doc comments to types that they would like to //! replace other types with, mark as opaque, etc. This module deals with all of //! that stuff. use crate::clang; /// What kind of accessor should we provide for a field?...
//! Adds [`try_map`](ArrayExt::try_map) and [`map2`](ArrayExt::try_map) methods to arrays. //! //! This crate requires nightly. #![doc(html_root_url = "https://docs.rs/array_try_map/0.1.0")] #![no_std] #![feature( min_const_generics, maybe_uninit_uninit_array, maybe_uninit_extra, maybe_uninit_slice, ...
/*! Contains types related to the type layout of function pointers. */ use super::*; use crate::{ composite_collections::{SmallStartLen as StartLen}, fn_pointer_extractor::TypeVisitor, lifetimes::LifetimeRange, }; use std::marker::PhantomData; use syn::Type; ///////////////////////////////////////////...
use super::{ tls::load_config, world::World, world_session::{SocketTools, WorldSession}, world_socket::WorldSocket, }; use crate::game::game_loop::GameLoop; use crate::{ error::{Error, Result}, game::GameTime, }; use crossbeam::atomic::AtomicCell; use std::{net::SocketAddr, path::Path, sync::Arc...
mod chip8; use chip8::Chip8; use sdl2::{audio, event, keyboard::Keycode, pixels}; use std::{collections::HashMap, env, fs, io}; fn main() -> Result<(), io::Error> { let args: Vec<String> = env::args().collect(); if args.len() == 1 { println!("Usage: chip8-oxidized <file-path>"); return Err(io...
use crate::args::{Args, Charset}; use crate::format::Pattern; use crate::graph::Graph; use anyhow::{anyhow, Context, Error}; use cargo_metadata::{DependencyKind, Package, PackageId}; use petgraph::visit::EdgeRef; use petgraph::EdgeDirection; use semver::Version; use std::collections::{HashMap, HashSet}; #[derive(Clone...
// Copyright 2018 <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 // // Unless required by applicable law or agreed t...
use crate::{gen::node::server as gen_server, service::NodeService}; use network_core::server::{ block::BlockService, content::ContentService, gossip::GossipService, Node, }; use futures::future::Executor; use tokio::net::{TcpListener, TcpStream}; use tokio::prelude::*; #[cfg(unix)] use tokio::net::{UnixListener,...
use std::{fmt, ops}; use impl_ops::*; #[derive(Copy, Clone, Debug)] pub struct Matrix4f { pub m00: f32, pub m10: f32, pub m20: f32, pub m30: f32, pub m01: f32, pub m11: f32, pub m21: f32, pub m31: f32, pub m02: f32, pub m12: f32, pub m22: f32, pub m32: f32, pub m03: f32, pub m13: f32, pub m23: f32, ...
use agc::cpu::Cpu; use agc::memory::load_yayul_img_file; use crossterm::cursor::*; use crossterm::event::*; use crossterm::style::*; use crossterm::terminal::*; use crossterm::*; use std::io::{stdout, Stdout, Write}; use std::path::PathBuf; fn main() -> std::result::Result<(), Box<dyn std::error::Error>> { // Init...
/* * Copyright (c) 2017 <NAME> <<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, modify, merge, pu...
use libc::{c_int, c_short, c_void, sigset_t, size_t}; #[derive(Clone, Copy, Debug)] #[repr(C)] pub struct sigaltstack { pub ss_sp: *const c_void, pub ss_size: size_t, pub ss_flags: c_int, } #[derive(Clone, Copy, Debug)] #[repr(C)] pub struct x86_exception_state64 { pub trapno: u16, pub cpu: u16, ...
// Copyright (c) 2018-2021 The MobileCoin Foundation #![doc = include_str!("../README.md")] #![deny(missing_docs)] mod json_format; pub mod config; pub mod keygen; use json_format::RootIdentityJson; use mc_account_keys::{PublicAddress, RootIdentity}; use mc_api::printable::PrintableWrapper; use std::{convert::TryIn...
// Generated from definition io.k8s.api.autoscaling.v2beta2.HPAScalingPolicy /// HPAScalingPolicy is a single policy which must hold true for a specified past interval. #[derive(Clone, Debug, Default, PartialEq)] pub struct HPAScalingPolicy { /// PeriodSeconds specifies the window of time for which the policy shou...
// Copyright (c) 2020 Huawei Technologies Co.,Ltd. All rights reserved. // // StratoVirt is licensed under Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan // PSL v2. // You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 // THIS SOFTWA...
use ndarray::prelude::*; use std::error::Error; use crate::prelude::*; pub fn native_mm_convolution_3d(input: Array3<f32>, hp: &ConvHyperParam) -> Result<Array3<f32>, Box<dyn Error>> { let input = pad_3d(input, hp.padding); let channels = input.dim().0; let (i_n, i_m) = (input.dim().1, input.dim().2); ...
use std::collections::HashMap; use std::fmt; use std::io; use std::ops::Index; use byteorder::WriteBytesExt; use flate2::read::{GzDecoder, ZlibDecoder}; use flate2::write::{GzEncoder, ZlibEncoder}; use flate2::Compression; use error::{Error, Result}; use raw; use value::Value; /// A generic, complete object in Named...
use crate::{Section, SectionLayout, GenericObject, DrawCall}; pub struct World { section_size: f64, locations: Vec<(i32, i32)>, sections: Vec<Section>, general_layout: SectionLayout, static_objects: Vec<Box<dyn GenericObject>>, } // -x = right // +x = left // -z = up/away // +z = down/towards impl World { ...
use std::error::Error; use std::path::{Path, PathBuf}; use yaml_rust::{Yaml, YamlEmitter, YamlLoader}; /// List of directories containing files to expand. The first tuple element is the source /// directory, while the second tuple element is the destination directory. #[rustfmt::skip] static TO_EXPAND: &[(&str, &str)]...
use {TryRead, TryWrite}; use std::mem; use mio::*; use std::io; use mio::deprecated::{EventLoop, Handler}; use mio::deprecated::unix::{PipeReader, PipeWriter}; use std::process::{Command, Stdio, Child}; struct SubprocessClient { stdin: Option<PipeWriter>, stdout: Option<PipeReader>, stderr: Option<PipeRea...
use std::time::{Duration, Instant}; use log::*; use serde_derive::*; use actix::prelude::*; use actix_web::ws; use futures::Future; use crate::canvas::*; use crate::State; const PING_INTERVAL: Duration = Duration::from_secs(5); const PING_TIMEOUT: Duration = Duration::from_secs(10); #[derive(Debug)] pub struct Cli...
use std::collections::HashMap; use serde_derive::{Serialize, Deserialize}; use crate::{ id::RbxId, instance::{RbxInstance, RbxInstanceProperties}, }; /// Represents a tree containing rooted instances. /// /// Rooted instances are described by /// [RbxInstance](struct.RbxInstance.html) and have an ID, childre...
#![recursion_limit = "256"] #![feature(slice_patterns)] use std::{convert::Into, fmt, str::FromStr}; use log::info; use serde::{Deserialize, Serialize}; use smart_default::SmartDefault; use stdweb::{js_deserializable, js_serializable, __js_serializable_boilerplate}; use web_logger; use yew::{ html, Bridge, Bridge...
//! Triangulator. use std::f64; use cgmath::{InnerSpace, Point3, Vector2, Vector3}; use failure::{bail, format_err, Fallible}; use fbxcel_dom::v7400::data::mesh::{PolygonVertexIndex, PolygonVertices}; /// Triangulator. pub fn triangulator( pvs: &PolygonVertices<'_>, poly_pvis: &[PolygonVertexIndex], resu...
use std::task::{Context, Poll}; use std::{cell::Cell, cell::RefCell, future::Future, num::NonZeroU16, pin::Pin, rc::Rc}; use ntex::router::{IntoPattern, Path, RouterBuilder}; use ntex::service::boxed::{self, BoxService, BoxServiceFactory}; use ntex::service::{IntoServiceFactory, Service, ServiceFactory}; use ntex::tas...
mod physics; use std::{borrow::Borrow, fs::File, io::Write, time::Duration, vec}; use gifed::{ block::{ extension::{DisposalMethod, Extension, GraphicControl}, ColorTable, Version, }, writer::{GifBuilder, ImageBuilder}, Color, }; use physics::{ objects::{Fixed, Kinetic}, Simulation, Vec2, }; use crate::ph...
use combine::{ easy, error::StreamError, stream::{Positioned, ResetStream, StreamErrorFor, StreamOnce}, ParseError, Stream, }; #[doc(hidden)] #[derive(Clone, Debug)] pub struct Biterator<I> { pub(crate) input: I, pub(crate) bits: u64, pub(crate) count: u8, } impl<I> Biterator<I> { pub ...
//! Anaylyze the SSH packet use std::fmt; use std::net::{IpAddr, SocketAddr}; use std::str; use pnet_packet::{ ethernet::{EtherType, EtherTypes, EthernetPacket}, ip::IpNextHeaderProtocols, ipv4::Ipv4Packet, ipv6::Ipv6Packet, tcp::TcpPacket, vlan::VlanPacket, Packet as _, }; use ssh_parser::...
extern crate sdl2; use sdl2::rect::Rect; use sdl2::pixels::Color; use sdl2::surface::Surface; use sdl2::event::Event; use crate::{colors, Window}; use super::{Widget, WidgetState}; use crate::view_components::{IntoViewComponent, ViewComponent}; use crate::images; use std::path::Path; /// Image Widget /// - Display...
#[macro_use] extern crate criterion; #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; use criterion::Criterion; use nom::{ branch::alt, bytes::complete::{tag, take}, character::complete::{anychar, char, multispace0, none_of}, combinator::{map, map_opt, map_res, value, verify}...
use intcode_computer::Computer; fn main() { challenge_1(); } fn challenge_1() { let mut computer = Computer::load_from_file("input"); let program = " NOT A T OR T J NOT B T OR T J NOT C T OR T J AND D J NOT T T...
/* Copyright 2021 Integritee AG and Supercomputing Systems AG Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or...
use serde::Serialize; use twilight_model::{ channel::message::{ sticker::{StickerFormatType, StickerType}, Sticker, }, id::{ marker::{GuildMarker, StickerMarker, StickerPackMarker, UserMarker}, Id, }, }; /// Representation of a cached [`Sticker`]. /// /// [`Sticker`]: tw...
// Copyright 2015-2016 <NAME>. // Portions Copyright (c) 2014, 2015, Google Inc. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. // // THE SOFTWAR...
use quicli::prelude::*; use structopt::StructOpt; use std::path::Path; use std::env; use std::path::PathBuf; use regex::Regex; use lazy_static::lazy_static; lazy_static! { static ref FRONTMATTER: regex::Regex = Regex::new(r"---[\n\r]").unwrap(); static ref DATE_REGEX: regex::Regex = Regex::new(r"(?P<y>\d{4})-(...
//! Low-Level reader for FDB files //! //! This module provides a struct which can be used to access //! a FDB file in any order the user desires. pub mod builder; use std::io::{self, BufRead, Read, Seek, SeekFrom}; use super::{ file::{ lists::{FDBBucketHeaderList, FDBColumnHeaderList, FDBFieldDataList, ...
use common; use regex; use std::io; use std::io::prelude::*; use std::collections::{HashSet,HashMap,VecDeque}; #[derive(Default, Copy, Clone, Debug, Eq, PartialEq, Hash)] struct State { pub elevator: usize, pub generators: [u8;4], pub chips: [u8;4], } impl State { pub fn is_valid(&self) -> bool { ...
// use darling::FromMeta; use proc_macro::TokenStream; use proc_macro2::Ident; use proc_macro2::TokenStream as TokenStream2; use quote::{quote, ToTokens, TokenStreamExt}; // use syn::visit_mut::VisitMut; use syn::{parse_macro_input, AttrStyle, Attribute, Data, DeriveInput, Lit, MetaNameValue}; /// # Description /// //...
use gcd::gcd; use std::fmt; use std::ops::Add; use std::ops::Sub; use std::ops::Mul; use std::ops::Div; pub static ZERO: Quotient = Quotient { numerator: 0, denominator: 1, positive: true }; /// A mathematical quotient (or "fraction"), living in the field Q. /// /// Always represented internally in lowest terms, wi...