text stringlengths 3.09k 13.9k |
|---|
/*
Copyright 2021 JFrog Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writi... |
use std::fmt;
#[derive(Debug, Clone, PartialEq)]
pub enum Symbol {
Module, // module
Declare, // declare
Struct, // struct
OpeningBrace, // {
ClosingBrace, // }
LeftParen, // (
RightParen, // )
LeftSquareBracket, // [
... |
use super::chunked_genome::{Chunk, ChunkedGenome};
use super::OurTree;
use crate::bam_ext::{open_bam, BamRecordExtensions};
use crate::rust_htslib::bam::Read;
use crate::BamError;
use rayon::prelude::*;
use rust_htslib::bam;
use std::collections::{HashMap, HashSet};
use std::hash::Hash;
///Quantify reads into gene_sta... |
#[cfg(feature = "stream")]
use async_std;
#[cfg(feature = "stream")]
use async_std::net::TcpStream;
#[cfg(feature = "stream")]
use async_std::prelude::FutureExt;
#[cfg(feature = "stream")]
use async_std::task;
#[cfg(feature = "stream")]
use brontide::{BrontideBuilder, BrontideStream};
#[cfg(feature = "stream")]
use fut... |
extern crate game_of_life;
#[macro_use]
extern crate glium;
extern crate time;
use glium::{DisplayBuild, Program, Surface, VertexBuffer};
use glium::backend::Facade;
use glium::glutin::ElementState::Pressed;
use glium::glutin::{Event, WindowBuilder, VirtualKeyCode};
use glium::index;
use glium::texture::Texture2d;
use... |
use core::{intrinsics::transmute, marker::PhantomData};
use crate::pac::{
generic::Reg,
systimer::{
target0_conf::TARGET0_CONF_SPEC,
target0_hi::TARGET0_HI_SPEC,
target0_lo::TARGET0_LO_SPEC,
},
SYSTIMER,
};
// TODO this only handles unit0 of the systimer
#[derive(Debug)]
pub s... |
use bastion::prelude::*;
fn main() {
env_logger::init();
Bastion::init();
Bastion::supervisor(sp).expect("Couldn't create the supervisor.");
Bastion::start();
Bastion::block_until_stopped();
}
fn sp(supervisor: Supervisor) -> Supervisor {
let callbacks = Callbacks::new()
.with_befor... |
use crate::device::{RCC,FLASH};
use crate::rcc;
use self::rcc::{Rccf1};
//use crate::flash::{FlashLatency,Ocm3CommonFlash};
/* I2S3SRC: I2S3 clock source */
pub use crate::device::rcc::cfgr2::I2S3SRCW as I2S3Src;
/* I2S2SRC: I2S2 clock source */
pub use crate::device::rcc::cfgr2::I2S2SRCW as I2S2Src;
/* PREDIV1SRC:... |
// use crate::apf::timescale_functions::{LivenessCounter, ReuseCounter};
use crate::apf::liveness_counter::LivenessCounter;
use crate::apf::reuse_counter::ReuseCounter;
#[cfg(feature = "show_records")]
use gnuplot::{Caption, Color, Figure};
mod constants;
use crate::apf::constants::{REUSE_BURST_LENGTH, REUSE_HIBERNAT... |
//! The GUI
use super::panel::Panel;
use super::chip8panel::{self, Chip8Panel};
use super::rampanel::RamPanel;
use super::stackpanel::StackPanel;
use super::piston_window as pwindow;
use super::sprite;
use super::{Point32, DrawingContext};
/// Width of the whole GUI in pixels
const WIDTH_NPIXELS: u32 = 640;
/// Heigh... |
const RADIUS_AT_EQUATOR: f64 = 6378137.0;
const FLATTENING_ELIPSOID: f64 = 1.0 / 298.257223563;
const RADIUS_AT_POLES: f64 = (1.0 - FLATTENING_ELIPSOID) * RADIUS_AT_EQUATOR;
const MAX_ITERATIONS: u32 = 200;
const CONVERGENCE_THRESHOLD: f64 = 0.000000000001;
const PRECISION: i32 = 6;
pub type Coordinate = (f64, f64);
... |
use super::core;
use super::core::error::{AppError, InternalError, InternalError::SessionError};
use super::core::models::OauthSession;
use super::core::AppState;
use crate::config;
use actix_session::Session;
use actix_web::http::header::CONTENT_LOCATION; // header "location" is blocked by cors
use actix_web::http::St... |
use std::marker::PhantomData;
use unsafe_unwrap::UnsafeUnwrap;
use crate::algorithms::dfs_visit::Visitor;
use crate::fst_properties::FstProperties;
use crate::fst_traits::{ExpandedFst, Fst};
use crate::semirings::Semiring;
use crate::Tr;
use crate::{StateId, NO_STATE_ID};
pub struct SccVisitor<'a, W: Semiring, F: Fs... |
// fetchjsonformatmod.rs
//! fetch JSON format
//region: use
use crate::rootrenderingmod::RootRenderingComponent;
use crate::fetchmod;
use crate::logmod;
use crate::stringmod;
use crate::unwrapmod;
use crate::unwrapmod::required;
//use unwrap::unwrap;
use indexmap::IndexMap;
use web_sys::{Request, RequestInit};
use s... |
use std::{future::Future, vec};
use std::panic;
use std::time::Instant;
use tracing::instrument;
use tracing_error::ErrorLayer;
use tracing_log::LogTracer;
use tracing_subscriber::{fmt, prelude::__tracing_subscriber_SubscriberExt, EnvFilter};
use eyre::Result;
use std::time::Duration;
fn init_log_system() -> Result<(... |
use std::fs::{read_dir, DirEntry};
use std::os::linux::fs::MetadataExt;
use std::os::unix::fs::FileTypeExt;
use std::os::unix::fs::PermissionsExt;
use std::time::SystemTime;
pub enum Kind {
File,
Dir,
Link,
Fifo,
Block,
Char,
Socket,
}
// https://www.gnu.org/software/libc/manual/html_node/... |
mod contains;
mod get;
mod insert;
mod keys;
pub mod path_iter;
mod remove;
pub mod value;
use std::collections::BTreeMap;
use std::fmt::{Debug, Display};
use std::sync::Arc;
use bytes::Bytes;
use chrono::Utc;
use log_schema::log_schema;
use serde::{Deserialize, Serialize};
use shared::ByteSizeOf;
use tracing::field:... |
extern crate rand;
use std::collections::HashMap;
use std::fmt;
use std::process::Command;
use std::{thread, time};
const WORLDWIDTH: i32 = 20;
const WORLDHEIGHT: i32 = 10;
const INITIALSPAWNTOLERANCE: f32 = 0.4;
const MAXSTEPS: i32 = 100;
fn clear_console() {
// Clear the terminal.
let output = Command::new... |
use std::env;
use std::ffi;
use std::fs;
use std::io::{self, BufRead, Write};
use std::iter::Iterator;
use std::os::raw;
use std::os::unix::{ffi::OsStrExt, io::AsRawFd};
use std::path::{Path, PathBuf};
use std::process;
use tempfile::NamedTempFile;
use thiserror::Error;
const USAGE: &str = r#"usage: bulkrename [-h|--... |
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... |
use std::iter;
use datasize::DataSize;
use itertools::Itertools;
use serde::{Deserialize, Serialize};
use thiserror::Error;
use super::validators::ValidatorIndex;
use crate::components::consensus::{
highway_core::{
endorsement::SignedEndorsement, highway::SignedWireUnit, state::Params,
validators:... |
use std::c_str::ToCStr;
use std::kinds::marker;
use std::str;
use libc;
use {raw, Error, Reference, Signature, BranchType};
/// A structure to represent a git [branch][1]
///
/// A branch is currently just a wrapper to an underlying `Reference`. The
/// reference can be accessed through the `get` and `unwrap` methods... |
//! Decode pixel data using GDCM when the default features are enabled.
use crate::*;
use dicom_encoding::adapters::DecodeError;
use dicom_encoding::transfer_syntax::TransferSyntaxIndex;
use dicom_transfer_syntax_registry::TransferSyntaxRegistry;
use gdcm_rs::{decode_single_frame_compressed, GDCMPhotometricInterpretat... |
pub const BINGO_SENTINEL: i64 = -1;
struct BingoBoard {
pub rows: usize,
pub columns: usize,
pub numbers: Vec<i64>,
}
impl BingoBoard {
pub fn check_off_number(&mut self, number: i64) {
for i in 0..self.numbers.len() {
if self.numbers[i] == number {
self.numbers[i] ... |
use crate::{DefaultRootSpanBuilder, RequestId, RootSpan, RootSpanBuilder};
use actix_web::dev::{Service, ServiceRequest, ServiceResponse, Transform};
use actix_web::{Error, HttpMessage, ResponseError};
use futures::future::{ok, Ready};
use std::future::Future;
use std::pin::Pin;
use tracing::Span;
use tracing_futures::... |
/// Heavily inspired from the [render_to_texture][1] example
/// [1]: https://github.com/bevyengine/bevy/blob/main/examples/3d/render_to_texture.rs
use super::first_pass::*;
use crate::default_gizmo;
use bevy::{
core_pipeline::RenderTargetClearColors,
prelude::*,
reflect::TypeUuid,
render::{
cam... |
use contract_ffi::bytesrepr;
use contract_ffi::bytesrepr::{FromBytes, ToBytes, U32_SIZE};
const NUM_FIELDS: usize = 10;
pub const WASM_COSTS_SIZE_SERIALIZED: usize = NUM_FIELDS * U32_SIZE;
// Taken (partially) from parity-ethereum
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct WasmCosts {
/// Default opc... |
use std::mem::{self, MaybeUninit};
use std::ptr;
use std::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
use std::sync::Arc;
use arc_swap::{ArcSwapOption, Guard};
use crossbeam::queue::SegQueue;
const CHUNK_SIZE: usize = 1024;
/// It's a linked list of chunks, with an associated free list!
/// Note that there is ... |
//! Functions to format types from DOF.
// Copyright 2021 Oxide Computer Company
//
// 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
//
/... |
use std::collections::HashMap;
use std::convert::TryInto;
use std::fs::File;
use std::io::Read;
use std::time::SystemTime;
use sdl2::audio::{AudioCallback, AudioSpecDesired, AudioSpec};
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use structopt::StructOpt;
use chip8::{Chip8Emulator, Insn};
use gl_scene::Scen... |
use std::mem;
use std::io;
use std::io::Write;
use byteorder::{LittleEndian, WriteBytesExt};
use std::io::BufWriter;
use std::fs::File;
#[derive(Debug)]
pub struct BitmapFileHeader {
header: [u8; 2],
file_size: u32,
reserved: i32,
data_offset: u32
}
impl BitmapFileHeader {
pub fn new() -> BitmapFile... |
use llvm_sys::core::{LLVMMDNode, LLVMMDString, LLVMIsAMDNode, LLVMIsAMDString, LLVMGetMDString, LLVMGetMDNodeNumOperands, LLVMGetMDNodeOperands, LLVMGetMDKindID};
use llvm_sys::prelude::LLVMValueRef;
#[llvm_versions(7.0..=latest)]
use llvm_sys::prelude::LLVMMetadataRef;
#[llvm_versions(7.0..=latest)]
use llvm_sys::cor... |
//! Used to define a state machine.
use kube::api::{PatchParams, Resource, ResourceExt};
use kube::Api;
use serde::de::DeserializeOwned;
use tracing::Instrument;
use tracing::{debug, error, trace, warn};
use crate::object::ObjectStatus;
use crate::Manifest;
// Re-export for compatibility.
pub use crate::object::Objec... |
/// Common code for printing the backtrace in the same way across the different
/// supported platforms.
use crate::env;
use crate::io;
use crate::io::prelude::*;
use crate::mem;
use crate::path::{self, Path};
use crate::ptr;
use crate::sync::atomic::{self, Ordering};
use crate::sys::mutex::Mutex;
use backtrace::{Byt... |
use serial_packet_parser::USARTPacket;
// constants for address range sizes
const CONFIG_ARRAY_SIZE: u8 = 64;
const DATA_ARRAY_SIZE: u8 = 60;
const COMMAND_COUNT: u8 = 12;
// constants for address starts
const DATA_ARRAY_START: u8 = 80;
const COMMAND_ADDR_START: u8 = 160;
// size of register array
const REGISTER_ARR... |
// Copyright 2019 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... |
use serde::{Serialize, Deserialize};
use serde_json;
use std::collections::HashSet;
use crate::types::{LiveEvent, Pair, Channel};
use crate::types;
use bigdecimal::BigDecimal;
use super::utils;
#[derive(Serialize, Deserialize, Debug)]
pub struct LiveTrade {
microtimestamp: String,
amount: f32,
buy_order_id... |
use super::*;
pub(super) fn write(
mut buf: String,
node: Node,
fmts: &[Fmt],
col: usize,
inline_field_id: bool,
map: NamedIter,
) -> String {
let fmt = fmts.get(node.index()).unwrap();
let id = node.kserd().id();
let prefix = |mut buf| {
maybe_write_nonprim_ident(&mut buf... |
use std::{
ffi::OsString,
path::{Component, Path},
};
use rustc_ast::ast;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_lint::{EarlyContext, EarlyLintPass, Level, LintContext};
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::{FileName, RealFileName, SourceFile, Span, ... |
extern crate bjorn;
#[test]
fn valid_comparisons() {
// Equal
assert_eq!(bjorn::interpret("1 == 1"), String::from("true"));
assert_eq!(bjorn::interpret("1 == 2"), String::from("false"));
assert_eq!(bjorn::interpret("1.0 == 1"), String::from("true"));
assert_eq!(bjorn::interpret("1 == 1.0"), String:... |
// 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... |
#[cfg(test)]
mod common;
#[cfg(test)]
mod interface_tests {
use environment::Environment;
use crate::common;
use rand::Rng;
use reqwest::StatusCode;
use std::fs::{self, File};
use std::io::{BufReader, Read};
use std::process::Child;
use std::process::Command;
use std::thread;
... |
// THIS IS ONE REFERENCE IMPLEMENTATION
// IT IS NOT EXACTLY WHAT WE WILL CREATE DURING THE TUTORIAL...but it's pretty similar.
use rusty_sword_arena::{
audio::Audio,
game::{ButtonProcessor, PlayerEvent, PlayerInput, PlayerState},
gfx::{angle_facing, GameEvent, Img, Vec2, Window},
net::ConnectionToServ... |
use std::{collections::HashMap, io, path::Path};
struct DiagnosticReport {
gamma_rate: u32,
epsilon_rate: u32,
oxygen_generator_rating: u32,
co2_scrubber_rating: u32,
}
impl DiagnosticReport {
fn new() -> Self {
Self {
gamma_rate: 0,
epsilon_rate: 0,
oxy... |
use crate::model::OnnxOpRegister;
use crate::model::ParseResult;
use crate::model::ParsingContext;
use crate::pb::NodeProto;
use tract_hir::internal::*;
use tract_core::ops;
use tract_itertools::Itertools;
pub fn register_all_ops(reg: &mut OnnxOpRegister) {
reg.insert("Not", |_, _| Ok((Box::new(ops::logic::not()),... |
use std::{collections::HashMap, env::var, thread::sleep, time::Duration};
use testcontainers::{
core::{Container, Docker, Port, WaitForMessage},
Image,
};
pub const MONEROD_RPC_PORT: u16 = 48081;
pub const WALLET_RPC_PORT: u16 = 48083;
#[derive(Debug)]
pub struct Monero {
tag: String,
args: Args,
... |
use crate::{instructions::gas, Machine, Return, Spec};
use super::i256::{i256_div, i256_mod};
use core::{convert::TryInto, ops::Rem};
use primitive_types::{U256, U512};
#[inline(always)]
pub fn div(op1: U256, op2: U256) -> U256 {
if op2.is_zero() {
U256::zero()
} else {
op1 / op2
}
}
#[in... |
use std::borrow::Cow;
use std::convert::TryInto;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use std::task::Poll;
use std::time::Instant;
use slab::Slab;
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
use wasmtime::Trap;
use crate::interop::rpc::{RpcMet... |
// Copyright (c) 2020 <NAME> worlds <<EMAIL>>
// SPDX-License-Identifier: MIT
//! A minimalist [AWS Lambda][lambda] [runtime] for Rust.
//!
//! ```rust,no_run
//! fn main() -> ! {
//! minlambda::run_ok(|_: serde::de::IgnoredAny| "Hello, world!")
//! }
//! ```
//!
//! [lambda]: https://aws.amazon.com/lambda/
//! [r... |
#![feature(const_fn)]
#![feature(untagged_unions)]
#![feature(libc)]
#![allow(unused_assignments)]
extern crate core;
extern crate libc;
extern crate static_assertions;
extern crate sysconf;
use std::thread::sleep;
use std::time::Duration;
#[macro_use]
mod types;
mod device;
mod memory;
mod pci;
pub use self::devic... |
//! Encapsulation for system call arguments and return values.
//!
//! The inline-asm and outline-asm code paths do some amount of reordering
//! of arguments; to ensure that we don't accidentally misroute an argument
//! or return value, we use distinct types for each argument index and
//! return value.
//!
//! # Saf... |
// Copyright (c) 2019-2020 Web 3 Foundation
//! ### Ring VRF keys
use std::io;
use std::ops::Add;
// use core::fmt::{Debug};
// use subtle::{Choice,ConstantTimeEq};
use rand_core::{RngCore,CryptoRng};
use zeroize::Zeroize;
use crate::{ReadWrite, Scalar};
use group::GroupEncoding;
/// Public key consisting of a J... |
use core::mem;
use super::sdt::Sdt;
use self::drhd::Drhd;
use crate::memory::Frame;
use crate::paging::{ActivePageTable, PhysicalAddress};
use crate::paging::entry::EntryFlags;
use super::{find_sdt, load_table, get_sdt_signature};
pub mod drhd;
/// The DMA Remapping Table
#[derive(Debug)]
pub struct Dmar {
sdt:... |
//! Utilities for building strategies.
use std::collections::HashMap;
use itertools::Itertools;
use regex::bytes::{Regex, RegexBuilder};
use wordle_rs::strategy::{Grade, Word};
fn generate_regex<'a>(
correct: &[(usize, char)],
incorrect: &str,
almost: impl IntoIterator<Item = (&'a char, &'a (u8, u8))> +... |
use futures::TryStreamExt;
use log::{error, info};
use serde::{Serialize, Deserialize};
use warp::{
Buf,
Rejection,
Reply,
http::StatusCode,
multipart::{
FormData,
Part
},
reply::{
self,
Json,
WithStatus
}
};
use std::{
sync::Arc,
... |
use crate::kzg10;
use crate::{
BTreeMap, PCCommitterKey, PCPreparedCommitment, PCPreparedVerifierKey, PCVerifierKey, Vec,
};
use ark_ec::{PairingEngine, ProjectiveCurve};
/// `UniversalParams` are the universal parameters for the KZG10 scheme.
pub type UniversalParams<E> = kzg10::UniversalParams<E>;
/// `Randomne... |
mod any;
mod mipmap_or_drawable;
mod res_or_string;
mod types;
pub use any::*;
pub use mipmap_or_drawable::*;
pub use res_or_string::*;
use serde::{
de::{self, Visitor},
Deserialize, Deserializer, Serialize, Serializer,
};
use std::fmt;
use std::io::{Read, Write};
use std::marker::PhantomData;
use std::str::Fr... |
use super::{Jobs, Job, Action};
use crate::controller::Event;
use std::time::Duration;
use std::sync::{Arc, Mutex};
use chrono::{Utc, Local, DateTime, Timelike};
// TODO FIXME multiple things left to do:
// - usually and tomorrow are not written to db
// - setting usually none goes wrong if tomorrow is not none
// - ... |
// 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... |
mod command_copy;
mod command_list_files;
mod command_list_storages;
mod copy;
mod finders;
mod glob;
mod path;
mod wpd;
use std::fmt::Write;
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
enum Command {
None,
ListStorages,
ListFiles,
Copy,
}
#[derive(Debug)]
pub struct Paths {
src: String,
des... |
use actix_web::{web, HttpRequest, HttpResponse};
use r2d2_redis::{r2d2, redis, RedisConnectionManager};
use serde_json::map::Map;
use serde_json::value::Value;
use std::ops::DerefMut;
pub fn get_goods(
req: HttpRequest,
db: web::Data<r2d2::Pool<RedisConnectionManager>>,
) -> HttpResponse {
let query = qstr... |
// Rust Bitcoin Library
// Written in 2014 by
// <NAME> <<EMAIL>>
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This software is distributed without
// any warranty.
//
// You should have rece... |
//! Split timeframe in eras
use crate::timeframe::Slot;
use chain_ser::packer::Codec;
use std::fmt;
/// Epoch number
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Epoch(pub u32);
/// Slot Offset *in* a given epoch
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Epo... |
// Bitcoin secp256k1 bindings
// Written in 2015 by
// <NAME>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This software is distributed without
// any warranty.
//
// You should have receive... |
use super::DerivationCode;
use crate::{error::Error, prefix::SelfAddressingPrefix};
use blake3;
use core::str::FromStr;
use ursa::hash::{
blake2::Blake2,
sha2::{Sha256, Sha512},
sha3::{Sha3_256, Sha3_512},
Digest,
};
/// Self Addressing Derivations
///
/// Self-addressing is a digest/hash of some incep... |
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity Ethereum.
// Parity Ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at yo... |
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
//! Certificate handling.
//!
//! This module implements types and functions for working with the
//! authentication portions of the Cerberus protocol, including
//! cer... |
use std::f32::EPSILON;
use crate::primitives::*;
use bevy::prelude::*;
#[allow(dead_code)]
#[non_exhaustive]
pub enum RaycastAlgorithm {
Geometric,
MollerTrumbore(Backfaces),
}
impl Default for RaycastAlgorithm {
fn default() -> Self {
RaycastAlgorithm::MollerTrumbore(Backfaces::Cull)
}
}
#[... |
// Copyright 2015 The gfx developers.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
//! A pairlist is a linked list of values with optional symbol tags.
use super::*;
#[derive(PartialEq, Clone)]
pub struct Pairlist {
pub(crate) robj: Robj,
}
impl Pairlist {
pub fn new() -> Self {
let robj = Robj::from(());
Self { robj }
}
/// Convert an iterator of names and values ... |
/*
### 5.5. TX_ACK packet ###
That packet type is used by the gateway to send a feedback to the server
to inform if a downlink request has been accepted or rejected by the gateway.
The datagram may optionnaly contain a JSON string to give more details on
acknoledge. If no JSON is present (empty string), this means tha... |
use anyhow::Context;
use healer_core::{target::Target, HashMap, HashSet};
use std::fmt::Write;
use std::hash::Hash;
use std::io::ErrorKind;
use std::sync::atomic::{AtomicU64, Ordering};
use std::{
fs::{create_dir_all, write},
hash::Hasher,
path::PathBuf,
sync::Mutex,
};
use syz_wrapper::{report::Report,... |
/*
* Copyright (c) Meta Platforms, Inc. and its affiliates.
*
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
use crate::{Displayable, FromToRaw, MemoryAccess};
use core::fmt;
use serde::{Deserialize, S... |
use rl_ecs::create_ecs;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
struct Creature {}
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
struct Stats {}
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
struct Inventory {}
#[derive(Copy, Clone, Debug, Serialize, D... |
use std::collections::BTreeMap;
use comfy_table::*;
use pueue_lib::network::message::TaskLogMessage;
use pueue_lib::settings::Settings;
use pueue_lib::task::{Task, TaskResult, TaskStatus};
use super::colors::Colors;
use crate::cli::SubCommand;
mod json;
mod local;
mod remote;
use json::*;
use local::*;
use remote:... |
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::json_rpc::JsonRpcClientWrapper;
use diem_config::config::RoleType;
use diem_management::error::Error;
use diem_network_address::{
encrypted::{Key, KeyVersion, KEY_LEN},
NetworkAddress,
};
use diem_network_address_encr... |
#![cfg_attr(not(feature = "std"), no_std)]
use codec::{Decode, Encode};
use frame_support::{
debug, decl_error, decl_event, decl_module, decl_storage,
dispatch::DispatchResult,
ensure,
traits::{Get, IsType, Randomness},
StorageMap, StorageValue,
};
use frame_system::{self as system, ensure_root, ensure_signed};
u... |
use super::booths::{group_combos, Parties};
use super::utils::StateAb;
use anyhow::{bail, Context, Result};
use std::collections::BTreeMap;
use std::fs::create_dir_all;
/// Projection phase
/// This file corresponds to `SA1s_Multiplier.py`
/// The AEC have given us a
/// "this many people from this SA1 voted at this ... |
//! BAM record data field value type.
use std::{error, fmt};
/// A BAM record data field value type.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum Type {
/// Character (`A`).
Char,
/// 8-bit integer (`c`).
Int8,
/// 8-bit unsigned integer (`C`).
UInt8,
/// 16-bit integer (`s`... |
// Copyright 2021 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 in writ... |
// Copyright (c) 2020 kprotty
//
// 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... |
use clap::{crate_version, App, Arg};
use fake_tcp::packet::MAX_PACKET_LEN;
use fake_tcp::{Socket, Stack};
use log::{debug, error, info};
use std::collections::HashMap;
use std::convert::TryInto;
use std::net::{Ipv4Addr, SocketAddr};
use std::sync::Arc;
use std::time::Duration;
use tokio::net::UdpSocket;
use tokio::sync... |
// 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 {
crate::builtin::capability::BuiltinCapability,
::routing::capability_source::InternalCapability,
anyhow::Error,
async_trait::async_tr... |
use crate::{
agents::{fetcher, repo},
objects::JsError,
};
use chrono::{DateTime, FixedOffset};
use uuid::Uuid;
use wasm_bindgen::{JsCast, JsValue};
use web_sys::IdbCursor;
use yew_agent::HandlerId;
#[derive(Debug)]
pub struct Task {
stage: Stage,
kind: Kind,
request: Option<web_sys::IdbRequest>,
... |
use crate::enclave_u::{check_initchain, check_tx, encrypt_tx, end_block};
use chain_core::state::account::DepositBondTx;
use chain_core::tx::data::TxId;
use chain_core::tx::TxEnclaveAux;
use chain_core::ChainInfo;
use enclave_protocol::IntraEnclaveRequest;
use enclave_protocol::{
is_basic_valid_tx_request, EnclaveR... |
use amethyst::prelude::WorldExt;
use amethyst::StateEvent;
use amethyst::{
animation::{
get_animation_set, AnimationCommand, AnimationControlSet, AnimationSet, EndControl,
},
ecs::{prelude::World, Entities, Join, ReadStorage, WriteStorage},
input::{is_close_requested, is_key_down, InputEvent, V... |
use crate::agents::SignJws;
use crate::bridges::oidc::ProviderKey;
use crate::config::Config;
use crate::email_address::EmailAddress;
use crate::utils::{base64url, keys::SignError, unix_duration, SecureRandom};
use ring::{
digest,
error::Unspecified,
signature::{self, UnparsedPublicKey},
};
use serde_json a... |
use core::fmt::Display;
mod error;
mod ibm;
mod pico;
pub use self::error::*;
pub use self::ibm::*;
pub use self::pico::*;
#[cfg(feature = "extra_langs_tts")]
mod espeak;
#[cfg(feature = "extra_langs_tts")]
pub use self::espeak::*;
#[cfg(feature = "google_tts")]
mod google;
#[cfg(feature = "google_tts")]
pub use se... |
//!
//! This module defines types for execution hierarchy.
//!
//! `Submission` is a piece of work that can be recorded into single primary command buffer.
//! `Submission` contains references to links and semaphores required to wait/signal.
//! `Queue` contains array of `Submission`'s. User is expected to submission c... |
//! https://adventofcode.com/2019/day/15
use advent_of_code_2019::*;
use std::collections::HashMap;
fn main() {
let input = include_str!("../../input/2019/day15.txt").trim();
let code = Intcode::parse(input);
println!("Part 1: {}", solve1(code.clone()));
println!("Part 2: {}", solve2(code.clone()));
... |
//! A crate to get images info and process them, including animated GIFs.
//!
//! # Example
//!
//! ```rust,ignore
//! extern crate image_utils;
//!
//! use std::path::Path;
//! use image_utils::{info, crop, resize};
//!
//! let path = Path::new("test.jpg");
//!
//! let inf = info(&path)?;
//! println!("{:?}", inf);
//... |
#[derive(Debug, Clone, PartialEq)]
enum Term {
Universe(usize),
Nat,
Var(usize),
Int(usize),
App(Box<Term>, Box<Term>),
Abs(Box<Term>, Box<Term>),
Pi(Box<Term>, Box<Term>),
}
impl Term {
fn normal(&self) -> bool {
match self {
Term::App(_, _) => false,
Te... |
use std::{future::Future, pin::Pin};
use crate::{AsyncRead, AsyncWrite};
use monoio::buf::{IoBuf, IoBufMut};
use monoio::io::{AsyncReadRent, AsyncWriteRent};
use monoio::net::TcpStream;
type PinnedFuture<B> = Pin<Box<dyn Future<Output = monoio::BufResult<usize, B>> + 'static>>;
struct LimitedBuffer {
buf: Vec<u8... |
use super::{errors, MemberInfo};
use byteorder::{NetworkEndian, WriteBytesExt};
use futures::future;
use futures::prelude::*;
use prost::Message;
use protomitch_pb;
use std::net;
/// Future vector of bytes, wire format.
pub(crate) type FuturePaylod = Box<Future<Item = Vec<u8>, Error = errors::Error> + Send>;
/// Try ... |
mod problems;
mod util;
mod matrix;
mod virtualmachine;
use crate::util::load_file;
// use std::env;
use log::{info, warn, Level}; // trace, debug, info, warn, error
use env_logger;
use std::io::Write;
use std::time::{Instant, Duration};
use rustop::opts;
use crate::util::RetType;
macro_rules! ifelse {
($c:expr,... |
use itertools::Itertools;
use text_io::{scan, try_scan};
use std::fmt::{self, Write};
use std::mem;
use std::ops::{Index, IndexMut};
#[derive(Clone, Copy, PartialEq, Eq)]
enum Tile {
Sand,
Clay,
Water,
Flow,
Faucet,
}
impl Into<char> for Tile {
fn into(self) -> char {
match self {
... |
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use wow_srp::client::{SrpClientChallenge, SrpClientUser};
use wow_srp::normalized_string::NormalizedString;
use wow_srp::server::{SrpProof, SrpVerifier};
use wow_srp::{
PublicKey, GENERATOR, LARGE_SAFE_PRIME_LITTLE_ENDIAN, PASSWORD_VERIFIER_LEN... |
use yew::{
ComponentLink,
Component,
Html,
};
use yew::prelude::*;
use yew::services::fetch::FetchTask;
use status_protoc::my_trait::StatusTrait;
use yew_router::agent::RouteAgent;
use yew_router::agent::RouteRequest::ChangeRoute;
use status_protoc::status::user::check::{CheckStatus, _CheckStatus};
use sta... |
use num::{one, zero, Complex, Float, Num};
pub fn bit_reversal<T>(a: &mut [T]) {
assert!(a.len().is_power_of_two());
let index_leading_zeros = (a.len() - 1).leading_zeros();
for i in 0..a.len() {
let j = i.reverse_bits() >> index_leading_zeros;
if i < j {
a.swap(i, j);
... |
use std::marker::PhantomData;
use pancake_db_idl::dml::{FieldValue, RepeatedFieldValue};
use pancake_db_idl::dml::field_value::Value;
use crate::encoding::byte_reader::ByteReader;
use crate::errors::{CoreError, CoreResult};
use crate::primitives::{Atom, Primitive};
use crate::utils;
use super::{NULL_BYTE, COUNT_BYTE}... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.