text stringlengths 3.09k 13.9k |
|---|
use std::mem;
type Link = Option<Box<Node>>;
struct List {
head: Link,
name: String,
}
#[derive(Debug)]
struct Node {
element: i32,
next: Link,
}
impl List {
fn new(given_name: &str) -> Self {
List { head: None, name: String::from(given_name) }
}
fn push(&mut self, i: i32) {
let old_head = s... |
use std::cmp;
use std::io::Read;
use std::io::Write;
use std::io::Result;
// A stream that is seeded with incoming data which can be consumed and
// records data written to it (like a socket).
//
// This allows us to unit test a transport without using sockets. :)
pub struct TestStream {
pub incoming: Vec<u8>,
... |
// Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use vtok_common::config;
use crate::crypto;
use crate::defs;
use crate::pkcs11;
pub mod object;
pub use object::{Object, ObjectHandle, ObjectKind};
// NOTE: for now, we use these *Info structs to ... |
extern crate python3_sys;
extern crate cpython;
#[path="append.rs"] mod append;
#[path="decoder.rs"] pub mod decoder;
#[path="resampler.rs"] pub mod resampler;
#[path="renderer.rs"] pub mod renderer;
#[path="exporter.rs"] pub mod exporter;
#[path="parser.rs"] pub mod parser;
#[path="models.rs"] pub mod models;
#[path=... |
use core::{fmt, marker::PhantomData};
#[cfg(not(target_os = "cuda"))]
use rust_cuda::rustacuda::{
error::CudaResult,
function::{BlockSize, GridSize},
};
use rust_cuda::utils::{
aliasing::{SplitSliceOverCudaThreadsConstStride, SplitSliceOverCudaThreadsDynamicStride},
exchange::buffer::CudaExchangeBuffe... |
use crate::config::Config;
use crate::diagnostic_emitter::{DiagnosticEmitter, MosResult};
use crate::test_runner::{enumerate_test_cases, format_cpu_details, ExecuteResult, TestRunner};
use crate::utils::paint;
use crate::Args;
use ansi_term::Colour;
use mos_core::parser::source::{FileSystemParsingSource, ParsingSource}... |
use strum::Display;
/// An enum of SQL query types
/// (see https://www.postgresql.org/docs/current/sql-commands.html for more info)
#[derive(Display, Debug, Clone, Copy, Eq, PartialEq)]
#[repr(u8)]
pub enum QueryType {
Other,
Select,
SelectInto,
SelectWithLocking,
Insert,
Update,
Delete,
... |
// Copyright Materialize, Inc. and contributors. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by ... |
// Copyright 2020 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, Error};
use argh::FromArgs;
use fidl::encoding::encode_persistent;
use fidl_fuchsia_component_internal as component_internal;
use ... |
use crate::{
scene::commands::terrain::{
AddTerrainLayerCommand, DeleteTerrainLayerCommand, SetTerrainDecalLayerIndexCommand,
},
send_sync_message,
sidebar::{
make_int_input_field, make_section, make_text_mark,
terrain::{brush::BrushSection, layer::LayerSection},
COLUMN_W... |
use crate::Trigger;
use futures_core::{ready, stream::Stream};
use pin_project::pin_project;
use std::fmt;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use tokio::sync::watch;
/// A stream combinator which takes elements from a stream until a future resolves.
///
/// This structure is pr... |
use crate::lang::execution_context::ExecutionContext;
use crate::lang::errors::CrushResult;
use std::collections::HashMap;
use crate::{
lang::stream::Readable,
lang::errors::CrushError,
lang::{
argument::Argument,
table::Row,
table::ColumnType,
value::ValueType,
value... |
// 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 writ... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use libra_types::{
access_path::AccessPath,
contract_event::ContractEvent,
transaction::{ChangeSet, Transaction, TransactionPayload},
write_set::{WriteOp, WriteSet},
};
use std::{
collections::{BTreeMap, BTreeSet},
... |
use anyhow::Result;
use nom::{
error::{Error as NomError, VerboseError},
ErrorConvert,
};
use std::collections::BTreeMap;
mod parsers;
use self::parsers::{all_objects, make_xref_table};
use crate::{dictionary::Dictionary, error::HandlingError, object::Object, xref::Xref, ObjectId};
use parsers::version;
#[de... |
//! Implementation of FPGA Session API for a simple serial port API.
use crate::data::{SleepTrackerOutput, SleepTrackerOutputVec};
use crate::error::FpgaDriverError;
use crate::protocol::{Packet, PROTO_MAX_PACKET_SIZE, PROTO_PAYLOAD_MAX_SIZE, READ_FIFO_DEPTH};
use crate::traits::Data;
use crate::FpgaDriverResult;
use ... |
#[macro_use]
extern crate error_chain;
#[macro_use]
extern crate serde_derive;
extern crate crypto;
extern crate fs_extra;
extern crate git2;
extern crate gpgme;
extern crate hex;
extern crate rand;
extern crate regex;
extern crate serde;
extern crate serde_json;
extern crate tempdir;
extern crate tempfile;
pub mod e... |
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://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 those terms.
use std::rc::Rc;
use term... |
//
//! Copyright 2020 Alibaba Group Holding 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 appl... |
use pueue_lib::network::message::*;
use pueue_lib::state::SharedState;
use pueue_lib::task::TaskStatus;
use super::ok_or_failure_message;
use crate::ok_or_return_failure_message;
use crate::state_helper::save_state;
/// Invoked when calling `pueue switch`.
/// Switch the position of two tasks in the upcoming queue.
/... |
use std::{
cell::Cell,
collections::{HashMap, HashSet},
fmt::Display,
ops::Deref,
path::{Path, PathBuf},
sync::Arc,
};
use anyhow::Context;
use relative_path::RelativePath;
use swc_atoms::JsWord;
use crate::config::AnalyzeTarget;
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub struct Normali... |
// Copyright 2020, The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
// 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 {
super::*,
async_helpers::event::Event,
fidl::endpoints::*,
fidl_fuchsia_bluetooth_component::{LifecycleMarker, LifecycleRequest, Life... |
use std::str::FromStr;
use unicode_segmentation::UnicodeSegmentation;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct Coord {
rank: u8,
file: u8,
}
/// Coordinate type to help convert between different representations
///
/// Mostly a complicated mess and not especially important for understanding
///... |
// Copyright 2020 Shift Cryptosecurity 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 ... |
//! This module implements the types necessary for consensus to perform http requests.
//!
//! The life of a request looks as follows (from consensus perspective):
//!
//! 1. A [`CanisterHttpRequest`] will be generated from the metadata stored in the state manager.
//! The artifact pool manager will take the request pa... |
use super::*;
/// `1` entries and meta nodes in an exact cover problem instance.
///
/// - Node indexing
/// - For starting node, row == 0 and col == 0.
/// - For column headers, row == 0 and col >= 1.
/// - For `1` entries, row >= 1 and col >= 1.
#[derive(Clone, Copy)]
struct Node {
left: usize,
right: ... |
use bufstream::BufStream;
use message::{IrcMessage, NumericReply};
use std::io::*;
use std::net::{ToSocketAddrs, TcpStream};
use std::str::FromStr;
use user::IrcUser;
#[derive(Debug)]
pub struct IrcClient<A: ToSocketAddrs> {
pub server: A,
pub user: IrcUser,
pub connected: bool,
pub messages: Vec<IrcMe... |
// Copyright 2018 <NAME> <<EMAIL>>
// Licensed under the MIT License.
/*! Colorized CLI output.
There are a few common colorized output styles that we use.
*/
use failure::Error;
use std::fmt;
use std::io::Write;
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
/// How to style some text... |
use crate::gc::swiper::CardIdx;
use crate::gc::swiper::{CARD_REFS, CARD_SIZE, CARD_SIZE_BITS};
use crate::gc::{Address, Region};
use crate::mem;
use crate::object::offset_of_array_data;
// see GC Handbook 11.8: Crossing Maps
// meaning of byte value
//
// 0 <= v < 64: [0-63] FirstObject
// first object starts v wo... |
// Copyright 2018 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::{
ast::BanjoAst,
backends::*,
parser::{BanjoParser, Rule},
},
failure::Error,
pest::Parser,
std::{... |
use crate::renderer::code_view::CodeView;
use crate::renderer::input::line_length;
use crate::renderer::rectangle::Rectangle;
use crate::renderer::Dimensions;
use std::path::PathBuf;
use wgpu::util::StagingBelt;
use wgpu::{CommandEncoder, TextureView};
use wgpu_glyph::ab_glyph::FontArc;
use wgpu_glyph::{GlyphBrush, Hor... |
mod arm64simd;
pub use arm64simd::*;
use crate::Ops;
use crate::frame::ElementWiseImpl;
use crate::frame::MatMatMul;
use crate::frame::MatMatMulImpl;
use tract_data::internal::DimLike;
fn is_cortex_a53() -> std::io::Result<bool> {
let cpu_info = std::fs::read_to_string("/proc/cpuinfo")?;
let a53 =
c... |
use prelude::*;
use image::Image;
use entity::camera::Camera;
use scoped_threadpool::Pool;
use num_cpus;
use ray::Ray;
use nalgebra as na;
use rand;
use rand::{ThreadRng, Rng};
use std::f32::consts::PI;
use std::f32;
pub struct SamplingConfig {
max_depth: usize,
starting_samples: usize,
scale_factor: f32,
... |
use super::{HttpAccount, HttpStore};
use async_trait::async_trait;
use bytes::BytesMut;
use futures::future::TryFutureExt;
use interledger_packet::{Address, ErrorCode, Packet, RejectBuilder};
use interledger_service::*;
use reqwest::{
header::{HeaderMap, HeaderName, HeaderValue},
Client, ClientBuilder, Response... |
use crate::ffi;
use std::{
error::Error as StdError,
fmt::{Display, Formatter, Result as FmtResult},
};
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum Error {
/// A value failed to match a documented [`Application`].
///
/// [`Applic... |
// Copyright 2021 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... |
#[macro_use]
extern crate log;
extern crate env_logger;
extern crate websocket;
extern crate byteorder;
extern crate fai;
use std::str;
use std::thread;
use std::sync::mpsc::{Sender, TryRecvError, channel};
use std::time::Duration;
use std::fs::File;
use std::io::prelude::*;
use byteorder::*;
use websocket::{Serve... |
use std::net::{SocketAddr, TcpListener, TcpStream};
mod logging;
use anyhow::{bail, Context};
use argh::FromArgs;
use async_executor::Executor;
use async_io::{block_on, Async};
use either::Either;
use feather_protocol::{
packets::client::HandshakeState, ClientHandshakePacket, ClientPacket, ClientPacketCodec,
... |
#![no_std]
extern crate byteorder;
extern crate bitflags;
extern crate embedded_hal as hal;
use byteorder::{ByteOrder, LittleEndian};
use hal::blocking::i2c;
pub mod pdo;
pub mod rdo;
pub mod registers;
use pdo::*;
use rdo::*;
use registers::*;
pub const STUSB4500_ADDR: u8 = 0x28;
/// Address enum for STUSB4500
p... |
use cfg_if::cfg_if;
use rayon::prelude::*;
use crate::{camera::Camera, clamp, hittable::Hittable, ray::Ray, render::Color};
const ASPECT_RATIO: f64 = 16.0 / 9.0;
const IMAGE_WIDTH: usize = 160 * 4;
const IMAGE_HEIGHT: usize = (IMAGE_WIDTH as f64 / ASPECT_RATIO) as usize;
const SAMPLES_PER_PIXEL: usize = 100;
const MA... |
use crate::errors::{ConversionError, DriverError, Result};
use core::marker::PhantomData;
use futures::ready;
use std::pin::Pin;
use std::task::{Context, Poll};
use std::{fmt::Debug, future::Future};
use tokio::io::{AsyncBufRead, AsyncRead, AsyncReadExt};
/// Read string data encoded as VarInt(length) + bytearray
pub(... |
use crate::models::phrase::Phrase;
use crate::models::word::Word;
use crate::tokenize::{PhrasedWordId, WordId};
use anyhow::{ensure, Result};
use itertools::Itertools;
use petgraph::algo;
use petgraph::algo::DfsSpace;
use petgraph::dot::{Config, Dot};
use petgraph::prelude::*;
use petgraph::visit::IntoNodeReferences;
u... |
//! General Purpose Input Output (GPIO)
//!
//! For details see p.987 in the cc2650 technical reference manual.
//!
//! Configures the GPIO pins, and interfaces with the HIL for gpio.
use core::cell::Cell;
use core::ops::{Index, IndexMut};
use ioc;
use kernel::common::regs::{ReadWrite, WriteOnly};
use kernel::hil;
co... |
use park::{BoxPark, BoxUnpark};
use task::{Task, Queue};
use worker::state::{State, PUSHED_MASK};
use std::cell::UnsafeCell;
use std::fmt;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::atomic::Ordering::{Acquire, AcqRel, Relaxed};
use crossbeam_utils::CachePadded;
use deque;
// T... |
use crate::{
config::FilesystemRetryAgentConfig,
hub::{Mail, MailAgent, MailRetryAgent, RetryAgentMessage},
};
use anyhow::Result;
use log::{debug, error, info, warn};
use serde_derive::{Deserialize, Serialize};
use std::{
collections::VecDeque,
fs, thread,
time::{Duration, SystemTime},
};
#[derive... |
use std::{collections::LinkedList, ops::Deref};
use gc::Gc;
use runtime::{
get_scope_root, new_external_function, new_list_from, new_map, new_string, new_symbol,
new_vector, nil_value, scope_get, scope_parent, Map, Object, Scope, Symbol, Value, Vector,
};
use super::{dylib_loader_lisp_fn, file_loader_lisp_fn,... |
#![doc = "generated by AutoRust 0.1.0"]
#[cfg(feature = "package-2021-08")]
pub mod package_2021_08;
#[cfg(all(feature = "package-2021-08", not(feature = "no-default-version")))]
pub use package_2021_08::{models, operations};
#[cfg(feature = "package-2021-07")]
pub mod package_2021_07;
#[cfg(all(feature = "package-2021... |
//! Grpc server.
use uslib::common::*;
use std::convert::TryInto;
use std::net::SocketAddr;
use std::sync::Arc;
use blockz::prelude::*;
// use proto::scrape_newsletter_service_server::ScrapeNewsletterService;
// use proto::scrape_newsletter_service_server::ScrapeNewsletterServiceServer;
use proto::scrape_store_serv... |
use na::{DVector, Real, Unit};
use std::ops::Range;
use joint::JointConstraint;
use math::{AngularVector, Point, Vector, DIM};
use object::{BodyHandle, BodySet};
use solver::helper;
use solver::{ConstraintSet, GenericNonlinearConstraint, IntegrationParameters,
NonlinearConstraintGenerator};
/// A constra... |
//! The module defines structures and protocols for asynchronous MPD communication
//!
//! The MPD supports very simple protocol for asynchronous client notifications about
//! different player events. First user issues `idle` command with optional argument
//! to filter events by source subsystem (like "database", "pl... |
use crate::blake2b::new_blake2b;
use crate::error::Error;
use crate::h256_ext::{H256Ext, H256};
use core::mem::size_of;
/* Account fields flags */
pub const GW_ACCOUNT_KV: u8 = 0;
pub const GW_ACCOUNT_NONCE: u8 = 1;
pub const GW_ACCOUNT_SCRIPT_HASH: u8 = 2;
/* prefix */
pub const GW_SCRIPT_HASH_TO_ID_PREFIX: [u8; 5] =... |
use crate::types::*;
use crate::errors::*;
use uuid::Uuid;
/// Contains a chat invite link
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ChatInviteLink {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serial... |
use regex::Regex;
use std::cmp::{Eq, PartialEq};
use std::collections::HashSet;
use std::hash::{Hash, Hasher};
use std::path::{Path, PathBuf};
use std::string::String;
use std::sync::Arc;
use unicode_casefold::UnicodeCaseFold;
use walkdir::{DirEntry, WalkDir};
pub struct MediaFile {
pub path: PathBuf,
base:... |
use std::{any::TypeId, borrow::Cow};
use crate::{
ArchetypeComponent, IntoSystem, Resources, System, SystemId, ThreadLocalExecution, TypeAccess,
World,
};
use bevy_utils::HashSet;
use downcast_rs::{impl_downcast, Downcast};
use super::{ParallelSystemStageExecutor, SerialSystemStageExecutor, SystemStageExecuto... |
use druid::{Widget, WidgetExt, EventCtx, Event, Env, LifeCycleCtx, LifeCycle, UpdateCtx, BoxConstraints, LayoutCtx, Size, PaintCtx, Color, RenderContext, theme, LensExt};
use druid::widget::{Flex, Label, TextBox, Scroll, List, Button, Checkbox, Either};
use crate::format::siformatter::SiFormatter;
use crate::model::pan... |
extern crate identifiers;
extern crate task;
extern crate formaters;
extern crate chrono;
use identifiers::UniqueIdentifier;
use task::Task;
use std::fs::OpenOptions;
use std::io::Write;
use std::time::Duration;
use chrono::NaiveDate;
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate serde_json... |
//! Constants
//!
//! The constant pool defined here allows Cranelift to avoid emitting the same constant multiple
//! times. As constants are inserted in the pool, a handle is returned; the handle is a Cranelift
//! Entity. Inserting the same data multiple times will always return the same handle.
//!
//! Future work ... |
// Experimental
// SuperMinHash – A New Minwise Hashing Algorithm for Jaccard Similarity Estimation
// https://arxiv.org/pdf/1706.05698.pdf
use std::cmp::min;
use std::hash::{BuildHasher, Hash, Hasher};
use fnv::FnvBuildHasher;
use rand::distributions::{Distribution, Uniform};
use rand::prelude::{SliceRandom, StdRng};... |
use std::{collections::HashMap, fmt::Display};
use anyhow::Context;
use reqwest::{RequestBuilder, StatusCode};
use serde::{self, Deserialize};
const APP_ID: u32 = 1061090;
const URL_AUTH_USER_TICKET: &str =
"https://api.steampowered.com/ISteamUserAuth/AuthenticateUserTicket/v1/";
const URL_GET_PLAYER_SUMMARIES: &... |
use std::io;
use bytes::BufMut;
use futures::{Async, Poll};
use tokio_io::AsyncWrite;
use http::{Method, Version};
use http::header::{HeaderValue, CONNECTION, DATE};
use helpers;
use body::{Body, Binary};
use httprequest::HttpMessage;
use httpresponse::HttpResponse;
use super::{Writer, WriterState, MAX_WRITE_BUFFER_SI... |
use std::rc::Rc;
use std::cell::RefCell;
use runtime::SingleThreadRuntime;
use continuation::ContinuationSt;
use signal::Signal;
use signal::signal_runtime::{SignalRuntimeRefBase, SignalRuntimeRefSt};
use signal::valued_signal::{ValuedSignal, SpSignal, CanEmit, GetValue, CanTryEmit, TryEmitValue};
/// A shared pointe... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor 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 ... |
use super::{BoundingBox, ClipBehavior, Point, Voronoi};
use super::utils::calculate_approximated_cetroid;
/// Provides a convenient way to construct a Voronoi diagram.
#[derive(Default)]
pub struct VoronoiBuilder {
sites: Option<Vec<Point>>,
lloyd_iterations: usize,
bounding_box: BoundingBox,
clip_beha... |
//!
//! tests for Payment related functions
extern crate bs58;
extern crate libc;
extern crate rand;
#[macro_use] extern crate log;
#[macro_use] extern crate serde_json;
#[macro_use] extern crate serde_derive;
#[macro_use] extern crate lazy_static;
extern crate indyrs as indy; // lib-sdk projec... |
//! Traits for canister-requested threshold signatures
//! (and the associated I-DKG)
use ic_base_types::NodeId;
use ic_base_types::PrincipalId;
use ic_types::crypto::canister_threshold_sig::error::{
IDkgCreateDealingError, IDkgCreateTranscriptError, IDkgLoadTranscriptError,
IDkgLoadTranscriptWithOpeningsError... |
// Copyright 2020 <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
//
// Unless required by applicable law or agreed t... |
// forked from https://github.com/niba1122/rust-wasm-webgl-mdn-tutorial
mod utils;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use web_sys::{WebGlRenderingContext, WebGlShader, WebGlBuffer, WebGlProgram};
use std::rc::{Rc};
use std::cell::{RefCell};
extern crate nalgebra_glm as glm;
// When the `wee_allo... |
/*! Packaging (prepping for distribution) utilities
Packaging is in two steps:
- First, we create a folder for each present language, and we move language files (text and metadata) into them
- Then, we compute a sha256sum for each file, and write them into language independent files, _usually_ compatible with `sha256s... |
/*
* Copyright 2018 The Starlark in Rust Authors.
* Copyright (c) Facebook, Inc. and its affiliates.
*
* 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
*
* https://www.apache.org/lic... |
use std::collections::HashMap;
use error::Result;
use may::sync::Mutex;
use rusqlite::Connection;
struct ChildInfo {
child_unit: String,
next_mc_unit: String,
}
lazy_static! {
static ref MAX_SPENDABLE_MCI: Mutex<Option<u32>> = Mutex::new(None);
}
fn get_max_spendable_mci(db: &Connection) -> Result<u32> ... |
//! Easing Functions(Equations)
//! # License
//! Original Code License:
//!
//! --Easing Functions(Equations)--
//!
//! MIT License
//! Copyright © 2001 <NAME>
//! Permission is hereby granted,
//! free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"),
//! ... |
use crate::{
key::SharedSecret,
memsec::{self, Scrubbed as _},
};
use cryptoxide::curve25519::curve25519;
use rand_core::{CryptoRng, RngCore};
use std::{
convert::TryFrom,
fmt::{self, Debug, Formatter},
hash::{Hash, Hasher},
str::FromStr,
};
use thiserror::Error;
#[derive(Clone)]
pub struct Sec... |
//! Use a time picker as an input element for picking times.
//!
//! *This API requires the following crate features to be activated: time_picker*
use dodrio::bumpalo;
use iced_web::{Bus, Css, Element, Widget};
pub use crate::core::time::{Period, Time};
pub use crate::style::time_picker::{Style, StyleSheet};
use std:... |
use std::fs::File;
use std::io::copy;
use std::path::PathBuf;
use std::time::Duration;
use std::{fs, thread};
use graphql_client::{GraphQLQuery, Response};
use reqwest::blocking::Client;
use reqwest::header::ACCEPT;
use serde::Deserialize;
use serde::Serialize;
#[derive(GraphQLQuery)]
#[graphql(
schema_path = "src/g... |
//! This program is an example showing how DTLS can be used in Tokio.
extern crate bytes;
extern crate env_logger;
extern crate futures;
#[macro_use]
extern crate log;
extern crate openssl;
extern crate tokio;
extern crate tokio_codec;
extern crate tokio_openssl;
mod udp;
mod util;
use std::io;
use std::net::SocketA... |
use std::{
self,
net::{Ipv4Addr, SocketAddr, SocketAddrV4, ToSocketAddrs, UdpSocket},
thread::{sleep, yield_now},
time::{Duration, Instant},
};
use crossbeam_channel::{self, Receiver, Sender, TryRecvError};
use crate::{
config::Config,
error::Result,
net::{
events::SocketEvent, Con... |
// Copyright 2018 Google LLC
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
//! Transports backed by in-memory channels.
use crate::PollIo;
use futures::{task::*, Sink, Stream};
use pin_project::pin_project;
use ... |
use crate::bulma::ImageRatio;
use crate::config_files::ImageReference;
use crate::files::{empty, write_raw};
use dashmap::DashMap;
use fast_image_resize::{FilterType, Image, MulDiv, PixelType, ResizeAlg, Resizer};
use image::io::Reader;
use image::GenericImage;
use std::borrow::Borrow;
use std::error::Error;
use std::f... |
use clap::{App, IntoApp, Parser};
use clap_generate::{generate, Generator, Shell};
use provola_core::test_runners::{Only, TestRunnerOpt};
use provola_core::*;
use provola_reporters::{ReporterType, DEFAULT_REPORTER_STR};
use provola_testrunners::make_test_runner;
use provola_testrunners::{TestRunnerInfo, TestRunnerType}... |
//! LE [`AdvertisingReport`] and [`ReportInfo`] types.
use crate::bytes::Storage;
use crate::hci::le::{MetaEvent, MetaEventCode};
use crate::le::advertisement::{RawAdvertisement, StaticAdvBuffer, MAX_ADV_LEN};
use crate::le::report::{AddressType, EventType, NumReports, ReportInfo};
use crate::{BTAddress, PackError, BT_... |
use std::fs::File;
use std::io::Read;
use std::io::Write;
use std::io::Result as IOResult;
use std::env;
const DEFAULT_HEADER: &'static str = r#"\documentclass[12pt, a4paper, twoside, titlepage]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{a4}
\usepackage[ngerman]{babel}
\usepac... |
// Copyright © 2018 <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, publish, distribu... |
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
#![deny(warnings)]
use aws_nitro_enclaves_image_format::defs::EifIdentityInfo;
use aws_nitro_enclaves_image_format::utils::eif_reader::EifReader;
use aws_nitro_enclaves_image_format:... |
//! Class for specifying user-defined functions which perform a
//! transformation on a slice.
//!
//! It is not required that every slice
//! belong to the domain and/or range of a function. Subclasses should
//! define InDomain and InRange to determine which slices are in either
//! of these sets respectively.
/// ... |
#![cfg_attr(docsrs, feature(doc_cfg))]
//! # hyper_trust_dns_connector
//!
//! A crate to make [trust-dns-resolver](https://docs.rs/trust-dns-resolver)'s
//! asynchronous resolver compatible with [hyper](https://docs.rs/hyper) client,
//! to use instead of the default dns threadpool.
//!
//! ## Features
//!
//! * `hyp... |
use crate::model::OnnxOpRegister;
use crate::model::ParsingContext;
use crate::pb::*;
use tract_hir::internal::*;
use tract_hir::ops;
use tract_hir::ops::binary::Nary;
mod clip;
mod gemm;
mod mat_mul_integer;
mod pow;
mod rem;
pub fn register_all_ops(reg: &mut OnnxOpRegister) {
reg.insert("Add", |_, _| Ok((ops::m... |
use std::env;
use std::fs;
use std::io::Write as _;
use lazy_static::lazy_static;
use structopt::StructOpt;
use tempfile::{tempdir, TempDir};
use acick_util::abs_path::AbsPathBuf;
use acick_util::assert_matches;
static ARC100_C_SOURCE: &str = r#"/*
[arc100] C - Linear Approximation
*/
#include <algorithm>
#include ... |
use std::{collections::HashMap, fmt::Display};
/// Resource requested
#[derive(Debug, PartialEq, Clone)]
pub enum Resource {
/// A path for a subpage
Path(String)
}
/// Http Request struct.
/// ```
/// use http::request::{HttpRequest, Method, Version, Resource};
/// use std::collections::HashMap;
///
/// let raw_re... |
use cbor_event;
use coin::{self, Coin};
use fee::{self, Fee, FeeAlgorithm};
use std::{fmt, result};
use tx::TxOut;
use txbuild::{self, TxBuilder};
use txutils::{output_sum, Input, OutputPolicy};
mod simple_selections;
pub use self::simple_selections::{Blackjack, HeadFirst, LargestFirst};
#[derive(Debug)]
pub enum Er... |
use crate::error::*;
use metfor::{Celsius, HectoPascal, Meters, WindSpdDir};
use sounding_base::Sounding;
use optional::{some, Optioned};
macro_rules! validate_f64_positive {
($var:expr, $var_name:expr, $err_list:ident) => {
if let Some(val) = $var.into_option() {
let val: f64 = metfor::Quanti... |
use crate::parse::{CursorExt, ReadExt};
use crate::Error;
use std::collections::HashMap;
use std::io::{self, Read};
use std::net::{IpAddr, Ipv4Addr};
use std::time::Instant;
use tokio::net::UdpSocket;
pub struct DnsCache {
addrs: HashMap<String, DnsEntry>,
}
#[derive(Clone, Debug)]
struct DnsEntry {
address:... |
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use fuchsia_zircon::{self as zx, HandleBased};
use log::warn;
use parking_lot::{RwLockReadGuard, RwLockWriteGuard};
use std::sync::Arc;
use syncio::{zxio::... |
use std::{
collections::{HashMap, HashSet},
vec,
};
use itertools::Itertools;
struct Digit {
number: u8,
raw_mapping: [bool; 7],
}
impl Digit {
fn mapped_str_mapping(&self, mapping: &Vec<&char>) -> String {
let mut out = String::new();
for (i, &c) in mapping.iter().enumerate() {
... |
extern crate mnist;
extern crate nalgebra;
extern crate typenum;
extern crate futures;
extern crate futures_cpupool;
extern crate num_cpus;
use mnist::{Mnist, MnistBuilder};
use nalgebra::{Matrix, MatrixArray, U28, VectorN};
use typenum::{U785};
type Image = Matrix<f32, U28, U28, MatrixArray<f32, U28, U28>>;
type Wei... |
use crate::packet::ReferenceIdentifier;
use std::convert::From;
use std::error::Error;
use std::fmt::{Display, Formatter};
/// Kiss code, reason of a Kiss-o'-Death reply.
///
/// Kiss code provides an information about why the SNTP server sent a Kiss-o'-Death packet, i.e.
/// why the request is rejected. This enum is ... |
use std::collections::HashMap;
use std::num::FromPrimitive;
use std::ptr;
use std::string;
use std::vec;
use keycode::KeyCode;
use rect::Rect;
use scancode::ScanCode;
use video::Window;
#[allow(non_camel_case_types)]
pub mod ll {
use libc::{c_int, c_char, c_uint, int32_t, uint8_t, uint16_t,
ui... |
use definition::workload::WorkloadDefinition;
use log::{error, info};
use node_metrics::metrics::Metrics;
use proto::common::{InstanceMetric, WorkerMetric, WorkerStatus, WorkloadRequestKind};
use proto::controller::WorkloadScheduling;
use proto::worker::InstanceScheduling;
use std::error::Error;
use std::fmt;
use std::... |
use std::fmt;
use std::io;
use std::net::{
Ipv4Addr,
Ipv6Addr,
IpAddr,
SocketAddr,
SocketAddrV4,
SocketAddrV6,
};
use futures::{
Async,
Poll,
Stream,
stream,
};
use dns_consts::{
Class,
Type,
};
use service::{
QueryRecord,
QueryRecordData,
QueryRecordFlags,
QueryRecordResult,
query_record_extended,
}... |
use std::collections::HashMap;
use std::io::Read;
use std::fs::File;
use std::sync::Arc;
use unicode_normalization::UnicodeNormalization;
use rusttype::{Font as RFont, Scale, point, Rect};
use super::{Color, Mesh, MeshBuilder, Model, ModelBuilder, Texture, Transform};
const TEXTURE_SIZE: (usize, usize) = (1024, 1024... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.