text stringlengths 3.09k 13.9k |
|---|
// due to code generated by JsonSchema
#![allow(clippy::field_reassign_with_default)]
use crate::{IdentityKey, SphinxKey};
use cosmwasm_std::{coin, Addr, Coin};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::cmp::Ordering;
use std::fmt::Display;
use ts_rs::TS;
use crate::current_block_height;... |
#[doc = "Reader of register DTOR"]
pub type R = crate::R<u32, super::DTOR>;
#[doc = "Writer for register DTOR"]
pub type W = crate::W<u32, super::DTOR>;
#[doc = "Register DTOR `reset()`'s with value 0"]
impl crate::ResetValue for super::DTOR {
#[inline(always)]
fn reset_value() -> Self::Ux { 0 }
}
#[doc = "Re... |
use super::{discovery, utils, Opts};
use discovery::DiscoveryItem;
use regex::Regex;
use serde::{Deserialize, Serialize};
use serde_json::{json, Map, Value};
extern crate sys_info;
static COLLECTOR_HOSTNAME: &str = "collector.hostname";
static COLLECTOR_OS_RELEASE: &str = "collector.operatingSystemRelease";
static COL... |
extern crate ansi_term;
extern crate difference;
extern crate smallvec;
extern crate lazy_static;
use ansi_term::*;
use difference::{Changeset, Difference};
use lazy_static::lazy_static;
use smallvec::SmallVec;
use std::cell::UnsafeCell;
use std::collections::HashMap;
use std::sync::Arc;
use std::sync::Mutex;
struct ... |
#![no_std]
#![feature(start)]
#![forbid(unsafe_code)]
use core::cmp;
use gba::{
fatal,
io::{
display::{DisplayControlSetting, DisplayMode, DISPCNT},
timers::{TimerControlSetting, TimerTickRate, TM0CNT_H, TM0CNT_L, TM1CNT_H, TM1CNT_L},
},
save::*,
vram::bitmap::Mode3,
warn, Color,
};
fn set_screen_... |
use ic_protobuf::log::log_entry::v1::LogEntry;
use ic_types::{PrincipalId, PrincipalIdParseError};
use log_analyzer::*;
use std::str::FromStr;
/// The log_analyzer will enforce properties about 'LogEntryFrom',
/// which couples a LogEntry with the node that emmitted it.
#[derive(Debug)]
pub struct LogEntryFrom {
f... |
// Copyright 2020-2021, The Tremor Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agr... |
use anyhow::{anyhow, Result};
use aws_config::{ConfigLoader, RetryConfig};
use aws_sdk_cloudwatchlogs::model::{LogGroup, LogStream};
use aws_sdk_cloudwatchlogs::{Client, Region};
use chrono::{Date, DateTime, Duration, NaiveDateTime, Utc};
use log::{debug, info, trace, LevelFilter};
use std::borrow::Cow;
const MIN_ITEM... |
use idna::domain_to_ascii;
use regex::Regex;
use std::borrow::Cow;
use crate::validation::ip::validate_ip;
lazy_static! {
// Regex from the specs
// https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address
// It will mark esoteric email addresses like quoted string as invalid
static ref ... |
use crate::context::Context;
use carapax::{
methods::SendMessage,
types::{Integer, ParseMode},
Api,
};
use chrono::{DateTime, Datelike, Duration as ChronoDuration, FixedOffset, NaiveTime, Utc, Weekday};
use rand::{seq::SliceRandom, thread_rng};
use std::{error::Error, fmt, str::FromStr};
use tokio::time::{i... |
use {
crate::{load::error::LoadError, models::SpanDisplay, prelude::*},
lib_transport::DataContext as RecordContext,
std::{error, fmt, io::Error as IoError, string::FromUtf8Error},
thiserror::Error,
};
pub type CrateResult<T> = std::result::Result<T, CrateError>;
pub type MainResult<T> = std::result::R... |
extern crate timely;
extern crate differential_dataflow;
extern crate interactive;
extern crate serde;
#[macro_use]
extern crate serde_derive;
use timely::synchronization::Sequencer;
use interactive::{Manager, Command, Query, Rule, Plan};
#[derive(Serialize, Deserialize, Debug, Clone, Hash, Eq, PartialEq, Ord, Parti... |
//! Frame parsers and data handlers
//!
//! Parse various frame types and return a fully-constructed object. See individual functions for
//! their descriptions.
use structs::{Frame, Callsign, InformationField};
use constants;
pub fn parse_frame(raw_frame: &[u8]) -> Frame {
for win in raw_frame.windows(2) {
... |
/*
* Copyright 2020 Nuclei Studio OÜ
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agree... |
// Copyright 2015 <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, ... |
//! Contains driver implementations of file system.
pub mod fat;
use alloc::boxed::Box;
use alloc::vec::Vec;
use spin::Mutex;
use crate::LibUserResult;
use crate::interface::driver::FileSystemDriver;
use crate::interface::filesystem::FileSystemOperations;
use storage_device::block::Block;
use storage_device::block_... |
// Copyright 2013-2018, The Gtk-rs Project Developers.
// See the COPYRIGHT file at the top-level directory of this distribution.
// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
#![allow(deprecated)]
#![cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
#![cf... |
use async_trait::async_trait;
use std::collections::HashMap;
use tokio_tungstenite::tungstenite::Message;
use crate::{
clients::common_traits::{
Candlestick, Level3OrderBook, OrderBook, OrderBookTopK, Ticker, Trade, BBO,
},
common::{
command_translator::CommandTranslator,
message_ha... |
//! Helper macros for parsing packed structs.
//!
//! The format is pretty much like `bincode` for structs,
//! but we do not want to rely on bincode just for this.
#![allow(unused_macros, dead_code)]
use anyhow::Result;
use byteordered::{byteorder::ReadBytesExt, ByteOrdered, Endian};
/// Declare a [`Parseable`] stru... |
/*!
This is an example `interface crate`,
where all publically available modules(structs of function pointers) and types are declared,
To load the library and the modules together,
call `<PluginMod_Ref as RootModule>::load_from_directory`,
which will load the dynamic library from a directory(folder),
and all the modul... |
use std::fs::File;
use std::io::Read;
use std::path::Path;
#[derive(Clone)]
struct Point {
x: usize,
y: usize,
}
struct Grid<T> {
rows: Vec<Vec<T>>,
}
impl<T: Clone> Grid<T> {
fn new() -> Grid<T> {
Grid::<T>{rows: Vec::new()}
}
fn len(&self) -> Point {
Point{x: self.rows[0].len(),
... |
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
// This file is part of substrate-subxt.
//
// subxt 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 optio... |
use num_traits::*;
pub fn is_prime<T>(n: T) -> bool
where
T: PrimInt + NumAssign,
{
// O(sqrt(n))
let mut flag: bool = true;
if n == one() {
flag = false
}
let mut i: T = one::<T>().signed_shl(1);
while i * i <= n {
if n % i == zero() {
flag = false;
... |
use std::collections::HashMap;
use color_eyre::eyre::{eyre, Context};
use color_eyre::Result;
use lazy_static::lazy_static;
use serde::Deserialize;
use tracing::trace;
use url::Url;
use crate::version::LenientVersion;
use crate::version_checker::{get_new_version_filename, VersionCheck};
use crate::CLIENT;
lazy_stati... |
use druid::{
kurbo::Line, BoxConstraints, Command, Env, Event, EventCtx, LayoutCtx,
LifeCycle, LifeCycleCtx, MouseEvent, PaintCtx, Point, RenderContext, Size,
Target, UpdateCtx, Widget, WidgetId, WidgetPod,
};
use lapce_data::{
command::{
CommandTarget, LapceCommand, LapceCommandNew, LapceUIComm... |
use std::collections::HashMap;
use std::collections::VecDeque;
use std::fs;
fn handle_portal(
input_map: &Vec<Vec<char>>,
first: (usize, usize),
second: (usize, usize),
entry: (usize, usize),
outer: bool,
portal_names: &mut HashMap<String, (usize, usize)>,
inner_portals: &mut HashMap<(usize... |
//! Fee adjustment utilities
use sp_runtime::{
traits::{Convert, Saturating},
FixedPointNumber, FixedU128, Perquintill,
};
use support::{pallet_prelude::*, weights::DispatchClass};
/// A struct to update the weight multiplier per block. It implements `Convert<Multiplier,
/// Multiplier>`, meaning that it can conver... |
use cobs::CobsDecoder;
use color_eyre::eyre::Result;
use object::read::{File as ElfFile, Object, ObjectSymbol};
use postform_decoder::{ElfMetadata, POSTFORM_VERSION};
use postform_rtt::{
attach_rtt, configure_rtt_mode, disable_cdebugen, download_firmware, handle_log, run_core,
RttError, RttMode,
};
use probe_rs... |
use crate::synchronizer::{BlockStatus, Synchronizer};
use crate::types::HeaderView;
use crate::{
BLOCK_DOWNLOAD_TIMEOUT, BLOCK_DOWNLOAD_WINDOW, MAX_BLOCKS_IN_TRANSIT_PER_PEER,
PER_FETCH_BLOCK_LIMIT,
};
use ckb_core::header::Header;
use ckb_network::PeerIndex;
use ckb_shared::index::ChainIndex;
use ckb_shared::s... |
use druid::commands::{CLOSE_WINDOW, QUIT_APP};
use druid::widget::{Button, Flex, Label};
use druid::{
AppDelegate, AppLauncher, Command, Data, DelegateCtx, Env, ExtEventSink, Handled, Lens,
Selector, Target, Widget, WidgetExt, WindowDesc, WindowId,
};
use crate::server::start_server;
use crate::update::{do_upd... |
use biscuit::jwa::SignatureAlgorithm;
use biscuit::jwe::RegisteredHeader;
use biscuit::jwk::RSAKeyParameters;
use biscuit::jws::{self, Secret};
use biscuit::{RegisteredClaims, StringOrUri};
pub type JWT = biscuit::JWT<biscuit::Empty, biscuit::Empty>;
use crate::common::*;
use crate::Result;
use super::{get_token_for_... |
// Copyright 2016 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... |
extern crate piston_window;
extern crate wrapped2d;
extern crate testbed;
use piston_window::*;
use piston_window::Button::*;
use wrapped2d::b2;
use wrapped2d::user_data::NoUserData;
type World = b2::World<NoUserData>;
fn main() {
let mut world = World::new(&b2::Vec2 { x: 0., y: 0. });
let ground = create_g... |
use crate::{Error, Result};
use lopdf::{dictionary, Document, Object, ObjectId, Stream};
fn calc_resulting_length(len: usize) -> usize {
if len % 4 == 0 {
len
} else {
len + 4 - len % 4
}
}
fn add_empty_page(doc: &mut Document, media_box: Object, pages_id: ObjectId) -> ObjectId {
let c... |
//! Tools to manage a repository
//!
//! ## Repository file system layout :
//!
//! - `current`: a very small JSON file with informations about the current version.
//! - `versions`: a JSON file with informations about all versions.
//! - `packages`: a JSON file that list available packages (i.e. the update graph).
//!... |
/*
* Copyright (C) 2019 Kubos Corporation
*
* 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 ... |
use plotters::prelude::*;
type Error = Box<dyn std::error::Error + 'static>;
enum SegmentType {
Type1,
Type2,
}
struct Level {
id: u8,
scale: f64,
directions: Vec<u8>,
types: Vec<SegmentType>,
}
impl Default for Level {
fn default() -> Self {
Level {
id: 0_u8,
... |
//! Definition of style sheet values.
use crate::prelude::*;
use crate::data::color;
// ============
// === Data ===
// ============
/// Type of values in the style sheet.
#[derive(Debug,Clone,PartialEq)]
#[allow(missing_docs)]
pub enum Data {
Invalid(String),
Number(f32),
Color(color::Rgba),
}
// =... |
use crate::{
cmd::{
api_url, get_password, get_txn_fees, load_wallet, print_footer, print_json, status_json,
status_str, Opts, OutputFormat,
},
keypair::PublicKey,
result::{anyhow, Result},
traits::{TxnEnvelope, TxnFee, TxnSign, TxnStakingFee, B64},
};
use helium_api::{BlockchainTxn,... |
// Copyright 2017 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 crate::protocol::util;
use crate::{HdbError, HdbResult};
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
#[allow(clippy::upper_case_acronyms, non_camel_case_types)]
#[derive(Clone, Debug, PartialEq)]
pub enum OptionValue {
INT(i32), // INTEGER
BIGINT(i64), // BIGINT
DOUBLE(f64)... |
use ic_crypto_utils_threshold_sig::parse_threshold_sig_key;
use ic_metrics::MetricsRegistry;
use ic_protobuf::registry::subnet::v1::SubnetType;
use ic_registry_client::client::{RegistryClient, RegistryClientImpl};
use ic_registry_client_helpers::{
node::NodeRegistry,
routing_table::RoutingTableRegistry,
sub... |
//! Performs validation and correction of GTIN-14 codes.
use utils;
/// Errors that make GTIN-14 correction impossible.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum FixError {
/// The provided string contains non-ASCII characters.
NonAsciiString,
/// The provided code was too long to be val... |
/*
Copyright 2020 <NAME> (github.com/erwanM974)
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 wri... |
struct Movement {
turn: char,
dist: i32
}
#[derive(PartialEq, Debug, Copy, Clone)]
enum Orientation {
North,
East,
South,
West,
}
struct Position {
north: i32,
east: i32,
orientation: Orientation
}
fn main() {
let input = "R2, L1, R2, R1, R1, L3, R3, L5, L5, L2, L1, R4, R1, R3, L5, L5, R3, L4, L4, R5, R4,... |
use super::{encode_event, encoding::EncodingConfig, Encoding, SinkBuildError, StreamSinkOld};
use crate::{
config::SinkContext,
dns::{Resolver, ResolverFuture},
sinks::{Healthcheck, VectorSink},
};
use bytes::Bytes;
use futures::{future, FutureExt, TryFutureExt};
use futures01::{stream::iter_ok, Async, Asyn... |
//! Displays a [`TabBar`](TabBar) to select the content to be displayed.
//!
//! You have to manage the logic to show the contend by yourself or you may want
//! to use the [`Tabs`](super::tabs) widget instead.
//!
//! *This API requires the following crate features to be activated: `tab_bar`*
use iced_graphics::{backe... |
use std::collections::HashMap;
use std::fs::File;
use std::io::Read;
use std::path::Path;
use crate::{SendgridError, SendgridResult};
macro_rules! add_field {
// Create a setter that appends.
(
$(#[$outer:meta])*
$method:ident << $field:ident: $ty:ty
) => {
$(#[$outer])*
pu... |
use std::io;
use std::io::Read;
use std::io::Write;
use std::net::SocketAddr;
use futures::done;
use futures::Future;
use futures::stream::Stream;
use tokio_core::io::read_exact;
use tokio_core::io::write_all;
use tokio_core::io::Io;
use tokio_core::net::TcpStream;
use tokio_core::reactor;
use solicit::HttpError;
us... |
use std::{
cell::Cell,
sync::atomic::{AtomicBool, AtomicU32},
};
use atomic::Ordering;
use parking_lot::{lock_api::RawMutex, RawMutex as Lock};
use crate::{
gc_base::GcBase,
mutator::{MutatorRef, ThreadState},
};
static SAFEPOINT_VERBOSE: AtomicBool = AtomicBool::new(false);
pub fn verbose_safepoint... |
use super::breadcrumbs::breadcrumbs;
use crate::{
views::{DocumentView, Header},
WebView,
};
use itertools::Itertools;
use leptos2::*;
use liturgy::{Document, Slug, SlugPath, Version};
type CategoryTree<'a> = Vec<(
Option<&'a String>,
Vec<(
Option<&'a String>,
Vec<(Option<&'a String>, V... |
use sc_service::{config::DatabaseConfig, Configuration, RuntimeGenesis};
use serde::Deserialize;
use structopt::StructOpt;
use crate::arg_enums::{
ExecutionStrategy, TracingReceiver, WasmExecutionMethod, DEFAULT_EXECUTION_BLOCK_CONSTRUCTION,
DEFAULT_EXECUTION_IMPORT_BLOCK, DEFAULT_EXECUTION_OFFCHAIN_WORKER, DEFAULT_... |
// Copyright 2020 Google 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 applicable law or agreed to in ... |
use rustc_serialize::json::Json;
use std::option::Option;
use std::collections::HashMap;
use hyper::method;
use error::{SendSecureError, SendSecureResult};
use utils::requester::make_request;
use rustc_serialize::json;
use jsonclient::{JsonClient, UploadFileWithPath};
use helpers::{safebox, securityprofile, enterprises... |
use crate::{
helpers::{cache::MemberHelper, CacheHelper},
slashies::{interaction::Interaction, Response, SlashCommand},
utils::{constants::SlashiesErrorMessages, CacheReliant},
};
use async_trait::async_trait;
use chrono::{DateTime, TimeZone, Utc};
use miette::{IntoDiagnostic, Result};
use twilight_cache_inmemory::R... |
mod lexer;
mod parser;
mod value;
mod interpreter;
mod error;
mod builtins;
mod generator;
mod optimize;
use std::{io::{self, Write}, collections::HashMap, path::PathBuf, fs};
use ariadne::Source;
use error::{ToReport, RuntimeError};
use fnv::FnvHashMap;
use interpreter::{execute, Globals, Exit};
use lasso::Rodeo;... |
use cgmath::Vector2;
use crate::Context;
use super::{
context::Texture, Color, Drawable, GraphicsError, Quad, Rect, Texture2D, TextureView2D,
};
pub struct Rasterizer {
renderer: super::BatchRender,
cache_texture: Texture2D,
cache: rusttype::gpu_cache::Cache<'static>,
font_id_next: usize,
}
impl... |
#![feature(drain_filter)]
extern crate event;
#[macro_use]
extern crate log;
extern crate netutils;
extern crate redox_netstack;
extern crate smoltcp;
extern crate syscall;
extern crate byteorder;
use std::cell::RefCell;
use std::fs::File;
use std::os::unix::io::{FromRawFd, RawFd};
use std::process;
use std::rc::Rc;
... |
#[doc = "Reader of register CHSR"]
pub type R = crate::R<u32, super::CHSR>;
#[doc = "Reader of field `ENA0`"]
pub type ENA0_R = crate::R<bool, bool>;
#[doc = "Reader of field `ENA1`"]
pub type ENA1_R = crate::R<bool, bool>;
#[doc = "Reader of field `ENA2`"]
pub type ENA2_R = crate::R<bool, bool>;
#[doc = "Reader of fie... |
// Copyright 2020 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT
// http://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD
// https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied,
// modified, or di... |
use num_traits::Float;
use std::ops::{Index, IndexMut};
/// A point in a 3D space.
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
pub struct Point3D<T> {
/// The x-coordinate of this point.
pub x: T,
/// The y-coordinate of this point.
pub y: T,
/// The z-coordinate of this point.
pub ... |
use crate::powers::{TauParams, TauPowers};
use groupy::{CurveAffine, EncodedPoint};
use paired::Engine;
use rayon::prelude::*;
use std::fmt;
use std::fs::OpenOptions;
use std::io::{self, Read};
use std::path::Path;
/// An URI can designate multiple ways to fetch a power of tau ceremony
#[derive(Clone, Debug)]
pub enum... |
#[cfg(feature = "serde-serialize")]
use serde;
use num::Zero;
use std::ops::MulAssign;
use alga::general::Real;
use ::ComplexHelper;
use na::{Scalar, DefaultAllocator, Matrix, VectorN, MatrixN};
use na::dimension::{Dim, U1};
use na::storage::Storage;
use na::allocator::Allocator;
use lapack::fortran as interface;
... |
use crate::{Fetcher, Loader, Scope, Tables};
use futures::channel::oneshot;
use futures::future::{FutureExt, LocalBoxFuture};
use std::cell::RefCell;
use std::collections::BTreeMap;
use std::task::Poll;
use url::Url;
#[cfg(test)]
mod test {
use super::evaluate_fixtures;
use serde_json::json;
macro_rules! ... |
use bevy_ecs::entity::Entity;
use std::{borrow::Cow, fmt};
use crate::render_resource::{Buffer, Sampler, TextureView};
/// A value passed between render [`Nodes`](super::Node).
/// Corresponds to the [`SlotType`] specified in the [`RenderGraph`](super::RenderGraph).
///
/// Slots can have four different types of valu... |
use crate::bounding_volume::{BoundingSphere, SimdAABB};
use crate::math::{Real, SimdBool, SimdReal, SIMD_WIDTH};
use crate::motion::{RigidMotion, RigidMotionComposition};
use crate::partitioning::{SimdBestFirstVisitStatus, SimdBestFirstVisitor};
use crate::query::{self, QueryDispatcher, TOI};
use crate::shape::{Ball, S... |
use crate::{Classes, ModeBits};
use std::{
fs,
os::{raw::c_int, unix::fs::PermissionsExt},
};
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Default)]
pub struct PermissionBits {
pub owner_bits: ModeBits,
pub group_bits: ModeBits,
pub other_bits: ModeBits,
}
impl PermissionBit... |
use super::color::Color;
use std::fs;
pub struct Canvas {
width: u16,
height: u16,
pixels: Vec<Color>
}
impl Canvas {
pub fn new(width: u16, height: u16) -> Self {
let pixels = vec![Color::new(0.0, 0.0, 0.0); height as usize * width as usize];
Self {width, height, pixels}
}
pu... |
//! This module is concerned with finding methods that a given type provides.
//! For details about how this works in rustc, see the method lookup page in the
//! [rustc guide](https://rust-lang.github.io/rustc-guide/method-lookup.html)
//! and the corresponding code mostly in librustc_typeck/check/method/probe.rs.
use... |
mod test_util;
use test_util::*;
use hacl_rust::aead::{hacl_aes_available, Aead, Algorithm, Error};
#[derive(Serialize, Deserialize, Debug, Clone)]
#[allow(non_snake_case)]
struct AeadTestVector {
algorithm: String,
generatorVersion: String,
numberOfTests: usize,
notes: Option<Value>, // text notes (m... |
use crate::traits::{Receiver, Scheduler};
use std::cell::UnsafeCell;
use std::future::Future;
use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Weak};
use std::task::{Context, Poll, RawWaker, RawWakerVTable, Waker};
pub trait Wakable {
fn wakeup(&self);
}
pub struct WakerData... |
use std::collections::HashMap;
use std::net::{SocketAddr, ToSocketAddrs};
use tokio::net::{ TcpStream, TcpListener};
use tokio::sync::{
Mutex, MutexGuard,
mpsc::{unbounded_channel}
};
use tokio::sync::mpsc::{ UnboundedReceiver, UnboundedSender};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::runtime;
... |
use core::marker::PhantomData;
use selfe_sys::*;
use crate::arch::fault::Fault;
use crate::cap::{
role, Badge, CNodeRole, CNodeSlot, Cap, ChildCNodeSlot, DirectRetype, Endpoint, LocalCNode,
LocalCNodeSlot, LocalCap, Untyped,
};
use crate::error::SeL4Error;
use crate::userland::{type_length_in_words, CapRights... |
// 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... |
use crate::block::BlockMatrix;
use std::rc::Rc;
pub mod pixel {
pub struct RGB {
pub r: u8,
pub g: u8,
pub b: u8,
}
impl RGB {
pub fn to_flat_data(&self) -> [u8; 4] {
[self.r, self.g, self.b, 255]
}
pub fn to_ycbcr(&self) -> YCbCr {
... |
use chrono::{DateTime, Utc};
use twilight_embed_builder::{EmbedAuthorBuilder, EmbedBuilder, ImageSource};
use twilight_model::guild::Permissions;
use twilight_model::user::UserFlags;
use crate::core::CommandContext;
use crate::error::CommandResult;
use crate::translation::{FluArgs, GearBotString};
use crate::utils::{s... |
use byteorder_extended::{ReadExt, WriteExt};
use std::collections::HashMap;
use std::io;
use std::io::{Error, ErrorKind, Read, Seek, SeekFrom, Write};
/// Reads the pak header from the specified reader.
pub fn read_header<R: Read>(reader: &mut R) -> io::Result<()> {
if reader.read_u8()? != 2 && reader.read_u8()? !... |
use std::{any::Any, fs, io::Read, net::{TcpListener, TcpStream}, ops::{Deref, Index}, str::FromStr, sync::{Arc,Mutex}, thread::spawn};
use tungstenite::{Message, ServerHandshake, WebSocket, handshake, protocol::frame::coding::Data, server::accept};
use serde_json::{Result, Value};
use serde::{Deserialize, Serialize};
u... |
use common::Puzzle;
use regex::Regex;
use std::str::FromStr;
use std::string::ParseError;
use std::mem::discriminant;
fn main() {
let mut a: Puzzle1 = Default::default();
a.run();
}
#[derive(Default)]
struct CPU {
acc: i64,
pc: i64,
}
#[derive(Copy, Clone)]
struct Patch {
find: Instruction,
r... |
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// https://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT o... |
use crate::errors::*;
use std::io::Write;
use std::io::Read;
use byteorder::{BigEndian, LittleEndian, ByteOrder, WriteBytesExt, ReadBytesExt};
use crate::{DataLink, Endianness, TsResolution};
/// Pcap Global Header
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct PcapHeader {
/// Magic number
pub ma... |
use super::token::Token;
use crate::private::Sealed;
use crate::StringProgram;
use std::fmt::Debug;
#[derive(Debug, PartialEq, Eq, Clone, Copy, PartialOrd, Ord)]
pub struct ColumnIndex(pub usize);
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct StringExpression(pub Vec<SubstringExpression>);
impl Sealed for String... |
use crate::framework_detector::{Framework, Frameworks};
use regex::Regex;
use std::cell::RefCell;
use walkdir::DirEntry;
pub const WORKSPACE_FRAMEWORK_GRADLE: &'static str = "workspace.framework.gradle";
pub const WORKSPACE_FRAMEWORK_GRADLE_COMPOSITE: &'static str =
"workspace.framework.gradle.composite";
pub cons... |
mod assembunny;
mod day01;
use crate::day01::{day01_part1, day01_part2};
fn day01() {
assert_eq!(230, day01_part1());
assert_eq!(154, day01_part2());
}
mod day02;
use crate::day02::{day02_part1, day02_part2};
fn day02() {
assert_eq!("99332", day02_part1());
assert_eq!("DD483", day02_part2());
}
mod d... |
// https://github.com/mitchmindtree/nannou-sketches/blob/master/aquatic-juice/src/main.rs
// cargo run --release has substantially better performance with large amount of values
// docs: https://docs.rs/nannou/0.13.1/nannou/
// prelud: https://docs.rs/nannou/0.13.1/nannou/prelude/index.html
extern crate nannou;
use... |
// Copyright 2018 The Starlark in Rust Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable la... |
use crate::codec::redis::redis_query_type;
use crate::error::ChainResponse;
use crate::frame::{Frame, RedisFrame};
use crate::message::{Message, QueryType};
use crate::transforms::{Transform, Transforms, Wrapper};
use anyhow::{anyhow, Result};
use async_trait::async_trait;
use bytes::Bytes;
use itertools::Itertools;
us... |
//! Source file maps and Source files.
use std::borrow::Cow;
use std::path::{Path, PathBuf};
use std::sync::atomic::AtomicU64;
use std::sync::{Arc, RwLock};
use std::{fs, io};
use super::loc::Loc;
use super::span::*;
#[derive(Hash, Debug, Clone, PartialEq)]
/// Information about the Source
pub enum SourceInfo {
S... |
// Copyright 2022 The Engula Authors.
//
// 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... |
#![no_std]
use core::panic::PanicInfo;
mod board;
mod stm32hal;
mod driver;
mod routine;
mod setup;
mod common;
// mod arm;
/* Set Clock In One Area */
const CLK: stm32hal::common::MsiRange = stm32hal::common::MsiRange::Clk16MHz;
#[no_mangle]
pub extern fn sys_init() {
/* RCC Enabling of the bus */
... |
use autoscaling::*;
use visibility::*;
use consumer::*;
use delete::*;
use processor::*;
use slog::Logger;
use util::*;
use std::sync::Arc;
use std::time::Duration;
pub struct Service {
consumers: ConsumerBroker
}
impl Service {
pub fn start(&mut self) {
self.consumers.consume();
}
pub fn s... |
// Copyright 2018 Google 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
use super::binary_writer::write;
use engine::resources::shader_manager::ShaderManager;
use lazy_static::lazy_static;
use path_abs::PathDir;
use regex::{Captures, Regex};
use std::collections::HashMap;
use std::env::current_exe;
use std::fs;
use std::os::windows::process::CommandExt;
use std::process::Command;
use winap... |
/// Trait for a quantum state
///
/// Trait QuState describes the interface for changing, measuring and monitoring
/// the quantum state of the simulated computer.
pub trait QuState
{
/// Apply a n-ary quantum gate `gate` on the qubits from `bits` in this state.
fn apply_gate<G>(&mut self, gate: &G, bits: &[usi... |
use std::collections::HashMap;
use bitcoinsuite_chronik_client::proto::{Block, SlpGenesisInfo, Token, Tx, TxHistoryPage};
use bitcoinsuite_core::CashAddress;
use bitcoinsuite_error::Result;
use crate::{
blockchain::to_be_hex,
server_primitives::{JsonToken, JsonTx, JsonTxStats},
};
pub fn tokens_to_json(token... |
//! rtss - Relative TimeStamps for Stuff.
//!
//! An `io::Write` implementation which prefixes each line with a timestamp since
//! a start time, and the duration since the previous line, if any.
//!
//! Also a couple of utility functions for formatting `Duration`, and copying from
//! one IO to another.
use std::io::... |
mod handler;
mod obj;
mod constants;
mod defined_error;
#[allow(dead_code, unused_imports)]
use std::convert::Infallible;
use std::error::Error;
use std::sync::Arc;
use chrono::Utc;
//use hyper::body::HttpBody;
use hyper::service::make_service_fn;
use hyper::{Server, StatusCode};
use tracing::error;
#[allow(unused_i... |
use entity::{EntityType, Movement, EntityState, CellMoveState, RcEntity};
use game_data::GameData;
use game_scene::GameEvent;
use cell_state::CellState;
use map::{CELL_SIZE, Adjacents};
use sdl2::pixels::Color;
use sdl2::rect::Rect;
use sdl2::render::Canvas;
use sdl2::video::Window;
use sdl2_engine_helpers::event_bus::... |
use std::time::Duration;
use async_trait::async_trait;
use futures::TryStreamExt;
use sqlx::sqlite::SqlitePoolOptions;
use sqlx::{Column as _, Row as _};
use database_tree::{Child, Database, Table};
use crate::database::{convert_column_val_to_str, Column, Constraint, ForeignKey, Index};
use crate::pool_exec_impl;
u... |
use crate::{consts::*, types::load_config};
use bevy::prelude::*;
use std::{fs::read_dir, iter};
/// A plugin for handling all the game's menus.
pub struct MenuPlugin;
impl Plugin for MenuPlugin {
fn build(&self, app: &mut AppBuilder) {
app.init_resource::<ButtonMaterials>()
.on_state_enter(AP... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.