text stringlengths 3.09k 13.9k |
|---|
//! All of the components in an IrGraph/IrModule
use crate::AddressSpace;
use petgraph::prelude::*;
use petgraph::stable_graph::StableDiGraph;
use std::collections::{HashMap, HashSet};
use std::fmt;
use toc_ast::ast::expr::{BinaryOp, UnaryOp};
use toc_ast::types::TypeRef;
use toc_ast::value::Value;
use toc_core::Locati... |
// Copyright 2020 Twitter, Inc.
// Licensed under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
use crate::common::Message;
use crate::event_loop::EventLoop;
use crate::session::*;
use crate::*;
use rustcommon_fastmetrics::metrics;
use std::io::BufRead;
use std::sync::Arc;
/// A `Work... |
//! The family of the gamma function.
//!
//! $$\Gamma(z)\equiv\int_{0}^{\infty}t^{z-1}e^{-t}dt\quad(\mathfrak{R}[z]>0)$$
use cauchy::Scalar;
use num_traits::ToPrimitive;
use crate::consts::SQRT_2_PI;
use crate::complex::FromComplex;
use crate::zeta::*;
/// Coefficients for calculating the gamma function.
const G_CO... |
use std::fmt;
use crate::cpu::Segment;
use crate::cpu::Op;
use crate::cpu::{Parameter, ParameterSet};
use crate::cpu::{OperandSize, AddressSize};
use crate::hex::hex_bytes;
use crate::string::right_pad;
#[derive(Clone, Debug, PartialEq)]
pub struct Instruction {
pub command: Op,
pub params: ParameterSet,
... |
use crate::shaders::*;
use crate::vertex::Vertex;
use std::sync::Arc;
use vulkano::command_buffer::DynamicState;
use vulkano::device::{Device, DeviceExtensions, Queue};
use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract, Subpass};
use vulkano::image::SwapchainImage;
use vulkano::instance::{... |
use anyhow::Context;
use smallvec::SmallVec;
use std::time::Duration;
use crate::{
inet::{
nlas::{Nla, NlaBuffer, NlasIterator},
SocketId,
SocketIdBuffer,
},
traits::{Emitable, Parseable, ParseableParametrized},
DecodeError,
};
/// The type of timer that is currently active for... |
use log::{debug, info, warn};
use quick_xml::events::Event;
use quick_xml::Reader;
use std::path::Path;
use std::{collections::HashMap, io::BufRead};
use crate::error::Result;
use crate::model::Feed;
use crate::remote::RemoteFeed;
#[derive(Debug)]
pub struct ImportedFeed {
rss_url: String,
title: Option<Strin... |
use crate::utils::*;
use std::cell::RefCell;
use std::collections::VecDeque;
use std::rc::Rc;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use wasm_bindgen_test::console_log;
use web_sys::{
HtmlCanvasElement, Request, RequestInit, RequestMode, Response, WebGl2RenderingContext,
WebGlProgram, WebGlRen... |
/// Whether the format of a compilation unit is 32- or 64-bit.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Format {
/// 64-bit DWARF
Dwarf64,
/// 32-bit DWARF
Dwarf32,
}
impl Format {
/// Return the serialized size of an initial length field for the format.
#[inline]
pub fn ... |
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate anyhow;
mod filters;
use anyhow::Result;
use chrono::prelude::*;
use serde::Serialize;
use std::error::Error;
use std::fs::{DirEntry, File};
use std::io::prelude::*;
use std::path::PathBuf;
use std::{fs, io};
use tera::{Context, Tera};
const ALLOWED_FI... |
use anyhow::{bail, Context, Result};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use std::fs::{self, OpenOptions};
use std::io::{self, Write};
use std::path::{Path, PathBuf};
#[derive(Debug, Deserialize, Eq, PartialEq, Serialize)]
struct DbVersion(u32);
pub struct Db {
pub dirs: Vec<Dir>,
pub modifi... |
use crate::{
num::{Complex, One, Zero},
tools::AssociatedValue,
};
#[codesnip::entry("fast_fourier_transform")]
pub use fast_fourier_transform_impls::convolve_fft;
#[codesnip::entry("fast_fourier_transform", include("Complex", "AssociatedValue"))]
pub mod fast_fourier_transform_impls {
use super::*;
st... |
mod gui;
use nanachi::{
buffer::GenericBuffer,
compositor,
context::{ChildContext, Context, FillStyle},
fill_color, fill_rule,
image::RgbaImage,
matrix::Matrix,
path_builder::PathBuilder,
pixel::Pixel,
pixel::Rgba,
writer::image_writer,
};
use std::time::Duration;
use std::{threa... |
use std::time::Duration;
use imgui_winit_support::WinitPlatform;
use legion::*;
use winit::window::Window;
use imgui::*;
use imgui_wgpu::{Renderer, RendererConfig};
use crate::{
wgpu_state::WgpuState,
app_state::AppState,
application::DeltaTime,
events::Events,
command::Command,
};
pub struct UiSta... |
use crate::model::error;
use crate::model::link::Links;
use crate::model::resource::{Resource, ResourceIdentifier};
use crate::model::{JsonApiInfo, Meta};
use core::fmt;
use serde::de::{MapAccess, Visitor};
use serde::ser::SerializeStruct;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde_json::V... |
use gir_core::primitives::*;
use gir_core::graph::*;
use gir_core::backend::*;
use gir_core::errors::*;
use ocl::{Buffer, Queue};
use ocl::flags::MemFlags;
use ocl::core::{create_sub_buffer, BufferRegion, Mem};
use std::collections::HashMap;
#[derive(Debug, Clone)]
pub struct OpenCLContainer {
pub mem: Vec<f32>,... |
mod utils;
use std::fmt;
use wasm_bindgen::prelude::*;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
#[wasm_bindgen]
extern "C" {
fn alert(s: &str);
}
extern c... |
fn ff0(x: u32, y: u32, z: u32) -> u32 { x ^ y ^ z }
fn ff1(x: u32, y: u32, z: u32) -> u32 { (x & y) | (x & z) | (y & z) }
fn gg0(x: u32, y: u32, z: u32) -> u32 { x ^ y ^ z }
fn gg1(x: u32, y: u32, z: u32) -> u32 { (x & y) | (!x & z) }
fn p0(x: u32) -> u32 { x ^ x.rotate_left(9) ^ x.rotate_left(17) }
fn p1(x: u32) ... |
use std::convert::TryFrom;
use std::mem;
use hidapi::{HidApi, HidDevice};
use crate::badge::{Badge, BADGE_MSG_FONT_HEIGHT, BadgeEffect, BadgeError, DISP_SIZE, N_MESSAGES};
/// Vendor ID of the LED Badge
const BADGE_VID: u16 = 0x0483;
/// Product ID of the LED Badge
const BADGE_PID: u16 = 0x5750;
/// Message Offset/... |
use crate::interfaces::{Interface, MacAddr};
use std::{
convert::TryFrom,
io::{Error, ErrorKind},
net::Ipv4Addr,
u16,
};
use num_derive::FromPrimitive;
use num_traits::FromPrimitive;
use pnet::packet::{
arp::{ArpHardwareTypes, ArpOperation, ArpPacket, MutableArpPacket},
ethernet::{
Eth... |
use crate::mm;
use crate::mm::{ PAGE_SIZE, VirtualAddress };
use crate::mm::{ MemorySpace, MemoryRegionFlags };
use crate::thread::{ Thread, ThreadHandle, ThreadRegisterState };
use crate::elf::{ Elf, ProgramHeaderType, ProgramHeaderFlags };
use alloc::string::String;
use alloc::vec::Vec;
use alloc::sync::{ Arc, Weak ... |
use rand::distributions::{Distribution, WeightedIndex};
use rand::Rng;
use std::cmp::Ordering;
use std::collections::{BTreeMap, BinaryHeap};
use std::fmt::{Debug, Display, Formatter};
trait FromU8 {
fn from_u8(v: u8) -> Self;
}
trait ToU8 {
fn to_u8(&self) -> u8;
}
#[derive(Eq, Copy, Clone)]
struct Ru8(u8);
... |
use crate::{
aead::{Aead, AeadTag},
kdf::Kdf as KdfTrait,
kem::{EncappedKey, Kem as KemTrait},
kex::KeyExchange,
op_mode::{OpModeR, OpModeS},
setup::{setup_receiver, setup_sender},
HpkeError,
};
use rand::{CryptoRng, RngCore};
// def SealAuthPSK(pkR, info, aad, pt, psk, pskID, skS):
// e... |
use std::collections::HashMap;
use std::convert::TryFrom;
use crate::models::{assets::*, generic::*};
use crate::schema::configs;
use crate::Error;
use diesel::{ExpressionMethods, PgConnection, QueryDsl, RunQueryDsl};
use serde::{Deserialize, Serialize};
#[derive(Queryable, AsChangeset, Debug)]
#[primary_key(config_i... |
use glam::Vec3A;
/// Calculates smooth per-vertex normals by by averaging over the vertices in each face.
/// `indices` is assumed to contain triangle indices for `positions`, so `indices.len()` should be a multiple of 3.
/// If either of `positions` or `indices` is empty, the result is empty.
pub fn calculate_smooth_... |
use std::collections::BTreeSet;
use serde::{Deserialize, Serialize};
#[cfg(feature = "processing")]
use {
relay_common::UnixTimestamp,
relay_general::protocol::{AsPair, Event, EventType},
relay_metrics::{Metric, MetricUnit, MetricValue},
std::collections::BTreeMap,
};
/// Configuration in relation to... |
use crate::class::FunctionType;
use crate::virtuals::VIRTUAL_CLASS_ID_MEM_ARG;
use wasm_encoder::{BlockType, Function as WASMFunction, Instruction as WASMInstruction, ValType};
/// Constructs a function (type and body) for checking if an object reference is an instance of a
/// target class (or any subclass of the tar... |
use std::io::prelude::*;
use std::time::{Instant, Duration};
use std::sync::{Mutex, Arc, Condvar};
use std::thread;
use std::cmp::Ordering;
struct Alarm {
time: Instant,
seconds: u64,
message: String,
}
struct AlarmBacklog {
backlog: Vec<Alarm>,
next: Option<Alarm>,
}
impl AlarmBacklog {
fn n... |
//! Schema for a docker-compose configuration file
//!
//! This is the data structure for holding the yaml file that docker compose uses to do its thing.
//! I'm only doing the fields for features I'm using as a proof of concept. This schema structure is only
//! going to be explicitly used by the application, so it sh... |
#![cfg_attr(not(feature = "std"), no_std)]
use codec::{Encode, Decode};
use sp_runtime::{
RuntimeDebug,
traits::{
MaybeSerializeDeserialize, Member, AtLeast32BitUnsigned, Saturating, Zero,
}
};
use sp_std::{fmt::Debug, prelude::Vec};
use frame_support::{
ensure, decl_module, decl_storage, decl_event, decl_error,... |
//! Auxiliary Proof of Work Pallet
//!
//! This pallet allows blockchain users to submit proofs of work on the parent block (or maybe a
//! few recent parents).
//!
//! Why?
//! It's cool
//! To avoid long range attacks
//! To not waste orphaned work (like GHOST)
//! To help forks resolve in a more continuous manner.
... |
// Copyright 2018 Osspial
//
// 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... |
use crate::auth::{
PlainSocksServerAuthProvider, ProtectedSocksServerAuthProvider, SocksServerAuthProvider,
};
use crate::common::*;
use proxy_relay::{relay, TargetAddr};
use std::net::{Shutdown, SocketAddr};
use std::sync::Arc;
use tokio::net::{TcpListener, TcpStream, ToSocketAddrs};
use tokio::prelude::*;
use tok... |
use glium::{DisplayBuild, Surface};
use glium::backend::glutin_backend::GlutinFacade;
use glium::glutin;
use glium::glutin::{ElementState, Event, MouseButton, MouseScrollDelta, VirtualKeyCode, TouchPhase};
use imgui::{ImGui, Ui, ImGuiKey};
use imgui_glium_renderer::Renderer;
use std::time::Instant;
pub struct Interfac... |
use std::fs::File;
use std::io::Read;
use std::path::PathBuf;
use std::sync::{Arc, Mutex};
use bytes::Bytes;
use failure::{format_err, Fail};
use futures::prelude::*;
use url::Url;
mod cache;
use self::cache::Cache;
pub mod thread;
#[derive(Debug, Clone)]
pub struct Fetcher {
client: hyper::Client<hyper_tls::Htt... |
//! Support for values with the `Core.Method` type.
//!
//! The documentation for this module has been slightly adapted from the comments for this struct
//! in [`julia.h`]
//!
//! [`julia.h`]: https://github.com/JuliaLang/julia/blob/96786e22ccabfdafd073122abb1fb69cea921e17/src/julia.h#L273
use super::array::Array;
us... |
use crate::action::{get, inspect_memory, invoke};
use crate::{
instantiate, ActionError, ActionOutcome, CompilationStrategy, CompiledModule, Compiler,
InstanceHandle, Namespace, RuntimeValue, SetupError,
};
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
use thiserror::Error;
use wasmpar... |
// Copyright 2017 PingCAP, 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 i... |
/*
Portions Copyright 2019-2021 ZomboDB, LLC.
Portions Copyright 2021-2022 Technology Concepts & Design, Inc. <<EMAIL>>
All rights reserved.
Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/
use crate::{
command::{
get::get_property, install::install_extensi... |
use crate::message_signatures::encode_tx_batch_confirm_hashed;
use crate::utils::{encode_valset_struct, get_tx_batch_nonce, GasCost};
use clarity::PrivateKey as EthPrivateKey;
use clarity::{Address as EthAddress, Uint256};
use gravity_utils::error::GravityError;
use gravity_utils::types::*;
use std::{cmp::min, time::Du... |
//! Contains [`Sources`] definition, a set of JS source code files with attached source map.
use crate::prelude::*;
use crate::visualization::Project;
use sourcemap::SourceMapBuilder;
use std::path::PathBuf;
// ============================
// === Visualizations paths ===
// ============================
/// Path ... |
use std::cell::{Cell, RefCell};
use std::fmt;
use std::marker::PhantomData;
#[derive(Debug, Clone, Copy)]
pub(crate) enum EnterContext {
Entered {
#[allow(dead_code)]
allow_blocking: bool,
},
NotEntered,
}
impl EnterContext {
pub(crate) fn is_entered(self) -> bool {
if let Ente... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::transport::{ConnectionOrigin, Transport};
use futures::{future::Future, stream::Stream};
use libra_network_address::NetworkAddress;
use libra_types::PeerId;
use pin_project::pin_project;
use std::{
pin::Pin,
task::{C... |
#[macro_use]
extern crate lazy_static;
mod error;
mod export_names;
mod import_map;
mod jsx;
mod resolve_fold;
mod resolver;
mod source_type;
mod strip_ssr;
mod swc;
use import_map::ImportHashMap;
use resolver::{DependencyDescriptor, InlineStyle, ReactOptions, Resolver};
use serde::{Deserialize, Serialize};
use sourc... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
code_cache::module_cache::ModuleCache,
frame::Frame,
loaded_data::function::{FunctionRef, FunctionReference},
IndexKind,
};
use solana_libra_types::vm_error::{StatusCode, VMStatus};
use solana_libra_vm::err... |
extern crate rand;
extern crate rustneat;
use rustneat::{Environment, NeatParams, NeuralNetwork, Organism, Population};
use std::io::Write;
// This example measure average XOR performance, and should be useful to check
// that changes in the algorithm doesn't break the algorithm
struct XORClassification;
impl Envir... |
use super::Result;
use rspirv::dr::{Instruction, Module};
use rspirv::spirv::{Capability, Decoration, LinkageType, Op, Word};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_errors::ErrorReported;
use rustc_session::Session;
pub fn run(sess: &Session, module: &mut Module) -> Result<()> {
let (rewr... |
use super::session::CmdCtxHandler;
use super::session::{handle_session, Session};
use super::slowlog::SlowRequestLogger;
use crate::common::batch::BatchStrategy;
use crate::common::config::ConfigError;
use crate::common::track::TrackedFutureRegistry;
use crate::common::utils::{resolve_first_address, ThreadSafe};
use fu... |
// 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... |
use crate::char_validator::CharValidator;
use crate::Emitter;
use crate::Reader;
#[derive(Debug)]
pub(crate) struct ReadHelper<R: Reader> {
reader: R,
last_character_was_cr: bool,
#[allow(clippy::option_option)]
to_reconsume: Option<Option<u8>>,
}
impl<R: Reader> ReadHelper<R> {
pub(crate) fn new(... |
use super::app;
use snui::wayland::Buffer;
use wayland_client::protocol::{
wl_compositor::WlCompositor,
wl_output::{Event, WlOutput},
wl_seat::WlSeat,
wl_shm::WlShm,
wl_surface::WlSurface,
};
use wayland_protocols::wlr::unstable::layer_shell::v1::client::{
zwlr_layer_surface_v1,
};
use std::time... |
//! Redirect deps
use crate::{registry::Registry, result::Result};
use etc::{Etc, Read, Write};
use std::path::PathBuf;
const PATH_ATTR_PATT: &str = "path = \"";
const GIT_ATTR_PATT: &str = "git = \"";
const VERSION_ATTR_PATT: &str = "version = \"";
const TAG_ATTR_PATT: &str = "tag = \"";
const INLINE_DEP_ANCHOR: &str... |
//! An implementation of `loader::Handle`, based on `walkdir` and `notify`.
//!
//! The file watching bits here are untested and quite probably buggy. For this
//! reason, by default we don't watch files and rely on editor's file watching
//! capabilities.
//!
//! Hopefully, one day a reliable file watching/walking cra... |
use core::str;
use crate::endian::LittleEndian as LE;
use crate::pe;
use crate::read::{
self, ComdatKind, ObjectComdat, ReadError, ReadRef, Result, SectionIndex, SymbolIndex,
};
use super::CoffFile;
/// An iterator over the COMDAT section groups of a `CoffFile`.
#[derive(Debug)]
pub struct CoffComdatIterator<'da... |
use crate::errors::SdError;
use serde::{Deserialize, Serialize};
use std::io::Read;
use std::{fmt, fs};
use uuid::Uuid;
/// A 128-bits ID.
#[derive(Clone, Eq, PartialEq, Deserialize, Serialize)]
#[serde(transparent)]
pub struct Id128 {
#[serde(flatten, serialize_with = "Id128::ser_uuid")]
uuid_v4: Uuid,
}
imp... |
use fnv::{FnvHashMap, FnvHashSet};
use libipld::Cid;
use std::{
fmt::Debug,
ops::{Deref, DerefMut},
sync::Arc,
time::{Duration, Instant},
};
mod async_tracker;
mod sqlite_tracker;
pub use async_tracker::{AsyncCacheTracker, Spawner};
use parking_lot::Mutex;
pub use sqlite_tracker::SqliteCacheTracker;
#[... |
use std::collections::HashMap;
use crate::atn_state::ATNState;
use crate::atn_state::ATNStateRef;
use crate::atn_type::ATNType;
use crate::dfa::ScopeExt;
use crate::interval_set::IntervalSet;
use crate::lexer_action::LexerAction;
use crate::ll1_analyzer::LL1Analyzer;
use crate::parser::ParserNodeType;
use crate::rule_... |
// Copyright 2019, 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... |
#![deny(
warnings,
rust_2018_idioms,
clippy::disallowed_methods,
clippy::disallowed_types
)]
#![forbid(unsafe_code)]
pub mod access_log;
pub mod level;
pub mod test;
mod uptime;
use self::uptime::Uptime;
use linkerd_error::Error;
use std::str;
use tracing::{Dispatch, Subscriber};
use tracing_subscribe... |
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors
//
// 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
//
// Unl... |
//! Connection Request Handler
//!
//! This module contains the logic for sending all outgoing messagse through the connection sink.
use futures::stream::Fuse;
use futures::sync::mpsc::{unbounded, UnboundedReceiver, UnboundedSender};
use futures::{try_ready, Async, AsyncSink, Future, Poll, Sink, Stream};
use crate::h... |
// Lookup Rules:
// - https://github.com/rust-lang/rustc-guide/blob/master/src/method-lookup.md
// - https://doc.rust-lang.org/reference/expressions/method-call-expr.html
//
// Simplified Rules:
// 1. Dereference to create a list of (self: T)
// 2. For each (self: U), find a match method in the following order
// - ... |
use std::marker::PhantomData;
use std::mem;
use std::ptr;
use std::time::Duration;
use libc::{c_int, c_void, timeval};
use libusb::*;
use device::{self, Device};
use device_list::{self, DeviceList};
use device_handle::{self, DeviceHandle};
use error;
#[cfg(windows)] type Seconds = ::libc::c_long;
#[cfg(windows)] typ... |
//! Handles layout of functions, globals, constants in the overall program.
use std::collections::{HashMap, HashSet};
use std::convert::TryInto;
use std::hash::Hash;
use crate::types::global::{self, TyKind, ExprKind};
use crate::types::entity::{ConstTc, Entity, ProcTc};
use crate::types::mir::{ConstKind, Constant, Pl... |
use std::cmp::Ord;
use std::cmp::Ordering;
use std::collections::binary_heap::PeekMut;
use std::collections::BinaryHeap;
use std::marker::PhantomPinned;
use std::ops::Generator;
use std::ops::GeneratorState;
use std::pin::Pin;
pub struct WaitCycles {
cycles: u64,
}
#[inline(always)]
pub fn wait_cycles(cycles: u64... |
use alloc::sync::Arc;
use spin::Mutex;
use super::{
BlockDevice,
Bitmap,
SuperBlock,
DiskInode,
DiskInodeType,
Inode,
get_block_cache,
};
use crate::BLOCK_SZ;
pub struct EasyFileSystem {
pub block_device: Arc<dyn BlockDevice>,
pub inode_bitmap: Bitmap,
pub data_bitmap: Bitmap,
... |
//! Scoping and symbols.
use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
use std::num::NonZeroUsize;
use crate::ast::NodeId;
use crate::functions::FunctionId;
use crate::types::TypeId;
/// An ID uniquely identifying a symbol.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct SymbolId(usiz... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{constants, error::Error, layout::Layout, secure_backend::SharedBackend};
use libra_crypto::ed25519::Ed25519PublicKey;
use libra_global_constants::{LIBRA_ROOT_KEY, OPERATOR_KEY, OWNER_KEY};
use libra_secure_storage::KVStorag... |
use crate::constants::{PITCH_LEFT_LINE, PITCH_RIGHT_LINE, PLAYER_DIAMETER, STADIUM_HEIGHT};
use rapier2d::dynamics::{RigidBodyHandle, RigidBodySet};
use rapier2d::prelude::*;
use serde::{Deserialize, Serialize};
use wasm_bindgen::closure::Closure;
use wasm_bindgen::prelude::wasm_bindgen;
use wasm_bindgen::JsCast;
pub ... |
use super::{rule_editor::RuleEditor, Editor, Mode, Msg};
use crate::{AppRoute, Rule};
use bootstrap_rs::{
input::InputType, Breadcrumb, BreadcrumbItem, ButtonGroup, CardBody, CardHeader, CardText,
FormGroup, Input, TextArea,
};
use validator::{ValidationErrors, ValidationErrorsKind};
use yew::prelude::*;
use ye... |
use std::iter::Iterator;
use crate::SeqNumber;
/// Iterator for compressing loss lists
pub struct CompressLossList<I> {
/// Underlying iterator
iterator: I,
/// The next item
next: Option<SeqNumber>,
/// Some if looping
last_in_loop: Option<SeqNumber>,
}
impl<I> Iterator for CompressLossLis... |
//! Argon2 memory block functions
use core::{
convert::TryInto,
num::Wrapping,
ops::{BitXor, BitXorAssign, Index, IndexMut},
slice,
};
#[cfg(feature = "zeroize")]
use zeroize::Zeroize;
/// Structure for the (1KB) memory block implemented as 128 64-bit words.
#[derive(Copy, Clone, Debug)]
pub(crate) s... |
// https://github.com/mesalock-linux/rust-optee-trustzone-sdk/blob/9785e927b14b607f3d052821b2df6d8a60535a79/optee-teec/src/parameter.rs
use crate::wrapper::raw::{TEEC_Parameter, TEEC_TempMemoryReference};
use core::{marker::PhantomData, mem};
pub trait Param {
fn from_raw(raw: TEEC_Parameter, param_type: ParamTyp... |
// day 21
struct Packet {
address:i64,
x:i64,
y:i64,
}
struct Nic {
prog:super::utility::IntcodeProgram,
in_buffer:super::utility::IOBuffer,
out_buffer:super::utility::IOBuffer,
packet_buffer:Vec<Packet>,
is_waiting:bool,
is_exited:bool,
}
fn run_network(prog:&mut super::utility::IntcodeProgram, part_b:bool... |
use std::{path::Path, sync::Arc};
use amethyst_assets::Source as AssetSource;
use amethyst_error::Error;
use gltf::{self, json, Gltf};
use crate::error;
#[derive(Debug)]
pub enum ImageFormat {
Png,
Jpeg,
}
impl ImageFormat {
fn from_mime_type(mime: &str) -> Self {
match mime {
"image... |
use crate::game::{WINDOW_H, WINDOW_W};
use rand::Rng;
use std::thread;
use crate::game::ENEMIES;
use crate::shapes::LIGHT_RADIUS;
pub const PLAYER_X: f32 = 10.0;
pub const PLAYER_Y: f32 = 10.0;
pub const PLAYER_H: f32 = 5.0;
pub const PLAYER_W: f32 = 5.0;
pub static mut READY_TO_BOOST: bool = true;
static mut BOOSTIN... |
use crate::plugins::*;
use crate::Html;
use std::any::Any;
use std::collections::HashMap;
/// An action which can be taken by many plugins. When run, a functional action will return a map of plugin names to their return types.
pub struct FunctionalPluginAction<A, R> {
/// The runners that will be called when this ... |
#![allow(dead_code)]
use mem_arena::MemArena;
use crate::{
algorithm::partition, bbox::BBox, boundable::Boundable, lerp::lerp_slice, ray::AccelRay,
timer::Timer,
};
use super::{
bvh_base::{BVHBase, BVHBaseNode, BVH_MAX_DEPTH},
ACCEL_NODE_RAY_TESTS, ACCEL_TRAV_TIME,
};
#[derive(Copy, Clone, Debug)]
p... |
use ahash::AHashMap;
use serde::Deserialize;
use std::os::unix::fs::MetadataExt;
use std::os::unix::fs::PermissionsExt;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::time::Instant;
use structopt::StructOpt;
use walkdir::WalkDir;
use watchman_client::prelude::*;
#[derive(StructOpt, Debug)]
#[structopt(ab... |
extern crate rusty_machine;
extern crate rand;
extern crate rayon;
use rusty_machine::linalg::{Vector};
use rand::Rng;
mod base;
use base::{_BaseParticleFilter, BaseParticleFilter};
struct ParticleFilter {
n_particles: usize,
predicted_value: Vec<f64>, // number of particles.
filtered_value: Vec<f64>,
... |
//! Exercises load balancers with mocked services.
extern crate env_logger;
extern crate futures;
extern crate hdrsample;
extern crate log;
extern crate rand;
extern crate tokio;
extern crate tower;
extern crate tower_balance;
extern crate tower_buffer;
extern crate tower_discover;
extern crate tower_in_flight_limit;
... |
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use move_binary_format::CompiledModule;
use move_package::BuildConfig;
use move_unit_test::UnitTestingConfig;
use num_enum::TryFromPrimitive;
use once_cell::sync::Lazy;
use std::path::Path;
use sui_types::error::{SuiError, SuiResult};
pub... |
extern crate reqwest;
use crate::wt_error;
use crate::AnyError;
use serde::Deserialize;
use serde::Serialize;
use std::io::Seek;
#[derive(Debug, Serialize, Deserialize)]
struct ReleaseAsset {
url: String,
id: i32,
name: String,
content_type: String,
size: i32,
browser_download_url: String,
}
... |
use crate::children::ChildrenRef;
use crate::context::BastionId;
use crate::message::BastionMessage;
use crate::supervisor::SupervisorRef;
use crate::system::SYSTEM;
use futures::channel::mpsc::{self, UnboundedReceiver, UnboundedSender};
use futures::prelude::*;
use fxhash::FxHashMap;
use std::pin::Pin;
use std::task::... |
//! `Subscribe` message content. This message is published by a user willing to become
//! a subscriber to this channel. It contains subscriber's NTRU public key that will be used
//! in keyload to encrypt session keys. Subscriber's NTRU public key is encrypted with
//! the `unsubscribe_key` which in turn is encapsulat... |
//! A basic input + output stream example, copying the mic input stream to the default output stream
extern crate coreaudio;
use std::collections::VecDeque;
use std::sync::{Arc, Mutex};
use coreaudio::audio_unit::{AudioUnit, Element, SampleFormat, Scope, StreamFormat};
use coreaudio::audio_unit::audio_format::Linear... |
use std::{
collections::HashSet,
hash::{Hash, Hasher},
};
use super::{direction::CardinalDir, orient::Orientable};
pub(crate) const TILE_SIZE: usize = 10;
pub(crate) const X: TileCell = TileCell(true);
pub(crate) const O: TileCell = TileCell(false);
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Partia... |
#![allow(dead_code)] //TODO: remove
use glow::Context;
use crate::hal::{pso, ColorSlot};
use smallvec::SmallVec;
use crate::{GlContainer, Share};
pub(crate) fn bind_draw_color_buffers(gl: &GlContainer, num: usize) {
let attachments: SmallVec<[u32; 16]> = (0..num)
.map(|x| glow::COLOR_ATTACHMENT0 + x as u3... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
_reserved0: [u8; 1536usize],
#[doc = "0x600 - Block protect configuration register 0"]
pub config0: CONFIG0,
#[doc = "0x604 - Block protect configuration register 1"]
pub config1: CONFIG1,
#[doc = "0x608 - Disable protection mechan... |
mod aliaser;
mod artifact_choosing;
mod auth_store;
mod ci_string;
mod config;
mod error;
mod fs;
mod paths;
mod tool_cache;
mod tool_provider;
use std::{env, ffi::OsStr, process};
use paths::ForemanPaths;
use structopt::StructOpt;
use crate::{
aliaser::add_self_alias,
auth_store::AuthStore,
config::Conf... |
//! `tor-config`: Tools for configuration management in Arti
//!
//! # Overview
//!
//! This crate is part of
//! [Arti](https://gitlab.torproject.org/tpo/core/arti/), a project to
//! implement [Tor](https://www.torproject.org/) in Rust.
//!
//! It provides a client configuration tool using using `serde` and `config`,... |
use alloc::sync::Arc;
use crate::arch::rand;
use crate::drivers::{NET_DRIVERS, SOCKET_ACTIVITY};
use crate::sync::SpinNoIrqLock as Mutex;
use crate::syscall::*;
use smoltcp::socket::*;
use smoltcp::wire::*;
lazy_static! {
pub static ref SOCKETS: Arc<Mutex<SocketSet<'static, 'static, 'static>>> =
Arc::new(... |
/*!
The "maximal zero-sum partitioning" problem may be stated thus:
> Given a multiset of numbers *X*, such that ∑(*X*) =0, partition *X* into the maximum number of
> subsets so that each subset sums to zero
This crate implements a dynamic programming-based solution to this problem.
```
# use mzsp::*;
let partitiona... |
extern crate serde_derive;
extern crate toml;
use super::error::Result;
#[derive(Serialize, Deserialize)]
pub struct Entry {
pub ip: String,
pub domain: Option<String>,
pub using: bool,
pub open_ports: Vec<u32>,
pub description: Option<String>,
}
impl Entry {
pub fn ports_as_string(&self) -> ... |
#![doc = include_str!("../Readme.md")]
use std::ffi::c_void;
use std::os::raw::*;
use std::io;
use std::path::Path;
use std::ptr::*;
/// The error type of this library, [std::io::Error](https://doc.rust-lang.org/std/io/struct.Error.html)
pub type Error = std::io::Error;
/// The result type of this library, [std::io:... |
/*!
*/
use std::time::Duration;
const REMOTE_MAC: [u8; 6] = *b"RSK\x12\x34\x56";
const LOCAL_MAC: [u8; 6] = *b"RSK\xFE\xFE\xFE";
pub mod tcp;
pub mod ipv4;
pub mod ethernet;
pub struct TestFramework {
socket: std::net::UdpSocket,
remote_addr: std::net::SocketAddr,
process: std::process::Child,
logfi... |
use std::{error, fmt};
use std::net::SocketAddr;
use std::time::Duration;
use std::sync::Arc;
use futures::{Async, Poll};
use http;
use rand;
use tower;
use tower_balance::{self, choose, load, Balance};
use tower_buffer::Buffer;
use tower_discover::{Change, Discover};
use tower_in_flight_limit::InFlightLimit;
use towe... |
extern crate base64;
use byteorder::{LittleEndian, ReadBytesExt};
use std::io::{Read, Seek};
#[derive(Copy, Clone, Default)]
#[derive(Debug)]
pub struct FitCrc{
crc: u16,
}
impl FitCrc {
pub fn new() -> FitCrc
{
return FitCrc { crc: 0, };
}
pub fn consume(&mut self, byte_array: &[u8]) {... |
// Copyright 2020 by <NAME> <<EMAIL>>
//
// 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 t... |
// Tests all pins by outputting unique patterns
//
// HVQFN33 package
// Pin LPC802 LPC804 LPC824 LPC845
// 1 PIO0_17 PIO0_17 PIO0_13 PIO0_13
// 2 PIO0_13 PIO0_13 PIO0_12 PIO0_12
// 3 PIO0_12 PIO0_12 nRESET nRESET
// 4 nRESET nRESET PIO0_4 PIO0_4
// 5 PIO0_4 PIO0_4 PIO0_28 PIO... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.