text stringlengths 3.09k 13.9k |
|---|
use super::{load_property_sheet, Error, Highlight, Highlighter, HtmlRenderer, Properties};
use regex::Regex;
use std::collections::HashMap;
use std::ffi::CStr;
use std::os::raw::c_char;
use std::process::abort;
use std::sync::atomic::AtomicUsize;
use std::{fmt, slice};
use tree_sitter::{Language, PropertySheet};
struc... |
#![allow(clippy::clone_on_copy)]
#[macro_use]
mod util;
use std::cmp::Ordering;
use derive_where::derive_where;
use self::util::{
AssertClone, AssertCopy, AssertDebug, AssertEq, AssertHash, AssertOrd, AssertPartialEq,
AssertPartialOrd, Wrapper,
};
#[test]
fn all() {
#[derive_where(Clone, Copy, Debug, Default, E... |
use luminance::context::GraphicsContext;
use luminance::pixel::{Depth32F, NormRGBA8UI};
use luminance::texture::{Dim2, GenMipmaps, Sampler, Texture};
use image;
use zip::ZipArchive;
use lazy_static::lazy_static;
use cgmath::Rad;
use std::fs::File;
use std::io::{Cursor, Read, Seek};
use std::path::{Path, PathBuf};
... |
//! See [`Progress`] for the primary entry point.
use std::process::{Command, Output};
use anyhow::{bail, Context, Result};
use indicatif::{ProgressBar, ProgressStyle};
/// What commands to display during workflow execution.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SignificanceVerbosity {
/// Only s... |
use chrono::DateTime;
use chrono::Local;
use core::convert::TryFrom;
use core::fmt;
use core::fmt::Formatter;
use core::option::Option::{None, Some};
use core::option::Option;
use std::os::unix::fs::MetadataExt;
use std::os::unix::fs::PermissionsExt;
use core::result::Result::Ok;
use std::fs;
use std::path::Path;
use s... |
/**
* [307] Range Sum Query - Mutable
*
* Given an integer array nums, handle multiple queries of the following types:
* <ol>
* Update the value of an element in nums.
* Calculate the sum of the elements of nums between indices left and right inclusive where left <= right.
* </ol>
* Implement the NumArray cla... |
#![allow(unused)]
use libc::*;
use openssl_sys::BIGNUM;
#[derive(Debug)]
#[repr(C)]
pub struct OSSL_PARAM {
pub key: *const c_char,
pub data_type: c_uint,
pub data: *mut c_void,
pub data_size: size_t,
pub return_size: size_t,
}
pub const OSSL_PARAM_END: OSSL_PARAM = OSSL_PARAM {
key: std::ptr:... |
use im::vector;
use im::HashMap;
use im::Vector;
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub enum Rule {
Constant(char),
Options(Vector<Vector<usize>>),
}
pub type Grammar = HashMap<usize, Rule>;
// 28: 94 108
// 40: 117 117 | 33 117
// 34: 117 46 | 33 53
// 33: "a"
fn parse_rule(input: &str)... |
extern crate rand;
extern crate serde_json;
mod common;
mod input_parsing;
mod woa;
use std::env;
use std::time::Instant;
use std::fs;
use std::io::Write;
use std::fs::OpenOptions;
use common::{calc_c_value_inf, calc_lambda, calc_score, AlgResult, Output, Point};
use input_parsing::{read_points, read_restrictions};... |
use std::cmp::Ordering;
use bevy::prelude::*;
use crate::{
gvas::{SwitchData, SwitchType},
spline::{mesh::curve_offset, CubicBezier, PolyBezier},
update::DragState,
};
// Snap points
pub struct SnapPlugin;
impl Plugin for SnapPlugin {
fn build(&self, app: &mut App) {
app.add_event::<SnapEven... |
use na::allocator::Allocator;
use na::dimension::DimMin;
use na::dimension::{U1, U2, U4};
use na::DefaultAllocator;
use na::{OMatrix, OVector, Vector2, Vector4};
use nalgebra as na;
use nalgebra_rand_mvn::rand_mvn;
use adskalman::{KalmanFilterNoControl, ObservationModel};
use adskalman_examples::motion_model;
use adsk... |
use async_std::fs;
use async_std::io;
use async_std::path::PathBuf;
use async_std::prelude::*;
use regex::Regex;
use std::convert::{From, TryInto};
use std::future::Future;
use std::time::{Duration, SystemTime};
pub enum CacheFile {
File(Vec<u8>),
Expired,
None,
}
impl From<Option<Vec<u8>>> for CacheFile ... |
use crate::delivery::{Deliveries, Delivery};
use crate::problem::*;
type Route = Vec<SiteId>;
struct RouteTrie {
root: RouteTrieNode,
number: usize,
}
impl RouteTrie {
fn new() -> Self {
Self {
root: RouteTrieNode::new(0),
number: 0,
}
}
fn set(&mut self, ... |
use anyhow::Context;
use anyhow::Result;
use clap::Args;
use identity::load_identity;
use ockam::identity::IdentityTrait;
use ockam::{identity::IdentityIdentifier, NodeBuilder};
use std::collections::BTreeSet;
use storage::{ensure_identity_exists, get_ockam_dir};
pub mod identity;
pub mod storage;
pub mod cmd {
/... |
//! (Rust) Silence stderr and stdout, optionally rerouting it.
//!
//! Stdout Gagging
//!
//! ```rust
//! println!("STDOUT GAGGING", );
//! println!("you will see this");
//! let shh = shh::stdout().unwrap();
//! println!("but not this");
//! drop(shh);
//! println!("and this");
//! ```
//!
//! Stderr Gagging
//!
//! `... |
// RGB Core Library: a reference implementation of RGB smart contract standards.
// Written in 2019-2022 by
// Dr. <NAME> <<EMAIL>>
//
// To the extent possible under law, the author(s) have dedicated all copyright
// and related and neighboring rights to this software to the public domain
// worldwide. This softwa... |
//! This is the build system for the Rest-OS
//! So this is built and run on the host machine
// TODO(patrik):
// - Add checks
// - For rust target is installed
// - For GRUB we need x86_64-elf
// - Restructure the program
// - Add command line options
// - Debug/Release build
// - Diffrent build... |
use std::thread;
use std::time::Duration;
use rand::{Rng, thread_rng};
#[cfg(target_os = "linux")]
use btleplug::bluez::{adapter::Adapter, manager::Manager};
#[cfg(target_os = "windows")]
use btleplug::winrtble::{adapter::Adapter, manager::Manager};
#[cfg(target_os = "macos")]
use btleplug::corebluetooth::{adap... |
use prost_build::{Method, Service, ServiceGenerator};
#[derive(Default)]
pub struct TwirpServiceGenerator {
pub embed_client: bool,
type_aliases_generated: bool,
}
impl TwirpServiceGenerator {
pub fn new() -> TwirpServiceGenerator { Default::default() }
fn prost_twirp_mod(&self) -> &str { if self.emb... |
// "adi_gpu_vulkan" crate - Licensed under the MIT LICENSE
// * Copyright (c) 2018 <NAME> <<EMAIL>>
//
//! Vulkan implementation for adi_gpu.
// #![no_std]
#[macro_use]
extern crate ami;
extern crate asi_vulkan;
extern crate adi_gpu_base;
extern crate libc;
/// Transform represents a transformation matrix.
pub(cra... |
use std::{convert::Infallible, future::Future, panic::AssertUnwindSafe, sync::Arc};
use futures::FutureExt;
use hyper::{
Body, Method, Request, Response, Server, StatusCode,
http::uri::PathAndQuery,
service::{make_service_fn, service_fn},
};
use tokio::sync::broadcast::Sender;
use crate::serve::proxy::Pro... |
use crate::solver::Solver;
use std::io::{self, BufReader, Read};
pub struct Problem;
impl Solver for Problem {
type Input = Directions;
type Output1 = u64;
type Output2 = u64;
fn parse_input<R: io::Read>(&self, r: R) -> Directions {
Directions::from_reader(r)
}
fn solve_first(&self, ... |
use std::env;
use std::error;
use std::ffi::{OsStr, OsString};
use std::fs::File;
use std::io::{stdin, BufReader, Read};
use std::path::PathBuf;
use std::time::Duration;
use reqwest;
use serde::{Deserialize, Serialize};
use structopt::StructOpt;
use multifon::{Client, Routing, API};
const ENV_LOGIN: &'static str = "... |
use std::io::{ Result, Error, ErrorKind };
use libc::termios as Termios;
use crate::actions::ansi::*;
use crate::common::enums::{ Clear, Style, Color };
pub struct Term { mode: Termios }
impl Term {
pub fn new() -> Result<Self> {
Ok(Self { mode: output::get_mode()? })
}
// CURSOR FUNCTIONS
p... |
//! Definitions for SCRAM messages.
use super::base64_decode_array;
use super::key::{ScramKey, SCRAM_KEY_LEN};
use super::signature::SignatureBuilder;
use crate::sasl::ChannelBinding;
use std::fmt;
use std::ops::Range;
/// Faithfully taken from PostgreSQL.
pub const SCRAM_RAW_NONCE_LEN: usize = 18;
/// Although we i... |
// Copyright (c) 2018 <NAME>
// [This program is licensed under the "MIT License"]
// Please see the file LICENSE in the source
// distribution of this software for license terms.
use std::io::{stdin, stdout, Write};
use piston::input::*;
use piston_window::PistonWindow as Window;
use sdl2_window::Sdl2Window;
mod cp... |
// use crate::regex_parsers;
use regex_procs::RegexParser;
use regex_parsers::*;
use regex::Regex;
use std::sync::Arc;
use std::rc::Rc;
macro_rules! convert {
($value: expr => $txt: literal => $rgx: literal : $ty: ty ) => {
let rgx = Regex::new($rgx).unwrap();
let caps = rgx.captures($txt).unwrap... |
use std::io::{Seek, SeekFrom};
use io::emmc::{self, EmmcDevice, Status1, Status32, TransferType};
use io::emmc::card::{CardState, TransferLoc};
pub fn go_idle_state(dev: &mut EmmcDevice) {
for card in dev._internal_state.cards.iter_mut() {
card.reset(false);
}
warn!("STUBBED: SDMMC CMD0 GO_IDLE_ST... |
#![no_main]
use libfuzzer_sys::fuzz_target;
use breakpad_symbols::fuzzing_private_exports::{
eval_win_expr_for_fuzzer, StackInfoWin, WinStackThing,
};
use breakpad_symbols::FrameWalker;
use std::collections::HashMap;
fuzz_target!(|data: ([u32; 14], &str)| {
test_stack_win_doc_example(data.0, data.1);
});
// ... |
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use std::fmt;
use crate::util::DisplayOption;
use crate::util::Manufacturer;
use crate::util::ParseError;
/// Represents the FVU ID record
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct ARe... |
use std::convert::TryInto;
use std::env;
use std::num::Wrapping;
const REPLACEMENT_TABLE: [[u8; 16]; 8] = [
[4, 10, 9, 2, 13, 8, 0, 14, 6, 11, 1, 12, 7, 15, 5, 3],
[14, 11, 4, 12, 6, 13, 15, 10, 2, 3, 8, 1, 0, 7, 5, 9],
[5, 8, 1, 13, 10, 3, 4, 2, 14, 15, 12, 7, 6, 0, 9, 11],
[7, 13, 10, 1, 0, 8, 9, 15... |
use std::borrow::Cow;
use std::collections::HashMap;
use std::str::FromStr;
use emv_qrcps_derive::EmvEncoder;
use strum::IntoEnumIterator;
use strum_macros::{EnumIter, IntoStaticStr};
#[derive(IntoStaticStr, EnumIter)]
pub enum HasChildren {
#[strum(serialize = "26")]
MerchantInfo,
#[strum(serialize = "62... |
use crate::cnf::NetworkConfiguration;
use crate::ds93c46::DS93C46;
use crate::io_utils::OutputPinInfallible;
use crate::platform::SpiError;
use embedded_hal::blocking::delay::DelayMs;
use embedded_nal::UdpFullStack;
use embedded_nal::{SocketAddr, SocketAddrV4, UdpClientStack};
use stm32f1xx_hal::gpio::gpioa::*;
use stm... |
// Copyright (c) 2017-present, PingCAP, Inc. Licensed under Apache-2.0.
//! Representations of objects in filesystem.
use std::io::BufRead;
use std::path::{Path, PathBuf};
use num_derive::{FromPrimitive, ToPrimitive};
use num_traits::{FromPrimitive, ToPrimitive};
use crate::codec::{self, NumberEncoder};
use crate::... |
use std::io;
use crate::error::Error;
// An enumeration of each possible QOI encoding "chunk", or Op.
pub enum Op {
// `QOI_OP_DIFF`, contains the red, green, and blue color difference from the
// previous pixel with a bias of +2.
//
// | 7 6 5 4 3 2 1 0 |
// |------------------------|
// | 0 1 | ... |
use image::{DynamicImage, ImageOutputFormat, Rgb, RgbImage};
use std::fs::File;
use std::io;
use std::process::exit;
use std::str::FromStr;
use std::{
sync::mpsc::{self, Receiver, Sender},
thread,
};
extern crate num_cpus;
struct Pixel {
x: u32,
y: u32,
clr: Rgb<u8>,
}
struct Offset{
x: f64,
... |
use crate::utils::inv_or_zero;
use crate::Float;
use approx::ulps_eq;
/// knot vector
#[derive(Clone, PartialEq, Debug)]
pub struct KnotVector(pub Vec<Float>);
impl KnotVector {
pub fn new(knots: Vec<Float>) -> KnotVector {
assert!(knots.len() > 1);
KnotVector(knots)
}
pub fn from_values_... |
#![allow(clippy::many_single_char_names)]
use std::future::pending;
use std::io;
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr};
use std::str;
use std::sync::{Arc, Mutex};
use std::time::Duration;
use awak::net::TcpStream;
use awak::time::timeout;
use futures_util::{AsyncRead, AsyncWrite};
use crate::cipher::Cipher;
... |
use serde::Deserialize;
use std::collections::HashMap;
use tabled::Tabled;
use crate::util::deserialize::null_to_default;
#[derive(Default, Deserialize)]
#[serde(default)]
pub struct Detections {
pub detections: Vec<Detection>,
}
#[derive(Deserialize)]
#[serde(default)]
pub struct Detection {
#[serde(deseria... |
use crate::app::model::ModulePermissions;
use anyhow::{anyhow, Context};
use async_trait::async_trait;
use std::io::Cursor;
use tracing::{debug, info_span, Instrument};
use wasi_common::pipe::WritePipe;
use wasi_experimental_http_wasmtime::{HttpCtx, HttpState};
use wasmtime::{Engine, Linker, Module, Store, TypedFunc};
... |
use crate::{inspect, player};
use bevy::prelude::*;
pub struct GameCameraPlugin;
impl Plugin for GameCameraPlugin {
fn build(&self, app: &mut App) {
app.insert_resource(CameraSettings::default())
.add_system(check_for_follow_burros)
.add_system(follow_following)
.add_sys... |
//! Facade fn factory.
use crate::factory::Factory;
use crate::paths;
use super::singleton_fns::SingletonFnArgs;
use super::singleton_fns::SingletonFnType;
use proc_macro2::Ident;
use proc_macro2::TokenStream;
use quote::quote;
use syn::parse::Parser;
use syn::Attribute;
use syn::Block;
use syn::Error;
use syn::Fn... |
//! A crew that uses the lock-free Chase-Lev deque implemented in `crossbeam`.
//!
//! Each worker runs this loop in a separate thread:
//!
//! 1. Try to steal a job
//! 2. If successful, perform it, and become "hot"
//! 3. If shutting down, break
//! 4. If lost a race or no jobs, "cool down"
//! 5. Possibly ... |
#![no_std]
#![no_main]
#![macro_use]
#![allow(incomplete_features)]
#![feature(generic_associated_types)]
#![feature(min_type_alias_impl_trait)]
#![feature(impl_trait_in_bindings)]
#![feature(type_alias_impl_trait)]
#![feature(concat_idents)]
use log::LevelFilter;
use panic_probe as _;
use rtt_logger::RTTLogger;
use r... |
#![feature(trait_alias, generic_associated_types)]
extern crate terms;
extern crate tree_automata as ta;
pub mod pattern_eq;
use std::fmt;
use std::marker::PhantomData;
use terms::Term;
use ta::{Automaton, Language, Symbol, State, Label, Ranked};
use ta::search::Representatives;
use ta::combinations_option;
#[deriv... |
#![warn(clippy::all)]
#![warn(clippy::pedantic)]
#![warn(clippy::cargo)]
#![allow(unknown_lints)]
#![warn(missing_docs)]
#![warn(missing_debug_implementations)]
#![warn(missing_copy_implementations)]
#![warn(rust_2018_idioms)]
#![warn(rust_2021_compatibility)]
#![warn(trivial_casts, trivial_numeric_casts)]
#![warn(unus... |
use crate::{
ffi, AsPyPointer, FromPyObject, IntoPy, Py, PyAny, PyObject, PyResult, PyTryFrom, Python,
ToPyObject,
};
use std::ops::Index;
use std::os::raw::c_char;
use std::slice::SliceIndex;
use std::str;
/// Represents a Python `bytes` object.
///
/// This type is immutable.
#[repr(transparent)]
pub struct ... |
use clap::{Command, Arg};
use std::{
io::{self, Read, Write, BufRead, BufReader},
fs::{self},
path::Path,
collections::HashMap
};
use sha2::{Sha256, Digest};
use unicode_bom::Bom;
enum Input {
File(fs::File),
Stdin(io::Stdin),
}
impl Read for Input {
fn read(&mut self, buf: &mut [u8]) -> i... |
// Copyright (c) 2017 The vulkano developers
// 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. All files in the project carrying such
// notice may not be co... |
// Copyright 2020 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
#![cfg(feature = "submodule_tests")]
use async_trait::async_trait;
use cid::{multihash::Blake2b256, Cid};
use db::MemoryDB;
use forest_ipld::json::{self, IpldJson};
use forest_ipld::selector::{LastBlockInfo, LinkResolver, Selector, VisitR... |
use super::{Dictionary, Document, Object, ObjectId};
impl Document {
/// Create new PDF document with version.
pub fn with_version<S: Into<String>>(version: S) -> Document {
let mut document = Self::new();
document.version = version.into();
document
}
/// Create an object ID.
pub fn new_object_id(&mut self... |
// Copyright (C) 2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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
... |
#![feature(seek_stream_len)]
#![feature(core_intrinsics)]
pub mod asset_bundle;
pub mod addressable;
pub mod serialized_file;
pub mod type_tree;
pub mod type_tree_node;
mod object_info;
mod serialized_string;
mod local_serialized_object_identifier;
mod file_identifier;
mod io_extension;
mod enums;
pub mod classes;
mod ... |
// This file is part of Polka Domain.
// Copyright (C) 2021 Polka Domain.
// SPDX-License-Identifier: Apache-2.0
// 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.or... |
use std::cell::Cell;
use super::loopy::{AddrReg, Time};
use super::pattern::PTIdx;
use super::{NTAddr, VAddr, TileCoord, PixelCoord};
#[derive(Default, Debug, Clone)]
pub struct Registers {
pub control: Cell<Control>,
pub mask: Cell<Mask>,
pub status: Cell<Status>,
oam_addr: u8,
oam_data: u8,
p... |
// Copyright 2020 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! Defines the messages and abstracts out communication for storage.
mod file_storage;
pub use file_storage::FileStorage;
use std::any::{type_name, ... |
use async_trait::async_trait;
use color_eyre::{eyre::eyre, Result};
use std::sync::Arc;
use tokio::{
task::JoinHandle,
time::{interval, Interval},
};
use tracing::info;
use optics_base::{
agent::{AgentCore, OpticsAgent},
home::Homes,
replica::Replicas,
};
use optics_core::traits::{Common, Replica};... |
// surfman/surfman/src/platform/windows/angle/connection.rs
//
//! A connection to the window server.
//!
//! It might seem like this should wrap an `EGLDisplay`, but it doesn't. Unfortunately, in the
//! ANGLE implementation `EGLDisplay` is not thread-safe, while `surfman` connections must be
//! thread-safe. So we n... |
// Copyright 2018 <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 those... |
//! --- Day 3: Crossed Wires ---
//!
//! The gravity assist was successful, and you're well on your way to the Venus refuelling station.
//! During the rush back on Earth, the fuel management system wasn't completely installed, so
//! that's next on the priority list.
//!
//! Opening the front panel reveals a jumble of... |
//!
//! Support to register an open [`AtomicDrmDevice`](AtomicDrmDevice)
//! to an open [`Session`](::backend::session::Session).
//!
use drm::control::{atomic::AtomicModeReq, crtc, property, AtomicCommitFlags, Device as ControlDevice};
use drm::Device as BasicDevice;
use failure::ResultExt;
use nix::libc::dev_t;
use ... |
use std::borrow::Cow;
use winit::{
event::{Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::Window,
};
use wgpu::util::DeviceExt;
async fn run(event_loop: EventLoop<()>, window: Window) {
let size = window.inner_size();
let instance = wgpu::Instance::new(wgpu::Backends::all());
... |
use crate::common::*;
pub(crate) struct Evaluator<'src: 'run, 'run> {
assignments: Option<&'run Table<'src, Assignment<'src>>>,
config: &'run Config,
dotenv: &'run BTreeMap<String, String>,
scope: Scope<'src, 'run>,
settings: &'run Settings<'run>,
search: &'run Search,
}
impl<'src,... |
use crate::constraint::Constraint;
use crate::world::Body;
use crate::math::{Vec2, PI, Cross};
use crate::joint::Joint;
const SPRING_DISPLACEMENT_SLOP: f32 = 0.05;
#[derive(Clone)]
pub struct SpringJoint {
pub local_anchor_a: Vec2,
pub local_anchor_b: Vec2,
pub distance: f32,
pub frequency: f32,
... |
use std::{collections::HashMap, iter, net::Ipv4Addr, sync::Arc};
use async_trait::async_trait;
use futures::{stream::BoxStream, FutureExt, StreamExt};
use log::{debug, error};
use tokio::{
io::Result,
net::TcpListener,
sync::{
broadcast::{channel, Sender},
Mutex,
},
task,
};
use tok... |
use std::io::Write;
use liquid_core::error::ResultLiquidExt;
use liquid_core::Expression;
use liquid_core::Language;
use liquid_core::Renderable;
use liquid_core::Runtime;
use liquid_core::ValueView;
use liquid_core::{Error, Result};
use liquid_core::{ParseTag, TagReflection, TagTokenIter};
#[derive(Debug)]
struct In... |
//! Command buffers.
//!
//! A command buffer collects a list of commands to be submitted to the device.
//! Each command buffer has specific capabilities for graphics, compute or transfer operations,
//! and can be either a "primary" command buffer or a "secondary" command buffer. Operations
//! always start from a p... |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
use std::fs;
use std::io;
use std::path::{Path, PathBuf, Component};
use std::time::SystemTime;
use anyhow::Context;
use async_std::task;
use fn_error_context::context;
use indicatif::{ProgressBar, ProgressStyle};
use crate::commands::ExitCode;
use crate::platform;
use crate::portable::exit_codes;
use crate::portable... |
use std::convert::TryInto;
use std::io;
use crate::vlq_encode;
use crate::vlq_encode::*;
use bounded_vec::{BoundedVec, BoundedVecOutOfBounds};
use thiserror::Error;
/// Ways serialization might fail
#[derive(Error, Eq, PartialEq, Debug, Clone)]
pub enum ScorexSerializationError {
/// IO fail (EOF, etc.)
#[err... |
use crate::{Module, Config};
use crate as tokenization;
use super::*;
use frame_support::{
construct_runtime, parameter_types, ord_parameter_types, weights::Weight,
impl_outer_event, impl_outer_origin, impl_outer_dispatch, traits::EnsureOrigin,
};
use sp_core::H256;
use sp_runtime::{testing::Header, traits::{Id... |
use std::fmt::Debug;
use async_trait::async_trait;
use bytes::Bytes;
use http::{Request, Response};
use opentelemetry::{
propagation::{Extractor, Injector},
trace::TraceError,
};
pub struct HeaderInjector<'a>(pub &'a mut http::HeaderMap);
impl<'a> Injector for HeaderInjector<'a> {
/// Set a key and value... |
use std::collections::HashMap;
use nom::{
bytes::complete::{take, take_till},
combinator::map,
number::complete::{le_u16, le_u32},
sequence::{preceded, tuple},
IResult, Parser,
};
use thiserror::Error;
use crate::{Elf, Pointee};
#[derive(Debug)]
struct Header {
symn: u16,
reln: u16,
... |
#![allow(missing_docs)]
#[warn(missing_docs)]
pub mod glsl;
use enso_prelude::*;
use js_sys::Float32Array;
use web_sys::WebGlBuffer;
use web_sys::WebGlProgram;
use web_sys::WebGl2RenderingContext;
use web_sys::WebGlShader;
// ===============
// === Exports ===
// ===============
/// Common types.
pub mod types {... |
use std::{
convert::TryFrom,
fs, io,
io::{BufRead, Read, Seek, SeekFrom},
sync::atomic::{AtomicBool, Ordering},
time::Instant,
};
use git_features::progress::{self, Progress};
use crate::{index::access::PackOffset, tree::Tree};
/// Returned by [`Tree::from_offsets_in_pack()`]
#[derive(thiserror::... |
// Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC.
// Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
// All Rights reserved. See files LICENSE and NOTICE for details.
//
// This file is part of CEED, a collection of benchmarks, miniapps, software
// libraries and APIs for ... |
use std::fmt;
use std::fmt::Debug;
use assembler::Instruction;
pub struct Section {
pub address: u32,
pub data: Box<[u8]>,
}
pub struct DolFile {
pub text_sections: Vec<Section>,
pub data_sections: Vec<Section>,
pub bss_address: u32,
pub bss_size: u32,
pub entry_point: u32,
}
struct DolHe... |
// std
use serde::{Deserialize, Serialize};
use std::f32::consts::PI;
use std::sync::Arc;
// pbrt
use crate::core::geometry::{nrm_abs_dot_vec3f, nrm_dot_vec3f, vec3_coordinate_system};
use crate::core::geometry::{Normal3f, Point2f, Ray, Vector3f, XYEnum};
use crate::core::interaction::{Interaction, InteractionCommon};... |
//! This module initializes sound effects (in ogg files), and
//! abstracts over them so we can have a config file containing
//! all the sound types. It uses a `SoundType` enum because many of
//! the types, like the `PlayerBlaster`, actually have several
//! variations that can be randomly chosen.
use amethyst::{
... |
use std::collections::BTreeMap;
use std::{cmp, str};
use crate::protocol::Protocol;
use crate::scsi::Scsi;
use syscall::error::{Error, Result};
use syscall::error::{EACCES, EBADF, EINVAL, EIO, ENOENT, ENOSYS};
use syscall::flag::{MODE_CHR, MODE_DIR};
use syscall::flag::{O_DIRECTORY, O_STAT};
use syscall::flag::{SEEK_... |
//! User (postfix)-snippet definitions.
//!
//! Actual logic is implemented in [`crate::completions::postfix`] and [`crate::completions::snippet`] respectively.
use std::ops::Deref;
// Feature: User Snippet Completions
//
// rust-analyzer allows the user to define custom (postfix)-snippets that may depend on items to... |
use crate::{
error::{UnsupportedError, UnsupportedErrorKind},
ColorType, ImageError, ImageFormat, ImageResult,
};
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use std::io::{Read, Write};
pub(crate) const ALPHA_BIT_MASK: u8 = 0b1111;
pub(crate) const SCREEN_ORIGIN_BIT_MASK: u8 = 0b10_0000;
pub(c... |
// Copyright 2019, 2020 Wingchain
//
// 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... |
/// Day 10: https://adventofcode.com/2020/day/10
/// Copyright 2021 by <NAME>
#[path = "common.rs"] mod common;
/// Raster-scan numbered seat-map.
struct RasterMap {
nrows: usize,
ncols: usize,
seats: Vec<Option<usize>>,
}
impl RasterMap {
fn new(input: &Vec<String>) -> Option<RasterMap> {
... |
use super::{get_image_data, Buffers, ImageFormat as ImportDataFormat};
use amethyst_assets::Source;
use amethyst_error::Error;
use amethyst_rendy::{
formats::{mtl::MaterialPrefab, texture::TexturePrefab},
palette::{LinSrgba, Srgba},
rendy::{
hal,
texture::{
image::{load_from_imag... |
// Copyright 2019 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
// dis... |
use rand::{thread_rng, Rng};
use either::Either;
use mpstthree::binary::struct_trait::{end::End, recv::Recv, send::Send, session::Session};
use mpstthree::role::end::RoleEnd;
use mpstthree::role::Role;
use std::error::Error;
use mpstthree::bundle_impl;
// Create new roles
bundle_impl!(MeshedChannels, A, B, D);
// T... |
//-
// Copyright 2018 The proptest developers
//
// 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
// exce... |
// Copyright © 2019 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause
//
// Copyright © 2020, Microsoft Corporation
//
// Copyright 2018-2019 CrowdStrike, Inc.
//
//
///
/// Export generically-named wrappers of kvm-bindings for Unix-based platforms
///
use crate::kvm::{KvmError, KvmResult};
u... |
// Copyright (C) 2021 <NAME> <<EMAIL>>
// SPDX-License-Identifier: MIT OR Apache-2.0
use std::convert::TryFrom;
use std::num::{NonZeroI32, NonZeroU32};
use crate::Timestamp;
const MAX_FORWARD_TIME_JUMP_SECS: u32 = 10;
/// Creates [Timestamp]s (which don't wrap and can be converted to NPT aka normal play time)
/// f... |
use bls12_381::hash_to_curve::{ExpandMsgXmd, HashToCurve};
use bls12_381::{G1Affine, G1Projective, Scalar};
use rand::{CryptoRng, RngCore};
use sha2::{Digest, Sha256, Sha512};
use alloc::{format, vec::Vec};
use core::{convert::TryInto, fmt};
use serde::de::MapAccess;
use serde::de::{self, Deserialize, Visitor};
use s... |
pub use self::redis::{get_client, MyRedisError};
use self::redis::{get_from_redis, set_in_redis};
use crate::{
auth_manager,
models::{JobStatus, JobStatusResponse, XMLJobStatusResponse},
};
use ::redis::Client;
use async_trait::async_trait;
use uuid::Uuid;
use warp::{http::StatusCode, reply::Json, Filter, Rejec... |
//! OS release information
//!
//! See: https://www.kernel.org/doc/html/latest/admin-guide/sysctl/kernel.html?highlight=osrelease#osrelease-ostype-version
use lazy_static::lazy_static;
use std::cmp::Ordering;
use std::ffi::CString;
use std::fmt;
use std::num::ParseIntError;
use std::str::FromStr;
const OSRELEASE: &'s... |
use failure::Error;
use feed::Feed;
use package::Package;
use reqwest::Body;
use reqwest::{Client as ReqwestClient, Response};
use serde::Deserialize;
use serde_xml_rs;
use url::Url;
pub struct Client {
client: ReqwestClient,
pub base_url: Url,
api_key: Option<String>,
}
impl Client {
pub fn new(url: ... |
use anyhow::{anyhow, Context, Result};
use chrono::NaiveDate;
use clap::value_t_or_exit;
use dialoguer::{Confirm, Input, Editor, MultiSelect};
use crate::cmds::issue::Issue;
use crate::config;
use crate::config::OutputFormat;
use crate::gitlab::{api, Client, CreateIssue, CreateIssueBuilder, Query};
use crate::utils;
u... |
mod batch;
mod capabilities;
mod custom;
mod forward;
mod generic_error;
mod internal_debug;
mod io;
mod sequence;
mod version;
pub use batch::*;
pub use capabilities::*;
pub use custom::*;
pub use forward::*;
pub use generic_error::*;
pub use internal_debug::*;
pub use io::*;
pub use sequence::*;
pub use version::*;
... |
use {
crate::{service::GduaCoreService, FileEntry, PartialEqMutex},
serde_derive::Serialize,
std::{
collections::HashSet,
path::{Path, PathBuf},
rc::Rc,
},
stdweb::js_serializable,
yew::{html, prelude::*},
};
#[derive(Debug, Clone, Serialize)]
pub struct Node {
name:... |
//! Kernel counter.
use core::fmt::{Debug, Error, Formatter};
use core::slice::from_raw_parts;
use core::sync::atomic::{AtomicUsize, Ordering};
const KCOUNTER_MAGIC: u64 = 1_547_273_975;
/// Kernel counter type.
#[repr(u64)]
#[derive(Debug)]
#[allow(dead_code)]
enum DescriptorType {
/// Padding
Padding = 0,
... |
/*
Copyright 2019 Supercomputing Systems AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law ... |
// Copyright 2021 The Simlin Authors. All rights reserved.
// Use of this source code is governed by the Apache License,
// Version 2.0, that can be found in the LICENSE file.
use std::collections::{BTreeSet, HashMap};
use prost::alloc::rc::Rc;
use crate::common::{Error, Ident};
use crate::dimensions::DimensionsCont... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.