text stringlengths 3.09k 13.9k |
|---|
use crate::input::Input;
use std::collections::{BTreeSet, HashMap, HashSet, VecDeque};
use std::error::Error;
type Position = (usize, usize);
fn surrounding_positions((x, y): Position) -> Vec<Position> {
let mut surroundings = vec![(x + 1, y), (x, y + 1)];
if x > 0 {
surroundings.push((x - 1, y));
... |
//! Metadata tags.
use std::borrow::Cow;
use std::convert::TryFrom;
use std::error::Error;
use std::fmt;
use mpd_protocol::command::Argument;
/// Tags which can be set on a [`Song`].
///
/// MusicBrainz tags are named differently from how they appear in the protocol to better reflect
/// their actual purpose.
///
//... |
// Traits
pub use crate::traits::{Configurable, Plotable, Saveable};
use core::fmt::Display;
use core::ops::Add;
/// Compare various ``Sequence``s.
pub mod comparison;
pub use comparison::SequenceBins;
/// Sequence of histograms normalize to represent a probability density function through bins.
///
/// To renormali... |
use std::io::{Read};
use std::fs::File;
use std::collections::{HashSet, LinkedList};
#[derive(Debug)]
struct Instruction {
opcode : i32,
mode1 : i32,
mode2 : i32,
mode3 : i32,
}
fn decode (i : i32) -> Instruction {
let mut i = i;
let opcode = i % 100;
i /= 100;
let mode1... |
// 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... |
use std::collections::HashMap;
use std::convert::TryFrom;
use std::io::{self, BufRead};
use std::num::ParseIntError;
type Address = u64;
type Value = u64;
#[derive(Debug, PartialEq)]
struct Decoder {
one_mask: Address,
fluctuating_bits: Vec<usize>,
}
impl Default for Decoder {
fn default() -> Self {
... |
use crate::filesystems;
use crate::kprintln;
use crate::memory::{
self,
address::{VirtualAddress},
physical,
virt::{
page_directory::{CurrentPageDirectory, PageDirectory, PermissionFlags},
region::{MemoryRegionType, Permissions},
},
};
use crate::process;
use super::stack::StackFrame;
use super::sysca... |
//! Channel based `TokenStream`
use std::borrow::Borrow;
use crate::int_stream::{IntStream, IterWrapper, EOF};
use crate::token::{Token, TOKEN_DEFAULT_CHANNEL, TOKEN_INVALID_TYPE};
use crate::token_factory::TokenFactory;
use crate::token_source::TokenSource;
use crate::token_stream::{TokenStream, UnbufferedTokenStream... |
// The MIT License (MIT)
//
// Copyright (c) 2018 AT&T. All other rights reserved.
//
// 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 ... |
//! A set of quirks, not necessarily specific to a checker
use crate::Range;
use fancy_regex::Regex;
use log::{trace, warn};
/// Returns `true` iff the replacements contains a variant of `word` without dashes.
pub(crate) fn replacements_contain_dashless<T: AsRef<str>>(word: &str, replacements: &[T]) -> bool {
let... |
use std::collections::VecDeque;
use std::time::Instant;
use bytes::{Bytes, BytesMut};
use crate::packet::{DataEncryption, PacketLocation};
use crate::protocol::{TimeBase, TimeStamp};
use crate::{
crypto::CryptoManager, ConnectionSettings, DataPacket, MsgNumber, SeqNumber, SocketId,
};
#[derive(Debug)]
pub struct... |
use crate::lowlevel::FXOSC;
pub const fn from_frequency(hz: u64) -> (u8, u8, u8) {
let freq = hz * 1u64.rotate_left(16) / FXOSC;
let freq0 = (freq & 0xff) as u8;
let freq1 = ((freq >> 8) & 0xff) as u8;
let freq2 = ((freq >> 16) & 0xff) as u8;
(freq0, freq1, freq2)
}
pub const fn from_deviation(v: ... |
use crate::cairo::lang::compiler::instruction::{
decode_instruction_values, ApUpdate, FpUpdate, Instruction, Op1Addr, Opcode, PcUpdate,
Register, Res, OFFSET_BITS,
};
use num_bigint::BigInt;
const DST_REG_BIT: u32 = 0;
const OP0_REG_BIT: u32 = 1;
const OP1_IMM_BIT: u32 = 2;
const OP1_FP_BIT: u32 = 3;
const OP... |
use crate::model::OwnedNamedOrBlankNode;
use crate::utils::*;
use quick_xml::events::*;
use quick_xml::Writer;
use rio_api::formatter::TriplesFormatter;
use rio_api::model::*;
use std::io;
use std::io::Write;
/// A [RDF XML](https://www.w3.org/TR/rdf-syntax-grammar/) formatter.
///
/// It implements the `TriplesFormat... |
// Copyright Kamu Data, Inc. and contributors. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by th... |
use std::rc::Rc;
use cgmath::BaseFloat as SpacialKey;
use super::{AABB2, Intersect, Intersection, Circle};
use cgmath::Point2 as Pnt2;
pub trait SpacialIndex {
fn get_position<T: SpacialKey>(&self) -> Pnt2<T>;
}
#[derive(Debug)]
pub struct QuadTree<S, T> where T: SpacialIndex + Sized, S: SpacialKey {
bucket: V... |
//! A transport that multiplexes requests.
use std::io;
use std::time::Duration;
use futures::{Async, AsyncSink, Future, Poll, Stream};
use tokio_core::reactor;
use super::super::channel::Channel;
use super::super::conf::ServerConf;
use super::super::request::{RequestReceiver, TransportRequest};
use super::pending::Pe... |
use std::error::Error;
use std::fs;
use std::lazy::SyncLazy;
use std::process::exit;
use std::time::Duration;
use tokio::sync::Mutex;
use crate::error::{error_webhook, NewsError};
use crate::json::recent::Recent;
use crate::scrapers::html_processing::html_processor;
use crate::scrapers::scraper_resources::resources::... |
// This file is part of Substrate.
// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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
//
// ht... |
use std::{
fmt::Display,
io::{Write, Stdout}
};
use super::draw_promt;
use crossterm::{
cursor::{self, SavePosition, RestorePosition, MoveToNextLine, MoveTo, MoveToPreviousLine, MoveRight},
terminal::{enable_raw_mode, disable_raw_mode, Clear, ClearType},
style::{SetAttribute, Attribute, SetForegro... |
use std::{
fmt, fs, io,
path::{Path, PathBuf},
process::{self, exit},
sync::mpsc::Sender,
time::Instant,
};
use crate::{color::Color::*, files::TestResult};
#[macro_use]
mod color;
mod files;
mod fuzzer;
mod timeout;
struct Args {
include_ignored: bool,
filter: String,
fuzz_ranges: b... |
//! A library to help grow the stack when it runs out of space.
//!
//! This is an implementation of manually instrumented segmented stacks where
//! points in a program's control flow are annotated with "maybe grow the stack
//! here". Each point of annotation indicates how far away from the end of the
//! stack it's ... |
use crate::chain::Coordinate;
use crate::config::Config;
use crate::monitor::{MonitorEvent, State};
use crate::node::Status;
use futures::{SinkExt, StreamExt};
use serde::Serialize;
use std::net::SocketAddr;
use std::sync::Arc;
use warp::filters::ws::Message;
use warp::Filter;
#[derive(Serialize)]
struct NodeResponse ... |
use core::mem::{self, MaybeUninit};
const KERNEL_RING: u8 = 0;
const USERLAND_RING: u8 = 3;
pub const KERNEL_CODE_SEG: Segment = Segment::kernel(1);
const KERNEL_DATA_SEG: Segment = Segment::kernel(2);
const USER_CODE_SEG: Segment = Segment::userland(3);
const USER_DATA_SEG: Segment = Segment::userland(4);
const MAX... |
use std::env;
use chrono::prelude::*;
use hls_m3u8::MasterPlaylist;
use rand::{rngs::SmallRng, Rng, SeedableRng};
use regex::Regex;
use std::{
convert::TryFrom,
time::{SystemTime, UNIX_EPOCH},
};
use stream_lib::StreamType;
use crate::utils::error::RsgetError;
use crate::utils::error::StreamError;
use crate... |
use crate::preamble::*;
use mediawiki_parser::transformations::*;
use mediawiki_parser::*;
use mfnf_sitemap::{Markers, Subtarget};
fn remove_exclusions_vec<'a>(
trans: &TFuncInplace<&'a Markers>,
root_content: &mut Vec<Element>,
markers: &'a Markers,
) -> TListResult {
let mut result = vec![];
let ... |
use crate::primitives::UnitVec3;
use crate::scene::scenemap::material::MaterialIndex;
use crate::scene::scenemap::sdf::Sdf;
use crate::{Point3, Vec3};
use itertools::FoldWhile::{Continue, Done};
use itertools::Itertools;
pub struct Ray {
origin: Point3,
direction: UnitVec3,
}
impl Ray {
pub fn new(origin:... |
#![crate_type = "dylib"]
use std::io::Cursor;
use brickadia::read::SaveReader;
use image::GenericImageView;
use intercom::{prelude::*, raw::HRESULT};
mod registry;
mod winstream;
use winstream::WinStream;
mod bindings;
use bindings::{
Windows::Win32::Foundation::WINCODEC_ERR_WRONGSTATE,
Windows::Win32::Gra... |
use std::fmt::{self, Debug};
use async_trait::async_trait;
use cast_trait_object::dyn_upcast;
use crate::graph::shape::{SinkShape, SourceShape};
use crate::graph::{stage, Inlet, Outlet, Port, Stage, PORT_DATA};
use crate::{AppData, ProctorResult, SharedString};
/// Transform this stream by applying the given functio... |
//! The `cargo rpm init` subcommand
use crate::{
builder::RPM_CONFIG_DIR,
config::{self, PackageConfig, CARGO_CONFIG_FILE},
error::Error,
prelude::*,
target::TargetType,
templates::{ServiceParams, SpecParams},
};
use abscissa_core::Command;
use std::{
fs::{self, File, OpenOptions},
io::... |
use std::ops::*;
pub trait Zero: Sized + Add<Self, Output = Self> {
const ZERO: Self;
}
macro_rules! impl_zero {
($t:ty, $val:expr) => {
impl Zero for $t {
const ZERO: Self = $val;
}
};
}
impl_zero!(i8, 0i8);
impl_zero!(i16, 0i16);
impl_zero!(i32, 0i32);
impl_zero!(i64, 0i64);... |
use std::env;
use std::ffi::OsStr;
use std::fmt;
use std::fs;
use std::path::{Path, PathBuf};
trait PathExt {
fn with_stem(&self, stem: impl AsRef<OsStr>) -> PathBuf;
fn rename(&self, to: impl AsRef<Path>) -> Result<(), Error>;
}
impl PathExt for Path {
/// Creates an owned `PathBuf` like `self` but with ... |
//! Pass to unshare registers by analyzing the live ranges of values stored
//! within them.
use crate::analysis::reaching_defns::{
GroupOrInvoke, ReachingDefinitionAnalysis,
};
use crate::ir::traversal::{Action, Named, VisResult, Visitor};
use crate::ir::{self, Builder, Cell, CloneName, LibrarySignatures, RRC};
us... |
extern crate cryptopals;
use cryptopals::block_ciphers::AESBlockMode;
use num_bigint::{BigUint, ToBigUint};
/*
In this attack, in comparison to the previous, we only modify traffic going to Bob
1) we modify the 'g' sent to Bob - which makes bob generate eg. 0 as pubkey (which causes
Alices shared key to ... |
use crate::pico::*;
use crate::sketch::*;
use std::cell::RefCell;
use std::cmp;
pub struct Erase2 {
pub last_mouse: Option<Point>,
pub radius: i32,
pub count: u32,
}
impl Sketch for Erase2 {
fn new() -> Erase2 {
set_dimensions(1024, 1024);
set_target(0);
cls(0);
set_ta... |
use crate::stream::Stream;
use std::fmt;
use std::io::{self, copy, empty, Cursor, Read, Write};
#[cfg(feature = "charset")]
use crate::response::DEFAULT_CHARACTER_SET;
#[cfg(feature = "charset")]
use encoding::label::encoding_from_whatwg_label;
#[cfg(feature = "charset")]
use encoding::EncoderTrap;
#[cfg(feature = "j... |
// Copyright 2012-2013 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... |
#[macro_use]
extern crate log;
extern crate xswag_base as base;
extern crate lalrpop_util;
pub mod lex;
pub mod ast;
pub mod grammar;
use base::diag::{Remark, Report, Snippet};
use base::code::{BytePos, FileMap, Span};
use lalrpop_util::ParseError;
use lex::{Token, TokenSpan};
use std::cell::RefCell;
use ast::ItemExt... |
#![no_std]
#![feature(maybe_uninit_uninit_array)]
//! This crate implements Storage SDK API for SVM.
//! Using this crate when writing SVM Templates in Rust isn't mandatory but should be very useful.
//!
//! The crate is compiled with `![no_std]` (no Rust stdlib) annotation in order to reduce the compiled WASM size.
... |
// BEGIN - Embark standard lints v0.3
// do not change or add/remove here, but one can add exceptions after this section
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
#![deny(unsafe_code)]
#![warn(
clippy::all,
clippy::await_holding_lock,
clippy::dbg_macro,
clippy::de... |
use std::{
collections::{BTreeMap, HashSet},
string::String,
};
use crate::*;
use super::items::PlotItem;
/// Where to place the plot legend.
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Corner {
LeftTop,
RightTop,
LeftBottom,
RightBottom,
}
impl Corner {
pub fn all() -> impl Iterat... |
use crate::{ClientGuid, Dialect};
use bitflags::bitflags;
use nom::*;
use num_derive::FromPrimitive;
use num_traits::FromPrimitive;
const REQUEST_STRUCTURE_SIZE: u16 = 36;
#[cfg_attr(debug_assertions, derive(Debug))]
pub struct Request<'a> {
pub signing_required: bool,
pub capabilities: Capabilities,
pub ... |
use std::env;
use std::fs::File;
use std::io;
use std::io::prelude::*;
use std::str;
mod day1;
mod day10;
mod day11;
mod day12;
mod day13;
mod day14;
mod day15;
mod day16;
mod day17;
mod day18;
mod day19;
mod day2;
mod day20;
mod day21;
mod day22;
mod day23;
mod day24;
mod day25;
mod day3;
mod day4;
mod day5;
mod day6... |
use super::bitmask::BitMask;
use super::EMPTY;
use core::mem;
#[cfg(target_arch = "x86")]
use core::arch::x86;
#[cfg(target_arch = "x86_64")]
use core::arch::x86_64 as x86;
pub type BitMaskWord = u16;
pub const BITMASK_STRIDE: usize = 1;
pub const BITMASK_MASK: BitMaskWord = 0xffff;
/// Abstraction over a group of c... |
// Copyright 2017 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... |
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use anyhow::{format_err, Error};
use fuchsia_component::client::connect_to_protocol;
use fuchsia_zircon::{Status, Vmo};
use parking_lot::{RwLock, RwLockUpg... |
use core::panic;
use std::time::Instant;
use bytesize::ByteSize;
use clap::Parser;
use futures::future;
use itertools::Itertools;
use rand::{Rng, SeedableRng};
use rand_chacha::ChaCha8Rng;
use runkv_common::prometheus::DefaultPrometheusExporter;
use runkv_storage::raft_log_store::entry::RaftLogBatchBuilder;
use runkv_... |
use crate::errors::{ParsingError, Result};
/// Try to parse the given array of bytes into an f64, by first converting
/// it to the corresponding ASCII (or even here, UTF-8) values.
pub fn parse_f64(value : &[u8]) -> Result<f64> {
let res = std::str::from_utf8(value)?;
let res_f64 = res.parse::<f64>()?;
Ok... |
// The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org/
//
// contributed by the Rust Project Developers
// contributed by <NAME> (@cristicbz)
// contributed by TeXitoi
extern crate futures;
extern crate futures_cpupool;
extern crate ordermap;
use std::sync::Arc;
use std::hash::{Hasher, B... |
// Copyright 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... |
#![no_std]
extern crate alloc;
#[macro_use] extern crate log;
#[macro_use] extern crate lazy_static;
extern crate spin;
extern crate memory;
extern crate volatile;
extern crate atomic_linked_list;
extern crate owning_ref;
use core::ops::DerefMut;
use alloc::boxed::Box;
use spin::{Mutex, MutexGuard};
use volatile::{... |
use env;
use std::path::PathBuf;
/// Jenkins CI
///
/// # References
///
/// - <https://wiki.jenkins.io/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-belowJenkinsSetEnvironmentVariables>
/// - <https://github.com/codecov/codecov-bash/blob/8b76995ad4a95a61cecd4b049a448a402d91d197/codecov#L430-L46... |
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use fidl::endpoints::Proxy;
use fidl_fuchsia_io as fio;
use io_util::directory;
use std::ffi::CString;
use std::sync::Arc;
use crate::fs::fuchsia::RemoteF... |
// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0
use crate::{
access_path::Path,
account_address::AccountAddress,
account_config::{AccountResource, CoinStoreResource},
account_view::AccountView,
state_store::{state_key::StateKey, state_value::StateValue},
};
use anyhow::{anyhow, Error,... |
struct UBigInt {
s: Vec<i32>
}
impl UBigInt {
const BASE: i32 = 1000000000;
const WIDTH: usize = 9;
const fn new() -> UBigInt {
UBigInt {
s: Vec::new()
}
}
fn from_string(str: &str) -> UBigInt {
let mut s = Vec::new();
let mut len = str.len();
... |
use std::{
time,
error,
fmt
};
use std::sync::Arc;
use std::time::SystemTime;
use tokio::time::delay_for;
use tokio::sync::Mutex;
use crate::proto::{
Player,
Vector3,
};
use crate::proto::game_progress::Status as ProtoGameStatus;
use crate::players::Players;
use crate::objects::Objects;
use crat... |
//! Definition of the `TryJoinAll` combinator, waiting for all of a list of
//! futures to finish with either success or error.
use alloc::boxed::Box;
use alloc::vec::Vec;
use core::fmt;
use core::future::Future;
use core::iter::FromIterator;
use core::mem;
use core::pin::Pin;
use core::task::{Context, Poll};
use sup... |
use std::{ops::Index, sync::Arc};
use either::Either;
use la_arena::{Arena, Idx};
use rustc_hash::FxHashMap;
use crate::{
db::{DefDatabase, DefWithBodyId},
expr::{ExprId, Statement, StatementId},
module_data::Name,
};
use super::{BindingId, Body};
pub type ScopeId = Idx<ScopeData>;
#[derive(Debug, Part... |
use apt_sources_lists::*;
use dist::{REQUIRED_DIST_FILES, update::{Updater, DistUpdateError}};
use futures::{self, Future, future::lazy};
use keyring::AptKeyring;
use reqwest::{self, async::{Client, Response}};
use std::{collections::HashSet, io};
use tokio::{self, prelude::future::*};
use std::sync::Arc;
use tokio::r... |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
use std::collections::{HashMap, HashSet};
use std::hash::Hash;
use std::fmt::Debug;
use std::io::Write;
#[derive(Debug, Copy, Clone)]
pub enum Gram<I> {
Orig(I),
Composition(usize, usize),
}
// Retuns the tokenized text, along with a list of decompositions
pub fn encode_into_ngrams<I: Debug + Copy + Eq + Has... |
use std::ffi::CString;
use std::sync::atomic::Ordering;
use crossbeam_channel::unbounded;
use rocketmq_client_sys::*;
use crate::consumer::MessageModel;
use crate::consumer::push::error::PushConsumerError;
use crate::consumer::push::PushConsumer;
use crate::LogLevel;
use crate::message::ext::MessageExtPtr;
use supe... |
use core::convert::TryFrom;
use crate::{
loan_terms::Duration, AddressId, Blockchain, Config, ExternalAmount, OfferId, TransferId,
};
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::weights::Weight;
use frame_support::{generate_storage_alias, traits::Get};
use frame_support::{Identity, Twox64Concat};
u... |
//! Signature for authenticity of data
use crate::Bytes;
use holo_hash::AgentPubKey;
use holochain_serialized_bytes::prelude::*;
/// Ed25519 signatures are always the same length, 64 bytes.
pub const SIGNATURE_BYTES: usize = 64;
/// Input structure for creating a signature.
#[derive(Debug, PartialEq, Serialize, Deser... |
use crate::alloc;
use alloc::Alloc;
use libc::c_char;
use log::*;
use solana_rbpf::{
ebpf::{HelperObject, MM_HEAP_START},
memory_region::{translate_addr, MemoryRegion},
EbpfVm,
};
use std::{
alloc::Layout,
ffi::CStr,
io::{Error, ErrorKind},
mem::align_of,
slice::from_raw_parts,
str::... |
use crate::connection_properties::ConnectionProperties;
use std::fs::File;
use std::net::UdpSocket;
use std::collections::BTreeMap;
use crate::sender::config::Config;
use std::time::{Instant, Duration};
use std::io::Read;
use crate::packet::{Packet, DataPacket, PacketHeader};
use std::num::Wrapping;
use std::cmp::min;
... |
extern crate ring;
extern crate simple_logger;
use mysql::packets;
use mysql::packets::handshake::AuthPlugin;
use std::convert::From;
use std::fmt::{Display, Formatter};
use {ConnectionInfo};
pub enum SupportedAuthMethods {
Unknown,
MySQLOldPassword,
MySQLNativePassword
}
pub struct Authen... |
#[macro_use]
extern crate quote;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate syn;
extern crate treexml;
pub mod mavlink;
use std::fs::File;
use std::io::BufReader;
use std::io::{Read, Write};
use std::path::Path;
use treexml::{Document, Element};
use serde_json::... |
// Copyright (c) 2021, <NAME>, <NAME> 10, bus 2452, B-3001 Leuven-Heverlee, Belgium.
// Copyright (c) 2021, Cosmian Tech SAS, 53-55 rue La Boétie, Paris, France.
use scale_binaries::*;
use std::{
ffi::CString,
os::raw::{c_int, c_uint},
ptr,
};
use structopt::StructOpt;
#[derive(StructOpt, Debug)]
struct ... |
use super::smp::Smp;
use super::dsp::dsp::Dsp;
use super::timer::Timer;
use super::spc::spc::{Spc, RAM_LEN, IPL_ROM_LEN};
static DEFAULT_IPL_ROM: [u8; IPL_ROM_LEN] = [
0xcd, 0xef, 0xbd, 0xe8, 0x00, 0xc6, 0x1d, 0xd0,
0xfc, 0x8f, 0xaa, 0xf4, 0x8f, 0xbb, 0xf5, 0x78,
0xcc, 0xf4, 0xd0, 0xfb, 0x2f, 0x19, 0xeb, 0... |
//! InvUniq uuid-like identifier, using base58 alphabet.
use once_cell::sync::Lazy;
use std::sync::Arc;
/// InvUniq uuid-like identifier, using base58 alphabet.
#[derive(
Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
serde::Serialize,
serde::Deserialize,
)]
pub struct InvUniq(Arc<str>);... |
use super::{
vk_format,
vk_format_aspect_mask,
Device,
DeviceAllocation,
};
use crate::{
Format,
MemoryType,
Result,
TextureUsage,
};
use ash::version::DeviceV1_0;
use ash::vk;
use std::sync::Arc;
// TODO: Do mip mapping
pub struct Texture {
pub owner: Arc<Device>,
pub image: vk::Image,
pub view: vk::Ima... |
//! Genealogy of a population.
//!
//! Describes ancestors of a group of individuals until they meet in the first
//! common ancestor of the group in a distant past. Usually coming from a realization of
//! the coalescent process.
//!
// Structs
use partitions::PartitionVec;
use petgraph::Graph;
use std::collectio... |
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
// This file is part of Open Ethereum.
// Open 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 your o... |
//! Defines the `pre` attribute and how it is handled.
use proc_macro2::{Span, TokenStream};
use proc_macro_error::{emit_error, emit_warning};
use quote::{quote, quote_spanned};
use syn::{
parse::{Parse, ParseStream},
parse2,
spanned::Spanned,
visit_mut::{
visit_expr_mut, visit_file_mut, visit_... |
use crate::bounding_box::BoundingBox;
use crate::intersection::Intersection;
use crate::ray::Ray;
use crate::shape::base_shape::BaseShape;
use crate::shape::shape::Shape;
use crate::tuple::Tuple;
#[derive(Debug, Clone)]
pub struct Triangle {
base: BaseShape,
pub p1: Tuple,
pub p2: Tuple,
pub p3: Tuple,... |
//! github client library for fetching content from Github
//!
use crate::{Error, Result};
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use serde_json::json;
const GITHUB_ENDPOINT: &str = "https://api.github.com";
const GH_USER_AGENT: &str = "mdsite";
/// Response from Github list-tree
#[derive(Debug, D... |
use super::*;
use structopt::StructOpt;
const HOST_ENV: &'static str = "CTRL_HOST";
const PORT_ENV: &'static str = "CTRL_PORT";
const TLS_OFF_ENV: &'static str = "CTRL_TLS_OFF";
const DEFAULT_HOST: &'static str = "tunnelto.dev";
const DEFAULT_CONTROL_HOST: &'static str = "wormhole.tunnelto.dev";
const DEFAULT_CONTROL... |
//! Raw, *unvalidated*, zone pointers.
use std::alloc::Layout;
use std::any::type_name;
use std::cmp;
use std::fmt;
use std::hash;
use std::mem;
use thiserror::Error;
use crate::coerce::TryCoerce;
use crate::pointee::Pointee;
use crate::marshal::*;
use crate::marshal::blob::*;
use crate::marshal::decode::*;
use cra... |
// Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
use crate::naming::Naming;
use crate::parsing_error::ParsingError;
use crate::special_names::SpecialNames;
use aast_parser::{AastParser,... |
use std::{
borrow::Cow,
collections::{HashMap, HashSet},
fs,
};
use super::*;
use crate::*;
///Removes all comments from the source code.
/// Recursive multiline comments are treated properly.
pub fn remove_comments(s: &str) -> Cow<str> {
let cow_str = Cow::Borrowed(s);
let no_multilines = remove_multiline_comme... |
use super::*;
use tcod::colors::{self, Color};
use crate::r#const::*;
use crate::types::object::Object;
use crate::types::slot::Slot;
use crate::types::Map;
use crate::types::rect::Rect;
use crate::types::tile::Tile;
use rand::Rng;
use rand::distributions::{Weighted, WeightedChoice, IndependentSample};
use std::cmp;
... |
// Copyright 2021 - <NAME> <<EMAIL>>
// SPDX-License-Identifier: Apache-2.0
use config::defaults::DENOM;
use cosmwasm_std::{StdResult, Storage, Uint128};
use cw_storage_plus::{Index, IndexList, IndexedMap, Map, UniqueIndex};
use mixnet_contract_common::{Addr, Coin, IdentityKeyRef, Layer, MixNode, MixNodeBond};
use ser... |
use primes::{factors_uniq, is_prime};
use std::{
sync::{Arc, Mutex},
thread,
};
fn main() {
let input = 34_000_000;
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!("p... |
//! # Sampler
use crate::api;
/// Sampling options
#[derive(Clone, Debug)]
pub enum Sampler {
/// Always sample the trace
Always,
/// Never sample the trace
Never,
/// Sample if the parent span is sampled
Parent,
/// Sample a given fraction of traces. Fractions >= 1 will always sample. If t... |
// Copyright 2021. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
use anyhow::{Context, Result};
use crate::storage;
use crate::transaction;
use crate::util;
use crate::msg;
use crate::msgmacros::*;
macro_rules! respond {
($writer: expr, $id: expr, $data: expr) => (
$writer.write_all(&response!($id, $data))
.context("send response")?
)
}
macro_rules! e... |
use gears::glam::Vec3;
use super::{point_to_index, shader, DEPTH, HEIGHT, WIDTH};
enum Lighting {
Top,
Bottom,
X,
Z,
}
impl Lighting {
fn to_exposure(&self) -> f32 {
match self {
Self::Top => 1.0,
Self::Z => 0.75,
Self::X => 0.5,
Self::Botto... |
// Creating a default reflection database implicitly doesn't really make sense
// for most cases.
#![allow(clippy::new_without_default)]
use std::{
borrow::Cow,
collections::{HashMap, HashSet},
};
use rbx_types::{Variant, VariantType};
use serde::{Deserialize, Serialize};
use crate::{ClassTag, PropertyTag};
... |
use httpdate::parse_http_date;
use std::time::{Duration, SystemTime};
use crate::protocol::EnvelopeItem;
use crate::Envelope;
/// A Utility that helps with rate limiting sentry requests.
#[derive(Debug, Default)]
pub struct RateLimiter {
global: Option<SystemTime>,
error: Option<SystemTime>,
session: Opti... |
// Copyright 2022 pyke.io
// 2019-2021 Tauri Programme within The Commons Conservancy
// [https://tauri.studio/]
//
// 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... |
use flo_canvas::*;
pub const DEFAULT_TEXT: Color = Color::Rgba(0.85, 0.95, 0.9, 1.0);
pub const MAIN_BACKGROUND: Color = Color::Rgba(0.25, 0.25, 0.25, 1.0);
pub const CANVAS_BACKGROUND: Color = Color::Rgba(0.25, 0.25, 0.25, 1.0);
pub const TIMELINE_BACKGROUND: ... |
use fs_extra::error::Error as FseError;
use fs_extra::error::ErrorKind as FseErrorKind;
use std::error::Error as StdError;
use std::fmt;
use std::io::Error as IoError;
use std::io::ErrorKind as IoErrorKind;
use std::path::PathBuf;
/// A list specifying general categories of fs_pro error.
#[derive(Debug)]
pub enum Erro... |
use crate::hash::blake2b_160;
use bech32::{FromBase32, ToBase32};
use tcx_chain::{Address, Result};
use tcx_constants::CoinInfo;
use tcx_primitive::TypedPublicKey;
// TYPE should be u5
static TYPE_FULL_DATA: u8 = 2u8;
static TYPE_FULL_TYPE: u8 = 4u8;
static TYPE_SHORT: u8 = 1u8;
pub struct CkbAddress();
impl Address... |
use crate::input::Input;
use crate::message::*;
use crate::world::*;
use crate::{netw_general, verification};
use ::rand::Rng;
use futures::stream::StreamExt;
use macroquad::prelude::*;
pub async fn server_loop() {
let mut world = new_world();
let (world_watch_sender, world_watch_recver) = tokio::sync::watch:... |
#[warn(non_snake_case)]
#[warn(dead_code)]
#[warn(unused_must_use)]
use KRdmaKit::rust_kernel_rdma_base;
// rust_kernel_rdma_base
use rust_kernel_rdma_base::*;
use rust_kernel_rdma_base::linux_kernel_module;
// linux_kernel_module
use linux_kernel_module::{println};
use KRdmaKit::device::{RContext};
use KRdmaKit::qp::{... |
use super::{parse_config, Action, Config};
use crate::{git, git::*};
use colored::Colorize;
use futures::future::join_all;
use std::{
env,
error::Error,
fmt,
fs::File,
io,
path::PathBuf,
process::Output,
time::{Duration, Instant},
};
use structopt::StructOpt;
use tokio::process::Command;... |
use anyhow::{anyhow, Result};
use crate::parse::{idx_to_name};
pub const UNINIT: usize = -1i64 as usize;
pub const NEG_SIGN: &str = "----";
pub const POS_SIGN: &str = "++++";
// TODO: date and time types
#[derive(Debug,Clone,PartialEq)]
pub enum Arg {
End,
Op(String),
// Plus, Minus, UPlus, UMinus, Divi... |
use std::{fmt, thread};
use std::fmt::{Debug, Formatter};
use std::sync::{Arc, Condvar, Mutex, TryLockError};
use std::sync::atomic::{AtomicBool, AtomicU8, Ordering};
use std::time::Duration;
use crate::common::{CommonError, required};
static COUNTER: AtomicU8 = AtomicU8::new(0);
#[derive(Debug)]
pub struct Executio... |
/*
* Copyright 2020 <NAME>
* https://github.com/mikechambers/dcli
*
* 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.