text stringlengths 3.09k 13.9k |
|---|
use std::fmt::{self, Display};
use bitflags::bitflags;
use serde::{
de::{self, Visitor},
Deserialize, Deserializer, Serialize, Serializer,
};
use serde_diff::SerdeDiff;
pub trait ObjectColored {
fn get_object_color(self) -> ObjectColor;
}
bitflags! {
#[derive(SerdeDiff)]
pub struct ObjectColor: u8 {
... |
use std::fs::File;
use std::io::{Write, Read};
use byteorder::WriteBytesExt;
use crate::types::*;
use crate::bit_buffer::*;
use crate::template::*;
pub fn encode<R: Read, W: Write>(input: &mut R, output: &mut W, templates: &Vec<Template>, rows: bool) -> Option<()> {
let mut lines = csv::Reader::from_... |
use std::ops::Index;
use std::ops::Range;
use std::slice::SliceIndex;
use std::str::CharIndices;
use super::Stream;
use crate::span::Spanned;
impl From<(usize, char)> for Spanned<char> {
fn from(loc: (usize, char)) -> Spanned<char> {
let lo = loc.0;
let ch = loc.1;
let hi = lo + ch.len_utf... |
// Copyright 2019 <NAME> .
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribu... |
//! Contains ppc-specific types
pub use arch::arch_builder::ppc::*;
use arch::DetailsArchInsn;
use capstone_sys::{cs_ppc, cs_ppc_op, ppc_op_mem, ppc_op_type};
use instruction::{RegId, RegIdInt};
use std::convert::From;
use std::{cmp, fmt, slice};
// XXX todo(tmfink): create rusty versions
pub use capstone_sys::ppc_in... |
use crate::shell::Shell;
use crate::{filesystem::filesystem_shell::FilesystemShellMode, maybe_text_codec::StringOrBinary};
use crate::{CommandArgs, FilesystemShell};
use nu_stream::{ActionStream, OutputStream};
use crate::shell::shell_args::{CdArgs, CopyArgs, LsArgs, MkdirArgs, MvArgs, RemoveArgs};
use encoding_rs::En... |
// Copyright 2016 PingCAP, Inc.
//
// 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 i... |
#![allow(unused_variables)]
enum Cell {
Int(i32),
Float(f64),
Text(String)
}
use std::collections::HashMap;
fn main() {
// exploring Vectors in Rust
// init an empty vector
let v: Vec<i32> = Vec::new();
// init a vector with values
// and implicit typing using a built in
// mac... |
use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize};
use near_sdk::collections::{LookupMap, UnorderedMap, UnorderedSet};
use near_sdk::json_types::{ValidAccountId, U128, U64};
use near_sdk::serde::{Deserialize, Serialize};
use near_sdk::{
assert_one_yocto, env, ext_contract, near_bindgen, AccountId, Balan... |
use crate::prelude::AwcExtensions;
use crate::sso::oauth_request::{OAuthRequest, SerdeMap};
use crate::sso::sso_provider::{DatabaseSSOProvider, SSOProvider};
use crate::sso::sso_provider_type::SSOProviderType;
use crate::user::User;
use crate::utils::identifiers::{is_username_taken, validate_username};
use crate::{conf... |
use std::backtrace::Backtrace;
use std::fmt::Formatter;
use std::ops::Bound;
use anyerror::AnyError;
use serde::Deserialize;
use serde::Serialize;
use crate::LogId;
use crate::SnapshotMeta;
use crate::Vote;
/// Convert error to StorageError::IO();
pub trait ToStorageResult<T> {
/// Convert Result<T, E> to Result... |
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
cargo::Cargo,
config::{CargoConfig, CargoInstallation},
};
use log::{error, info, warn};
use std::process::Command;
pub struct Installer {
cargo_config: CargoConfig,
cargo_installations: Vec<(String, CargoI... |
extern crate serde_json;
extern crate params;
extern crate logger;
extern crate env_logger;
#[macro_use] extern crate askama;
#[macro_use] extern crate iron;
#[macro_use] extern crate serde_derive;
#[macro_use] extern crate error_chain;
use askama::Template;
use iron::Iron;
use iron::IronResult;
use iron::headers::Co... |
use std::collections::HashMap;
use xgboost::{parameters, Booster, DMatrix};
pub fn to_xgboost_dataset(xdata: &[Vec<f64>], ydata: Option<Vec<f32>>) -> DMatrix {
let rows = xdata.len();
let mut xdata2 = vec![];
for row in xdata {
for item in row {
xdata2.push(*item as f32);
}
... |
use azure_sdk_core::errors::{check_status_extract_body, AzureError};
use azure_sdk_storage_core::key_client::KeyClient;
use azure_sdk_storage_core::prelude::*;
use azure_sdk_storage_core::{
client, get_default_json_mime, get_json_mime_fullmetadata, get_json_mime_nometadata,
ConnectionString, ServiceType,
};
use... |
use std::cmp;
use std::ops;
use crate::basis::Basis;
use crate::constants::FIRST_NON_BASIS_PRIME;
/// Iterate through origin_primes within [start, end)
///
/// This requires first sieving through all primes below sqrt(end). We use a custom OriginSegment
/// to sieve, as the WheelSegment's many Spokes carry extra init... |
use std::{
collections::HashMap,
};
use regex::Regex;
// use permutohedron::{
// heap_recursive,
// control::Control,
// };
#[derive(Debug, Clone)]
struct Field {
name: String,
possible_ranges: [(usize, usize); 2],
}
fn parse_data() -> (Vec<Field>, Vec<usize>, Vec<Vec<usize>>) {
let mut lines ... |
use crate::{Matrix, MatrixT, Vector, simd, simd_size, zero};
use packed_simd::f32x8;
use unroll::unroll_for_loops;
use itertools::{Itertools, iproduct};
use crate::ffi::mkl::*;
pub fn matmul<const M: usize, const N: usize, const K: usize>
(a: &Matrix<M, K>, b: &Matrix<K, N>, c: &mut Matrix<M, N>)
where [u8; simd(N)]... |
use crate::mp4::AtomIdent;
use crate::picture::Picture;
use std::fmt::{Debug, Formatter};
// Atoms with multiple values aren't all that common,
// so there's no need to create a bunch of single-element Vecs
#[derive(PartialEq, Clone)]
pub(super) enum AtomDataStorage {
Single(AtomData),
Multiple(Vec<AtomData>),
}
i... |
/// Given a duration, return a tuple of (scalar, time-unit).
/// This function attempts to round far away times to the nearest large
/// unit (naively implemented so it doesn't exactly behave that way).
pub fn pretty_duration<'a>(time_difference: chrono::Duration) -> (i64, &'a str) {
// Pretty print how long ago a ... |
use super::ext_value::{self, Ext};
use std::cell::RefCell;
use std::fmt::{Debug, Display};
use std::rc::Rc;
/*
We define both concrete
State and Transition types as well as abstract State and
Transition traits. These will be instantiated with states of a particular
type and transitions of varying arit... |
use super::*;
/// Pre-compute the TD-IDF weight for each term of each binding.
/// Then write the compute weights in a file at the given path.
pub fn tfidf_gen(method_names: &[&str]) -> (Vec<String>, Vec<Vec<(String, f64)>>) {
let documents = method_names
.iter()
.map(|x| split_words(x))
.c... |
use log::*;
use std::time::Duration;
pub mod env_reader;
pub mod sleeper;
pub struct Config {
pub hosts: String,
pub global_timeout: u64,
pub tcp_connection_timeout: u64,
pub wait_before: u64,
pub wait_after: u64,
pub wait_sleep_interval: u64,
}
const LINE_SEPARATOR: &str = "-----------------... |
use futures::{try_ready, Async, Future, Poll};
use futures_cpupool::{CpuFuture, CpuPool};
use lazy_static::lazy_static;
use state_machine_future::{transition, RentToOwn, StateMachineFuture};
use std::io;
use std::net::{IpAddr, SocketAddr, ToSocketAddrs};
use std::time::Instant;
use std::vec;
use tokio_tcp::TcpStream;
u... |
use std::task::{Context, Poll};
use std::{future::Future, marker::PhantomData, pin::Pin, rc::Rc};
use h2::server::{self, Handshake};
use crate::http::body::MessageBody;
use crate::http::config::{DispatcherConfig, ServiceConfig};
use crate::http::error::{DispatchError, ResponseError};
use crate::http::request::Request... |
#[macro_use]
extern crate log;
#[cfg(feature = "auth")]
use crate::request::build_update;
use crate::request::{build_client, build_request};
use crate::utils::config::Config;
use clap::Parser;
use clap_verbosity_flag::InfoLevel;
use harvest::data_harvest::Data;
use hyper::StatusCode;
use std::{ffi::OsStr, path::Path,... |
/*
* data-sifter
* Copyright © 2022 <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 o... |
#![allow(clippy::suspicious_else_formatting)]
mod common;
use clap::Parser;
use common::{new_docker, print_chunk};
use futures::StreamExt;
use std::path::PathBuf;
#[derive(Parser)]
struct Opts {
#[clap(subcommand)]
subcmd: Cmd,
}
#[derive(Parser)]
enum Cmd {
/// Attach to a running containers TTY.
Att... |
use crate::ast::*;
use crate::consts::special;
use crate::codegen::Generator;
use crate::codegen::eval::{self, EvalContext, Value};
use crate::codegen::convert;
use crate::sections::ConstantSection;
use crate::reporting::*;
use classfile::raw;
pub fn expand_declared_constants(gen: &mut Generator, constants: Vec<Const... |
//! Test the generated Datalog program by reading Datalog commands from stdin (i.e., from a pipe or
//! CLI), parsing them with cmd_parser crate, executing commands, and tracking database state in a
//! map.
#![allow(non_snake_case, dead_code)]
//#![feature(alloc_system)]
//extern crate alloc_system;
extern crate da... |
use std::collections::HashMap;
use std::collections::HashSet;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::str::FromStr;
// const FILE_NAME: &str = "input/day16.test.txt";
const FILE_NAME: &str = "input/day16.txt";
fn main() {
let file = File::open(FILE_NAME).expect("cannot open file");
let ... |
#![no_std]
#![feature(unboxed_closures)]
#![feature(abi_x86_interrupt)]
#![feature(fn_traits)]
// extern crate alloc;
#[macro_use] extern crate lazy_static;
extern crate port_io;
extern crate irq_safety;
extern crate spin;
extern crate state_store;
#[macro_use] extern crate log;
extern crate x86_64;
use port_io::Port... |
extern crate proc_macro;
use proc_macro2::{Span, TokenStream};
use syn::{parse_macro_input, Token, Item, Result, Ident, LitInt, spanned::Spanned};
use syn::parse::{Parse, ParseStream};
use quote::ToTokens;
use std::collections::HashSet;
mod ast_output;
mod types;
use ast_output::output_parser;
use types::{Component... |
use super::dump::{dump_voter_timestamp, dump_account, dump_ledger};
use crate::crypto::hash::{Address, EthereumH256 as H256};
use crate::blockchain::BlockChain;
use crate::blockdb::BlockDatabase;
use crate::statedb::StateDatabase;
use std::collections::HashMap;
use std::sync::Arc;
use std::thread;
use tiny_http::Header... |
use anyhow::{anyhow, Result};
use crate::ops::{Pos,Arg, UNINIT, NEG_SIGN, POS_SIGN};
use crate::parse::{skip_white, parse_arg};
// TODO: detect errors:
// - bracket follows comma
// - comma follows bracket
pub fn str_expr_to_vec(s: &str) -> Result<Vec<Arg>> {
// let mut last_arg = Arg::Op(String::new());
l... |
use std::collections::HashMap;
use petgraph::graph::{UnGraph, NodeIndex};
use talus::{graph, morse, LabeledPoint};
use pyo3::prelude::*;
use pyo3::PyErr;
use pyo3::exceptions::PyOSError;
#[pyclass]
pub struct MorseNode {
#[pyo3(get, set)]
pub identifier: i64,
#[pyo3(get, set)]
pub value: f64,
#[py... |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
use std::fmt;
use anyhow::Result;
use onefuzz::process::Output;
use crate::coordinator::{NodeCommand, NodeState};
use crate::reboot::RebootContext;
use crate::setup::ISetupRunner;
use crate::work::*;
use crate::worker::*;
pub enum Scheduler ... |
use common::*;
use bytes::BytesMut;
use futures::prelude::*;
use once_cell::sync::Lazy;
use regex::Regex;
use std::borrow::Cow;
use std::error::Error;
use tokio::time::{delay_for, Duration};
use tracing_futures::Instrument;
const BASE_STREAM_URL: &str = "http://stream.pushshift.io?type=submissions&is_self=false";
co... |
#[cfg(any(target_os = "linux", target_os = "macos"))]
use libc::c_void;
#[cfg(target_os = "windows")]
use winapi::ctypes::c_void;
use std::{mem, ptr, str};
use gl;
use gl::types::*;
use crate::context_gfx::ContextGfx;
use crate::error::RuntimeError;
use crate::error::RuntimeError::*;
use crate::shader::{compile_sha... |
use gloo_render::{request_animation_frame, AnimationFrame};
use wasm_bindgen::JsCast;
use web_sys::{HtmlCanvasElement, WebGlRenderingContext};
use weblog::console_log;
use yew::{html::Scope, prelude::*, props, Properties};
pub enum Msg {
Render(f64),
MouseMove(i32, i32),
}
pub struct Background {
gl: Opti... |
use log::*;
use std::path::PathBuf;
use std::sync::atomic::Ordering;
use clap::{
crate_authors, crate_version, value_t, value_t_or_exit, values_t, App, AppSettings, Arg,
ArgMatches, SubCommand,
};
use nix::unistd::Pid;
use vmsh::attach::{self, AttachOptions};
use vmsh::coredump::CoredumpOptions;
use vmsh::dev... |
// Copyright (c) 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 acco... |
use crate::aabb::AABB;
use crate::material::{Lambertian, Material};
use crate::rtweekend::{degrees_to_radians, fmax, fmin, INFINITY};
use crate::Ray;
use crate::Vec3;
use crate::{Color, Point3};
use std::sync::Arc;
#[derive(Clone)]
pub struct HitRecord {
pub p: Point3,
pub normal: Vec3,
pub front_face: boo... |
// Copyright 2018 New Vector Ltd
//
// 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 ... |
use super::Args;
use crate::dbopt::{PgPool, PooledPg};
use crate::fetch_places::OverpassOpt;
use crate::photosdir::PhotosDir;
use diesel::r2d2::{Pool, PooledConnection};
use log::{debug, warn};
use medallion::{Header, Payload, Token};
use r2d2_memcache::r2d2::Error;
use r2d2_memcache::MemcacheConnectionManager;
use std... |
use crate::{
error::Result,
filesystem::{
files,
path::{get_resized_dir_path, get_resized_paths},
resizer::resize_images,
watcher::{get_watcher_event_action, FileAction},
},
model::{config::AppConfig, ImageSize, ResizeOptions},
};
use notify::{watcher, DebouncedEvent, Rec... |
use std::convert::AsRef;
use std::fmt::{self, Debug, Display};
use lasso::{Key, Spur, ThreadedRodeo};
use once_cell::sync::OnceCell;
pub use lasso;
/// An interned string.
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub struct Symbol(Spur);
impl Symbol {
/// Intern a string and return the symbol.
#[must_use... |
use {
std::{
collections::HashSet,
convert::Infallible as Never,
sync::Arc,
time::Duration as StdDuration,
},
chrono::{
Duration,
prelude::*,
},
chrono_tz::Tz,
enum_iterator::IntoEnumIterator,
futures::{
pin_mut,
stream::{
... |
use rustc::ty;
use syntax::ast::*;
use syntax::ptr::P;
use crate::ast_manip::{fold_blocks, FlatMapNodes, AstEquiv};
use crate::command::{CommandState, Registry};
use crate::driver::{Phase, parse_expr};
use crate::matcher::{mut_visit_match, Subst};
use crate::path_edit::fold_resolved_paths;
use crate::transform::Transf... |
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
// @TODO: uncomment once https://github.com/rust-lang/rust/issues/54726 stable
//#![rustfmt::skip::macros(class)]
#![allow(
clippy::used_underscore_binding,
clippy::non_ascii_literal,
clippy::enum_glob_use,
clippy::must_use_candidate,
clippy::wildcard_imports
)]
mod generated;
mod guide;
mod page;... |
use super::relay::relay_connection;
use crate::utils::make_error;
use crate::config::TunnelConfig;
use std::error::Error;
use std::net::{Ipv4Addr, Ipv6Addr};
use tokio::io::AsyncReadExt;
use tokio::io::AsyncWriteExt;
use tokio::net::TcpStream;
mod v5 {
pub const VERSION: u8 = 5;
pub const METH_NO_AUTH: u8 = ... |
// Copyright 2020 - developers of the `grammers` project.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distr... |
//! Provides a high quality sampling scheme based on (0, 2)-sequences
//! See sec. 7.4.3 of Physically Based Rendering
// use rand::distributions::{IndependentSample, Range};
use rand::distributions::{Distribution, Uniform};
use rand::rngs::ThreadRng;
use rand::seq::SliceRandom;
// use rand::Rng;
use std::{f32, iter, ... |
use super::wasmedge;
pub type WasmEdgeProposal = wasmedge::WasmEdge_Proposal;
pub type HostRegistration = wasmedge::WasmEdge_HostRegistration;
pub type HostFunc = wasmedge::WasmEdge_HostFunc_t;
pub type WrapFunc = wasmedge::WasmEdge_WrapFunc_t;
#[derive(Debug)]
pub enum WasmEdgeRefType {
FuncRef,
ExternRef,
}
... |
use super::*;
use alloc::boxed::Box;
use bitflags::*;
use log::*;
use volatile::{ReadOnly, WriteOnly};
/// Virtual human interface devices such as keyboards, mice and tablets.
///
/// An instance of the virtio device represents one such input device.
/// Device behavior mirrors that of the evdev layer in Linu... |
#![deny(bare_trait_objects)]
//! The nvimpam binary. Needs to be connected to neovim by stdin/stdout like
//! this (assuming it is in your PATH):
//!
//! ```text
//! let s:bin = 'nvimpam'
//! let s:id = jobstart([s:bin], { 'rpc': v:true }
//! ```
//!
//! It will automatically notify neovim of its activity, request the ... |
use base64;
use gistcard::{get_gist, Gist, GistError, GistFile};
use http::{header, StatusCode};
use log::debug;
use now_lambda::{error::NowError, lambda, IntoResponse, Request, Response};
use reqwest::Client;
use serde::Serialize;
use serde_json::json;
use simplelog::{Config, Level, LevelFilter, SimpleLogger};
use std... |
use sgx_rand::Rng;
use sgx_tse::{rsgx_create_report, rsgx_verify_report};
use sgx_tstd::{ptr, string::String, vec::Vec};
use sgx_types::*;
use crate::ias::Client;
extern "C" {
pub fn ocall_sgx_init_quote(
ret_val: *mut sgx_status_t,
ret_ti: *mut sgx_target_info_t,
ret_gid: *mut sgx_epid_gr... |
#![no_main]
#![no_std]
use bbqueue::{consts::*, framed::FrameGrantW, BBBuffer, ConstBBBuffer};
use embedded_hal::blocking::delay::{DelayMs, DelayUs};
use embedded_hal::digital::v2::OutputPin;
use cpu_002 as _; // global logger + panicking-behavior + memory layout
use nrf52840_hal::{
self as hal,
clocks::LfOscC... |
//! A cache that doesn't ever expire entries, generally for use by a client storing bindles on disk
use std::convert::TryInto;
use tokio_stream::{Stream, StreamExt};
use tracing::{debug, instrument, trace, warn};
use tracing_futures::Instrument;
use super::{into_cache_result, Cache};
use crate::provider::{Provider, P... |
//! An atomic-based read-write lockable U32.
use std::sync::atomic::{AtomicU64, Ordering};
/// A read-write lockable U32, backed by an atomic U64.
///
/// Only supports try-locking.
pub struct Rwu32 {
/// The backing u64 is split up as follows:
///
/// |--- payload (32 bits) ---|W|--- read count (31 bits)... |
use ansi_term::Color::{Blue, White};
use anyhow::anyhow;
use chrono::Local;
use phylum_cli::api::PhylumApi;
use phylum_cli::config::{get_current_project, save_config, ProjectConfig};
use phylum_cli::types::PROJ_CONF_FILE;
use uuid::Uuid;
use super::{CommandResult, CommandValue};
use crate::print::*;
use crate::print_... |
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
fuchsia_zircon::{self as zx},
virtio_device::{
mem::{DeviceRange, DriverMem, DriverRange},
queue::QueueMemory,
ring,
... |
extern crate docopt;
extern crate git2;
extern crate regex;
extern crate rustc_serialize;
extern crate progress;
extern crate toml;
#[macro_use]
extern crate log;
extern crate env_logger;
use docopt::Docopt;
use std::env;
const USAGE: &'static str = "
Usage: cargo-incremental build [options]
cargo-incremental... |
use array_macro::array;
use crate::fs::VFile;
use crate::arch::riscv::{ tp, sstatus };
use crate::arch::riscv::qemu::param::NCPU;
use crate::lock::spinlock::{SpinlockGuard, Spinlock};
use core::cell::RefCell;
use core::ops::IndexMut;
use core::ptr::NonNull;
use super::*;
pub struct CPU {
pub process: Option<NonNull... |
use crate::array::Array;
use crate::error::Error;
use crate::hardware::Hardware;
use crate::operator::Operator;
use crate::result::Result;
use crate::shape::Shape;
use std::cell::RefCell;
/// Placeholder of `Array`s.
/// Unlike `Option`, the object always holds its `Shape` and `Hardware` informatin.
pub(crate) enum Ar... |
use crate::air::*;
use crate::air::TestTraceSystem;
use crate::polynomials::*;
use crate::fft::multicore::Worker;
use crate::*;
use ff::PrimeField;
// mod single_witness;
mod per_register;
mod density_query;
pub(crate) mod mappings;
/*
This module contains an ARP step of the Stark. Values of the registers in the AIR... |
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0.
#![feature(shrink_to)]
pub mod future;
pub mod thread;
mod collector;
mod trace;
mod utils;
pub use collector::Collector;
pub use trace::{ScopeGuard, SpanGuard};
pub use minitrace_macro::{trace, trace_async};
#[cfg(test)]
mod tests;
#[derive(Debu... |
use std::error::Error;
use std::fmt::Error as FormatterError;
use std::fmt::{Debug, Display, Formatter};
use std::marker::PhantomData;
use std::time::Duration;
use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};
use super::{
DeviceCode, EndUserVerificationUrl, ErrorResponse, ErrorResponseType, R... |
use rnp::{parse_ping_target, RnpStubServerConfig, RnpSupportedProtocol};
use std::net::SocketAddr;
use std::time::Duration;
use structopt::StructOpt;
#[derive(Debug, StructOpt, PartialEq)]
#[structopt(name = rnp::RNP_SERVER_NAME, author = rnp::RNP_AUTHOR, about = rnp::RNP_ABOUT)]
pub struct RnpServerCliOptions {
#... |
use crate::evm_types::{StackValue, StackValue::*};
use ethereum_types::U256;
use std::ffi::{CStr, CString};
use std::os::raw::c_char;
use z3_sys::*;
impl StackValue {
fn simplify_sys(&self) {
unsafe {
let config = Z3_mk_config();
let context = Z3_mk_context(config);
let ... |
extern crate open_cl_low_level;
use std::fmt;
use open_cl_low_level::*;
fn main() {
run_procedural();
run_with_session();
}
fn run_procedural() {
unsafe {
let src = include_str!("simple_add.ocl");
let mut platforms = Platform::list_all().unwrap();
if platforms.len() == 0 {
... |
use std::{
io::{BufRead, BufReader, Read},
str::FromStr,
vec,
};
#[derive(Debug, Clone)]
struct Board {
numbers: Vec<Vec<usize>>,
marked_numbers: Vec<Vec<bool>>,
}
impl Board {
fn from_string_vec(lines: Vec<String>) -> Self {
let mut board = Board {
numbers: vec![],
... |
//! Individual implementation for all traits.
mod clone;
mod common_ord;
mod copy;
mod debug;
mod default;
mod eq;
mod hash;
mod ord;
mod partial_eq;
mod partial_ord;
#[cfg(feature = "zeroize")]
mod zeroize;
#[cfg(feature = "zeroize")]
mod zeroize_on_drop;
use proc_macro2::TokenStream;
use syn::{spanned::Spanned, Met... |
use crate::xml::{get_attrib, get_child, get_child_text};
use crate::{errors::*, fetch_body};
use bitflags::bitflags;
use error_chain::bail;
use futures::Future;
use reqwest::r#async::{Client, RequestBuilder};
use roxmltree::{Document, Node};
use std::sync::Arc;
const LOCATION_AHA: &str = "/webservices/homeautoswitch... |
use adventofcrustacean;
use std::collections::HashMap;
#[derive(Debug,Clone,Eq,Hash)]
struct Config {
score: [u16; 2],
pos: [u16; 2],
round: usize,
}
impl PartialEq for Config {
fn eq(&self, other: &Config) -> bool {
self.score == other.score && self.pos == other.pos && self.round == other.rou... |
//! Each of the valid `Value` types.
//!
//! These generally mimic the Sway types with a couple of exceptions:
//! - [`Type::Unit`] is still a discrete type rather than an empty tuple. This may change in the
//! future.
//! - [`Type::Union`] is a sum type which resembles a C union. Each member of the union uses the... |
use crate::Opt;
use notify::{
event::{Event as NEvent, EventKind as NEventKind},
immediate_watcher, RecursiveMode, Watcher,
};
use std::fs;
use std::fs::File;
use std::io::prelude::*;
use std::net::TcpStream;
use std::process::Command;
use std::sync::{Arc, Mutex};
use std::time::{Duration, Instant};
#[derive(D... |
// Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
use std::collections::BTreeMap;
use std::path::Path;
use sha1::{Digest, Sha1};
#[derive(Clone)]
pub struct ConfigFile {
map: BTree... |
#![allow(
dead_code,
unused_imports,
clippy::needless_range_loop,
clippy::ptr_arg,
clippy::char_lit_as_u8
)]
use std::char;
use std::cmp::{max, min};
use std::fmt;
use std::io::BufRead;
use std::iter::*;
use std::ops::*;
use std::str;
use std::str::FromStr;
use std::{io, process};
use failure::bai... |
use std::{
collections::HashMap,
path::{Path, PathBuf},
};
use serde::Deserialize;
use steam_shortcuts_util::{shortcut::ShortcutOwned, Shortcut};
#[derive(Deserialize, Debug, Clone)]
pub(crate) struct ManifestItem {
#[serde(alias = "LaunchExecutable")]
pub launch_executable: String,
#[serde(alias... |
//! Human repository.
use diesel::prelude::*;
use uuid::Uuid;
use crate::error::DbError;
use crate::pg::PgConn;
use crate::schema::{human_friends, humans};
#[derive(Debug, PartialEq, Queryable, Deserialize, Serialize)]
pub struct Human {
pub id: Uuid,
pub name: String,
}
#[derive(Deserialize)]
pub struct Cre... |
use std::convert::{TryFrom, TryInto};
use serde::{Deserialize, Serialize};
/// Incomplete location error type.
///
/// uses [LocationKind] to inform which field is missing.
#[derive(Debug, Clone)]
pub struct IncompleteLocation {
missing: LocationKind,
}
/// enum of the mandatory [Location] fields.
///
// Not ver... |
use crate as duster;
use frame_support::parameter_types;
use frame_support::traits::{Everything, GenesisBuild, Nothing, OnKilledAccount};
use orml_currencies::BasicCurrencyAdapter;
use orml_traits::parameter_type_with_key;
use primitives::{AssetId, Balance};
use crate::Config;
use frame_system as system;
use sp_cor... |
#[macro_use] extern crate hex_literal;
extern crate aes_soft as aes;
extern crate block_padding;
use std::iter::repeat;
use block_padding::{Pkcs7, Padding};
use aes::block_cipher_trait::generic_array::GenericArray;
use aes::block_cipher_trait::generic_array::typenum::U16;
use aes::block_cipher_trait::BlockCipher;
use... |
use crate::{background::Position, value_or_default, values_or_default};
use anyhow::Result;
use std::{fs, path::PathBuf};
/// Generate config files from dotfiles
#[derive(Debug, clap::Parser)]
pub struct Dotfiles {
#[clap(long)]
temporary_project_dir: Option<PathBuf>,
#[clap(long)]
editor: Option<Strin... |
use async_trait::async_trait;
use error_chain::bail;
use std::path::PathBuf;
use std::fs::read_to_string;
use std::fs::File;
use std::io::prelude::*;
use std::process::*;
use ini::Ini;
use serde_json::{self, Value};
use toml_edit::{value, Document};
use crate::cli::WriteArgs;
use crate::errors::ErrorKind;
use crate:... |
use std::{
convert::identity,
fmt::Debug,
io,
pin::Pin,
sync::Arc,
task::{Context, Poll},
};
use futures::{Sink, SinkExt, Stream, TryStreamExt};
use pin_project_lite::pin_project;
use redust_resp::Data;
use tokio::{
net::{TcpStream, ToSocketAddrs},
sync::Mutex,
};
use tokio_util::codec::{Decoder, Framed};
use ... |
use std::ops::{Add, Sub, Mul, Div, Neg};
use super::{Point3D, Vector3D, AsVector, Matrix3D};
#[derive(PartialEq, PartialOrd, Clone, Debug)]
pub struct Direction3D {
direction: Vector3D
}
static DIRECTION3D_UNIT_X: Direction3D = Direction3D {
direction: Vector3D {x: 1.0, y: 0.0, z: 0.0}
};
static DIRECTION3D_... |
use std::path::Path;
use std::sync::Arc;
use std::{fs::File, path::PathBuf};
use fehler::throws;
use serde::Deserialize;
use stable_eyre::eyre::{self, Error, WrapErr};
use toml::value::Datetime;
use crate::metrics::Consumer;
use crate::metrics::{self, Graphql};
mod high_contributor;
mod issue_closure;
mod repo_info;... |
use chrono::Utc;
use deltalake::action::*;
use deltalake::*;
use maplit::hashmap;
use std::collections::HashMap;
use std::fs;
use std::path::{Path, PathBuf};
use uuid::Uuid;
// NOTE: The below is a useful external command for inspecting the written checkpoint schema visually:
// parquet-tools inspect tests/data/checkp... |
#[cfg(target_os = "linux")]
pub use self::linux::*;
#[cfg(target_os = "linux")]
mod linux {
use crate::*;
use disk_types::*;
use std::fs::read_link;
pub fn scan(world: &mut DiskManager) -> Result<(), DiskError> {
let prober = BlockProber::new().map_err(DiskError::BlockProber)?;
for res... |
use crate::common::block_status::BlockStatus;
use crate::serialization::block::BlockDB as ProtoBlockDB;
use crate::traits::EnumConverter;
use crate::traits::{BlockHeader, Decode, Encode, Proto};
use protobuf::Message as ProtoMessage;
use std::error::Error;
#[derive(Clone, Debug)]
pub struct Meta<HeaderType>
where
... |
use futures::{
channel::mpsc::{UnboundedReceiver, UnboundedSender},
future::LocalBoxFuture,
FutureExt,
};
use rand::Rng;
use rumpsteak::{
channel::Bidirectional, session, try_session, Branch, End, Message, Receive, Role, Roles,
Select, Send,
};
use std::{error::Error, result, time::Duration};
use to... |
use macroquad::{prelude::*, ui::root_ui};
const PART_WIDTH: f32 = 10.0;
const PART_HEIGHT: f32 = 10.0;
#[derive(Clone, Copy, Debug)]
enum Direction {
North,
South,
West,
East,
}
fn is_opposite_of(one: Direction, other: Direction) -> bool {
use Direction::*;
matches!(
(one, other),
... |
use config::Config;
use state::State;
use std::sync::{Once, ONCE_INIT};
static HEADER: Once = ONCE_INIT;
fn should_run_bm(bm_name: &String) -> bool {
let filter = &Config::get().filter;
filter.is_match(bm_name)
}
fn range_generator<T>(i: T) -> T {
i
}
fn compose<T: 'static, U: 'static>(f: Box<Fn(u64) -... |
use geo;
use geo::algorithm::boundingbox::BoundingBox;
use gfx;
use render::*;
use vertex::Vertex;
/// A collection of polygons that could all be rendered in a single draw call.
#[derive(Clone, Debug)]
pub struct PolygonBuffer {
pub(crate) polyhedron_vertices: Vec<Vertex>,
pub(crate) bounding_box_vertices: Ve... |
use crate::dyn_utf16_ptr;
use crate::guid::*;
use crate::println;
use core::ffi::c_void;
use core::mem::MaybeUninit;
use crate::uefi::*;
type FnPtr = u64;
type CHAR16 = u16;
use crate::impl_guid;
impl_guid!(
EfiGraphicsOutputProtocol<'_>,
EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID
);
impl_guid!(
EfiSimpleFileSyst... |
// Lexer for Ceres
use std::vec;
use std::char;
use lazy_static::lazy_static;
// use crate::stream::PeekableStream;
use crate::token::Token;
lazy_static! {
static ref TYPE_KEYWORDS: Vec<&'static str> = vec![
"int",
"bool",
"char",
"str"
];
// Reserved keywords
static r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.