text stringlengths 3.09k 13.9k |
|---|
//! Rocket's logging infrastructure.
use std::fmt;
use std::str::FromStr;
use log;
use yansi::Paint;
use serde::{de, Serialize, Serializer, Deserialize, Deserializer};
#[derive(Debug)]
struct RocketLogger(LogLevel);
/// Defines the maximum level of log messages to show.
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
... |
use clap::{App, AppSettings, Arg, Shell, SubCommand};
pub fn build_cli() -> App<'static, 'static> {
let database_arg = Arg::with_name("DATABASE_URL")
.long("database-url")
.help(
"Specifies the database URL to connect to. Falls back to \
the DATABASE_URL environment variabl... |
mod balance_monitor;
mod config;
use anyhow::Result;
use clap::Parser;
use prometheus::Encoder as _;
use std::{net::SocketAddr, path::PathBuf, time::Duration};
use web3::types::U256;
#[derive(Debug, Parser)]
struct Opt {
/// Path to the config file.
#[clap(long, parse(from_os_str))]
config: PathBuf,
... |
//! Completes constants and paths in unqualified patterns.
use hir::{db::DefDatabase, AssocItem, ScopeDef};
use rustc_hash::FxHashSet;
use syntax::ast::Pat;
use crate::{
context::{PathCompletionCtx, PathQualifierCtx, PatternRefutability},
CompletionContext, Completions,
};
/// Completes constants and paths i... |
use std::borrow::Cow;
use std::pin::Pin;
use std::task::{Context, Poll};
use bytes::Bytes;
use futures_util::{AsyncWriteExt, Stream};
use multer::{parse_boundary, Multipart};
use crate::service::login::creds::{CredentialsConfig, Signed};
use crate::service::Error;
use crate::state::AppState;
use futures_io::AsyncBufR... |
use hex_literal::hex;
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::{ChainType, Properties};
use serde::{Deserialize, Serialize};
use sp_core::crypto::Ss58Codec;
use sp_core::{sr25519, Pair, Public};
use sp_runtime::traits::{IdentifyAccount, Verify};
use virto_runtime::{AccountId, AuraId, Sig... |
use crate::{
backend::Token,
data::{SharedDataDispatcher, SharedDataOps},
examples::{data::ExampleData, note_local_certs},
};
use drogue_cloud_service_api::endpoints::Endpoints;
use patternfly_yew::*;
use yew::prelude::*;
use yew_router::{
agent::{RouteAgentDispatcher, RouteRequest},
route::Route,
}... |
use rand::{
distributions::{Distribution, Standard},
Rng,
};
use serde::{Deserialize, Serialize};
use sha1::{Digest, Sha1};
use std::{
convert::{TryFrom, TryInto},
fmt,
ops::BitXor,
};
use thiserror::Error;
/// Length of `Id` in bytes.
pub const ID_LEN: usize = 20;
/// 20-byte long identifier of n... |
extern crate advent_of_code_2019;
extern crate device_query;
extern crate image;
use advent_of_code_2019::{intcode, parser};
use device_query::{DeviceQuery, DeviceState, Keycode};
use std::cell::RefCell;
use std::collections::HashMap;
use std::env;
use std::error::Error;
use std::i64;
use std::io;
use std::io::Write;
... |
use crate::{CoapMessageExt, PacketUdp};
use super::{
packet::{ObserveOption, Packet},
MessageClass, RequestType, MessageType
};
/// The CoAP request.
#[derive(Clone, Debug)]
pub struct CoapRequest<T: Packet> {
message: T,
}
impl<'a, T:'a + Packet> CoapMessageExt<'a, T> for CoapRequest<T> {
fn get_mes... |
//! Provides the `NodeDistro` type, which represents a provisioned Node distribution.
use std::fs::{read_to_string, rename, File};
use std::io::Write;
use std::path::{Path, PathBuf};
use std::string::ToString;
use super::{Distro, Fetched};
use archive::{self, Archive};
use distro::error::DownloadError;
use distro::Di... |
use crate::character::Character;
use crate::orc::{create_orc, Orc};
use crate::player::{create_player, Player};
use crate::terrain::{create_terrain, TILE_SIZE};
use rand::prelude::ThreadRng;
use rand::Rng;
use std::f32::consts::PI;
use tuber::core::input::{Input, InputState};
use tuber::core::transform::Transform2D;
us... |
use std::collections::HashMap;
use std::env;
use std::path::PathBuf;
use std::sync::Arc;
use ignore::types::TypesBuilder;
use ignore::WalkBuilder;
use percent_encoding::{utf8_percent_encode, AsciiSet, CONTROLS};
use warp::Filter;
const ROOT_ISO_PATH: &str = "/mnt/storage/games/psp";
const FRAGMENT: &AsciiSet = &CONTR... |
use std::str::FromStr;
use std::collections::HashSet;
pub fn main(input: &str) -> Result<(usize, usize), String> {
let heights: Heightmap = input.parse()?;
let mut i = 0;
let mut extremums = Vec::new();
while i < heights.len() {
let p = Point(i);
if p.is_minimum(&heights) {
... |
/*
* Copyright (c) 2017-2020 Boucher, Antoni <<EMAIL>>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, mod... |
#[cfg(not(any(feature = "pio", feature = "native")))]
compile_error!("One of the features `pio` or `native` must be selected.");
use anyhow::*;
use regex::{self};
use std::{
env, error, fs,
iter::once,
path::{Path, PathBuf},
str::FromStr,
};
use embuild::{bindgen, build, cargo, kconfig, path_buf, util... |
use failure::Error;
use rocket::config::Value;
use rocket::Config;
use serde_derive::{Deserialize, Serialize};
use std::collections::HashMap;
use std::convert::Into;
use std::str::FromStr;
/// Map one or more settings value names to environment variables directly
///
/// # Examples
///
/// Using `map_to_env` in non-st... |
extern crate nalgebra as na;
use crate::na::Vector3;
use clap::{load_yaml, value_t, App};
use indicatif::{ProgressBar, ProgressStyle};
use log::{error, info, warn};
use pretty_env_logger;
use rand::prelude::*;
use rayon::iter::IntoParallelIterator;
use rayon::prelude::*;
use std::time::Instant;
use std::vec::Vec;
use ... |
///! This module takes given contents and spits out Tokens that are more easily digested
///! By programs.
use nom::bytes::complete::tag;
use nom::bytes::complete::take_till;
use nom::bytes::complete::take_until;
use nom::bytes::complete::take_while;
use nom::multi::many0;
use std::collections::HashMap;
#[cfg(test)]
... |
//! Provides the following functionality:
//! * Starts services on startup
//! * Service status annoncements
//! * Service running status queries
//! * Service registration/discovery
#![no_std]
#![feature(alloc_prelude)]
#![feature(drain_filter)]
#![deny(unused_must_use)]
#[macro_use]
extern crate alloc;
#[macro_use... |
use crate::{
defs::{self, BitSize},
fail::RtResult,
};
use core::ptr;
/// Generic bits copy algorithm which assumes non-byte-aligned `src` and `dst`.
/// The direction can be forward or backward.
/// Note: This is literal translation of OTP's erts_copy_bits in erl_bits.c
pub unsafe fn copy_bits(
mut src: *const ... |
//! Declare a general purpose "document ID type" for tracking which
//! documents we want and which we have.
use std::{borrow::Borrow, collections::HashMap};
use tor_dirclient::request;
use tor_netdoc::doc::{
authcert::AuthCertKeyIds, microdesc::MdDigest, netstatus::ConsensusFlavor, routerdesc::RdDigest,
};
/// ... |
use std::sync::{Arc, Mutex};
use anyhow::{format_err, Result};
use audiopus::coder::Encoder;
use futures::prelude::*;
use sdl2::audio::{AudioCallback, AudioDevice, AudioSpec, AudioSpecDesired, AudioStatus};
use sdl2::AudioSubsystem;
use slog::{debug, error, o, Logger};
use tokio::sync::mpsc;
use tokio::task::LocalSet;... |
use std::ops::{Mul, Sub};
use crate::prelude::*;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ProjectileKind {
Bullet,
Beam,
}
pub struct ProjectileParams {
pub kind: ProjectileKind,
pub effects: Vec<Effect>,
pub color: Color,
pub siz... |
// This file is part of Substrate.
// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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
//
// ht... |
#![no_std]
/// This module implements a limited version of the Segger
/// Real Time Transfer protocol between the debugger host
/// and the target program.
/// RTT works by scanning memory to look for a control block
/// containing a magic string (it is also possible to tell
/// the monitor exactly where to find this b... |
//! Adaptation/port of
//! [`SQLite` CSV parser](http://www.sqlite.org/src/artifact?ci=trunk&filename=src/shell.c).
//! See `csv_read_one_field` function in `SQLite3` shell sources.
use memchr::memchr2;
use std::ops::Range;
use std::result::Result;
mod error;
pub use csv::error::Error;
pub use scan::Splitter;
pub en... |
mod types;
pub use types::*;
use crate::evaluator_rules::RuleSet;
use crate::grammar::*;
use crate::utils::{hash, normalize};
use std::collections::HashSet;
use std::error::Error;
use std::rc::Rc;
/// Evaluates an expression to as simplified a form as possible.
/// The evaluation may be partial, as some values (like... |
//! Protocol decoder aiming at inspecting the app's interaction with the device
//! Frames are fed without the hid message id, but with the length prefix and crc value
//!
//! Once a frame is decoded, it's printed to the given writer
use std::fmt;
use bimap::BiMap;
use bytes::Bytes;
use termcolor::{Color, ColorSpec, ... |
use crate::{
configs::{
cluster::{Cluster as ClusterConfig, DistributionFunc},
node::Node as NodeConfig,
},
data::{BobKey, DiskPath, VDisk as DataVDisk, VDiskId},
node::{Id as NodeId, Node},
};
use futures::{stream::FuturesUnordered, StreamExt};
use std::{collections::HashMap, convert::T... |
use crate::non_fungible_token::approval::ext_nft_approval_receiver;
/// Common implementation of the [approval management standard](https://nomicon.io/Standards/NonFungibleToken/ApprovalManagement.html) for NFTs.
/// on the contract/account that has just been approved. This is not required to implement.
use crate::non_... |
pub fn main() {
let number = 13;
// TODO ^ Try different values for `number`
println!("Tell me about {}", number);
match number {
// Match a single value
1 => println!("One!"),
// Match several values
2 | 3 | 5 | 7 | 11 => println!("This is a prime"),
// Match an... |
use super::diagnostics;
use crate::{get_all_idl_nodes, message};
use anyhow::{anyhow, Result};
use clap::{App, Arg, ArgMatches};
use idl_gen::lang::*;
use message::Message;
use std::path::Path;
use std::{fs, path::PathBuf};
enum GenArgs {
TargetLanguage(String),
}
pub fn create_command<'a>() -> App<'a> {
App:... |
//! Exports source code object and related items.
mod indexing;
#[cfg(test)]
mod test;
use crate::{location::Location, span::Span};
pub use indexing::SourceIndex;
use indexing::{IndexArray, IndexArrayBuilder, IndexArrayIter};
use std::{
cmp::Ordering,
fmt,
hash::{Hash, Hasher},
ops::Index,
sync::... |
use crate::binary::uvarint;
use crate::error::{SnappyError, TAG_LITERAL, TAG_COPY1, TAG_COPY2, TAG_COPY4};
use std::ptr::{copy_nonoverlapping, copy};
/// Return the exact length of decoded data.
pub fn decode_len(src: &[u8]) -> Result<usize, SnappyError> {
let (v, _, err) = _decode_len(src);
return match err {... |
use crate::colour::*;
use crate::error::ErrorLevel;
use std::fmt::{Display, Formatter, Result};
/// The context for an error message. This can be created using builder style methods.
/// ```
/// use custom_error::*;
/// enum ErrorType {
/// NotANumber,
/// }
/// fn parse_num(line: &str, linenumber: usize) -> Resul... |
use std::sync::Arc;
use parking_lot::RwLock;
use beserial::Deserialize;
use nimiq_block::{
Block, MacroBlock, MacroBody, MacroHeader, MultiSignature, SignedViewChange,
TendermintIdentifier, TendermintProof, TendermintStep, TendermintVote, ViewChange,
ViewChangeProof,
};
use nimiq_block_production::BlockPr... |
use crate::{
arguments::Arguments,
environment::Environment,
error::{self, Result},
request_handler::RequestHandler,
};
use hyper::server::conn::AddrIncoming;
use openssl::x509::X509;
use snafu::ResultExt;
use std::{io::Write, net::ToSocketAddrs};
use tower::make::Shared;
pub(crate) struct Server {
request_h... |
//! Simple representation of terms, sorts, etc.
use {
std::{ops::Deref,rc::Rc, fmt, ptr},
crate::types::{self,Op,Atom},
batsmt_pretty as pp,
};
// re-export
pub use batsmt_pretty::Pretty;
#[derive(Eq,PartialEq,Hash)]
struct SortCell {
name: Atom,
arity: u8,
}
/// A sort
#[derive(Clone,Eq,Partia... |
use std::convert::TryInto;
use hex;
#[cfg(test)]
use crate::{aes128, aes192, aes256};
const BLOCK_SIZE : usize = 16;
const SUBKEY_GEN_R128 : [u8; BLOCK_SIZE] = [0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00... |
use std::collections::HashMap;
use std::error::Error;
use std::io::{self, Read};
use std::ops::Range;
use pest::iterators::Pair;
use pest::Parser;
use pest_derive::Parser;
fn main() -> Result<(), Box<Error>> {
let mut input = String::new();
io::stdin().read_to_string(&mut input)?;
let output = solve(&inp... |
use bytes::{BytesMut, BufMut};
use futures::{Future, IntoFuture, Sink, Stream as FuturesStream, Poll};
use futures::future::Either;
use postgres_shared::params::Host;
use postgres_protocol::message::backend;
use postgres_protocol::message::frontend;
use std::io::{self, Read, Write};
use tokio_io::{AsyncRead, AsyncWrite... |
//! The in-memory representation of the homesync config. Refer to
//! [homesync/template.yml](https://github.com/jrpotter/homesync/blob/main/rsrc/template.yml)
//! (copied below) for an example of what this config might look like.
//!
//! ```yaml
//! ---
//! user:
//! name: name
//! email: <EMAIL>
//! ssh:
//! pu... |
use winapi::um::winuser::{WS_VISIBLE, WS_DISABLED, WS_BORDER, WS_CHILD, WS_CLIPCHILDREN, WS_EX_CONTROLPARENT};
use crate::win32::window_helper as wh;
use crate::win32::base_helper::check_hwnd;
use crate::NwgError;
use super::{ControlBase, ControlHandle};
const NOT_BOUND: &'static str = "Frame is not yet bound to a win... |
use crate::{
composite_renderer::{Command, Image},
sprite_sheet_asset_protocol::SpriteSheetAsset,
};
use core::{
assets::{
asset::{Asset, AssetId},
database::AssetsDatabase,
protocol::{AssetLoadResult, AssetProtocol, AssetVariant, Meta},
},
Ignite, Scalar,
};
use serde::{Dese... |
use std::{
collections::HashMap,
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr},
os::unix::io::RawFd,
};
use actix_codec::{AsyncRead, AsyncWrite};
use ctor::ctor;
use envconfig::Envconfig;
use frida_gum::{interceptor::Interceptor, Gum};
use futures::{SinkExt, StreamExt};
use kube::api::Portforwarder;
use la... |
mod compact;
use scale::{Decode, Encode};
use ink_env::Hash;
use ink_storage::traits::{PackedLayout, SpreadLayout};
pub use compact::Compact;
#[derive(
PartialEq, Debug, Eq, Clone, Copy, Default, Encode, Decode, SpreadLayout, PackedLayout,
)]
#[cfg_attr(
feature = "std",
derive(scale_info::TypeInfo, ink... |
extern crate eventual;
extern crate wampire;
use eventual::Async;
use std::io;
use std::sync::{Arc, Mutex};
use wampire::client::{Client, Connection, Subscription};
use wampire::{MatchingPolicy, Value, URI};
#[macro_use]
extern crate log;
extern crate env_logger;
enum Command {
Sub,
Pub,
Unsub,
List,
... |
// Copyright 2020 the Deno authors. All rights reserved. MIT license.
use clap::App;
use clap::Arg;
use deno_lint::diagnostic::LintDiagnostic;
use deno_lint::linter::LinterBuilder;
use deno_lint::rules::get_recommended_rules;
use rayon::prelude::*;
use std::fmt;
use std::io::Write;
use std::sync::atomic::{AtomicUsize, ... |
use reader_writer::FourCC;
use structs::{FstEntryFile, GcDisc, Resource, ResourceKind};
use crate::mlvl_wrapper::{MlvlArea, MlvlEditor};
use std::{
collections::{HashMap, HashSet},
ops::RangeFrom,
};
#[derive(Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd, Debug)]
struct ResourceKey<'r>
{
pak_name: &'... |
//! Tests for `std::collections::HashMap`
use arbitrary::*;
use std::hash::{BuildHasher, Hash, Hasher};
use std::mem;
/// Build a [`TrulyAwfulHasher`]
///
/// This struct serves only to anchor a [`BuildHasher`]. It has no internal
/// mechanism.
pub struct BuildTrulyAwfulHasher {
seed: u8,
}
impl BuildTrulyAwfulH... |
use glucose::linear::vec::Point;
pub mod cache;
pub mod defaults;
#[cfg(feature = "discord")]
pub mod discord;
#[cfg(feature = "terminal")]
pub mod terminal;
#[derive(Debug, Copy, Clone)]
pub struct Move<const N: usize> {
pub player_id: i32,
pub piece_id: i32,
pub from: Option<Point<i32, { N }>>,
pub ... |
#![feature(rustc_private)]
extern crate rustc_interface;
use std::{
env,
path::PathBuf,
process::{exit, Command},
};
use clap::clap_app;
use rand::prelude::*;
const VERSION: &str = env!("CARGO_PKG_VERSION");
const TARGET_DIR: &str = "target/flowistry";
fn main() {
env_logger::init();
let flowistry_rustc... |
use clap::App;
use clap::Arg;
use failure::ResultExt;
use prometheus::Registry;
use sentry::integrations::failure::capture_fail;
use sentry::internals::ClientInitGuard;
use sentry::internals::IntoDsn;
use slog::debug;
use slog::info;
use slog::warn;
use slog::Logger;
use replicante_util_upkeep::Upkeep;
mod components... |
use lp_modeler::operations::LpOperations;
use lp_modeler::problem::{LpObjective, LpProblem};
use lp_modeler::solvers::{GlpkSolver, SolverTrait};
use lp_modeler::variables::{lp_sum, LpContinuous, LpExpression};
use crate::config::get_config;
use crate::graph::path::Path;
use crate::graph::Graph;
use crate::helpers::{co... |
use ::*;
/// Stuff related to things in the world
pub mod play;
use play::Play;
pub trait GameState {
fn update(&mut self, &mut State);
fn logic(&mut self, &mut State, &mut Context);
fn draw(&mut self, &State, &mut Context) -> GameResult<()>;
fn draw_hud(&mut self, &State, &mut Context) -> GameResult... |
use generic_array::{arr, typenum::*};
use std::collections::HashMap;
use virtual_modular_graph::{Node, NodeTemplate, Ports, BLOCK_SIZE};
pub mod utils;
#[cfg(feature = "abc")]
pub mod abc;
pub mod clock;
pub mod computation;
pub mod delay_and_reverb;
pub mod distortion;
pub mod envelope;
pub mod filter;
pub mod misc;
... |
use crate::core::object::Object;
use crate::core::HitRecord;
use crate::geometry::{Geometry, Visitor};
use crate::material::Material;
use crate::math::OrthoNormalBase;
use crate::math::{Ray, AABB};
use crate::random;
use crate::types::{FSize, Point3, TextureCoordinate, Vector3};
use core::f64::consts::PI;
use std::erro... |
use advent_lib::{
cases::{GenericPuzzleCase, Puzzle, PuzzleCase, PuzzleRunner},
helpers::StringAdventExt,
};
use indoc::indoc;
use std::{
collections::{HashMap, VecDeque},
iter::Iterator,
str::FromStr,
};
pub fn get_puzzles() -> Vec<Box<dyn Puzzle>> {
vec![Box::new(Part1), Box::new(Part2)]
}
#... |
use log::{debug, warn};
use std::path::{Path, PathBuf};
use crate::libs::keyer_io::keyer_io::KeyerType;
use serde_derive::Deserialize;
use serde_derive::Serialize;
use std::ops::Deref;
use std::fs;
#[derive(Serialize, Deserialize, Debug)]
struct Config {
keyer: Keyer,
audio_devices: AudioDevices,
}
#[derive... |
use egui::{Pos2, Rect};
use glam::{Mat3, Mat4, Vec3, Vec4};
/// Creates a matrix that represents rotation between two 3d vectors
///
/// Credit: https://www.iquilezles.org/www/articles/noacos/noacos.htm
pub fn rotation_align(from: Vec3, to: Vec3) -> Mat3 {
let v = from.cross(to);
let c = from.dot(to);
let ... |
extern crate glib;
extern crate gtk;
use crate::ui::*;
use gtk::prelude::*;
use std::cell::RefCell;
use std::rc::Rc;
#[derive(Clone)]
pub struct PractiseView {
body: gtk::Grid,
title_box: gtk::Box,
title: gtk::Label,
section: gtk::Label,
subsection: gtk::Label,
id: gtk::Label,
question: gt... |
use advent_lib::{
cases::{GenericPuzzleCase, Puzzle, PuzzleCase, PuzzleRunner},
twodee::Point,
};
use std::iter::Iterator;
pub fn get_puzzles() -> Vec<Box<dyn Puzzle>> {
vec![Box::new(Part1), Box::new(Part2)]
}
#[derive(Debug)]
pub struct Part1;
impl PuzzleRunner for Part1 {
type Input = Map;
typ... |
// 5.2.21. /proc/modules
// This file displays a list of all modules loaded into the kernel. Its contents vary based on the configuration and use of your system, but it should be organized in a similar manner to this sample /proc/modules file output:
// Note
//
// This example has been reformatted into a readable form... |
use std::str;
use crate::client::ActionTag;
use vdom_rsjs::{VNode, VTag};
use vdom_rsjs::render::{Render, Cache};
use vdom_websocket_rsjs::Action;
use tokio_coap::message::Message as CoapMessage;
use tokio_coap::error::Error as CoapError;
use tokio_coap::message::option::ContentFormat;
use tokio_coap::message::option... |
use graph::prelude::*;
use float_ord::FloatOrd;
use log::info;
use rayon::prelude::*;
use std::{cmp::Reverse, path::Path, path::PathBuf, sync::atomic::Ordering, time::Instant};
const INF: f32 = f32::MAX;
fn main() -> Result<(), Box<dyn std::error::Error>> {
env_logger::init();
let cli::AppArgs {
pat... |
// Copyright The pipewire-rs Contributors.
// SPDX-License-Identifier: MIT
//! SPA results and errors.
use std::{convert::TryInto, fmt};
use errno::Errno;
/// A result returned by a SPA method, usually to be converted to
/// a Rust result using [`SpaResult::into_result`] or [`SpaResult::into_async_result`].
#[deriv... |
//! Playlists
pub mod video;
pub use self::video::Video;
use crate::{
youtube::{
browse::{
self,
playlist::{PlaylistSidebarPrimaryInfoRenderer, PlaylistSidebarSecondaryInfoRenderer},
},
innertube::Browse,
},
Client, Thumbnail,
};
/// A Id describing a Play... |
extern crate collections;
use mob;
use fov;
use mob::behavior as bhvr;
use world::{ World, TileKind};
use geo::{ Dir, Pos };
use input;
use input::Command;
use dice;
pub struct Game {
pub world: World,
pub mobs: Vec<mob::Mob>,
pub turn: usize
}
/// Combined information about what's going on on a tile
///... |
use crate::internal::*;
use ndarray::prelude::*;
use crate::ops::cnn::pools::{ConcretePoolGeometry, PoolGeometry, PoolSpec};
#[derive(Debug, Clone, new, Hash)]
pub struct MaxPool {
pub pool_spec: PoolSpec,
pub with_index_outputs: Option<DatumType>,
}
impl_dyn_hash!(MaxPool);
impl Op for MaxPool {
fn nam... |
#![feature(duration_as_u128)]
#[macro_use]
extern crate bencher;
use bencher::Bencher;
use criterion::black_box;
#[macro_use]
extern crate itertools;
extern crate rand;
use rand::Rng;
extern crate chrono;
use chrono::prelude::*;
extern crate curve25519_dalek;
use curve25519_dalek::ristretto::RistrettoPoint;
use cur... |
//! Implementation of Insctruction related things, such as parsing
//! instructions or data strucutres that represent Instructions.
//!
//! There are 6 (and some other that doesn't really matter right now) ways, to encode a instruction and it's
//! operands. R(egister), I(mmediate), U(pper immediate), S(tore), B(ranch)... |
#[macro_use]
extern crate glium;
extern crate glutin;
extern crate cgmath;
extern crate rand;
extern crate collision;
extern crate noise;
#[macro_use]
extern crate log;
extern crate simplelog;
mod render;
mod block;
mod camera;
mod space;
mod color;
mod world;
mod worldgen;
mod game;
mod default;
use glium::Surface;
... |
use crate::{config::Config, config::ManagerConfig, database::setup_db};
use revault_net::{noise::SecretKey as NoisePrivkey, sodiumoxide};
use revault_tx::{
miniscript::{
bitcoin::{
secp256k1,
secp256k1::rand::{rngs::SmallRng, FromEntropy, RngCore},
util::bip32::{self, Chi... |
use crate::code::AnsiCode;
use crate::error::Error;
use std::{convert::TryInto, slice::Iter};
use tui::style::{Color, Modifier, Style};
#[derive(Debug)]
pub struct Stack<T> {
st: Vec<T>,
lock: bool,
}
impl<T> Stack<T> {
pub fn new() -> Self {
Self {
st: Vec::<T>::new(),
loc... |
use crate::ast::*;
impl SyntaxNode {
/// Create a borrowing iterator over this &[SyntaxNode] and all it's children (and their children, ...).
/// It visits in a pre-order tree traversal:
/// 1. visits the node itself
/// 2. visits all the child nodes
pub fn iter(&self) -> AstIterator<SyntaxNode> {
... |
use crate::encoding::{Reader, Writer};
use crate::error::{Error, Result};
use crate::mini_der;
use crate::signature::SignatureHash;
use ring::signature::ED25519_PUBLIC_KEY_LEN;
pub const SSH_ED25519: &[u8] = b"ssh-ed25519";
pub const SSH_ECDSA_P256: &[u8] = b"ecdsa-sha2-nistp256";
pub const SSH_ECDSA_P384: &[u8] = b"e... |
use super::Alignment;
use alloc::alloc::Layout;
use alloc::boxed::Box;
use alloc::vec::Vec;
use core::mem::{align_of, size_of};
/// Aligns the first element in a `Vec<T>` to `A`. If the alignment of `A` is less than the alignment of `T` then a `Vec<T>`
/// with capacity `t_capacity` is returned. This method is safe be... |
use std::net::SocketAddr;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use kvraft::KVServer;
use lazy_static::lazy_static;
use serde_derive::{Deserialize, Serialize};
use warp::Filter;
use crate::one_clerk::create_clerk;
use crate::run::run_kv_instance;
mod kv_service;
mod one_clerk;
mod persi... |
use std::hash::{Hash, Hasher};
use std::mem::MaybeUninit;
use std::{fmt, mem, ptr};
use crate::boxed::types::shared_str::SharedStr;
use crate::boxed::*;
/// Describes the storage of a string's data
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum StrStorage {
/// String data is stored inline in a box of the give... |
//! Primary configuration
//!
//! Public representation is via the [`Mdr0`] struct.
//!
//! Exposes configurations for
//! - [`Quadrature count mode`]: Controls the interpretation of the input encoder signals
//! - [`Index pin behavior`]: Controls the behavior of the Index pin.
//! - [`Count cycle mode`]: Controls t... |
use regex::Regex;
use std::{
fs::Metadata,
ops::RangeInclusive,
time::{Duration, SystemTime},
};
use walkdir::DirEntry;
use crate::{
cfg::{Config, Mode},
size::Size,
};
pub struct Filter {
mod_age: Option<RangeInclusive<Duration>>,
pattern: Option<Regex>,
min_size: u64,
mode: Mode,... |
/// These functions are used so that most movement calculations can assume we're in the
/// arctic triangle of root 0 (see `triangles.rs`) to minimise the amount of
/// special case logic.
use crate::na;
use super::triangles::*;
use crate::cell_shape::NEIGHBOR_OFFSETS;
use crate::{Dir, GridCoord, Point3};
// Use nalg... |
use super::{
ChineseVariant, LunisolarYear, BA_ZI_WEIGHT_MONTHS, BIG_MONTHS, MIN_YEAR_IN_SOLAR_CALENDAR,
THE_LUNAR_MONTHS,
};
use std::mem::transmute;
use std::fmt::{self, Display, Formatter};
use std::str::FromStr;
/// 列舉農曆十二個月份名稱:正月、二月、三月、四月、五月、六月、七月、八月、九月、十月、冬月、臘月。包含閏月。
#[derive(Debug, PartialOrd, Ord, Pa... |
use crate::{setup::*, diverged::SpiDiverged, master::SpiMasterDrv, SpiMap};
use core::marker::PhantomData;
use drone_cortexm::{fib, reg::prelude::*, thr::prelude::*};
use drone_stm32_map::periph::{
dma::ch::DmaChMap,
spi::traits::*,
};
use drone_stm32f4_dma_drv::{DmaChCfg, DmaStChToken};
use drone_stm32f4_rcc_d... |
use std::cell::RefCell;
use cpu_6502::cpu_6502::Cpu6502;
use sdl2::{
event::Event,
keyboard::Keycode,
pixels::{Color, PixelFormatEnum},
render::{Canvas, Texture, TextureCreator},
video::{Window, WindowContext},
Sdl,
};
pub struct ScreenBuffer<'a> {
pub texture_data: Vec<u8>,
pub textur... |
use std::fmt::{self, Display};
use ansi_term::{Color::Fixed, Style};
use git2::{BranchType, Oid, Reference, Repository, Statuses};
fn branch(repo: &Repository) -> impl Display {
if repo.head_detached().unwrap() {
return Fixed(199).bold().paint("<detached>");
}
// Use the reference here to avoid r... |
use serde_json::de;
use serde_json::error::Error::Syntax;
use serde_json::error::ErrorCode;
use serde_json::value::Value;
use crate::flowgger::config::Config;
use crate::flowgger::record::{Record, SDValue, SEVERITY_MAX, StructuredData};
use crate::flowgger::utils;
use super::Decoder;
#[derive(Clone)]
pub struct Json... |
use {DepthFirstNumber, SimplifiedAnswer, TableIndex};
use context::prelude::*;
use context::AnswerStream;
use logic::RootSearchFail;
use stack::{Stack, StackIndex};
use tables::Tables;
use table::{Answer, AnswerIndex};
pub struct Forest<C: Context, CO: ContextOps<C>> {
#[allow(dead_code)]
pub(crate) context: C... |
use crate::feature::*;
use core::UriBound;
use std::cmp::{Ordering, PartialEq, PartialOrd};
use std::fmt;
use std::hash::{Hash, Hasher};
use std::marker::PhantomData;
use std::num::NonZeroU32;
/// Representation of a URI for fast comparisons.
///
/// A URID is basically a number which represents a URI, which makes the... |
//! Array-type node attributes.
use std::{io, marker::PhantomData};
use byteorder::LittleEndian;
use libflate::zlib::Decoder as ZlibDecoder;
use crate::{
low::v7400::ArrayAttributeEncoding,
pull_parser::{error::DataError, Result},
};
/// Attribute stream decoder.
// `io::BufRead` is not implemented for `Zli... |
//! Mocks for the debt treasury module.
#![cfg(test)]
use super::*;
use frame_support::{
impl_outer_dispatch, impl_outer_event, impl_outer_origin, ord_parameter_types, parameter_types,
weights::IdentityFee,
};
use primitives::{Amount, TokenSymbol, TradingPair};
use sp_core::H256;
use sp_runtime::{testing... |
use crate::source::SourceReader;
use crate::tokens::Token;
use std::convert::TryInto;
use strip_bom::StripBom;
#[derive(Clone)]
pub struct TokenReader<'a> {
/// The source of this TokenReader
src: SourceReader<'a>,
}
impl<'a> Iterator for TokenReader<'a> {
type Item = Token<'a>;
/// Read a token from... |
// Copyright 2021 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot 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) any late... |
use anyhow::Result;
use chrono::TimeZone;
use serde::{Deserialize, Serialize};
use wither::bson::{doc, oid::ObjectId, Document};
use wither::mongodb::options::ClientOptions;
use wither::mongodb::*;
use wither::prelude::*;
use wither::{Model, ModelCursor};
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Stat... |
use futures::lock::Mutex;
use indexmap::IndexMap;
use openapiv3::{OpenAPI, PathItem, ReferenceOr};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use sqlparser::dialect::MySqlDialect;
use std::{
collections::HashMap,
fs::File,
io::Read,
net::{SocketAddr, ToSocketAddrs},
sync::Arc,
};... |
//! FUSE kernel driver communication
//!
//! Raw communication channel to the FUSE kernel driver.
use std::io;
use std::ffi::{CString, CStr, OsStr};
use std::os::unix::ffi::OsStrExt;
use std::path::{PathBuf, Path};
use fuse_sys::{fuse_args, fuse_mount_compat25};
use libc::{self, c_int, c_void, size_t};
use log::error;... |
//! Multicore support
// See [Chapter ?? Section ??](https://datasheets.raspberrypi.org/rp2040/rp2040_datasheet.pdf) for more details
use crate::pac;
#[cfg(feature = "alloc")]
extern crate alloc;
/// Errors for multicore operations.
#[derive(Debug)]
pub enum Error {
/// Operation is invalid on this core.
Inv... |
use crate::env::cmp::CmpModule;
use crate::env::lambda::LambdaModule;
use crate::env::logic::LogicModule;
use crate::env::math::MathModule;
use crate::{parse, RispErr, RispExp, RispFunc};
use std::collections::HashMap;
use std::rc::Rc;
use crate::env::def::DefModule;
pub mod cmp;
pub mod def;
pub mod lambda;
pub mod l... |
mod data;
mod scanner;
extern crate itertools;
extern crate once_cell;
extern crate petgraph;
extern crate rayon;
use itertools::Itertools;
use petgraph::algo::astar;
use petgraph::{Graph, Undirected};
use rayon::prelude::*;
use std::collections::{HashMap, HashSet};
fn find_scanner_mappings(reports: &[scanner::Repo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.