text stringlengths 3.09k 13.9k |
|---|
use std::{
error::Error,
path::{Path, PathBuf},
process,
time::Instant,
};
use clap::{App, AppSettings, Arg, SubCommand};
use command::Command;
use envious_tui::run_tui;
use envyc::{
compile,
environment::Environment,
error::reporter::{ErrorReporter, Reporter},
filter_tokens,
functi... |
use chrono::NaiveDate;
use super::field::Field;
use super::event::Event;
/// `EventTrunc`
/// contains certain fields from a row
#[derive(Debug, Clone, RustcEncodable)]
pub struct EventTrunc {
pub event_date: NaiveDate,
pub year: i32,
pub event_type: String,
pub actor_1: String,
pub ally_actor_1:... |
use super::{apply_tags, remove_quotes, Capture, Compiler};
use crate::{
graphs::{relations, resources, Relation, Resource},
utils::path::merge,
};
use once_cell::sync::Lazy;
use std::path::Path;
/// Query patterns for JavaScript (and reused for TypeScript)
pub const PATTERNS: &str = r#"
(program (comment) @com... |
//! Advent of Code 2020 Day 07
//! https://adventofcode.com/2020/day/7
//!
//! Challenge part 1
//!
//! Determine the number of different bag colors that can contain the bag color posed in the
//! challenge.
use std::collections::HashSet;
use std::fs;
const INPUT_FILENAME: &str = "2020_day07_input.txt";
const CHALLEN... |
//! File handle for process
#![allow(dead_code)]
use crate::fs::FileLikeType;
use alloc::{boxed::Box, string::String, sync::Arc};
use super::FileLike;
use crate::error::{LxError, LxResult};
use async_trait::async_trait;
use rcore_fs::vfs::{FsError, INode, Metadata, PollStatus};
use spin::Mutex;
use zircon_object::ob... |
use alloc::{
collections::{btree_map::Iter, BTreeMap},
vec::Vec,
};
use types::{
account::PublicKey,
system_contract_errors::pos::{Error, Result},
U512,
};
use crate::{constants::sys_params, store};
pub struct Delegations {
table: BTreeMap<DelegationKey, U512>,
total_amount: U512,
}
#[de... |
#![recursion_limit = "1024"]
extern crate rustup_dist;
#[macro_use]
extern crate rustup_utils;
#[macro_use]
extern crate error_chain;
#[macro_use]
extern crate clap;
extern crate regex;
#[macro_use]
extern crate rustup;
extern crate term;
extern crate itertools;
extern crate time;
extern crate rand;
extern crate scop... |
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use anyhow::{ensure, format_err, Error, Result};
use serde::{de::Visitor, export::fmt::Debug, Deserialize, Deserializer, Serialize};
use std::{
convert::TryFrom,
fmt::{Display, Formatter},
str::FromStr,
};
/// A registry of ... |
// Rust Bitcoin Library
// Written by
// The Rust Bitcoin developers
//
// 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 software is distributed without
// any warranty.
//
// You should have ... |
use crate::{arg::value, output::Light as OutputLight, output::Scan as OutputScan, util};
use huelib::resource::{light, Modifier};
use huelib::Color;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
pub enum Arg {
/// Modifies the state and attributes of a light
Set(Set),
/// Prints the state and attri... |
use crate::completions::{Completer, CompletionOptions};
use nu_protocol::{
engine::{EngineState, StateWorkingSet},
levenshtein_distance, Span,
};
use reedline::Suggestion;
use std::path::{is_separator, Path};
use std::sync::Arc;
const SEP: char = std::path::MAIN_SEPARATOR;
#[derive(Clone)]
pub struct FileComp... |
use super::Decoder;
use crate::flowgger::config::Config;
use crate::flowgger::record::{Record, SDValue, StructuredData, SEVERITY_MAX};
use crate::flowgger::utils;
use serde_json::de;
use serde_json::error::Error::Syntax;
use serde_json::error::ErrorCode;
use serde_json::value::Value;
#[derive(Clone)]
pub struct GelfDe... |
mod generated;
mod types;
pub use types::{Key, KeyPrefix, Value};
use crate::extensions::{rce_validator::generated::xudt_rce::SmtUpdate, Extension};
use crate::types::DeployedScriptConfig;
use anyhow::Result;
use ckb_indexer::store::{Batch, IteratorDirection, Store};
use ckb_types::core::{BlockNumber, BlockView};
us... |
// Copyright 2020 The Exonum Team
//
// 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... |
//! # Introduction
//!
//! Thespian implements a basic actor system in async Rust inspired
//! heavily by Erlang Processes and Supervisors.
//!
//! Instead of providing a direct messaging interface to the `Actor`,
//! methods defined by the package user on `impl Actor<State, Reply>`
//! are used as the external API for... |
// The build for pcre2-sys currently does roughly the following:
//
// 1. Use the PCRE2 system library as reported by pkg-config if it exists
// and only if we don't explicitly want a static build.
// 2. Otherwise, statically build PCRE2 by hand.
//
// For step 1, we permit opting out of using the system libr... |
// Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors
// SPDX-License-Identifier: MIT
use std::env;
use tezedge_recorder::tables::node_log;
pub async fn get_log(params: &str) -> Result<Vec<node_log::ItemWithId>, serde_json::error::Error> {
let debugger = env::var("DEBUGGER_URL")
.unwrap(... |
use crate::prelude::*;
use lightning_core::util::DropGuard;
use rand::distributions::Alphanumeric;
use rand::prelude::*;
use std::fs::{self, OpenOptions};
use std::io::{self, Read, Write};
use std::path::PathBuf;
use std::slice;
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::Arc;
use threadpool::ThreadPoo... |
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// at http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This... |
use std::collections::HashMap;
pub type Atom = (String, usize);
pub type Molecule = Vec<Atom>;
#[derive(Debug)]
pub enum ParseError {
InvalidAtomName,
UnsupportedToken,
MismatchedBrackets,
}
enum Element {
Atom(String),
Count(usize),
OpenBracket,
CloseBracket,
}
enum Count {
Atom(usi... |
use std::{ffi::CStr, os::raw::c_char};
use leaf::{Config, RuntimeOption, StartOptions};
/// No error.
pub const ERR_OK: i32 = 0;
/// Config path error.
pub const ERR_CONFIG_PATH: i32 = 1;
/// Config parsing error.
pub const ERR_CONFIG: i32 = 2;
/// IO error.
pub const ERR_IO: i32 = 3;
/// Config file watcher error.
p... |
#![allow(non_camel_case_types, non_snake_case)]
pub mod constants;
use self::constants::*;
use ncurses::{box_, getmouse, keyname, setlocale, LcCategory, COLORS, COLOR_PAIRS};
use ncurses::ll::{chtype, ungetch, wattroff, wattron, wattrset, MEVENT, NCURSES_ATTR_T, WINDOW};
use ncurses::ll::{resize_term, wgetch};
use li... |
/*!
Provides the functions, and format types, to serialize a [`Document`](../model/document/struct.Document.html)
in supported markup formats.
The enum [`OutputFormat`](enum.OutputFormat.html) provides a set of implemented formatters that may
then be used in [`write_document`](fn.write_document.html) and
[`write_docum... |
//! Update agent.
mod actor;
use crate::cincinnati::Cincinnati;
use crate::config::Settings;
use crate::identity::Identity;
use crate::rpm_ostree::{Release, RpmOstreeClient};
use crate::strategy::UpdateStrategy;
use actix::Addr;
use chrono::prelude::*;
use prometheus::IntGauge;
use std::time::Duration;
/// Default t... |
/*
* Copyright 2020 Nuclei Studio OÜ
*
* 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 agree... |
use async_trait::async_trait;
use dataloader::cached::Loader;
use dataloader::BatchFn;
use futures::executor::block_on;
use std::collections::{HashMap, HashSet};
use std::sync::{Arc, Mutex};
use std::thread;
struct MyLoadFn;
#[async_trait]
impl BatchFn<usize, usize> for MyLoadFn {
async fn load(&self, keys: &[usi... |
use crate::error::NettuError;
use crate::shared::{
auth::protect_account_route,
usecase::{execute, UseCase},
};
use actix_web::{web, HttpRequest, HttpResponse};
use nettu_scheduler_api_structs::add_user_to_service::*;
use nettu_scheduler_domain::{Account, Service, ServiceResource, TimePlan, ID};
use nettu_sched... |
use crate::node::NodeQueryParam;
use crate::root::Root;
use futures::future;
use hyper::service::Service;
use hyper::{header, Body, Method, Request, Response, Server};
use serde::{ser::SerializeMap, Deserialize, Serialize, Serializer};
use std::net::SocketAddr;
use std::sync::Arc;
use std::task::{Context, Poll};
/// ... |
// Copyright (c) 2018-2020 <NAME> <<EMAIL>>
// Distributed under the MIT License
// (See acoompanying LICENSE file or a copy at http://opensource.org/licenses/MIT)
//! Parser del Building Description Language (BDL) de DOE
//!
//! Puentes térmicos (THERMAL-BRIDGE)
use std::convert::TryFrom;
use anyhow::{bail, Error};... |
extern crate image;
use std::path::Path;
use std::error::Error;
use std::fs::File;
use std::io::BufWriter;
use std::io::Write;
pub struct ColorBufferRGB {
width: usize,
height: usize,
pixels: Vec<u8>,
}
impl ColorBufferRGB {
pub fn new(width: usize, height: usize) -> ColorBufferRGB {
ColorBuf... |
//
// Copyright 2018-2019 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... |
use std::path::Path;
use crate::channel::*;
use crate::threadpool::*;
use crossbeam_channel::*;
pub enum FileManagerRequests {
ReadAll {
file: String,
sender: Sender<Message>,
},
}
pub struct ReadAllResult {}
pub enum FileManagerRequestsResponses {
Ok,
ReadAllResult(ReadAllResult),
}... |
//! A pool which manages allocation of unique indices. Acts like a
//! psuedo-memory allocator.
//!
//! ```
//! extern crate index_pool;
//! use index_pool::IndexPool;
//!
//! fn main() {
//! let mut pool = IndexPool::new();
//!
//! let a = pool.new_id();
//! let b = pool.new_id();
//! let c = pool.new_... |
use crate::tail_blocks;
use crate::tui;
use ansi_term::Style as AnsiStyle;
use clap::{App, Arg, SubCommand};
use ethers_core::abi::AbiParser;
use ethers_core::abi::FunctionExt;
use ethers_core::types::Bytes;
use ethers_core::types::NameOrAddress;
use ethers_core::types::TransactionRequest;
use ethers_core::types::H160... |
use crate::{LEVEL, TilePos, camera::Camera, cf32, sprites::{CRATE, INFOBOX1, INFOBOX2, STAR1, STAR2}, utils::{UfmtBuf, draw_colours}, wasm4::{SCREEN_SIZE, blit, rect, text}, world::World};
use enum_iterator::IntoEnumIterator;
#[derive(variant_count::VariantCount, PartialEq, Eq, Copy, Clone, enum_iterator::IntoEnumIte... |
mod input;
mod render;
mod sound;
mod state;
mod system;
mod util;
use input::Input;
use system::System;
use winit::event::*;
use winit::event_loop::{ControlFlow, EventLoop};
use winit::window::{Fullscreen, WindowBuilder};
fn main() {
let event_loop = EventLoop::new();
let monitor = event_loop.primary_monito... |
//! PKCS#8 private key document.
use crate::{DecodePrivateKey, EncodePrivateKey, Error, PrivateKeyInfo, Result};
use alloc::vec::Vec;
use core::fmt;
use der::{Decodable, Document};
use zeroize::{Zeroize, Zeroizing};
#[cfg(feature = "encryption")]
use {
crate::{EncryptedPrivateKeyDocument, EncryptedPrivateKeyInfo}... |
use crate::cmd_lib;
use crate::mlua;
use crate::errors;
use super::kernel;
use std::fs;
use std::env;
use std::path::{ Path };
use std::process::{ Command, Stdio };
use mlua::prelude::*;
use cmd_lib::{ run_fun };
use crate::{ Inject };
use kernel::{ Kernel };
#[derive(Clone, Debug)]
pub(crate) struct Distro {
pub... |
use std::sync::atomic::{AtomicUsize, Ordering};
use basedrop::{Shared, SharedCell};
use num_derive::{FromPrimitive, ToPrimitive};
use audio_garbage_collector::{make_shared, make_shared_cell};
use audio_processor_traits::audio_buffer::OwnedAudioBuffer;
use audio_processor_traits::{AtomicF32, AudioBuffer, VecAudioBuffe... |
#![no_std]
#![no_main]
use embedded_graphics as eg;
use panic_halt as _;
use wio_terminal as wio;
use cortex_m::peripheral::NVIC;
use wio::hal::adc::{FreeRunning, InterruptAdc, SingleConversion};
use wio::hal::clock::GenericClockController;
use wio::hal::delay::Delay;
use wio::pac::{adc0::refctrl::REFSEL_A, gclk::pch... |
use std::cell::RefCell;
use std::path::{Path, PathBuf};
use std::str;
use crate::*;
use anyhow::*;
use std::borrow::Cow;
use ewgpu_macros::DerefMut;
///
/// Wraper for wgpu::ShaderModule using shaderc to load shader modules.
///
/// TODO: Automatic reload if files update.
/// Inspiration from Wumpf's [blub](https://gi... |
// Copyright 2020 Netwarps Ltd.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, dis... |
use std::cmp::{max};
use readers::path_expr::{RangeExpr};
use readers::prelude::{Index, IndexIterator, RAReader, Value, UnknownRangeRefIter, KnownRangeRefIter};
use crate::alignments::MAlignmentFunc;
use super::sgl_range_align::{AlignedRangeStep, create_aligned_range_step_index, update_range_step};
use crate::lang::... |
#![allow(unused_imports)]
#![allow(dead_code)]
use super::super::beach_line as VB;
use super::super::geometry::Point;
use super::super::predicate as VP;
use super::super::site_event as VSE;
use super::super::InputType;
use super::super::OutputType;
use lazy_static::lazy_static;
use regex::Regex;
use std::fs::File;
use ... |
// -*- mode:rust; coding:utf-8-unix; -*-
//! main.rs
// Copyright 2016 hanepjiv
// @author hanepjiv <<EMAIL>>
// @copyright The MIT License (MIT) / Apache License Version 2.0
// @since 2016/10/12
// @date 2020/04/12
// ////////////////////////////////////////////////////////////////////////////
// attribute ==... |
pub mod note;
pub mod octave;
pub mod repeat;
pub mod tempo;
pub mod tone;
pub mod volume;
use crate::tokenize::{Token, TokenKind};
use std::fmt;
use tone::Effect;
#[macro_export]
macro_rules! try_or_ok_none {
($option:expr) => {
if let Ok(ok) = $option {
ok
} else {
return... |
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
use std::any::Any;
use std::borrow::Cow;
use std::fmt::Display;
use std::sync::mpsc::channel;
use std::sync::Arc;
use std::thread;
use crossbeam::channel::{Receiver, Sender};
use tuikit::prelude::{Event as TermEvent, *};
pub use crate::ansi::AnsiS... |
use std::time::{Duration, Instant};
use thiserror::Error;
use vst::plugin::Plugin;
use audio_processor_traits::{AudioProcessorSettings, InterleavedAudioBuffer};
use crate::audio_io::cpal_vst_buffer_handler::CpalVstBufferHandler;
use crate::audio_io::AudioHostPluginLoadError;
use crate::processors::audio_file_process... |
// euler - A collection of ProjectEuler libraries, tools, and solutions.
// Copyright (C) 2013 <NAME>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
//... |
//!
//! # 基本类型定义
//!
use myutil::{err::*, *};
use serde::{Deserialize, Serialize};
use std::fmt;
pub use ttcore_def::*;
/// ops_id 的字符长度, eg: "1234"
pub const OPS_ID_LEN: usize = 4;
/// 无法获取 uuid 时使用此默认 id
pub const DEFAULT_REQ_ID: u64 = std::u64::MAX;
/// uuid of req/resp
pub type UUID = u64;
/// - format: "<IP>:... |
// Copyright (c) Microsoft. All rights reserved.
//! Sample CLI app showing how one can use this crate to access the IoT Hub
//! service API. You can run the commands supported by this CLI like so:
//!
//! ```ignore
//! $ sas_token=`iothub-explorer sas-token ed<PASSWORD> | grep SharedAccessSignature | cut -d ' ' -f 2`... |
mod cli;
mod config;
mod output;
mod parse;
use cli::Options;
use config::{Language, CONFIG};
use crossbeam_deque::{Stealer, Worker};
use output::Output;
use parse::{parser, Data, Value};
use std::path::PathBuf;
use walkdir::WalkDir;
#[macro_export]
macro_rules! exit {
($($arg:tt)*) => {
{
use ... |
#[cfg(test)]
use std::net::{Ipv4Addr, SocketAddr};
use std::str::FromStr;
use datasize::DataSize;
use libp2p::request_response::RequestResponseConfig;
use serde::{Deserialize, Serialize};
use crate::{components::small_network, types::TimeDiff};
// TODO - remove these defaults once small_network's config has been rep... |
use std::cmp::Ordering::Equal;
use std::collections::HashMap;
use anyhow::{Context, Result};
use serde::{Deserialize, Serialize};
use crate::counts::{ExpectedMutationCounts, ObservedMutationCounts};
use crate::io::get_writer;
use crate::observed::Mutation;
use crate::sample::SampledMutations;
use crate::{Float, Mutat... |
use std::collections::HashSet;
use proc_macro2::Span;
use rtic_syntax::{
analyze::Analysis,
ast::{App, CustomArg},
};
use syn::{parse, Path};
pub struct Extra<'a> {
pub device: &'a Path,
pub monotonic: Option<&'a Path>,
pub peripherals: Option<u8>,
}
impl<'a> Extra<'a> {
pub fn monotonic(&sel... |
use std::{pin::Pin, task::Poll};
use backoff::backoff::Backoff;
use futures::{Future, Stream, TryStream};
use pin_project::pin_project;
use tokio::time::{sleep, Instant, Sleep};
/// Applies a [`Backoff`] policy to a [`Stream`]
///
/// After any [`Err`] is emitted, the stream is paused for [`Backoff::next_backoff`]. T... |
use alloc::vec::Vec;
use core::cmp::Ordering;
use utils::{impl_md_flow_minimal, Hash};
use crate::{
consts::{
{f1, f2, f3, f4, f5}, {H160, K160_LEFT, K160_RIGHT, R_LEFT, R_RIGHT, S_LEFT, S_RIGHT},
},
{round_left_160_minimal, round_right_160_minimal},
};
pub struct Ripemd160 {
status: [u32; 5]... |
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(unused_variables)]
use heap;
use heap::layout::*;
use heap::immix::ImmixMutatorLocal;
use heap::immix::ImmixSpace;
use heap::freelist;
use heap::freelist::FreeListSpace;
use std::mem::size_of as size_of;
extern crate... |
use super::{Attachment, Iml};
use libflate::deflate::{Decoder, Encoder};
use std::io::Read;
use universal_wallet::{
contents::{public_key_info::KeyType, Content},
unlocked::UnlockedWallet,
};
impl Iml {
pub fn new(wallet: &mut UnlockedWallet) -> Self {
let current_sk_raw = wallet
.new_k... |
use super::ffs;
use bevy::math::prelude::*;
use packed_simd::{f32x16, f32x4, f32x8};
pub struct ExtentsSimd {
pub single: Vec<(u32, f32)>,
vec4_ff: Vec<f32x4>,
vec8_ff: Vec<f32x8>,
vec16_ff: Vec<f32x16>,
pub vec4: Vec<u32>,
pub vec8: Vec<u32>,
pub vec16: Vec<u32>,
}
// use rayo... |
use std::fmt;
use std::str::FromStr;
use super::lang_mapping;
use crate::error::ParseError;
use crate::Lang;
#[cfg(feature = "enum-map")]
use enum_map::Enum;
/// Represents a writing system (Latin, Cyrillic, Arabic, etc).
#[cfg_attr(feature = "enum-map", derive(Enum))]
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
pu... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use libra_metrics::{
register_histogram, register_histogram_vec, register_int_counter, register_int_counter_vec,
register_int_gauge, register_int_gauge_vec, DurationHistogram, Histogram, HistogramVec,
IntCounter, IntCounter... |
#![warn(clippy::all, clippy::pedantic, clippy::nursery)]
extern crate ammonia;
extern crate csv;
extern crate regex;
extern crate reqwest;
use ammonia::Builder;
use csv::Reader;
use csv::ReaderBuilder;
use regex::Regex;
use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::io::prelude::*;
use std::ite... |
use candid::{CandidType, Nat, Principal};
use serde::{Deserialize, Serialize};
use crate::{
constants::{
BLOCK_ARCHIVE_SIZE, BLOCK_ARCHIVE_TRIGGER_THRESHOLD, CYCLES_PER_AUTO_SCALING,
MAX_CANISTER_STORAGE_BYTES,
},
BlockHeight,
};
#[derive(Serialize, Deserialize, CandidType, Clone, Debug, P... |
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
//! Table elements within a wasm module.
use crate::emit::{Emit, EmitContext, Section};
use crate::parse::IndicesToIds;
use crate::tombstone_arena::{Id, Tombstone, TombstoneArena};
use crate::{ir::Value, FunctionId, InitExpr, Module, Result, TableId, ValType};
use anyhow::{bail, Context};
/// A passive element segmen... |
//! Apis relate to [crate::sys::zend_ini_entry_def].
use crate::sys::{
phper_zend_ini_mh, zend_ini_entry_def, OnUpdateBool, OnUpdateLong, OnUpdateReal,
OnUpdateString, PHP_INI_ALL, PHP_INI_PERDIR, PHP_INI_SYSTEM, PHP_INI_USER,
};
use dashmap::DashMap;
use std::{
any::TypeId,
ffi::CStr,
mem::{size_o... |
use crate::gg::games::Game;
use crate::gg::games::GameInput;
use crate::gg::games::view_details::{ViewDetails2D, ViewDetails};
use crate::gg::input::keyboard::KeyboardInput;
use crate::gg::rendering::*;
use crate::gg::geometry::*;
#[allow(dead_code)]
#[derive(Default, Clone)]
pub struct RenderableTestGame {
view_d... |
use itertools::Itertools;
use serde::de::{self, Deserialize};
use std::fmt;
use std::io::Read;
use std::result;
use std::{collections, fs, path};
//use walkdir::WalkDir;
use crate::errors::*;
#[derive(Clone, Debug)]
pub struct TestData {
pub id: String,
pub base: path::PathBuf,
pub source: String,
pub... |
#![feature(vec_remove_item)]
#[cfg(test)]
#[macro_use]
extern crate lazy_static;
use std::collections::HashMap;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::iter::IntoIterator;
const INPUT_FILE: &'static str = "./input/input_07.txt";
const ALPHABET: &'static str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typ... |
extern crate utilities;
use regex::Regex;
use std::cmp::max;
use std::path::PathBuf;
use structopt::StructOpt;
#[derive(StructOpt, Debug)]
#[structopt(name = "day3", version = "1.0.0")]
struct Args {
// The number of occurrences of the `v/verbose` flag
/// Verbose mode (-v, -vv, -vvv, etc.)
///#[structopt(... |
//! Type information structs for API discovery
use crate::{gvk::GroupVersionKind, resource::Resource};
/// Information about a Kubernetes API resource
///
/// Enough information to use it like a `Resource` by passing it to the dynamic `Api`
/// constructors like `Api::all_with` and `Api::namespaced_with`.
#[derive(Deb... |
use core::alloc::Layout;
use core::fmt;
use core::mem;
use core::ptr::NonNull;
use liblumen_core::alloc::utils::{align_up_to, is_aligned, is_aligned_at};
use liblumen_core::sys::alloc as sys_alloc;
use liblumen_core::sys::sysconf::MIN_ALIGN;
use liblumen_core::util::pointer::distance_absolute;
use crate::erts::except... |
// test: cargo test test_gethelloworldwebservice
// test: cargo test test_posthelloworldwebservice
// test: cargo test test_statusnotfoundwebservice
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Request, Response, Server, Method, StatusCode};
use std::net::SocketAddr;
use super::helloworld;
/... |
use std::{
collections::{BTreeSet, VecDeque},
convert::{From, TryFrom},
hash::Hash,
marker::PhantomData,
mem,
};
use derive_more::{Deref, DerefMut};
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use super::super::{
consensus_protocol::{
ConsensusContext, ConsensusProtocol,... |
use std::{
borrow::Cow,
collections::HashMap,
path::{Path, PathBuf},
sync::{
atomic::{AtomicU64, Ordering},
Arc,
},
};
use lru::LruCache;
use parking_lot::{Mutex, MutexGuard};
use super::{LogEntry, TransactionHandle, TreeLock, TreeLocks};
use crate::transaction::TransactionId;
con... |
use anyhow::Result;
use clap::{App, Arg};
use reqwest::Method;
use std::env;
use std::ffi::OsString;
pub struct Args {
pub input: String,
pub method: Method,
pub url: String,
pub concurrent: usize,
pub timeout_seconds: u64,
pub insecure: bool,
}
impl Args {
pub fn parse() -> Result<Self> {... |
use std::collections::HashMap;
use std::env;
use std::process;
use std::fs;
use crate::Part::{First, Second};
enum Part {
First(String),
Second(String),
}
fn parse_input(lines: Vec<&str>) -> Vec<(Vec<&str>, Vec<&str>)> {
let mut data = Vec::new();
for line in lines {
let line_split: Vec<&str... |
use anchor_lang::prelude::*;
use anchor_lang::{AccountDeserialize, AnchorDeserialize};
use anchor_spl::token::{self, TokenAccount, Transfer};
#[program]
mod auction {
use super::*;
pub fn create_auction(ctx: Context<CreateAuction>, start_price: u64) -> Result<()> {
// init auction
let auction ... |
//! Tokens
pub(crate) mod arc;
pub(crate) mod assignment;
pub(crate) mod block;
pub(crate) mod call;
pub(crate) mod comment;
pub(crate) mod coord;
pub(crate) mod gcode;
pub(crate) mod mcode;
pub(crate) mod othercode;
pub(crate) mod polar;
pub(crate) mod return_stmt;
use self::arc::{center_format_arc, radius_format_ar... |
use crate::commands::Command;
use cereus_core::{
COMMAND_PREFIX,
types::{Component, Context, Command as TCommand}
};
fn make_command_string(commands: Vec<TCommand>) -> Option<String> {
if commands.len() == 0 {
return None
}
return Some(commands.iter().fold("".to_string(),
|a, b|... |
#![allow(non_snake_case)]
#![cfg_attr(debug_assertions, allow(dead_code, unused_imports))]
extern crate raylib;
use raylib::consts::KeyboardKey;
use raylib::consts::KeyboardKey::*;
use raylib::consts::MouseButton::*;
// use raylib::consts::GestureType::*;
use raylib::prelude::*;
use structopt::StructOpt;
mod options;... |
#![allow(dead_code)]
use std::{fmt::Display, ptr::NonNull};
use crate::*;
impl<T: Debug> Display for RangesTree<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "RangesTree (size: {:?}) ", self.size)?;
self.tree.show(f, " ", true)
}
}
fn show_tab(f: &mut st... |
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed unde... |
use super::client;
use super::client::collections::CollectionsResult;
use cache::Cache;
use config::{Config, OutputFormat, Verbosity};
use utils::console::*;
use utils::output;
use clap::{App, Arg, ArgMatches, SubCommand};
use indicatif::{ProgressBar, ProgressStyle};
use mime::Mime;
use mime_guess::guess_mime_type_op... |
use crate::{Point,Value,Location,write_cache::WriteCache};
use failure::{Error};
use random_access_storage::RandomAccess;
use std::collections::HashSet;
use std::rc::Rc;
use std::cell::RefCell;
use desert::{FromBytes,ToBytes,CountBytes};
pub struct StagingIterator<'b,P,V> where P: Point, V: Value {
inserts: Rc<RefCe... |
// Copyright 2017 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 byteorder::{ByteOrder, LittleEndian};
use sys;
use sys::{device_get_protocol, usb_device_descriptor_t, usb_protocol_t, usb_request_type_t, USB_DIR_IN, ... |
#[macro_use]
extern crate neon;
extern crate neon_serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_bytes;
extern crate serde_json;
use std::sync::mpsc::{self, TryRecvError};
use std::sync::{Arc, Mutex};
use std::thread;
use std::time::Duration;
use neon::context::{Context, FunctionContext, TaskConte... |
/* Copyright © 2020-2021 <NAME> <<EMAIL>>
By using this software, you agree to the LICENSE TERMS
outlined in the file titled LICENSE.md contained in the
top-level directory of this project. If you don't agree
to the LICENSE TERMS, you aren't allowed to use this
software.
*/
/*! A basic usage example for the library... |
use cursive::event::Event;
use cursive::theme::{BaseColor, Color, Effect, Style};
use cursive::traits::{Nameable, Scrollable};
use cursive::utils::markup::StyledString;
use cursive::utils::span::SpannedString;
use cursive::views::{Dialog, TextView};
use cursive::Cursive;
use cursive::XY;
use std::collections::HashMap;
... |
use crate::error::WebmentionError;
use nom::{
branch::alt,
bytes::complete::is_not,
character::complete::char,
combinator::map_res,
multi::{many0, separated_list0},
sequence::{delimited, preceded, tuple},
IResult,
};
use reqwest::header::{GetAll, HeaderValue};
pub fn all_rels(header: GetAll... |
use std::iter;
//-----------------------------------------------------
// Setup.
static INPUT: &str = include_str!("data/q20.data");
fn parse_algorithm(data: &str) -> [bool; 512] {
let mut rv = [false; 512];
let data: Vec<char> = data.chars().collect();
for (i, &curr) in data.iter().enumerate() {
... |
//! Pratt parsers for formulas
use super::{LexErrorKind, Lexer, ParseError, ParseErrorKind, TokenKind, Parser};
use crate::expect;
#[derive(Debug, Clone, Copy)]
pub enum Operator {
Plus,
Minus,
Times,
Divide,
Power,
Modulo,
}
#[derive(Debug, Clone, Copy)]
pub enum UnaryOperator {
Neg,
}
... |
use crate::{Color, Size};
use druid::widget::{Controller, ControllerHost};
use druid::{
BoxConstraints, Data, Env, Event, EventCtx, LayoutCtx, LifeCycle, LifeCycleCtx, MouseButton,
PaintCtx, Point, RenderContext, Selector, UpdateCtx, Widget, WidgetExt, WidgetPod,
};
/// Selector used to open the sidebar.
pub(c... |
use futures::*;
use futures::sync::mpsc;
use futures_cpupool::CpuPool;
use std::{self, fmt, str};
use std::collections::{HashMap, HashSet};
use std::sync::{Arc, Mutex};
use super::messages::Message as IRCMessage;
use super::messages::commands::{Command, requests as Requests, responses as Responses};
use super::connecti... |
use crate::app_state::AppState;
use crate::app_state::ReferenceChange;
use crate::components::{MetadataComponent, TransformComponent};
use crate::managers::scene::Scene;
use na::*;
pub struct TransformUpdateSystem {}
impl TransformUpdateSystem {
pub fn run(&self, state: &mut AppState, scene: &mut Scene) {
... |
use bigtools::bbiread::{BBIRead, ChromAndSize};
use bigtools::bigbedread::BigBedRead;
use bigtools::bigwig::BedEntry;
use bigtools::seekableread::{Reopen, SeekableRead};
use std::collections::HashMap;
use std::error::Error;
use std::fmt;
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub struct ChromDa... |
// Copyright [2020] [<NAME>]
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
extern crate rust_base58;
extern crate ursa;
extern crate clap;
use zmq;
use base64;
use rust_base58::FromBase58;
use clap::{Arg, App};
use ursa::{
keys::PublicKey,
signatures::ed25519::Ed25519Sha512,
};
const EXPECTED_PK_LENGTH : usize = 32;
fn main() {
let timeout: i64;
let tries_count: i32;
... |
#[doc = "Reader of register PCLKSR"]
pub type R = crate::R<u32, super::PCLKSR>;
#[doc = "Reader of field `XOSCRDY`"]
pub type XOSCRDY_R = crate::R<bool, bool>;
#[doc = "Reader of field `XOSC32KRDY`"]
pub type XOSC32KRDY_R = crate::R<bool, bool>;
#[doc = "Reader of field `OSC32KRDY`"]
pub type OSC32KRDY_R = crate::R<boo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.