text stringlengths 7.05k 33.9k |
|---|
use alloc::{
boxed::Box,
collections::VecDeque,
string::{String, ToString},
sync::Arc,
vec::Vec,
};
use core::{
alloc::GlobalAlloc,
cmp::Ordering,
mem,
};
use spin::RwLock;
use crate::arch::{interrupt::InterruptStack, paging::PAGE_SIZE};
use crate::common::unique::Unique;
use crate::con... |
use anyhow::format_err;
use cargo::core::{TargetKind, Workspace};
use cargo::ops;
use cargo::util::CargoResult;
use cargo::CliError;
use itertools::Itertools;
use serde::Deserialize;
use std::collections::btree_map::BTreeMap;
use std::env;
use std::fs;
use std::fs::File;
use std::io::Read;
use std::iter::FromIterator;
... |
//! This module contains code used to place the MCU in low power modes.
//! Reference section 5.3.3: `Low power modes` of the L4 Reference Manual.
use crate::{
clocks::Clocks,
pac::{PWR, RCC},
};
#[cfg(any(feature = "l4", feature = "l5"))]
use crate::clocks::MsiRange;
use cortex_m::{asm::wfi, peripheral::SCB... |
use core::borrow::Borrow;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::mem;
use super::nodes::{Heap, Node, NodeHasher, NodeIndex};
use super::path::{Directions, Path, Position, Proof};
use crate::merkle::{Hash, MerkleItem};
/// Forest consists of a number of roots of merkle binary tree... |
//! AMQP broker.
use async_trait::async_trait;
use chrono::{DateTime, SecondsFormat, Utc};
use lapin::message::Delivery;
use lapin::options::{
BasicAckOptions, BasicConsumeOptions, BasicPublishOptions, BasicQosOptions, QueueDeclareOptions,
};
use lapin::types::{AMQPValue, FieldArray, FieldTable};
use lapin::uri::{... |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
use std::ops::*;
use std::fmt::{Display, Formatter, Result as FmtResult};
use std::str::FromStr;
use anyhow::*;
use derive_more::{Deref, DerefMut};
use arith::{Number, YString};
use pest::{Parser, iterators::Pair};
use pest_derive::*;
use super::*;
#[derive(Debug, Parser, Clone)]
#[grammar = "yolol.pest"]
pub struct Y... |
use bevy::{
app::startup_stage,
prelude::*,
render::pass::ClearColor,
sprite::collide_aabb::collide,
window::{self, WindowMode},
};
use rand::Rng;
use std::{ops::Range, time::Duration};
fn main() {
static STATE: &str = "state";
App::build()
.add_resource(WindowDescriptor {
... |
extern crate skimmer;
use model::schema::Schema;
use model::{ Model, TaggedValue };
use sage::{ Idea, YamlVersion, SageError };
use self::skimmer::{ Chunk, Data, Datum, Marker };
use reader::{ Block, BlockType, Node, NodeKind };
use std::borrow::Cow;
use std::marker::PhantomData;
pub struct Savant<S, D> {
y... |
// 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... |
// Copyright 2016 The Rust Project Developers.
//
// 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 http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// exc... |
#![windows_subsystem = "windows"]
mod app;
mod clientmanager;
mod definitions;
mod interpolate;
mod lvars;
mod server;
mod simconfig;
mod sync;
mod syncdefs;
mod update;
mod util;
mod varreader;
use app::{App, AppMessage};
use clientmanager::ClientManager;
use definitions::{Definitions, SyncPermission};
use log::{err... |
use std::f64::consts;
use log::*;
use indexmap::{indexset, IndexMap};
use crate::{
cad::{Cad, EGraph, ListVar as LV, Vec3},
num::Num,
permute::Permutation,
};
use egg::{ENode, Id};
fn f(u: usize) -> f64 {
u as f64
}
#[derive(Debug, PartialEq)]
pub struct VecFormula {
x: Formula,
y: Formula... |
#![cfg_attr(not(feature = "std"), no_std)]
#![warn(clippy::too_many_arguments)]
/// Edit this file to define custom logic or remove it if it is not needed.
/// Learn more about FRAME and the core library of Substrate FRAME pallets:
/// <https://docs.substrate.io/v3/runtime/frame>
pub use pallet::*;
use frame_support::... |
use crate::util::{DeviceRc};
use crate::resource::{self as res, MapResource};
use crate::common::*;
use gfx_hal::{
self as hal,
Backend,
device::Device,
memory as m,
buffer as b,
pso,
pool::{self, CommandPool},
command as c,
queue::CommandQueue
};
use std::default::Default;
use st... |
use crate::{
Intersection, IntersectionID, IntersectionType, Lane, LaneID, LaneType, Road, RoadID, Turn,
TurnID, TurnType, LANE_THICKNESS,
};
use abstutil::{Timer, Warn};
use geom::{Distance, Line, PolyLine, Pt2D};
use nbez::{Bez3o, BezCurve, Point2d};
use std::collections::{BTreeSet, HashMap, HashSet};
// TOD... |
pub mod atlas;
pub mod font;
use std::error::Error;
pub use imui::*;
pub use glium;
pub use glium::Surface;
pub use glium::glutin::event::{Event, WindowEvent};
pub use glium::glutin::event_loop::{EventLoop, ControlFlow};
use glium::{Display, IndexBuffer, VertexBuffer, implement_vertex, uniform};
use glium::program::{... |
#[allow(unused_parens)]
use cty::*;
use cortex_m_semihosting::hprintln;
use stm32g0::stm32g030;
pub fn rust_print(msg: *const u8){
//hprintln!("{}",msg);//TODO:how to print '*const u8'
}
pub fn oled_pow(m:u8,n:u8)->u8
{
let mut result:u8=1;
let mut c:u8=n;
while c>0 {
result=result*m;
c=c-1... |
/*
*********************************************************************************
* *
* FILE: main.rs *
* ... |
use crate::perspective;
use cgmath::prelude::*;
use cgmath::{Basis3, Matrix3, Matrix4, Quaternion, Rad, Vector2, Vector3};
use std::f32;
/// The camera is a state machine, what each input does depends on the state that its in.
/// The possible states are this enum.
#[derive(PartialEq, Eq)]
enum CamState {
/// This... |
use std::{collections::VecDeque, io::Write};
use crate::trace::Trace;
use super::{ Instruction, Cpu, Memory };
use rand::prelude::*;
pub const ADD_CYCLES: usize = 2;
pub const SUB_CYCLES: usize = 2;
pub const MUL_CYCLES: usize = 12;
pub const DIV_CYCLES: usize = 24;
pub const LOAD_CYCLES: usize = 2;
pub const JUMP_C... |
use std::cell::Cell;
use std::ops::{Deref, DerefMut};
use std::rc::Rc;
use glib::subclass::prelude::*;
use parking_lot::RwLock;
use super::highlights::HighlightDefinitions;
mod imp {
use std::cell::Cell;
use std::rc::Rc;
use glib::subclass::prelude::*;
use parking_lot::{RwLock, RwLockReadGuard};
... |
use std::{
sync::Arc,
str::FromStr,
};
use rocksdb::DB;
use web3::futures::{future, StreamExt};
use web3::contract::Contract;
use web3::types::{Address, FilterBuilder, U128};
use tokio::sync::broadcast::Sender;
use sp_io::hashing::keccak_256;
use crate::shared::*;
async fn update_order(order_id: [u8; 16], db:... |
use std::fmt;
use errors::*;
pub use backends::usbhid as backend;
use libusb;
use protocol::usbhid;
use protocol::usbhid::Command;
use protocol::usbhid::TxPacket;
use byteorder::{ByteOrder, LittleEndian};
pub const VENDOR_ID: u16 = 0x1b1c;
pub const PRODUCT_ID: u16 = 0x0c04;
#[derive(Debug, Copy, Clone)]
pub struct... |
//! Encrypt and decrypt Sphinx packets.
extern crate curve25519_dalek;
extern crate rand;
extern crate zeroize;
use curve25519_dalek::constants::RISTRETTO_BASEPOINT_POINT as G;
use curve25519_dalek::ristretto::CompressedRistretto;
use curve25519_dalek::ristretto::RistrettoPoint;
use curve25519_dalek::scalar::Scalar;
... |
use super::clause_db::{ClauseDb, ClauseIndex};
use super::drat_clauses::{DratClause, DratClauses};
use super::solver_options::SolverOptions;
use super::trail::Trail;
use super::VarManager;
use solhop_types::{Clause, LBool, Lit, Solution, Var, UNDEF_LIT};
use std::collections::HashSet;
use std::collections::VecDeque;
/... |
// A stage that handles generating the keys used to encrypt the ledger and sample it
// for storage mining. Replicators submit storage proofs, validator then bundles them
// to submit its proof for mining to be rewarded.
#[cfg(all(feature = "chacha", feature = "cuda"))]
use crate::chacha_cuda::chacha_cbc_encrypt_file_... |
// Copyright (c) 2016-2020 <NAME>
//! Defines all tokens that may result from performing lexical analysis on a
//! SystemVerilog source file. This module is inspired heavily by the tokens
//! used in the Rust compiler.
pub use self::DelimToken::*;
pub use self::Lit::*;
pub use self::Token::*;
use moore_common::name::... |
use ffi;
use libc::c_int;
use std::ptr;
use cvt;
use error::ErrorStack;
use hash::MessageDigest;
use symm::Cipher;
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub struct KeyIvPair {
pub key: Vec<u8>,
pub iv: Option<Vec<u8>>,
}
/// Derives a key and an IV from various parameters.
///
/// If specified, `salt`... |
// Copyright 2022 pyke.io
// 2019-2021 Tauri Programme within The Commons Conservancy
// [https://tauri.studio/]
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
//! Protocol to discover network addresses of other peers on the Libra network
//!
//! ## Implementation
//!
//! The discovery module is implemented as a stand-alone actor in the Network sub-system of the
//! Libra stack. The actor par... |
// 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... |
//! Contains all structures and methods to create and manage navigation meshes (navmesh).
//!
//! Navigation mesh is a set of convex polygons which is used for path finding in complex
//! environment.
#![warn(missing_docs)]
use crate::scene::mesh::buffer::{VertexAttributeUsage, VertexReadTrait};
use crate::{
core... |
/*
* Copyright 2018 The Starlark in Rust Authors.
* Copyright (c) Facebook, Inc. and its affiliates.
*
* 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/lic... |
//! Database description. This crate is used heavily in the introspection and migration engines.
#![allow(clippy::trivial_regex)] // this is allowed, because we want to do CoW replaces and these regexes will grow.
#![allow(clippy::match_bool)] // we respectfully disagree that it makes the code less readable.
pub use e... |
//! # Offchain Worker Callback Example
//!
//! This is a minimal example module to show case how the runtime can and should
//! interact with an offchain worker asynchronously.
//!
//! This example plays simple ping-pong with authenticated off-chain workers:
//! Once a signed transaction to `ping` is submitted, the run... |
//
// Copyright (c) <NAME>. All rights reserved.
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
use crate::datasources::{Datasource, Datasources};
use pbr::ProgressBar;
use percent_encoding::percent_decode;
use serde_json;
use std::cmp;
use std::io::{stderr, St... |
//! Implementation of SPI for NRF52 using EasyDMA.
//!
//! This file only implments support for the three SPI master (`SPIM`)
//! peripherals, and not SPI slave (`SPIS`).
//!
//! Although `kernel::hil::spi::SpiMaster` is implemented for `SPIM`,
//! only the functions marked with `x` are fully defined:
//!
//! - [x] set... |
//! MIDI parsing routines
use std::cmp::max;
use std::fs::File;
use std::io::{BufReader, Error, ErrorKind, Read, Result, Seek, SeekFrom};
use std::path::Path;
use std::vec;
use byteorder::{BigEndian, ReadBytesExt};
// http://www.midi.org/techspecs/midimessages.php
// http://www.ccarh.org/courses/253/handout/smf/
// ... |
pub mod variables;
pub mod relationships;
pub mod expressions;
#[cfg(test)]
mod tests {
use math::variables::{AbstVar, new_var, new_const, new_slack_var, new_surplus_var, new_arti_var};
use math::relationships::Relationship;
use math::expressions::Expression;
#[test]
fn can_create_variables() {
... |
use bellperson::{
gadgets::{
boolean::{field_into_allocated_bits_le, AllocatedBit, Boolean},
multipack::pack_bits,
num::AllocatedNum,
},
ConstraintSystem, LinearCombination, SynthesisError,
};
use blstrs::Scalar as Fr;
use ff::{Field, PrimeField};
use filecoin_hashers::{HashFunction,... |
//! Basic implementation of Kubernetes Admission API
use crate::Operator;
use anyhow::{bail, ensure, Context};
use k8s_openapi::{api::authentication::v1::UserInfo, apimachinery::pkg::apis::meta::v1::Status};
use k8s_openapi::{
api::{
admissionregistration::v1::MutatingWebhookConfiguration,
core::v1:... |
//! "Stripped-down" versions of the core state events.
//!
//! Each "stripped" event includes only the `content`, `type`, and `state_key` fields of its full
//! version. These stripped types are useful for APIs where the user is providing the content of a
//! state event to be created, when the other fields can be infe... |
use brb::{Actor, Net, Packet};
use brb_dt_at2::{Bank, Money, Op};
struct BankNet(Net<Bank>);
impl BankNet {
pub fn new() -> Self {
Self(Net::new())
}
pub fn find_actor_with_balance(&self, balance: Money) -> Option<Actor> {
self.0
.actors()
.iter()
.clon... |
use crate::token::TwoFactorSecret;
pub use accountlinker::{AccountLinkError, AccountLinker, FinalizeLinkError};
use anyhow::Result;
pub use confirmation::{Confirmation, ConfirmationType};
use hmacsha1::hmac_sha1;
use log::*;
use regex::Regex;
use reqwest::{
cookie::CookieStore,
header::{COOKIE, USER_AGENT},
Url,
};
... |
//
// Copyright (C) 2018 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 agree... |
use super::*;
use crate::span::Span;
use crate::{
asm_lang::*,
parse_tree::{CallPath, Literal},
semantic_analysis::{
ast_node::{TypedAsmRegisterDeclaration, TypedCodeBlock, TypedExpressionVariant},
TypedExpression,
},
type_engine::look_up_type_id,
};
mod array;
mod contract_call;
mo... |
use std::{
io::{self, SeekFrom},
ops::{AddAssign, ShrAssign},
};
use bitflags::bitflags;
use quick_error::quick_error;
use scroll::{Pread, Pwrite};
use crate::calculate_crc32c;
pub const SUPERBLOCK_OFFSET: u64 = 1024;
pub const SUPERBLOCK_LEN: u64 = 1024;
pub const SIGNATURE: u16 = 0xEF53;
#[derive(Debug, ... |
use super::storage::{self, address_key, valid_data_key};
use super::{Command, Event, InvokeContext, Msg, RaftClient, Res, RockStorage};
use crate::{r, Config, Result};
use crossbeam::channel::{self, Receiver, RecvTimeoutError, Sender, TrySendError};
use futures::channel::mpsc;
use futures_timer::Delay;
use raft::eraftp... |
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
use std::collections::HashSet;
use std::env::VarError;
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use std::path::{Path, PathBuf};
use std::{env, fs, io};
use cmake::Config as CmakeConfig;
use pkg_config::{Config as PkgConfig, ... |
use batchcensor::{generator, utils, Config, Generator, Pos, Replace, Transcript};
use failure::ResultExt;
use relative_path::{RelativePath, RelativePathBuf};
use std::{
borrow::Cow,
collections::{BTreeMap, BTreeSet, HashMap},
fmt,
fs::File,
io,
path::{Path, PathBuf},
};
const VERSION: &'static ... |
/*
* Generously hacked LambdaDB tokenizer, with keywords added from SQLite.
*/
use tokens::*;
macro_rules! tokens {
( $( $x:expr ),* ) => {
{
let mut _temp_vec = Vec::new();
$(
_temp_vec.push(Token::new($x.0, $x.1, $x.2, $x.3.to_string()));
)*
_temp_vec
}
};
}
enum LexerState {
NoState,
W... |
use std::fs::File;
use std::io::{Write,Seek,SeekFrom,Cursor,BufWriter};
use super::Error;
use super::fourcc::{FourCC, WriteFourCC, RIFF_SIG, RF64_SIG, DS64_SIG,
WAVE_SIG, FMT__SIG, DATA_SIG, ELM1_SIG, JUNK_SIG, BEXT_SIG,AXML_SIG,
IXML_SIG};
use super::fmt::WaveFmt;
//use super::common_format::CommonFormat;
us... |
//! Controller Area Network
//!
//! CAN is currently not enabled by default, and
//! can be enabled by the `can` feature.
//!
//! It is a implementation of the [`embedded_hal_can`][can] traits.
//!
//! [can]: embedded_hal_can
//!
//! A usage example of the can peripheral can be found at [examples/can.rs]
//!
//! [examp... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Event Control"]
pub evctrl: EVCTRL,
_reserved1: [u8; 3usize],
#[doc = "0x04 - Interrupt Enable Clear"]
pub intenclr: INTENCLR,
#[doc = "0x08 - Interrupt Enable Set"]
pub intenset: INTENSET,
#[doc = "0x0c - I... |
use std::convert::TryInto;
use std::convert::TryFrom;
use std::fmt;
use bit::BitIndex;
use num_enum::TryFromPrimitive;
use crate::{SystemExclusiveData, Checksum, every_nth_byte};
use crate::k4::{NAME_LENGTH, get_effect_number};
use crate::k4::source::Source;
use crate::k4::lfo::*;
use crate::k4::amp::Amplifier;
use c... |
use buffer::BoundBuffer;
use iced_core::Point;
use iced_wgpu::{wgpu, Backend, Renderer, Settings, Viewport};
use iced_winit::{
program,
winit::{
dpi::{PhysicalPosition, PhysicalSize},
event::{
DeviceEvent, ElementState, Event, KeyboardInput, ModifiersState, StartCause,
Vi... |
use std::convert::TryFrom;
use std::fmt;
use crate::x::core::{
XConn, XWindowID, XError, XAtom,
Result,
};
use crate::types::{Point};
/// X server properties.
#[derive(Debug, Clone)]
pub enum Property {
/// a list of Atoms (u32), expressed as strings.
Atom(Vec<String>),
/// a cardinal number.
... |
// Copyright 2020-2021 <NAME> under the terms of the MIT License as detailed
// in the accompanying file README.md or <https://opensource.org/licenses/MIT>.
//! [`Inventory`] for storing items.
use std::borrow::Cow;
use std::collections::BTreeMap;
use std::error::Error;
use std::num::NonZeroU16;
use std::sync::Arc;
... |
// Copyright (c) 2016, 2020 <NAME> <<EMAIL>>
#![deny(dead_code)]
#![deny(missing_docs)]
#![deny(unreachable_patterns)]
#![deny(unused_extern_crates)]
#![deny(unused_imports)]
#![deny(unused_qualifications)]
//! **Numerics**, a library for converting numbers to their English word readings.
//!
//! Usage:
//!
//! ```ru... |
use crate::utils::{ Buffer, Cycle };
use crate::gba::IrqFlags;
use crate::log::*;
use super::oam::{ ObjAttributes, ObjTransform };
use super::mode0;
use super::Framebuffer;
use crate::utils::sign_extend;
const ADDR_UPPER_MASK: u32 = 0xFF00_0000;
const PALETTE_START: u32 = 0x0500_0000;
const PALETTE_SIZE: u32 = 1024;
... |
//! Circuit abstraction
use crate::client::circuit::derive_keys;
use crate::crypto::aes::Aes256Gcm;
use crate::crypto::cprng::thread_cprng;
use crate::crypto::key::Key;
use crate::crypto::threefish::Threefish2048;
use crate::crypto::{x25519, x448};
use crate::defs::{
tokens_from_bytes, CircuitId, RoundNo, Token, CE... |
use std::collections::VecDeque;
use crate::{
fractal::Fractal,
pen_detector::PenEvent,
ringbuffer::RingBuffer,
sequence::{MergeDirection, Seq},
};
// 三笔重叠判断算法
// 三笔4个端点必须:
// 情况A:向上线段 1<=min(2,3,4) && 4>=max(1,2,3)
// 情况B:向下线段 1>=max(2,3,4) && 4<=min(1,2,3)
// 每3笔做一次判断 (分型个数 -1 ) % ... |
// Copyright 2015 The syscall.rs Project Developers. See the
// COPYRIGHT file at the top-level directory of this distribution.
//
// 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 http://opensource.org/licenses/MIT>... |
use std::any::Any;
use std::fmt;
use colored::*;
use const_format::formatcp;
use thiserror::Error;
use crate::config::*;
#[derive(Error, Clone, Debug, Default)]
pub struct UiErrorItem {
msg: String,
action: String,
hint: String,
detail: Option<String>,
}
#[derive(Error, Clone, Debug, Default)]
pub s... |
use self::instruction_table::*;
use crate::{
instructions::{control::*, stack_manip::*, *},
state::*,
tracing::Tracer,
*,
};
use ethereum_types::{Address, U256};
fn check_requirements(
instruction_table: &InstructionTable,
state: &mut ExecutionState,
op: OpCode,
) -> Result<(), StatusCode> ... |
// Advanced mapper with bank-switched PRG ROM and CHR ROM, and a scanline counter feeding into IRQ
// Reference capabilities: https://wiki.nesdev.com/w/index.php/MMC3
use ines::INesCartridge;
use memoryblock::MemoryBlock;
use mmc::mapper::*;
use mmc::mirroring;
pub struct Mmc3 {
pub prg_rom: MemoryBlock,
pub... |
//! # YUV4MPEG2 (.y4m) Encoder/Decoder
#![deny(missing_docs)]
use std::fmt;
use std::io;
use std::io::Read;
use std::io::Write;
use std::num;
use std::str;
const MAX_PARAMS_SIZE: usize = 1024;
const FILE_MAGICK: &[u8] = b"YUV4MPEG2 ";
const FRAME_MAGICK: &[u8] = b"FRAME";
const TERMINATOR: u8 = 0x0A;
const FIELD_SEP:... |
//! Service and ServiceFactory implementation. Specialized wrapper over substrate service.
use crate::cli::Cli;
#[cfg(feature = "manual-seal")]
use crate::cli::Sealing;
use async_trait::async_trait;
use fc_consensus::FrontierBlockImport;
use fc_mapping_sync::{MappingSyncWorker, SyncStrategy};
use fc_rpc::EthTask;
use ... |
//! `NameDefinition` keeps information about the element we want to search references for.
//! The element is represented by `NameKind`. It's located inside some `container` and
//! has a `visibility`, which defines a search scope.
//! Note that the reference search is possible for not all of the classified items.
// ... |
/* Math builtin module
*
*
*/
use statrs::function::erf::{erf, erfc};
use statrs::function::gamma::{gamma, ln_gamma};
use num_bigint::BigInt;
use num_traits::{One, Signed, Zero};
use crate::function::{Args, OptionalArg};
use crate::obj::objfloat::{self, IntoPyFloat, PyFloatRef};
use crate::obj::objint::{self, PyI... |
//! The *resume* end of a reconnectable backend consists of an [`Acceptor`] and the set of [`Chan`]s
//! it manages. New or reconnecting pairs of transmitter/receiver can be
//! [`accept`](Acceptor::accept)ed, and depending on the outcome of their handshake, either generate
//! a new [`Chan`] or reconnect an existing [... |
// This file is part of the uutils coreutils package.
//
// (c) <NAME> <<EMAIL>>
// (c) <NAME> <<EMAIL>>
//
// For the full copyright and license information, please view the LICENSE file
// that was distributed with this source code.
// spell-checker:ignore (ToDO) sourcepath targetpath
#[macro_use]
extern crate uuc... |
mod n_plus_one;
mod tetris;
pub(crate) mod traitor;
use crate::game::{
find_groups, ActionChange, ActionKind, Board, BoardHistory, Color, GameState, Group, GroupVec,
MakeActionError, MakeActionResult, Point, SharedState, VisibilityBoard,
};
use serde::{Deserialize, Serialize};
use bitmaps::Bitmap;
use tinyvec... |
//! Block proposer.
//!
//! The block proposer stores deploy hashes in memory, tracking their suitability for inclusion into
//! a new block. Upon request, it returns a list of candidates that can be included.
mod deploy_sets;
mod event;
mod metrics;
#[cfg(test)]
mod tests;
use std::{
collections::{HashMap, Hash... |
//! The **Details** output view displays each file as a row in a table.
//!
//! It’s used in the following situations:
//!
//! - Most commonly, when using the `--long` command-line argument to display the
//! details of each file, which requires using a table view to hold all the data;
//! - When using the `--tree` a... |
pub use calc::{get_recursive_pixel, Algo, Config, Imaginary, RGB};
use std::io::Write;
use clap::{Arg, ArgGroup};
use rand::{Rng, SeedableRng};
use rayon::iter::{IntoParallelIterator, ParallelIterator};
#[cfg(feature = "gui")]
#[path = "gui.rs"]
pub mod gui;
#[cfg(feature = "avif")]
pub const fn transmute_rgb_slice(... |
//! Cyclical asynchronous pipelined processing.
//!
//! For many tasks, a single, cyclical pipeline is necessary (think graphics).
//! This examples shows how to saturate the OpenCL device and as many CPU
//! threads as necessary while ensuring that tasks that depend on a previous
//! task completing do not begin befor... |
// Copyright 2021 <NAME>
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requir... |
use core::arch::asm;
use core::marker::PhantomData;
use crate::arch::x86_64::physicalmem;
/// Pointer to the root page table (PML4)
const PML4_ADDRESS: *mut PageTable<PML4> = 0xFFFF_FFFF_FFFF_F000 as *mut PageTable<PML4>;
/// Number of Offset bits of a virtual address for a 4 KiB page, which are shifted away to get ... |
//! This crate helps with creating multiple mutable references to the contents of a variable without triggering undefined behavior.
//! The Rust borrow rules dictate that it is undefined behavior to create more than one mutable reference to the same region,
//! even if the mutable reference is not used. However, this c... |
// Copyright 2016 The Gfx-rs 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 ag... |
//! State types
use crate::{
error::LendingError,
math::{Decimal, Rate},
};
use arrayref::{array_mut_ref, array_ref, array_refs, mut_array_refs};
use solana_program::{
clock::{Slot, DEFAULT_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT, SECONDS_PER_DAY},
entrypoint::ProgramResult,
program_error::Program... |
#[macro_use]
extern crate clap;
use clap::App;
use glob::glob;
use handlebars::Handlebars;
use pulldown_cmark::{html, CodeBlockKind, Event, Options, Parser, Tag};
use rhai::{Engine, FnAccess, ScriptFnMetadata, AST};
use serde::{Deserialize, Serialize};
use std::cmp::Ordering;
use std::collections::BTreeMap;
use std::f... |
//! Turtle lexer.
use std::iter::Peekable;
use std::fmt;
use std::marker::PhantomData;
use iref::IriBuf;
use source_span::{Position, Span, Metrics, Loc};
/// Lexing error.
#[derive(Debug)]
pub enum Error<E: std::error::Error> {
/// IO error.
IO(E),
/// Unexpected end of char stream.
UnexpectedEos,
/// Wrong cl... |
use std::ops::BitOr;
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
use nom::{
branch::alt,
bytes::complete::tag,
character::complete::{anychar, char, digit1, satisfy},
combinator::{eof, map_res, opt, value},
multi::{many0, many1},
IResult,
};
use super::{VimEdgeEvent, VimEdgePath, ... |
use tracing_core::{
metadata::Metadata,
span,
subscriber::{Interest, Subscriber},
Event, LevelFilter,
};
use crate::{
filter,
layer::{Context, Layer},
registry::LookupSpan,
};
#[cfg(feature = "registry")]
use crate::{filter::FilterId, registry::Registry};
use std::{any::TypeId, fmt, marker:... |
use primitives::SimpleEdge;
use delaunay::*;
use self::delaunay_basic::BasicDelaunaySubdivision;
use traits::{HasPosition2D};
use point_traits::{PointN, TwoDimensional, PointNExtensions};
pub struct LineIntersectionIterator<'a, T, V, E=()> where
T: BasicDelaunaySubdivision<V, EdgeType=E> + 'a,
V: HasPosition2D... |
//! Support for [`tch::Tensor`].
//!
//! This module adds support for displaying [`tch::Tensor`] as images.
//! The main interface is provided by an extension trait [`TensorAsImage`],
//! which allows you to wrap a tensor in a [`TensorImage`].
//! The wrapper struct adds some required metadata for interpreting the tens... |
pub use super::{
NoRecv,
RecvErr::{self, *},
};
use incin::Pause;
use owned_alloc::OwnedAlloc;
use ptr::{bypass_null, check_null_align};
use removable::Removable;
use std::{
fmt,
ptr::{null_mut, NonNull},
sync::{
atomic::{AtomicPtr, Ordering::*},
Arc,
},
};
/// Creates an asynch... |
// 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
// dis... |
//! Making floating-point behave: ordering, equivalence, hashing, and
//! constraints for floating-point types.
//!
//! Decorum provides traits that describe types using floating-point
//! representations and provides proxy types that wrap primitive floating-point
//! types. Proxy types implement a total ordering and c... |
pub mod client;
pub mod envelope;
pub mod key_exchange;
pub mod opaque;
pub mod oprf;
use crate::key_exchange::KeyExchange;
use curve25519_dalek::constants::RISTRETTO_BASEPOINT_POINT;
use curve25519_dalek::ristretto::{CompressedRistretto, RistrettoPoint};
use curve25519_dalek::scalar::Scalar;
use rand_os::OsRng;
us... |
//! Records metrics in the Prometheus exposition format.
#![deny(missing_docs)]
use std::future::Future;
use hyper::{
service::{make_service_fn, service_fn},
{Body, Error as HyperError, Response, Server},
};
use metrics::{Key, Recorder, SetRecorderError, Unit};
use metrics_util::{
parse_quantiles, Composit... |
use std::fmt;
use core_foundation::base::{CFType, TCFType};
use core_foundation::boolean::CFBoolean;
use core_foundation::data::CFData;
use core_foundation::dictionary::CFDictionary;
use core_foundation::error::{CFError, CFErrorRef};
use core_foundation::number::CFNumber;
use core_foundation::string::{CFString, CFStri... |
use std::cell::RefCell;
use std::cmp;
use std::collections::HashMap;
use std::io::{Cursor, Seek, SeekFrom, Write};
use std::iter::Peekable;
use std::mem;
use std::slice;
use failure::ResultExt;
use fnv::{FnvHashMap, FnvHashSet};
use num;
use symbolic_common::types::{DebugKind, Language};
use symbolic_debuginfo::{Obje... |
use std::net::SocketAddr;
use std::{
collections::{BTreeMap, VecDeque},
convert::TryFrom,
io::{self, Read},
};
use bytes::{Buf, Bytes, BytesMut};
use codecs::StreamDecodingError;
use flate2::read::ZlibDecoder;
use serde::{Deserialize, Serialize};
use smallvec::{smallvec, SmallVec};
use snafu::{ResultExt, S... |
//! Dialogue flow control.
use bson::{bson, doc, Bson, Document};
use chrono::{prelude::*, Duration};
use log::debug;
use mongodb::Collection;
use rand::prelude::*;
use reqwest::blocking::Client;
use serde_json::Value;
use std::{collections::HashMap, error, fmt};
/// The states our dialogue supports.
#[derive(Debug, ... |
// This file is part of Substrate.
// Copyright (C) 2020 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://w... |
#![allow(unused)]
use byteorder::{ByteOrder, NetworkEndian};
use enum_primitive_derive::Primitive;
use num_traits::FromPrimitive;
use std::fmt::{self, Display};
use std::mem::MaybeUninit;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
use std::os::raw::{c_int, c_uint, c_void};
use std::ptr;
use std::{io, mem};
use crat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.