text stringlengths 7.05k 33.9k |
|---|
use crate::types::{VerifyContext, VerifyWitness};
use anyhow::{anyhow, Result};
use ckb_types::prelude::{Builder, Entity};
use gw_common::H256;
use gw_config::ContractsCellDep;
use gw_types::core::{DepType, SigningType, Status};
use gw_types::offchain::{CellInfo, InputCellInfo, RecoverAccount, RollupContext};
use gw_t... |
//! Address types
use crate::ergo_tree::ErgoTree;
use crate::ergo_tree::ErgoTreeParsingError;
use crate::mir::constant::Constant;
use crate::mir::expr::Expr;
use crate::serialization::SerializationError;
use crate::serialization::SigmaSerializable;
use crate::sigma_protocol::dlog_group::EcPoint;
use crate::sigma_proto... |
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate log;
extern crate stderrlog;
use aho_corasick::{AhoCorasick, AhoCorasickBuilder};
use arraystring::{ArrayString, typenum::U4};
use image::image_dimensions;
use std::cmp::Ordering;
use std::fs::{create_dir_all, rename};
use std::path::{Path, PathBuf};
use... |
// Copyright 2015-2020 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 (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
//! Transaction Queue
use super::{
client, listener, local_transactions::LocalTransactionsList, ready, replace, scoring, verifier,
PendingOrdering, PendingSettings, PrioritizationStrategy, SeqNumber, TxStatus,
};
use crate:... |
use crate::rule_prelude::*;
use ast::*;
use SyntaxKind::*;
declare_lint! {
/**
Disallow unnecessary boolean casts.
In contexts where expression will be coerced to a `Boolean` (e.g. `if`),
casting to a boolean (using `!!` or `Boolean(expr)`) is unnecessary.
## Invalid Code Examples
```js
... |
//! # K-Means Clustering
//!
//! K-means clustering partitions data into k clusters in a way that data points in the same cluster are similar and data points in the different clusters are farther apart.
//! Similarity of two points is determined by the [Euclidian Distance](../../math/distance/euclidian/index.html) betw... |
use serde::{Deserialize, Serialize};
use std::fmt;
use crate::memory::Memory;
const BG: u8 = 1;
const SPRITE: u8 = 3;
const WINDOW: u8 = 2;
pub enum RegU8 {
A,
B,
C,
D,
E,
H,
L,
U8,
RamU8(Box<RegU8>),
RamU16(RegU16),
}
#[derive(PartialEq)]
pub enum RegU16 {
AF,
BC,
... |
extern crate minifb;
use std::env;
use std::fs;
use std::time::SystemTime;
const CHIP8_WIDTH : usize = 64;
const CHIP8_HEIGHT : usize = 32;
const FONT_BASE_ADDR : usize = 0x0;
const ROM_BASE_ADDR : usize = 0x200;
const FONT : [u8; 80] = [
0xF0, 0x90, 0x90, 0x90, 0xF0, // 0
0x20, 0x60, 0x20, 0x20, 0x70, // 1
... |
//! Constant evaluation details
use std::{
collections::HashMap,
convert::TryInto,
fmt::{Display, Write},
};
use chalk_ir::{BoundVar, DebruijnIndex, GenericArgData, IntTy, Scalar};
use hir_def::{
expr::{ArithOp, BinaryOp, Expr, ExprId, Literal, Pat, PatId},
path::ModPath,
resolver::{resolver_f... |
use bevy::{
core::FixedTimestep,
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*,
render::pass::ClearColor,
sprite::collide_aabb::{collide, Collision},
};
use rand::Rng;
use crate::GameState;
static WIDTH: f32 = 1600.0;
static HEIGHT: f32 = 900.0;
static MIN_SPEED: f32 = ... |
#![allow(clippy::many_single_char_names)]
#![allow(clippy::same_item_push)]
use std::{
cmp::max,
collections::{hash_map::Entry::*, HashMap, HashSet},
fs::{self, OpenOptions},
io::Write,
path::PathBuf,
};
use awint_ext::ExtAwi;
use crate::{
arena::Ptr,
lowering::{Dag, Node},
Op,
};
//... |
/// A SerialMessage which can be sent and received over a Driver
#[derive(Debug, Clone)]
pub struct SerialMessage {
pub header: SerialMessageHeader,
pub typ: SerialMessageType,
pub func: SerialMessageFunction,
pub data: Vec<u8>,
}
impl SerialMessage {
/// create a new message
pub fn new(typ: Se... |
use {
super::*, crate::ipc::*, crate::object::*, alloc::sync::Arc, alloc::vec, alloc::vec::Vec,
core::mem::size_of, futures::channel::oneshot, kernel_hal::context::UserContext, spin::Mutex,
};
/// Kernel-owned exception channel endpoint.
pub struct Exceptionate {
type_: ExceptionChannelType,
inner: Mut... |
use crate::harness_tests;
use crate::shard_chain::{
BlockProcessingOutcome as ShardBlockProcessingOutcome, ShardChain, ShardChainTypes,
};
use beacon_chain::{BeaconChain, BeaconChainTypes, BlockProcessingOutcome};
use lmd_ghost::LmdGhost;
use shard_lmd_ghost::LmdGhost as ShardLmdGhost;
use shard_state_processing::p... |
use byteorder::{ByteOrder, LittleEndian};
use num_derive::FromPrimitive;
use num_traits::FromPrimitive;
use serde::Serialize;
use std::{collections::HashMap, convert::TryInto};
use thiserror::Error;
use uuid::Uuid;
use crate::{serialize_as_base64, EventType, ParseSettings};
fn string_from_widechar(wchar: &[u8]) -> Re... |
//
// ISO/IEC 14496-12:2015(E)
// 8.5.2 Sample Description Box
//
use std::io;
use crate::boxes::prelude::*;
use crate::bitreader::BitReader;
use crate::track::AudioTrackInfo;
use crate::io::CountBytes;
def_box! {
/// AAC sample entry (AudioSampleEntry).
AacSampleEntry {
skip: 6,
... |
use super::{split2, Cubic, CubicSlice};
use crate::{
math::{
cmp::{max, min, ApproxEq},
simd::Float4,
},
shapes::{bezier::Bezier, line::Line},
utils::arrayvec::ArrayVec,
};
/// Calculates the t-value for every intersection between the two curves `a` and
/// `b`.
#[must_use]
pub fn find(... |
//! Provides facilities for examining scripts to determine their compatibility with iOS.
use byteorder::{LittleEndian, ReadBytesExt};
use once_cell::sync::OnceCell;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::fmt::Display;
use std::io::{self, Cursor, Error, ErrorKind, Seek};
#[derive(... |
use crate::fitcrc::{FitCrc};
use chrono::{DateTime, TimeZone, Utc};
use std::sync::Arc;
use std::collections::HashMap;
use std::convert::{TryFrom};
pub const INVALID_U32: u32 = 0xFFFFFFFF;
#[derive(Copy, Clone, Default)]
#[derive(Debug)]
pub struct FitFileHeader {
pub header_size: u8,
pub protocol_version:... |
use crate::config::{CONFIGURATION, PROGRESS_BAR};
use crate::heuristics::WildcardFilter;
use crate::utils::{format_url, get_current_depth, get_url_path_length, make_request};
use crate::{heuristics, progress, FeroxChannel};
use futures::future::{BoxFuture, FutureExt};
use futures::{stream, StreamExt};
use lazy_static::... |
use crate::health::{Health, StageLevel, InjuryKey};
use crate::health::side::{SideEffectDeltasC};
use crate::health::disease::{DiseaseDeltasC};
use crate::utils::{HealthC, FrameC, GameTimeC, FrameSummaryC};
use crate::utils::event::{Event, Listener, Dispatcher, MessageQueue};
use crate::health::injury::{InjuryDeltasC};... |
#![feature(new_uninit)]
use std::time::Instant;
use errno::prelude::{Errno::*, *};
use self::benches::{Bench, BenchBuilder, IoPattern, IoType};
use self::consts::*;
use self::tmp_disk::DiskType;
use self::util::{DisplayData, DisplayThroughput};
fn main() {
// Specify the number of threads to execute async tasks... |
use std::{env, fmt::Display, path::Path, process::Command, str::FromStr, vec};
use cargo_metadata::{Metadata, MetadataCommand};
type DynError = Box<dyn std::error::Error>;
use rand::Rng;
use std::io::{Read, Write};
fn main() {
if let Err(e) = try_main() {
eprintln!("{}", e);
std::process::exit(10... |
use std::{cmp, iter};
use bytes::{Bytes, BytesMut};
use failure::Fail;
use rand::{rngs::OsRng, Rng};
use trust_dns_proto::{error::ProtoError, rr::Name};
use crate::util::hex;
const NAME_MAX_SIZE: usize = 255;
const LABEL_MAX_SIZE: usize = 63;
const LABEL_COST: usize = 1;
/// An immutable wrapper around a `Name` wit... |
use futures::stream::StreamExt;
use regex::Regex;
use std::ffi::OsString;
use std::path::PathBuf;
use std::sync::Arc;
use std::{collections::HashMap, path::Path};
use std::{fmt, fs};
use termion::color;
use tokio::sync::{Mutex, RwLock};
use yaml_rust::YamlLoader;
pub mod ast;
pub mod tasks;
pub mod util;
use thiserro... |
#![deny(warnings)]
#![allow(non_camel_case_types)]
#![allow(clippy::all)]
#![no_std]
mod generic;
pub use generic::*;
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Control Register"]
pub ctrl: CTRL,
#[doc = "0x02 - Input Filter Register"]
pub filt: FILT,
#[doc = ... |
use std::f32;
use std::f32::consts::{FRAC_PI_4, PI};
use std::fmt;
use na::{self, Point2, Point3, Translation3, Unit, UnitQuaternion, Vector2};
use ncu;
use kiss3d::scene::SceneNode;
use yobun::partial_clamp;
use lsys::{self, ol};
use lsys::{Skeleton, SkeletonBuilder};
use lsys3d;
use yobun::*;
pub fn is_nothing(lsy... |
use num;
use af;
use af::{Array, MatProp, Dim4, DType};
use utils;
use std::sync::{Arc, Mutex};
use activations;
use initializations;
use params::{Params};
use layer::Layer;
use num::Complex;
pub struct Unitary {
pub input_size: usize,
pub output_size: usize,
}
/// Compute the multiplication with the diagonal ... |
use crate::cpp_checks::Condition;
use crate::cpp_ffi_data::{
CppFfiArgumentMeaning, CppFfiFunctionKind, CppFfiType, CppFieldAccessorType,
CppToFfiTypeConversion, QtSlotWrapper,
};
use crate::cpp_ffi_data::{CppFfiFunction, CppFfiItem};
use crate::cpp_function::ReturnValueAllocationPlace;
use crate::cpp_type::Cpp... |
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
//! This module defines the abstract state for the type and memory safety analysis.
use crate::{
absint::{AbstractDomain, JoinResult},
binary_views::FunctionView,
};
use alloc::collections::{BTreeMap, BTreeSet};
use alloc::vec::... |
use crate::{script, Tag, Face, GlyphInfo, Mask, Script};
use crate::buffer::{Buffer, BufferFlags};
use crate::ot::{feature, FeatureFlags};
use crate::plan::{ShapePlan, ShapePlanner};
use crate::unicode::{CharExt, GeneralCategoryExt};
use super::*;
use super::arabic::ArabicShapePlan;
pub const UNIVERSAL_SHAPER: Comple... |
use std::collections::{BTreeSet, VecDeque};
use bit_set::BitSet;
use itertools::Itertools;
use rustc_hash::{FxHashMap, FxHashSet};
use pyo3::prelude::*;
use pyo3::prelude::{pymodule, PyModule, PyResult, Python};
use pyo3::wrap_pyfunction;
use u32 as Node;
use FxHashMap as Dict;
// ----------------------------------... |
//
// Sysinfo
//
// Copyright (c) 2015 <NAME>
//
use std::cell::UnsafeCell;
use std::collections::HashMap;
use std::fmt;
use std::fs::{self, File};
use std::io::Read;
use std::path::{Path, PathBuf};
use std::str::FromStr;
use libc::{gid_t, kill, sysconf, uid_t, _SC_CLK_TCK};
use crate::sys::system::REMAINING_FILES;
... |
// Copyright 2021 <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... |
//! Parse OVSDB database update messages and convert them into DDlog table update commands
#![allow(clippy::map_clone)]
#![warn(missing_copy_implementations, missing_debug_implementations)]
#[cfg(test)]
mod test;
use std::borrow::Cow;
use num::{BigInt, Signed, ToPrimitive};
use serde_json::map::Map;
use serde_json:... |
/*
An almost-literal transliteration of AVX-optimized sin(), cos(), exp() and log()
functions by <NAME>, available at http://software-lisc.fbk.eu/avx_mathfun/
Copyright (C) 2012 <NAME>
Interdisciplinary Laboratory for Computational Science (LISC)
<NAME> and University of Trento
via Sommarive, 18
I-38123 Trento (Italy)... |
use types::{EnclaveReturn, ResultToEnclaveReturn};
//use types::{EnclaveReturn, ResultToEnclaveReturn};
// use enigma_tools_m::ToolsError;
// use json_patch;
// use pwasm_utils as wasm_utils;
use sgx_types::sgx_status_t;
// use enigma_crypto::CryptoError;
use std::str;
use std::string::{String, ToString};
// use wasmi:... |
//! Handles extraction from DCA archives
use std::cmp::min;
use std::fs::{self, File};
use std::io::{self, prelude::*, BufRead, Seek, SeekFrom};
use std::path::{Path, PathBuf};
use crate::error::{
error, warn, ArchiveError, DecompressionError, FilePosition, Handler as ErrorHandler, Result,
};
use ArchiveError as... |
use core::ops::{Deref, DerefMut};
use spinning_top::Spinlock;
use crate::cop0::{cause_extract_delay, cause_extract_exception, CauseException};
use crate::graphics::color::Color;
use crate::graphics::cursor::Cursor;
use crate::graphics::font::Font;
use crate::graphics::system_font::FONT_GENEVA_9;
use crate::graphics::... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
chained_bft::{
common::Round,
consensus_types::timeout_msg::{PacemakerTimeout, PacemakerTimeoutCertificate},
liveness::{
pacemaker::{NewRoundEvent, NewRoundReason, Pacemaker},
... |
use crate::{
StorageAlloc, cell_db::CellDb,
db::{rocksdb::RocksDb, traits::{DbKey, KvcSnapshotable, KvcTransaction}},
dynamic_boc_db::DynamicBocDb, /*dynamic_boc_diff_writer::DynamicBocDiffWriter,*/
traits::Serializable, types::{CellId, Reference, StorageCell},
TARGET,
};
#[cfg(feature = "telemetry... |
use core::marker::PhantomData;
use managed::ManagedSlice;
use crate::{
arch::{Arch, Registers},
connection::Connection,
internal::*,
protocol::{Command, ConsoleOutput, Packet, ResponseWriter, Tid, TidSelector},
target::{Actions, BreakOp, ResumeAction, StopReason, Target, WatchKind},
util::mana... |
use dirs_next as dirs;
use serde::Deserialize;
use std::fs;
use std::io::{self, Write};
use std::process::Command;
use std::sync::{Arc, Mutex};
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
mod colors;
use colors::Colors;
type Name = String;
type Version = String;
type OnlineVersion = St... |
//! Basic types used in all buffers
use std::mem;
use gl;
use gl::types::*;
use cable_math::{Vec2, Vec3, Vec4, Mat4};
/// Represents different types of primitives which can be drawn on the GPU.
#[repr(u32)] // GLenum is u32
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum PrimitiveMode {
Points ... |
pub mod blocks;
pub mod generator;
pub mod physics;
pub mod raycast;
pub mod voxel;
use std::collections::{HashMap, HashSet};
#[cfg(feature = "inline_assets")]
use std::path::Path;
use bevy::{
asset::{HandleId, LoadState},
ecs::schedule::ShouldRun,
math::{IVec2, Vec3},
pbr::AmbientLight,
prelude:... |
use std::str;
use std::borrow::Borrow;
use bytes::Bytes;
// TODO: Enforce some reasonable limit (for really large sizes approaching this limit, we probably want to implement a stream interface rather than storing the whole thing in memory)
const BULK_STRING_SIZE_LIMIT: i64 = 512*1024*1024;
// Constants for all of th... |
// This file is part of Bit.Country.
// Extension of orml vesting schedule to support multi-currencies vesting.
// Copyright (C) 2020-2021 Bit.Country.
// 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 Li... |
use crate::data::ComponentSet;
use crate::dynamics::{IslandManager, JointGraphEdge, JointIndex, RigidBodyIds};
use crate::geometry::{ContactManifold, ContactManifoldIndex};
#[cfg(feature = "simd-is-enabled")]
use {
crate::data::BundleSet,
crate::math::{SIMD_LAST_INDEX, SIMD_WIDTH},
vec_map::VecMap,
};
#[c... |
// Copyright 2020 The Matrix.org Foundation C.I.C.
//
// 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... |
use aoc_runner_derive::{aoc, aoc_generator};
use itertools::Itertools;
use std::collections::BinaryHeap;
use std::error::Error;
use std::fmt;
use std::iter::Sum;
use std::ops::{Add, AddAssign, Neg};
use std::str::FromStr;
type NodeIndex = usize;
#[derive(Debug, Copy, Clone)]
enum Dir {
Left,
Right,
}
impl Neg... |
// Copyright 2019 Intel Corporation. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use super::{Error, Result};
use crate::vhost_user::Inflight;
use crate::{
get_host_address_range, GuestMemoryMmap, GuestRegionMmap, MmapRegion, VirtioInterrupt,
VirtioInterruptType,
};
use std::convert::TryInto;
us... |
use std::cell::{RefCell, Ref, RefMut};
use std::ffi::{CStr, CString};
use std::fs::File;
use std::mem;
use std::os::unix::io::*;
use std::path::{Path, PathBuf};
use std::ptr;
use std::slice;
use std::rc::Rc;
use libc::FILE;
use libc;
use libsolv;
use libsolv_sys;
use libsolvext_sys;
use libsolv::chksum::Chksum;
use ... |
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use diem_sdk::{
client::{
BlockingClient, Client, InMemoryStorage, MethodRequest, MethodResponse, Response, Result,
VerifyingClient,
},
transaction_builder::Currency,
types::{
account_address::Acc... |
//! # Relay Pallet
//! Based on the [specification](https://spec.interlay.io/spec/relay.html).
#![deny(warnings)]
#![cfg_attr(test, feature(proc_macro_hygiene))]
#![cfg_attr(not(feature = "std"), no_std)]
mod ext;
pub mod types;
#[cfg(any(feature = "runtime-benchmarks", test))]
mod benchmarking;
mod default_weights... |
#![feature(box_syntax)]
pub mod commands;
pub mod helpers;
pub mod memory;
pub mod neighbour_values;
pub mod reclass;
use crate::memory::ReadFromBytes;
use clap::{crate_version, App, Arg, Subcommand};
use commands::{Command, HELP_TEXT};
use itertools::Itertools;
use neighbour_values::NeighbourValuesQuery;
use parking... |
//! Provides raw ffi bindings to the Chipmunk2D library.
use libc::{c_double, c_int, c_uint, uintptr_t};
#[repr(C)]
#[derive(Clone,Copy,PartialEq,Debug)]
/// A Chipmunk2D vector.
pub struct CPVect {
/// The x component.
pub x: CPFloat,
/// The y component.
pub y: CPFloat,
}
impl CPVect {
/// Cr... |
/*!
BGPKIT Parser aims to provides the most ergonomic MRT/BGP message parsing Rust API.
Features:
- **performant**: comparable to C-based implementations like `bgpdump` or `bgpreader`.
- **actively maintained**: we consistently introduce feature updates and bug fixes, and support most of the relevant BGP RFCs.
- **erg... |
// Copyright (c) 2017-2021 <NAME>
//! Desequentialization
use crate::{
analysis::{TemporalRegion, TemporalRegionGraph},
ir::{prelude::*, InstData},
opt::prelude::*,
value::IntValue,
};
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
/// Desequentialization
///
/// This pass implements d... |
// 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.
//! Extensions for fuchsia.net.interfaces.admin.
use fidl_fuchsia_net_interfaces_admin as fnet_interfaces_admin;
use futures::{FutureExt as _, Stream, Str... |
use crate::chip8;
use crate::imgui_wgpu::Renderer;
use futures::executor::block_on;
use glob::glob;
use imgui::*;
use imgui_winit_support;
use std::path::PathBuf;
use std::rc::Rc;
use std::time::Instant;
use wgpu::{Device, Queue};
use winit::{
dpi::LogicalSize,
event::{ElementState, Event, KeyboardInput, Virtua... |
use crate::core::{MicroAlgos, Round, VotePk, VrfPk};
use crate::crypto::address::{Address, HashDigest, MultisigSignature, Signature};
use crate::error::AlgorandError;
use account::Account;
use serde::{Deserialize, Serialize, Serializer};
const MIN_TXN_FEE: MicroAlgos = MicroAlgos(1000);
pub mod account;
pub mod aucti... |
use crate::gl::{GLuint, GL_FLOAT, GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, GLenum, GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_SRC_ALPHA, GL_DST_COLOR, GL_DST_ALPHA, GL_ONE_MINUS_SRC_COLOR, GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA, GL_ONE_MINUS_DST_ALPHA... |
use std::{sync::{Arc}};
use actix_web::{web, HttpRequest, HttpResponse, Responder, post, get, ResponseError};
use bigdecimal::{BigDecimal, ToPrimitive};
use actix_identity::Identity;
use tokio::{spawn};
use inflector::Inflector;
use num_bigint::{ToBigInt};
use serde::{Deserialize, Serialize};
use crate::{AppData, gene... |
use self::managed::{DropNotifier, ManagedTransportState, MangedTransport, RefOwner, WeakRefOwner};
use self::resolver::{Resolver, SystemResolver};
use self::stun_user::StunUser;
use crate::{Endpoint, Request, Response, Result};
use bytes::Bytes;
use parking_lot::Mutex;
use sip_types::host::{Host, HostPort};
use sip_typ... |
//! Implementation of policy `AlphaZero` based on combined MCTS with non-linear value approximator.
//!
//! `AlphaZero` policy is implemented based on [Mastering the game of Go with deep neural networks and tree search](https://www.nature.com/articles/nature16961)
//! and [Mastering Chess and Shogi by Self-Play with a ... |
use sdl2::event::Event;
use sdl2::image::{InitFlag, LoadTexture};
use sdl2::keyboard::Keycode;
use sdl2::messagebox::ClickedButton;
use sdl2::messagebox::*;
use sdl2::pixels::Color;
use sdl2::rect::Rect;
use sdl2::render::{Canvas, Texture};
use sdl2::video::Window;
// use shakmaty::{Board, Chess, File, Move, Position,... |
// Copyright (c) 2017-2018 ETH Zurich
// <NAME> <<EMAIL>>
//! Main command line tool implementation.
use std;
use std::fs::{canonicalize, metadata};
use std::path::{Path, PathBuf};
use std::process::Command;
use clap::{App, AppSettings, Arg, OsValues, SubCommand};
use serde_yaml;
use crate::cmd;
use crate::config::... |
//! This crate implements code formatter rules that are not implemented in rustfmt. These rules
//! are this codebase specific, and they may not be desired in other code bases, including:
//! - Sorting imports into groups (e.g. local imports, pub imports, etc.).
//! - Sorting module attributes into groups.
//! - Adding... |
//! This module provides code specific to the x86-64 architecture.
use bitflags::bitflags;
use crate::error::Error;
use num_derive::FromPrimitive;
/// Represents the general-purpose registers of the x86-64 architecture.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Register {
/// The accumulator register.... |
use crate::bigint::Power;
use num_bigint::BigInt;
use num_integer::Integer;
use std::fmt;
use std::vec;
use std::ops::Deref;
use super::polynomial;
use super::term_builder::TermBuildable;
use super::term_builder;
use crate::bigint::Inverse;
use num_traits::Zero;
use num_traits::One;
use num_traits::ToPrimitive;
/// y^... |
//! Layout types.
use super::data::*;
use super::font::Font;
use core::ops::Range;
use swash::text::cluster::{Boundary, ClusterInfo};
use swash::{GlyphId, NormalizedCoord, Synthesis};
pub use super::line::BreakLines;
/// Alignment of a layout.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[repr(u8)]
pub enum Alignme... |
use super::*;
use std::collections::HashSet;
/// Return a plan that blocks all deliberation transitions.
pub fn block_all(model: &TransitionSystemModel) -> Vec<TransitionSpec> {
model
.transitions
.iter()
.filter_map(|t: &Transition| {
if t.type_ == TransitionType::Controlled {
... |
// Lumol, an extensible molecular simulation engine
// Copyright (C) Lumol's contributors — BSD license
//! Caching energy components for speeding up the energy computation in
//! Monte Carlo simulations.
//!
//! In most of Monte Carlo moves, only a very small subset of the system changes.
//! We can use that property... |
use std::collections::{HashMap, HashSet};
use std::iter::FromIterator;
use super::*;
use ops::control_flow_ops::Group;
use ops::math_ops;
use ops::state_ops;
/// Maintains moving averages of variables by employing an exponential decay.
///
/// When training a model, it is often beneficial to maintain moving averages ... |
use crate::input::{
BaseUrlMap, Group, InputData, InputItem, Kind, Mod, Part, References, TraitImplPattern, Type,
};
use crate::parser::{self, ParsedItem};
use crate::token::{Primitive, Range, Token, TokenStream};
use bitflags::bitflags;
use std::collections::HashMap;
use std::fmt::{Display, Formatter, Result, Writ... |
//! Data model for effect settings.
//!
use std::convert::TryFrom;
use std::fmt;
use std::collections::HashMap;
use num_enum::TryFromPrimitive;
use lazy_static::lazy_static;
use crate::SystemExclusiveData;
use crate::k5000::control;
use crate::k5000::{Depth, UnsignedLevel};
type EffectParameter = UnsignedLevel;
st... |
use anyhow::{anyhow, Result};
use gw_common::h256_ext::H256Ext;
use gw_common::merkle_utils::calculate_state_checkpoint;
use gw_common::smt::{Blake2bHasher, SMT};
use gw_common::sparse_merkle_tree::default_store::DefaultStore;
use gw_common::sparse_merkle_tree::CompiledMerkleProof;
use gw_common::state::State;
use gw_c... |
use std::sync::mpsc::{channel, Sender};
use std::thread;
use rug::Float;
use threadpool::ThreadPool;
use glium::{
glutin::{
self,
event::{ElementState, Event, ModifiersState, MouseButton, MouseScrollDelta, WindowEvent},
event_loop::{ControlFlow, EventLoop, EventLoopWindowTarget},
},
... |
//! Codec for chunk type 7 = FLI_SS2.
use std::io::{Cursor,Read,Seek,SeekFrom,Write};
use byteorder::LittleEndian as LE;
use byteorder::{ReadBytesExt,WriteBytesExt};
use ::{FlicError,FlicResult,Raster,RasterMut};
use super::{Group,GroupBySS2};
/// Magic for a FLI_SS2 chunk - Word Aligned Delta Compression.
///
/// T... |
pub mod container;
pub mod basic;
pub mod action;
pub mod shared;
pub mod structures;
use conrod;
use conrod::backend::glium::glium::{self, Surface};
use conrod::position::Rect;
use time;
use std::sync::mpsc::{self, Sender, Receiver};
use std::collections::HashMap;
use std::path::Path;
use find_folder;
use image;
... |
//! # Event management
//!
//! Event handling
//!
//! Here you can get events, registered students with their statuses, you can modify and upload them back to the intra.
//!
//! ## Example
//!
//! ```no_run
//! use epitok::event::{Event, list_events_today};
//! use epitok::student::fetch_students;
//!
//! # #[async_std... |
// Copyright 2018-2019 Parity Technologies (UK) 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 applicabl... |
use std::cmp::Ordering;
use std::str::FromStr;
use bigdecimal::{BigDecimal, One, Signed, ToPrimitive, Zero};
use num_bigint::BigInt;
// ipow' :: Num a => a -> Integer -> a
// ipow' x n
// | n == 0 = 1
// | m == 0 = let y = ipow' x d in y * y
// | otherwise = x * ipow' x (n - 1)
// where (d,m) = divMod n 2
fn ... |
use std::io::Write;
use std::iter;
use deflate::calculate_block_size;
use hash::{Hash, update_hash, warmup_hash};
use lz77::{BlockState, LZ77Store, find_longest_match, lz77_greedy, store_litlen_dist,
verify_len_dist};
use tree::calculate_entropy;
use util::{LARGE_FLOAT, MAX_MATCH, MIN_MATCH, NUM_D, NUM_LL, ... |
use std::mem;
use cranelift::{
codegen::ir::{FuncRef, JumpTable, StackSlot},
prelude::*,
};
use cranelift_jit::{JITBuilder, JITModule};
use cranelift_module::{FuncId, Linkage, Module};
use itertools::{EitherOrBoth, Itertools};
use super::{
errors::jit::JitResult,
parser::{InsType, Instruction, Registe... |
use std::collections::HashMap;
use crate::api;
use super::raw::{DatabaseExt, StatementExt};
use super::{DBIter, Database, ReadStmt};
const FETCH: &str = "\
select \
id, \
isbn, \
title, \
publisher, \
year, \
costs, \
note, \
borrowable, \
category, \
ifnull(group_concat(a... |
// Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors
// SPDX-License-Identifier: MIT
//! Storage snapshots command. Produces a new trimmed copy of the source storage,
//! with all the context history and block application results for blocks before
//! the specified target block removed. If no target... |
// Copyright 2016 TiKV Project Authors. Licensed under Apache-2.0.
use std::fmt::{self, Debug, Display, Formatter};
use std::ops::Deref;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use std::time::Duration;
use engine::rocks;
use engine::rocks::util::CFOp... |
// Copyright (c) 2016 Google Inc (<EMAIL>).
//
// Refer to the project root for licensing information.
//
use crate::authenticator_delegate::{DefaultInstalledFlowDelegate, InstalledFlowDelegate};
use crate::error::Error;
use crate::types::{ApplicationSecret, TokenInfo};
use futures::lock::Mutex;
use std::convert::AsRe... |
//! # Corsware
//! Yet another implementation of the CORS Specification for Iron.
extern crate iron;
extern crate unicase;
#[macro_use]
extern crate hyper;
pub use unicase::UniCase;
use iron::prelude::*;
use iron::method::Method;
use iron::method::Method::*;
use iron::status;
//use iron::headers::Origin as OriginHead... |
use crate::bucket_item::BucketItem;
use crate::bucket_map::BucketMapError;
use crate::bucket_stats::BucketMapStats;
use crate::bucket_storage::{BucketStorage, Uid, DEFAULT_CAPACITY_POW2, UID_UNLOCKED};
use crate::index_entry::IndexEntry;
use crate::{MaxSearch, RefCount};
use rand::thread_rng;
use rand::Rng;
use analog_... |
/// A budget is a plan that describes what you expect to spend on Cloud
/// projects, plus the rules to execute as spend is tracked against that plan,
/// (for example, send an alert when 90% of the target spend is met).
/// Currently all plans are monthly budgets so the usage period(s) tracked are
/// implied (calenda... |
//! RPKI Manifests.
//!
//! Manifests list all the files that are currently published by an RPKI CA.
//! They are defined in RFC 6486.
//!
//! This module defines the type [`Manifest`] that represents a decoded
//! manifest and the type [`ManifestContent`] for the content of a validated
//! manifest, as well as some he... |
/*
Modified version of the image crates DXT implementation.
The MIT License (MIT)
Copyright (c) 2014 PistonDevelopers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includi... |
use crate::mir::interpret::Scalar;
use crate::ty::{self, Ty, TyCtxt};
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
use smallvec::{smallvec, SmallVec};
use super::{
AssertMessage, BasicBlock, InlineAsmOperand, Operand, Place, SourceInfo, Successors,
SuccessorsMut,
};
pub use rustc_ast::Mutability;... |
mod utils;
mod test_utils;
mod arithmetic;
mod branch;
mod logical;
use log::error;
use log::debug;
use crate::disassembler::disassemble_op;
use crate::emulator::utils::*;
use crate::emulator::branch::*;
use crate::emulator::arithmetic::*;
use crate::emulator::logical::*;
#[derive(Debug)]
pub struct ConditionCodes {
... |
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use std::borrow::Cow;
use std::fmt;
use anyhow::Error;
use log::{info, trace};
use serde::Serialize;
use crate::{
license::{LicenseType, TextData},
store::{Match, Store},
};
/// A struct describ... |
/*
* Copyright (C) 2020, 2021 <NAME>
*
* 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 di... |
use nannou::math::cgmath::{self, Matrix3, Matrix4, Point3, Rad, Vector3};
use nannou::prelude::*;
use std::cell::RefCell;
mod data;
/* Generates vertices on a subdivided isocahedron, normalized to 1.
* It is used for creating a sphere for which the vertices are spread more
* regularly than it would be with for inst... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.