text
stringlengths
3.09k
13.9k
use crate::shared::{Monitor, MonitorManager, ReactionRole, StateManager}; use log::{debug, error, info}; use serenity::{ client::Context, model::channel::Message, model::channel::{Channel, ReactionType}, utils::MessageBuilder, }; use std::error::Error; /// Return whether the message should be ignored. ...
//! Vulkan setup. use std::sync::Arc; use failure::{format_err, Fallible, ResultExt}; use log::{debug, info}; use vulkano::{ descriptor::descriptor_set::{DescriptorSet, PersistentDescriptorSet}, device::{Device, DeviceExtensions, Queue}, format::R8G8B8A8Srgb, image::{Dimensions, ImmutableImage, Swapch...
//! UCI interface. use crate::types::Move; use std::io::{self, BufRead, Write}; use std::sync::mpsc; use std::thread; use std::time::Duration; pub struct Uci { _stdin_thread: thread::JoinHandle<()>, line_rx: mpsc::Receiver<io::Result<String>>, writer: Box<dyn Write>, } impl Uci { pub fn new() -> Self...
//! [`Write`] stream to create bgzip format file. //! //! [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html //! //! # Example //! ``` //! use bgzip::write::BGzWriter; //! use std::fs; //! use std::io; //! use std::io::prelude::*; //! //! # fn main() { let _ = run(); } //! # fn run() -> io::Result<()> { //! l...
#[cfg(feature = "orbital")] use edit::buffer::TextBuffer; #[cfg(feature = "orbital")] use io::redraw::RedrawTask; use state::editor::Editor; #[cfg(feature = "orbital")] use state::mode::{Mode, PrimitiveMode}; #[cfg(feature = "orbital")] use orbclient::{Color, Renderer}; #[cfg(feature = "orbital")] impl Editor { /...
use crate::{config::Config, get_input::get_input}; use chrono::{Datelike, Timelike, Utc}; use core::{Bag, Board, Colour, Game, GameType, Input, Recorder, Replay, Score, TickType}; use display::ScreenBuffer; use rand::{RngCore, SeedableRng}; use std::{ io::{BufRead, Write}, path::Path, time::{Duratio...
use crate::frame_parser::Frame; #[cfg(feature = "serialize")] use serde::{Deserialize, Serialize}; use thiserror::Error; const I3LIDAR_NEW_DISTANCE: u8 = 0xAD; const I3LIDAR_LIDAR_SPEED: u8 = 0xAE; #[derive(Debug, PartialEq)] #[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))] pub enum Packet { Dis...
use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use crate::ContractError; use cosmwasm_std::{Addr, Decimal, Env, Fraction, Uint128}; use cw_storage_plus::{Item, Map}; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct Config { // address of oracle contract (this allow...
use crate::ambient_occlusion::*; use crate::context::Context; use crate::material::VoxelMaterialId; use crate::side::*; use crate::voxel::*; use nalgebra_glm::*; use rendy::mesh::{Normal, Position, Tangent}; use std::iter::repeat; /// The required functionality to triangulate voxels. pub trait Triangulate<T: Data> { ...
use futures::executor::block_on; use zeebest::Client; fn main() { let client = Client::new("127.0.0.1", 26500).unwrap(); let result = block_on(client.deploy_bpmn_workflow("simple-process", SIMPLE_PROCESS_XML.into())); println!("deploy workflow result: {:?}", result); } const SIMPLE_PROCESS_XML: &'static...
use aadsia::sstree::SsTree; use eframe::epi; use egui::{emath, util::cache::CacheTrait, Color32, Frame, Pos2, Rect, Sense, Shape, Stroke}; use rand::Rng; struct Select { center: Pos2, radius: f32, } impl Select { pub fn new(center: Pos2) -> Self { Self { center, radius: 0.0...
use super::{Image, Serializable}; use super::{adler::AdlerIterator, crc, ChecksumIterator}; pub struct PNG { magic_number: [u8; 8], ihdr_chunk: Chunk<IHDR>, idat_chunk: Chunk<IDAT>, iend_chunk: Chunk<IEND>, } struct Chunk<T: Serializable> { length: u32, name: [u8; 4], payload: T, // c...
use std::os::unix::io::AsRawFd; use std::path::Path; use anyhow::Result; use super::*; use nix::fcntl::OFlag; use nix::sys::stat::Mode; use oci_spec::runtime::LinuxDeviceCgroup; use crate::common::{default_allow_devices, default_devices, ControllerOpt}; use crate::v2::controller::Controller; #[cfg(test)] use bpf::m...
extern crate geo; extern crate open_location_code; extern crate rand; use rand::Rng; use std::time::Instant; use std::vec::Vec; use open_location_code::{decode, encode}; use open_location_code::{is_full, is_short, is_valid}; use open_location_code::{recover_nearest, shorten}; use geo::Point; mod csv_reader; use cs...
use std::{ sync::{ atomic::{AtomicBool, Ordering}, Arc, }, time::Duration, }; use arci::*; use futures::stream::StreamExt; use parking_lot::Mutex; use r2r::{ builtin_interfaces::{msg as builtin_msg, msg::Time}, control_msgs::{action::FollowJointTrajectory, msg::JointTrajectoryContro...
#![cfg(test)] use super::FastBernoulliTrial; use rand::{SeedableRng, XorShiftRng}; use std; fn make(probability: f64) -> FastBernoulliTrial<XorShiftRng> { let rng = XorShiftRng::from_seed([0x3b3f4150, 0x53704c15, 0x09b0136e, 0xf66c1396]); FastBernoulliTrial::new_with_rng...
use std::default::{Default}; use std::rc::{Rc}; use game_state::{State}; use map::{Map, Terrain, distance}; use fov::{fov, simple_fov}; use db::{Db}; use unit::{Unit, UnitType}; use position::{MapPos, ExactPos, SlotId}; use event::{CoreEvent}; use player::{PlayerId}; use object::{ObjectClass}; #[derive(Clone, Copy, Pa...
#![allow(dead_code)] #![allow(clippy::unnecessary_wraps)] type Error = Box<dyn std::error::Error>; type Result<T> = std::result::Result<T, Error>; pub struct BytePacketBuffer { pub buf: [u8; 512], pub pos: usize, } impl Default for BytePacketBuffer { fn default() -> Self { BytePacket...
use std::{ borrow::Borrow, fmt::{Debug, Result}, }; pub trait NonAdjacentForm { fn non_adjacent_form(&self, w: usize) -> [i8; 256]; } impl<C> NonAdjacentForm for Scalar<C> where C: Ciphersuite, { /// Computes a width-\\(w\\) "Non-Adjacent Form" of this scalar. /// /// Thanks to curve25519-...
use expr::{Node, Op, Var}; use lex::{Token, TokenType}; pub mod expr; pub mod error; use error::ParseError; pub struct Parser<'a> { tokens: Vec<Token<'a>>, nodes: Vec<Node>, index: usize, } impl<'a> Parser<'a> { fn new(tok: Vec<Token>) -> Parser { Parser { tokens: tok, ...
//! [`Certificate`]. use std::time::Duration; use error::CertificateError; use serde::{Deserialize, Serialize}; use webpki::EndEntityCert; use x509_parser::{certificate::X509Certificate, extensions::GeneralName, prelude::FromDer}; use crate::error; /// A public certificate. You can distribute it freely to peers. #[...
use anyhow::{anyhow, Result}; use std::collections::HashMap; use std::str::FromStr; struct Byr(u64); struct Iyr(u64); struct Eyr(u64); enum Hgt { Cm(u64), In(u64), } struct Hcl(String); struct Ecl(String); struct Pid(u32); fn parse_num_in_range(s: &str, min: u64, max: u64) -> Result<u64, anyhow::Error> { ...
use crate::BlockingProvider; use sputnik::backend::{Backend, Basic, MemoryAccount}; use ethers::{ providers::Middleware, types::{BlockId, H160, H256, U256}, }; use std::collections::BTreeMap; /// Memory backend with ability to fork another chain from an HTTP provider, storing all cache /// values in a `BTree...
use gtk4::cairo::glib::SignalHandlerId; use gtk4::{self, glib, glib::clone, prelude::*, subclass::prelude::*, CompositeTemplate}; pub(crate) mod imp { use super::*; use gtk4::glib::ParamSpec; use once_cell::sync::OnceCell; use std::cell::RefCell; #[derive(Debug, CompositeTemplate)] #[template(...
//! Representing and handling values in CO. use colang::program::FieldId; use std::cell::{Ref, RefCell, RefMut}; use std::collections::HashMap; use std::rc::Rc; /// A value in CO. /// /// Can represent a value of any type and value category. Lvalues are represented as pointers, /// so that they could be modified. #[d...
#![allow(unused)] fluent_templates::static_loader! { static LOCALES = { locales: "./tests/locales", fallback_language: "en-US", core_locales: "./tests/locales/core.ftl", customise: |bundle| bundle.set_use_isolating(false), }; } fluent_templates::static_loader! { pub(crate) ...
use crate::{pool, DbError, DbResult, Paginated, DEFAULT_PAGE_SIZE}; use async_diesel::*; use chrono::prelude::*; use diesel::prelude::*; use diesel::QueryDsl; use diesel_filter::{DieselFilter, Paginate}; pub use diesel_json::Json; use platz_chart_ext::resource_types::ChartExtResourceTypes; use platz_chart_ext::{ChartEx...
///////////////////////////////////////////////////////////////////////////// // // // Un administrador de paquetes universal para linux como modelo: PKGBUILD // // // // Autor...
use crate::bgp::packet::MutableBgpHeaderPacket; use crate::bgp::packet::MutableBgpOpenPacket; use crate::bgp::packet::{BgpHeaderPacket, BgpOpenOptPacket, BgpOpenPacket, BgpTypes}; use crate::bgp::{Capabilities, Capability, Family, AFI_IP, BGP_HEADER_LEN, SAFI_MPLS_VPN}; use bytes::BytesMut; use pnet::packet::Packet; us...
use hex::FromHex; use nom::bits::complete::{tag, take}; use nom::branch::alt; use nom::multi::count; use nom::multi::many0; use nom::sequence::pair; use nom::sequence::preceded; use nom::IResult; type THeader = (usize, usize); #[derive(Debug)] enum Packet { Lit(THeader, usize), Op(THeader, Vec<Packet>), } impl Pa...
use std::io::Write; use anyhow::Result; use clap::Parser; use cli_macro::crud_gen; /// Create, list, edit, view, and delete organizations. #[derive(Parser, Debug, Clone)] #[clap(verbatim_doc_comment)] pub struct CmdOrganization { #[clap(subcommand)] subcmd: SubCommand, } #[crud_gen { tag = "organizations...
use crate::{ behaviour::EpisubNetworkBehaviourAction, config::Config, error::RpcError, rpc::{self, rpc::Action}, tree::PlumTree, view::{AddressablePeer, HyParView}, EpisubEvent, }; use futures::FutureExt; use libp2p_core::PeerId; use libp2p_swarm::NetworkBehaviourAction; use std::{ collections::VecDeque...
//! Access secure credentials at runtime with multiple backends. //! //! For more information, see [the //! homepage](https://github.com/emk/credentials). //! //! ``` //! # #[tokio::main] //! # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> { //! use std::env; //! //! env::set_var("PA...
use pge::*; use pge::gfx2d::{Transform2D, GFX2D}; use pge::gfx2d::vec2d::Vec2d; use image::GenericImageView; use minifb::Key; struct GameState { spr: Sprite, total_time: f32, // todo: move???? list_events: Vec<String>, } impl State for GameState { fn on_user_create(&mut self) -> bool { for _ in 0..1...
use std::convert::TryInto; use crate::instruction::AppInstruction; use crate::schema::lottery::MAX_PARTICIPANT; use crate::{error::AppError, schema::lottery::Lottery}; use solana_program::native_token::{sol_to_lamports, LAMPORTS_PER_SOL}; use solana_program::program::invoke; use solana_program::sysvar::Sysvar; use sol...
use arcs::{ components::{ layer::LayerType, CursorPosition, Dimension, DrawingObject, Geometry, GridStyle, Layer, Name, PointStyle, }, euclid::{Length, Point2D, Size2D}, piet::Color, primitives::Grid, specs::prelude::*, systems::deleter::Deleter, systems::draw::Draw, systems::mover::Mover, s...
use wpilib::wpilib_hal::*; use wpilib::hal_call::*; use wpilib::sensor; use wpilib::usage::*; use std::{thread, time}; /// An analog input on the RoboRIO pub struct AnalogInput { channel: i32, handle: HAL_AnalogInputHandle, accumulator_offset: i64, } impl AnalogInput { /// Create a new analog input on...
use crate::app::App; use crate::common::{ColorLegend, Colorer}; use crate::layer::{Layer, LayerOutcome}; use abstutil::{prettyprint_usize, Counter}; use ezgui::{ hotkey, Btn, Checkbox, Composite, Drawable, EventCtx, GfxCtx, HorizontalAlignment, Key, Line, Outcome, Text, TextExt, VerticalAlignment, Widget, }; us...
use image::{DynamicImage, GenericImage}; use crate::{ light::Light, material::{Color, SurfaceKind}, object::Intersectable, object::Intersection, object::Object, vector::Vector3, }; const SHADOW_ACNE_BIAS: f32 = 0.001; #[derive(Debug, Clone)] pub struct Ray { pub origin: Vector3, pub d...
// use std; use std::cmp; use super::character::*; use super::battlefield::*; extern crate rand; // use rand::random; // The Character direct references here are bad and wrong, // because what happens if a character dies before an attack goes off? // They need to be some sort of indirect reference so we can check //...
use std::error::Error; use std::fmt; use std::io; /// Mathematical operations that our compiler can do. #[derive(Debug, Eq, PartialEq, Clone, Copy)] enum Op { Mul, Div, Add, Sub, } impl Op { fn precedence(&self) -> i32 { use Op::*; match self { Mul | Div => PREC_MUL, ...
pub use crate::buffer::{SliceBuffer, SliceInfo}; pub use crate::read::StreamReader; pub use crate::store::StreamStorage; pub use crate::stream::{DocId, Head, PeerId, SignedHead, Slice, Stream, StreamId}; pub use crate::write::StreamWriter; pub use bao::Hash; pub use ed25519_dalek::{Keypair, PublicKey, SecretKey}; mod ...
mod tetronimos; use std::collections::HashMap; use tetronimos::{Tetronimo, TetronimoBag, Type}; use tui::style::Color; pub enum ScoreAction { RowCleared(u8), FallLength(u8), HardDrop(u8), } pub enum MoveDirection { Down, Left, Right, } pub struct Board { falling: Option<Tetronimo>, u...
//! Component and buffers use crate::{ assets::{ Id, Texture, Mesh }, services::Assets, }; use super::pipeline::Pipeline; use dotrix_math::Mat4; /// Pipeline buffers pub struct Buffers { bind_group: wgpu::BindGroup, vertices: wgpu::Buffer, indices: wgpu::Buffer, proj_view: wgpu::Buffer, i...
mod git; mod hg; mod util; use std::collections::HashMap; use std::env; use std::path::PathBuf; use util::Status; /// Available formatting styles enum OutputStyle { Detailed, Minimal, } /// Supported version control systems #[derive(Clone)] enum VCS { Git, Hg, None, } impl VCS { fn get_sta...
//---------------------------------------------------------------------------// // Copyright (c) 2017-2020 <NAME>. All rights reserved. // // This file is part of the Rusted PackFile Manager (RPFM) project, // which can be found here: https://github.com/Frodo45127/rpfm. // // This file is licensed under the MIT license...
use crate::*; use bitcoin::hashes::Hash; use bitcoin::{Block, Txid, Script, WScriptHash}; use crate::rocks_db::{Serialize, Deserialize, ConstantSize}; use crate::db::utxo::UtxoEntry; #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct AddressIndexDBKey { pub wscript_hash: WScriptHash, // +32 = 32. ...
use std::collections::HashMap; use std::convert::TryFrom; use std::fmt; use std::io::{Cursor, Read, Write}; use std::str::FromStr; use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use num_enum::{IntoPrimitive, TryFromPrimitive}; use serde::{Deserialize, Serialize}; use crate::Error; pub const HEADER_FIXED_LE...
use std::fmt::{Display, Formatter}; use std::ops::Deref; /// Both attributes and elements can have a namespace alias prefix, such as `ns:foo`, where `ns` is /// the 'prefix' and 'foo' is the 'name'. The `Name` struct provides the convenience of parsing and /// differentiating the 'prefix' and 'name' parts. #[derive(De...
// cargo run --release --example harmonograph_1 -- --radius 1 // // some nice designs based on the concept of a harmonograph // ref: https://en.wikipedia.org/wiki/Harmonograph // // examples with arguments (after being built) // dots // ./target/release/examples/harmonograph_1 --radius 7000 --y-origin 5900 --x-mod-...
use std::f64; use vecmath::Vector3; use vecmath::Matrix3; use vecmath::{vec3_add, vec3_sub, vec3_neg, vec3_dot, vec3_square_len, vec3_normalized_sub}; use vecmath::row_mat3_transform; use aabb::AABB; use anim::RayTraceAnimation; use hit::RayTraceRayHit; use material::RayTraceMaterial; use object::RayTraceObject; use ...
// 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...
//! This test attempts to verify that the set of 'native' //! certificates produced by this crate is roughly similar //! to the set of certificates in the mozilla root program //! as expressed by the `webpki-roots` crate. //! //! This is, obviously, quite a heuristic test. #![cfg(feature = "rustls")] use std::collecti...
//! Implementation of Item Variation Store //! //! https://docs.microsoft.com/en-us/typography/opentype/spec/otvarcommonformats#item-variation-store use crate::NormalizedCoord; use crate::parser::{Stream, FromData, LazyArray16, NumFrom}; #[derive(Clone, Copy)] pub(crate) struct ItemVariationStore<'a> { data: &'a...
use std::marker::PhantomData; use specs::{ storage::ComponentEvent, world::Index, BitSet, Join, ReadStorage, ReaderId, System, SystemData, World, WriteExpect, WriteStorage, }; use crate::{ bodies::{PhysicsBody, Position}, nalgebra::RealField, Physics, }; use su...
// Copyright (c) 2018-2021 The MobileCoin Foundation //! Configuration parameters for the watcher test utility. use mc_util_uri::{ConsensusClientUri, WatcherUri}; use serde::{Deserialize, Serialize}; use std::{fs, path::PathBuf, str::FromStr, time::Duration}; use structopt::StructOpt; use url::Url; #[derive(Clone, D...
use std::io::{Error as IoError, ErrorKind, Result as IoResult}; use base64::URL_SAFE_NO_PAD; use http::{Method, Uri}; use hyper::{client::HttpConnector, Client}; use hyper_rustls::HttpsConnector; use ring::digest::{digest, Digest, SHA256}; use serde::{de::DeserializeOwned, Serialize}; use crate::listener::acme::key_p...
//! Consensus account address structures. use std::{convert::TryInto, fmt}; use anyhow::{anyhow, Result}; use bech32::{self, FromBase32, ToBase32, Variant}; use lazy_static::lazy_static; use crate::common::{ crypto::{hash::Hash, signature::PublicKey}, key_format::KeyFormatAtom, namespace::Namespace, }; l...
#![allow(dead_code)] use sabi_math::*; use std::collections::HashMap; use super::block::*; use super::chunk::*; #[derive(Debug, Clone, Hash, Eq, PartialEq)] pub struct ChunkCoordinate { pub x: u32, pub y: u32, pub z: u32, } impl ChunkCoordinate { #[inline] pub fn new(x: u32, y: u32, z: u32) -> Ch...
#![recursion_limit = "128"] extern crate proc_macro; #[macro_use] extern crate syn; #[macro_use] extern crate quote; use proc_macro::TokenStream; use quote::Tokens; use syn::{Attribute, Data, DataEnum, DataStruct, DeriveInput, Field, Fields, Ident, Lit, Meta, MetaNameValue, Path, PathArguments, PathSegment, Type, Typ...
#![cfg_attr(not(feature = "std"), no_std)] #![allow(unused_mut)] #[cfg(feature = "std")] use std as core; #[macro_use] extern crate log; extern crate smoltcp; #[cfg(feature = "std")] extern crate env_logger; #[cfg(feature = "std")] extern crate getopts; #[cfg(feature = "std")] #[allow(dead_code)] mod utils; use core...
use codespan::{ByteIndex, Span}; use regex::Regex; use std::{ error::Error as StdError, fmt::{self, Display, Formatter}, }; /// A generic table-based lexer. /// /// This works by registering a bunch of token patterns and *Token Constructors* /// which let you convert the matched text into a custom `Token` type...
use gtk::glib::Sender; use gtk::prelude::{BoxExt, ButtonExt, GtkWindowExt}; use relm4::factory::{DynamicIndex, Factory, FactoryPrototype, FactoryVecDeque, WeakDynamicIndex}; use relm4::{gtk, send, AppUpdate, Model, RelmApp, Widgets}; #[derive(Debug)] enum AppMsg { AddFirst, RemoveLast, CountAt(WeakDynamicI...
#![deny(warnings, rust_2018_idioms)] use tokio_codec::{Encoder, FramedWrite}; use tokio_io::AsyncWrite; use tokio_test::assert_ready; use tokio_test::task::MockTask; use bytes::{BufMut, BytesMut}; use futures_sink::Sink; use std::collections::VecDeque; use std::io::{self, Write}; use std::pin::Pin; use std::task::Pol...
use data_encoding::Encoding; use data_encoding_macro::new_encoding; use diesel::{ backend::Backend, deserialize::FromSql, serialize::ToSql, sql_types::{BigInt, HasSqlType}, }; use rand::Rng; use serde::{de::Error as _, ser::Error as _}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use ...
// Copyright 2018 astonbitecode // // 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 wr...
use proptest::{ arbitrary::{any, any_with, Arbitrary, StrategyFor}, strategy::{BoxedStrategy, Just, Map, Strategy}, test_runner::{Reason, TestRunner}, }; use crate::server::coretypes::{GameCfg, HedgehogInfo, ServerVar, ServerVar::*, TeamInfo}; use super::messages::{HWProtocolMessage, HWProtocolMessage::*}...
use borsh::{BorshDeserialize, BorshSerialize}; use serde::{Deserialize, Serialize}; use std::convert::{TryFrom, TryInto}; /// PublicKey curve #[derive( Debug, Clone, Copy, Serialize, Deserialize, PartialEq, BorshDeserialize, BorshSerialize, )] pub enum CurveType { ED25519 = 0, SECP256K1 = 1, } impl TryFro...
use winapi::um::winuser::{WS_CHILD, WS_VISIBLE, WS_CLIPCHILDREN, WS_CLIPSIBLINGS}; use crate::win32::base_helper::check_hwnd; use crate::win32::window_helper as wh; use crate::NwgError; use super::{ControlBase, ControlHandle}; use plotters::prelude::DrawingArea; use plotters::coord::Shift; pub use crate::win32::plotte...
//! ra_db defines basic database traits. The concrete DB is defined by ra_ide. mod cancellation; mod input; pub mod fixture; use std::{panic, sync::Arc}; use ra_prof::profile; use ra_syntax::{ast, Parse, SourceFile, TextRange, TextUnit}; pub use crate::{ cancellation::Canceled, input::{ CrateGraph, C...
use crate::utils::{match_qpath, paths, snippet, span_lint_and_then}; use rustc_ast::ast::LitKind; use rustc_errors::Applicability; use rustc_hir::{Arm, Expr, ExprKind, MatchSource, PatKind, QPath}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_li...
use std::{ops::Mul, fmt, str::FromStr}; use curve25519_dalek::{edwards::EdwardsPoint, scalar::Scalar}; use serde::{Serialize, Deserialize}; use rac::{Array, Concat, Curve, LineValid, Line, generic_array::typenum}; use self::lattice::{Sk, Pk, PkHash}; pub use self::lattice::{Ct, SharedSecret, Encapsulated}; pub struct ...
use std::path::PathBuf; use rusty_engine::prelude::*; struct GameState { circle_radius: f32, } impl Default for GameState { fn default() -> Self { Self { circle_radius: 16.0, } } } rusty_engine::init!(GameState); fn main() { // We need an image file to work with, so the ...
//! Component for starting up nrf52 platforms. //! Contains 3 components, NrfStartupComponent, NrfClockComponent, //! and UartChannelComponent, as well as two helper structs for //! intializing Uart on Nordic boards. use capsules::virtual_alarm::MuxAlarm; use components; use kernel::component::Component; use nrf52::gp...
// Copyright 2018 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 agree...
/***************************************************************************************************************** This source file implements Sonic Constraint System unit test suite driver. The following tests are implemented: 1. Checking Point conversion formula between Edwards and Montgomery coordinates. This t...
use bevy::prelude::*; use bevy_ui_navigation::systems::{ default_gamepad_input, default_keyboard_input, default_mouse_input, InputMapping, }; use bevy_ui_navigation::{Focusable, NavEvent, NavMenu, NavRequest, NavigationPlugin}; /// This example demonstrates a more complex menu system where you navigate /// throug...
/** * [0641] Design Circular Deque * * Design your implementation of the circular double-ended queue (deque). * Implement the MyCircularDeque class: * * MyCircularDeque(int k) Initializes the deque with a maximum size of k. * boolean insertFront() Adds an item at the front of Deque. Returns true if the operati...
use kitsune_p2p_types::config::KitsuneP2pTuningParams; use kitsune_p2p_types::tx2::tx2_utils::*; use kitsune_p2p_types::*; use url2::Url2; /// TODO - FIXME - holochain bootstrap should not be encoded in kitsune /// The default production bootstrap service url. pub const BOOTSTRAP_SERVICE_DEFAULT: &str = "https://boots...
/* * Copyright 2018 Fluence Labs Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
use num::{ Complex, Num, Float}; use std::ops::{ Div, Mul }; pub mod leaf; pub mod node; pub mod tree; /*************************************************** Structures ****************************************/ #[derive(Debug, PartialEq, Clone)] pub struct PointWise<F> { pub seq: Vec<Complex<F>> } /*******************...
use std::{ marker::Unpin, str::FromStr, time::Duration, }; use futures::{ future::{ BoxFuture, Either, }, select, FutureExt, StreamExt, }; use tokio::{ signal::ctrl_c, runtime::Runtime, sync::oneshot, }; use bytes::{ Bytes, }; use crate::{ diagnost...
//! Demonstration of MNIST digits classification with convolutional net. //! //! With accelerate, got 0.987 test accuracy in 70 sec on Apple M1 (8core CPU, 16GB RAM). //! //! First, run "./download_mnist.sh" beforehand if you don't have dataset and then run //! "cargo run --example cnn_mnist --release --features blas,<...
//! Unsigned integers use num_traits::{Num, Zero, One}; use crate::string::{ParseIntError}; use crate::memory::{WordArray, Word, IAllocError}; use std::ops::Add; /// An unsigned integer /// /// Memory is managed via the /// specified [ArrayType] pub struct UnsignedInteger<A: WordArray = Vec<Word>> { /// The inte...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use libra_metrics::OpMetrics; use libra_types::{ transaction::TransactionStatus, vm_error::{StatusCode, StatusType, VMStatus}, }; use once_cell::sync::Lazy; use prometheus::{IntCounter, IntGauge}; use std::{convert::TryFrom, ti...
use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; use near_sdk::json_types::U128; use near_sdk::serde_json::{self, json}; use near_sdk::{env, near_bindgen, PromiseResult}; near_sdk::setup_alloc!(); // Prepaid gas for making a single simple call. const SINGLE_CALL_GAS: u64 = 200000000000000; #[near_bindg...
// implementation of the simple publicly verifiable secret sharing scheme // http://www.win.tue.nl/~berry/papers/crypto99.pdf use super::dleq; use super::math; use super::types::*; use super::crypto::*; use std::borrow::Borrow; pub type Secret = Point; pub struct Escrow { pub extra_generator: Point, pub po...
use crate::display::Display; use crate::keypad::Keypad; pub struct Cpu { // Program counter pub pc: u16, // Registers pub v: [u8; 16], // Index register pub i: u16, // Stack pub stack: [u16; 16], // Stack pointer pub sp: u8, // Delay timer pub dt: u8, // Memory p...
use std::collections::HashMap; use std::rc::Rc; use regex_syntax; use regex_syntax::hir::GroupKind as LibGroup; use regex_syntax::hir::HirKind as LibHir; use regex_syntax::hir::RepetitionKind as LibRepKind; use regex_syntax::hir::RepetitionRange as LibRepRange; use super::super::automaton::atom::Atom; use super::supe...
//! Provides implementations of the `oxigraph::Repository` trait. mod memory; pub(crate) mod numeric_encoder; #[cfg(feature = "rocksdb")] mod rocksdb; pub use crate::sparql::GraphPattern; pub use crate::store::memory::MemoryRepository; #[cfg(feature = "rocksdb")] pub use crate::store::rocksdb::RocksDbRepository; use...
use name::*; use grammar::{FormPat, SynEnv}; use grammar::FormPat::*; use ast::Ast; use ast::Ast::*; use util::mbe::EnvMBE; fn node_names_mentioned(pat: &FormPat) -> Vec<Name> { match *pat { Named(n, ref body) => { let mut res = node_names_mentioned(&*body); res.push(n); ...
//! Types for the Parity Ad-Hoc Trace API //! //! <https://openethereum.github.io/wiki/JSONRPC-trace-module> use crate::types::{Bytes, H160, H256, U256}; use serde::{Deserialize, Serialize}; use std::collections::BTreeMap; mod filter; pub use filter::*; #[derive(Debug, Clone, Serialize)] /// Description of the type o...
use crate::bounds::{Lit, Relation}; use std::borrow::Borrow; /// A set of literals representing a disjunction. /// A `Disjunction` maintains the invariant that there are not duplicated literals (a literal that entails another one). /// Implementation maintains the literals sorted. #[derive(Debug, PartialEq, Clone, Eq,...
//! Extrablatt: Customizable article scraping & curation. //! //! A library to gather and scrape news articles. This functionality is also //! provided as a [CLI utility](//github.com/mattsse/extrablatt). Extrablatt //! supports targeted article scraping and non-targeted gathering of articles //! either limited by cate...
#![allow(clippy::eq_op, clippy::from_over_into, clippy::identity_op)] #![no_std] use core::{ cmp::Ordering, ops::{Div, Rem}, }; use primitive_types::U256; #[derive(Copy, Clone, Eq, PartialEq, Debug)] pub enum Sign { Plus, Minus, NoSign, } const SIGN_BIT_MASK: U256 = U256([ 0xffffffffffffffff, ...
use crate::utils; use anyhow::Error; use std::collections::{hash_map, HashMap, HashSet}; use std::fmt; use std::sync::Arc; /// Trait over something that has a matchable pattern. pub trait Matchable { /// Get the key for the matchable element. fn key(&self) -> &Key; /// Get the pattern for the matchable el...
use std::{ fmt, ops::{Add, Mul, Sub, AddAssign}, }; use super::DefaultCd; // #[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] // pub struct Scalar<T>(pub T); #[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct Point<T = DefaultCd> { pub x: T, pub y: T, } impl<T: Mul<Ou...
use cgmath::prelude::*; use cgmath::{Vector2, Vector3}; use dx::gles::{core30::gl, enums::*}; use std::mem::size_of; use super::shader::Shader; // NOTE: without repr(C) the compiler may reorder the fields or use different padding/alignment than C. // Depending on how you pass the data to OpenGL, this may be bad. In t...
use crate::util::{self, BResult, Boom}; use gif::{Encoder, Frame}; use std::str::FromStr; #[derive(Clone, Debug)] enum Coordinate { X, Y, } impl FromStr for Coordinate { type Err = Boom; fn from_str(s: &str) -> Result<Coordinate, Boom> { match s { "x" | "X" => Ok(Coordinate::X), ...
//! This crate provides types and methods for parsing/ creating [FCP](https://github.com/insomnimus/fcp) requests. //! //! # Examples //! //! ``` //! use fancp::{Request, AdjRequest, GetRequest, SetRequest}; //! //! // Imagine we have an incoming fcp request //! // over some connection. We can parse the request like th...