text stringlengths 3.35k 22.8k |
|---|
//! A Simple Charity which holds and governs a pot of funds.
//!
//! The Charity has a pot of funds. The Pot is unique because unlike other token-holding accounts,
//! it is not controlled by a cryptographic keypair. Rather it belongs to the pallet itself.
//! Funds can be added to the pot in two ways:
//! * Anyone can... |
//! Driver for OS targets
//!
//! Uses the [btleplug](https://crates.io/crates/btleplug/) crate to
//! provide a cross-platform interface to BLE API's on Linux, macOS
//! and Windows.
use core::pin::Pin;
use btleplug::api::{Central, Manager as _, Peripheral};
use btleplug::api::{CharPropFlags, Characteristic, ValueNo... |
use super::{Action, Label, Target};
use anyhow::*;
use crypto::digest::Digest;
use crypto::sha1::Sha1;
use dashmap::DashMap;
use log::*;
use std::fs;
use std::path::PathBuf;
use zap_buildscript::*;
#[derive(Clone, Debug)]
pub struct Dependency {
pub label: Label,
pub hash: String,
pub outs: Vec<PathBuf>,
}... |
// Copyright 2018 Google LLC
//
// 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 w... |
use digest::{BlockInput,FixedOutput,Input};
use digest::generic_array::ArrayLength;
use hmac::{Hmac,Mac};
use num::{BigUint,Zero};
use std::clone::Clone;
#[allow(non_snake_case)]
pub struct KIterator<H>
where
H: Clone + BlockInput + Input + FixedOutput + Default,
H::BlockSize : ArrayLength<u8>
{
hmac_k: ... |
use crate::helpers::*;
use crate::response_builder::ResponseBuilder;
use crate::{ApiError, ApiResult, BoxFut, UrlQuery};
use beacon_chain::{BeaconChain, BeaconChainTypes};
use futures::{Future, Stream};
use hyper::{Body, Request};
use serde::{Deserialize, Serialize};
use ssz_derive::{Decode, Encode};
use state_processi... |
use crate::config::PlatformConfiguration;
use crate::platform::regular_platform::RegularPlatform;
use crate::toolchain::ToolchainConfig;
use crate::{Compiler, Device, Platform, PlatformManager, Result};
use std::{env, fs, path, process, sync};
pub use self::device::AndroidDevice;
use anyhow::Context;
mod device;
pu... |
use std::borrow::Borrow;
use std::fs::{create_dir_all, rename, OpenOptions};
use std::io::Write;
use std::path::{Path, PathBuf};
use failure::Error;
use futures::prelude::*;
use futures::stream::futures_unordered::FuturesUnordered;
use reqwest::{Client, ClientBuilder, Response};
use reqwest::{redirect, Url};
use crat... |
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::clone::Clone;
use thiserror::Error;
use tracing::{event, instrument, Level};
use crate::find;
const SESSION_TIMEOUT_DEFAULT: u32 = 900;
#[derive(Deserialize, Serialize, Default, Debug, Clone)]
pub struct Parameters {
ipaddr: String,
info0: Strin... |
use std::{
io,
net::{IpAddr, Ipv4Addr, SocketAddr},
};
use mio::net::UdpSocket;
use log::{debug, error, info, trace};
use socket2::{Domain, Protocol, SockAddr, Socket, Type};
use bytes::{Bytes, BytesMut};
use crate::{
network::util::{
get_local_multicast_ip_addrs, get_local_multicast_locators, get_local_uni... |
// Copyright 2017-2020 <NAME>. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// 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. T... |
//! A simple actor system that implements a working "echo" audio effect.
//!
//! Provided you have PulseAudio installed, run it as:
//!
//! parec --latency=2940 | ./target/debug/examples/echo | pacat --latency=2940
//!
//! BEWARE, running is prone to create loud audio feedback. Headphones ease that.
//!
//! ... |
#![allow(dead_code)]
// Agent identifiers
pub const ANDROID5_NEXUS7: &str = "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 7 Build/LMY47V) AppleWebKit/537.36 (KHTML like Gecko) Chrome/47.0.2526.76 Safari/537.36";
pub const ANDROID7_GALAXYS8: &str = "Mozilla/5.0 (Linux; Android 7.0; SM-G892A Build/NRD90M; wv) AppleWebKit/53... |
mod bitcoind;
mod config;
mod daemonize;
mod database;
mod keys;
mod poller;
use bitcoind::{load_watchonly_wallet, start_bitcoind, wait_bitcoind_synced};
use config::{config_folder_path, Config};
use daemonize::daemonize;
use database::setup_db;
use keys::read_or_create_noise_key;
use revault_net::{
noise::PublicK... |
use structopt::StructOpt;
use x11::xlib;
use x11::xrandr;
use x11::xinput2;
use std::ptr;
use std::env;
use std::ffi::CString;
use std::mem::MaybeUninit;
use std::ffi::CStr;
use nix::unistd;
use nix::sys;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use configparser::ini::Ini;
static RUNNING: At... |
use std::cmp::Ordering;
use std::str::from_utf8;
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
from_binary, to_binary, Api, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Order, Pair,
Response, StdError, StdResult, Uint128, WasmMsg,
};
use cw2::set_contract_version;
u... |
use std::{
cmp::{max, min},
ops::{AddAssign, DivAssign, MulAssign, SubAssign},
};
use num::FromPrimitive;
use num::{Float, Num};
use num_traits::NumAssignOps;
#[derive(Debug, Clone)]
pub struct PowerSeries<T> {
pub n: usize,
pub N: usize,
pub coeffs: Vec<T>,
}
impl<T: Copy + Num> PowerSeries<T> {... |
//!
//! ACPI Machine Language Data Objects
//!
use super::expression_opcode;
use super::name_object::NameString;
use super::opcode;
use super::{AcpiInt, AmlError, AmlStream};
use crate::ignore_invalid_type_error;
use crate::kernel::memory_manager::data_type::{Address, MSize, VAddress};
#[derive(Clone, Debug)]
pub st... |
use crate::actix::Actor as ActixActor;
use crate::actix::ActorContext;
use crate::actix::Addr;
use crate::actix::AsyncContext;
use crate::actix::Handler;
use crate::actix::Message;
use crate::actix::Running;
use crate::actix::StreamHandler;
use crate::actix_web::middleware;
use crate::actix_web::web;
use crate::actix_w... |
use mlb_api::client::StatGroup;
use mlb_api::stats::{HittingStat, PitchingStat, StatResponse, StatSplit};
use indexmap::IndexMap;
use tui::widgets::TableState;
use std::string::ToString;
/// The width of the first column, which is a longer item like team name.
pub const STATS_FIRST_COL_WIDTH: u16 = 25;
/// The width... |
use rand::Rng;
use std::marker::PhantomData;
// TODO: not yet used / required for later
/// Models the dynamics of the asset(s) price.
/// RandomPath represents the underlying random distribution,
/// which is transformed to the price path.
pub trait Dynamics<Input, RandomPath, Path> {
fn transform(&self, input: I... |
//! Representations of various properties of a block cipher.
//!
//! Currently only linear approximations and differentials are represented.
use crate::dl::cg_original::cipher::Cipher;
use crate::dl::cg_original::sbox::Sbox;
use fnv::FnvHashMap;
use itertools::Itertools;
use std::cmp::Ordering;
use std::collections::h... |
use crate::ntapi_base::{CLIENT_ID, PCLIENT_ID};
use winapi::shared::evntprov::EVENT_FILTER_DESCRIPTOR;
use winapi::shared::guiddef::LPCGUID;
use winapi::shared::ntdef::{
BOOLEAN, HANDLE, NTSTATUS, PCCH, PCH, PCSTR, PHANDLE, PLARGE_INTEGER, POBJECT_ATTRIBUTES,
PULONG, PVOID, UCHAR, ULONG, ULONGLONG,
};
use winap... |
use std::collections::HashMap;
use anyhow::{anyhow, Context, Result};
use log::debug;
use prost_types::{DescriptorProto, FieldDescriptorProto, MessageOptions};
use serde::ser::Error;
use serde::{Deserialize, Serialize, Serializer};
use crate::renderer::case::Case;
use crate::renderer::context::proto_type::ProtoType;
... |
use std::cell::RefCell;
use std::cmp;
use std::collections::HashMap;
use std::rc::Rc;
use crate::dispatch::*;
use crate::log_entry::*;
use crate::message::*;
use crate::state::State;
// broadcastTime ≪ electionTimeout ≪ MTBF
const HEARTBEAT_INTERVAL_MS: u64 = 50;
const ELECTION_TIMEOUT_MS: u64 = 500; // FIXME: Random... |
// Copyright 2021 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
use std::ops::Range;
use std::sync::Arc;
use im::HashMap;
use itertools::Itertools;
use super::ast::{
self, Ast, AstError, AstKind, AstString, CollectErrors, Identifier, Int, Lambda, Symbol, Text,
};
use super::cst::{self, Cst, CstDb, CstKind};
use super::error::{CompilerError, CompilerErrorPayload};
use super::r... |
use std::vec;
use rand::Rng;
use crate::{
cell::{Cell, CellKind, CellState, SweeperCell},
error::Error,
};
pub enum BoardResult {
Win,
Lost,
}
pub enum BoardState {
Uninitialized,
Playing,
Finished(BoardResult),
}
pub trait SweeperBoard<T>
where
Self: Sized,
T: SweeperCell,
{
... |
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not... |
// Melhor exemplo:
// let str1 = String::from("atraocaasdqw");
// let str2 = String::from("rtoacabdwqoi");
// http://odur.let.rug.nl/kleiweg/lev/
// Não tem a função de eliminar, já que a inserção/deleção
// do restante dos caracteres faz mais sentido
fn main() {
//Strings a serem comparadas
let str1 = String::f... |
use crate::Evaluator;
use crate::CardsType;
use crate::card;
const CARD_PRIMES: [u32;13] = [2,3,5,7,11,13,17,19,23,29,31,37,41];
// 一些表格
const FLUSHES: [u16;0x1F01] = include!("tbl_flushes");
const UNIQUE5: [u16;0x1F01] = include!("tbl_unique5");
//const OTHER_PRODUCTS: [u32;4888] = include!("tbl_other_products");
//... |
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
// Modifications Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// See GitHub history for details.
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use std::path::{Path, PathBuf};
use tracing::*;
use crate::common::{Config, Mode,... |
mod constant;
mod imports;
mod structs;
use std::{collections::HashSet, fmt, io::Write, mem};
use failure::Fallible as Result;
use heck::*;
use self::{constant::Constant, imports::*, structs::*};
use crate::{
parser::*,
semantics::SemanticChecker,
};
#[derive(Clone, Copy, Debug)]
pub enum TagEnvironment {
... |
use std::process;
//gomoku_ai crate
use gomoku_ai::{find_best_move, Player, Point, MAX};
//iced crate
use iced::{button, Button, Color, Column, Element, Length, Radio, Row, Sandbox, Settings, Text};
//main function
pub fn main() -> iced::Result {
GomukuUI::run(Settings::default())
}
//GomukuUI struct
#[derive(Def... |
mod keychain;
mod crypto;
mod item;
#[macro_use]
extern crate lazy_static;
extern crate byteorder;
extern crate getopts;
extern crate rpassword;
extern crate regex;
extern crate clipboard;
extern crate rand;
#[cfg(test)]
mod tests;
use getopts::Options;
use std::env;
use std::io;
use std::io::Write;
use regex::Regex... |
// Copyright (c) Meta Platforms, Inc. and affiliates.
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
mod assemble;
mod compile;
mod crc;
mod expr_trees;
mod facts;
mod parse;
use ::compile::{EnvFlags, HHBCFlags, NativeEnv, ParserFlags};
u... |
#![allow(clippy::float_cmp)]
#![allow(clippy::inline_always)]
#![allow(clippy::many_single_char_names)]
#![allow(clippy::needless_lifetimes)]
#![allow(clippy::needless_return)]
#![allow(clippy::or_fun_call)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::redundant_field_names)]
#![allow(clippy::enum_variant_nam... |
// Copyright 2020 - developers of the `grammers` project.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distr... |
use parking_lot::{const_mutex, Mutex};
use rome_rowan::{TextRange, TextSize};
use similar::{utils::diff_lines, Algorithm};
use std::{
env,
ffi::OsStr,
fmt::Write,
fs::{read_to_string, write},
ops::Range,
path::Path,
};
use rome_formatter::{FormatOptions, IndentStyle};
use rslint_errors::{file::... |
extern crate clap;
extern crate tempfile;
extern crate os_pipe;
extern crate scopeguard;
use std::io::{self, Write};
use std::fs;
use std::ffi::OsStr;
use std::path::{Path, PathBuf};
use clap::{App, Arg, ArgGroup, AppSettings};
#[derive(Clone)]
enum StdIn<'a> {
Null,
Redirect(&'a OsStr),
Inherit,
}
#[d... |
use crate::{hash, pack, zlib::stream::inflate::InflateReaderBoxed};
use flate2::Decompress;
use git_features::hash::Sha1;
use git_object::owned;
use std::{fs, io};
/// Returned by [`Iter::new_from_header()`] and as part of `Item` of [`Iter`]
#[derive(thiserror::Error, Debug)]
#[allow(missing_docs)]
pub enum Error {
... |
use crossterm_input::{input, AsyncReader, InputEvent, KeyEvent, RawScreen};
use rand::prelude::*;
use std::collections::{HashSet, VecDeque};
use std::thread::sleep;
use std::time::Duration;
use std::io::prelude::*;
/// A collection of all the game's components.
pub struct Game {
snake: Snake,
food_pos: (u16, u... |
// Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors
// SPDX-License-Identifier: MIT
use std::collections::HashMap;
use std::process::Command;
use failure::bail;
use itertools::Itertools;
use crate::configuration::RpcPerformanceTestEnv;
use crate::types::{Branch, BranchType, WrkResult};
type WrkR... |
use crate::devices::uart::Uart;
use core::alloc::{AllocError, Allocator, GlobalAlloc, Layout};
use core::ptr::{null_mut, NonNull};
use core::slice::from_raw_parts_mut;
pub const PAGE_ORDER: usize = 12;
pub const PAGE_SIZE: usize = 1 << PAGE_ORDER;
/// Utilizamos un sistema de alloc en el que dividimos la memoria en N... |
/*
* This file is part of CycloneDX Rust Cargo.
*
* 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 l... |
use std::{fmt, mem};
use windows::{
core::{PCWSTR, PWSTR},
Win32::{
Foundation::*, Graphics::Gdi::*, System::LibraryLoader::GetModuleHandleW,
UI::WindowsAndMessaging::*,
},
};
use crate::ui::window::{
ControlKind, MessageResult, WindowBuilder, WindowError, WindowGeometry, WindowMessage... |
// Copyright 2020-2021 <NAME> under the terms of the MIT License as detailed
// in the accompanying file README.md or <https://opensource.org/licenses/MIT>.
//! Headless image (and someday video) generation.
use std::array::IntoIter;
use std::convert::{TryFrom, TryInto};
use std::error::Error;
use std::fs::File;
use ... |
//! Platform Level Interrupt Control peripheral driver for SweRV EH1.
use kernel::utilities::cells::VolatileCell;
use kernel::utilities::registers::interfaces::{Readable, Writeable};
use kernel::utilities::registers::{
register_bitfields, register_structs, LocalRegisterCopy, ReadWrite,
};
use kernel::utilities::St... |
/// binary search helper
pub trait Bisect: Clone {
/// return between two elements
fn halve(&self, other: &Self) -> Self;
/// the end condition of binary search
fn section_end(&self, other: &Self) -> bool;
}
macro_rules! impl_bisect_unsigned {
($($t:ty)*) => {
$(impl Bisect for $t {
... |
#[cfg(target_os = "windows")]
extern crate winapi;
use std::fs;
use std::path::{Path, PathBuf};
use std::time::Instant;
#[cfg(not(target_os = "windows"))]
use std::os::unix::io::AsRawFd;
#[cfg(target_os = "windows")]
use {std::ffi::OsStr, std::os::windows::ffi::OsStrExt};
pub(crate) trait DiskWriteable {
fn write_... |
use std::sync::Arc;
use crate::algebra::Algebra;
use crate::module::homomorphism::{FreeModuleHomomorphism, ModuleHomomorphism};
use crate::module::{FreeModule, Module, ZeroModule};
use fp::matrix::Matrix;
use fp::vector::{FpVector, SliceMut};
use once::OnceBiVec;
#[cfg(feature = "json")]
use {
crate::algebra::Jso... |
use crate::assemble_pipeline::unitig_links_manager::{
ThreadUnitigsLinkManager, UnitigLinksManager,
};
use crate::assemble_pipeline::AssemblePipeline;
use crate::config::{
BucketIndexType, SwapPriority, DEFAULT_PER_CPU_BUFFER_SIZE, DEFAULT_PREFETCH_AMOUNT,
};
use crate::io::structs::unitig_link::{UnitigFlags, U... |
use crate::parser::ast::ExprKind;
use crate::parser::parser::SyntaxObject;
use crate::parser::tokens::TokenType;
use crate::parser::visitors::ConsumingVisitor;
// use crate::parser::span::Span;
use crate::rerrs::{ErrorKind, SteelErr};
use crate::rvals::Result;
use super::ast::Atom;
use std::collections::HashMap;
us... |
use itertools::Itertools;
use llvm_ir::Module;
use llvm_ir_analysis::*;
fn init_logging() {
// capture log messages with test harness
let _ = env_logger::builder().is_test(true).try_init();
}
/// call.c / call.bc, functionptr.c / functionptr.bc, and crossmod.c /
/// crossmod.bc are all taken from [`haybale`]'... |
#[macro_use]
extern crate rocket;
mod context;
mod markdown;
use rocket::figment::value::magic::RelativePathBuf;
use rocket::form::Form;
use rocket::fs::FileServer;
use rocket::http::{Cookie, CookieJar, Status};
use rocket::request::FlashMessage;
use rocket::response::{Flash, Redirect};
use rocket::serde::json::Json;... |
//! Type level (and pseudo-type-level) natural numbers and singletons.
use std::marker::PhantomData;
use std::ops::Deref;
/// A type is `AsNat` if a value can be viewed as a natural number.
pub trait AsNat {
/// Get the underlying natural number as a `usize`.
fn as_nat(&self) -> usize;
}
impl AsNat for usize... |
use std::error::Error as StdError;
use std::fmt;
use std::result::Result as StdResult;
use std::string::String as StdString;
use std::sync::Arc;
/// Error type returned by `rlua` methods.
#[derive(Debug, Clone)]
pub enum Error
{
/// Syntax error while parsing Lua source code.
SyntaxError
{
/// The ... |
// Copyright 2013 <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, ... |
use crate::assets::mesh_adv::{MeshAdvAssetData, MeshAdvPartAssetData};
use crate::features::mesh_adv::{MeshVertexFull, MeshVertexPosition};
use distill::importer::{ImportedAsset, Importer, ImporterValue};
use distill::{core::AssetUuid, importer::ImportOp};
use glam::Vec3;
use rafx::api::{RafxIndexType, RafxResourceType... |
fn main()
{
let ( _event_loop, _window, surface, surface_config, device, queue ) = context_make();
let render_pipeline = render_pipeline_make( &device, &surface_config );
render( &device, &surface, &queue, &render_pipeline ).unwrap();
}
//
pub fn render_pipeline_make
(
device : &wgpu::Device,
surface_con... |
use crate::capitalizing::table_name_to_struct_name;
use crate::crud::{ColumnValue, ExtractColumn, QueryType};
use crate::supported_data_types::CassandraDataType;
use crate::{create_test_db_session, keyspace, query_columns, use_keyspace, Columns};
use cdrs::query::QueryExecutor;
use cdrs::types::value::Value;
use std::c... |
//! The Settings crate handles settings for Rita, specifically it uses lazy_static to load and
//! deserialize the config file on system start. Once deserialized using Serde into internal data
//! structures it is then provided to Rita as a global static reference, this reference is locked
//! using a RwLock to allow m... |
use mesh::Triangle;
use mesh::Vertex;
use mesh::Mesh;
use tables::VERTS_INSIDE_TO_EDGE_ISECT;
use tables::EDGE_ISECTS_TO_TRIS;
use tables::EDGES;
pub fn tessellate_corners(p: &[(f32, f32, f32)], f: &[f32]) -> Mesh {
let corners_in = (0..8).filter(|i| f[*i as usize] < 0.0).fold(
0,
|c, i| c | (1 <... |
use evaluator::*;
use io_tools::*;
use std::collections::HashMap;
use std::env;
use std::path::Path;
use string_tools::*;
pub struct Preprocessor {
context: HashMap<String, String>,
}
impl Preprocessor {
pub fn new() -> Self {
let mut p = Preprocessor {
context: HashMap::new(),
};
... |
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
//! External storage support.
//! Cloud provider backends can be found under components/cloud
#[macro_use]
extern crate slog_global;
#[allow(unused_extern_crates)]
extern crate tikv_alloc;
use std::{
io::{self, Write},
marker::Unpin,
sync... |
// Copyright 2017-2019 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
// Substrate is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) a... |
pub mod casting;
pub mod componentinators;
pub mod data;
pub mod patterns;
use std::convert::TryInto;
use data::{SpellData, SpellDataKind};
use hecs::{Entity, World};
use macroquad::prelude::Vec2;
use nalgebra::vector;
use rapier2d::prelude::*;
use smallvec::{smallvec, SmallVec};
use strum_macros::Enum... |
use crate::b2_body::*;
use crate::b2_broad_phase::*;
use crate::b2_collision::*;
use crate::b2_fixture::*;
use crate::b2_math::*;
use std::rc::Rc;
use std::ptr;
use crate::b2_settings::*;
pub fn b2_fixture_default<T:UserDataType>() -> B2fixture<T> {
return B2fixture::<T> {
m_user_data: None,
m_body: None,
m_nex... |
use std::{
collections::BTreeMap,
error::Error,
rc::Rc,
time::{Duration, SystemTime},
};
use crate::proto::goodmetrics::{dimension, measurement, Datum, Dimension, Measurement};
use crate::server::{
postgres_things::{
ddl::{self, clean_id},
histogram::get_or_create_histogram_type,
... |
use std::future::Future;
use crate::config::CurrencyConfig;
use crate::error::Error;
use crate::models::TransferChain;
use crate::{context::Context, models::Payment};
use m10_protos::MetadataExt;
use m10_sdk::contract::FinalizedContractExt;
use m10_sdk::EnhancedTransfer;
use m10_sdk::{
directory::{alias, Alias},
... |
use anyhow::Result;
use plist;
use serde::Deserialize;
use std::process::Command;
pub struct HdiUtil {}
impl HdiUtil {
#[allow(dead_code)]
pub fn info() -> Result<HdiUtilInfo> {
let output = Command::new("hdiutil").args(&["info", "-plist"]).output()?;
if !output.status.success() {
... |
/*
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... |
extern crate web_sys;
use std::collections::HashMap;
use js_sys;
use wasm_bindgen::prelude::*;
use wasm_bindgen::{Clamped, JsCast};
use web_sys::{CanvasRenderingContext2d, HtmlElement};
use serde::Deserialize;
use crate::utils;
use crate::web;
use vm::vm;
const SCREEN_HEIGHT: u32 = 256;
const SCREEN_WIDTH: u32 = 5... |
use std::iter::Peekable;
use std::str::Chars;
use crate::common::position::CaretPos;
use crate::lex::lex_result::{LexErr, LexResult};
use crate::lex::state::State;
use crate::lex::token::{Lex, Token};
use crate::lex::tokenize;
#[allow(clippy::cognitive_complexity)]
pub fn into_tokens(c: char, it: &mut Peekable<Chars>... |
mod error;
pub use self::error::DatabaseError;
pub use self::error::DatabaseResult;
use crate::config::ConnectionSettings;
use crate::config::QuerySchemaSettings;
use postgres::config::Config;
use postgres::row::Row;
use postgres::Client;
use postgres::NoTls;
use std::collections::HashMap;
use std::collections::HashS... |
use super::{filescraper::FileContent, ExtrinsicResult, StepRepeatEntry};
use failure::Error;
#[derive(Debug, Fail)]
enum AnalyserError {
#[fail(display = "header value of the benchmark result is missing")]
MissingHeader,
#[fail(display = "header value of the benchmark result is invalid")]
InvalidHeade... |
pub mod types;
pub use types::{Key, KeyPrefix, SpMap, SpecialCellKind, SpecialCellsExtensionError, Value};
use crate::extensions::{DetailedCell, DetailedCells, Extension};
use crate::types::DeployedScriptConfig;
use crate::utils::{find, remove_item, to_fixed_array};
use anyhow::Result;
use bincode::{deserialize, ser... |
//! The directory displays all the available settings and lets users change them
//! from within the configurator.
use cursive::Cursive;
use cursive::views::{Dialog, TextView, EditView, ListView, BoxView, LinearLayout, SelectView};
use super::*;
/// Draws the global configuration directory which contains all possibl... |
use std::fmt;
use crate::{
Buffer, ParseError,
err::{perr, ParseErrorKind::*},
parse::{first_byte_or_empty, hex_digit_value},
};
/// An integer literal, e.g. `27`, `0x7F`, `0b101010u8` or `5_000_000i64`.
///
/// An integer literal consists of an optional base prefix (`0b`, `0o`, `0x`),
/// the main part ... |
use crate::constants::RECEIVE_TIMEOUT;
use crate::http::HttpClient;
use crate::internal::prelude::*;
use crate::types::gateway::{GetGatewayBotData, WsDispatchEvent, WsInboundEvent};
use crate::{ClientState, EventHandler, Intents};
use super::GatewayError;
use super::WsStream;
use flate2::read::ZlibDecoder;
use future... |
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::cmp;
use aoc::*;
use priority_queue::PriorityQueue;
#[derive(Clone, Debug)]
pub struct ManyWorldsInterpretation {
entrances: Vec<Pos>,
grid: HashMap<Pos, Block>,
}
#[derive(Copy, Clone, Debug)]
pub enum Blo... |
// Copyright 2015-2016 <NAME>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL... |
use crate::common::*;
use crate::error::Result;
use crate::lzss;
use image;
use image::ColorType;
use std::ffi::OsStr;
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;
use std::str;
use tim2;
use tim2::Pixel;
fn has_tm2_header(slice: &[u8]) -> bool {
if let Ok(header) = str::from_utf8(&slice) {
... |
use artichoke_core::eval::{self, Eval};
use std::borrow::Cow;
use std::ffi::{c_void, CStr, CString};
use std::mem;
use crate::exception::Exception;
use crate::exception_handler::ExceptionHandler;
use crate::extn::core::exception::Fatal;
use crate::sys::{self, DescribeState};
use crate::value::Value;
use crate::Articho... |
//! Generic implementation of [Parallelizable Message Authentication Code (PMAC)][1],
//! otherwise known as OMAC1.
//!
//! # Usage
//! We will use AES-128 block cipher from [aes](https://docs.rs/aes) crate.
//!
//! To get the authentication code:
//!
//! ```rust
//! use aes::Aes128;
//! use pmac::{Pmac, Mac, NewMac};
... |
// Copyright (c) 2021 FaultyRAM
//
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. This file may not be copied,
// modified, or distributed except according to t... |
use crate::database::database::{get_money, money_increment};
use rand::{seq::SliceRandom, thread_rng};
use serenity::{
framework::standard::{macros::command, Args, CommandResult},
model::channel::Message,
prelude::*,
Error,
};
use std::{thread::sleep, time, time::Duration};
#[command]
#[only_in(guilds)... |
use filebuffer::FileBuffer;
use std::cmp::min;
use std::io;
use std::path;
use crate::hash::hash;
use crate::uint32;
pub use std::io::Result;
const KEYSIZE: usize = 32;
/// CDB file reader
///
/// # Example
///
/// ```
/// let cdb = cdb::CDB::open("tests/test1.cdb").unwrap();
///
/// for result in cdb.find(b"one") ... |
use std::io::Write;
use bitcoin::consensus::encode::{deserialize, serialize};
use bitcoin::{Network, OutPoint, Script, Transaction, TxIn, TxOut};
use cmd;
use hal::tx::{InputInfo, InputScriptInfo, OutputInfo, OutputScriptInfo, TransactionInfo};
pub fn subcommand<'a>() -> clap::App<'a, 'a> {
cmd::subcommand_group("t... |
use rocket::{response::Redirect, State};
use chrono::{DateTime, FixedOffset, NaiveDate, TimeZone, Utc};
use pointercrate_core::{audit::AuditLogEntryType, pool::PointercratePool};
use pointercrate_core_api::{
error::Result,
response::{Page, Response2},
};
use pointercrate_demonlist::{
demon::{audit::audit_l... |
use ordered_float::NotNan;
use std::{collections::BTreeMap, fs::File, io::Read};
type Field = Vec<Vec<bool>>;
fn parse(asteroid_field: &str) -> Field {
let mut vec = vec![];
for line in asteroid_field.lines() {
vec.push(line.trim().chars().map(|c| c == '#').collect());
}
vec
}
fn filter_aster... |
extern crate regex;
#[macro_use] extern crate lazy_static;
extern crate utils;
use std::cmp::Ordering;
use std::cmp;
use std::collections::BinaryHeap;
use std::str::FromStr;
use std::error::Error;
use std::num::ParseIntError;
use std::io::{self, BufReader};
use std::io::prelude::*;
use std::fs::File;
use regex::Regex;... |
use anyhow::{anyhow, bail, Context, Result};
use log::{debug, info, warn};
use serde::Deserialize;
use std::{
collections::{BTreeMap, BTreeSet},
env,
io::{Read, Write},
process::{Child, Command, Output, Stdio},
};
pub use PackageManager::{Apt, AptGet, Brew, Cargo, Choco, Yum};
pub use Shell::{Bash, Pow... |
use std::net;
use std::str::FromStr;
use std::time::{Duration, Instant};
use actix::prelude::*;
use futures::Stream;
use tokio_codec::FramedRead;
use tokio_io::AsyncRead;
use tokio_signal::unix::{Signal, SIGINT, SIGTERM};
use tokio_tcp::{TcpListener, TcpStream};
use tokio_timer::Delay;
use super::cli::{AgentOpt, Pack... |
use crate::ffi::windows as ffi;
use crate::ffi::windows::{DWORD, PDNS_SERVICE_INSTANCE, PVOID};
use crate::os::windows::to_utf16;
use crate::DNSServiceBuilder;
use std::convert::TryFrom;
use std::ffi::OsString;
use std::fmt;
use std::io::{Error as IoError, ErrorKind};
use std::os::windows::ffi::OsStringExt;
use std::pt... |
use std::collections::{HashMap, HashSet};
use std::fmt;
use std::io::{self, Read};
use std::path::PathBuf;
use std::process;
use std::str::FromStr;
use goblin::elf::{
header::{EM_386, EM_AARCH64, EM_ARM, EM_PPC64, EM_S390, EM_X86_64},
sym::STT_FUNC,
Elf,
};
use regex::Regex;
use structopt::StructOpt;
use t... |
use serde::{Deserialize, Serialize};
use abstutil::Timer;
use geom::{Duration, UnitFmt};
use widgetry::{
CanvasSettings, Choice, EventCtx, GeomBatch, GfxCtx, Key, Line, Outcome, Panel, Spinner, State,
TextExt, Toggle, Widget,
};
use crate::colors::ColorSchemeChoice;
use crate::render::DrawBuilding;
use crate:... |
// Copyright 2015 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 ... |
// Copyright 2019 The Druid 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... |
use std::fs::File;
use std::io::prelude::*;
use std::vec::Vec;
extern crate toml;
use toml::Value as Toml;
extern crate serde_json;
use serde_json::Value as Json;
extern crate argparse;
use argparse::{ArgumentParser, StoreTrue, Store};
extern crate log4rs;
static SERVERS : &'static str = "servers";
static PORT: &... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.