text stringlengths 3.09k 13.9k |
|---|
// Copyright 2020 Two Sigma Investments, LP.
//
// 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... |
use std::env;
use futures::executor::block_on;
use reqwest::header;
use serde::{Deserialize, Serialize};
// See https://docs.github.com/en/rest/reference/repos
#[derive(Debug, Serialize, Deserialize)]
struct GitHubRepo {
id: String,
name: String,
full_name: String,
description: String,
fork: bool,... |
//! The Abstract Syntax Tree.
use std::cmp::Ordering;
use std::collections::HashMap;
use std::convert::TryFrom;
use crate::position::PositionContainer;
use crate::token::TokenKind;
/// A node of an Abstract Syntax Tree. Either an expression or a statement.
#[derive(Debug, PartialEq)]
pub enum AstNode {
Expressio... |
// traits are interface in typescript
// can use as implement structure
// also can use as parameter type
// and return type
use std::fmt::Display;
use std::fmt::Debug;
use traits_behavior::Summary2;
// define interface type trait
pub trait Summary {
fn summarize(&self) -> String;
}
pub struct NewsArticle {
p... |
extern crate peroxide;
use peroxide::*;
const SIZE: usize = 100;
#[allow(non_snake_case)]
fn main() {
let size = SIZE;
// Make test data set
let noise = Normal(0., 0.5);
let p_true: Vec<Number> = NumberVector::from_f64_vec(vec![20f64, 10f64, 1f64, 50f64]);
let real = f(p_true.clone()).to_f64_vec(... |
use std::time::Duration;
use std::{env, process};
use clap::Clap;
use color_eyre::eyre::{bail, Result};
use futures::stream::StreamExt;
use nix::sys::signal;
use nix::unistd::Pid;
use signal_hook::consts::signal::*;
use signal_hook_tokio::Signals;
use tokio::{fs, task};
use crate::cmd::peer::List;
use crate::cmd::rep... |
#![doc(html_root_url = "https://docs.rs/tower-request-modifier/0.1.0")]
#![deny(missing_docs, missing_debug_implementations, unreachable_pub)]
#![cfg_attr(test, deny(warnings))]
//! A `tower::Service` middleware to modify the request.
use http::header::{HeaderName, HeaderValue};
use http::uri::{self, Uri};
use http::... |
use super::*;
/// SLIP decode context
pub struct Decoder {
header_found: bool,
esc_seq: [u8; 4],
esc_seq_len: usize,
}
impl Decoder {
/// Create a new context for SLIP decoding
pub fn new() -> Self {
Decoder {
header_found: false,
esc_seq: [0; 4],
esc_se... |
use std::collections::HashMap;
type CompilerResult = Result<Vec<Value>, Errors>;
#[derive(Debug)]
pub struct Executor {
functions: HashMap<String, Vec<Instruction>>,
variables: HashMap<String, Vec<Value>>,
}
impl Default for Executor {
fn default() -> Self {
Self {
functions: HashMap:... |
use std::collections::HashMap;
use serde::{Deserialize, Serialize};
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
let result = 2 + 2;
assert_eq!(result, 4);
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Table {
num_cols: usize,
rows: Vec<Vec<String>>,
}
#[deriv... |
use std::collections::HashMap;
use std::ffi::CString;
use std::string;
use std::sync::{Arc, RwLock};
const MAX_NAME_LEN: usize = 256;
pub type JobSharedDataType = Arc<RwLock<JobSharedData>>;
#[derive(Copy, Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum Algorithm {
Cuckoo = 1,
RandomX = 2,
ProgPow = 3,... |
use std::{
cell::RefCell,
collections::{hash_map::Entry, HashMap},
};
use cqrs::{Aggregate, AggregateId, EventNumber, EventSink, EventSource, Precondition, Since, Version, VersionedEvent};
use cqrs_todo_core::{TodoAggregate, TodoEvent, TodoIdRef, TodoMetadata};
use void::Void;
#[derive(Debug)]
struct EventMap... |
use std::collections::HashMap;
use std::fmt::Display;
use std::fmt::Formatter;
use std::ops::Index;
use serde::*;
use quicksilver::lifecycle::Window;
use quicksilver::lifecycle::Event;
use quicksilver::input::Key;
use quicksilver::input::GamepadButton;
use quicksilver::input::GamepadAxis;
#[derive(Clone, Copy, Eq, Pa... |
use alloc::vec::Vec;
use alloc::string::String;
use sha2::{Digest, Sha256};
use crate::unid::errors::UNiDError;
use super::codec;
const MULTIHASH_SHA256_CODE: u8 = 0x12; // 0x12 = 18
const MULTIHASH_SHA256_SIZE: u8 = 0x20; // 0x20 = 32
pub struct Multihash {}
#[derive(PartialEq, Debug)]
pub struct DecodedContainer... |
// #![feature(backtrace)]
// use std::backtrace::Backtrace;
use std::usize;
use bevy::{diagnostic::Diagnostics, prelude::*};
use bevy::{
diagnostic::FrameTimeDiagnosticsPlugin,
log::{Level, LogSettings},
};
use rand::{thread_rng, Rng};
///
/// ECS: Entity, Component, System
/// 实体(Entity) 是指向一群 组件(Component)... |
use crate::build_filter_helper::derive_non_table_filter;
use crate::diagnostic_shim::{Diagnostic, DiagnosticShim};
use crate::field::Field;
use crate::model::Model;
use crate::utils::{is_has_many, wrap_in_dummy_mod};
use proc_macro2::{Span, TokenStream};
use quote::quote;
use syn::parse_quote;
pub fn derive(item: &syn... |
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use metrohash::MetroHash128;
use std::{
hash::Hasher,
io,
io::{Read, Write},
mem::size_of,
};
type Word = u32;
const WORD_BITS: u32 = 32;
const WORD_LEN_BITS: usize = 5;
const WORD_MASK: u32 = 0x55555555;
#[derive(Debug, PartialEq, Eq)]
pub s... |
#![deny(rust_2018_idioms, unsafe_code, missing_docs)]
//! This crate defines the API exposed by the connectors to the migration engine core. The entry point for this API is the [MigrationConnector](trait.MigrationConnector.html) trait.
mod checksum;
mod connector_params;
mod destructive_change_checker;
mod diff;
mod ... |
extern crate atoi;
extern crate pairing_plus as pairing_plus;
extern crate pointproofs_paramgen;
extern crate rand;
use atoi::atoi;
use pairing_plus::serdes::SerDes;
use pointproofs_paramgen::*;
use rand::rngs::OsRng;
use rand::RngCore;
use std::fs::{File, OpenOptions};
use zeroize::Zeroize;
fn usage(progname: &str) ... |
use gettextrs::{gettext, ngettext};
use gladis::Gladis;
use gtk::prelude::*;
use std::rc::Rc;
use super::DetailsModel;
use crate::app::components::{screen_add_css_provider, Component, EventListener, Playlist};
use crate::app::dispatch::Worker;
use crate::app::loader::ImageLoader;
use crate::app::{AppEvent, BrowserEve... |
use caches::art_cache::ArtCache;
use caches::facet_cache::Altitudes;
use caches::texmap_cache::TexMapCache;
use cgmath::Point2;
use ggez::graphics::{self, DrawParam, Image, Mesh, MeshBuilder, Vertex};
use ggez::{Context, GameResult};
use std::cmp::Ordering;
use uorustlibs::map::{Block, StaticLocation};
use uorustlibs::... |
mod health_checker;
mod routes;
mod url_value;
use std::cmp::Reverse;
use std::fmt::Write;
use std::str::FromStr;
use std::time::Duration;
use std::{env, io, str, thread};
use futures::channel::mpsc::{self, Sender};
use futures::executor::ThreadPool;
use futures::stream::StreamExt;
use futures_stream_batch::ChunksTim... |
use crate::config::Keybind;
use crate::errors::{self, Error, LeftError};
use crate::xkeysym_lookup;
use std::os::raw::{c_int, c_ulong};
use std::ptr;
use std::sync::Arc;
use tokio::sync::{oneshot, Notify};
use tokio::time::Duration;
use x11_dl::xlib;
pub struct XWrap {
pub xlib: xlib::Xlib,
pub display: *mut x... |
use dirs::{CARGO_HOME, RUSTUP_HOME};
use errors::*;
use run;
use std::env;
use std::fmt::{self, Display, Formatter};
use std::fs;
use std::path::{Path, PathBuf};
static IMAGE_NAME: &'static str = "cargobomb";
/// Builds the docker container image, 'cargobomb', what will be used
/// to isolate builds from each other. ... |
// Copyright © 2021-present <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
// https://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in w... |
use crate::{
detect_encoding, flavor::ImperatorFlavor, tokens::TokenLookup, BodyEncoding, Extraction,
FailedResolveStrategy, ImperatorDate, ImperatorError, ImperatorErrorKind, PdsDate,
};
use jomini::{BinaryTape, BinaryToken, TextWriterBuilder, TokenResolver};
use std::{
collections::HashSet,
io::{Curso... |
use solana_program::clock::UnixTimestamp;
use crate::state::bc_token_metadata::BcTokenMetadata;
use crate::state::enums::BcTokenState;
use crate::{error::ShihonError, state::enums::ShihonAccountType, PROGRAM_AUTHORITY_SEED};
use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
use solana_program::{
account_... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Watchdog mode register. This register contains the basic mode and status of the Watchdog Timer"]
pub wdmod: WDMOD,
#[doc = "0x04 - Watchdog timer constant register. This register determines the time-out value"]
pub wdtc: WD... |
#![cfg_attr(not(feature = "gtk_3_10"), allow(unused_variables, unused_mut))]
extern crate gtk;
extern crate gdk;
#[cfg(feature = "gtk_3_10")]
mod example {
use gdk;
use gtk::prelude::*;
use gtk::{
self, AboutDialog, AppChooserDialog, Builder, Button, Dialog, Entry, FileChooserAction,
FileC... |
use pac::{EUSCI_A0, EUSCI_A1, EUSCI_A2, EUSCI_A3};
use pac::{EUSCI_B0, EUSCI_B1, EUSCI_B2, EUSCI_B3};
use super::SPI;
pub enum ClockSource {
ACLK,
SMCLK,
}
pub enum SpiError {
Unknown,
}
pub struct Disabled;
pub struct Enabled;
macro_rules! spi {
(
$(($spix:ident,$ucx_ctlw0:ident, $ucx_brw... |
use crate::configuration::Configuration;
use crate::page::Page;
use rayon::ThreadPoolBuilder;
use robotparser::RobotFileParser;
use std::collections::HashSet;
use std::{sync, thread, time};
/// Page handler
pub trait PageHandler {
/// handle a `Page`, return links to crawl
fn handle(&mut self, page: Page) -> V... |
use std::collections::VecDeque;
use std::fmt::Debug;
use super::TestId;
use super::buffered::BufferSlot;
use super::super::mutation::{ MutationInfo, MutatorId };
trait IntervalProperty {
type ChapterT : PartialEq + Debug + Copy + Clone;
type IndexT : Default + PartialEq + Debug;
fn is_direct_succession(old: &Self::... |
use crate::interpreter::{EvaluationError, Interpreter, InterpreterBuilder, SymbolIndex};
use crate::reader::{is_structural, is_symbolic, is_token, read, ReadError};
use crate::value::Value;
use rustyline::completion::{Completer, Pair};
use rustyline::error::ReadlineError;
use rustyline::highlight::{Highlighter, Matchin... |
use crate::args::{Args, Command, SortType};
use crate::formats::Format;
use crate::progress::WalkProgress;
use crate::state::WalkState;
use crate::walker::Walker;
use std::fs::File;
use std::io;
use crate::directory_stat::DirectoryStat;
use chrono_humanize::Humanize;
use indicatif::HumanBytes;
use prettytable::{cell,... |
use std::env;
use std::ffi::{OsStr, OsString};
use std::fmt;
#[derive(Debug, Clone)]
pub enum UsageError {
InvalidArgument { arg: OsString },
UnexpectedArgument { arg: OsString },
MissingArgument { name: String },
UnknownOption { option: String },
OptionMissingParameter { option: String },
Opti... |
use crate::errors::Result;
use crate::record_parsing::{RecordParser, RecordParsingOptions};
use crate::typer::{DatasetValue, Typer};
use crate::value_parsing::Parsed;
use crate::{
dataset_file::{DatasetFile, RecordsToRead},
lexer::Record,
};
use futures_core::TryStream;
use itertools::Itertools;
use maplit::has... |
use super::error::{ResolveError, UnresolvedError};
use super::field_resolve_cell::FieldResolveCell;
use crate::mapping::definition::{
ColumnDefinition, ForeignKeyDefinition, IndexDefinition, TableDefinition,
};
use crate::mapping::{DatabaseType, Table};
use heck::SnakeCase;
use proc_macro2::{Ident, TokenStream};
us... |
use crate::keyword::Keyword;
use crate::span::ByteSpan;
use crate::token::Token;
use crate::transaction::Flag;
macro_rules! directives {
(
$(
$( #[doc = $doc:literal] )*
$name:ident {
$(
$( #[doc = $attrdoc:literal] )*
$attrname:ident: $attrty:ty ,
)+
} $( : $keyword:path )? ,
)+
) => ... |
use std::env;
use crate::{
broker::{Broker, BrokerMessage},
client::UnconnectedClient,
};
use bytes::BytesMut;
use futures::{stream, SinkExt, StreamExt};
use log::{debug, info, trace, warn};
use mqtt_v5::{
codec::MqttCodec,
encoder,
types::{DecodeError, EncodeError, Packet, ProtocolVersion},
we... |
use itertools::iproduct;
use rand::{distributions::Uniform, rngs::StdRng, Rng, SeedableRng};
use std::ops::{Index, IndexMut};
use rayon::prelude::*;
// A struct to contain the grid and the various metadata
// The grid is 2d, but it is stored as a 1d vec.
// Here are the rules: Each has a state n from 0..num_states
// ... |
use aoc_utils::PuzzleInput;
const DAY: u8 = 13;
struct TransparentPaper {
map: Vec<Vec<bool>>,
fold_instructions: Vec<FoldInstruction>,
}
impl TransparentPaper {
fn parse(input: &PuzzleInput) -> TransparentPaper {
let mut parts = input.raw_input.split("\n\n");
let coordinate_lines = parts.... |
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
anyhow::{format_err, Error},
async_helpers::hanging_get::asynchronous as hanging_get,
fidl_fuchsia_bluetooth_sys::{self as sys, AccessReq... |
use std::net::{IpAddr, SocketAddr};
use std::sync::Arc;
use anyhow::Result;
use futures::stream::StreamExt;
use log::*;
use tokio::net::{TcpStream, UdpSocket};
use tokio::sync::mpsc::channel as tokio_channel;
use tokio::sync::mpsc::{Receiver as TokioReceiver, Sender as TokioSender};
use crate::app::dispatcher::Dispa... |
// 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... |
// Copyright (c) 2017 The vulkano developers
// 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. All files in the project carrying such
// notice may not be ... |
//! Related to out filenames of compilation (e.g. save analysis, binaries).
use crate::config::{CrateType, Input, OutputFilenames, OutputType};
use crate::Session;
use rustc_ast as ast;
use rustc_span::symbol::sym;
use rustc_span::Span;
use std::path::{Path, PathBuf};
pub fn out_filename(
sess: &Session,
crate... |
extern crate regex;
use std::collections::{BTreeMap, HashMap};
use std::error::Error;
use std::io::{BufRead, BufReader, Read};
use regex::Regex;
type Minute = usize;
type GuardID = usize;
#[derive(Debug)]
enum EventType {
Error = 0,
BeginShift,
FallAsleep,
WakesUp,
}
#[derive(Debug, Clone, Eq, Part... |
use crate::{DebuggerError, DebuggerOptions};
use probe_rs::{
architecture::{
arm::{
ap::{GenericAp, MemoryAp, IDR},
armv6m::Demcr,
memory::Component,
sequences::DefaultArmSequence,
ApAddress, ApInformation, ArmProbeInterface, DpAddress, MemoryApIn... |
use crate::local_network::LocalNetwork;
use node_test_rig::eth2::types::{BlockId, StateId};
use std::time::Duration;
use types::{Epoch, EthSpec, Slot, Unsigned};
/// Checks that all of the validators have on-boarded by the start of the second eth1 voting
/// period.
pub async fn verify_initial_validator_count<E: EthSp... |
#![feature(external_doc)]
#![doc(include = "../README.md")]
use std::fs;
use std::io::{
Error,
Write,
};
use std::path::Path;
use clap::{
arg_enum,
values_t,
App,
Arg,
};
mod _utils;
use crate::_utils::pretty_curly_print;
use fe_compiler::errors::install_compiler_panic_hook;
use fe_compiler::... |
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
use crate::util::num_de::{self, DeferredValue};
use crate::otp::otp_img::OtpImg;
use crate::otp::vmem_serialize::*;
use anyhow::{anyhow, bail, Result};
use serde::Deser... |
//! Types representing various errors that can occur in a Rocket application.
use std::{io, fmt};
use std::sync::atomic::{Ordering, AtomicBool};
use yansi::Paint;
use figment::Profile;
use crate::router::Route;
/// An error that occurs during launch.
///
/// An `Error` is returned by [`launch()`](crate::Rocket::lau... |
use crate::script::{ScriptContext, ScriptEngine, ScriptResponse};
use crate::Result;
use async_trait::async_trait;
use rlua::{Context, Function, Lua, Result as LuaResult, Table};
use serde_json::Value;
use std::collections::HashMap;
use std::sync::{Arc, RwLock, RwLockReadGuard};
use crate::error::SimbaError;
#[deriv... |
use crate::pac::Interrupt;
/// Wrapper around interrupt types for the timers.
#[derive(Copy, Clone, Debug)]
// To make the type non-creatable but still accessable.
#[non_exhaustive]
pub struct InterruptTypes {
/// Break Interrupt
pub r#break: Interrupt,
/// Update Interrupt
pub update: Interrupt,
/... |
// This file is picked from project testa [https://github.com/TimeExceed/testa.git]
// Copyright (c) 2013, Taoda (<EMAIL>)
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// * Redistributions o... |
// Copyright (c) 2018-2020 MobileCoin Inc.
use crate::config::Config;
use build_info;
use common::logger::{log, o, Logger};
use handlebars::Handlebars;
use lazy_static::lazy_static;
use metrics::OpMetrics;
use prometheus::{self, Encoder};
use rouille::{router, Request, Response, Server};
use serde_json::json;
use std:... |
// Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors
// SPDX-License-Identifier: MIT
use std::convert::TryFrom;
use std::sync::Arc;
use rocksdb::{Cache, ColumnFamilyDescriptor, SliceTransform};
use crypto::hash::{BlockHash, HashType};
use tezos_messages::p2p::encoding::prelude::*;
use crate::data... |
//! kritik is both a library and a binary to "nicely" run programs in the command line. It was
//! inspired by `chronic`, which is included in the [moreutils](https://joeyh.name/code/moreutils/)
//! tools, and "runs a command quietly unless it fails".
//!
//! * As a binary, it can be used in scripts to run commands, on... |
//! I2S frame formats
mod data24frame32;
use crate::pac::spi1::i2scfgr::{CHLEN_A, DATLEN_A};
use crate::pac::spi1::RegisterBlock;
pub use self::data24frame32::Data24Frame32;
/// I2S communication frame format standards
#[derive(Debug, Clone)]
pub enum FrameFormat {
/// Philips I2S
PhilipsI2s,
/// Bits j... |
//! File System Filters
use std::io;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use bytes::{BufMut, BytesMut};
use futures::{future, Future};
use futures::future::Either;
use http;
use tokio::fs;
use tokio::io::AsyncRead;
use ::filter::{Filter, FilterClone, filter_fn, One, one};
use ::reject::{self, Rejecti... |
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
extern crate futures;
extern crate hyper;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate tokio_core;
extern crate tokio_uds;
extern crate fc_util;
#[macr... |
use crate::objects::*;
use crate::Error;
use crate::GtfsReader;
use std::path::Path;
/// Data structure that map the GTFS csv with little intelligence
///
/// This is used to analyze the GTFS and detect anomalies
/// To manipulate the transit data, maybe [crate::Gtfs] will be more convienient
#[derive(Debug)]
pub stru... |
use std::fmt;
use std::io;
use std::path::{Path, PathBuf};
use std::result;
use std::string;
use failure::{Backtrace, Context, Fail};
use image;
use notify;
use toml;
/// A type alias for handling errors throughout grimoire
pub type Result<T> = result::Result<T, Error>;
/// An error that can occur while running grim... |
#![recursion_limit="128"]
#[macro_use]
extern crate serde_derive;
mod markdown;
use yew::{html, Component, ComponentLink, Html, Renderable, ShouldRender};
use yew::format::Json;
use yew::services::{DialogService, StorageService};
use yew::services::storage::Area;
const KEY: &'static str = "yew.crm.database";
#[der... |
use super::{
error::{WriteDataError, WriteNpyError},
header::Header,
WritableElement,
};
use ndarray::{Dimension, IntoDimension};
use std::{
fs::File,
marker,
path::{Path, PathBuf},
};
/// This define a stream that allows progressively output a stream of array data
/// into a `.npy` file.
///
... |
//! Write some text for your users to read.
use crate::{
Element, Hasher, Layout, MouseCursor, Node, Point, Rectangle, Style, Widget,
};
use std::hash::Hash;
/// A fragment of text.
///
/// It implements [`Widget`] when the associated [`core::Renderer`] implements
/// the [`text::Renderer`] trait.
///
/// [`Widge... |
use parking_lot::RwLock;
use slotmap::SlotMap;
use std::collections::{HashMap, VecDeque};
use temporal_sdk_core_protos::coresdk::workflow_activation::{
remove_from_cache::EvictionReason, RemoveFromCache,
};
/// Tracks pending activations using an internal queue, while also allowing lookup and removal of
/// any pe... |
use crate::core::compiler::{CompileKind, RustcTargetData};
use crate::core::dependency::DepKind;
use crate::core::resolver::{HasDevUnits, Resolve, ResolveOpts};
use crate::core::{Dependency, InternedString, Package, PackageId, Workspace};
use crate::ops::{self, Packages};
use crate::util::CargoResult;
use cargo_platfor... |
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
crate::{builtin::capability::BuiltinCapability, capability::*},
anyhow::Error,
async_trait::async_trait,
cm_rust::{CapabilityNameOrPa... |
use crate::frontend::{Data, Enum, Property, Value};
use crate::model::Type;
use anyhow::Context;
use heck::CamelCase;
use proc_macro2::{Ident, Span, TokenStream};
use quote::quote;
use std::collections::BTreeSet;
use std::collections::HashMap;
use std::fs::File;
use std::io::Write;
use std::process::Command;
use syn::e... |
use std::collections::hash_set::HashSet;
use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::path::PathBuf;
use cargo_metadata::MetadataCommand;
// TODO(Sh3Rm4n - 2021-04-28):
// Remove when [feature="slice_group_by"] is stable.
// See with https://github.com/rust-lang/rust/issues/80552.
use slice_group... |
// This example demonstrates the use of the appsink element.
// It operates the following pipeline:
// {audiotestsrc} - {appsink}
// The application specifies what format it wants to handle. This format
// is applied by calling set_caps on the appsink. Now it's the audiotestsrc's
// task to provide this data format. ... |
use crate::Space;
use crate::primitives::*;
/// The data structure that represents a read-only view of a subspace
/// of some parent space
#[derive(Debug, Clone)]
pub struct SubSpace<'a, T> {
/// The space that this SubSpace is from
parent: &'a Space<T>,
/// The X position that this SubSpace starts at
... |
use std::convert::TryFrom;
use proc_macro2::{Ident, TokenStream};
use quote::{quote, ToTokens};
use syn::parse::{Parse, ParseStream};
use syn::spanned::Spanned;
use syn::{Attribute, Error, FnArg, GenericArgument, Lit, LitStr, Meta};
use syn::{NestedMeta, Pat, PatType, Path, PathArguments, Result, Signature, Token, Typ... |
//! This module defines FRP Graphviz bindings. It allows visualizing the FRP network as Graphviz
//! diagram.
//! WARNING
//! THIS MODULE IS IN A VERY WORK-IN-PROGRESS STATE. IT WILL BE CHANGED SOON.
// === Non-Standard Linter Configuration ===
#![allow(missing_docs)]
#![allow(dead_code)]
use crate::prelude::*;
//... |
use crate::io::{DataRequest, LoaderIO, MetadataRequest, ResolveRequest};
use crate::loader::LoaderState;
use atelier_core::{utils::make_array, ArtifactMetadata, AssetMetadata, AssetRef, AssetUuid};
use atelier_schema::pack::pack_file;
use capnp::serialize::SliceSegments;
use memmap::{Mmap, MmapOptions};
use std::{
... |
use std::fmt;
use anyhow::anyhow;
#[derive(Debug, Clone, PartialEq, Eq)]
struct Status {
staged: u32,
conflicts: u32,
changed: u32,
untracked: u32,
}
impl Status {
fn from_repo(repo: &git2::Repository) -> anyhow::Result<Self> {
let wt_changed_status = {
use git2::Status;
... |
//! Nvidia Tegra210 CPU cluster driver.
use mirage_mmio::{Mmio, VolatileStorage};
use crate::{
clock::{Car, Clock},
i2c::{Error, I2c, Device},
pmc::Pmc,
sysreg::{SbRegisters, EXCEPTION_VECTOR_BASE},
timer::usleep,
};
/// Base address for Flow Control registers.
pub(crate) const FLOW_CTLR_BASE: u3... |
// Unless explicitly stated otherwise all files in this repository are licensed under the
// MIT/Apache-2.0 License, at your convenience
//
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020 Datadog, Inc.
//
//! An executor for running async tasks.
#![forbid(unsafe_code... |
use crate::fs::ioctl::*;
use crate::process::{process_group, Pgid};
use crate::signal::{send_signal, Signal};
use crate::signal::{Siginfo, SI_KERNEL};
use crate::{sync::Event, sync::EventBus, syscall::SysError};
use alloc::boxed::Box;
use alloc::collections::VecDeque;
use alloc::sync::Arc;
use core::any::Any;
use core:... |
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
use once_cell::sync::Lazy;
use rand::{rngs::ThreadRng, Rng, RngCore};
use std::fmt::Debug;
use std::sync::{Arc, Mutex};
use std::thread;
use std::time::Duration;
#[derive(Debug, Clone)]
enum Action {
AddProgressBar(usize),
IncProgressBar(usize),
}
#[... |
extern crate getopts;
use anyhow::anyhow;
use n2::load;
use n2::progress::ConsoleProgress;
use n2::trace;
use n2::work;
use std::path::Path;
// The result of starting a build.
enum BuildResult {
/// A build task failed.
Failed,
/// Renerated build.ninja rather than the requested build. The caller must
... |
use std::{
fs,
io,
io::Write,
panic,
process::{Command, Stdio},
thread,
time::Duration,
};
use nix::{
sys::wait::{waitpid, WaitPidFlag},
unistd::{gettid, Pid},
};
use mayastor::core::Mthread;
// there is a CARGO_EXEC_$BIN variable in recent Rust which does
// not seem to work yet ... |
use rand::{distributions::Alphanumeric, prelude::*};
use std::sync::Arc;
use tbot::{
contexts::fields,
markup::{italic, markdown_v2},
prelude::*,
state::{
messages::{MessageId, Messages},
Chats,
},
types::{chat, parameters::Text},
util::entities,
Bot,
};
use tokio::sync::... |
use super::*;
/// * MSDN: [RAWINPUT](https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-rawinput)
#[derive(Clone, Copy)]
#[repr(C)]
pub struct RawInput {
pub header: RawInputHeader,
pub data: RawInputData,
}
#[derive(Clone, Copy)]
#[repr(C)]
pub union RawInputData {
pub mouse: RawMouse,
pub... |
use std::{
sync::{atomic::AtomicUsize, Arc},
thread,
time::{Duration, Instant},
};
use crossbeam_channel::Sender;
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use crate::{
physics::{ray::Ray, shapes::bvh_node::BVHNode, colliders::ray_collider::RayCollider},
scene::scene::Scene, rende... |
// This file contains generated code. Do not edit directly.
// To regenerate this, run 'make'.
//! Bindings to the `GenericEvent` X11 extension.
#![allow(clippy::too_many_arguments)]
#[allow(unused_imports)]
use std::borrow::Cow;
use std::convert::TryFrom;
#[allow(unused_imports)]
use std::convert::TryInto;
use std:... |
use crate::model::{Entry, Feed, FeedType, Image, Link, Person, Text};
use crate::parser;
use crate::util::test;
// Example from the web
#[test]
fn test_example_1() {
// Parse the feed
let test_data = test::fixture_as_string("rss_1.0_example_1.xml");
let actual = parser::parse(test_data.as_bytes()).unwrap()... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
_reserved0: [u8; 8usize],
#[doc = "0x08 - Crossbar Switch (AXBS) Slave Configuration"]
pub plasc: PLASC,
#[doc = "0x0a - Crossbar Switch (AXBS) Master Configuration"]
pub plamc: PLAMC,
#[doc = "0x0c - Control Register"]
pub cr:... |
use rendy::{
command::{
CommandBuffer, CommandPool, ExecutableState, Families, Family, FamilyId, Fence, MultiShot,
PendingState, Queue, SimultaneousUse, Submission, Submit, Supports, Transfer,
},
factory::{Factory, ImageState},
frame::Frames,
graph::{
gfx_acquire_barriers, gf... |
use std::pin::Pin;
use std::time::{Duration, Instant};
use crate::words::WORDS;
use async_std::stream::interval;
use futures::{stream::select, StreamExt};
use futures::executor::block_on;
use futures::stream::Stream;
use rand::prelude::ThreadRng;
use rand::Rng;
pub const DEFAULT_SPEED: f64 = 0.0001;
/// Events the ... |
use std::fs::{create_dir_all, File};
use std::io::Write;
use std::path::PathBuf;
use roselib::files::{STB, ZSC};
use roselib::files::zsc::SceneMaterial;
use roselib::io::RoseFile;
fn bail(msg: &str) -> Result<(), ::std::io::Error> {
println!("{}", msg);
::std::process::exit(1);
}
fn main() -> Result<(), ::st... |
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
// This file is part of Parity Bridges Common.
// Parity Bridges Common 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, ... |
//
// Copyright (c) Dell Inc., or its subsidiaries. All Rights Reserved.
//
// 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
//
use crate::pr... |
use std::io::{Cursor, Read, Seek, SeekFrom};
use std::sync::Arc;
use byteorder::{LittleEndian, ReadBytesExt};
use asset;
use buffer::{Buffer, BufferView};
use model;
use mesh::Mesh;
use index;
use vertex;
mod mesh;
mod blend_shape;
mod bone_bindings;
mod skeleton;
mod mesh_bindings;
mod animation;
#[cfg(target_e... |
//! # quickcdc
//! `quickcdc` is a fast content defined chunker.
//! * For some background information, see [AE: An Asymmetric Extremum Content Defined Chunking Algorithm](https://ieeexplore.ieee.org/document/7218510) by <NAME>.
//! * Modification(s):
//! * User may provide salt, introducing entropy / cutpoint variat... |
use crate::{util, Ctx, Krate, Source};
use anyhow::{bail, Context, Error};
use bytes::{BufMut, Bytes, BytesMut};
use log::debug;
use reqwest::Client;
use std::process::Command;
pub fn from_crates_io(client: &Client, krate: &Krate) -> Result<Bytes, Error> {
match &krate.source {
Source::CratesIo(chksum) => ... |
use crate::*;
pub fn templates(mut data: PresentDataWrapper) -> RetFut<()> {
box_fut!({
let data = unsafe { data.get_inner() };
let bytes = Bytes::copy_from_slice(
&handle_template(data.args(), data.response().body(), data.host()).await,
);
*data.response_mut().body_mut(... |
use std::os::raw::c_int;
mod inet4;
mod inet6;
mod unix;
pub use inet4::*;
pub use inet6::*;
pub use unix::*;
// TODO: implement Debug in a nice manner for the types.
/// A socket address that supports multiple address families at runtime.
pub trait GenericSocketAddress: AsSocketAddress {}
/// A socket address tha... |
use std::{
borrow::Cow,
collections::{BTreeMap, HashMap},
convert::TryFrom,
rc::Rc,
};
/// A de-duplicated set of type definitions.
///
/// We insert new entries via hash consing, to de-duplicate entries.
///
/// This is shared across all modules in a module linking bundle.
///
/// We assign and track ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.