text stringlengths 3.09k 13.9k |
|---|
// 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... |
// Copyright (c) 2020 Ant Group
//
// SPDX-License-Identifier: Apache-2.0
//
use anyhow::{anyhow, Result};
use eventfd::{eventfd, EfdFlags};
use nix::sys::eventfd;
use nix::sys::inotify::{AddWatchFlags, InitFlags, Inotify};
use std::fs::{self, File};
use std::io::Read;
use std::os::unix::io::{AsRawFd, FromRawFd};
use ... |
#![doc(hidden)]
use std::{mem, ptr};
use std::fmt::{self, Display, Formatter};
use std::error::Error;
use std::io::Read;
use {k32, w};
use bincode::{self, SizeLimit};
use bincode::serde::DeserializeResult;
use serde::{Serializer, Deserialize, Deserializer};
/// An error that can occur in a call to an initializer fun... |
// This file is part of Bit.Country.
// Copyright (C) 2020-2021 Bit.Country.
// SPDX-License-Identifier: Apache-2.0
// This program 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 L... |
use std::error::Error;
use std::fmt;
use {format, state};
use {Primitive, Resources};
use MAX_COLOR_TARGETS;
/// An offset inside a vertex buffer, in bytes.
pub type BufferOffset = usize;
/// Error types happening upon PSO creation on the device side.
#[derive(Clone, PartialEq, Debug)]
pub struct CreationError;
imp... |
#![allow(dead_code)]
extern crate idioma;
use std::{
io::prelude::*,
fs::File,
};
use idioma::*;
use crate::shared::Instruction::{self, *};
pub struct Preprocessor {
bytes: Vec<u8>,
stack: Vec<usize>,
pub instructions: Vec<Instruction>,
}
// Public interface.
impl Preprocessor {
pub fn ne... |
use std::collections::HashMap;
use std::marker::{Send, Sync};
use std::ops::{Index, IndexMut};
use std::path::{Path, PathBuf};
use std::pin::Pin;
use async_std::sync::{Arc, RwLock};
use futures::{Stream, StreamExt};
use rose_tree::petgraph::graph::{DefaultIx, NodeIndex};
use rose_tree::RoseTree;
use crate::Result;
... |
pub(crate) mod packet;
pub(crate) mod socketaddr;
pub(crate) mod stream;
pub(crate) use packet::Packet;
pub(crate) use stream::Stream;
use std::io;
use std::mem;
use std::net::SocketAddr;
use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
use std::path::Path;
use crate::driver::{Action, SharedFd};
use s... |
//! Clock state
//!
//! The main home page
use crate::application::states::prelude::*;
use heapless::String;
use heapless::consts::*;
use crate::system::bms::State as BmsState;
use core::fmt::Write;
use embedded_graphics::Drawing;
use embedded_graphics::fonts::Font6x12;
use embedded_graphics::prelude::*;
use seven... |
use serde::{Serialize, Deserialize};
use serde_repr::{Serialize_repr, Deserialize_repr};
use thiserror::Error;
use super::Parsable;
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct File {
pub activities: Vec<FileItem>,
pub custom_views: Vec<FileItem>,
}
impl Parsable for File {
type ParseError = FilePars... |
use crate::is_perf_true;
use crate::utils::{gather_parent_env_vars, report_error};
use log::info;
use log::trace;
use miette::{IntoDiagnostic, Result};
use nu_engine::{convert_env_values, eval_block};
use nu_parser::parse;
use nu_protocol::{
ast::Call,
engine::{EngineState, Stack, StateDelta, StateWorkingSet},
... |
//! User buttons PB13, PB14, PB15, PH14, PH15, PI0, PI1, PI2
use stm32f40x::{EXTI, GPIOB, GPIOD, GPIOH, GPIOI, RCC, SYSCFG};
/// Button connected to pins PB13, PB14, PB15, PH14, PH15, PI0, PI1, PI2
pub static BUTTONS: [Button; 8] = [
Button { i: 13 },
Button { i: 14 },
Button { i: 15 },
Button { i: 0... |
use std::fs;
use std::os::unix::fs::PermissionsExt;
use std::path::Path;
use std::process::Command;
use string_builder::Builder;
use structs::utils::{append_to_file, get_ok_or_error, print_message};
use which::which;
pub const COPY: &str = "cp";
pub const CURL: &str = "curl";
pub const DNSMASQ: &str = "dnsmasq";
pub c... |
#![allow(dead_code)]
use super::types::*;
use exitfailure::ExitFailure;
use reqwest::Url;
use crate::url_builder::UrlBuilder;
use serde::de::DeserializeOwned;
/// Finnhub API Client object.
#[derive(Debug, Clone)]
pub struct Client {
/// API key from the Finnhub dashboard.
pub api_key: String,
/// Constru... |
use super::proc::Proc;
use super::raw_types;
use super::value::Value;
use super::DMContext;
use crate::raw_types::values::IntoRawValue;
use crate::runtime::DMResult;
use detour::RawDetour;
use std::cell::RefCell;
use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::ffi::c_void;
#[doc(hidden)]... |
extern crate wasm_bindgen;
extern crate wee_alloc;
use std::ops::Add;
use std::slice;
use web_sys::{CanvasRenderingContext2d, ImageData};
use wasm_bindgen::prelude::*;
use wasm_bindgen::Clamped;
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
#[cfg(debug_assertions)]
#[macro_use]... |
use std::intrinsics::{likely, unlikely};
const INPUT: &str = include_str!("../input/day12.txt");
struct Cave {
name: &'static str,
links: Vec<usize>,
is_big: bool,
}
impl Cave {
fn new(name: &'static str) -> Self {
debug_assert!(name.to_uppercase() == name || name.to_lowercase() == name);
... |
use crate::memory_manager::frame::Frame;
use crate::memory_manager::frame_allocator::FrameAllocator;
use crate::memory_manager::PAGE_SIZE;
use core::marker::PhantomData;
use core::ops::{Index, IndexMut};
const ENTRY_COUNT: usize = 512;
#[allow(dead_code)]
#[repr(u64)]
pub enum EntryFlag {
Present = 1,
Writabl... |
use ark_ff::Field;
use ark_relations::{
lc,
r1cs::{ConstraintSynthesizer, ConstraintSystem, ConstraintSystemRef, SynthesisError},
};
// verifier wants to prove that she knows some x such that x^3 + x + 5 == 35
// or more general x^3 + x + 5 == (a public value)
struct CubicDemoCircuit<F: Field> {
pub x: Opt... |
use zwaves_primitives::bit_iterator;
use zwaves_primitives::hasher;
use crate::hasher::PedersenHasherBls12;
use pairing::bls12_381::{Fr};
use rand::rngs::OsRng;
use rand::{RngCore};
use std::mem::transmute;
use wasm_bindgen::prelude::*;
use bellman::{Circuit, ConstraintSystem, SynthesisError};
use sapling_crypto::ju... |
use std::io;
use termion::event::Key;
use termion::input::MouseTerminal;
use termion::raw::IntoRawMode;
use termion::screen::AlternateScreen;
use tui::backend::TermionBackend;
use tui::style::{Color, Modifier, Style};
use tui::widgets::{Axis, Block, Borders, Chart, Dataset, Marker, Widget};
use tui::Terminal;
use fai... |
use std::{io, num::TryFromIntError};
use byteorder::{BigEndian, ReadBytesExt};
use tracing::trace;
use crate::{
palette::{Palette, SectionPalette},
Biomes, BlockState, BlockStates, Chunk, ChunkSection, BLOCKS_PER_SECTION, SECTIONS_PER_CHUNK,
};
mod packed_vec;
mod varint;
pub use packed_vec::PackedIntVec;
p... |
use nom::branch::alt;
use nom::bytes::complete::tag;
use nom::character::complete::{multispace0, satisfy};
use nom::combinator::{all_consuming, map, map_res};
use nom::multi::{many0, many_m_n};
use nom::sequence::{delimited, preceded, terminated};
use nom::Finish;
use nom::IResult;
use std::error::Error;
use std::fmt;
... |
use std::sync::atomic::{AtomicUsize, Ordering};
/// A state for a segment of data, for an concurrent version see
/// [`AtomicState`].
///
/// [`AtomicState`]: struct.AtomicState.html
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub enum State {
/// No data has been written.
Empty,
/// Data is currently be... |
#[macro_use]
extern crate serde_derive;
extern crate image;
extern crate rayon;
extern crate docopt;
extern crate sprack;
mod sprack_bin;
use sprack_bin::*;
use sprack::*;
use std::path::Path;
use std::ffi::OsStr;
use rayon::prelude::*;
use image::{DynamicImage, GenericImage};
use docopt::Docopt;
const PNG_EXT: &str... |
extern crate fnv;
#[macro_use]
extern crate lazy_static;
extern crate netbricks;
extern crate twox_hash;
use fnv::FnvHasher;
use netbricks::common::Result;
use netbricks::config::load_config;
use netbricks::interface::{PacketRx, PacketTx};
use netbricks::operators::{Batch, ReceiveBatch};
use netbricks::packets::ip::v4:... |
/* BSD 3-Clause License
*
* Copyright © 2019, <NAME> <<EMAIL>>.
* Copyright © 2008-2019, Jice and the libtcod contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistri... |
use std::borrow::{Borrow, Cow};
use crate::{
alternation::RegexAlternation,
boundary::BoundaryKind,
char_class::{
unicode::{Category, CodeBlock, OtherProperties, Script},
RegexCharClass, RegexClassItem,
},
group::RegexGroup,
literal,
lookaround::RegexLookaround,
options:... |
use alloc::vec::Vec;
use core::fmt::Debug;
use core::u8;
use super::error::Error;
use super::runtime::revert;
use super::{alloc_bytes, to_ptr, ContractRef, TURef};
use crate::bytesrepr::deserialize;
use crate::contract_api::error::result_from;
use crate::ext_ffi;
use crate::system_contracts::SystemContract;
use crate:... |
use *;
use bytes::*;
use super::{
packet::BlockDataPacket,
checksum::{ChecksumValidator}
};
pub type ReadRange = (i64, i64);
#[derive(Debug)]
pub(crate) struct ReadStreamer {
checksum: Box<ChecksumValidator>,
read_range: ReadRange,
seqno: i64,
offset: i64
}
impl ReadStreamer {
pub fn new(... |
use std::env;
use actix_web::{HttpRequest, HttpResponse, Responder, post, web};
use actix_identity::{Identity};
use serde::{Deserialize};
use regex::Regex;
use crate::{AppData, generate_email_context};
use crate::models::{Communities, CommunityData, Email, People};
// for for single email address
#[derive(Debug, De... |
use gimli::{
BaseAddresses, CfaRule, Expression, Register, RegisterRule, UnwindContext, UnwindTableRow,
};
#[cfg(feature = "dwarf-expr")]
use gimli::{Evaluation, EvaluationResult, Location, Value};
use super::arch::*;
use super::find_fde::{self, FDEFinder, FDESearchResult};
use crate::abi::PersonalityRoutine;
use ... |
#[macro_use]
extern crate clap;
use atty::Stream;
use clap::Arg;
use colored::Colorize;
use image::{DynamicImage, FilterType, GenericImageView, RgbImage};
use mozjpeg::{ColorSpace, Compress};
use rayon::prelude::*;
use rexiv2::{Metadata, Rexiv2Error};
use snafu::{OptionExt, ResultExt, Snafu};
use std::ffi::OsStr;
use ... |
use crate::attribute::Attribute;
use crate::encoding::Encoding;
use crate::handler::Handler;
use crate::tag;
use crate::tag::Tag;
use crate::value_parser::ParseError;
use crate::value_parser::ParseResult;
use crate::value_parser::ValueParser;
use std::marker::PhantomData;
pub struct EncapsulatedPixelDataParser<T: Enco... |
use crate::cmp::Bounded;
use std::{fmt, hash, iter, num::ParseIntError, ops, str};
// for cargo-simple-bundler
#[cfg(any())]
pub trait Int {}
macro_rules! int {
($($Op:ident $OpAssign:ident $Rhs:ty)*; $($func:tt)*) => {
/// A trait for primitive integer types.
pub trait Int:
Sized
+ Clone
... |
use crate::db::snapshot::SnapNode;
use crate::env::Env;
use crate::env::PosixEnv;
use crate::table::{Block, FilterPolicy};
use crate::utils::cmp::{BytewiseComparatorImpl, Comparator};
use crate::utils::lru_cache::Cache;
use slog::Logger;
use std::sync::{Arc, Mutex, RwLock};
#[derive(Clone, Copy)]
#[non_exhaustive]
pub... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
de::Deserializer,
error::{Error, Result},
format::*,
ser::Serializer,
value::Value,
};
use serde::{de::DeserializeSeed, Deserialize, Serialize};
use std::collections::{BTreeMap, BTreeSet};
/// A map of... |
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
//! # iso_iec_7064::pure
//!
//! A trait to help implement the _Pure Check Character Systems_ appearing in The Standard.
use crate::system::System;
/// This is the state that will change with each iteration. Constant generic parameter CHECK_LENGTH
/// must be non-zero. The type of CHECK_LENGTH is usize instead of u8 ... |
use base64;
use failure;
use infra::oauth::{Claims, OAuthProvider, VerifyTokenError};
use jsonwebtoken::errors::ErrorKind;
use jsonwebtoken::{decode, Algorithm, TokenData, Validation};
use oauth2::basic::{BasicErrorResponseType, BasicTokenType};
use oauth2::prelude::*;
use oauth2::{
AuthUrl, AuthorizationCode, Clie... |
use crate::commands::canister::call::get_effective_canister_id;
use crate::lib::environment::Environment;
use crate::lib::error::DfxResult;
use crate::lib::identity::identity_utils::CallSender;
use crate::lib::models::canister_id_store::CanisterIdStore;
use crate::lib::operations::canister::get_local_cid_and_candid_pat... |
use nu_engine::CallExt;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape,
Value,
};
#[derive(Clone)]
pub struct ViewSource;
impl Command for ViewSource {
fn nam... |
use crate::intcode_computer::*;
use crate::infinite_memory_intcomputer::*;
use itertools::*;
use std::error;
fn run_thruster_computer(
phase_setting: i32,
input_signal: i32,
program: &Vec<i32>,
) -> Result<i32, Box<dyn error::Error>> {
let mut program = program.clone();
let inputs = vec![phase_sett... |
#[macro_use]
extern crate bitflags;
use std::fs;
use std::io::prelude::*;
use std::sync::Arc;
use clap::{App, Arg};
use colored::*;
use log::{info, warn, error, trace};
mod constants;
mod common;
mod error;
mod gadget;
mod format;
mod section;
mod session;
mod cpu;
mod engine;
use common::GenericResult;
use error::... |
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
use std::sync::Arc;
use crate::engine::RocksEngine;
use crate::options::RocksWriteOptions;
use crate::util::get_cf_handle;
use engine_traits::{self, Error, Mutable, Result, WriteBatchExt, WriteOptions};
use rocksdb::{Writable, WriteBatch as RawWriteBa... |
use clap::Parser;
use color_eyre::eyre::eyre;
use log::{info, LevelFilter};
use std::{sync::Arc, time::Duration};
use tokio::sync::Mutex;
#[cfg(all(unix, feature = "drop_privs"))]
use privdrop::PrivDrop;
use rspamd_mon::counters::RspamdStat;
#[derive(Clone, Debug, Parser, Default)]
#[clap(rename_all = "kebab-case")]... |
#![feature(clamp)]
#![warn(clippy::pedantic)]
extern crate reqwest;
use chrono::{DateTime, Utc};
use image::{png, ImageDecoder, Rgb, RgbImage};
use std::path::PathBuf;
use std::process;
#[cfg(target_os = "macos")]
use std::process::Command;
use structopt::StructOpt;
mod heatmap;
#[derive(StructOpt)]
#[structopt(nam... |
use seed::{prelude::*, *};
use typebinder::{
contexts::type_solving::TypeSolvingContextBuilder,
error::TsExportError,
exporters::Exporter,
macros::context::MacroSolvingContext,
path_mapper::PathMapper,
pipeline::{module_step::ModuleStep, Pipeline},
step_spawner::PipelineStepSpawner,
syn... |
use crate::utils;
use super::block::Block;
use super::block_header::*;
use super::mdf4_enums::{EventCause, EventSyncType, EventType, RangeType};
use super::mdf4_file::link_extract;
#[derive(Debug, Clone, PartialEq)]
pub struct EVBlock {
header: BlockHeader,
#[allow(dead_code)]
ev_ev_next: u64,
#[allow... |
//! Assorted tools and UI states that're useful for applications built to display maps.
use abstutil::MapName;
use geom::Polygon;
use widgetry::{GfxCtx, Line, Text};
pub use self::city_picker::CityPicker;
pub use self::colors::{ColorDiscrete, ColorLegend, ColorNetwork, ColorScale, DivergingScale};
pub use self::heatm... |
//! Types used in the realtime audio thread.
use sqa_jack::*;
use arrayvec::ArrayVec;
use super::{MAX_PLAYERS, MAX_CHANS, ONE_SECOND_IN_NANOSECONDS};
use bounded_spsc_queue::Consumer;
use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU64, AtomicPtr};
use std::sync::atomic::Ordering::*;
use std::sync::Arc;
use uui... |
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
//! Wire format traits.
//!
//! This module provides [`FromWire`] and [`ToWire`], a pair of traits similar
//! to the core traits in the [`serde`] library. Rather than r... |
use super::{RequestWrapper, ResponseFuture};
use crate::config::get_config;
use crate::error::{bail, Context, Error};
use cache::{Cache, Position};
use futures::future;
use std::str::FromStr;
use websock::{self as ws, spawn_websocket_with_timeout};
mod cache;
lazy_static! {
static ref CACHE: Cache = Cache::new(10... |
// MIT License
//
// Copyright (c) 2019-2021 <NAME> <<EMAIL>>
// Copyright (c) 2019-2021 Tangram Technologies S.R.L. <https://tngrm.io>
//
// 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 w... |
use crate::next_proxy_impl;
use crate::prelude::*;
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
#[derive(Clone)]
pub struct MergeOp<S1, S2> {
pub(crate) source1: S1,
pub(crate) source2: S2,
}
impl<S1, S2> Observable for MergeOp<S1, S2>
where
S1: Observable,
S2: Observable<Item = S1::I... |
//! This crate contains macros used by Bevy's `Reflect` API.
//!
//! The main export of this crate is the derive macro for [`Reflect`]. This allows
//! types to easily implement `Reflect` along with other `bevy_reflect` traits,
//! such as `Struct`, `GetTypeRegistration`, and more— all with a single derive!
//!
//! Som... |
use std::collections::{BTreeMap, HashMap, HashSet};
use std::convert::TryFrom;
use std::net::{IpAddr, SocketAddr};
use std::time::Instant;
use p2p::{
multiaddr::Multiaddr,
utils::{is_reachable, multiaddr_to_socketaddr},
SessionId,
};
// See: bitcoin/netaddress.cpp pchIPv4[12]
pub(crate) const PCH_IPV4: [u... |
use account::inherent::Inherent;
use block_base;
use beserial::{Deserialize, ReadBytesExt, Serialize, SerializingError};
use hash::{Argon2dHash, Blake2bHash, Hash};
use primitives::networks::NetworkId;
use transaction::Transaction;
use crate::{BlockBody, BlockError, BlockHeader, BlockInterlink, Target};
#[derive(Defa... |
use std::{arch::x86_64::*, mem::transmute};
pub(crate) const HAS_MAXIMUM: bool = false;
pub(crate) type F64X2 = __m128d;
pub(crate) fn abs(x: F64X2) -> F64X2 {
// Drop sign bits.
unsafe { _mm_andnot_pd(splat(-0.0), x) }
}
pub(crate) fn all(x: F64X2) -> bool {
bitmask(x) == 3
}
pub(crate) fn and(x: F64X... |
// Copyright 2019 Parity Technologies (UK) Ltd.
// Copyright 2020 Netwarps Ltd.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the ... |
// 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 super::{AccountsTreeNode, AddressNibbles, NO_CHILDREN};
use super::super::{Address, Account};
use crate::consensus::base::primitive::hash::{Hash, Blake2bHash};
use crate::utils::db::{Database, Transaction, WriteTransaction, Environment};
#[derive(Debug)]
pub struct AccountsTree<'env> {
db: Database<'env>
}
im... |
use std::{
convert::TryInto,
f32::consts::{FRAC_PI_2, FRAC_PI_4, PI, TAU},
ops::Deref,
};
use amethyst::{
assets::PrefabData,
core::{math::{Complex, Point3, Vector3}, Transform},
ecs::{Component, prelude::*, storage::MaskedStorage},
error::Error,
};
use itertools::{Itertools, multizip};
use... |
use super::IndexBuffer;
use crate::core::*;
use crate::renderer::*;
///
/// Used to define the initial position and velocity of a particle in [Particles](Particles).
///
pub struct ParticleData {
/// Initial position of the particle.
pub start_position: Vec3,
/// Initial velocity of the particle.
pub s... |
pub use self::{
adversary::{
AdversaryFragmentSender, AdversaryFragmentSenderError, AdversaryFragmentSenderSetup,
},
export::{FragmentExporter, FragmentExporterError},
generator::FragmentGenerator,
initial_certificates::{signed_delegation_cert, signed_stake_pool_cert, vote_plan_cert},
no... |
// An implementation of the dynamic programming algorithm for solving the
// longest common subsequence (LCS) problem.
use std::ops::{Deref, DerefMut};
#[derive(Debug)]
pub struct Lengths(Vec<u32>);
impl Deref for Lengths {
type Target = Vec<u32>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
... |
//! RADIUS Generic Server implementation
use crate::protocol::host::Host;
use crate::protocol::radius_packet::{ RadiusAttribute, RadiusMsgType, RadiusPacket, TypeCode };
use crate::protocol::dictionary::Dictionary;
use crate::protocol::error::RadiusError;
use crypto::digest::Digest;
use crypto::md5::Md5;
#[derive(... |
use core::marker::PhantomData;
use embassy_hal_common::unborrow;
use embedded_storage::nor_flash::{ErrorType, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash};
pub use crate::pac::{ERASE_SIZE, ERASE_VALUE, FLASH_BASE, FLASH_SIZE, WRITE_SIZE};
use crate::peripherals::FLASH;
use crate::Unborrow;
const FLASH_EN... |
use nu_engine::CallExt;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Value,
};
#[derive(Clone)]
pub struct SplitBy;
impl Command for SplitBy {
fn name(&self) -> &str {
"s... |
use crate::game::stage::NetRelay;
use crate::game::{Action, NetPlayerId};
use crate::net::{Codec, Connection};
use crate::net::{PROTOCOL, VERSION_HEADER};
use crate::server::ws_server::Role;
use std::error::Error as StdError;
use std::sync::mpsc::Sender as TSender;
use ws::util::Timeout;
use ws::util::Token;
use ws::{
... |
//! This crate provides forward– and reverse-geocoding functionality for Rust.
//! Over time, a variety of providers will be added. Each provider may implement one or both
//! of the `Forward` and `Reverse` traits, which provide forward– and reverse-geocoding methods.
//!
//! Note that for the `reverse` method, the ret... |
use super::{Command, Error, ForwardType, Socket};
use std::ffi::OsStr;
use std::fs;
use std::io;
use std::path::Path;
use std::process::Stdio;
use tokio::process;
use tempfile::TempDir;
#[derive(Debug)]
pub(crate) struct Session {
tempdir: Option<TempDir>,
ctl: Box<Path>,
addr: Box<str>,
master_log:... |
mod core;
use self::core::Cell;
pub(crate) use self::core::Header;
mod error;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::error::JoinError;
mod harness;
use self::harness::Harness;
mod join;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub ... |
// Type inference
use racer::{Match};
use racer::nameres::{resolve_path_with_str};
use racer::{ast,codeiter,scopes};
use racer;
use std::io::File;
use std::io::BufferedReader;
use std::{str};
use racer::{ExactMatch, TypeNamespace};
use racer::util::txt_matches;
fn find_start_of_function_body(src: &str) -> uint {
... |
use serde::Serialize;
use twilight_model::{
application::interaction::application_command::InteractionMember,
datetime::Timestamp,
guild::{Member, PartialMember},
id::{GuildId, RoleId, UserId},
};
/// Represents a cached [`Member`].
///
/// [`Member`]: twilight_model::guild::Member
#[derive(Clone, Debu... |
use crate::common::preview_features::PreviewFeature;
use crate::{ast, dml, Datasource, IndexField, PrimaryKeyField, SortOrder};
use enumflags2::BitFlags;
pub struct LowerDmlToAst<'a> {
pub datasource: Option<&'a Datasource>,
pub preview_features: BitFlags<PreviewFeature>,
}
impl<'a> LowerDmlToAst<'a> {
//... |
use crate::{ TCOD, SCREEN_WIDTH, SCREEN_HEIGHT };
use crate::game::{ self, Game, LEVEL_UP_BASE, LEVEL_UP_FACTOR, PLAYER_ID };
use crate::object::Object;
use crate::fighter::Fighter;
use crate::item::*;
use tcod::colors::{ self, Color };
use tcod::console::*;
const MAIN_MENU_WIDTH: i32 = 24;
const INVENTORY_MENU_WIDTH... |
//! Models used when responding to interactions over HTTP.
use crate::{
application::{command::CommandOptionChoice, component::Component},
channel::{
embed::Embed,
message::{AllowedMentions, MessageFlags},
},
http::attachment::Attachment,
};
use serde::{Deserialize, Serialize};
use serd... |
use crate::lang::errors::{CrushResult, argument_error};
use crate::lang::argument::{Argument, ArgumentDefinition};
use crate::lang::command::{Parameter, CrushCommand};
use crate::lang::scope::Scope;
use std::collections::HashMap;
use crate::lang::value::{Value, ValueType};
use crate::lang::list::List;
use crate::lang::... |
use ash::vk::{self, Handle, InstanceCreateFlags};
use bevy_xr::presentation::XrGraphicsContext;
use openxr as xr;
use std::{
error::Error,
ffi::{CStr},
sync::Arc,
};
use wgpu_hal as hal;
use xr::sys::{platform::VkInstanceCreateInfo};
#[derive(Clone)]
pub enum GraphicsContextHandles {
Vulkan {
i... |
//! A collection of semi-random shape and image drawing examples.
use glam::*;
use ggez::event;
use ggez::graphics::{self, Color, DrawMode, DrawParam};
use ggez::timer;
use ggez::{Context, GameResult};
use std::env;
use std::path;
struct MainState {
image1: graphics::Image,
image2_linear: graphics::Image,
... |
// 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 std::io::{Error, Write};
use vte::{Parser, Perform};
/// A trait for objects that write line delimited strings.
pub trait WriteLine {
/// Write a ... |
use std::{cmp::Ordering, sync::Arc};
use ash::{
prelude::VkResult,
vk::{
self, ExtensionProperties, Format, FormatProperties, KhrPortabilitySubsetFn,
KhrShaderFloat16Int8Fn, KhrTimelineSemaphoreFn, PhysicalDeviceFeatures2,
PhysicalDeviceFloat16Int8FeaturesKHR, PhysicalDevicePortabilityS... |
// MIT License
// Copyright (c) 2020-2021 brycx
// 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, merg... |
//-
// Copyright 2017 <NAME>
//
// 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... |
//! ZboxFS is a zero-details, privacy-focused in-app file system.
//!
//! It keeps your app files securely, privately and reliably on underlying
//! storages. By encapsulating files and directories into an encrypted
//! repository, it provides a virtual file system and exclusive access to
//! the authorised application... |
#![crate_type = "lib"]
#![crate_name = "keccak_rust"]
mod keccak_f;
use keccak_f::*;
mod sponge;
use sponge::*;
pub type BitsWidth = usize;
pub type Rate = usize;
pub type Capacity = usize;
pub type Security = (Rate, Capacity);
pub type Byte = u8;
pub type State = [[u64; 5]; 5];
pub type BytesVec = Vec<Byte>;
pub ... |
use anyhow::{anyhow, format_err, Error, Result};
use cargo_toml::Manifest;
use semver::Version;
use serde::{Deserialize, Serialize};
use serde_with::{DeserializeFromStr, SerializeDisplay};
use std::collections::BTreeMap;
use std::fs;
use std::fs::File;
use std::io::Read;
use std::path::PathBuf;
use std::str::FromStr;
u... |
// Copyright 2022 RisingLight Project Authors. Licensed under Apache-2.0.
#![allow(dead_code)]
use std::cmp::Ordering;
use std::vec::Vec;
use super::*;
use crate::array::{DataChunk, DataChunkBuilder};
use crate::types::{DataType, Row};
/// The executor for sort merge join
pub struct SortMergeJoinExecutor {
pub lef... |
#![allow(clippy::many_single_char_names)]
use std::io;
use std::net::{Ipv4Addr, Ipv6Addr};
use std::str;
use std::time::Duration;
use awak::time::timeout;
use futures_util::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
use crate::util::other;
pub mod v5 {
pub const VERSION: u8 = 5;
pub const METH_NO_... |
// Copyright 2020 The xi-editor 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 ag... |
//! Global CLI Setup.
use std::env;
use clap::{App, AppSettings, Arg, ArgMatches, ColorChoice};
use clap_complete::Shell;
use const_format::concatcp;
use env_logger::fmt::WriteStyle;
use lazy_static::lazy_static;
use crate::command;
/// Base URL of the manual, without the trailing slash.
const MANUAL_URL_BASE: &str... |
/*
get the output(objective) of the conds.
*/
use angora_common::{cond_stmt_base::CondStmtBase, defs};
use std;
const EPS: u64 = 1;
pub trait CondOutput {
fn get_output(&self) -> u64;
}
impl CondOutput for CondStmtBase {
// relu
fn get_output(&self) -> u64 {
let mut a = self.arg1;
let mut... |
#![no_std]
#![no_main]
#![feature(lang_items)]
use panic_halt as _;
use cortex_m_rt::{entry, heap_start};
use cortex_m_semihosting::hprintln;
use stm32f1xx_hal::{delay::Delay, pac, prelude::*};
use alloc_cortex_m::CortexMHeap;
use core::alloc::Layout;
use embedded_hal::digital::v2::{InputPin, OutputPin};
use tmledk... |
use crate::parser::typing::TypeEnv;
use crate::pretty::*;
use crate::types::{Field, Function, Label, Type};
use pretty::RcDoc;
static KEYWORDS: [&str; 29] = [
"import",
"service",
"func",
"type",
"opt",
"vec",
"record",
"variant",
"blob",
"principal",
"nat",
"nat8",
... |
extern crate clap;
extern crate colored;
extern crate mdbook;
extern crate threadpool;
extern crate git2;
mod document;
mod grammar;
mod model;
mod parse;
use mdbook::config::Config;
use mdbook::MDBook;
use clap::App;
use clap::Arg;
use std::fs;
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;
use th... |
#[doc = "Reader of register DC2"]
pub type R = crate::R<u32, super::DC2>;
#[doc = "Reader of field `UART0`"]
pub type UART0_R = crate::R<bool, bool>;
#[doc = "Reader of field `UART1`"]
pub type UART1_R = crate::R<bool, bool>;
#[doc = "Reader of field `UART2`"]
pub type UART2_R = crate::R<bool, bool>;
#[doc = "Reader of... |
use std::{
borrow::BorrowMut,
convert::Infallible,
fmt,
future::{ready, Future, Ready},
pin::Pin,
task::{Context, Poll},
};
use goods::{
Asset, AssetBuild, AssetField, AssetFieldBuild, AssetHandle, AssetId, AssetResult, Container,
Loader,
};
use serde::ser::SerializeStruct;
use sierra::... |
use parquet::errors::ParquetError;
use quick_error::quick_error;
use std::io;
use std::path::PathBuf;
use std::result;
quick_error! {
/// Set of errors that can be produced during different operations.
#[derive(Debug, PartialEq)]
pub enum Error {
/// General Parquet error.
Parquet(path: Pat... |
//! A scratchpad that holds a single client
use crate::{
core::{
bindings::KeyEventHandler,
client::Client,
data_types::{Region, WinId},
helpers::spawn,
hooks::Hook,
manager::WindowManager,
ring::Selector,
xconnection::XConn,
},
Result,
};
use... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.