text stringlengths 3.09k 13.9k |
|---|
#![allow(non_camel_case_types)]
extern crate bit_array;
extern crate typenum;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate log;
pub mod file_utils;
pub mod iso_field;
pub mod iso_msg;
pub mod iso_specs;
pub mod pds;
use crate::iso_specs::Category;
use std::collections::HashMap;
use std::fmt;
#[d... |
//! Support for creating futures that represent timeouts.
//!
//! This module contains the `Delay` type which is a future that will resolve
//! at a particular point in the future.
use std::io;
use std::sync::{Arc, Mutex};
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::Ordering::SeqCst;
use std::time::{Dur... |
// Copyright 2018 PingCAP, 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 to i... |
#![deny(missing_docs)]
//!
//! Process Github webhooks in [tide](https://github.com/http-rs/tide).
//!
//! ## Example
//!
//! ```Rust
//! #[async_std::main]
//! async fn main() -> tide::Result<()> {
//! let mut app = tide::new();
//! let github = tide_github::new("My Github webhook s3cr#t")
//! .on(Even... |
use std::cmp::Ordering;
use std::str::FromStr;
#[aoc(day17, part1)]
fn part1(input: &str) -> i64 {
let input = input.lines().next().unwrap();
let target_area = Rectangle::from_str(input).unwrap();
let mut max_height = -100;
for x in 1..1000 {
for y in -1000..1000 {
if let Some(hei... |
use crate::auth;
use crate::config;
use crate::fairings::{RedisReader, RedisWriter};
use rocket::http::Status;
use rocket::Outcome;
trait MakeClient {
fn make_client(client_id: String) -> Self;
}
fn get_auth_client<'a, 'r, C: MakeClient + Send + Sync + Clone + 'static>(
token_name: &str,
request: &'a rock... |
use crate::bounding_volume::{self, BoundingVolume};
use crate::math::Isometry;
use na::{self, RealField};
use crate::pipeline::narrow_phase::{ProximityAlgorithm, ProximityDetector, ProximityDispatcher};
use crate::query::{visitors::BoundingVolumeInterferencesCollector, Proximity};
use crate::shape::{CompositeShape, Sha... |
use crate::player;
use crate::prelude::*;
use crate::template::Template;
use crate::utils;
use anyhow::Result;
use std::fs::File;
use std::path::PathBuf;
static DEFAULT_CURRENT_SONG_TEMPLATE: &str = "Song: {{name}}{{#if artists}} by {{artists}}{{/if}}{{#if paused}} (Paused){{/if}} ({{duration}})\n{{#if user~}}Request ... |
// Copyright 2022 The Engula Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to... |
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
anyhow::{bail, Context, Result},
clap::{App, Arg},
scrutiny_config::Config,
scrutiny_frontend::{command_builder::CommandBuilder, laun... |
use crate::entities::spawn_bullet;
use crate::geom::*;
use bevy::prelude::*;
#[derive(Default)]
pub struct ShipsSpriteHandles {
pub handles: Vec<HandleUntyped>,
pub atlas_loaded: bool,
}
#[derive(Debug)]
pub struct ShipBuilder;
#[derive(Clone, Copy, Eq, PartialEq, Hash, Debug)]
pub enum POWERUPTYPE {
Heal... |
use nom::{be_u8,be_u16,be_u32,rest};
use {ParseOps,ConvError};
use packet_writer::{PacketWriter,WriteFields};
named!(bytes_to_ip<&[u8], IPv4Hdr>, do_parse!(
version_and_length: be_u8 >>
qos: be_u8 >>
pk_length: be_u16 >>
ident: be_u16 >>
flags_and_offset: be_u16 >>
ttl: be_u8 >>
proto: be_... |
use std::collections::HashMap;
use std::os::raw::c_int;
use geo::algorithm::euclidean_distance::EuclideanDistance;
use geo_types::{Coordinate, LineString, Point, Polygon};
use h3ron_h3_sys::{destroyLinkedPolygon, h3SetToLinkedGeo, radsToDegs, H3Index, LinkedGeoPolygon};
use crate::algorithm::smoothen_h3_linked_polyg... |
/*
* Copyright (c) 2017 <NAME> <<EMAIL>>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, pu... |
//! An example of using texture.
// The texture is referenced by:
// https://cc0textures.com/view?id=WoodFloor024
use std::io::Read;
use truck_modeling::*;
use truck_platform::*;
use truck_rendimpl::*;
use wgpu::*;
use winit::{dpi::*, event::*, event_loop::ControlFlow};
mod app;
use app::*;
struct MyApp {
scene:... |
use std::collections::HashMap;
use std::time::Instant;
use log::*;
use rand::Rng;
use crate::config;
use crate::context;
use crate::messages;
use crate::utils;
#[derive(Debug)]
pub enum Role {
Follower(FollowerData),
Candidate(CandidateData),
Leader(LeaderData)
}
#[derive(Debug)]
pub struct FollowerData... |
use bdk::bitcoin::Amount;
use bdk::bitcoin::Network;
use daemon::auth::Authenticated;
use daemon::bitmex_price_feed;
use daemon::connection::ConnectionStatus;
use daemon::model::cfd::OrderId;
use daemon::model::Leverage;
use daemon::model::Price;
use daemon::model::Usd;
use daemon::model::WalletInfo;
use daemon::oracle... |
use crate::db::{
APIResponse, Account, AccountDenormalized, AccountJoined, AccountShort, GetAccountResponse,
MyRocketSQLConn,
};
use rocket::http::RawStr;
use rocket_contrib::json::Json;
#[rocket::delete("/account/<id>?<apikey>")]
pub fn delete_account(
id: &RawStr,
apikey: &RawStr,
mut conn: MyRoc... |
use crate::{save_keys, MasterKeyOutput, PrivateMasterKey};
use crate::{Result, ToHrp};
use bitcoin::bech32::{self, FromBase32};
use bitcoin::util::bip32::ExtendedPrivKey;
use bitcoin::Network;
use log::debug;
use serde::{Deserialize, Serialize};
use std::io;
use std::str::FromStr;
use structopt::StructOpt;
/// Restore... |
use crate::core::traits::Real;
use std::ops;
#[derive(Debug, Copy, Clone, Default, PartialEq)]
pub struct Vector2<T = f64> {
pub x: T,
pub y: T,
}
impl<T> Vector2<T>
where
T: Real,
{
/// Create a new vector with x and y components.
pub fn new(x: T, y: T) -> Self {
Vector2 { x, y }
}
... |
use crate::Error;
use crate::{BNO08X_UART_RVC_FRAME_SIZE, BNO08X_UART_RVC_HEADER, BUFFER_SIZE};
use bbqueue::Consumer;
use core::borrow::Borrow;
use serde::Deserialize;
#[derive(Deserialize, Debug, Copy, Clone, PartialEq)]
pub struct Bno08xRvcRawFrame {
pub index: u8,
pub yaw: i16,
pub pitch: i16,
pub ... |
use std::mem;
use proc_macro2::Span;
use quote::{quote, ToTokens};
use syn::parse::{Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::token::Comma;
use crate::util::FieldParams;
pub fn form(meta: &FormMeta, ast: &mut syn::ItemStruct) -> proc_macro2::TokenStream {
let fields = match &mut ast.fields {... |
use std::error::Error;
use std::fs;
use std::path::Path;
use std::collections::HashMap;
use super::intcode;
#[derive(Debug, Clone, Copy, PartialEq)]
enum Tile {
Empty(usize),
Wall,
Oxygen(usize),
Unknown,
Start,
}
type Coordinate = (i32, i32);
type Map = HashMap<Coordinate, Tile>;
fn explore_ma... |
// path.rs 2D vector paths.
//
// Copyright (c) 2017-2019 <NAME>
//
/// Fill-rule for filling paths.
#[derive(Clone, Copy, Debug)]
pub enum FillRule {
/// All points within bounds are filled
NonZero,
/// Alternate filling with path outline
EvenOdd,
}
/// Path operation.
pub enum PathOp {
///... |
use styxc_ast::{
func::{ExternFunc, FuncDecl, ParenArgument},
Block, Declaration, Expr, Literal, Mutability, Node, Stmt,
};
use styxc_types::Type;
/// An enum of linkage types.
#[derive(Debug)]
pub enum Linkage {
/// The function is declared locally, and is not exported.
Local,
/// The function is ... |
// Copyright 2021 The BMW 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 agreed... |
extern crate toml;
use std::process::exit;
use std::fs::File;
use std::io::Read;
use std::path::{Path, PathBuf};
use std::collections::BTreeMap;
use std::str::FromStr;
use serde_json;
#[derive(Debug, Clone)]
pub struct BookConfig {
root: PathBuf,
pub dest: PathBuf,
pub src: PathBuf,
pub theme_path: Pa... |
use std::convert::From;
use std::ops::{AddAssign, Div, Mul, SubAssign};
/// 二項係数を計算する.
/// NOTE: ACLibrary のModInt のような有限体が渡されることを想定している.
/// # Example
/// ```
/// use my_library_rs::*;
/// use std::ops::{Mul, Div};
///
/// const MOD: u64 = 1_000_000_007;
/// fn pow(mut a: u64, mut n: u64) -> u64 {
/// let mut r =... |
use clap::{crate_authors, crate_description, crate_version, App, Arg, ArgMatches};
use parity_wasm::{self, deserialize_buffer, elements::Module, serialize};
use std::{
ffi::OsStr,
fs::File,
io::{stdin, stdout, Read, Write},
path::Path,
process::exit,
str::FromStr,
};
use wabt::wat2wasm;
fn main() {
if std::env:... |
use xpath_reader::{FromXml, FromXmlOptional, Error, Reader};
use crate::entities::{Mbid, ResourceOld};
use crate::entities::date::PartialDate;
/// A label entity in the MusicBrainz database.
/// There is quite some controversy in the music industry what a 'label'
/// constitutes.
///
/// For a complete disambiguation... |
#![cfg(test)]
// #![feature(test)]
//! This benchmarking suite is extremely naive
//! I use it internally to determine if I have
//! been able to make large impact performance
//! improvements in both this crate
//! and `ress`
//! If you want to full output please run
//! `node ./bencher.js` in the crate root
//! this ... |
use std::borrow::Cow;
use crate::app::state::{
browser_state::{BrowserAction, BrowserEvent, BrowserState},
login_state::{LoginAction, LoginEvent, LoginState},
playback_state::{PlaybackAction, PlaybackEvent, PlaybackState},
selection_state::{SelectionAction, SelectionContext, SelectionEvent, SelectionSt... |
/*!
# Davidson Diagonalization
The Davidson method is suitable for diagonal-dominant symmetric matrices,
that are quite common in certain scientific problems like [electronic
structure](https://en.wikipedia.org/wiki/Electronic_structure). The Davidson
method could be not practical for other kind of symmetric matrices... |
use super::super::super::SingleShard;
use super::test_util;
use loom::sync::{Arc, Condvar, Mutex};
use loom::thread;
fn store_val(slab: &Arc<SingleShard>, readiness: usize) -> usize {
println!("store: {}", readiness);
let key = slab.alloc().expect("allocate slot");
if let Some(slot) = slab.get(key) {
... |
use std::num::NonZeroUsize;
/// Represents a suggestion for an invalid `command` or `option`
#[derive(Debug, Clone, PartialOrd, PartialEq)]
pub struct Suggestion {
/// The suggested value.
pub value: String,
/// The similarity between the suggested value and the invalid one.
pub similarity: f32,
}
///... |
/// Runtime module implementing the token transfer functions.
/// With added lock and unlock functions for staking in TCR runtime.
/// Implements a custom type `TokenBalance` for representing account balance.
/// `TokenBalance` type is similar to the `Balance` type in `balances` SRML module.
use rstd::prelude::*;
use ... |
use super::parents_list::ParentsList;
use crate::errors::{HashgraphError, HashgraphErrorType};
use crate::event::event_hash::EventHash;
use crate::event::Event;
use failure::Error;
use std::collections::{BTreeMap, HashMap, HashSet};
use std::iter::FromIterator;
#[derive(Clone, Deserialize, PartialEq, Serialize)]
pub e... |
use crate::blockchain::transaction::{
Address, NormalTransaction, Transaction, TransactionInput, TransactionOutput,
};
use anyhow::{bail, Result};
use chrono::Utc;
pub struct UTXOManager {
my_address: Address,
transactions: Vec<(Transaction, usize)>,
balance: u64,
}
impl UTXOManager {
pub fn new(m... |
use Interface;
use ipnetwork::Ipv4Network;
use std::collections::BTreeMap;
use std::net::Ipv4Addr;
// TODO: Add metric
#[derive(Debug, Clone)]
pub struct RouteEntry {
pub net: Ipv4Network,
pub gw: Option<Ipv4Addr>,
pub interface: Interface,
}
impl RouteEntry {
pub fn new(net: Ipv4Network, gw: Option... |
use std::{
collections::HashMap,
fs::File,
io::{self, BufRead, BufReader},
str::FromStr,
};
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
struct Point {
x: usize,
y: usize,
}
impl FromStr for Point {
type Err = io::Error;
fn from_str(s: &str) -> Result<Self, Self... |
#[macro_use]
extern crate clap;
use std::fs::{self, File};
use std::path::Path;
use std::io::{BufRead, BufReader, Write};
#[derive(Clone)]
enum ParsedLine {
Set(String, String, String), // Object, path, value
SetCmp(String, String, String, String), // Object, path, compare value, value
Start(HotfixType)
}... |
#![cfg(feature = "builders")]
use atom_syndication::extension::*;
use atom_syndication::*;
use std::collections::BTreeMap;
use std::str::FromStr;
fn join_lines(text: &str) -> String {
text.lines().map(|line| line.trim()).collect()
}
#[test]
fn test_builders() {
let does = vec![
PersonBuilder::default... |
use keeper_primitives::{
moonbeam::{
self, utils::query_submit_and_finish_result, IS_FINISHED, MOONBEAM_LISTENED_EVENT,
MOONBEAM_SCAN_LOG_TARGET, MOONBEAM_SCAN_SPAN, MOONBEAM_SUBMIT_LOG_TARGET,
MOONBEAM_TRANSACTION_CONFIRMATIONS, SUBMIT_STATUS_QUERY, SUBMIT_TX_MAX_RETRY_TIMES,
SUBMIT_VERIFICATION,
},
Address... |
#[macro_use]
extern crate derive_new;
extern crate clap;
extern crate hyper;
extern crate log;
extern crate pretty_env_logger;
#[derive(Debug, new)]
struct Config {
host: String,
port: String,
status: String,
headers: Vec<String>,
body: String,
socket_address: std::net::SocketAddr,
respons... |
#![macro_use]
use std::fmt;
use std::fmt::Display;
use self::prelude::*;
use crate::assembled::prelude::*;
use crate::instruction::prelude::*;
/// Re-exports important traits and types for glob importing.
pub mod prelude {
pub use super::DisassembledRom;
pub use super::RomBlock;
pub use super::RomBlockCo... |
//! Parses token lists according to the token list standard.
//!
//! # License
//!
//! The `tokenlist` crate is licensed under the Apache 2.0 License.
#![deny(missing_docs)]
use chrono::{DateTime, Utc};
use serde::{Deserialize, Deserializer, Serialize};
use serde_json::Value;
use solana_program::pubkey::Pubkey;
use st... |
use ash::extensions::khr::{Surface, Swapchain as AshSwapchain};
use ash::version::{DeviceV1_0};
use ash::{vk, Device, Instance};
use std::sync::Arc;
use winit::dpi::PhysicalSize;
pub struct Swapchain {
device: Arc<Device>,
swapchain: vk::SwapchainKHR,
swapchain_loader: Arc<AshSwapchain>,
present_imag... |
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... |
//! caniuse.rs object structures.
//!
//! Definitions derived from https://github.com/jplatte/caniuse.rs/blob/e9c940047437cccfaf8ff65bcf68f70538877662/build.rs.
use std::{
cmp::{self, Ordering},
fmt,
};
use alfred::{Item, ItemBuilder, Modifier};
use serde::{Deserialize, Serialize};
use time::{macros::format_d... |
use super::scaling::{Bounds, GraphingBounds};
use bevy::render::mesh::{Indices, Mesh};
use bevy::render::render_resource::PrimitiveTopology;
use bevy::prelude::*;
use crate::axis_text::{MinAxisInfo, MidAxisInfo};
mod gen_expr_mesh;
pub use gen_expr_mesh::gen_expr_mesh;
#[derive(Clone, Debug)]
pub struct GridMeshHandl... |
use crate::types::{
Bs, Env, FunEnv, IdStatus, Overload, SigEnv, StrEnv, Sym, Syms, Ty, TyEnv, TyInfo, TyScheme,
TyVarKind, ValEnv, ValInfo,
};
use std::collections::BTreeMap;
use std::rc::Rc;
pub(crate) fn get() -> (Syms, Bs) {
let mut syms = Syms::default();
for sym in [Sym::INT, Sym::WORD, Sym::REAL, Sym::C... |
// Copyright 2021 <NAME> <<EMAIL>>
// All right reserved.
//
use keyberon::action::Action;
use keyberon::action::Action::*;
use keyberon::key_code::KeyCode;
use crate::event::KeyEvent;
use crate::event::KeyEvent::{Released, Pressed};
use crate::key_switch::KeySwitch;
use crate::reporter::Reporter;
use heapless::Vec;
... |
// https://www.codewars.com/kata/tiny-three-pass-compiler/train/rust
use std::slice::Iter;
use std::iter::Peekable;
use std::collections::HashMap;
#[derive(Clone, Debug)]
enum Ast {
BinOp(String, Box<Ast>, Box<Ast>),
UnOp(String, i64),
}
impl Ast {
fn imm(x: i64) -> Ast { Ast::UnOp("imm".to_string(), x) ... |
use super::{Atom, AtomData, AtomIdent, Ilst};
use crate::error::{LoftyError, Result};
use crate::id3::v1::constants::GENRES;
use crate::id3::v2::util::text_utils::utf16_decode;
use crate::mp4::atom_info::AtomInfo;
use crate::mp4::read::skip_unneeded;
use crate::types::picture::{MimeType, Picture, PictureType};
use std... |
#[macro_use]
extern crate log;
use rand::{Rng, SeedableRng};
// use dirichlet_fit::{GreedyOptimizer, Optimizer};
use rand_distr::{self, Distribution};
use rand_xoshiro::Xoshiro256PlusPlus;
fn gen_post_dist<R: Rng>(cl: usize, dim: usize, err: bool, rng: &mut R) -> Vec<f64> {
let mut param = vec![0.5f64; dim];
i... |
use std::error::Error;
use wasmer::{imports, wat2wasm, Instance, Module, Store};
use wasmer_compiler_cranelift::Cranelift;
use wasmer_engine_universal::Universal;
use wasmtime::*;
use anyhow::Result;
fn main() {
let nan = 0.0_f32 / 0.0;
let nan2 = -0.0_f32 / 0.0;
println!("nan signaling: {:?}", nan.to_be_b... |
use std::{
collections::HashSet,
future::Future,
net::SocketAddr,
pin::Pin,
sync::{Arc, Mutex},
task::{Context, Poll},
};
use chrono::Utc;
use futures::{channel::mpsc, prelude::*};
use tokio::net::TcpStream;
use tokio_util::codec::Framed;
use tower::Service;
use tracing::{span, Level};
use trac... |
mod outgoing;
pub mod websocket;
pub use remote::websocket::Connection;
use std::net::SocketAddr;
use std::collections::{HashSet, HashMap, BTreeSet};
use std::sync::{Arc};
use std::time::{Duration};
use proto::{ReceivedImage, AbortedImage};
use proto::{Registry};
use peers::Peer;
use index::{ImageId};
use {VPath};
u... |
use futures_util::future::try_join_all;
use std::path::Path;
use std::time::Duration;
use thiserror::Error;
use crate::acme::{Account, AcmeError, Auth, Directory, Identifier, Order};
use crate::crypto::{gen_acme_cert, get_cert_duration_left, sha256_hasher, CertBuilder};
use crate::fs::write;
use rustls::sign::Certifie... |
use crate::context::CmpContext;
use crate::context::KeyRefInfo;
use crate::context::ValidationContext;
use crate::core::Type;
use crate::core::TypeRef;
use crate::identifier::Identifier;
use crate::metadata::Meta;
use crate::metadata::MetadataSetter;
use crate::metadata::WithMetadata;
use crate::schema_builder::BuildsO... |
//! # Format
//!
//! The RFC defines the following format for the response header:
/*!
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Version = 2 |R| ... |
// 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... |
//! Evaluate core
//!
//! This might be by various strategies including delegating to
//! another implementation or interpreting core directly
use crate::{
common::{prettify, sourcemap::*},
core::expr::*,
driver::{error::EucalyptError, options::EucalyptOptions, source::SourceLoader},
eval::{
err... |
//! Provide userspace applications with a driver interface to asynchronous
//! GPIO pins. These are pins that exist on something like a GPIO extender or
//! a radio that has controllable GPIOs.
use core::cell::Cell;
use kernel::{AppId, Callback, Driver};
use kernel::ReturnCode;
use kernel::hil;
pub struct GPIOAsync<... |
use {
diesel::{PgConnection, QueryResult},
rand::{
thread_rng,
seq::SliceRandom
},
std::{
time::SystemTime,
iter::FromIterator,
collections::{VecDeque, HashSet}
},
crate::{
models::stopwatch::Stopwatch,
models::db::{
QuestionId,... |
// Copyright 2017 <NAME> <<EMAIL>> <<EMAIL>>
use std::cmp::*;
use std::marker::PhantomData;
use std::rc::Rc;
use pw_gix::{
gtk::{self, prelude::*, WidgetExt},
gtkx::dialog::*,
wrapper::*,
};
use colour_math_gtk::coloured::*;
use crate::app_name;
use crate::basic_paint::*;
use crate::colour::*;
use crate... |
//!
//! This is more or less just an initial implementation.
//! Currently, only from raw mutf8 and to utf8 operations are supported.
//! Ideally, this will turn into a "complete enough" mutf8 library for use in other libs/apps.
//!
mod mutf8;
#[cfg(feature = "use-structs")]
mod str;
pub use mutf8::mutf8_to_utf8;
pu... |
use std::collections::HashSet;
type SegmentDisplay = HashSet<char>;
#[derive(Debug, Clone)]
pub struct Entry {
patterns: [SegmentDisplay; 10],
output: [SegmentDisplay; 4],
}
#[aoc_generator(day8)]
pub fn input_generator(input: &str) -> Vec<Entry> {
input
.lines()
.map(|line| {
... |
/*
This tool is part of the WhiteboxTools geospatial analysis library.
Authors: Dr. <NAME>
Created: June 21, 2017
Last Modified: December 15, 2017
License: MIT
*/
use std;
use std::env;
use std::io::{Error, ErrorKind};
use std::path;
use lidar::*;
use tools::*;
pub struct LidarJoin {
name: String,
descriptio... |
use std::time::Duration;
use ::value::Value;
use compiler::state;
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
use indoc::indoc;
use vector_common::TimeZone;
use vrl::Runtime;
struct Source {
name: &'static str,
target: &'static str,
program: &'static str,
}
static... |
//! all the network related actions and processes
//!
//! This module only provides and handle the different connections
//! and act as message passing between the other modules (blockchain,
//! transactions...);
//!
mod grpc;
// TODO: to be ported
//mod ntt;
pub mod p2p_topology;
mod service;
use crate::blockcfg::Bl... |
//
//
//
//! Simple text input field
pub use surface::Colour;
pub use geom::Rect;
/// A single-line text input widget, supporting shadow text and optionally obscured input
#[derive(Default)]
pub struct TextInput<'a>
{
state: ::std::cell::RefCell<State>,
shadow: String,
obscure_char: Option<char>,
submit_cb: Option... |
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
use std::sync::Arc;
use parking_lot::Mutex;
use common::key::Key;
use common::value::account::{BlockTime, PublicKey};
use common::value::{Value, U512};
use engine_state::utils::WasmiBytes;
use execution::{self, Executor};
use shared::newtypes::{B... |
use std::borrow::Cow;
use clap::{ArgEnum, Clap};
use eyre::{eyre, Result};
use log::{debug, trace};
use prettytable::{cell, row, Cell, Row, Table};
use terminal_size::{terminal_size, Width};
use crate::border::Border;
use crate::utils::{
get_metadata, Pair,
};
use crate::utils::{date, path};
pub struct SizedTabl... |
use std::sync::Arc;
use super::{catalog_schema, SplittableTable};
use crate::datasource::{HBeeTableDesc, S3ParquetTable};
use crate::error::Result;
use crate::internal_err;
use crate::models::SizedFile;
use arrow::array::*;
use arrow::datatypes::*;
use arrow::record_batch::RecordBatch;
use async_trait::async_trait;
us... |
use std::{
ffi::OsString,
io::Write,
path::{Path, PathBuf},
process::{Child, Command, Output},
str::FromStr,
time::Duration,
};
use bitcoinsuite_test_utils::pick_ports;
use tempdir::TempDir;
use crate::{error::Result, BitcoindError};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Bitco... |
use {
colored::Colorize,
maxminddb::{self, Reader},
memmap::Mmap,
ntex::server::Server,
ntex::web::{types::Data, App, HttpServer},
peace_database::Database,
prometheus::{opts, IntCounterVec},
std::time::Instant,
// use actix_web_prom::PrometheusMetrics;
tokio::sync::mpsc::{unboun... |
// SPDX-License-Identifier: MIT OR Apache-2.0
//
// Copyright (c) 2020-2021 <NAME> <<EMAIL>>
//! Memory Management Unit.
#[cfg(target_arch = "aarch64")]
#[path = "../_arch/aarch64/memory/mmu.rs"]
mod arch_mmu;
mod mapping_record;
mod translation_table;
mod types;
use crate::{
bsp,
memory::{Address, Physical... |
//
// dc4 :: A Unix dc(1) implementation in Rust.
//
// This is the program entry point.
// It parses command line arguments and invokes the dc4 library.
//
// Copyright (c) 2015-2021 by <NAME>
//
#![deny(rust_2018_idioms)]
use std::env;
use std::fs::File;
use std::io;
use std::path::Path;
use dc4::Dc4;
use dc4::DcR... |
extern crate clap;
use atty::Stream;
use clap::{crate_authors, crate_description, crate_version, App, Arg};
use dataurl::DataUrl;
use std::env;
use std::fs;
use std::io::{self, prelude::*, Write};
pub fn read_stdin() -> Vec<u8> {
let mut buffer: Vec<u8> = vec![];
match io::stdin().lock().read_to_end(&mut buf... |
use crate::answers::{Answer, Answers, DictAnswers};
use crate::attempt::{Attempt, Attempts};
use crate::errors::Error;
use crate::options::Options;
use crate::tests::{Test, TestSuite};
use crate::Dict;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
/// Description of a game current state
pub struct Gam... |
use std::path::{Path, PathBuf};
use std::collections::HashMap;
use std::mem::MaybeUninit;
use std::fs::File;
use std::io::{Seek, Write};
use std::time::{Duration, Instant};
use ::afl_lib::*;
use ::cflib::*;
::cfg_if::cfg_if! {
if #[cfg(target_os = "windows")] {
mod windows;
use windows as os;
... |
use crate::error::Error;
use clap::{App, Arg, ArgGroup};
use std::fs;
// Todo: Add validators (i.e. min length for token & salt, etc)
// Todo: Remove `testing` and use compiler flags for identifying tests
pub struct Config {
pub address: [u8; 4],
pub db_name: String,
pub db_user: String,
pub db_password: Stri... |
use super::Solution;
use itertools::Itertools;
const FFT_PATTERN: [i32; 4] = [0, 1, 0, -1];
#[derive(Clone, Copy, Debug)]
struct FftPattern {
period: usize,
rep: usize,
idx: usize,
}
fn fft_pattern(period: usize) -> FftPattern {
FftPattern {
period: period,
rep: 0,
idx: 0,
... |
use std::f32::consts::{PI};
use cgmath::{Vector3, Vector2, Rad, Angle, InnerSpace};
use core::geom;
use core::position::{ExactPos, MapPos, SlotId, get_slots_count};
use core::dir::{Dir};
use core::game_state::{State};
use core::map::{Distance, spiral_iter};
use types::{VertexCoord, WorldPos, WorldDistance};
pub use co... |
//! # Mahalanobis Distance
//!
//! The Mahalanobis distance (MD) is the distance between two points in multivariate space.
//! In a regular Euclidean space the distance between any two points can be measured with [Euclidean distance](../euclidian/index.html).
//! For uncorrelated variables, the Euclidean distance equal... |
#[macro_use]
extern crate cpp;
extern crate libc; // TODO remove?
use std::{ptr, slice};
cpp!{{
#include "VHACD.h"
}}
pub struct ConvexHull<'a> {
pub points: &'a [[f64; 3]],
pub triangles: &'a [[u32; 3]],
pub volume: f64,
pub center: [f64; 3],
}
pub enum ConvexHullList {}
impl ConvexHullList {
... |
use proc_macro2::TokenStream;
use quote::{format_ident, quote};
use syn::{Attribute, Data, DeriveInput, GenericArgument, Ident, LitStr, Path, PathArguments, PathSegment, Token, Type, TypePath};
use syn::spanned::Spanned;
use syn::parse::{Parse, ParseStream};
#[derive(Default)]
struct Attrs {
each: Option<LitStr>,
... |
use serialport::{available_ports, SerialPort, SerialPortType};
use std::collections::{HashMap};
use std::env;
use std::thread;
use std::time::{Duration, SystemTime};
use std::ops::Sub;
use std::collections::VecDeque;
use std::sync::{Mutex, Arc};
/// Largest chunk of bytes to read from serial port in one read
const M... |
use std::{
any::TypeId,
sync::atomic::{AtomicUsize, Ordering},
};
use crate::{
managers::{MaterialKeyPair, MaterialManager, MeshManager},
types::{Object, ObjectHandle},
util::{frustum::BoundingSphere, registry::ArchetypicalRegistry},
};
use glam::{Mat4, Vec3A};
use rend3_types::{Material, MaterialH... |
use crate::protocol::MessageToInbox;
use crate::room::room_loop;
use crate::shared_room_data::SharedRoomData;
use chrono::Local;
use futures::channel::mpsc::{self, UnboundedSender};
use std::collections::HashMap;
use std::mem::swap;
use std::net::IpAddr;
use std::ops::Deref;
use std::sync::Arc;
use std::time::{SystemTi... |
// Copyright 2020-2022 <NAME>
// SPDX-License-Identifier: Apache-2.0
use std::any::Any;
use serde::Serialize;
use crate::did::CoreDID;
use crate::did::DID;
use identity_core::common::KeyComparable;
use identity_core::common::Object;
use identity_core::common::Timestamp;
use identity_core::crypto::merkle_key::Blake2b... |
use core::alloc::Layout;
use core::convert::TryFrom;
use core::iter;
use core::mem;
use core::ptr;
use core::slice;
use core::str;
use crate::borrow::CloneToProcess;
use crate::erts;
use crate::erts::exception::AllocResult;
use crate::erts::process::alloc::{HeapAlloc, TermAlloc};
use crate::erts::string::Encoding;
use... |
use crate::headers::from_headers::*;
use crate::prelude::*;
use crate::resources::trigger::*;
use crate::resources::Trigger;
use crate::ResourceQuota;
use azure_core::collect_pinned_stream;
use azure_core::headers::{etag_from_headers, session_token_from_headers};
use azure_core::prelude::*;
use azure_core::Response as ... |
//! Digest algorithm and operations.
use std::io;
use ring::digest;
use bcder::{decode, encode};
use bcder::encode::PrimitiveContent;
use bcder::Tag;
use crate::oid;
// Re-export the things from ring for actual digest generation.
pub use ring::digest::Digest;
//------------ DigestAlgorithm -------------------------... |
use std::rc::Rc;
use api::{WsResult, RoomId, GameId};
use log::{debug, error};
use wasm_bindgen_futures::spawn_local;
use yew::{
function_component, html, html::Scope, Callback, Component, Context, ContextProvider, Html,
Properties,
};
use yew_router::{
components::Redirect, history::History, prelude::Rout... |
use rustc_hir::{BinOpKind, Expr, ExprKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty;
use rustc_session::{declare_lint_pass, declare_tool_lint};
use clippy_utils::comparisons::{normalize_comparison, Rel};
use clippy_utils::consts::{constant, Constant};
use clippy_utils::diagnostics::span_lint_... |
use std::{path::PathBuf, process::Command, str};
use yansi::Paint;
use rbx_mantle::{
config::{load_project_config, TargetConfig},
project::{load_project, Project},
resource_graph::{EvaluateResults, ResourceGraph},
roblox_resource_manager::{RobloxInputs, RobloxOutputs, RobloxResource, RobloxResourceMan... |
// Copyright Materialize, Inc. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License... |
#[macro_use]
extern crate beehave;
extern crate rand;
// Example based on the example provided by http://machinejs.maryrosecook.com
use std::cell::RefCell;
use std::rc::Rc;
use std::thread;
use std::time::Duration;
use beehave::{ Sequence, Selector, ConditionalDecorator, Action, BehaviourNode };
#[derive(Clone)]
p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.