text stringlengths 3.09k 13.9k |
|---|
#![allow(clippy::upper_case_acronyms)]
use std::io::{self, Read};
use std::str::FromStr;
use anyhow::{anyhow, Result};
use qrcodegen::{QrCode, QrCodeEcc};
use sampi::SampiKeyPair;
use structopt::StructOpt;
#[derive(Debug)]
struct HexData64(Vec<u8>);
impl FromStr for HexData64 {
type Err = hex::FromHexError;
... |
// Copyright 2017-2018 Parity Technologies (UK) 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... |
// Copyright 2015-2017 <NAME> <<EMAIL>>
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according... |
use crate::{include_sql, params, telegram::Telegram, Context};
use chrono::prelude::*;
use darkredis::{Command, CommandList, Value};
use futures::TryStreamExt;
use serde::{Deserialize, Serialize};
use tokio_postgres::types::Type;
#[derive(Serialize, Deserialize)]
struct LastDisaster {
from: i64,
to: i64,
u... |
use futures::{Future, Stream};
use crate::packet::constants::{IFF_UP, NLM_F_ACK, NLM_F_CREATE, NLM_F_EXCL, NLM_F_REQUEST};
use crate::packet::{
LinkFlags, LinkInfo, LinkInfoData, LinkInfoKind, LinkInfoVlan, LinkMessage, LinkNla,
NetlinkFlags, NetlinkMessage, NetlinkPayload, RtnlMessage, VethInfoNla,
};
use cr... |
use crate::attr;
use proc_macro2::{Span, TokenStream, TokenTree};
use quote::{format_ident, quote, quote_spanned};
use std::iter::FromIterator;
use syn::parse::{Error, Parse, ParseStream, Result};
use syn::punctuated::Punctuated;
use syn::{
braced, parenthesized, parse_quote, Abi, Attribute, BareFnArg, BoundLifetim... |
//! Wayland scanner crate
//!
//!
//! This crate is a rust equivalent of the wayland-scanner tool from the
//! official wayland C library.
//!
//! You can use in your build script to generate the rust code for any
//! wayland protocol file, to use alongside the `wayland_client` and
//! `wayland_server` crate to build y... |
use std::marker::PhantomData;
use keyboard_types::Code;
use crate::{
Context, Data, Event, Handle, Lens, Model, TreeExt, View, WindowEvent, Binding,
};
/// An `ItemPtr` is used to access an item from context in a list item template.
///
/// An `ItemPtr` is provided by the item template of a list view and can ... |
// Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0.
use crate::callback::must_call;
use futures::channel::mpsc;
use futures::channel::oneshot as futures_oneshot;
use futures::future::{self, BoxFuture, Future, FutureExt, TryFutureExt};
use futures::stream::{Stream, StreamExt};
use futures::task::{self, A... |
mod state;
use super::{
message::{consensus_message as message, consensus_response as response},
Core, Error, RingBuffer,
};
use crate::consensus::{BlockNumber, LeaderTerm};
use pinxit::{PeerId, Signature};
use state::State;
use std::{
future::Future,
ops::Deref,
sync::{Arc, Mutex},
time::{Dura... |
#![warn(clippy::pedantic)]
use std::convert::TryInto;
use std::io::{Read, Write};
use std::path::PathBuf;
use std::sync::mpsc;
use std::time::Duration;
use std::{fs, thread};
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt()]
struct Opt {
src: PathBuf,
dst: PathBuf,
}
/// Get OS dirty byte ... |
pub(super) fn run() -> Result<(), super::Error> {
let (earliest_departure_timestamp, bus_ids) = parse_input(super::read_input_lines::<String>("day13")?)?;
{
let result = part1(earliest_departure_timestamp, &bus_ids)?;
println!("13a: {}", result);
assert_eq!(result, 153);
}
#[cfg(not(test))]
{
let resul... |
#![no_std]
use core::iter;
use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand};
use embedded_hal::digital::v2::OutputPin;
mod graphics;
pub struct ILI9486<CSX, RSX, IF> {
interface: IF,
chip_select: CSX,
reset: RSX,
config: Config,
}
struct Config {
width: u16,
height: u... |
use kaze::*;
use super::alu::ALU;
use super::and::And;
use super::mux16::Mux16;
use super::not::Not;
use super::or::Or;
use super::pc::PC;
use super::register::Register;
pub struct CPU<'a> {
pub m: &'a Module<'a>,
pub inM: &'a Input<'a>,
pub instruction: &'a Input<'a>,
pub reset: &'a Input<'a>,
pu... |
mod chunk_iterator;
mod iterator;
mod slice_iterator;
mod zip_validity;
pub use iterator::BitmapIter;
pub use slice_iterator::SlicesIterator;
pub use zip_validity::{zip_validity, ZipValidity};
const BIT_MASK: [u8; 8] = [1, 2, 4, 8, 16, 32, 64, 128];
const UNSET_BIT_MASK: [u8; 8] = [
255 - 1,
255 - 2,
255 ... |
//! This library only exists to have a common structure definition that can be
//! passed from the bootloader to the kernel. This contains any information
//! that the bootloader wants to enlighten the kernel with.
//!
//! This structure also support backwards passing, for the kernel to pass
//! information back to the... |
mod constants;
mod external;
mod types;
pub use constants::*;
pub use external::*;
use std::mem::{self, MaybeUninit};
use std::ops::Deref;
use std::ptr;
pub use types::*;
type Result<T> = std::result::Result<T, c_ulong>;
fn last_error<T>() -> Result<T> {
Err(unsafe { GetLastError() })
}
pub fn get_module_handle... |
// Slab Allocator
use super::*;
use crate::arch::cpu::Cpu;
// use crate::*;
use ::alloc::vec::Vec;
use core::alloc::Layout;
use core::mem::MaybeUninit;
use core::sync::atomic::*;
use core::{mem::size_of, num::*};
type UsizeSmall = u16;
pub(super) struct SlabAllocator {
vec: Vec<SlabCache>,
}
impl SlabAllocator ... |
// taken from https://github.com/hyperium/http/blob/master/src/extensions.rs.
use crate::sync::{RwLockReadGuard, RwLockWriteGuard};
use std::{
any::{Any, TypeId},
collections::HashMap,
fmt,
hash::{BuildHasherDefault, Hasher},
};
#[allow(warnings)]
type AnyMap = HashMap<TypeId, Box<dyn Any + Send + Syn... |
//! This module implements the [`QuotedString`] type, which can be used to print
//! paths that may contain non-printable characters.
//!
//! The final string can be limited to a maximum width.
use std::cell::Cell;
use std::ffi::OsStr;
use std::fmt;
use std::num::NonZeroUsize;
#[cfg(unix)]
use std::os::unix::ffi::OsS... |
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
// This file is part of Parity Ethereum.
// Parity Ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at yo... |
// Generated from definition io.k8s.api.flowcontrol.v1alpha1.FlowSchemaSpec
/// FlowSchemaSpec describes how the FlowSchema's specification looks like.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct FlowSchemaSpec {
/// `distinguisherMethod` defines how to compute the flow distinguisher for requests that m... |
//! Provides userspace applications with a driver interface to asynchronous GPIO
//! pins.
//!
//! Async GPIO pins are pins that exist on something like a GPIO extender or a
//! radio that has controllable GPIOs.
//!
//! Usage
//! -----
//!
//! ```rust
//! Generate a list of ports to group into one userspace driver.
//... |
use crate::utils;
use proc_macro2::{Ident, Literal, Span, TokenStream};
use quote::quote;
use utils::witx_target_module_map_ident;
use witx::WasmType;
fn emit_func_extern(
name: &str,
params: &[WasmType],
returns: &[WasmType],
module_map_id: &Ident,
module_id: &Ident,
) -> TokenStream {
let to_... |
use crate::input::Input;
use crate::lib::intcode;
use std::collections::HashSet;
use std::error;
type Error = Box<dyn error::Error>;
const PRESSURE_SENSITIVE_FLOOR: &str = "== Pressure-Sensitive Floor ==";
const TOO_HEAVY: &str = "Alert! Droids on this ship are heavier than the detected value!";
const TOO_LIGHT: &str... |
use kiss3d::scene::SceneNode;
use na::{Isometry3, Point3};
use nphysics3d::object::ColliderHandle;
use nphysics3d::world::World;
use crate::objects::ball::Ball;
use crate::objects::box_node::Box;
use crate::objects::cone::Cone;
use crate::objects::capsule::Capsule;
use crate::objects::convex::Convex;
use crate::objects... |
use rocket::State;
use rocket_contrib::json::Json;
use serde_json::{json, Value as JsonValue};
use libra_wallet::{key_factory::ChildNumber, Mnemonic, WalletLibrary};
use types::{
access_path::AccessPath,
account_config::{account_received_event_path, account_sent_event_path},
};
use crate::{client::{Client, Ra... |
use std::thread::JoinHandle;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::io::Result;
use std::net::UdpSocket;
use std::net::SocketAddr;
use std::sync::Mutex;
use std::time::Duration;
use rand::Rng;
use crossbeam_queue::ArrayQueue;
use crate::protocol::*;
#[derive(Copy, Clone, Debug, Def... |
//! Core utilities shared by most of toc's crates
//! Includes
//! - Common location information
//! - Common status reporting facility
use std::fmt::{self, Arguments, Display, Formatter};
pub mod token;
/// Location of a token in a file/text stream
#[derive(Debug, PartialEq, Copy, Clone)]
pub struct Location {
/... |
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
use std::{sync::Mutex, collections::HashMap};
use std::path::Path;
use std::sync::Arc;
use wikit_core::config;
use wikit_core::wikit;
use wikit_core::wikit::WikitDictionary;
use tauri::{CustomMenuItem, Menu, MenuItem,... |
// 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 ... |
use std::fmt;
use std::str::FromStr;
use chrono::{NaiveDate, NaiveDateTime, Utc};
use diesel::{delete, insert_into, prelude::*, update};
use super::super::super::{
errors::{Error, Result},
orm::{Connection, ID},
};
use super::schema::policies;
#[derive(Queryable)]
pub struct Item {
pub id: ID,
pub us... |
//! Various structs containing Torrent information.
use std::ffi;
use chrono::prelude::NaiveDateTime;
use serde::{Deserialize, Serialize};
use transmission_sys;
use super::Priority;
/// A file that is part of a torrent.
#[derive(Debug, Serialize, Deserialize)]
pub struct TorrentFile {
/// The length of the file ... |
use core::convert::TryInto;
use bn_rs::BN;
use bytes::{Bytes, BytesMut};
use primitive_types::{H160, U256};
use revm::{AccountInfo, DatabaseCommit, InMemoryDB, SpecId, TransactTo, EVM as rEVM};
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
// Use `js_namespace` here to bind `console.log(..)` instead ... |
mod check;
mod error;
mod migrations;
mod moodle;
mod subscribe;
mod tenant;
mod user;
use crate::check::start_check_loop;
use crate::subscribe::{add_subscribe, remove_group_subscribe, remove_subscribe};
use crate::tenant::Tenant;
use crate::user::get_user_id_from_qq;
use coolq_sdk_rust::api::{
add_log, get_login_... |
use crate::dom;
use crate::event;
use crate::native;
use std::collections::HashSet;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use web_sys;
pub struct Renderer {
before: dom::Node,
root: web_sys::Node,
}
impl Renderer {
pub fn new(virtual_node: dom::Node, root_node: web_sys::Node) -> Self {
... |
use std::convert::TryFrom;
use github_scbot_conf::Config;
use github_scbot_types::{common::GhRepository, pulls::GhMergeStrategy};
use super::{IRepositoryDbAdapter, RepositoryCreation, RepositoryModel, RepositoryUpdate};
use crate::Result;
#[must_use]
#[derive(Default)]
pub struct RepositoryModelBuilder<'a> {
id:... |
use glium::glutin::{
DeviceEvent, ElementState, Event, KeyboardInput, MouseButton, VirtualKeyCode, WindowEvent,
};
use cgmath::prelude::*;
use cgmath::Vector3;
use clamp::clamp;
use rand::prelude::*;
use std::f32::consts::PI;
use std::time::SystemTime;
use client::{Client, GameState, Graphics, PlayerState, Sig... |
//! This module defines various traits required by the users of the library to implement.
use bellperson::{gadgets::num::AllocatedNum, ConstraintSystem, SynthesisError};
use core::{
fmt::Debug,
ops::{Add, AddAssign, Mul, MulAssign, Sub, SubAssign},
};
use ff::{PrimeField, PrimeFieldBits};
use merlin::Transcript;
us... |
use crate::input::{mouse::ViewportPosition, InputPreprocessor};
use crate::tool::{DocumentToolData, Fsm, ToolActionHandlerData};
use crate::{message_prelude::*, SvgDocument};
use document_core::{layers::style, Operation};
use std::f64::consts::PI;
#[derive(Default)]
pub struct Line {
fsm_state: LineToolFsmState,
da... |
use chrono::{DateTime, Local};
use serde::{Deserialize, Serialize, ser::SerializeStruct};
use std::cmp::Ordering;
use crate::{derivation::attached_signature_code::{get_sig_count}, error::Error, event::sections::seal::EventSeal, prefix::{AttachedSignaturePrefix, BasicPrefix, Prefix, SelfSigningPrefix, attached_seal::At... |
// "Tifflin" Kernel
// - By <NAME> (thePowersGang)
//
// Core/irqs.rs
//! Core IRQ Abstraction
use prelude::*;
use core::sync::atomic::AtomicBool;
use arch::sync::Spinlock;
use arch::interrupts;
use lib::{VecMap};
use lib::mem::Arc;
/// A handle for an IRQ binding that pokes an async event when the IRQ fires
pub struc... |
mod client_socket_connection;
mod connection_info;
mod messages;
mod room_actor;
mod server_state;
mod service_actor;
use crate::room_actor::GetConnectionInfo;
use actix_web::error::ErrorInternalServerError;
use actix_web::web::{self, get};
use actix_web::{web::Data, App, Error, HttpRequest, HttpResponse, HttpServer, ... |
//
// Copyright (c) 2021 chiya.dev
//
// Use of this source code is governed by the MIT License
// which can be found in the LICENSE file and at:
//
// https://opensource.org/licenses/MIT
//
use crate::internal::{escape, Buffer};
use alloc::{
borrow::{Cow, ToOwned},
string::String,
};
use core::num::{
Non... |
//! Defines types to describe a TM.
use std::fmt;
use crate::tape::CellValue;
/// An N-state turing machine operating on a binary tape.
///
/// This type can only represent TMs up to N=6 states.
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct Tm<const N: usize> {
/// Every state is encoded using 10 bits, start... |
#[macro_use]
extern crate clap;
use async_jsonrpc_client::HttpTransport;
use cli_table::{format::Justify, print_stdout, Cell, Style, Table};
use ethabi::{Address, Uint};
use std::error::Error;
use vault::{
get_simulation, CdpManager, HttpBlockchainReader, Median, Pair, Saver, Scenario, Spot,
};
#[tokio::main]
asyn... |
#[cfg(test)]
#[macro_use]
/// Alternative `insta` macros with the following properties:
///
/// * They use a single snapshot directory outside of the src/ directory.
/// * If you provide a third argument, it is ADDED to the expression rather than replacing it.
/// This way, there is no hidden disadvantage to providi... |
extern crate ansi_term;
extern crate gcnctrlusb;
use std::cell::Cell;
use std::io::{self, Write};
use std::sync::{Arc, Mutex};
use std::thread;
use std::time::Duration;
fn main() {
let controllers = Arc::new(Mutex::new(Cell::new(Default::default())));
let controllers_write = controllers.clone();
thread::... |
extern crate sponge;
extern crate image;
extern crate rayon;
extern crate time;
extern crate cgmath;
use std::thread;
use image::GrayImage;
use image::Luma;
use sponge::*;
use rayon::{Configuration};
use rayon::prelude::*;
use cgmath::*;
const RENDER_WIDTH : u32 = 256;
const RENDER_HEIGHT : u32 = 256;
fn main(... |
// 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 writing,... |
use ffi::StringBuffer;
use std::ffi::{CString, NulError};
use std::string::FromUtf8Error;
use xplm_sys::*;
/// Datarefs created by X-Plane or other plugins
pub mod borrowed;
/// Datarefs created by this plugin
pub mod owned;
/// Marks a dataref as readable
pub enum ReadOnly {}
/// Marks a dataref as writeable
pub en... |
use std::fmt::Debug;
include!("../../helpers.rs");
#[derive(Copy, Clone, Eq, PartialEq)]
enum Seat {
OutOfBounds,
Floor,
Empty,
Occupied,
}
impl Seat {
pub fn parse(b: u8) -> Seat {
match b {
b'.' => Seat::Floor,
b'L' => Seat::Empty,
b'#' => Seat::Occup... |
use crate::db;
use hir::PerNs;
/// `CompletionItem` describes a single completion variant in the editor pop-up.
/// It is basically a POD with various properties. To construct a
/// `CompletionItem`, use `new` method and the `Builder` struct.
#[derive(Debug)]
pub struct CompletionItem {
/// Used only internally i... |
use super::*;
use proptest::arbitrary::any;
use proptest::strategy::{BoxedStrategy, Just, Strategy};
use proptest::test_runner::{Config, TestRunner};
use proptest::{prop_assert, prop_assert_eq};
use liblumen_alloc::erts::term::{
make_pid, next_pid, BigInteger, HeapBin, SmallInteger, SubBinary,
};
use liblumen_all... |
#![cfg(test)]
mod benchmarks;
use crate::merkle_tree::{MerkleTree, calculate_height};
use crate::hash::*;
#[test]
fn test_empty_tree_hash() {
let db: MerkleTree<u32> = MerkleTree::new();
assert_eq!(&"5feceb66ffc86f38d952786c6d696c79c2dbc239dd4e91b46729d73a27fb57e9".to_string(),
db.root_hash().... |
use crate::{db, template, utils};
use chrono::{DateTime, Utc};
use diesel::prelude::*;
use failure::{format_err, ResultExt as _};
use hashbrown::HashMap;
use parking_lot::RwLock;
use std::{fmt, sync::Arc};
#[derive(Debug, err_derive::Error)]
pub enum BumpError {
/// Trying to bump something which doesn't exist.
... |
use std::ops::Range;
use Backend;
use pso;
use buffer::IndexBufferView;
use image::{ImageLayout, SubresourceRange};
use queue::capability::{Graphics, Supports};
use super::{CommandBuffer, RawCommandBuffer, RenderPassInlineEncoder};
#[allow(missing_docs)]
#[derive(Clone, Copy, Debug, Hash, PartialEq, PartialOrd)]
#[c... |
use std::net::{Shutdown, TcpListener, TcpStream};
use std::thread;
use diffie_hellman::communication::Communicate;
use diffie_hellman::handshake::{
ClientDeterminesParameters, ClientServerPair, Handshake, ServerCanOverrideParameters,
};
use diffie_hellman::mitm_handshake::{
MitmFakeGeneratorOne, MitmFakeGenera... |
use std::str::from_utf8;
use chrono::NaiveDate;
use hubcaps::Github;
use serde::{Deserialize, Serialize};
use tracing::instrument;
use crate::db::Database;
use crate::models::{NewJournalClubMeeting, NewJournalClubPaper};
use crate::utils::github_org;
#[derive(Debug, Deserialize, Serialize)]
pub struct Meeting {
... |
use super::archive_schema::Archive;
use super::paths::to_absolute;
use super::setup_archive::setup_archive;
use super::utils::Arguments;
use std::ffi::OsStr;
use std::fs::create_dir_all;
use std::io::{
Error as ioError,
Result as ioResult,
};
use std::path::Path;
use std::path::PathBuf;
/// Helper function to make ... |
use super::BidirectionalSparseGraph;
#[derive(Debug, Clone)]
pub struct PrimalDualBuilder {
vsize: usize,
edges: Vec<(usize, usize)>,
capacities: Vec<u64>,
costs: Vec<i64>,
has_negedge: bool,
}
impl PrimalDualBuilder {
pub fn new(vsize: usize, esize_expect: usize) -> Self {
Self {
... |
// Copyright (c) 2012-2022 Supercolony
//
// 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, publis... |
use std::io;
use bitflags::bitflags;
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use failure::Fail;
use num_derive::{FromPrimitive, ToPrimitive};
use num_traits::{FromPrimitive, ToPrimitive};
use crate::{gcc, impl_from_error, PduParsing};
const SYNCHRONIZE_PDU_SIZE: usize = 2 + 2;
const CONTROL_PDU_S... |
use std::fmt;
use base64;
use rand::Rng;
use crate::octets as octets;
use crate::SEGMENT_SIZE;
#[derive(Debug, Copy, Clone)]
pub struct GridSize {
pub height: usize,
pub width: usize
}
impl GridSize {
pub fn area(&self) -> usize {
self.height * self.width
}
}
pub struct Grid {
pub dimensions: GridSiz... |
use std::sync::mpsc::{channel, Sender};
use std::thread::{sleep, spawn, JoinHandle};
use std::time::Duration;
use std::{fmt::Debug, io::Write};
use std::{
io::Read,
net::{SocketAddr, TcpListener, TcpStream},
};
use serde::{de::DeserializeOwned, Serialize};
use super::{Updater, UpdaterChannel, Value};
/// An ... |
use permutohedron::LexicalPermutation;
use computer::{Computer, ComputerIo, ExecutionState};
fn get_phase_setting_permutations(mut phase_settings: Vec<i64>) -> Vec<Vec<i64>> {
let mut permutations = Vec::new();
loop {
permutations.push(phase_settings.clone());
if !phase_settings.next_permutatio... |
use serde::{Deserialize, Serialize};
#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct Timestamp32(u32);
#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct Timestamp64(u64);
#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct FixedPoint64(i64);
#[derive(Debug, PartialEq, Serialize, Deseriali... |
use std::borrow::Cow;
use std::collections::BTreeMap;
use std::convert::Infallible;
use std::net::{Ipv4Addr, SocketAddr};
use std::pin::Pin;
use std::sync::Arc;
use std::task::{Context, Poll};
use aes_ctr::cipher::generic_array::GenericArray;
use aes_ctr::cipher::{NewStreamCipher, SyncStreamCipher};
use aes_ctr::Aes12... |
use std::{
borrow::Cow,
fs::{self, DirEntry},
io,
path::Path,
process::Command,
};
use lazy_static::lazy_static;
use regex::Regex;
use colored::*;
lazy_static! {
static ref EXPECTED: Regex = Regex::new("// expect: ?(.*)").unwrap();
static ref ERROR: Regex = Regex::new("// expect error").u... |
use crate::{
default::DEFAULT_SETTINGS,
types::{GerritUsername, PathToUserData, ProfileId, Settings, Synchronization},
};
use ron;
use std::collections::HashMap;
use std::fs;
use std::path::Path;
pub trait UserService {
/**
* Load a map of Gerrit username to available Synchronization data.
*/
... |
#![allow(dead_code)]
use thiserror::Error;
#[derive(Debug)]
pub enum CpNodeError {
Class,
String,
MethodType,
Module,
Package,
Integer,
Float,
Dynamic,
NameAndType,
InvokeDynamic,
FieldRef,
MethodRef,
InterfaceMethodRef,
Long,
Double,
MethodHandle,
U... |
use std::io;
use std::sync::Arc;
use crossterm::event::KeyCode;
use tui::layout::Rect;
use tui::{
backend::CrosstermBackend,
layout::{Constraint, Direction, Layout},
style::{Color, Modifier, Style},
symbols::DOT,
text::Spans,
widgets::BorderType,
widgets::{Block, ListState, Tabs},
Fram... |
use std::env;
use std::fs;
use std::io;
use std::path::PathBuf;
use anyhow::Result;
use netrc_rs::Netrc;
use reqwest::blocking::{Request, Response};
use reqwest::header::{HeaderValue, AUTHORIZATION, WWW_AUTHENTICATE};
use reqwest::StatusCode;
use crate::cli::AuthType;
use crate::middleware::{Context, Middleware};
use... |
// Ported from convert_neologd_to_mozcdic.rb file.
use std::io::{BufRead, BufReader, BufWriter, Write};
use std::fs::File;
use regex::*;
use rayon::prelude::*;
use super::mozc::get_id;
use super::util::*;
#[derive(Debug, Eq, Ord, PartialEq, PartialOrd)]
struct Entry {
yomi: String,
hyouki: String,
cos... |
use crate::storage::{Entity, EntitySparseArray, IndexEntity, Version};
use std::num::NonZeroU32;
use std::ops::Deref;
use std::sync::atomic::{AtomicU32, AtomicUsize, Ordering};
/// Sparse set-based storage for entities.
#[derive(Default)]
pub struct EntityStorage {
storage: EntitySparseSet,
allocator: EntityAl... |
#![allow(dead_code)]
use super::*;
use delegate::delegate;
use std::boxed::Box;
use std::error::Error;
use std::format;
use std::fs::File;
use std::io::Read;
use std::string::String;
const O_SYNC: i32 = 0x101000;
fn read_file_to_string(path: String) -> Result<String, Box<dyn Error>> {
let mut file = File::open(p... |
extern crate unbase;
use futures::join;
use futures_await_test::async_test;
use std::time::Duration;
use timer::Delay;
use tracing::{
debug,
info,
span,
Level,
};
use unbase::Entity;
#[async_test]
async fn remote_traversal_simulated() {
unbase_test_util::init_test_logger();
let testspan = span... |
use crate::format_context::FormatContext;
use crate::order::{
filter_input::FilterInput, filter_output::FilterOutput, input::Input, input_kind::InputKind,
output::Output, output_kind::OutputKind, stream::Stream,
};
use crate::order::{Filter, Order, OutputResult::Entry, ParameterValue};
use crate::probe::deep::{Chec... |
/*
* Copyright 2019 Comcast Cable Communications Management, 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicab... |
extern crate glib;
extern crate gdk;
extern crate gtk;
#[macro_use]
extern crate relm;
#[macro_use]
extern crate relm_derive;
extern crate net_tester;
use gtk::{
Button,
ButtonExt,
ContainerExt,
Inhibit,
WidgetExt,
Window,
WindowType,
TextView,
TextViewExt,
TextBuffer,
TextB... |
#[derive(Clone, Copy, Debug)]
enum Operator {
Sub,
Plus,
Mul,
Div,
}
#[derive(Clone, Debug)]
struct Factor {
content: String,
value: i32,
}
fn apply(op: Operator, left: &[Factor], right: &[Factor]) -> Vec<Factor> {
let mut ret = Vec::new();
for l in left.iter() {
for r in rig... |
extern crate minifb;
use minifb::{Key, Window, WindowOptions};
use pixel_engine::PixelBuffer;
use std::fs::File;
use std::io::Read;
use std::path::Path;
use std::time::{Duration, Instant};
mod cpu;
mod decoder;
mod gpu;
mod memory;
fn remap_keys(keys: Vec<Key>) -> Vec<u8> {
keys.iter()
.filter_map(|key|... |
use bitcoin::blockdata::block::Block;
use bitcoin::network::serialize::BitcoinHash;
use bitcoin::network::serialize::SimpleDecoder;
use bitcoin::network::serialize::{deserialize, RawDecoder};
use bitcoin::util::hash::Sha256dHash;
use std::collections::HashSet;
use std::fs;
use std::io::{Cursor, Seek, SeekFrom};
use std... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use itertools::Itertools;
use std::{
collections::{BTreeMap, HashMap},
convert::TryFrom,
};
use crate::account_resource_ext;
use failure::prelude::*;
use libra_types::{
access_path::DataPath,
account_address::Accoun... |
pub mod dynamic_pool;
pub mod static_pool;
use self::dynamic_pool::DynamicPool;
use self::static_pool::StaticPool;
use reducer::{CollectReducer, Reducer};
use std::fmt::Debug;
use std::iter::FromIterator;
use std::marker::PhantomData;
use worker::Worker;
/// Pool allows for parallel processing of items. When creating... |
use amethyst::{
assets::{Loader, ProgressCounter},
audio::output::init_output,
core::{math::Vector3, ArcThreadPool, Parent, Transform},
ecs::{world::Builder, Dispatcher, DispatcherBuilder, Entity, World, WorldExt},
prelude::*,
renderer::{ActiveCamera, Camera},
ui::TtfFormat,
};
use crate::{... |
//! Module that provides an implementation of [Preferences] that saves the value into the device
//! storage.
use crate::io;
use crate::io::IoError;
use crate::preferences::{Preferences, PreferencesError, Result};
use serde_json::{Map, Value};
pub struct UnencryptedPreferences {
name: String,
data: Map<String... |
use std::fmt;
use async_trait::async_trait;
use derive_more::Display;
use futures::StreamExt;
use tracing::{debug, error, error_span, info, warn, Span};
use tracing_futures::Instrument;
use crate::{
discarded,
metric,
metrics::Measurement,
state_machine::{
coordinator::CoordinatorState,
... |
//! Connection base / building block.
//!
//! Contains some helper structs and traits common to all Connection types.-
use crate::{Message, to_c_str, c_str_to_slice, MessageType};
use crate::message::MatchRule;
#[cfg(not(feature = "native-channel"))]
mod ffichannel;
#[cfg(not(feature = "native-channel"))]
pub use ffi... |
#![allow(clippy::must_use_candidate, clippy::missing_panics_doc)]
use std::fs::read_to_string;
use bitvec::prelude::*;
use itertools::Itertools;
struct BitBufReader {
bits: BitVec<Msb0, u8>,
position: usize,
}
impl BitBufReader {
fn new(bits: BitVec<Msb0, u8>) -> Self {
Self { bits, position: 0 }
}
fn read(... |
// 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::{
container::ComponentIdentity,
logs::{
budget::BudgetHandle,
buffer::ArcList,
error::StreamError,
socke... |
extern crate hoffman;
use hoffman::*;
use std::time::Instant;
use std::iter::repeat;
const N: usize = 4;
const M: usize = 2;
fn main() {
/* Unique:
Equal: 9 680 536 squares
Narrow: 7 807 933 squares
Wide: 7 807 933 squares
Universal: 6 406 310 squares */
/* Including s... |
use std::collections::HashMap;
use std::convert::TryInto;
use std::str::FromStr;
const SIZE: usize = 36;
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum MaskBit {
ZERO,
ONE,
FLOATING,
}
impl MaskBit {
fn from_char(c: char) -> Self {
match c {
'0' => MaskBit::ZERO,
... |
use serde::{Deserialize, Serialize};
use thiserror::Error;
use oasis_runtime_sdk::{
self as sdk,
context::{DispatchContext, TxContext},
core::common::cbor,
error::{Error as _, RuntimeError},
module::{CallableMethodInfo, Module as _, QueryMethodInfo},
types::transaction::CallResult,
};
pub mod ... |
use std::error::Error;
use crate::step_defs::{
integration::world::World,
util::{account_from_kmd_response, wait_for_pending_transaction},
};
use algonaut::{algod::v2::Algod, kmd::v1::Kmd};
use algonaut_core::{MicroAlgos, Round};
use algonaut_transaction::{Pay, TxnBuilder};
use cucumber::{given, then, when};
... |
use magic_vlsi::units::{Area, Distance};
use serde::Deserialize;
use std::collections::HashMap;
use std::path::Path;
#[derive(Debug, Deserialize, Eq, PartialEq)]
pub struct SramConfig {
pub rows: u32,
pub cols: u32,
pub output_dir: String,
pub tech_dir: String,
}
#[derive(Debug, Deserialize)]
struct T... |
use regex::Regex;
use itertools::Itertools;
use std::collections::HashSet;
use std::fs;
use std::fs::File;
use std::io::{self, BufRead, Error};
use std::iter::FromIterator;
use std::path::Path;
// The output is wrapped in a Result to allow matching on errors
// Returns an Iterator to the Reader of the lines of the fil... |
//! Link: https://adventofcode.com/2019/day/12
//! Day 12: The N-Body Problem
//!
//! The space near Jupiter is not a very safe place;
//! you need to be careful of a big distracting red spot,
//! extreme radiation, and a whole lot of moons swirling around.
//! You decide to start by tracking the four largest moons... |
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
mod methods;
use gveditor_core::gen_client::Client;
use gveditor_core::handlers::{
LocalHandler,
TransportHandler,
};
use gveditor_core::tokio::sync::mpsc::{
channel,
Receiver,
Sender,
};
use gv... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - SAC OA Control Register"]
pub sac1oa: SAC1OA,
#[doc = "0x02 - SAC PGA Control Register"]
pub sac1pga: SAC1PGA,
#[doc = "0x04 - SAC DAC Control Register"]
pub sac1dac: SAC1DAC,
#[doc = "0x06 - SAC DAC Data Regist... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.