text stringlengths 3.09k 13.9k |
|---|
use crate::system::System;
use anyhow::{bail, Context, Result};
use crossbeam_channel::{bounded, Receiver, Sender};
use log::{debug, error, info};
use nix::{
sys::signal::{kill, Signal},
unistd::Pid,
};
use serde::{Deserialize, Serialize};
use std::{
fs::{self, create_dir_all, File},
io::{BufRead, BufRe... |
use crate::const_vars::*;
use crate::eaglesong::*;
use std::vec::Vec;
mod const_vars;
mod eaglesong;
pub fn eaglesong(input: &[u8], output: &mut [u8]) {
eaglesong_sponge(output, output.len(), input, input.len())
}
#[derive(Default)]
pub struct EagleSongBuilder {
state: [u32; 16],
length: usize,
msg: ... |
pub mod asset_data;
pub mod category_data;
pub mod database;
pub mod engine_data;
pub mod project_data;
use crate::config::APP_ID;
use egs_api::EpicGames;
use gtk4::gio;
use gtk4::glib::{MainContext, Receiver, Sender, UserDirectory, PRIORITY_DEFAULT};
use gtk4::prelude::*;
use log::{debug, error, info};
#[cfg(target_... |
//! Simple boolean parameters.
use std::fmt::Display;
use std::sync::Arc;
use super::internals::ParamPtr;
use super::{Param, ParamFlags};
/// A simple boolean parmaeter.
#[repr(C, align(4))]
pub struct BoolParam {
/// The field's current value. Should be initialized with the default value.
pub value: bool,
... |
use std::sync::Arc;
use bevy::prelude::*;
use bevy_prototype_lyon::prelude::*;
use notation_bevy_utils::prelude::{BevyUtil, LayoutSize, OutlineRectangle, ShapeOp};
use notation_model::prelude::{
Duration, Fretboard6, HandShape6, Pick, PlaySpeed, PlayingState, SyllableNote, TabMeta, Units,
};
use crate::prelude::{... |
#![deny(warnings)]
#[macro_use]
extern crate failure;
extern crate clap;
extern crate elf;
extern crate errno;
extern crate libc;
extern crate rustc_demangle;
mod unwind;
use clap::{App, Arg};
use elf::types::Symbol;
use errno::errno;
use failure::Error;
use libc::{
pid_t, ptrace, waitpid, ECHILD, PTRACE_ATTACH,... |
use std::convert::TryFrom;
use beserial::{Deserialize, Serialize};
use keys::Address;
use primitives::account::*;
use primitives::coin::Coin;
use transaction::{SignatureProof, Transaction};
use transaction::account::htlc_contract::{AnyHash, CreationTransactionData, HashAlgorithm, ProofType};
use crate::{Account, Acco... |
#![allow(unused_mut, unused_variables, unused_must_use)]
use crate::lang_zhCN::formatter as cnText;
use anyhow::Result as AnyResult;
use clap::ArgMatches;
use colorful::Colorful;
use libept::base::v1;
use std::collections::HashSet;
use std::env::var;
use std::path::Path;
use tokio::fs;
use v1::Package;
use crate::type... |
//! Provides the [`integrate`](Model#method.integrate) method
use anyhow::{Context, Result};
use integrators::{
GeneralIntegrator, GeneralIntegrators, ResultExt, SymplecticIntegrator, SymplecticIntegrators,
};
use numeric_literals::replace_float_literals;
use rand::prelude::*;
use rand_distr::Normal;
use rand_xosh... |
use proc_macro2::{Ident, TokenStream};
use quote::{quote, ToTokens, TokenStreamExt};
use std::convert::TryFrom;
mod integer;
mod float;
pub use integer::*;
pub use float::*;
use crate::ir::{Identifier, Path};
#[derive(Debug, PartialEq, Clone, Copy)]
/// Atomic Enum
pub enum Atomic {
/// Integer variant
Integ... |
use crate::utf8_parser::{
char_categories::is_ws,
combinators,
combinators::{alt2, lookahead, pair, recognize, take_while},
ok::IOk,
util,
util::base_err,
BaseErrorKind, ErrorTree, Expectation, IResultLookahead, Input, InputParseErr,
};
/// Matches always and doesn't advance the parser
pub ... |
use std::fmt;
use std::path::{Path, PathBuf};
use std::result;
use csv;
use failure::{Backtrace, Context, Fail};
use fst;
/// A type alias for handling errors throughout imdb-index.
pub type Result<T> = result::Result<T, Error>;
/// An error that can occur while interacting with an IMDb index.
#[derive(Debug)]
pub s... |
//! Dotrix camera implementation
use crate::ecs::{Const, Mut};
use crate::renderer::Buffer;
use crate::{Frame, Globals, Input, Renderer, Window};
use dotrix_math::{perspective, InnerSpace, Mat4, Point3, Quat, Rad, Rotation3, Vec3};
use std::f32::consts::PI;
const ROTATE_SPEED: f32 = PI / 10.0;
const ZOOM_SPEED: f32 =... |
use std::error::Error;
use std::fs::{self, File, OpenOptions};
use std::io::Write;
use std::path::Path;
use std::process;
pub mod config;
#[cfg(test)]
mod tests;
type Config = config::Config;
/// Prints out the data stored in the data file, then exits
pub fn print_tab() {
// Set the data file (Hardcoded for now... |
use conrod_core::{color, widget, Labelable, Positionable, Sizeable, Widget};
use std::time::Duration;
use crate::data::{FileList, Rating, FILE_SORT_METHODS};
use crate::res::Resources;
use crate::systems::{events as e, AppEvent, EventSystem};
mod list_item;
mod rating;
widget_ids!(struct Ids {
next,
prev,
... |
//
//! Copyright 2020 Alibaba Group Holding Limited.
//!
//! 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 ... |
#![feature(plugin)]
#![plugin(rocket_codegen)]
extern crate cloudflare;
extern crate dotenv;
extern crate hmac;
#[macro_use]
extern crate lazy_static;
extern crate rayon;
extern crate reqwest;
extern crate rocket;
extern crate rocket_contrib;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crat... |
// iterate over both dirs, find common (and unique?) files, compare hashes, note any differing
// hashes, combine dirs?
use failure::Error;
use rayon::prelude::*;
use sha2::{Digest, Sha256};
use walkdir::WalkDir;
use std::{
cell::RefCell,
collections::HashMap,
fs::File,
io::{Read, Write},
path::{Path, PathB... |
use std::{error::Error, marker::PhantomData, path::PathBuf};
/// Macro for enabling a watchable library.
/// Ensure that
/// ```
/// [lib]
/// crate-type = ["cdylib", "rlib"]
/// ```
/// Is added to the crate.
/// This was intended that the plugin will live at the top level of the module.
/// `state` is the state that... |
extern crate rand;
use libc::INT_MAX;
use rand::distributions::{Distribution, Uniform};
fn median_of5(a: i32, b: i32, c: i32, d: i32, e: i32) -> usize {
return if b < a {
if d < c {
if b < d {
if a < e {
if a < d {
if e < d { 4 } else { 3 }
} else if c < a { 2 } els... |
use std::collections::HashMap;
use crate::{
alternation::Alternation,
boundary::Boundary,
char_class::CharClass,
compile::{CompileResult, CompileState},
error::{CompileError, CompileErrorKind, ParseError},
grapheme::Grapheme,
group::Group,
literal::Literal,
lookaround::Lookaround,
... |
pub mod data;
pub mod key;
pub mod tile;
pub mod control;
use image::Pixel;
use image::Rgba;
use image::RgbaImage;
use crate::color::biome::Biome;
use crate::color::ColorManager;
use crate::color::BakedColorManager;
use data::TILESIZE;
use data::View;
use tile::Tile;
pub type GEResult<T> = Result<T, Box<dyn std::er... |
//! This module defines thread control blocks (TCBs).
use super::stack::AccessType;
use super::{ProcessID, Stack, ThreadID, PCB, PROCESS_LIST};
use crate::arch::{self, Architecture};
use core::cmp::Ordering;
use core::fmt;
use core::time::Duration;
use crate::memory::{VirtualAddress, AddressSpaceManager};
use crate::s... |
/*
Copyright (c) 2018-present evan GmbH.
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... |
use std::{cell::RefCell, rc::Rc};
use gloo::{
events::EventListener,
render::{request_animation_frame, AnimationFrame},
utils::{document, window},
};
use hexomino_core::{Board, Hexo, MovedHexo, RHexo, Transform};
use log::{debug, error};
use piet::kurbo::Point;
use piet_web::WebRenderContext;
use wasm_bind... |
/*
Copyright 2021 JFrog Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writi... |
use std::collections::HashMap;
use std::fmt::{Display, Formatter, Result as FmtResult};
pub mod stdlib;
pub mod util;
use util::eval;
#[derive(Debug, Clone)]
pub enum Var {
String(String),
Number(f64),
Other(String),
Nothing,
}
impl Display for Var {
fn fmt(&self, f: &mut Formatter) -> FmtResult {
... |
use crate::blob::blob::requests::*;
use crate::blob::prelude::*;
use crate::core::prelude::*;
use crate::shared_access_signature::SharedAccessSignature;
use azure_core::prelude::*;
use azure_core::HttpClient;
use bytes::Bytes;
use http::method::Method;
use http::request::{Builder, Request};
use std::sync::Arc;
pub tra... |
//! Core auditing functionality
use crate::{config::AuditConfig, lockfile, prelude::*, presenter::Presenter};
use rustsec::{lockfile::Lockfile, registry, report, warning, Error, ErrorKind, Warning};
use std::{
collections::btree_map as map,
io::{self, Read},
path::Path,
process::exit,
};
/// Name of `... |
#![allow(dead_code)]
use std::fmt::Debug;
use std::iter;
use std::slice;
use bezier::Interpolate;
use bspline::BSpline;
/// Represents a B-spline surface that will use polynomials of the
/// specified degree along u and v to to interpolate the control mesh
/// using the knots along u and v.
#[derive(Clone, Debug)]
p... |
use proptest::prelude::*;
use wiggle::{GuestMemory, GuestPtr};
use wiggle_test::{impl_errno, HostMemory, MemArea, WasiCtx};
wiggle::from_witx!({
witx: ["tests/pointers.witx"],
ctx: WasiCtx,
});
impl_errno!(types::Errno, types::GuestErrorConversion);
impl<'a> pointers::Pointers for WasiCtx<'a> {
fn pointe... |
use std::sync::Arc;
use vulkano::{
self,
device::{Device, Queue},
format::Format,
image::SwapchainImage,
instance::{Instance, PhysicalDevice},
swapchain::{ColorSpace, Surface, Swapchain, SwapchainCreationError},
Version,
};
use vulkano::image::ImageUsage;
use vulkano_win::{self, VkSurfaceBu... |
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#![cfg(test)]
use {
crate::{
client::types as client_types,
config_management::{
Credential, NetworkConfig, NetworkConfigEr... |
use crate::clippy_project_root;
use std::fs::{self, OpenOptions};
use std::io::prelude::*;
use std::io::{self, ErrorKind};
use std::path::{Path, PathBuf};
struct LintData<'a> {
pass: &'a str,
name: &'a str,
category: &'a str,
project_root: PathBuf,
}
trait Context {
fn context<C: AsRef<str>>(self,... |
use bytes::{Bytes, BytesMut};
use ethereum_types::*;
use ethnum::U256;
use num_traits::Zero;
use serde::{
de::{self, Error},
Deserialize,
};
use std::{
borrow::Borrow,
fmt::{self, Formatter},
};
pub fn static_left_pad<const LEN: usize>(unpadded: &[u8]) -> [u8; LEN] {
assert!(unpadded.len() <= LEN);... |
use crate::*;
mod render_helper;
use render_helper::*;
use std::fmt;
struct DrawData {
width: f64,
height: f64,
padding: f64,
paddingy: f64,
}
struct ScaleData {
minx: f64,
maxx: f64,
miny: f64,
maxy: f64,
scalex: f64,
scaley: f64,
preserve_aspect: bool,
aspect_offset: ... |
use crossbeam::channel::unbounded;
use num_format::{ToFormattedString, Locale};
use tabled::Tabled;
use crate::{rules::{board::Board, pieces::movement::{Move, NullMove}}, util::concurrency::{pools::ThreadPool, tasks::Task}};
enum PerftType {
Size,
Captures,
EnPassants,
Castles,
Promotions,
Ch... |
use crate::{chip8_vm::*, debug::ImGuiWrapper, instructions::decode_opcode};
use ggez::{
event::{EventHandler, KeyCode, KeyMods, MouseButton},
graphics, Context, GameResult,
};
fn fetch_opcode(memory: &[u8], pc: u16) -> Result<u16, ()> {
if pc >= MEMORY_SIZE as u16 {
return Err(());
}
Ok((m... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{chain_watcher::ChainWatcherHandle, scripts::PackageRegistry, tx_applier::TxApplier};
use anyhow::{bail, Result};
use coerce_rt::actor::{context::ActorContext, message::Message, ActorRef};
use crate::{channel::channel_st... |
use {
crate::{HEADER_LENGTH, IP_ECHO_SERVER_RESPONSE_LENGTH},
log::*,
serde_derive::{Deserialize, Serialize},
analog_sdk::deserialize_utils::default_on_eof,
std::{
io,
net::{IpAddr, SocketAddr},
time::Duration,
},
tokio::{
io::{AsyncReadExt, AsyncWriteExt},
... |
use regex::{Captures, Regex};
fn main() {
let input = include_str!("input.txt");
let answer = part_one(input).expect("no solution for part one");
println!("part 1: {}", answer);
let answer = part_two(input).expect("no solution for part two");
println!("part 2: {}", answer);
}
#[derive(Debug, Par... |
use std::collections::HashMap;
use anyhow::Result;
use codespan::FileId;
use log::{debug, trace, warn};
use lsp_server::{
Connection, ErrorCode, Message, Notification, RequestId, Response, ResponseError,
};
use lsp_types::{
notification::Notification as _,
notification::{DidChangeTextDocument, DidOpenTextD... |
#![allow(clippy::single_match)]
#[cfg(not(target_arch = "wasm32"))]
fn main() {
use std::{collections::HashMap, sync::mpsc, thread, time::Duration};
use simple_logger::SimpleLogger;
use winit::{
dpi::{PhysicalPosition, PhysicalSize, Position, Size},
event::{ElementState, Event, KeyboardInp... |
use na::{DVector, Real, Unit, Vector3};
use std::ops::Range;
use crate::joint::JointConstraint;
use crate::math::{AngularVector, Point};
use crate::object::{BodyPartHandle, BodySet};
use crate::solver::helper;
use crate::solver::{ConstraintSet, GenericNonlinearConstraint, IntegrationParameters,
NonlinearC... |
use nom::IResult;
use crate::sym::Symbol;
use super::*;
// Just to assume the types are right.
const _ASSERT_TYPE: &[fn(&str) -> IResult<&str, Expr>] = &[
super::integer,
super::float_e,
super::symbol,
super::primitive,
super::pow,
super::negative,
super::product,
super::expr,
];
macro... |
use crate::prelude::types::Wei;
use crate::prelude::{Address, U256};
use crate::test_utils::{self, solidity};
use aurora_engine::transaction::legacy::TransactionLegacy;
use secp256k1::SecretKey;
use std::path::{Path, PathBuf};
use std::process::Command;
use std::sync::Once;
const INITIAL_BALANCE: Wei = Wei::new_u64(1_... |
#![allow(unused)]
use svm_gas::{
BlockNum, FuncIndex, FuncPrice, Function, Graph, NodeData, NodeLabel, PriceResolver, Program,
ProgramPricing, ProgramVisitor, CFG,
};
pub fn parse_wasm(wasm: &str) -> Program {
let wasm = wat::parse_str(wasm).unwrap();
svm_gas::read_program(&wasm).unwrap()
}
pub fn g... |
// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0
use crate::{
database::{execute_with_better_error, PgDbPool, PgPoolConnection},
indexer::{
errors::TransactionProcessingError, processing_result::ProcessingResult,
transaction_processor::TransactionProcessor,
},
models::{
... |
// Copyright 2021 <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 writ... |
// Copyright 2014 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 err_derive::Error;
use regex_syntax::{ast, hir};
use std::fmt;
mod private {
pub trait Sealed {}
}
pub struct Pattern {
pub hir: hir::Hir,
modifiers: Modifiers,
}
#[derive(Debug, Default)]
struct Modifiers {
// Passed to parser.
extended: bool,
// Passed to translator.
caseless: bool... |
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::parser::SelectorImpl;
use cssparser::ToCss;
use std::fmt;
#[derive(Clone, Eq, PartialEq, ToShmem)]
#[... |
// 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 {
async_trait::async_trait,
fidl_fuchsia_test::{
self as ftest, Invocation, Result_ as TestResult, RunListenerProxy, Status,
},
... |
//! NFLOG link layer encapsulation for PCAP
//!
//! Helper module to access content of data stored using NFLOG (239)
//! data link type.
//!
//! See <http://www.tcpdump.org/linktypes/LINKTYPE_NFLOG.html> for details.
use crate::data::{PacketData, ETHERTYPE_IPV4, ETHERTYPE_IPV6};
use nom::bytes::streaming::take;
use no... |
// Copyright (c) 2006 <NAME> <<EMAIL>>
// Copyright (c) 2018-2021 <NAME> <<EMAIL>>
//
// 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 t... |
impl Solution {
#[allow(clippy::needless_pass_by_value)]
#[must_use]
pub fn is_match(s: String, p: String) -> bool {
is_match(&s, &p)
}
}
enum SingleToken {
Wildcard,
Char(char),
}
enum Token {
SingleToken(SingleToken),
ZeroOrMore(SingleToken),
}
fn to_simple_token(c: char) -> ... |
use app::App;
use OptionLoaned;
use graphics::Sprite;
use math::{Transform, Vector};
use component::{Component, ComponentAny, Message};
use std::collections::BTreeMap;
use std::mem::replace;
use nphysics2d::object::{RigidBody, RigidBodyHandle};
/// GameObjects are the primary descriptor for things that are visible in ... |
use crate::na::{DMatrix, DVector};
use std::f64::EPSILON;
use std::io::Error;
use std::io::ErrorKind;
pub struct PolynomialRegression2D {
poly_order: usize,
pub num_coefficients: usize,
pub coefficients: Vec<[f64; 2]>,
pub residuals: Vec<f64>
}
impl PolynomialRegression2D {
pub fn new(
pol... |
extern crate wasm_bindgen;
extern crate web_sys;
use engine::board::*;
use engine::piece::Piece;
use log;
use PIECE_SIZE;
use SQUARE_SIZE;
use self::wasm_bindgen::prelude::*;
use self::web_sys::CanvasRenderingContext2d;
use engine::piece::Color;
static COLOR_1: &str = "#f4d9b0";
static COLOR_2: &str = "#bc865c";
sta... |
use crate::GeneralWordReg::Sp;
use crate::SegmentReg::{Cs, Ss};
use crate::{Cpu, GeneralByteReg, GeneralWordReg, SegmentReg, WordReg};
pub type System = firn_core::System<Cpu>;
pub trait ExtSystem {
fn mem_linear_8(&self, address: usize) -> u8;
fn mem_linear_16(&self, address: usize) -> u16;
fn linear_me... |
#[derive(Clone)]
pub struct Child {
pub element: rnix::SyntaxElement,
pub pos: crate::position::Position,
}
pub struct Children {
children: Vec<Child>,
current_index: usize,
}
impl Children {
pub fn new(
build_ctx: &crate::builder::BuildCtx,
node: &rnix::SyntaxNode,
) ... |
//! The Private Key.
use std::convert::TryFrom;
use std::fmt;
use std::str::FromStr;
use hex::{FromHex, ToHex};
use secp256k1::{Message, SecretKey};
use sha2::{Digest, Sha256};
use crate::error::Error;
use crate::signature::Signature;
/// Private key of Secp256k1.
#[derive(PartialEq, Hash, Clone)]
pub struct Privat... |
use std::{
ffi::CString,
fs,
mem::{self, MaybeUninit},
panic,
path::Path,
process, ptr,
};
use backtrace::Backtrace;
use fluid_parser::{Expression, Parser, Statement};
use llvm::{
core::*,
execution_engine::*,
prelude::*,
target_machine::*,
transforms::{scalar::*, util::*}... |
extern crate nom_sql;
extern crate rayon;
use ::ExtractedSql::InsertData;
use nom_sql::{
InsertStatement,
Literal,
parser,
parser::SqlQuery,
SqlQuery::CreateTable,
SqlQuery::Insert,
Table,
};
use nom_sql::Column;
use nom_sql::ColumnSpecification;
use nom_sql::CreateTableStatement;
use rayon... |
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::ty::is_type_diagnostic_item;
use clippy_utils::{is_refutable, peel_hir_pat_refs, recurse_or_patterns};
use rustc_errors::Applicability;
use rustc_hir::def::{CtorKind, DefKind, Res};
use rustc_hir::{Arm, Expr, PatKind, PathSegment, QPath, Ty, TyKind};
... |
// Copyright 2012-2014 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-MI... |
use super::graph::{Graph, SignalRef};
use crate::rand::Rand;
use std::cmp::min;
use std::error;
use std::fmt::{Debug, Display, Formatter, Result as FResult};
/// Parameters for instantiating a synthesizer program.
#[derive(Debug)]
pub struct Parameters {
/// Audio sample rate, samples per second.
pub sample_ra... |
// Copyright 2018 The Grin Developers
//
// 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... |
//! A universe is the container which `World`s exist inside.
use std::cmp::Ordering;
use std::collections::BTreeSet;
use std::sync::{Arc, atomic, RwLock};
use std::sync::atomic::AtomicU64;
use crate::{Archetype, EntityID};
use crate::archetype::{ComponentSet, ComponentSetExt, ComponentSliceSet};
/// A convenience ty... |
use std::{io::Write, str};
use bytes::Bytes;
use crate::{Error, Headers, Method, Status, StatusCode, Version};
#[derive(Debug, PartialEq, Clone)]
pub struct Response {
pub status: Status,
pub headers: Headers,
pub method: Method,
pub body: Bytes,
}
impl Response {
pub fn from_header(header: &[u8... |
#![no_main]
#![no_std]
#![allow(dead_code, unused_imports)]
use core::sync::atomic::{AtomicBool, Ordering};
use diegesis_fw::{Board, InternalReport, groundhog_nrf52::GlobalRollingTimer, pinmap::{PinMap, Leds}, profiler, saadc_src::SaadcSrc, spim_src::SpimSrc, time_ticks};
use nrf52840_hal::{
clocks::{Clocks, Ext... |
use yew::prelude::*;
use serde_json::{value::Value, error::Error, from_str, json};
use yew::format::Json;
use yew::services::{
fetch::{FetchService, Request, Response, FetchTask},
};
use serde_derive::{Deserialize, Serialize};
use yew::format::{Text};
use anyhow::{anyhow};
use crate::app::{Coin};
use crate::compone... |
use crate::secret_channel::{
storage_prefix_for_topic_pubkey, KeyPair, Peeler, PeelingReceiver, SecretMessageChannel,
};
use std::convert::TryFrom as _;
use std::fmt::Debug;
use crate::system::{TransactionError, TransactionResult};
use crate::types::{deopaque_query, OpaqueError, OpaqueQuery, OpaqueReply};
use anyh... |
use crate::error::HytError;
use core::convert::TryFrom;
#[cfg(feature = "i8f24")]
use fixed::types::I8F24;
/// A single measurement response.
///
/// This represents a reading of both temperature and humidity, plus some metadata. Accessors are
/// provided for all meaningful fields.
#[derive(Clone, Copy, Debug)]
pub ... |
use std::ffi::{OsStr, OsString};
use std::path::PathBuf;
use clap;
pub enum InputSpec {
File(PathBuf),
Stdin,
}
arg_enum!{
#[derive(Debug)]
pub enum UseColors { Always, Auto, Never }
}
arg_enum!{
#[derive(Debug)]
pub enum Preprocessor { Context, Ignore, Preserve }
}
arg_enum!{
#[derive(D... |
use std::marker::PhantomData;
use std::ops::{Add, AddAssign, Div};
use ego_tree::{NodeId, NodeMut, Tree};
use num_traits::{ToPrimitive, Zero};
use rand::{thread_rng, Rng};
use crate::aliases::{LazyMctsNode, LazyMctsTree};
use crate::mcts_node::MctsNode;
use crate::traits::{BackPropPolicy, GameTrait, LazyTreePolicy, P... |
//! Module for interacting with `config.toml` and `passwords.toml`.
use crate::crypto::*;
use crate::files::*;
use crate::generator::Generator;
use anyhow::{Context, Result};
use serde_derive::Serialize;
use std::collections::HashMap;
use std::io::Read;
use std::io::Write;
/// Struct for serializing passwords' file ... |
/// This module represents the session state of an MQTT communication session.
use crate::{warn, QoS};
use embedded_nal::IpAddr;
use heapless::{LinearMap, String, Vec};
use embedded_time::{
duration::{Extensions, Milliseconds, Seconds},
Instant,
};
/// The default duration to wait for a ping response from the... |
#[macro_use] extern crate serde_derive;
#[macro_use] extern crate slog;
#[macro_use] extern crate git_version;
use std::thread;
use std::sync::{Arc, Mutex};
use shared_str::ArcStr;
use chrono::{
prelude::*,
Duration,
};
use irc::client::prelude::{*, Config as IrcConfig};
use failure::Error;
use playbot::{Playb... |
//! A triple source produces triples, and may also fail in the process.
//!
//! The trait [`TripleSource`]
//! provides an API similar to (a subset of) the [`Iterator`] API,
//! with methods such as [`for_each_triple`] and [`try_for_each_triple`].
//!
//! # Rationale (or Why not simply use `Iterator`?)
//!
//! The [`It... |
extern crate itertools;
use itertools::Itertools;
use std::fs::File;
use std::io::BufRead;
use std::io::BufReader;
use std::path::Path;
use Hand::*;
#[derive(PartialEq, PartialOrd, Eq, Ord, Clone, Copy, Debug)]
struct Rank(u8);
fn make_rank(ch: char) -> Rank {
Rank(match ch {
'2'...'9' => (ch as u8) - (... |
#![allow(non_snake_case,non_camel_case_types,non_upper_case_globals,dead_code)]
use std::mem;
use libc::{c_void, c_char, c_int, c_ulong, wchar_t};
pub type BYTE = u8;
pub type WORD = u16;
pub type DWORD = c_ulong;
pub type BOOL = c_int;
pub type WCHAR = wchar_t;
pub type LPDWORD = *mut DWORD;
pub type LPVOID = *mut... |
use shell_escape::escape;
use std::ffi::OsStr;
use std::io;
use std::path::{Path, PathBuf};
use std::process::{self, Command};
use walkdir::WalkDir;
#[derive(Debug)]
pub enum CliError {
CommandFailed(String),
IoError(io::Error),
ProjectRootNotFound,
RustfmtNotInstalled,
WalkDirError(walkdir::Error)... |
use std::collections::HashMap;
use crate::domain::components::component::{Component, ComponentType};
use super::entities_repository::EntitiesRepository;
pub struct MemoryEntitiesRepository {
entities_components: HashMap<String, Vec<Box<dyn Component>>>,
entities_per_components: HashMap<ComponentType, Vec<St... |
use failure::{Error, Fail};
use select::document::Document;
use select::predicate::{Attr, Class, Name, Predicate};
use crate::html::escape;
use crate::types::*;
#[derive(Debug, Fail)]
pub enum ParseCrateOfWeekError {
#[fail(display = "p not found")]
ParagraphNotFound,
#[fail(display = "link is not found"... |
use {
serde::{Deserialize, Serialize},
solana_frozen_abi_macro::{AbiEnumVisitor, AbiExample},
solana_sdk::{clock::Slot, instruction::InstructionError, pubkey::Pubkey},
std::borrow::Cow,
};
/// The maximum number of addresses that a lookup table can hold
pub const LOOKUP_TABLE_MAX_ADDRESSES: usize = 256... |
use crate::okta::auth::LoginRequest;
use std::collections::HashSet;
use std::sync::Arc;
use anyhow::{anyhow, Result};
use backoff::future::retry;
use backoff::ExponentialBackoff;
use dialoguer::Password;
use reqwest::cookie::Jar;
use reqwest::header::{HeaderValue, ACCEPT};
use reqwest::Response;
use reqwest::{Client ... |
// Copyright 2019, 2020 Wingchain
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to... |
use std::collections::{HashMap, BinaryHeap};
use std::cmp::Reverse;
use rustler::{Env, Encoder, Term, NifResult, Error};
rustler::init!("util", [sort_ints, mean_nif, median_nif, calculate_fuel, dijkstra]);
#[rustler::nif]
fn sort_ints<'a>(env: Env<'a>, term: Term) -> NifResult<Term<'a>> {
if let Ok(mut i) = term.... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
//! This module defines the control-flow graph uses for bytecode verification.
use std::{
collections::{BTreeMap, BTreeSet},
marker::Sized,
result::Result,
};
use vm::{
errors::VMStaticViolation,
file_format::{Bytec... |
use crate::config::processing_loop::ProcessingLoop;
use crate::sql::{SqlQueryContext, SqlService};
use crate::table::TableValue;
use crate::util::time_span::warn_long;
use crate::{metastore, CubeError};
use async_trait::async_trait;
use hex::ToHex;
use log::{error, info, warn};
use msql_srv::*;
use std::io;
use std::sy... |
// https://atcoder.jp/contests/apg4b/tasks/apg4b_cj
#![allow(unused_macros, dead_code, unused_variables, non_upper_case_globals)]
use std::io::{Read, Write};
use reader::Reader;
use writer::Writer;
#[macro_use]
pub mod reader {
use std::io::{BufRead, BufReader, Read};
use std::iter::Peekable;
use std::mem... |
use memflow::connector::*;
use memflow::mem::*;
use memflow_win32::error::{Error, Result};
use memflow_win32::win32::{Kernel, Win32ModuleInfo, Win32Process};
use clap::*;
use log::Level;
use colored::*;
static mut HAD_ERROR: bool = false;
fn main() -> Result<()> {
let (connector, args_str) = parse_args();
... |
type RepoState = git2::RepositoryState;
pub type R<T> = Result<T, String>;
#[derive(Clone, Debug, PartialEq)]
pub struct RepoStatus {
// the branch might not be known, when the repo does not have any commits
pub branch: Option<String>,
pub state: RepoState,
}
#[derive(Clone, Debug, Default)]
pub struct Br... |
use nannou::draw::Draw;
use nannou::noise::{NoiseFn, Perlin};
use nannou::prelude::*;
use std::fmt::{self, Display, Formatter};
pub use super::meander;
pub use super::Line2;
#[derive(Debug)]
pub struct Blob {
pub x: f32,
pub y: f32,
noise_scale: f32,
width: f32,
height: f32,
seed: f32,
// this is a jank... |
use crate::{
self as pallet_dutch_auction,
mock::currency::{CurrencyId, NativeAssetId},
weights::SubstrateWeight,
};
use composable_traits::defi::DeFiComposableConfig;
use frame_support::{
ord_parameter_types, parameter_types,
traits::Everything,
weights::{WeightToFeeCoefficient, WeightToFeeCoefficients, WeightT... |
// 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::prelude_internal::*;
use crate::spinel::Subnet;
use anyhow::Error;
use async_trait::async_trait;
use futures::stream::BoxStream;
#[allow(dead_c... |
use async_std::task;
use ggez::conf::{WindowMode, WindowSetup};
use ggez::event;
use ggez::event::{EventHandler, MouseButton};
use ggez::graphics::{self, Color};
use ggez::{Context, ContextBuilder, GameResult};
use std::sync::{Arc, Mutex};
use yorool_gui2::button::ButtonMode::{Checkbox, PressButton, Radio};
use yorool_... |
use std::iter;
use itertools::Itertools;
use plonky2_field::extension_field::Extendable;
use plonky2_field::field_types::Field;
use plonky2_util::ceil_div_usize;
use crate::hash::hash_types::RichField;
use crate::iop::ext_target::ExtensionTarget;
use crate::plonk::circuit_builder::CircuitBuilder;
pub(crate) fn quoti... |
use super::ast::{ASTProperty, ASTTuple, AST};
use doc::{
inference::{ArrayShape, ObjShape, Provenance, Shape},
SchemaIndex,
};
use json::schema::types;
use regex::Regex;
use std::collections::BTreeMap;
pub struct Mapper<'a> {
pub index: &'a SchemaIndex<'a>,
pub top_level: BTreeMap<&'a url::Url, &'a str... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.