text stringlengths 3.09k 13.9k |
|---|
use chrono::prelude::*;
use failure::Error;
use serde::{Deserialize, Serialize};
use std::sync::mpsc;
use crate::downloader::DownloadRequest;
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Pin {
pub id: String,
pub title: String,
pub urls: Vec<String>,
pub description: String,
pub rend... |
use crate::diff::*;
use crate::levenshtein::distance;
use std::collections::{BTreeMap, HashSet};
pub type Mapping<'a> = BTreeMap<&'a str, &'a str>;
// TODO: Is it better to return a list of matches or a hashmap
// It might be better to do former because we may need to distinguise
// b/w full and partial match
#[deriv... |
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
use crate::{
ast::{Node, ProcTag},
compiler::Compiler,
lexer::Lexer,
parser::Parser,
primitive::*,
vm::{StackItem, VM},
};
fn position_var(sym: &Node, list: &Node) -> Option<isize> {
match list {
Node::List(lis... |
use crate::gl::{GLuint, glGetUniformLocation, GLint, GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, glCreateProgram, glAttachShader, glLinkProgram, glGetProgramiv, GL_LINK_STATUS, GL_INFO_LOG_LENGTH, glGetProgramInfoLog, glUseProgram, GLenum, glCreateShader, glShaderSource, glCompileShader, glGetShaderiv, GL_COMPILE_STATUS, glG... |
//! Global `Arc`-based object interning infrastructure.
//!
//! Eventually this should probably be replaced with salsa-based interning.
use std::{
collections::HashMap,
fmt::{self, Debug},
hash::{BuildHasherDefault, Hash, Hasher},
ops::Deref,
sync::Arc,
};
use dashmap::{lock::RwLockWriteGuard, Das... |
use crate::commands::wallet::get_wallet;
use crate::lib::environment::Environment;
use crate::lib::error::DfxResult;
use anyhow::Context;
use clap::Parser;
use num_traits::FromPrimitive;
use rust_decimal::Decimal;
const DECIMAL_POINT: char = '.';
/// Get the cycle balance of the selected Identity's cycles wallet.
#[... |
use super::consts::T1;
use super::key::TsxKey;
use super::{TsxRegistration, TsxResponse};
use crate::error::Error;
use crate::transport::{OutgoingParts, OutgoingRequest, TargetTransportInfo};
use crate::Result;
use crate::{Endpoint, Request};
use bytes::Bytes;
use sip_types::header::typed::CSeq;
use sip_types::header::... |
//! Utility methods for interacting with Win32 messages, message queues, and loops thereof.
//!
//! ### See Also
//! * [About Messages and Message Queues](https://docs.microsoft.com/en-us/windows/win32/winmsg/about-messages-and-message-queues)
//! * [Using Messages and Message Queues](https://docs.microsoft.com/en-us/w... |
// Copyright 2019 <NAME><<EMAIL>>
//
// 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... |
//! Access elevation data for a given GPS location using an external source
use crate::config::{FromServiceConfig, ServiceConfig};
use crate::db::QueryStringBuilder;
use crate::gps::Location;
use crate::Error;
use log::{info, warn};
use rusqlite::{params, Transaction};
mod opentopodata;
pub use opentopodata::OpenTopoD... |
use std::collections::HashMap;
use ndarray::{Array, Array1, Array2, ArrayBase, ArrayView, ArrayViewMut, Axis, CowArray, Data, DataMut, Dimension, Ix1, Ix2, Ix3, OwnedRepr, ViewRepr};
use super::{
AsMultiTargets, AsMultiTargetsMut, AsProbabilities, AsSingleTargets, AsSingleTargetsMut, AsTargets, AsTargetsMut, Counted... |
#![allow(non_upper_case_globals)]
use std::process::{Command, Output};
use std::str;
use crate::TmuxInterfaceError;
use crate::Version;
pub const _1_KEY: &str = "-1";
pub const _2_KEY: &str = "-2";
// constants for use as keys for subcommands
pub const a_KEY: &str = "-a";
pub const b_KEY: &str = "-b";
pub const c_... |
//! Tools for loading artifacts that contain compiled contracts.
//!
//! Artifacts come in various shapes and sizes, but usually they
//! are JSON files containing one or multiple compiled contracts
//! as well as their deployment information.
//!
//! This module provides trait [`Artifact`] that encapsulates different
... |
//! The rectangle shape tool
use druid::kurbo::Vec2;
use druid::piet::{FontBuilder, PietTextLayout, Text, TextLayout, TextLayoutBuilder};
use druid::{
Color, Env, EventCtx, KeyCode, KeyEvent, MouseEvent, PaintCtx, Point, Rect, RenderContext,
};
use crate::design_space::DPoint;
use crate::edit_session::EditSession... |
// Copyright 2019-2020 Twitter, Inc.
// Licensed under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
use std::convert::TryInto;
use std::sync::Arc;
use std::time::Duration;
use async_trait::async_trait;
use rustcommon_metrics::*;
use tokio::runtime::Runtime;
use tokio::time::{interval,... |
use super::object::Object;
//use crate::do_parse;
use crate::parser::*;
use crate::parser::combinators::*;
use std::str::{ FromStr };
use std::ops::Deref;
impl FromStr for Object {
type Err = ParseError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
parse_to_object(s)
}
}
pub fn magma() -> ... |
use aidungeon2_api::api::{start_options::*, story::*, AIDungeon, AIDungeonError};
use ansi_term::*;
use std::cmp::PartialOrd;
use std::io::Stdin;
use std::str::FromStr;
fn main() {
println!("AI Dungeon 2");
println!("--------------------------------");
println!("CLI version by <NAME> soptikha2/aidungeon2-c... |
use options::{parse_options, Options, Phase};
use std::path::{Path};
use std::process::{Command, Stdio};
use util::*;
use tempfile::{NamedTempFile};
use std::io::{Write, BufWriter};
use std::fs::{read_dir, create_dir_all};
use crossbeam::thread;
use std::env::current_dir;
use std::ffi::OsStr;
use ansi_term::Color;
mod... |
use crate::token::{
Boolean, Keyword, Modifier, Number, Operator, Parenthesis, PrimitiveType, Token,
};
use derive_more::Constructor;
use std::borrow::Cow;
use std::iter::Peekable;
use std::option::Option::Some;
use std::str::Chars;
#[cfg(test)]
mod tests;
#[derive(Default, Constructor)]
pub struct Lexer;
trait ... |
use num_enum::TryFromPrimitive;
/// Enumerate all device registers.
#[allow(dead_code, non_camel_case_types)]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[repr(u8)]
pub enum Register {
OUT_T = 0x0C,
INFO1 = 0x0D,
INFO2 = 0x0E,
WHOAMI = 0x0F,
OFF_X = 0x10,
OFF_Y = 0x11,
OFF_Z = 0x12,
... |
use std::path::PathBuf;
use anyhow::{anyhow, bail, Result};
use clap::{AppSettings::DeriveDisplayOrder, ArgEnum, Parser};
use rand::Rng;
use rattice::model::SortOrder;
const RANDOM_CHARSET: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ\
abcdefghijklmnopqrstuvwxyz\
... |
use std::convert::TryInto;
use std::io::{Read, Write};
use std::net::{Shutdown, SocketAddr, TcpStream};
use std::time::Duration;
use crate::bitfield;
use crate::handshake;
use crate::message;
use crate::p2p;
#[derive(Debug, Clone)]
pub enum ClientError {
ConnectionFailure,
BitfieldFailure,
PayloadFailure,... |
use arrayref::array_ref;
use bytes::Bytes;
use ethereum_types::{Address, H256};
use ethnum::U256;
use strum_macros::Display;
/// Message status code.
#[must_use]
#[derive(Clone, Debug, Display, PartialEq)]
pub enum StatusCode {
/// Execution finished with success.
#[strum(serialize = "success")]
Success,
... |
use super::slab::{
build_connections,
assign_stream,
};
use super::workerid::WorkerID;
use super::ipc::{
PresentRequests,
get_requests,
Requests,
Events,
build_ipc,
send_event,
send_futfillment,
};
use super::mio::{
PollOpt,
Poll,
Ready,
Events as EventBuff,
Token... |
use std::fmt::{Display, Formatter};
use std::ops::Deref;
use std::time::Instant;
/// A WeightedSum contains an averaging mechanism that accepts a varying weight at each
/// point to be averaged, and biases the mean based on those weights
#[derive(Clone, Copy, Debug, Default)]
pub struct WeightedSum {
total: f64,
... |
use super::HasSpan;
use super::Lookup;
use crate::parser::{ContextLevel, Parse, ParseErrorKind, ParseRes, Parser, Token};
use serde_derive::{Deserialize, Serialize};
use std::marker::PhantomData;
use std::ops::Range;
/// An interpolated string, which supports spaces in between and variables:
/// `@name.file is broken`... |
//! Defines the BxDF interface implemented by BRDF/BTDFs to describe
//! material properties. Also provides the BSDF type which composes
//! various BRDF/BTDFs to describe materials
use enum_set::{CLike, EnumSet};
use std::f32;
use std::mem;
use film::Colorf;
use linalg::{self, Vector};
use mc;
pub use self::bsdf::B... |
use std::convert::From;
use std::ops::Add;
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
pub enum MaskBit {
Zero,
One,
X,
}
impl From<char> for MaskBit {
fn from(bit: char) -> Self {
match bit {
'0' => Self::Zero,
'1' => Self::One,
'X' => Self::X,
... |
/*
Copyright 2021 Integritee AG and Supercomputing Systems AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or... |
pub struct ClientWindow {
window: winit::window::Window,
}
pub struct ClientState {
main: bool,
quit: bool,
start_time: std::time::Instant,
time: std::time::Instant,
frame_elapsed: std::time::Duration,
mouse_rel: uv::Vec2,
input_mode: InputMode,
key_held: [bool; 255],
}
#[derive... |
use filesize::PathExt;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::collections::LinkedList;
use std::ffi::OsStr;
use std::fs;
use std::io;
use std::path::Path;
#[derive(Deserialize, Serialize, Debug)]
struct FileExtensionSummary {
extension: String,
count: u32,
total_size: ... |
use ludus;
use ludus::NES_HEIGHT;
use ludus::NES_WIDTH;
use wasm_bindgen::prelude::*;
use wasm_bindgen::Clamped;
use web_sys::AudioContext;
use web_sys::{CanvasRenderingContext2d, ImageData};
#[wasm_bindgen]
pub fn height() -> u32 {
ludus::NES_HEIGHT as u32
}
#[wasm_bindgen]
pub fn width() -> u32 {
ludus::NES... |
use crate::{
coord::Coord,
modal_groups::{
CoordinateSystem, CutterCompensation, DistanceMode, FeedrateMode, Motion, NonModal,
PlaneSelect, Spindle, Stopping, Units,
},
parameter::Parameter,
value::Value,
word::parse_word,
Span,
};
use nom::{
branch::alt,
bytes::compl... |
pub mod database;
pub mod errors;
pub mod handle_db;
pub mod handle_tunnel;
pub mod io;
pub mod logger;
pub mod tunnel;
pub mod utils;
use errors::{DriverError, DriverManagerUnknownType};
use futures::executor::block_on;
use futures::future::pending;
use io::*;
use lazy_static::*;
use sentry_backtrace::current_stacktr... |
use crate::{PathI32, PathF64, PointF64, Spline};
#[derive(Debug)]
/// A collection of `Path` and `Spline` that represents a shape with holes
pub struct CompoundPath {
pub paths: Vec<CompoundPathElement>,
}
#[derive(Debug)]
/// An element of a `CompoundPath`
pub enum CompoundPathElement {
PathI32(PathI32),
... |
extern crate darkside;
extern crate dirs;
extern crate readability;
extern crate serde;
extern crate serde_json;
extern crate webbrowser;
mod article_viewer;
mod user_data;
mod util;
use feed_parser::{parser, Entry};
use serde::{Deserialize, Serialize};
use article_viewer::*;
use darkside::input::*;
use darkside::l... |
//! # embedded-nal - A Network Abstraction Layer for Embedded Systems
#![doc(html_root_url = "https://docs.rs/embedded-nal/0.2.0")]
#![no_std]
#![deny(missing_docs)]
#![deny(unsafe_code)]
pub use nb;
mod dns;
pub use dns::{AddrType, Dns};
pub use no_std_net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, Soc... |
use std::{
cmp::Ordering::*,
sync::{Arc, Barrier},
};
use serenity::{
model::{channel::Message, gateway::Ready, id::ChannelId},
prelude::*,
};
use crate::business;
mod shutdown_sender;
pub(crate) use self::shutdown_sender::shutdown_msg as send_sd_msg;
// TODO: load dynamicly
const TRADES_ID: Channel... |
use secp256k1::{Message, SecretKey};
use rustc_hex::ToHex;
use protobuf::{Message as OtherMessage};
use crate::keypair::PrivKey;
use crate::hasher::{Hasher, Hash};
use crate::types::{H256, U256, H160, ToVec};
use crate::transaction::{Transaction, UnverifiedTransaction, Crypto};
use super::sign;
use crate::eth::Eth;
//... |
//! A Mutex for the Future(s)
//!
//! API is similar to [`futures::sync::BiLock`](https://docs.rs/futures/0.1.11/futures/sync/struct.BiLock.html)
//! However, it can be cloned into as many handles as desired.
//!
extern crate futures;
extern crate parking_lot;
use std::ops::{Deref, DerefMut};
use futures::task::{self... |
use std::fs;
use gtk4::{gio::{ApplicationFlags, self}};
use libadwaita as adw;
use directories::{ ProjectDirs};
use adw::{prelude::*};
use gtk4::{Application};
use model::{init_tools, Tool, TOOLS, Size};
use ui::MainWindow;
mod model;
pub mod ui;
pub struct Settings {
font_path: Option<std::path::PathBuf>,
c... |
// Copyright 2017 LambdaStack 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 at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law... |
//! Serve the lorri daemon on a unix socket.
use crate::daemon::{IndicateActivity, LoopHandlerEvent};
use crate::run_async::Async;
use crate::socket::communicate;
use crate::socket::communicate::listener::{Connection, Listener};
use crate::socket::communicate::{CommunicationType, Ping, StreamEvents};
use crate::socket:... |
use crate::common::*;
use crate::term_buf::{num_cols, num_lines, place_string};
use crate::train::{Config, Train};
const D51HEIGHT: i32 = 10;
const D51FUNNEL: i32 = 7;
const D51LENGTH: i32 = 83;
const D51PATTERNS: i32 = 6;
const D51STR1: &str = " ==== ________ ___________ ";
const D51STR2: ... |
// Copyright 2014 The Gfx-rs 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 ag... |
#![allow(dead_code)]
use std::{net::{SocketAddr, UdpSocket}, thread, time::{Duration, Instant}};
use anyhow::Result;
use crate::{
self as lifx,
BuildOptions,
HSBK,
Message,
PowerLevel,
RawMessage,
udp::RefreshableData,
};
const HOUR: Duration = Duration::from_secs(60 * 60);
pub struct Bulb {
pub last_seen: ... |
use crate::svd::{Cluster, Register, RegisterCluster};
use inflections::Inflect;
use proc_macro2::{Literal, TokenStream};
use quote::ToTokens;
use std::borrow::Cow;
/// List of chars that some vendors use in their peripheral/field names but
/// that are not valid in Rust ident
const BLACKLIST_CHARS: &[char] = &['(', ')... |
//! Write some text for your users to read.
use crate::{
Element, Hasher, Layout, MouseCursor, Node, Point, Rectangle, Style, Widget,
};
use std::hash::Hash;
/// A fragment of text with a generic `Color`.
///
/// It implements [`Widget`] when the associated `Renderer` implements the
/// [`text::Renderer`] trait.
... |
// This file is part of guetzli-sys. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/guetzli-sys/master/COPYRIGHT. No part of guetzli-sys, including this file, may be copied, modified, propagated, or distri... |
// Copyright 2021 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT
// https://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD
// https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied,
// modified, or d... |
//! # Day 01: Chronal Calibration
//!
//! [Benchmarking report](../../../day01/target/criterion/report/index.html):
//!
//! * [Part 1](../../../day01/target/criterion/day01_part1/report/index.html)
//! * [Part 2](../../../day01/target/criterion/day01_part2/report/index.html)
//!
//!
//! ## Part One
//!
//! "We've detec... |
use crate::{
cluster::supervisor::Tokens,
node::supervisor::gen_node_id,
ring::{
Msb,
ShardCount,
DC,
},
};
use cdrs::{
compression::Compression,
frame::{
frame_result,
frame_supported,
traits::FromCursor,
Flag,
Frame,
IntoB... |
pub mod v4;
pub mod v6;
use crate::common::Result;
use crate::packets::checksum::PseudoHeader;
use crate::packets::Packet;
use failure::Fail;
use std::fmt;
use std::net::{IpAddr, Ipv4Addr};
/// Assigned internet protocol number
///
/// From https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
#[de... |
#[allow(unused_imports, deprecated)]
use std::ascii::AsciiExt;
use std::borrow::Cow;
use std::fmt;
use std::str::FromStr;
use chrono::{DateTime, Utc};
use url::form_urlencoded;
use dsn::Dsn;
use protocol;
use utils::{datetime_to_timestamp, timestamp_to_datetime};
/// Represents an auth header parsing error.
#[derive... |
use std::{
alloc::{Alloc, Layout},
any::Any,
fmt,
marker::Unsize,
mem::{forget, transmute, ManuallyDrop},
ops::{CoerceUnsized, Deref, DerefMut},
ptr::NonNull,
};
use crate::allocator::Block;
use crate::GC_ALLOCATOR;
/// A garbage collected pointer. 'Gc' stands for 'Garbage collected'.
///... |
/// Threshold Secret Sharing scheme
/// See https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing
/// Based on https://tools.ietf.org/id/draft-mcgrew-tss-03.html
use failure::Fail;
use crate::shamir::gf256::Gf256;
use std::convert::TryInto;
mod gf256;
#[derive(Debug, Fail)]
pub enum SecretShareError {
#[fail(d... |
#[doc = "Reader of register STARTSRP0"]
pub type R = crate::R<u32, super::STARTSRP0>;
#[doc = "Reader of field `SRPIO0_0`"]
pub type SRPIO0_0_R = crate::R<bool, bool>;
#[doc = "Reader of field `SRPIO0_1`"]
pub type SRPIO0_1_R = crate::R<bool, bool>;
#[doc = "Reader of field `SRPIO0_2`"]
pub type SRPIO0_2_R = crate::R<b... |
use std::fmt::Debug;
use std::sync::Arc;
use std::net::SocketAddr;
use anyhow::anyhow;
use bytes::BytesMut;
use common::{MessageFramedRead, MessageFramedWrite, NetAddress, PpaassError, RsaCryptoFetcher};
use futures::{SinkExt, StreamExt};
use tcp_connect::Socks5TcpConnectFlow;
use tokio::net::{TcpStream, UdpSocket};... |
#[doc = "Reader of register EFUSE_RD_RS_ERR0"]
pub type R = crate::R<u32, super::EFUSE_RD_RS_ERR0>;
#[doc = "Reader of field `EFUSE_KEY4_FAIL`"]
pub type EFUSE_KEY4_FAIL_R = crate::R<bool, bool>;
#[doc = "Reader of field `EFUSE_KEY4_ERR_NUM`"]
pub type EFUSE_KEY4_ERR_NUM_R = crate::R<u8, u8>;
#[doc = "Reader of field `... |
pub mod area_effect_cloud;
pub use area_effect_cloud::AreaEffectCloud;
pub mod armor_stand;
pub use armor_stand::ArmorStand;
pub mod arrow;
pub use arrow::Arrow;
pub mod bat;
pub use bat::Bat;
pub mod bee;
pub use bee::Bee;
pub mod blaze;
pub use blaze::Blaze;
pub mod boat;
pub use boat::Boat;
pub mod cat;
pub use cat:... |
// rseip
//
// rseip - Ethernet/IP (CIP) in pure Rust.
// Copyright: 2021, Joylei <<EMAIL>>
// License: MIT
use super::{
command::{self, Command},
framed::Framed,
EncapsulationPacket,
};
use crate::{codec::ClientCodec, *};
use byteorder::{ByteOrder, LittleEndian};
use bytes::{BufMut, Bytes, BytesMut};
use ... |
//
// potential.rs
// Copyright (C) 2019 <NAME> <<EMAIL>>
// Distributed under terms of the MIT license.
//
// This is an issue with the Derived traits
#![allow(clippy::type_repetition_in_bounds)]
use std::cmp::Ordering;
use std::fmt::Write;
use anyhow::Error;
use log::debug;
use serde::{Deserialize, Serialize};
us... |
#![warn(clippy::all)]
use std::fs;
use std::str::FromStr;
fn print_banner(msg: &str) {
let sep_length = msg.len() + 2;
println!("+{}+", "-".repeat(sep_length));
println!("| {} |", msg);
println!("+{}+", "-".repeat(sep_length));
}
fn count_if(vec: &[i32], val: i32) -> usize {
vec.iter().filter(|x|... |
//! Serialize/deserialize Timestamp type from and into string:
use serde::{de::Error as _, Deserialize, Deserializer, Serialize, Serializer};
use crate::google::protobuf::Timestamp;
use chrono::{DateTime, LocalResult, TimeZone, Utc};
use serde::ser::Error;
/// Helper struct to serialize and deserialize Timestamp into... |
//! # rust-miniscript integration test
//!
//! Read Miniscripts from file and translate into miniscripts
//! which we know how to satisfy
//!
use bitcoin;
use bitcoin::hashes::hex::ToHex;
use bitcoin::hashes::{hash160, ripemd160, sha256, sha256d, Hash};
use bitcoin::secp256k1;
use miniscript::Miniscript;
use miniscrip... |
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
use crate::fs as deno_fs;
use crate::installer::is_remote_url;
use deno_core::ErrBox;
use std;
use std::path::Path;
use std::path::PathBuf;
use url::Url;
fn is_supported(p: &Path) -> bool {
use std::path::Component;
if let Some(Component::... |
use crate::simulator::Simulator;
use ast::SourceLocation;
use generated_parser::{
reduce, AstBuilder, ErrorCode, ParseError, Result, StackValue, TerminalId, Token, TABLES,
};
const SPECIAL_CASE_MASK: i64 = 0x3fff_ffff_ffff_ffff;
const ACCEPT: i64 = 0x_bfff_ffff_ffff_ffff_u64 as i64;
const ERROR: i64 = ACCEPT - 1;
... |
use bob::{
build_info::BuildInfo, init_counters, BobApiServer, BobServer, ClusterConfig, Factory, Grinder,
VirtualMapper,
};
use clap::{crate_version, App, Arg, ArgMatches};
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use tokio::runtime::Handle;
use tonic::transport::Server;
#[macro_use]
extern crate log;
#... |
#[cfg(feature = "client")]
use std::path::PathBuf;
use clap::{IntoApp, Subcommand};
use eyre::{Result, WrapErr};
#[cfg(feature = "client")]
use atuin_client::database::Sqlite;
#[cfg(feature = "client")]
use atuin_client::settings::Settings as ClientSettings;
#[cfg(feature = "client")]
use atuin_common::utils::uuid_v4... |
//! Iterators over types.
use core::ops;
use misc::Contained;
use uncon::*;
mod private {
use super::*;
pub trait Iterable: Sized {
type Raw: Copy + Ord + Sized + From<u8> + Into<usize> + ops::Add<Output=Self::Raw>;
const MIN: Self::Raw;
const MAX: Self::Raw;
fn raw(self) -... |
use std::path::PathBuf;
use std::sync::{Arc, Mutex};
#[derive(Debug, Default, Clone)]
struct BazelExecutable {
executable: PathBuf,
}
impl BazelExecutable {
pub fn new(executable: &str) -> Self {
BazelExecutable{executable: PathBuf::from(executable)}
}
fn call_bazel(&self, command: Vec<String>, cwd: &Pa... |
/***********************************************************************
* proto-system/src/server.rs
* Prototype for development of an initial Elliott 503 operator
* control panel with pushbottons and lamps.
* Copyright (C) 2020, <NAME>.
* Licensed under the MIT License, see
* http://www.opensource.org/licen... |
// M_2_5_02
//
// Generative Gestaltung – Creative Coding im Web
// ISBN: 978-3-87439-902-9, First Edition, Hermann Schmidt, Mainz, 2018
// <NAME>, <NAME>, <NAME>, <NAME>
// with contributions by <NAME> and <NAME>
// Copyright 2018
//
// http://www.generative-gestaltung.de
//
// Licensed under the Apache License, Versi... |
#![allow(unused_variables, dead_code)]
use itertools::Itertools;
use std::convert::TryInto;
const NUM_TILES: usize = 25;
#[derive(Clone)]
pub struct Board {
// All in row-major order
tiles: [u32; NUM_TILES],
marked: [bool; NUM_TILES],
}
impl Board {
fn from_tiles(tiles: &[u32]) -> Self {
Sel... |
use std::collections::HashMap;
use crossbeam_channel::Sender;
use slog::info;
use crate::{
program_version::PerfBufferSize, set_memlock_limit, ArrayMap, BpfHashMap, DebugfsMountOpts,
OxidebpfError, PerfChannelMessage, ProgramBlueprint, ProgramVersion, SchedulingPolicy, LOGGER,
};
/// A group of eBPF [`Progra... |
use std::collections::HashMap;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
enum Target {
B(usize),
O(usize),
None,
}
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
struct Bot {
values: Vec<usize>,
hi: Target,
lo: Target,
}
impl Bot {
fn new() -> Bot ... |
use std::{io::Cursor, net::SocketAddr, sync::{Arc, atomic::{AtomicBool, Ordering}}};
use tokio::{io::{AsyncReadExt, AsyncWriteExt}, net::{TcpStream, tcp::{OwnedReadHalf, OwnedWriteHalf}}, sync::mpsc};
use crate::iproto::{request::Request, response::Response};
use super::{RespChans, connector::Connector};
pub(crat... |
use ffi::ares_socket_t;
use std::os::raw::c_int;
// Library initialization flags
pub const ARES_LIB_INIT_NONE: c_int = (0);
pub const ARES_LIB_INIT_WIN32: c_int = 1;
pub const ARES_LIB_INIT_ALL: c_int = (ARES_LIB_INIT_WIN32);
// Error codes
pub const ARES_SUCCESS: c_int = 0;
pub const ARES_ENODATA: c_int = 1;
pub con... |
#![no_std]
#![no_main]
use testsuite as _;
use stm32f3xx_hal as hal;
use hal::gpio::{OpenDrain, PushPull, AF7};
use hal::pac;
use hal::prelude::*;
use hal::serial::Serial;
use hal::{
gpio::{
gpioa::{PA10, PA2, PA3, PA9},
gpiob::{PB10, PB11},
},
rcc::{Clocks, APB2},
};
use core::array::In... |
use std::f32;
use std::time::Instant;
use rand::random;
use indicatif::{ProgressBar, ProgressStyle};
extern crate raytracer;
use raytracer::core::vec3::*;
use raytracer::core::ray::*;
use raytracer::core::hitable::*;
use raytracer::core::hitable_list::*;
use raytracer::core::material::*;
use raytracer::core::sphere::*... |
use core::convert::TryInto;
use svd_parser as svd;
use crate::{ir, translate::svd as translate};
pub fn device<'a>(d: &'a svd::Device, whitelist: &[&str]) -> ir::Device<'a> {
let defaults = &d.default_register_properties;
let mut peripherals = vec![];
for periph in &d.peripherals {
if whitelist.c... |
#![feature(env,old_io,old_path,os)]
#![feature(collections)]
#![feature(core)]
extern crate mesh;
extern crate getopts;
extern crate nalgebra;
use std::old_io::BufferedReader;
use std::old_io::fs::File;
use std::old_path::Path;
use mesh::StlFile;
use mesh::AmfFile;
use mesh::POV;
use mesh::Mesh;
use mesh::Vector3D;
u... |
use crate::{
body::AsyncBody,
config::{request::RequestConfig, RedirectPolicy},
error::{Error, ErrorKind},
handler::RequestBody,
interceptor::{Context, Interceptor, InterceptorFuture},
request::RequestExt,
};
use http::{header::ToStrError, HeaderValue, Request, Response, Uri};
use std::{borrow::... |
use crate::model::inline::HasInlineContent;
use regex::Regex;
#[cfg(feature = "fmt_json")]
use serde::{Deserialize, Serialize};
use std::fmt::{Display, Formatter};
use std::ops::Deref;
use std::str::FromStr;
// ------------------------------------------------------------------------------------------------
// Public T... |
//! Functionality related to parsing 'ENUMERATED' ASN.1 Type
use crate::error::Error;
use crate::tokenizer::Token;
use crate::parser::utils::{expect_keyword, expect_one_of_tokens, expect_token};
use crate::parser::asn::structs::types::base::{Asn1TypeEnumerated, EnumValue};
use super::utils::parse_named_maybe_value;... |
use std::env;
use std::process;
fn make_three_tris(p1: (u32, u32), p2: (u32, u32), p3: (u32, u32)) -> [(u32, u32); 9] {
let mleft = ( (p1.0 + p2.0) / 2, (p1.1 + p2.1) / 2);
let mbottom = ( (p2.0 + p3.0) / 2, (p2.1 + p3.1) / 2);
let mright = ( (p3.0 + p1.0) / 2, (p3.1 + p1.1) / 2);
[p1, mleft, mright, ... |
//! Angle (dimensionless quantity).
quantity! {
/// Angle (dimensionless quantity).
quantity: Angle; "angle";
/// Dimension of angle, 1 (dimensionless).
dimension: ISQ<
Z0, // length
Z0, // mass
Z0, // time
Z0, // electric current
Z0, // therm... |
// Copyright 2021 The Matrix.org Foundation C.I.C.
//
// 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... |
use rustc_hash::FxHashMap;
use image::ImageBuffer;
use image::DynamicImage;
use image::GenericImage;
use image::GenericImageView;
use super::TextureError;
use super::TextureObject;
use super::TextureObjectBuilder;
use std::rc::Rc;
pub struct TextureAtlasBuilder {
texture: DynamicImage,
width: u32,
height: ... |
use std::borrow::Cow;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PunctuatorToken {
CurlyOpen, // {
CurlyClose, // }
ParenOpen, // (
ParenClose, // )
SquareOpen, // [
SquareClose, // ]
Semicolon, // ;
Comma, // ,
Tilde, // ~
Question, // ?
Colon, // :
Period, // .
Ellipsis, // ...
... |
//! Command line arguments.
use {
std::{
net::SocketAddr,
path::{Path, PathBuf},
},
structopt::StructOpt,
viceroy_lib::Error,
};
// Command-line arguments for the Viceroy CLI.
//
// This struct is used to derive a command-line argument parser. See the
// [structopt](https://docs.rs/str... |
use std::net::IpAddr;
use std::path::PathBuf;
use std::str::FromStr;
use bytes::Bytes;
use destream::de::FromStream;
use futures::{future, stream, TryFutureExt};
use structopt::StructOpt;
use tokio::time::Duration;
use tc_error::*;
use tc_transact::{Transact, TxnId};
use tc_value::{LinkHost, LinkProtocol};
use tinyc... |
use core::{
cmp::{Ord, Ordering},
fmt,
};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use necsim_core_bond::{NonNegativeF64, NonZeroOneU64, PositiveF64};
use crate::{
cogs::{
backup::BackedUp, coalescence_sampler::CoalescenceRngSample, Backup, Habitat,
LineageReference,... |
use crate::{
draw::{Context, LINE_HEIGHT},
font, m8,
};
pub use crate::{
nav_item::{Action, Direction, Edit, Input, Item},
nav_page::Page,
};
const MENU_X: i32 = 288;
const MENU_Y: i32 = 200;
#[derive(Debug)]
pub struct Navigation {
pages: Vec<Page>,
page: (usize, isize),
changed: bool,
}
impl Navigation {
... |
// Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0.
use std::error::Error;
use std::path::Path;
use std::result::Result;
use serde::{Deserialize, Serialize};
use engine_rocks::raw::DBCompressionType;
use security::SecurityConfig;
use tikv::config::{log_level_serde, DbConfig, MetricConfig};
use tikv_ut... |
use crate::Result;
use anyhow::Context;
use serde_yaml::{Mapping, Sequence, Value as YamlValue};
use std::collections::{HashMap, HashSet};
use std::convert::TryFrom;
pub static COMMON_DEPS_KEY: &str = "all";
type DepsMap = HashMap<String, HashSet<String>>;
#[derive(Clone, Debug, PartialEq)]
pub struct Dependencies ... |
use std::cmp::{max, min};
use std::ops::{Index, IndexMut, RangeInclusive};
use itertools::*;
type Line = (String, i32, i32, i32, i32, i32, i32);
fn parse(line: &str) -> Line {
{
let mut iter = line
.split("..")
.flat_map(|s| s.split(" x="))
.flat_map(|s| s.split(",y="))... |
use crate::message as msg;
use crate::simulation::Simulation;
use crate::slave::SlavePLm;
use crate::stm_simple_tm_es::STMSimplePayloadTypes;
use rand::{RngCore, SeedableRng};
use rand_xorshift::XorShiftRng;
use runiversal::common::mk_qid;
use runiversal::model::common::{EndpointId, SlaveGroupId};
use runiversal::simul... |
use crate::{
diagnostics::{DiagnosticReporter, DiagnosticReporterExt},
parse::Ast,
Location,
};
use codespan::FileId;
use slog::Logger;
use specs::{prelude::*, Component};
use std::{
collections::HashMap,
fmt::{self, Debug, Formatter},
};
use syntax::ast::{self, AstNode, Dim, Line};
/// Turns an AS... |
#[doc = "Reader of register ACS_WAKEUP_STATE"]
pub type R = crate::R<u32, super::ACS_WAKEUP_STATE>;
#[doc = "Status register indicates the last wake-up source\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum WAKEUP_SRC_A {
#[doc = "7: The last wake-up was due to the DCDC overload... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.