text stringlengths 3.09k 13.9k |
|---|
// 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, Error};
use fuchsia_async as fasync;
use fuchsia_syslog::fx_log_err;
use futures::lock::Mutex;
use serde::de::DeserializeOwned;
us... |
// Copyright (c) 2021 Quark Container 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 ... |
#[derive(Debug, Clone)]
pub struct Point {
pub x: f64,
pub y: f64,
}
impl Point {
pub fn new(x: f64, y: f64) -> Self {
Point { x, y }
}
fn rotate(&self, axis: &Point, keel: f64) -> Point {
let s = keel.sin();
let c = keel.cos();
let tx = self.x - axis.x;
let... |
extern crate slog;
mod beacon_chain_types;
mod client_config;
pub mod error;
pub mod notifier;
use beacon_chain::BeaconChain;
use exit_future::Signal;
use futures::{future::Future, Stream};
use network::Service as NetworkService;
use prometheus::Registry;
use slog::{error, info, o};
use slot_clock::SlotClock;
use std... |
use crate::prelude::*;
use crate::{complete_proxy_impl, error_proxy_impl, is_stopped_proxy_impl};
#[derive(Clone)]
pub struct ScanOp<Source, BinaryOp, OutputItem> {
pub(crate) source_observable: Source,
pub(crate) binary_op: BinaryOp,
pub(crate) initial_value: OutputItem,
}
pub struct ScanObserver<Observer, Bin... |
extern crate chrono;
extern crate deflate;
extern crate zipr;
use deflate::deflate_bytes;
use std::{env, process};
use std::fs::*;
use std::path::PathBuf;
use chrono::prelude::*;
use std::io::{BufReader, Read, BufWriter, Write};
use zipr::zip_header::ZipHeader;
use zipr::central_dir_header::CentralDirHe... |
use hashbrown::HashMap;
use rand::prelude::*;
use serde::{Deserialize, Serialize};
use std::cmp::{min, Ordering};
use std::ops::{Deref, DerefMut};
#[derive(Default, Serialize, Deserialize)]
pub struct Markov<'a> {
#[serde(borrow)]
chain: HashMap<Vec<&'a str>, LinkSet<'a>>,
entries: Vec<&'a str>,
depth... |
use crate::{Event, Input, Motion};
/// Stores the touch state.
#[derive(Copy, Clone, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
pub enum Touch {
/// The start of touch, for example
/// a finger pressed down on a touch screen.
Start,
/// The move of touch, for example
/// ... |
//! Mercator
use super::OperatorArgs;
use super::OperatorCore;
use crate::operator_construction::*;
use crate::Context;
use crate::CoordinateTuple;
use crate::Ellipsoid;
use crate::GeodesyError;
#[derive(Debug)]
pub struct Merc {
ellps: Ellipsoid,
inverted: bool,
k_0: f64,
lon_0: f64,
lat_0: f64,
... |
use alloc::{boxed::Box, vec::Vec};
use embedded_hal::PwmPin;
use heapless::LinearMap;
use crate::{config::peripherals::pwm as config, datastore, fcs::out::Configuration};
type PWM = Box<dyn PwmPin<Duty = u16> + Send>;
pub struct PWMs<'a> {
config_iteration: usize,
pwms: Vec<(&'a str, PWM)>,
motors: heap... |
// Code generated by mkerrno_linux.py; DO NOT EDIT.
pub type Errno = i32;
pub const EPERM: Errno = 1;
pub const ENOENT: Errno = 2;
pub const ESRCH: Errno = 3;
pub const EINTR: Errno = 4;
pub const EIO: Errno = 5;
pub const ENXIO: Errno = 6;
pub const E2BIG: Errno = 7;
pub const ENOEXEC: Errno = 8;
pub const EBADF: Err... |
//! Transparency, visibility sorting and camera centroid culling for 3D Meshes.
use crate::{
camera::{ActiveCamera, Camera},
transparent::Transparent,
};
use amethyst_core::{
ecs::prelude::{
Component, DenseVecStorage, Entities, Entity, Join, Read, ReadExpect, ReadStorage, System,
Write,
... |
//! Module for items related to aggregating validation_receipts
use fallible_iterator::FallibleIterator;
use holo_hash::AgentPubKey;
use holo_hash::DhtOpHash;
use holochain_keystore::AgentPubKeyExt;
use holochain_keystore::KeystoreSender;
use holochain_lmdb::buffer::BufferedStore;
use holochain_lmdb::buffer::KvvBufUse... |
//! (deprecated) Interactive Distributed Key Generation (DKG) Types
//!
//! The types in this file correspond to the types used in the spec, including
//! ephemeral (secp256k1) keys, dealings, complaints and transcripts. Please
//! see the specification for more details.
mod advanced_ops;
#[cfg(test)]
mod arbitrary;
... |
use std::path::Path;
use std::time::Instant;
use sdl2::audio::{AudioSpecDesired, AudioCallback, AudioSpec};
use sdl2::event::Event;
use sdl2::rect::Rect;
use crate::base::App;
use crate::geometry::Point;
use crate::input::Input;
use crate::video::{draw_str, ScreenBuffer};
pub mod base;
pub mod input;
pub mod geometr... |
use super::{
security::{AccessChecker, Subjects, Token, TokenMgr, TokenMgrError},
ApiResult, ResultToApiUtil as _,
};
use std::sync::Arc;
pub(crate) type DbPool = Arc<db::DbConn>;
//TODO: Do not clone Context on every request
pub(crate) struct ContextData {
pub(crate) cfg: Arc<entity::Loader>,
pub(cra... |
use common::datatypes::bucket::BucketUsersData;
//use Context;
use util::button::Button;
use yew::prelude::*;
use wire::bucket::BucketUsersResponse;
use util::loadable::Loadable;
use util::uploadable::Uploadable;
//use context::networking::RequestWrapper;
use identifiers::bucket::BucketUuid;
use identifiers::user::... |
#[macro_use]
extern crate log;
mod error;
mod sql_database_migration_inferrer;
mod sql_database_step_applier;
mod sql_destructive_changes_checker;
mod sql_migration;
mod sql_migration_persistence;
mod sql_renderer;
mod sql_schema_calculator;
mod sql_schema_differ;
pub use error::*;
pub use sql_connection::SqlFamily;
... |
// Copyright 2019 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT
// https://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD
// https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied,
// modified, or d... |
#[macro_use]
extern crate log;
use core::panic;
use std::fs::OpenOptions;
use i3ipc::{
event::{inner::WindowChange, Event, WindowEventInfo},
reply::{Node, NodeLayout, NodeType},
EstablishError, I3Connection, I3EventListener, Subscription,
};
use log::{trace, warn};
use settings::{load_settings, Settings};... |
// Copyright (c) 2016-2017 <NAME> <<EMAIL>>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use libra_types::{
access_path::AccessPath,
contract_event::ContractEvent,
on_chain_config::ConfigStorage,
vm_status::{StatusCode, VMStatus},
write_set::{WriteOp, WriteSet, WriteSetMut},
};
use move_core_types::lang... |
#![allow(unused_variables, dead_code, unused_imports, unused_mut)]
#[macro_use]
extern crate serde_derive;
extern crate jsonwebtoken as jwt;
extern crate chrono;
#[macro_use]
extern crate log;
mod protocol_buffer;
mod ffi_utils;
mod grant;
mod logging;
use std::os::raw::c_char;
use std::str::FromStr;
use std::error... |
use std::path::Path;
use std::{fs, fmt};
use std::collections::{HashSet, HashMap};
const ASTEROID: char = '#';
fn main() {
// Part 1
assert_eq!((Pos::new(3, 4), 8), best_position(&Map::from_file("sample0.txt").find_asteroids()));
assert_eq!((Pos::new(5, 8), 33), best_position(&Map::from_file("sample1.txt"... |
// Generated by `scripts/generate.js`
use utils::vk_traits::*;
/// Wrapper for [VkSurfaceTransformFlagsKHR](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkSurfaceTransformFlagsKHR.html).
///
/// Use the macro `VkSurfaceTransformFlags!` as an alternative method to create a structure. For examp... |
//! This module contains a virtual filesystem backed by a SLF file.
#![allow(dead_code)]
use lru::LruCache;
use std::collections::HashSet;
use std::ffi::OsString;
use std::fmt;
use std::io;
use std::io::SeekFrom;
use std::path::{Path, PathBuf};
use std::rc::Rc;
use std::sync::Mutex;
use crate::fs;
use crate::fs::File... |
use std::fs::File;
use std::io::{BufWriter, Read, Seek, SeekFrom};
use std::path::{Path, PathBuf};
use std::sync::mpsc::channel;
use std::time::Duration;
use notify::{DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher};
use self::CompareError::*;
use super::comparer_config::*;
use super::disasm::*;
use super:... |
//! Converts a series of images by time to images by row. I.e. transposes (x,y) in the cube in (x,y,t) to (x,t).
use crate::shake::Crop;
use crate::slicer::SliceLength::{Count, Pixels, Rows};
use crate::streams::{Compression, ImageStream, PixelOutputStream};
use crate::ParseEnumError;
use image::flat::SampleLayout;
us... |
// Copyright (c) 2019 Ant Financial
//
// 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 crate::data_processing::{get_dataset_by_name, ContestDataset, Dataset};
use crate::systems::{
simulate_contest, CodeforcesSys, EloMMR, EloMMRVariant, Glicko, PlayersByName, RatingSystem,
TopcoderSys, TrueSkillSPb, BAR,
};
use crate::metrics::{compute_metrics_custom, PerformanceReport};
use rand::rngs::StdR... |
//! Async Groth16 batch verifier service
use std::{
fmt,
future::Future,
mem,
pin::Pin,
task::{Context, Poll},
};
use bellman::{
groth16::{batch, prepare_verifying_key, VerifyingKey},
VerificationError,
};
use bls12_381::Bls12;
use futures::future::{ready, Ready};
use once_cell::sync::Lazy... |
use core::fmt;
use std::{
marker::PhantomData,
ops::{Deref, DerefMut},
};
use crate::{
forest::{Config, Secrets, TreeTypes},
index::Index,
tree::Tree,
};
/// A thing that hands out unique offsets. Parts of StreamBuilderState
///
/// these are the byte offsets for the stream cipher and not related ... |
use std::path::Path;
use std::{fmt, fs};
use graphql_parser::schema::Definition::TypeDefinition;
use graphql_parser::schema::TypeDefinition::Object;
use tracing::{debug, error, instrument, trace, warn};
use walkdir::WalkDir;
use crate::schema::DataType;
/// A path scanner accepts an address, such as a file path, and... |
use bytes::Buf;
use hashing::hash;
use int_to_bytes::int_to_bytes4;
use std::io::Cursor;
const SEED_SIZE: usize = 32;
const ROUND_SIZE: usize = 1;
const POSITION_WINDOW_SIZE: usize = 4;
const PIVOT_VIEW_SIZE: usize = SEED_SIZE + ROUND_SIZE;
const TOTAL_SIZE: usize = SEED_SIZE + ROUND_SIZE + POSITION_WINDOW_SIZE;
/// ... |
use base_62::base62;
use na::{IsometryMatrix3, Matrix4, Point3, Vector2, Vector3, Vector4};
use rand::seq::SliceRandom;
use rand::thread_rng;
use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet};
use std::fmt;
use std::hash::Hash;
use std::hash::Hasher;
pub fn face_towards_dir(
pos: &Vecto... |
use proc_macro2::{Ident, Span, TokenStream};
use quote::{quote_spanned, ToTokens};
use syn::{Expr, ExprAsync, Stmt, Token};
use super::{CratePath, OuterAttrs};
/// Transform an async block to a completion stream.
pub(crate) fn transform(mut expr: ExprAsync, crate_path: &CratePath) -> TokenStream {
let item = Iden... |
//! # Tcp Network
//!
//! `tcp` contains the Tcp network backend types and functions.
use crate::error::Error;
use crate::message::Message;
use crate::result::Result;
use crate::traits::Network;
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use crypto::hash::{Blake512Hasher, Digest};
use std::io::{Cursor, R... |
use crate::bluez::{enable_le_scan, get_filter, open, set_filter, HciEvent, HciFilter, HciType};
use crate::bt_parsing::bt_parser;
use crate::event::{Color, Dispatcher, Event};
use crate::ibeacon_parsing::{ibeacon_parser, IBeacon};
use anyhow::{Context, Result};
use std::{
convert::{TryFrom, TryInto},
io::Read,
... |
use druid::piet::{Text, TextAlignment, TextLayoutBuilder, TextAttribute};
use druid::widget::prelude::*;
use druid::widget::{Align, Button, Flex};
use druid::{
commands, AppDelegate, AppLauncher, Color, Command, Data, DelegateCtx, Env, FileDialogOptions,
FileSpec, Handled, Lens, LocalizedString, Selector, Targe... |
//!
use crate::gateway::{GatewayController, GatewayConfig};
use crate::http::{HttpConfig, RateLimits};
use derive_setters::*;
use minnie_errors::*;
use minnie_model::gateway::PresenceUpdate;
use minnie_model::types::{DiscordClientSecret, DiscordToken, Snowflake};
use reqwest::{Client, ClientBuilder};
use reqwest::head... |
// rgb.rs Rgb pixel format.
//
// Copyright (c) 2018-2019 <NAME>
//
use pix::{Mask8, Rgb, Translucent, Associated};
use crate::Blend;
#[cfg(all(target_arch = "x86", feature = "simd"))]
use std::arch::x86::*;
#[cfg(all(target_arch = "x86_64", feature = "simd"))]
use std::arch::x86_64::*;
impl Blend for Rgb<Ch8,... |
use crate::Error;
use super::accum::{Accum, ACCUM_MAX};
use super::bit_src::BitSrc;
use std::mem;
#[cfg(target_pointer_width = "64")]
const MASK: [usize; 9] = [
0x0000_0000_0000_0000,
0x0000_0000_0000_00FF,
0x0000_0000_0000_FFFF,
0x0000_0000_00FF_FFFF,
0x0000_0000_FFFF_FFFF,
0x0000_00FF_FFFF_... |
use crate::constants::DISCORD_API_URL;
use crate::{route, types, ThreadSafeError, ThreadSafeResult};
use tracing::debug;
use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION, CONTENT_TYPE, USER_AGENT};
use reqwest::Method;
#[derive(Copy, Clone, Debug)]
pub enum RequestMethod {
GET,
POST,
PUT,
... |
use std::borrow::Cow;
use crate::constraints::Margin;
use crate::Alignment;
use crate::Result;
use crate::WrapStyle;
use fontdue::layout::{self, GlyphPosition, Layout, TextStyle};
use glam::{Vec2, Vec3};
use ivy_base::Size2D;
use ivy_graphics::NormalizedRect;
use crate::{Font, UIVertex};
pub struct Text {
str: C... |
use crate::config::{Config, OnFailure};
use crate::fst::*;
use crate::utils::traits::CommandConfig;
use libc::{fork, signal};
use libc::{SIGHUP, SIG_IGN};
use std::fs;
use std::path::{Path, PathBuf};
use std::process::{exit, Command, Stdio};
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
pub struct Run {
/// ... |
//! Core types, methods, and constants to be shared between all components of the bindgen pipeline.
//!
//! This component is intended to be fairly minimal, to reduce the impact of having it included in client code.
/// Marker trait for types that are trivially stable ABI types
pub trait FfiStable {}
macro_rules! tri... |
use anyhow::Error;
use bytes::Bytes;
use http::{self, header::HeaderName, HeaderMap, HeaderValue, Request, StatusCode};
use std::str::FromStr;
#[derive(Debug, thiserror::Error)]
enum HttpError {
#[error("Invalid handle")]
InvalidHandle,
#[error("Memory not found")]
MemoryNotFound,
#[error("Memory a... |
extern crate regex;
extern crate num_cpus;
extern crate rand;
extern crate byte_unit;
extern crate csv;
extern crate serde;
use crate::{
compile::{
compile,
Compiled,
},
navigate::{
DemoLookup,
demo_lookup,
},
quant::{
subproc,
demo_min_time,
},
... |
use parking_lot::Mutex;
use gc::swiper::card::CardTable;
use gc::swiper::controller::SharedHeapConfig;
use gc::swiper::crossing::CrossingMap;
use gc::swiper::{CARD_SIZE, CARD_SIZE_BITS};
use gc::{arena, gen_aligned, Address, Region, GEN_SIZE};
use mem;
use object::offset_of_array_data;
pub struct OldGen {
total: ... |
use super::client::BleConnectEvent;
use super::svc::BlePeerService;
use super::uuid::BleUUID;
use super::{Ble, BlePeerDeviceSharedState};
use anyhow::Result;
use esp_idf_hal::mutex::Mutex;
use std::sync::mpsc::Receiver;
use std::sync::Weak;
pub type BleConnHandle = u32;
enum BlePeerServiceDiscoveryEvent {
Discove... |
// Copyright 2017 <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... |
/*
* Copyright (c) 2016 <NAME> <<EMAIL>>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, pu... |
use super::event::*;
use super::super::control::*;
use super::super::controller::*;
use flo_stream::*;
use flo_binding::*;
use itertools::*;
use futures::*;
use futures::future::{BoxFuture};
use std::mem;
use std::sync::*;
use std::collections::HashMap;
///
/// Core UI session structures
///
pub struct UiSessionCor... |
//! This module offers structs and traits for valueset analysis as inctroduced
//! in "Analyzing Memory Access in x86 Executables" by <NAME> and
//! <NAME>
//! It offers datastructures specific to memory access
use std::collections::HashMap;
use std::hash::Hash;
use std::fmt::Debug;
use std::fmt;
use petgraph::graph:... |
// Generated from definition com.github.openshift.api.route.v1.TLSConfig
/// TLSConfig defines config used to secure a route and provide termination
#[derive(Clone, Debug, Default, PartialEq)]
pub struct TLSConfig {
/// caCertificate provides the cert authority certificate contents
pub ca_certificate: Option<S... |
use super::{
behavior::{DilateBehavior, RevolveBehavior, SpreadBehavior, TranslateBehavior},
PreviewParams, HANDLE_RADIUS,
};
use crate::{
accumulator::Accumulator,
camera::Camera,
capture::Capture,
color::Color,
interaction::{ClickInteraction, DragInteraction, Interaction, MouseReleaseInter... |
use codespan_reporting::files::{Error as FilesError, Files, SimpleFile};
use std::ops::Range;
use std::path::{Path, PathBuf};
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct SourceFileId(usize);
// This should probably implements `Files` directly instead of relying on SimpleFile
#[derive(Debug)] // TODO Implement... |
use std::io;
use byteorder::{LittleEndian, ReadBytesExt};
use failure::Error;
use assumption_failed;
use not_found;
const EXT4_BLOCK_GROUP_INODES_UNUSED: u16 = 0b1;
const EXT4_BLOCK_GROUP_BLOCKS_UNUSED: u16 = 0b10;
#[derive(Debug)]
struct Entry {
inode_table_block: u64,
max_inode_number: u32,
}
#[derive(De... |
use std::collections::HashMap;
use std::os::unix::fs::MetadataExt;
use itertools::Itertools;
const DIVISORS_SI: [(u64, &'static str); 4] = [
(1_000_000_000_000, "T"),
(1_000_000_000, "G"),
(1_000_000, "M"),
(1_000, "K"),
];
const DIVISORS_NON_SI: [(u64, &'static str); 4] = [
(1_099_511_627_776, "T... |
mod custom_tag;
use custom_tag::HTag;
use pulldown_cmark::{CodeBlockKind, Event, Options, Parser, Tag};
use yew::{
html,
virtual_dom::{VNode, VTag, VText},
Html,
};
pub fn render_markdown(src: &str) -> Html {
let mut depth: u32 = 0; // virtal stack
let mut spine = Vec::new();
macro_rules! add... |
// Copyright 2022 OpenStax Poland
// Licensed under the MIT license. See LICENSE file in the project root for
// full license text.
use memchr::memmem;
use serde::Serialize;
use thiserror::Error;
use crate::{mail::{syntax as mail, ParseFieldError, separate_message}, syntax::*, state::Errors};
use super::{Unparsed, En... |
#[macro_use]
use serde_derive::*;
use nalgebra_glm::{Mat4, Vec3};
extern crate nalgebra;
/// Data of a single bezier curve in a bezier patch
#[derive(Serialize, Deserialize, Clone)]
pub struct BezierCurveParameters {
/// The four control points that describe this curve
pub control_points: [Vec3; 4]
}
impl Bez... |
//! # Quick Start
//!
//! Contained within this module are two functions:
//! * `is_witness`
//! * `is_prime`
//!
//! The function `is_witness` performs a single iteration of the Miller-Rabin
//! primality test.
//!
//! On the other hand, `is_prime` is a routine that performs the Miller-Rabin
//! primality test a g... |
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::thread;
use directories::{ProjectDirs, UserDirs};
use rayon::prelude::*;
use structopt::StructOpt;
use url::Url;
use steno_lookup::alfred::results_to_alfred;
use steno_lookup::{Dictionary, Error, InvertedDictionary, Stroke};
const ADDR: &str = "127.0.0.1:2... |
//! Slider element
//!
//! Slider used to select a value from of values. Silder will try to fill
//! horizontal space of its container.
//!
//! See [`Slider`] docs to find out more about its methods.
//!
//! # Usage
//! TODO
//!
//! [`Slider`]: crate::prelude::Slider
use crate::{id::Id, prelude::*};
use derive_rich::R... |
// Copyright © 2018 <NAME>
// This program is licensed under the "MIT License". Please
// see the file `LICENSE` in this distribution for license
// terms.
//! Chomp player in Rust.
extern crate rand;
use rand::Rng;
use std::collections::HashSet;
use std::env;
use std::fmt::{self, Display};
use std::io::Write;
use ... |
use {
bindings::windows::win32::{
controls::MARGINS,
display_devices::RECT,
dwm::{DwmDefWindowProc, DwmExtendFrameIntoClientArea, DwmIsCompositionEnabled},
shell::{DefSubclassProc, SetWindowSubclass},
system_services::{
FALSE, HTBOTTOM, HTBOTTOMLEFT, HTBOTTOMRIGHT... |
use serde::{Serialize, Deserialize};
use clap::{App, Arg};
use crate::types::{WSDEnum, Format, Style, PaperSize, PaperOrientation, PlotParameters};
use std::error::Error;
/// Represent configuration obtained from command line
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Config {
///... |
use rdkafka::{
Message,
message::BorrowedMessage,
config::ClientConfig,
consumer::{CommitMode, Consumer, stream_consumer::StreamConsumer},
topic_partition_list::{Offset, TopicPartitionList},
};
use kafka::Config;
use events::{
application::Application,
push_notification::PushNotification,
... |
use heck::SnakeCase;
use proc_macro2::{Span, TokenStream};
use quote::{format_ident, quote};
use serde::Deserialize;
use serde_yaml::Value;
use std::fs;
use std::path::Path;
use syn::parse::{Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::spanned::Spanned;
use syn::{Error, Result};
#[derive(Deserialize)... |
use futures::{stream, Future, Stream};
use network::transport::MPSCAddress;
pub use network::transport::MPSCConnection;
use network::transport::MPSCTransport;
use rand::{self, Rng};
use std::collections::HashSet;
use std::hash::Hash;
use std::ops::Add;
use std::time::{Duration, Instant};
use tokio;
use tokio_timer::Del... |
use crate::error;
use error::PrintableError;
use num_bigint::{BigInt, BigUint};
use num_rational::BigRational;
use num_traits::identities::zero;
use std::convert::TryFrom;
pub struct Error<K> {
column: u16,
kind: K,
}
pub type LexError = Error<LexErrorKind>;
pub enum LexErrorKind {
TooManyTabs,
TooMa... |
use std::io::Write;
use std::os::unix::prelude::*;
use std::{env, ffi, fs, io, path, process, time};
use nix::{errno, fcntl, sys, unistd};
use crate::ops::{block_on_locked_file, files, OpsError, QUEUE_FILE_PREFIX};
struct TaskFileHandler {
pub queue_dir: path::PathBuf,
cmd: ffi::OsString,
args: Vec<ffi::... |
extern crate image;
use array2d::Array2D;
use image::{ImageBuffer, Rgba, RgbaImage, SubImage, imageops};
use image::math::Rect;
use crate::color;
struct TransparencyMask {
bounds: Rect,
filter: Array2D<bool>,
}
fn create_filter_from_color(mask_color: Rgba<u8>, image: &RgbaImage) -> Array2D<bool> {
let (... |
use async_trait::async_trait;
use k8s_cri::v1alpha2 as cri;
use log::{debug, error, info};
use std::sync::Arc;
use crate::states::{PodState, Registered, SharedPodState, Terminated};
type Namespace = String;
type Pod = String;
type Container = String;
type Id = String;
pub(crate) type PodMap =
Arc<tokio::sync::Rw... |
use crate::calculus::*;
use crate::layer;
use crate::layer::*;
use crate::numpy;
use crate::numpy::*;
use rand::distributions::{Normal, Distribution};
use rand::prelude::*;
pub struct Network {
pub layer1: Box<ConvolutionLayer>,
pub layer2: Box<CnnReluLayer>,
pub layer3: Box<MaxPoolingLayer>,
pub layer... |
use crate::sealed;
use crate::wire::{packet, Packet};
use err_derive::Error;
#[derive(Debug, Copy, Clone, Eq, PartialEq, Error)]
pub enum Error {
#[error(display = "Not enough bytes in the decoder buffer to store the frame")]
InsufficientBufferSize,
#[error(display = "Encountered a packet error. {}", _0)]... |
use change::Change;
use std::env;
use std::fmt;
use std::fs::{self, DirBuilder};
use std::error::Error;
use std::io::prelude::*;
use std::fs::File;
use std::default::Default;
use std::path::Path;
use std::str::FromStr;
use serde_json;
#[derive(PartialEq, Clone, Serialize, Deserialize)]
pub enum Timing {
Pre,
P... |
use std::num::NonZeroU32;
async fn run() {
let instance = wgpu::Instance::new(wgpu::BackendBit::PRIMARY);
let adapter = instance
.request_adapter(&wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::default(),
compatible_surface: None,
})
.awai... |
//! A collection of newtypes defining type-strong IDs.
use std::fmt::{Display, Formatter, Result as FmtResult};
use chrono::{DateTime, TimeZone, Utc};
use serde::de::{Deserialize, Deserializer};
use super::utils::U64Visitor;
use crate::internal::prelude::*;
macro_rules! id_u64 {
($($name:ident;)*) => {
... |
//! A library for creating General Game Playing (GGP) players. This library is based off of
//! [GGP Base](https://github.com/ggp-org/ggp-base). While GGP Base allows the creation of
//! players backed by a propositional network or a logic prover, this library currently only
//! supports logic prover based players.
//!... |
#[macro_use] extern crate anyhow;
#[macro_use] extern crate clap;
extern crate encoding;
extern crate magic;
extern crate mlua;
extern crate squashfs;
mod info;
use std::cell::RefCell;
use std::collections::HashMap;
use std::convert::TryInto;
use std::ffi::{OsStr, OsString};
use std::fs::File;
use std::io::{Read, Wri... |
use std::convert::TryFrom;
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use yaserde_derive::{YaDeserialize, YaSerialize};
use crate::{Attribution, Event, GedcomxError, Group, Person, PlaceDescription, Relationship, Uri};
/// A reference to data being used to derive the given instance o... |
use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::ops::Deref;
use std::path::Path;
use itertools::Itertools;
use regex::Regex;
use select::document::Document;
use select::node::Data;
use select::node::Node;
use select::predicate::*;
use std::process::Command;
use quote::*;
use proc_macro2::TokenStrea... |
use crate::boards::idx_coord::BoardCoord;
use crate::boards::{board_cols, board_rows};
use crate::constants::colors::{
alpha, APRICOT, BLACK, COPPER, CREAM, DARK_GREEN, LIGHT_BLUE, PIECE_COMPUTER, PIECE_HUMAN,
TRANSPARENT, WHITE,
};
use crate::chess::State;
use crate::system::letter_mesh::make_letter_mesh;
use... |
//! The [`FromPest`] conversion framework to convert from pest trees into typed structure.
#[doc(hidden)]
pub extern crate pest;
extern crate void;
#[doc(hidden)]
pub extern crate log;
#[doc(inline)]
pub use void::Void;
use {
pest::{
iterators::{Pair, Pairs},
RuleType,
},
std::marker::Pha... |
//! Wrapper for a `Collect` or `Subscribe` to allow it to be dynamically reloaded.
//!
//! This module provides a type implementing [`Subscribe`] which wraps another type implementing
//! the [`Subscribe`] trait, allowing the wrapped type to be replaced with another
//! instance of that type at runtime.
//!
//! This ca... |
use crate::switch::ToCKBCellDataTuple;
use crate::utils::config::SIGNER_FEE_RATE;
use crate::utils::tools::{check_capacity, is_XT_typescript, verify_btc_address, XChainKind};
use crate::utils::types::{Error, ToCKBCellDataView};
use ckb_std::ckb_constants::Source;
use ckb_std::debug;
use ckb_std::error::SysError;
use ck... |
//! Parking and unparking timely fibers.
use std::rc::Rc;
use std::cell::RefCell;
use std::sync::mpsc::{Sender, Receiver};
use std::thread::Thread;
/// Allocation-free activation tracker.
pub struct Activations {
clean: usize,
/// `(offset, length)`
bounds: Vec<(usize, usize)>,
slices: Vec<usize>,
... |
// Copyright (c) 2012-2022 Supercolony
//
// 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, publis... |
use crate::{BTreeMap, String, Vec};
use algebra::Field;
use r1cs_core::{ConstraintSystem, Index, LinearCombination, SynthesisError, Variable};
#[derive(Debug)]
enum NamedObject {
Constraint(usize),
Var(Variable),
Namespace,
}
/// Constraint system for testing purposes.
pub struct TestConstraintSystem<Cons... |
//< ch-3
use std;
use std::cell::RefCell;
use std::rc::Rc;
use llvm_sys::prelude::LLVMValueRef;
use iron_llvm::core;
use iron_llvm::core::types::{FunctionType, FunctionTypeRef, RealTypeCtor, RealTypeRef};
use iron_llvm::core::value::{Function, FunctionCtor, FunctionRef, Value};
use iron_llvm::execution_engine::execut... |
#![warn(rust_2018_idioms)]
#![warn(clippy::pedantic)]
#![warn(clippy::cargo)]
#![warn(clippy::nursery)]
#![allow(clippy::non_ascii_literal)]
#![deny(unsafe_code)]
use std::{
fmt::{self, Display},
result::Result as StdResult,
time::Duration,
};
use anyhow::{anyhow, Context, Error};
use clap::ArgMatches;
us... |
#![allow(clippy::from_over_into)]
use crate as pallet_client;
use frame_support::parameter_types;
use frame_system as system;
use frame_system::EnsureRoot;
use sp_core::H256;
use sp_runtime::{
testing::Header,
traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify},
MultiSignature,
};
use xcm_builde... |
use std::fmt::{self, Display, Write};
use std::time::{SystemTime, UNIX_EPOCH};
const MINUTE_SECONDS: u64 = 60;
const HOUR_SECONDS: u64 = 60 * MINUTE_SECONDS;
const DAY_SECONDS: u64 = 24 * HOUR_SECONDS;
const ALL_COMPONENTS: u8 = u8::MAX;
#[derive(Copy, Clone)]
pub struct HumanTime(u64);
impl HumanTime {
pub con... |
use super::ffi;
use super::unlock_notify;
use super::StatementStatus;
#[cfg(feature = "modern_sqlite")]
use crate::util::SqliteMallocString;
use std::ffi::CStr;
use std::os::raw::c_int;
use std::ptr;
use std::sync::Arc;
// Private newtype for raw sqlite3_stmts that finalize themselves when dropped.
#[derive(Debug)]
pu... |
//! The contents of this module can be used to query a bodhi instance about existing releases.
//!
//! The [`ReleaseNameQuery`](struct.ReleaseNameQuery.html) returns exactly one
//! [`Release`](../../data/struct.Release.html), if and only if a `Release` with this name exists -
//! otherwise, it will return an error.
//... |
use crate::cli::CliConfig;
use anyhow::Result;
use bus_queue::{bounded, Publisher, Subscriber};
use futures::{SinkExt, StreamExt};
use hyper::{
header,
server::Server,
service::{make_service_fn, service_fn},
Body, Error, Request, Response, StatusCode,
};
use hyper_websocket_lite::{server_upgrade, AsyncC... |
// sadly current html decode crate requires std::io::Write not fmt
use std::fmt::{self, Write};
use super::named_chars::NAMED_CHAR_REF;
use std::lazy::SyncLazy;
static MAX_CR_NAME_LEN: SyncLazy<usize> =
SyncLazy::new(|| NAMED_CHAR_REF.keys().copied().map(str::len).max().unwrap());
type DecodeResult<'a> = Result<&... |
//! Escape strings for use in ostree refs.
//!
//! It can be desirable to map arbitrary identifiers, such as RPM/dpkg
//! package names or container image references (e.g. `docker://quay.io/examplecorp/os:latest`)
//! into ostree refs (branch names) which have a quite restricted set
//! of valid characters; basically a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.