text stringlengths 3.09k 13.9k |
|---|
//! gRPC service implementations for `ingester`.
use crate::handler::IngestHandler;
use arrow_flight::{
flight_service_server::{FlightService as Flight, FlightServiceServer as FlightServer},
Action, ActionType, Criteria, Empty, FlightData, FlightDescriptor, FlightInfo,
HandshakeRequest, HandshakeResponse, ... |
//! This calculates the types which has storage which lives across a suspension point in a
//! generator from the perspective of typeck. The actual types used at runtime
//! is calculated in `rustc_mir::transform::generator` and may be a subset of the
//! types computed here.
use rustc::hir::def_id::DefId;
use rustc::... |
//! Multilevel feedback queue scheduler for Tock
//!
//! Based on the MLFQ rules described in "Operating Systems: Three Easy Pieces"
//! by <NAME> and <NAME>.
//!
//! This scheduler can be summarized by the following rules:
//!
//! - Rule 1: If Priority(A) > Priority(B), and both are ready, A runs (B
//! does... |
use crate::{
gui::{BuildContext, Ui, UiMessage, UiNode},
scene::commands::{
light::{
SetLightCastShadowsCommand, SetLightColorCommand, SetLightScatterCommand,
SetLightScatterEnabledCommand,
},
SceneCommand,
},
send_sync_message,
sidebar::{
ligh... |
//! This crate simplifies the generation of valid Prometheus metrics. You should start by building
//! a [`PrometheusMetric`] and then adding as many [`PrometheusInstance`] as needed.
//!
//! [`PrometheusMetric`] specifies the [`counter name`], [`type`] and [`help`]. Each [`PrometheusInstance`]
//! specifies the [`valu... |
use anyhow::{Context, Result};
use clap::{Parser, Subcommand};
use client::Client;
use clients::*;
use delay::retry_if_err;
use futures::future::FutureExt;
use futures::stream::{FuturesUnordered, StreamExt};
use jobs::{Job, JobRunner};
use log::{error, info};
use realtps_common::{
chain::{Chain, ChainType},
db:... |
/*
* Copyright 2021 Fluence Labs Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
//! Defines the `Reload` trait.
use std::{sync::Arc, time::Instant};
use amethyst_core as core;
use amethyst_core::{
specs::prelude::{DispatcherBuilder, Read, Resources, System, Write},
SystemBundle, Time,
};
use crate::{Asset, Format, FormatValue, Loader, Result, Source};
/// This bundle activates hot relo... |
use anyhow::{anyhow, Result};
use r2d2::Pool;
use r2d2_sqlite::SqliteConnectionManager;
use rusqlite::{params, ToSql};
use rusqlite::{Connection, Error::QueryReturnedNoRows, NO_PARAMS};
use serde::{Deserialize, Serialize};
use std::path::{Path, PathBuf};
use std::str::FromStr;
pub type Pond = Pool<SqliteConnectionMana... |
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
mod op_fetch_asset;
use deno_core::js_check;
use deno_core::JsRuntime;
use deno_core::RuntimeOptions;
use std::collections::HashMap;
use std::env;
use std::path::Path;
use std::path::PathBuf;
fn create_snapshot(
mut isolate: JsRuntime,
sn... |
use crate::timeline::Timeline;
use std::time::{Duration, SystemTime};
/// Identify a slot in a *specific* timeframe
///
/// The slots are not comparable to others slots made on a
/// different time frame
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Slot(pub(crate) u64);
impl From<u64> for ... |
use crate::infrastructure::{config, graphql, repositories, security};
use actix_web::{dev, error, web, Error, FromRequest, HttpRequest, HttpResponse, Result};
use futures_util::future::{FutureExt, LocalBoxFuture};
use graphql_parser::query;
use juniper::{http, DefaultScalarValue, InputValue, ScalarValue};
use serde::{D... |
// Rust JSON-RPC Library
// Written in 2015 by
// <NAME> <<EMAIL>>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This software is distributed without
// any warranty.
//
// You should have ... |
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use super::select::{self, Select};
use bach::{
executor::{self, JoinHandle},
time::scheduler,
};
use core::{pin::Pin, task::Poll};
use s2n_quic_core::{endpoint::Endpoint, inet::SocketAddress};
type Err... |
use crate::constants::{
AUTH_URL, CLIENT_ID, CLIENT_SECRET, HASH_SECRET, USER_AGENT, X_CLIENT_HASH, X_CLIENT_TIME,
};
use crate::errors::AuthError;
use crate::pixiv::helper_structs::illustration::Illustration;
use crate::pixiv::request::PixivRequest;
use http::{header, status::StatusCode};
use md5;
use reqwest::{C... |
use {
bet::BeTree,
regex::{self, Regex},
thiserror::Error,
};
#[derive(Debug, Error)]
pub enum StrFilterParseError {
#[error("invalid pattern {0:?} : {1}")]
InvalidPattern(String, String),
#[error("invalid regex {0:?}")]
InvalidRegex(#[from] regex::Error),
}
/// Query operators.
/// `And... |
// Copyright 2019 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 crate::common::Adapter;
use crate::fidl_clone::*;
use failure::{format_err, Error};
use fidl_fuchsia_setui::*;
use fuchsia_syslog::fx_log_err;
use futu... |
// Copyright 2014 The CGMath Developers. For a full listing of the authors,
// refer to the AUTHORS file at the top-level directory of this distribution.
//
// 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 ... |
use std::{
collections::HashMap,
fmt,
hash::Hash,
iter::FromIterator,
ops::{Add, Index, IndexMut},
slice, vec,
};
use derive_more::{AsRef, From};
use serde::{Deserialize, Serialize};
use super::Weight;
/// The index of a validator, in a list of all validators, ordered by ID.
#[derive(Copy, Cl... |
use winapi::um::winnt::HANDLE;
use winapi::um::winuser::IMAGE_BITMAP;
use crate::win32::resources_helper as rh;
use crate::{OemBitmap, OemImage, NwgError};
use std::ptr;
#[cfg(feature = "embed-resource")]
use super::EmbedResource;
/**
A wrapper over a bitmap file (*.bmp)
Note that Bitmap object are only used as dis... |
use std::collections::{HashMap, HashSet};
use syntax::parse::lexer::comments::CommentStyle;
use syntax::source_map::{DUMMY_SP, Span};
use crate::c_ast::{CDeclId, CDeclKind, CommentContext, SrcLoc, TypedAstContext};
use crate::c_ast::iterators::{NodeVisitor, SomeId};
use crate::rust_ast::pos_to_span;
use crate::rust_ast... |
use num::FromPrimitive;
use terminal::Terminal;
use key::Key;
/// `Event` is an event of termfest, that contains special key pressed, character input, and window
/// resize.
#[derive(Debug, Clone)]
pub enum Event {
/// `Key` is an event that notify a special key (e.g. ctrl-A, Space, Enter) is pressed.
Key(Key... |
use byte_strings::c_str as c;
use log::*;
#[allow(unused_imports)]
use std::ffi::CString;
use std::ops::Deref;
use std::path::PathBuf;
#[allow(unused_imports)]
use std::ptr::{null, null_mut};
use structopt::StructOpt;
use wide_literals::w;
use widestring::WideCString;
use winapi::{
shared::minwindef::FALSE,
sha... |
use std::{fs::File, path::Path, sync::Arc};
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
use probe_rs::{
flashing::{FlashLoader, FlashProgress, Format},
Session, Target,
};
use probe_rs_cli_util::logging;
use crate::{config::Config, diagnostics::RoverError};
/// Performs the flash download wit... |
// Copyright 2015-2018 Aerospike, 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 t... |
// Copyright 2021 UINB Technologies Pte. Ltd.
// 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... |
//! Rome's official formatter.
//!
//! The crate exposes some API and utilities to implement the formatting logic.
//!
//! The formatter relies on an [IR], which allows to format any kind of data structure.
//!
//! In order to implement the formatting logic, you need to implement the trait [FormatValue] for
//! the dat... |
pub struct Scanner<R: std::io::Read> {
reader: R,
}
impl<R: std::io::Read> Scanner<R> {
/// let stdin = std::io::stdin();
/// let mut sc = Scanner::new(stdin.lock());
pub fn new(reader: R) -> Self { Self { reader: reader } }
pub fn scan<T: std::str::FromStr>(&mut self) -> T {
use std::io::... |
/*
* Copyright 2018 OysterPack 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 applicabl... |
use log::{debug, info};
use serde_derive::{Serialize, Deserialize};
use serde_json::Value;
use crate::comment::submit_comment;
use crate::OAUTH_REDDIT_URL;
use crate::reddit_client::{AuthRedditClient, DeleteRequest};
use crate::user::User;
#[derive(Serialize, Deserialize, Debug)]
pub struct Posts {
pub main_post_i... |
use crate::Jira;
use crate::Jira::types::{JiraIssue, JiraIssueLight};
use contrast;
use md5::{Digest, Md5};
use napi::{CallContext, Env, Error as NapiError, JsObject, JsString, JsUnknown, Status};
use rgb::RGB;
use std::fmt::Write;
#[derive(Serialize, Debug, Deserialize)]
struct IssueLabelDetail {
color: Option<St... |
//! Database used for testing `hir_def`.
use std::{
fmt, panic,
sync::{Arc, Mutex},
};
use base_db::{
salsa, AnchoredPath, CrateId, FileID, FileLoader, FileLoaderDelegate, FilePosition,
SourceDatabase, Upcast,
};
use hir_expand::{db::AstDatabase, InFile};
use rustc_hash::FxHashSet;
use syntax::{algo, ... |
use std::{
convert::TryFrom,
marker::PhantomData,
ops::{Deref, DerefMut},
os::unix::io::{AsRawFd, RawFd},
};
use crate::{
generated::bpf_map_type::BPF_MAP_TYPE_SOCKHASH,
maps::{
hash_map, sock::SocketMap, IterableMap, Map, MapError, MapIter, MapKeys, MapRef, MapRefMut,
},
sys::b... |
mod writer;
mod resolver;
use actix::prelude::*;
use log::*;
use std::net::{SocketAddr};
use tokio::net::TcpStream;
use std::io::{Error};
use crate::cluster::{Cluster, NodeEvents, Gossip};
use crate::codec::{ClusterMessage, ConnectCodec};
use crate::remote::{RemoteAddr, RemoteWrapper, AddrRepresentation, AddrResolver... |
use common_macros::b_tree_map;
use dune::{Environment, Error, Expression};
pub fn get() -> Expression {
(b_tree_map! {
String::from("strip") => Expression::builtin("strip", |args, env| {
super::check_exact_args_len("strip", &args, 1)?;
Ok(crate::strip_ansi_escapes(args[0].eval(env)?... |
use darling::{FromField, FromVariant};
use proc_macro2::TokenStream;
use quote::{format_ident, quote, quote_spanned};
use syn::{spanned::Spanned, Data, DeriveInput};
#[derive(Default, FromMeta)]
struct DisplayFieldOpts {
/// Skip formatting this field or variant
#[darling(default)]
skip: bool,
/// Use ... |
// Copyright 2019 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... |
use std::sync::atomic::{AtomicBool, Ordering};
use futures::channel::mpsc::UnboundedSender;
use log::{debug, error};
use tentacle::{
context::ServiceContext,
error::Error as TentacleError,
multiaddr::Multiaddr,
service::{ServiceError, ServiceEvent},
traits::ServiceHandle,
};
use crate::{
error... |
use std::*;
use std::fs::File;
use std::io::prelude::*;
extern crate rand;
use rand::Rng;
mod triangular;
use triangular::TriangularMatrix;
trait RandomGenerator {
fn next_random(&mut self) -> f64;
}
struct RustRand {
generator: rand::ThreadRng
}
impl RustRand {
fn new() -> RustRand {
RustRand{... |
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
//! autodiscovery-rs provides a function to automatically detect and connect to peers.
//!
//! # Examples
//!
//! ```rust,no_run
//! use std::net::{TcpListener, TcpStream};
//! use std::thread;
//! use autodiscover_rs::Method;
//! use env_logger;
//!
//! fn handle_client(stream: std::io::Result<TcpStream>) {
//! pr... |
// Copyright 2019 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::{format_err, Context as _, Error};
use bt_a2dp as a2dp;
use fidl_fuchsia_media::{AudioFormat, AudioUncompressedFormat, DomainFormat, PcmFormat}... |
// Copyright 2019 Parity Technologies (UK) Ltd.
//
// 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, ... |
use proc_macro2::TokenStream;
use syn::spanned::Spanned;
use syn::{
Attribute, Data, DeriveInput, Fields, GenericArgument, Ident, Index, Member, Meta, NestedMeta,
PathArguments, Type,
};
pub fn expand_com_wrapper(input: &DeriveInput) -> Result<TokenStream, String> {
let fields = match &input.data {
... |
#![allow(clippy::too_many_arguments)]
#![allow(dead_code, unused_variables, unused_imports)]
#[macro_use]
extern crate juniper;
use assert_json_diff::assert_json_include;
use chrono::prelude::*;
use juniper::{Executor, FieldResult, Variables, ID};
use juniper_from_schema::{graphql_schema, graphql_schema_from_file};
u... |
use crate::{day_solver::DaySolver, util::*};
pub struct Day4;
#[derive(derive_builder::Builder, Copy, Clone)]
pub struct Passport<'a> {
birth_year: &'a [u8],
issue_year: &'a [u8],
exp_year: &'a [u8],
height: &'a [u8],
hair_color: &'a [u8],
eye_color: &'a [u8],
pass_id: &'a [u8],
}
impl<'a... |
use std::path::Path;
use crate::lib::error::DfxResult;
use super::identity_manager::EncryptionConfiguration;
use super::identity_utils;
use super::IdentityConfiguration;
use aes_gcm::aead::{Aead, NewAead};
use aes_gcm::{Aes256Gcm, Key, Nonce};
use anyhow::{anyhow, Context};
use argon2::{password_hash::PasswordHasher... |
// Zinc, the bare metal stack for rust.
// Copyright 2014 <NAME> <<EMAIL>>
//
// 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
//
// Unles... |
#![allow(dead_code, unused_variables, unused_imports)]
extern crate cairo;
extern crate gtk;
extern crate glib;
extern crate gio;
use std::time::{SystemTime, Duration};
use std::cell::RefCell;
use std::rc::Rc;
use gtk::prelude::*;
use gio::prelude::*;
use gtk::{Window, WindowType, Button, DrawingArea};
use cairo::{... |
use std::f64::INFINITY;
use serde::{Deserialize, Serialize};
use super::AsModel;
use super::ModelMessage;
use crate::input_modeling::random_variable::ContinuousRandomVariable;
use crate::input_modeling::Thinning;
use crate::simulator::Services;
use crate::utils::error::SimulationError;
use crate::utils::{populate_his... |
//! password.rs: Password hashing functionality and password-based key derivation
//!
//! scrypt is presently the only supported password hashing function / KDF
//!
use alg::PasswordAlg;
use errors::*;
use pwhash::scrypt::{self, ScryptParams};
use ring::constant_time;
use ring::rand::SecureRandom;
use rpassword;
// S... |
use ::actix_web::http::StatusCode;
use ::actix_web::HttpResponse;
use ::chrono::prelude::*;
use ::config::*;
use ::handlebars::Handlebars;
use ::log::{info, warn};
use ::serde::Deserialize;
use ::shellexpand::tilde;
use ::std::collections::HashMap;
use ::std::path::Path;
use ::std::process;
use crate::messages::NewTas... |
use crate::sockets::*;
use crate::units::*;
use std::path::PathBuf;
pub fn parse_socket(
parsed_file: ParsedFile,
path: &PathBuf,
chosen_id: UnitId,
) -> Result<Unit, ParsingErrorReason> {
let mut socket_configs = None;
let mut install_config = None;
let mut unit_config = None;
let mut exec... |
use ark_bls12_381::{Fr, G1Projective};
use ark_bls12_381::Bls12_381;
use ark_ec::PairingEngine;
use ark_ec::AffineCurve;
use ark_poly::univariate::DensePolynomial as DensePoly;
use num_traits::identities::Zero;
use ark_poly_commit::kzg10::{Commitment, Powers, Proof, UniversalParams, VerifierKey, KZG10};
use rand_chacha... |
use crate::{Level, Status, Task};
use rosrust::Time;
use std::collections::VecDeque;
use std::sync::Mutex;
/// The structure for building a frequency status task.
///
/// Use `FrequencyStatus::builder()` to create an instance of this structure.
pub struct FrequencyStatusBuilder<'a> {
min_frequency: f64,
max_fr... |
use std::cmp::Ordering;
use time::format_description::FormatItem;
use time::macros::format_description;
use time::PrimitiveDateTime;
use duct::cmd;
use once_cell::sync::Lazy;
use regex::Regex;
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct ProcessInfo {
pub pid: i32,
pub ppid: i32,
pub uid: u32,
pu... |
// MIT License
// Copyright (c) 2017 <NAME>
// 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, p... |
use std::{
ffi::OsStr,
fs,
path::{Path, PathBuf},
sync::Mutex,
};
use anyhow::{Context, Result};
use beam_file::{
chunk::{AtomChunk, ExpTChunk, ImpTChunk, StandardChunk},
StandardBeamFile,
};
use lazy_static::lazy_static;
use rayon::prelude::*;
use regex::Regex;
use crate::types::{AppDeps, App... |
use std::collections::HashMap;
use geom::{Circle, Distance, Pt2D, Speed};
use map_gui::tools::{nice_map_name, CityPicker};
use map_gui::{SimpleApp, ID};
use map_model::{BuildingID, BuildingType};
use widgetry::{
lctrl, Btn, Checkbox, Color, Drawable, EventCtx, GeomBatch, GfxCtx, HorizontalAlignment, Key,
Line,... |
//! # interledger-btp
//!
//! Client and server implementations of the [Bilateral Transport Protocol (BTP)](https://github.com/interledger/rfcs/blob/master/0023-bilateral-transfer-protocol/0023-bilateral-transfer-protocol.md).
//! This is a WebSocket-based protocol for exchanging ILP packets between directly connected ... |
#![allow(dead_code)]
use jelly_mem_access::*;
const REG_DMA_STATUS: usize = 0;
const REG_DMA_WSTART: usize = 1;
const REG_DMA_RSTART: usize = 2;
const REG_DMA_ADDR: usize = 3;
const REG_DMA_WDATA0: usize = 4;
const REG_DMA_WDATA1: usize = 5;
const REG_DMA_RDATA0: usize = 6;
const REG_DMA_RDATA1: usize = 7;
const REG_... |
#[macro_use]
extern crate seahorse;
extern crate repoint;
extern crate dirs;
use std::path::{Path, PathBuf};
use std::env;
use std::fs::{File, metadata};
use seahorse::{App, Command, Context, Flag, FlagType};
use repoint::repoint_file;
fn main() {
let args: Vec<String> = env::args().collect();
let app = App::... |
// Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors
// SPDX-License-Identifier: MIT
use std::path::Path;
use derive_builder::Builder;
use crate::commit_log::{CommitLogError, CommitLogs};
use crate::database::error::Error as DatabaseError;
use crate::database::rockdb_backend::RocksDBBackend;
use c... |
//! ## Example
//!
//! ```rust
//! use byond_crc32::Crc32;
//!
//! let mut crc32 = Crc32::new();
//! crc32.update(b"123456789");
//! let checksum = crc32.as_u32();
//! ```
#![cfg_attr(not(any(feature = "std", test)), no_std)]
mod combine;
mod tables;
#[cfg(not(feature = "std"))]
use core::{convert::TryInto, hash::Ha... |
use super::*;
use crate::param::*;
pub type Paths = HashMap<String, PathItem>;
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
pub struct Operation {
pub tags: Option<Vec<String>>,
pub summary: Option<String>,
pub description: Option<String>,
#[serde(rename = "externalDocs")]
... |
use image::{
imageops::{resize, FilterType},
ImageBuffer, Luma, Rgb, RgbImage, RgbaImage,
};
use ndarray::prelude::*;
use ndarray_stats::QuantileExt;
pub type GreyF32Image = ImageBuffer<Luma<f32>, Vec<f32>>;
pub const COLORMAP: [[u8; 3]; 10] = [
[0, 0, 4],
[27, 12, 65],
[74, 12, 107],
[120, 28... |
// Copyright 2020 Contributors to the Parsec project.
// SPDX-License-Identifier: Apache-2.0
use super::utils;
use super::utils::validate_public_key;
#[allow(deprecated)]
use super::utils::LegacyPasswordContext;
use super::utils::PasswordContext;
use super::Provider;
use crate::authenticators::ApplicationName;
use crat... |
use std::fmt;
use std::io::{self, Read};
use lazy_static::lazy_static;
use regex::Regex;
#[derive(Copy, Clone, Debug)]
struct Point {
x: i64, y: i64, z: i64
}
impl Point {
fn new(x: i64, y: i64, z: i64) -> Point {
Point { x: x, y: y, z: z }
}
}
impl fmt::Display for Point {
fn fmt(&self, f: ... |
use std::{process::exit, time::Instant};
use colored::Colorize;
mod clap;
mod display_timings;
mod errors;
mod io;
mod test_server;
use crate::clap::app;
use io::{read_bytes_from_path, read_from_path, write_bytes};
use ::clap::ArgMatches;
use errors::StorkCommandLineError;
use num_format::{Locale, ToFormattedString... |
use std::env;
use std::fs::File;
extern crate hound;
extern crate vcd;
use vcd::{TimescaleUnit,Value};
fn usage() {
println!("usage wav2aes in_file.wav");
panic!("usage ");
}
fn crackargs_for_filename() -> String {
if env::args().count() < 2 {
usage();
}
let argout = env::args().nth(1).unw... |
use std::{cmp::Ordering, fmt, hash::Hash};
use crate::{
card::rank::Rank,
evaluate::{class::EvalClass, hand_rank::PokerHandRank},
};
/// Hand metadata stored in the lookup table. It contains slightly more
/// information than a `EvalClass`, and is not meant to be public/constructed by
/// hand.
#[derive(Debug... |
//! Contains `XmlEvent` datatype, instances of which are emitted by the parser.
use std::fmt;
use std::borrow::Cow;
use name::OwnedName;
use attribute::OwnedAttribute;
use common::XmlVersion;
use namespace::Namespace;
/// An element of an XML input stream.
///
/// Items of this enum are emitted by `reader::EventRead... |
//! Cookie-related functionality for WebDriver.
use cookie::SameSite;
use serde::{Deserialize, Serialize};
use std::convert::{TryFrom, TryInto};
use time::OffsetDateTime;
use webdriver::command::{AddCookieParameters, WebDriverCommand};
use webdriver::common::Date;
use crate::client::Client;
use crate::error;
/// Typ... |
use crate::timestamp::Timestamp;
use crate::{Event, ProfilingData};
use measureme::{EventId, EventIdBuilder, Profiler, StringId};
use rustc_hash::FxHashMap;
use std::borrow::Cow;
use std::default::Default;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::time::SystemTime;
fn mk_filestem(file_name_stem: &st... |
use crate::{Enr, EnrError, EnrKey, EnrPublicKey, Key, NodeId, MAX_ENR_SIZE};
use bytes::{Bytes, BytesMut};
use rlp::RlpStream;
use std::{collections::BTreeMap, marker::PhantomData, net::IpAddr};
///! The base builder for generating ENR records with arbitrary signing algorithms.
pub struct EnrBuilder<K: EnrKey> {
/... |
//! High-level opinionated multi-producer multi-consumer channel.
//! Features:
//! - Async support
//! - `tracing` aware
use std::collections::VecDeque;
use std::future::Future;
use std::sync::Mutex;
use std::task::{Context, Poll, Waker};
use tracing_futures::Instrument;
use triomphe::Arc;
/// Used to send objects... |
use std::marker::PhantomData;
use wasm_bindgen::JsValue;
use crate::util::promise_to_void_future;
use super::{sys, IntoAsyncWrite, IntoSink, WritableStream};
/// A [`WritableStreamDefaultWriter`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter)
/// that can be used to write chunks to a ... |
use std::ffi::CString;
use std::io;
use std::process::Command;
use std::ptr;
use std::sync::Arc;
use std::thread::{Builder, JoinHandle};
#[derive(Debug)]
pub struct Client {
sem: Handle,
name: String,
}
#[derive(Debug)]
pub struct Acquired;
type BOOL = i32;
type DWORD = u32;
type HANDLE = *mut u8;
type LONG ... |
use std::fs::File;
use std::io::{Seek, SeekFrom, Write};
use std::num::NonZeroU32;
use std::time::{Duration, SystemTime};
use anyhow::{anyhow, Result};
use binrw::{io::Cursor, BinWrite};
use chrono::Local;
use tempfile::tempfile;
use tokio::{spawn, task::JoinHandle};
use zstd::encode_all;
use super::BlobType;
use cra... |
use std::io::{BufRead, BufReader, Read};
use std::pin::Pin;
use std::str::FromStr;
use std::sync::{Arc, Mutex};
use futures::stream::Stream;
use futures::task::{Context, Poll};
use crate::layers::domain::entities::chunk::{Chunk, ChunkLine};
use crate::layers::domain::parser_settings::ParserSettings;
use crate::layers... |
use std::collections::HashMap;
use algorithm::data_structure::graph::*;
use fnv::FnvHashMap;
use assembling::searching::discovery::general_approach::triple_adviser::TripleAdviser;
use assembling::searching::discovery::general_approach::graph_explorer::GraphExplorer;
// Use ot build graph explorer for one data source
p... |
extern crate getopts;
extern crate rayon;
use getopts::Options;
use std::time::Instant;
use std::env;
use alchemy::LIQUIDS;
use alchemy::SOLIDS;
use alchemy::init;
use alchemy::recipe;
use rayon::iter::IntoParallelIterator;
use rayon::iter::ParallelIterator;
mod alchemy;
const SEEDMAX: i64 = 4294967295;
fn print_abo... |
#![allow(clippy::many_single_char_names)]
extern crate bignum;
extern crate digest;
extern crate num_traits;
extern crate rsa;
extern crate sha1;
use digest::Digest;
use num_traits::NumOps;
pub struct Dsa<T> {
params: DsaParams<T>,
x: T,
y: T,
}
impl<T> Dsa<T>
where
T: bignum::BigNumTrait + bignum::... |
use approx::relative_eq;
use bevy::math::prelude::*;
const PI: f32 = std::f32::consts::PI;
/// A (yaw, pitch) pair representing a direction.
#[derive(Clone, Copy, Debug, Default)]
pub struct LookAngles {
// The fields are protected to keep them in an allowable range for the camera transform.
yaw: f32,
pit... |
use crate::{Field, FragmentSpread, InlineFragment};
use std::fmt;
/// The SelectionSet type represents a selection_set type in a fragment spread,
/// an operation or a field
///
/// *SelectionSet*:
/// Selection*
///
/// Detailed documentation can be found in [GraphQL spec](https://spec.graphql.org/October2021/#se... |
use fctrl::schema::*;
use futures::{Sink, Stream};
use futures_util::sink::SinkExt;
use futures_util::StreamExt;
use lazy_static::lazy_static;
use std::io::Write;
use tokio::sync::Mutex;
use tokio_tungstenite::tungstenite::{self, Message};
lazy_static! {
/// Pipe mode - disable output decoratives to facilitate pi... |
use crate::mock::{new_test_ext, Chips, GameGuessHashModule, Origin, System};
use frame_support::{
assert_ok,
traits::{OnFinalize, OnInitialize},
};
/// Jump to the specified block
fn run_to_block(n: u64) {
while System::block_number() < n {
GameGuessHashModule::on_finalize(System::block_number());
... |
use actix_web::{HttpServer, App, HttpRequest, Responder, HttpResponse, FromRequest};
use actix_web::web::{Path, Bytes, Buf};
use rand::Rng;
use rand::distributions::Alphanumeric;
use std::{thread, fs};
use std::collections::HashMap;
use std::time::{Duration, Instant};
use std::sync::{Mutex, MutexGuard};
use std::io::{R... |
// Widget Base Definition
//
// 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 writing,... |
//! Some code was borrowed from [Redox OS Kernel](https://gitlab.redox-os.org/redox-os/kernel)
use alloc::string::String;
use x86_64::instructions::port::Port;
pub static mut KEYBOARD: Keyboard = Keyboard::new();
pub mod us {
static US: [[char; 2]; 58] = [
['\0', '\0'],
['\x1B', '\x1B'],
... |
// Radio Button Widget
// Extensible widget for the widget library - handles a radio button with text.
//
// 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... |
use super::Config;
use crate::mixer::Error as MixerError;
use crate::{gst_create_element, Result};
use gst::prelude::*;
use gstreamer as gst;
pub struct Test {
pub name: String,
pipeline: Option<gst::Pipeline>,
config: Config,
audio: gst::Element,
audio_convert: gst::Element,
audio_resample: g... |
use anyhow::Result;
use path_slash::PathBufExt;
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
#[derive(Default, Deserialize, Serialize)]
struct PubspecYaml {
flutter: Option<FlutterSection>,
}
#[derive(Default, Deserialize, Serialize)]
struct FlutterSection {... |
use crate::input::Input;
pub fn solve(input: &mut Input) -> Result<u32, String> {
let mut lines = input.text.lines();
if input.is_part_one() {
let mut sum = SnailfishNumber::parse(lines.next().ok_or("Empty input")?)?;
for line in lines {
let number = SnailfishNumber::parse(line)?;
... |
#![allow(dead_code, unused_variables, clippy::let_and_return)]
use std::collections::HashSet;
use std::fmt::Display;
use std::str::FromStr;
#[derive(Clone, Copy)]
pub struct Line{
x1: u16,
y1: u16,
x2: u16,
y2: u16
}
impl Display for Line {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::f... |
/*
Copyright 2022 <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 writing... |
extern crate env_logger;
#[macro_use]
extern crate log;
extern crate tempdir;
use tempdir::TempDir;
use std::fs;
use std::path::{Path, PathBuf};
use std::process::Command;
/// Utility: run a process, optionally displaying its stdout/stderr.
fn run(mut command: std::process::Command) -> std::io::Result<()> {
let ... |
use super::{
bit_vector::BitVector,
mappers::{
BitMapper, BitVectorMappable, BoolMapper, CoughSeverityMapper, FeverSeverityMapper,
TimeMapper, TimeUserInputMapper, VersionMapper,
},
public_symptoms::PublicSymptoms,
};
use crate::expect_log;
#[cfg(target_os = "android")]
use log::error;
u... |
use std::time::Instant;
use itertools::Itertools;
use aoc_2021::get_input;
#[derive(Debug, PartialEq, Eq)]
enum Axis {
X,
Y,
}
impl TryFrom<&str> for Axis {
type Error = String;
fn try_from(s: &str) -> Result<Axis, Self::Error> {
match s {
"x" => Ok(Axis::X),
"y" => ... |
//! World controller.
use piston::input::GenericEvent;
use planning::world::*;
use planning::astar::*;
pub enum AppState {
Config {
cfg: AStarCfg,
world: World,
},
Active(AStar),
}
impl AppState {
pub fn world(&self) -> &World {
match &self {
AppState::Config { c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.