text
stringlengths
3.09k
13.9k
//! Basic variant of dijkstras algorithm use super::*; use crate::algo::dijkstra::gen_topo_dijkstra::Neutral; use crate::datastr::{index_heap::*, timestamped_vector::*}; pub trait DijkstraOps<Graph> { type Label: super::Label + Clone; type Arc: Arc; type LinkResult; fn link(&mut self, graph: &Graph, ...
use crate::{ core::*, domains::Transition, fa::{Approximator, Parameterised, QFunction}, geometry::{MatrixView, MatrixViewMut}, policies::{ sample_probs_with_rng, DifferentiablePolicy, ParameterisedPolicy, FinitePolicy, Policy }, utils::argmax_choose, ...
#[macro_use] extern crate log; #[macro_use] extern crate lazy_static; #[macro_use] extern crate failure; #[macro_use] extern crate serde_derive; pub mod database; pub mod logging; pub mod network_endpoints; pub mod rita_loop; pub mod traffic_watcher; pub use crate::database::database_tools::*; pub use crate::datab...
use std::fmt::Display; use itertools::Itertools; use strum::IntoEnumIterator; const ROWS: usize = 97; const COLS: usize = 98; #[derive(Clone,Copy,PartialEq,Eq)] enum States { Floor, Empty, Occupied, } impl Display for States { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { ...
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. //! # Disassemble /...
//! Syntax highlighting injections such as highlighting of documentation tests. use std::{collections::BTreeMap, convert::TryFrom}; use ast::{HasQuotes, HasStringValue}; use hir::Semantics; use ra_syntax::{ast, AstToken, SyntaxNode, SyntaxToken, TextRange, TextSize}; use stdx::SepBy; use crate::{ call_info::Acti...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ counters, logging::{self, LogEntry, LogEvent, LogField}, Error, }; use consensus_types::{common::Author, safety_data::SafetyData}; use libra_crypto::ed25519::{Ed25519PrivateKey, Ed25519PublicKey}; use libra_glo...
//! Stream protocol implementation use std::{ io::{self, ErrorKind}, marker::Unpin, pin::Pin, slice, task::{self, Poll}, }; use byte_string::ByteStr; use bytes::{BufMut, Bytes, BytesMut}; use futures::ready; use log::{trace, warn}; use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; use crate::{ ...
/// EVM instruction opcodes pub type Opcode = u8; pub const STOP: Opcode = 0x00; pub const ADD: Opcode = 0x01; pub const MUL: Opcode = 0x02; pub const SUB: Opcode = 0x03; pub const DIV: Opcode = 0x04; pub const SDIV: Opcode = 0x05; pub const MOD: Opcode = 0x06; pub const SMOD: Opcode = 0x07; pub const ADDMOD: Opcode =...
use crate::frame::Content; use crate::frame::Frame; use crate::stream::unsynch; use crate::tag::Version; use flate2::read::ZlibDecoder; use std::io; use std::str; pub mod content; pub mod v2; pub mod v3; pub mod v4; pub fn decode(reader: impl io::Read, version: Version) -> crate::Result<Option<(usize, Frame)>> { ...
//! The middleware parses the function binary bytecodes and transform them //! with the chosen functions. use loupe::MemoryUsage; use smallvec::SmallVec; use std::collections::VecDeque; use std::fmt::Debug; use std::ops::Deref; use wasmer_types::LocalFunctionIndex; use wasmer_vm::ModuleInfo; use wasmparser::{BinaryRea...
use bitflags::bitflags; use cortex_a::registers::*; use tock_registers::interfaces::ReadWriteable; use crate::{ addr::PAddr, arch::Armv8, arch::{ addr::{pa2pte, pte2pa, PLNUM}, asm::{isb, tlbi_vmalle1}, interface::{IPageTableEntry, MemLayout, PageTableManager}, memlayout::GI...
use std::collections::BTreeMap; use qstring::QString; use serde::Serialize; use crate::data::*; use crate::server::web::handlers; use crate::server::{MockServerState, ServerRequestHeader, ServerResponse}; /// This route is responsible for adding a new mock pub(crate) fn ping() -> Result<ServerResponse, String> { ...
// // (c) 2020 <NAME> <<EMAIL>> // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. // use chrono::Local; use plotlib::page::Page; use plotlib::repr::BarChart; use plotlib::style::BoxStyle; use plotlib::view::CategoricalView; use std::collect...
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
use tokio::prelude::*; use tokio::timer::Interval; use std::sync::Arc; use std::time::{Duration, Instant}; use ofp_device::{ DeviceId, DeviceEvent }; use ofp_controller::{DeviceControllerApp, DeviceController }; use message::Message; use message::{ StatsReq, StatsReqType, StatsReqBody, PortStats, FlowStats, ...
use crypto; use crypto::mac::Mac; use crypto::digest::Digest; use dns_sd::DNSService; use hyper; use hyper::net::NetworkListener; use num::BigUint; use url; use rand; use rustc_serialize::base64::{self, ToBase64, FromBase64}; use std::collections::BTreeMap; use std::io::{Read, Write}; use std::sync::{mpsc, Mutex}; use...
use crate::{ gpio::{Floating, Input}, target::SAADC, }; use core::{ hint::unreachable_unchecked, sync::atomic::{compiler_fence, Ordering::SeqCst}, }; use embedded_hal::adc::{Channel, OneShot}; pub use crate::target::saadc::{ ch::config::{GAINW as Gain, REFSELW as Reference, RESPW as Resistor, TACQW...
use std::{collections::HashMap, convert::Infallible, str::FromStr}; use aoc::{lines, PuzzleInput}; type Input = Bingo; type Output = u32; register!( "input/day4.txt"; (input: input!(verbatim Input)) -> Output { part1(&input.draws, &mut input.boards); part2(&input.draws, &mut input.boards); ...
use std::fs::File; use std::io::{self, Read, Write}; use std::os::unix::io::{AsRawFd, FromRawFd, RawFd}; use std::pin::Pin; use std::task::Poll; use std::{fmt, mem, slice}; use futures::task::Context; use futures::{self, ready, Sink, Stream}; use libc::eventfd; use thiserror::Error; use tokio::io::unix::AsyncFd; #[de...
use std::time::{Instant, Duration}; use rand::{thread_rng, RngCore, Rng}; use std::fs::OpenOptions; use std::io::prelude::*; use rand::distributions::Alphanumeric; use eytzinger_sort::traversal_sort::eytzinger_traversal_sort; use eytzinger_sort::find::first_index_for_eytzinger; use eytzinger_sort::march_sort::eytzinger...
use bevy::{ prelude::{App as BevyApp, AssetServer, Commands, Res, ResMut}, window::WindowDescriptor, DefaultPlugins, }; use kayak_ui::{ bevy::{BevyContext, BevyKayakUIPlugin, FontMapping, UICameraBundle}, core::{ render, rsx, styles::{Style, StyleProp, Units}, use_state, wid...
// Copyright 2020 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT // http://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 di...
// TODO write a better description here //! Template stuff //! #![deny( missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts, trivial_numeric_casts, dead_code, unsafe_code, unstable_features, unused_import_braces, unused_qualifications )] #[do...
#![doc = include_str!("../README.md")] pub(crate) mod argument; pub(crate) mod description; pub(crate) mod directive; pub(crate) mod document; pub(crate) mod enum_; pub(crate) mod field; pub(crate) mod fragment; pub(crate) mod input_object; pub(crate) mod input_value; pub(crate) mod interface; pub(crate) mod name; pub...
use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] pub struct RegistrationInstructionsResponse { /// MsgType = p #[serde(flatten)] pub standard_message_header: super::super::standard_message_header::StandardMessageHeader<'p', ' '>, /// Unique identifier of the...
// Copyright 2020 Shift Crypto 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 agreed t...
//! [`AttValue`] inside apostrophies (`'`). //! //! About `AttValue`, see [Extensible Markup Language (XML) 1.0 (Fifth Edition)][`AttValue`]. //! //! [`AttValue`]: http://www.w3.org/TR/REC-xml/#NT-AttValue use std::convert::TryFrom; use crate::{ attribute::{ value::content::{parse_raw as parse_content, Pa...
use serde::Deserialize; use serde::Serialize; use std::collections::BTreeSet; use std::fs::File; use std::path::PathBuf; use miette::Diagnostic; use thiserror::Error; const ANGULAR_TYPES: [&str; 10] = [ "feat", "fix", "docs", "style", "refactor", "perf", "test", "chore", "build", "ci", ]; #[non_exhaustive] #[der...
use crate::{Job, UnitOfWork, WorkerRef}; use async_trait::async_trait; use bb8_redis::{bb8::Pool, RedisConnectionManager}; use slog::error; use std::sync::Arc; use tokio::sync::RwLock; pub type ServerResult = Result<(), Box<dyn std::error::Error>>; #[async_trait] pub trait ServerMiddleware { async fn call( ...
use cannyls::deadline::Deadline; use cannyls::lump::LumpData; use fibers::sync::mpsc; use futures::future::{Done, Either}; use futures::{self, Async, Future, Poll}; use raftlog::log::{LogEntry, LogIndex, LogSuffix}; use raftlog::Error; use std::mem; use std::time::Instant; use super::{into_box_future, BoxFuture, Event...
use std::time::{Duration, SystemTime}; use cpu_time::ProcessTime; use env_logger::{Builder}; // search in paralle mode 8 core i7-10875H @2.3Ghz time 100 neighbours // max_nb_conn ef_cons ef_search scale_factor extend keep pruned recall req/s last ratio // // 64 800 64 ...
pub mod compress; #[path = "./protos/message.rs"] pub mod message_proto; #[path = "./protos/rendezvous.rs"] pub mod rendezvous_proto; pub use bytes; pub use futures; pub use protobuf; use std::{ fs::File, io::{self, BufRead}, net::{Ipv4Addr, SocketAddr, SocketAddrV4}, path::Path, time::{self, System...
// Copyright 2020-2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 use std::sync::Arc; use hashbrown::hash_map::Entry; use hashbrown::HashMap; use tokio::sync::RwLock; use identity_did::did::DID; use identity_iota::did::IotaDID; use crate::error::Error; use crate::error::Result; use crate::identity::Identi...
use std::process::{Command, Stdio}; use std::str::FromStr; use crate::bitbucket::{get_bitbucket_remote, get_current_repo_id, Client, PullRequest, RepoId}; use crate::common_git::{ fetch_remote, find_remote_branch, get_current_branch, switch_to_existing_branch, switch_to_local_branch, AuthDomainConfig, BaseUrlC...
use std::error::Error; use std::fmt::{self, Debug, Display, Formatter}; use atoi::atoi; use smallvec::alloc::borrow::Cow; use crate::error::DatabaseError; use crate::postgres::message::{Notice, PgSeverity}; /// An error returned from the PostgreSQL database. pub struct PgDatabaseError(pub(crate) Notice); // Error m...
/* tag::catalog[] Goal:: Ensure that an upgrade with a wrong hash can be fixed by downloading the correct update file Runbook:: . Setup an IC with 4-node NNS. . Initiate upgrade on the replicas with a wrong hash. . Prove subnet is stuck - "wrong SHA" log message and inability to create a canister. . On 3/4 of nodes d...
#[doc = "Reader of register IIR"] pub type R = crate::R<u32, super::IIR>; #[doc = "Interrupt status. Note that U4IIR\\[0\\] is active low. The pending interrupt can be determined by evaluating U4IIR\\[3:1\\].\n\nValue on reset: 1"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum INTSTATUS_A { #[doc = "0: At least...
///! Stabilizer network management module ///! ///! # Design ///! The stabilizer network architecture supports numerous layers to permit transmission of ///! telemetry (via MQTT), configuration of run-time settings (via MQTT + Miniconf), and live data ///! streaming over raw UDP/TCP sockets. This module encompasses the...
use std::fs::File; use std::path::{Path, PathBuf}; use crate::prelude::*; use rustc_codegen_ssa::{METADATA_FILENAME, RLIB_BYTECODE_EXTENSION}; use rustc_codegen_ssa::back::archive::{ArchiveBuilder, find_library}; struct ArchiveConfig<'a> { sess: &'a Session, dst: PathBuf, src: Option<PathBuf>, lib_se...
use orz::bits::*; use std; pub struct HuffmanEncoder { symbol_bits_len_vec: Vec<u8>, encoding_vec: Vec<u16>, } pub struct HuffmanDecoder { symbol_bits_len_vec: Vec<u8>, symbol_bits_len_max: u8, decoding_vec: Vec<u16>, } impl HuffmanEncoder { pub fn from_symbol_weight_vec( symbol_weigh...
// Copyright (c) 2019-2020 <NAME>. All rights reserved. // Licensed under the Apache License, Version 2.0 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. // All files in the project carrying such notice may not ...
// 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. //! Helpers for capturing logs from Fuchsia processes. use { fdio::fdio_sys, fuchsia_async as fasync, fuchsia_zircon as zx, futures::{ ...
use interpolate::{Interpolator, sawtooth}; use noise::Noise; use std::num::{NumCast, Float}; static X_PRIME: i32 = 1073741827; static Y_PRIME: i32 = 53688275; fn float_to_i32<F: Float>(f: F) -> i32 { NumCast::from(f).expect("got position that is not convertible to i32") } /// Takes discrete input noise to produc...
//! Discover pathfinder releases via github API. /// Monitors Github for new releases and logs when this occurs. /// /// Will continuously log this with every poll so that the user /// has a better chance of spotting it. pub async fn poll_github_for_releases() -> anyhow::Result<()> { use anyhow::Context; let c...
use dice::Roll; use self::{ deadly::DeadlyRule, finesse::FinessRule, passthrough::Passthrough, propulsive::PropulsiveRule, str_mod_damage::StrengthModDamageRule, striking::StrikingRule, }; use crate::character::Character; use crate::world::World; use std::collections::HashMap; mod deadly; mod finesse; mod pas...
use std::sync::{Arc, Mutex}; use anyhow::Error; use byte_slice_cast::*; use glib::source::SourceId; use gst::prelude::*; use gst_app::AppSrc; use gst_audio::AudioInfo; #[path = "../tutorials-common.rs"] mod tutorials_common; const CHUNK_SIZE: usize = 1024; // Amount of bytes we are sending in each buffer const SAMP...
extern crate digest; extern crate indy_crypto; extern crate sha2; extern crate rust_base58; extern crate thread_scoped; extern crate time; use errors::prelude::*; use services::blob_storage::BlobStorageService; use domain::anoncreds::revocation_registry_definition::RevocationRegistryDefinitionV1; use self::indy_crypt...
use std::sync::mpsc; use std::sync::mpsc::{Receiver, Sender, TryRecvError}; use std::sync::Arc; use std::thread::JoinHandle; use std::time::{Duration, Instant}; use std::collections::HashMap; use lightoros_plugin_base::*; use data_types::*; use input_pipe::*; use output_pipe::*; #[macro_use] mod data_types; mod inpu...
use super::{ line_parser::{parse_line, ParsedLine, ParsedLineInstruction}, resolver::resolve, }; use crate::{context::Program, instruction::Instruction}; use std::collections::{hash_map::Entry, HashMap}; pub(super) fn is_valid_label(s: &str) -> bool { fn is_valid_first_char(c: u8) -> bool { match c...
// Copyright 2022 Webb Technologies Inc. // // 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...
// Copyright Materialize, Inc. and contributors. All rights reserved. // // 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 in the LICENSE file at the // root of this repository, or online at // /...
#![feature(asm, naked_functions)] //! Switcheroo provides lightweight context switches in Rust. //! //! It consists of two parts: //! 1. A stack implementation (currently only providing a [fixed 8Mb stack](stack/struct.EightMbStack.html)). //! 2. A [generator](struct.Generator.html) implementation. //! ## Example //! ...
//! Project Euler solutions for problems 1 through 10. //! //! This crate is designed to be used via crate `euler`. use std::ops::Add; use std::f64::EPSILON; extern crate primal; extern crate itertools; use itertools::Itertools; extern crate euler_library; use euler_library::common as eu; /// Multiples of 3 and 5 ...
use byteorder::{ByteOrder, NetworkEndian}; use super::{InformationElementTraits, InformationElementType, LENGTH}; pub struct InformationElement { /* Bits |---------------------------------------------------------------| Octets | 8 | 7 ...
//! Core traits and structs for Transparent Zcash Extensions. use crate::transaction::components::{Amount, TzeOut, TzeOutPoint}; use std::fmt; /// Binary parsing capability for TZE preconditions & witnesses. /// /// Serialization formats interpreted by implementations of this trait become consensus-critical /// upon ...
use super::win::{calc_possibole_pairs, is_kokushimusou_win}; use crate::model::*; use crate::util::common::cartesian_product; use SetPairType::*; #[derive(Debug, Clone, Copy)] pub enum SetPairType { Pair, // 雀頭 Shuntsu, // 順子 Koutsu, // 刻子 Chi, // チー Pon, // ポン Minkan, // 明槓 (大明槓 ...
use mimasim::types::*; use mimasim::microcycle::Descriptor as MicrocycleDescriptor; use mimasim::unit::*; use mimasim::mima::Mima; // Information about register / flag values and changes are stored in enums to record changes: #[derive(Copy, Clone)] pub enum Value<T> { Stasis(T), Change(T, T), } impl<T> Value<T> { ...
use image::{imageops, GenericImage, ImageBuffer, Rgba, RgbaImage}; use crate::raster_renderer::tile_set::TileSet; use crate::TilePlacement::{Normal, Rotated, RotatedAndShifted}; use crate::{Hand, HandGroup, HandTile}; #[derive(Copy, Clone, Default, Debug)] pub struct TileWidthRatio(pub f32); #[derive(Copy, Clone, De...
use { crate::blockstore::Blockstore, crossbeam_channel::bounded, log::*, solana_measure::measure::Measure, solana_sdk::clock::Slot, std::{ cmp::min, collections::HashSet, result::Result, sync::{ atomic::{AtomicBool, Ordering}, Arc, ...
use sdl2::audio::{ AudioCallback, AudioSpecDesired }; struct SineWave { tone_frequency: f32, sample_rate: u16, amplitude: u16, } impl SineWave { fn samples(&self) -> Vec<i16> { let increment = self.tone_frequency / self.sample_rate as f32; // Num the samples needed to g...
use std::cmp; use ndarray::ArrayViewMut1; use crate::{executor::MpcExecution, MpcEngine}; use super::{join_circuits_all, BitShare, IntShare, WrappedShare}; /// Pair of indices in array and hidden result of their comparison, generated by a sorting algorithm. pub struct MaybeSwap<T> { first_index: usize, seco...
use crate::lang::reification::ExprInterface; use crate::lang::*; use aries_core::*; use std::cmp::Ordering; /// Normal form of an expression with component of type `X`. /// It can be either: a literal, an expression of type `X` /// or the negation of an expression of type `X`. pub enum NormalExpr<X> { Literal(Lit)...
//! `iced` compatible version of the picklist theme. use crate::{ Theme as Collection, color::Color, border::Theme as Border, }; use iced::{ pick_list::{ Menu, Style, StyleSheet, }, }; use super::{ MenuComponent, MenuSerial, StateComponent, Serial, StateSerial }; #[derive(Clone, Copy...
sat_micro::front::prelude!(); use std::time::Instant; use sat_micro::{dpll, front}; sat_micro::front::prelude!(); use crate::conf::*; pub mod conf; fn main() { let conf = Conf::new(); // Handles verbosity CLAP and logger setup. Keep this as the first CLAP step so that we can use // logging ASAP. s...
//! File system implementation. Five layers: //! + Blocks: allocator for raw disk blocks. //! + Log: crash recovery for multi-step updates. //! + Files: inode allocator, reading, writing, metadata. //! + Directories: inode with special contents (list of other inodes!) //! + Names: paths like /usr/rtm/xv6/fs....
use std::collections::BTreeMap; use log::error; use serde::{Deserialize, Serialize}; use super::{ Callback, Error, ExternalDoc, ObjectOrReference, Parameter, RequestBody, Response, Server, Spec, }; /// Describes a single API operation on a path. /// /// See <https://github.com/OAI/OpenAPI-Specification/blob/HEAD...
use{ crate::{wang_landau::*, Histogram}, std::io::Write }; /// # Traits for quantities that all Wang Landau simulations have /// * see also: `WangLandauHist` /// * this trait is for convinience, so that you do not have /// to write all the trait bounds of, e.g., `WangLandauHist`, if you are /// not using func...
#![allow(clippy::let_and_return)] use core::marker::PhantomData; /// Transducer trait /// /// When applied transducer consumes some input value and produce corresponding output result. /// /// Each filter and regulator should implement this trait. pub trait Transducer { /// Input values type type Input; /...
use std::collections::HashSet; use proc_macro2::{Ident, Span}; use syn::{ parse::{Parse, ParseStream}, Error, Expr, ExprClosure, Token, }; /// Represents the entire parsed input to the macro pub struct Input { pub assigned: Vec<AssignedDirective>, pub all: Vec<AllDirective>, pub closure: ExprClosu...
use crate::abi::*; use crate::xaml_user_type::XamlUserType; use bindings::windows::ui::xaml::interop::TypeName; use bindings::windows::ui::xaml::markup::{IXamlMetadataProvider, IXamlType, XmlnsDefinition}; use std::ptr::NonNull; use winrt::*; #[repr(transparent)] pub struct XamlMetadataProvider { ptr: ComPtr<XamlM...
use crate::solution_template::Solution; use std::collections::HashMap; pub struct TicketSolution { fields: Vec<TicketRule>, ticket: Vec<i64>, others: HashMap<Vec<i64>, Vec<i64>>, } /// You're on your way to yet another flight, but your ticket is in a /// language you can't read. You somehow get access to ...
use std::time::Duration; #[derive(PartialEq, Clone, Copy)] /// Pid controller implementation /// Implementation in a recursive form /// u(k+1) = u(k) + (e(k) - e(k-1)) * Kp + e(k) * Ki * dt + (e(k) - 2 * e(k-1) + e(k-2)) * Kd / dt /// For variable dt add dt duration as argument, if fixed dt or scheduled synchronously ...
/** * Copyright (c) Visly Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ use json::JsonValue; use std::any::Any; use std::f32; use std::ffi::{CStr, CString}; use std::os::raw::{c_char, c_void}; use stretch::geometry::Rect; use s...
use crate::format::{self, Format}; use proc_macro2::{Span, TokenStream}; use syn; #[derive(Debug)] pub enum Protocol { DiscriminantFormat(format::Enum), Discriminator(syn::Lit), LengthPrefix { kind: LengthPrefixKind, prefix_field_name: syn::Ident, prefix_subfield_names: Vec<syn::Id...
use std::collections::HashSet; use aoc2018::{load, Result}; const BEFORE_PREFIX: usize = "Before: [".len(); const AFTER_PREFIX: usize = "After: [".len(); const OPS: [OP; 16] = [ addr, addi, mulr, muli, banr, bani, borr, bori, seti, setr, gtir, gtri, gtrr, eqir, eqri, eqrr, ]; type OP = fn(&[usize], &mut [usize...
use std::fs; use std::io::Result; use std::path::{Path, PathBuf}; use std::sync::mpsc::channel; use ansi_term::Colour::Yellow; use indexmap::IndexMap; use rayon::prelude::*; use crate::core::concat::ConcatHandler; use crate::helper::sequence::Sequence; use crate::helper::stats; use crate::helper::types::{DataType, He...
// 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 writi...
use std::cmp; use std::mem; /// Merge k min-sorted iterators I over values T into a single min-sorted iterator over T /// /// This is equivalent to pushing the least element of each iterator into a priority queue and then /// popping elements. But instead of using a BinaryHeap as the backing data store, we implement a...
#[doc = "Reader of register RSTCTL_SOFTRESET_STAT"] pub type R = crate::R<u32, super::RSTCTL_SOFTRESET_STAT>; #[doc = "Reader of field `SRC0`"] pub type SRC0_R = crate::R<bool, bool>; #[doc = "Reader of field `SRC1`"] pub type SRC1_R = crate::R<bool, bool>; #[doc = "Reader of field `SRC2`"] pub type SRC2_R = crate::R<b...
use crate::{Decorator, Result}; use i73_base::matcher::BlockMatcher; use i73_base::math; use i73_base::block::Block; use i73_trig as trig; use java_rand::Random; use vocs::position::{Offset, QuadPosition}; use vocs::view::QuadMut; // TODO: Is this really 3.141593? /// For when you don't have the time to type out all t...
use std::collections::{BTreeSet, HashMap}; #[derive(Debug, PartialEq)] struct Line { signal: Vec<BTreeSet<char>>, output: Vec<BTreeSet<char>>, } impl From<String> for Line { fn from(input: String) -> Line { let (signal, output) = input.split_once(" | ").unwrap(); Line { signal...
#![allow(non_upper_case_globals)] #![allow(non_snake_case)] use crate::tables::LogonSessions; use winapi::{ um::{ ntlsa::*, winnt::{LUID, PWSTR, LPWSTR, PSID, LARGE_INTEGER} }, shared::{minwindef::DWORD,ntstatus::*, sddl::ConvertSidToStringSidW} }; use winapi::um::err...
#[doc = r" Value read from the register"] pub struct R { bits: u32, } #[doc = r" Value to write to the register"] pub struct W { bits: u32, } impl super::FCFG1 { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w mut...
//! The `kalman_filters` module estimates a pose of a simulated robot in its state-space model by using Kalman Filter use std::time::Instant; extern crate nalgebra as na; use crate::agent::Agent; use crate::data::{Pose, Observed}; use crate::planners::dwa_wo_obstacle; use crate::models::{robot, camera}; /// **\[pri...
//! <NAME> (@Tsadow) //! 2018 //! //! Random terrain height map generation extern crate rand; extern crate colored; use rand::Rng; use std::cmp::min; use std::cmp::max; use colored::*; struct Point { x: i32, y: i32, z: i32, } impl Point { fn new(x_in: i32, y_in: i32, z_in: i32) -> Point { P...
use crate::error::Error; use crate::events::Event; use crate::trace_structs::{bpftrace_cmd, TraceStack}; use std::io::{BufRead, Read}; use std::process::Stdio; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{mpsc, Arc}; use std::thread; /// Encapsulates a scheme for tracing a particular program and its ...
//! Utility types/fn for alpm_event_t use alpm_sys::*; use package::{Package, PackageOperation}; /// An event emitted from libalpm pub enum Event<'a> { /// Dependencies will be computed for a package. CheckDepsStart, /// Dependencies were computed for a package. CheckDepsDone, /// File conflicts ...
use std::cmp; use std::sync::Arc; use protobuf::Message; use crate::config::Config; use crate::engine::{fetch_entries, MemTableAccessor}; use crate::log_batch::{EntryExt, LogBatch, LogItemContent, OpType}; use crate::pipe_log::{GenericPipeLog, LogQueue}; use crate::util::HandyRwLock; use crate::Result; // If a regio...
use std::iter::once; use proc_macro::TokenStream; use proc_macro2::Span; use syn::{ Result, parse, Ident, Lit, LitInt, LitStr, ItemForeignMod, ForeignItem, ForeignItemFn, Signature, FnArg, Meta, NestedMeta, ReturnType, }; use quote::quote; use proc_macro_crate::cr...
use std::convert::TryFrom; use crate::parse::{Document, Block, List, ListToken, TokenEnumerator, TokenWrapper}; use numerals::roman::Roman; static ALPHABET_UPPER: [char; 26] = [ 'A', 'B', 'C', 'D', 'E', 'B', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X'...
use std::collections::{HashMap, HashSet}; use std::hash::Hash; type Row3d = (i8, i8, i8); type Row4d = (i8, i8, i8, i8); static NEIGHBOURS: [Row4d; 80] = [ (-1, -1, -1, -1), (-1, -1, -1, 0), (-1, -1, -1, 1), (-1, -1, 0, -1), (-1, -1, 0, 0), (-1, -1, 0, 1), (-1, -1, 1, -1), (-1, -1, 1, 0...
use async_std::{ fs::File, io::{ prelude::{ReadExt, WriteExt}, BufReader, }, path::Path, }; use serde::{Deserialize, Serialize}; use std::{fmt, io::Error as IoError}; use url::Url; /// The index config. this lives at the root of a valid index. #[derive(Debug, Serialize, Deserialize, Par...
//! Symbolic boolean expressions. use std::fmt::{self, Display, Formatter}; use z3::Context as Z3Context; use z3::ast::{Ast, Bool as Z3Bool}; use crate::helper::{check_compatible, boxed}; use super::{SymExpr, Symbol, Integer, DataType, Traversed}; use super::smt::{Z3Parser, FromAstError}; use SymCondition::*; use Sym...
pub type VOID = core::ffi::c_void; pub type CHAR16 = u16; #[repr(u8)] #[derive(Copy, Clone)] pub enum BOOL { FALSE = 0, TRUE = 1, } impl From<bool> for BOOL { fn from(val: bool) -> BOOL { if val { BOOL::TRUE } else { BOOL::FALSE } } } impl Into<bool> fo...
use hal::pac::TIMER2; use nrf52840_hal as hal; // Embedded_hal implementation for my chip use super::super::JamblerTimer; use core::sync::atomic::{compiler_fence, Ordering::SeqCst}; /// A struct for using a timer on the nrf for ble. /// Wraps around Timer 2 of the nrf52480, with a prescaler of 4 and 32-bit counter, /...
// Copyright 2018-2020, Wayfair GmbH // // 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...
use hyber::display::Display; use hyber::event::Event; use hyber::renderer::{AbsoluteWidgetCollection, Message, RenderInstructionCollection, Renderer}; use hyber::util::{Color, IDMachine, Vector2D}; use hyber::widget::grid_view::GridViewWidget; use hyber::widget::label::LabelWidget; use hyber::widget::progress_bar::Prog...
use crate::voxel::Voxel; use bevy::prelude::*; use bevy::render::{mesh::VertexAttribute, pipeline::PrimitiveTopology}; #[derive(Debug)] struct Size { x: usize, y: usize, z: usize, } impl Size { fn new(x: usize, y: usize, z: usize) -> Self { Self { x, y, z } } fn volume(&self) -> usize...
#![feature(uniform_paths)] #![feature(try_blocks, try_trait, type_ascription)] use failure::{Error, Fail}; use futures::{prelude::*, stream::Stream}; use hyper::rt; use k8s_openapi::v1_11::{ api::core::v1::*, apimachinery::pkg::{apis::meta::v1::*, runtime::*}, }; use log::{error, info}; use std::{option::NoneE...