text stringlengths 7.05k 33.9k |
|---|
//! Provides the `Engine` struct. `Engine` drives the game itself.
use std::fmt;
use std::io;
use crate::{ChuiResult, ChuiError};
use super::piece::Color;
use super::player::Player;
use super::board::{ChessVariant, Board};
use super::chess_move::Move;
use super::MoveGenerator;
use super::parser::{self, Parser, Parser... |
//! Menu bar functionality (very basic so far).
//!
//! Usage:
//! ```
//! fn show_menu(ui: &mut egui::Ui) {
//! use egui::{menu, Button};
//!
//! menu::bar(ui, |ui| {
//! ui.menu_button("File", |ui| {
//! if ui.button("Open").clicked() {
//! // β¦
//! }
//! ... |
//! Winit allows you to build a window on as many platforms as possible.
//!
//! # Building a window
//!
//! Before you can build a window, you first need to build an `EventsLoop`. This is done with the
//! `EventsLoop::new()` function. Example:
//!
//! ```no_run
//! use winit::EventsLoop;
//! let events_loop = EventsL... |
use std::{collections::HashMap, net::UdpSocket, time::{Duration, Instant}, mem::MaybeUninit};
use std::{io, net::SocketAddr};
use super::{
constants::*,
cursor::BytesMut,
packet::{
frames::{Frame, Header, PacketType},
pool::{BufferHandle, BufferPool},
sequence_buffer::{SequenceBuf... |
//! Discover which template type parameters are actually used.
//!
//! ### Why do we care?
//!
//! C++ allows ignoring template parameters, while Rust does not. Usually we can
//! blindly stick a `PhantomData<T>` inside a generic Rust struct to make up for
//! this. That doesn't work for templated type aliases, however... |
//! True Random Number Generator (TRNG)
//!
//! Provides basic support for the True Random Number Generator. The TRNG generates truly random
//! data and is intended for use as a generator of entropy.
//!
//! The TRNG is fairly slow - 15 minutes to an hour to generate 1 megabyte - so it probably
//! should only be used... |
// Copyright (c) 2016-2021 The http-serve developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE.txt or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT.txt or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or dist... |
pub fn gen_ast_macros() -> String {
vec![
// ==== Macro that turns a StmtBody into a Stmt ====
gen_ast_macro(
"stmt", &[
("time", ArgKind::StmtTimeRequired),
("body", ArgKind::SpTransparent),
],
FinalCasesType::Regular(r#"
... |
use std::collections::BTreeMap;
use std::fmt;
use std::str::FromStr;
use crate::{
error::{OptionsError, ParameterScanError},
parameter::range_step::{Numeric, RangeStep},
};
use clap::ArgMatches;
use crate::parameter::tokenize::tokenize;
use crate::parameter::ParameterValue;
use anyhow::{bail, Result};
use c... |
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
use std::cmp::min;
use std::collections::HashMap;
use std::ffi::{OsStr, OsString};
use std::fs;
use std::io;
use std::os::unix::fs::MetadataExt;
use std::path::Path;
use walkdir::WalkDir;
use format::{
BlobRef, BlobRefKind, DirEnt, DirList, FileChunk, FileChunkList, Ino, Inode, InodeAdditional,
Result, Rootfs... |
use crate::mini_parser::combinators::{alt, and, delimited, or, preceded, terminated, tuple};
use crate::mini_parser::input::{Find, SplitAt, StripPrefix};
use crate::mini_parser::parsers::{alphanumeric0, digit1, lower_hex_digit0, tag, take};
use crate::mini_parser::Parser;
use crate::rust_v0::{
Abi, BasicType, Const... |
use crossbeam_channel as channel;
use eframe::egui;
use std::{
ops::ControlFlow,
sync::{Arc, Mutex},
time::Duration,
};
use super::app::{self, Error};
use crate::{
ctrl_surf::{self, AppEvent},
midi, mpris,
};
const CTRL_SURF_CONNECTION_TIMEOUT: Duration = Duration::from_millis(250);
const TRACK_ME... |
use std::{
collections::{HashMap, HashSet},
convert::TryInto,
pin::Pin,
};
use async_trait::async_trait;
use bb8::Pool;
use cdl_dto::{
edges::{ComplexFilter, Filter, RelationTree, SimpleFilter},
materialization,
materialization::{FullView, Schema},
TryIntoRpc,
};
use communication_utils::{c... |
//! C Interfaces for ucore
//!
//! NOTE: Must link these sections:
//! `*.got.*` `*.data.*` `*.rodata.*`
#![feature(lang_items)]
#![feature(panic_info_message)]
#![no_std]
#[macro_use]
extern crate alloc;
#[macro_use]
extern crate bitflags;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate static_asse... |
use alloc::boxed::Box;
use alloc::string::String;
use alloc::vec::Vec;
use core::any::Any;
use crate::rsp::rsp::RSP;
use crate::rsp::rsp_assembler::{E, Element, GPR, RSPAssembler, VR, VSARAccumulator};
use crate::rsp::spmem::SPMEM;
use crate::tests::{Level, Test};
use crate::tests::soft_asserts::soft_assert_eq;
fn ru... |
use super::command_pool::{create_command_buffers, create_command_pool};
use super::constants::{INDICES_DATA, MAX_FRAMES_IN_FLIGHT, VALIDATION, VERTICES_DATA};
use super::device::create_logical_device;
use super::framebuffers::create_framebuffers;
use super::graphics_pipeline::create_graphics_pipeline;
use super::instan... |
// 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 in the LICENSE-APACHE file or at:
// https://www.apache.org/licenses/LICENSE-2.0
//! Widget styling
//!
//! Widget size and appearance can b... |
#![allow(dead_code)]
use bit::BitIndex;
use bitflags::bitflags;
use core::ops::Range;
use paste;
use x86_64::registers::model_specific::Msr;
#[derive(Debug)]
pub struct LocalApicRegisters {
base: Msr,
id: Msr,
version: Msr,
tpr: Msr,
ppr: Msr,
eoi: Msr,
ldr: Msr,
sivr: Msr,
isr0: M... |
// Copyright 2017, 2021 AXIA Technologies
//
// 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 a... |
use amethyst::{
assets::{Asset, AssetStorage, Handle, HotReloadStrategy, Loader, ProcessingState},
core::{ArcThreadPool, Time},
ecs::prelude::*,
renderer::{
mtl::{Material, MaterialDefaults},
palette::*,
rendy::{
hal::image::*,
texture::{pixel::*, MipLevel... |
use base64;
use bytes::Bytes;
use futures::{future::ok, Future};
use hyper::{
header::{HeaderValue, ACCEPT},
service::{service_fn, Service},
Body, Error, Method, Request, Response, Server,
};
use interledger_api::{NodeApi, NodeStore};
use interledger_btp::{connect_client, create_open_signup_server, create_s... |
// Copyright 2020 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::model::{
actions::{Action, ActionKey},
component::{
ComponentInstance, ExecutionState, InstanceState, Package,... |
// Copyright 2019 Fullstop000 <<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 ag... |
#![no_std]
#![no_main]
#![feature(abi_efiapi)]
#![allow(unused_imports)]
#![allow(unused_variables)]
// Because there are too many constants that we won't gonna use
#![allow(dead_code)]
// Because extra parens lead to better readability
#![allow(unused_parens)]
// For IoBase
#![feature(const_fn_trait_bound)]
// We ... |
//! Async bits for web applications.
//!
//! This includes [reading to bytes](fn.read_to_end.html),
//! a adapter between std's [`Read`] trait and tokio's [`AsyncRead`],
//! a [`mod@write`] module for writing `HTTP/1` requests and responses,
//! and a [`read`] module for reading `HTTP/1` requests and responses.
#![den... |
// Copyright 2020 <NAME>. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0
use std::convert::TryFrom;
use std::ffi::OsString;
use std::mem::size_of;
use anyhow::{Context, Result};
use nydus_utils::digest::{DigestHasher, RafsDigest};
use rafs::metadata::layout::v5::{
RafsV5ChunkInfo, RafsV5InodeTabl... |
// From https://github.com/koute/pinky/blob/master/pinky-web Thx !!
#![recursion_limit="2048"]
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate stdweb;
extern crate unicorn;
#[macro_use]
extern crate serde_derive;
extern crate serde;
use std::time::Duration;
use std::sync::{Arc, Mutex};
use std::ce... |
// external
use pyo3::prelude::*;
use log::{info};
use crate::misc::helper::{find_heating_system_storage,
find_heat_storage_loss_parameter,
find_minimum};
use crate::components::boiler::Boiler;
use crate::components::heatpump::Heatpump;
use crate::components::generi... |
use crate::primitives::{Byte, Memory, Word};
// TODO: Because of the lack of information some assumptions has been made which need proove:
// - Not readable registers/bits return 0xFF or 1 when read.
/// Manages the sound. This is mapped to `0xFF10..0xFF40` in the Memory.
///
/// Unused bits read 1 and writes are ig... |
#[cfg(feature = "exp")]
use crate::args;
use crate::{FantochFeature, Protocol, RunMode, Testbed};
use fantoch::client::Workload;
use fantoch::config::Config;
use fantoch::id::{ProcessId, ShardId};
use fantoch::planet::{Planet, Region};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::fmt;
us... |
// Copyright 2016 <NAME>, The Alacritty Project Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by ... |
//! Hyperboloids
#![allow(dead_code)]
use core::efloat::*;
use core::geometry::*;
use core::interaction::*;
use core::paramset::*;
use core::pbrt::*;
use std::mem::swap;
use std::sync::Arc;
macro_rules! sqr {
($a: expr) => {
$a * $a
};
}
macro_rules! quad {
($a: expr) => {
sqr!($a) * sqr!... |
use crate::auth::default_token_issuer::DefaultTokenIssuer;
use crate::domain_events::errors::DomainActionError;
use crate::errors::ApiError;
use crate::utils::deep_linker::DeepLinker;
use chrono::Duration;
use db::prelude::*;
use diesel::PgConnection;
use log::Level::Error;
use serde_json::Value;
use std::collections::... |
use crate::errors::NmeaSentenceError;
use crate::parsers;
use crate::sentences::{GeneralSentence, SentenceType};
macro_rules! status {
($($name:ident, $type:ty : [$($input:tt => $status:ident),+ error: $error:ident]),+) => {
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum StatusParsingError {
... |
// Copyright (c) 2021 FZI Forschungszentrum Informatik
// SPDX-License-Identifier: Apache-2.0
//! Test related to expressions
use std::sync::Arc;
use nom::combinator::all_consuming;
use nom::Finish;
use quickcheck::{Arbitrary, Gen};
use crate::named::Named;
use crate::tests::{Equivalence, Identifier};
use crate::typ... |
use super::*;
use crate::{
ast::*,
line_numbers::LineNumbers,
pretty::*,
type_::{FieldMap, ModuleValueConstructor, ValueConstructor, ValueConstructorVariant},
};
static RECORD_KEY: &str = "type";
#[derive(Debug)]
pub struct Generator<'module> {
module_name: &'module [String],
line_numbers: &'m... |
// The tiles in the map, and a struct to contain them
use rand;
use rand::Rng;
use super::super::units::*;
use super::iter_2d::Iter2D;
use super::walls::*;
use super::grid::*;
use items::Item;
use resources::Image;
use utils::*;
// todo: make map generation better!
const MIN_PIT_SIZE: usize = 2;
const MAX_PIT_SIZE:... |
pub(crate) fn f32_shift_right_jam(a: i32, dist: i32) -> i32 {
if dist < 31 {
if (a << (-dist & 31)) != 0 {
(a >> dist) | 1
} else {
(a >> dist) | 0
}
} else {
if a != 0 {
1
} else {
0
}
}
}
use crate::soft_floa... |
// Copyright Materialize, Inc. and contributors. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by ... |
use std::collections::HashMap;
use semver::VersionReq;
use url::Url;
use core::{Dependency, PackageId, Source, SourceId, SourceMap, Summary};
use core::PackageSet;
use util::{profile, Config};
use util::errors::{CargoResult, CargoResultExt};
use sources::config::SourceConfigMap;
/// Source of information about a gro... |
extern crate ssdp;
extern crate futures;
extern crate tokio_core;
extern crate tokio_timer;
use self::futures::{future, Async, Poll, Future, Stream};
use self::futures::task::{self, Task};
use std::time::Duration;
use self::tokio_timer::Timer;
use slog::DrainExt;
use slog;
use slog_stdlog;
use slog_scope;
use std:... |
use crate::internal::{consts, Chain, Sector, SectorInit, Sectors, Version};
use byteorder::{LittleEndian, WriteBytesExt};
use fnv::FnvHashSet;
use std::io::{self, Seek, Write};
use std::mem::size_of;
//===========================================================================//
macro_rules! malformed {
($e:expr)... |
// 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::{
component_instance::{
ComponentInstanceInterface, WeakComponentInstanceInterface,
WeakExtendedInstanceIn... |
use std::fmt;
use std::io::{self, Cursor, ErrorKind, Read, Seek};
use byteorder::{ByteOrder, LittleEndian, ReadBytesExt};
use serde_derive::Serialize;
use uuid::Uuid;
use crate::bit_set::BitSet;
use crate::column_types::ColumnType;
use crate::errors::{ColumnParseError, EventParseError};
use crate::packet_helpers::*;
... |
use std::{
collections::{HashMap, VecDeque},
fs::File,
io::{self, Write},
io::{BufRead, BufReader, BufWriter},
ops::Index,
path::Path,
};
const DEFAULT_MAX_SIZE: usize = 1000;
#[derive(Clone, Debug)]
struct HistoryItem {
context: Option<Vec<String>>,
buffer: String,
}
impl HistoryItem... |
use std::fs;
use std::path::PathBuf;
// non-scrypto dependencies
use clap::{ArgEnum, Parser, Subcommand};
use k256::ecdsa::{signature::Signer, Signature, SigningKey};
// scrypto dependencies
use radix_engine::engine::validate_data;
use radix_engine::ledger::*;
use radix_engine::model::{Instruction, Transaction};
use ... |
//! Handling of everything related to the calling convention. Also fills `fx.local_map`.
mod comments;
mod pass_mode;
mod returning;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use rustc_middle::ty::layout::FnAbiOf;
use rustc_target::abi::call::{Conv, FnAbi};
use rustc_target::spec::abi::Abi;
use... |
use crate::{components, data, data::SignupBoardData, db, embeds};
use chrono::Datelike;
use chrono::NaiveDate;
use itertools::Itertools;
use serenity::{model::prelude::*, prelude::*};
use std::{convert::TryFrom, mem, sync::Arc};
type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
type St... |
use crate::core::card::Card;
use crate::core::hand::Hand;
/// All the different possible hand ranks.
/// For each hand rank the u32 corresponds to
/// the strength of the hand in comparison to others
/// of the same rank.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Part... |
#![warn(missing_docs)]
#![deny(missing_debug_implementations)]
#![doc(html_no_source)]
//! # Sigma: Simple, Safe and Fast Template language.
//!
//! ##### Simple:
//!
//! sigma is a very simple template language, it only tries to solve only one
//! problem. it also extendable, but with simple idea too (_Pure Functions... |
// Copyright (c) 2017-2021, The rav1e contributors. All rights reserved
//
// This source code is subject to the terms of the BSD 2 Clause License and
// the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
// was not distributed with this source code in the LICENSE file, you can
// obtain it at ... |
use crate::multiset::MultiSet;
use algebra::bls12_381::Fr;
use num_traits::identities::One;
/// Computes the multisets h_1 and h_2
pub fn compute_h1_h2(f: &MultiSet, t: &MultiSet) -> (MultiSet, MultiSet) {
//
// 1. Compute s
// XXX: we no longer use sorted by t definition
let sorted_s = f.concatenate_a... |
// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
// Substrate 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 option) a... |
#![forbid(unsafe_code)]
use chrono::{Duration, Local, NaiveDate};
use clap::{App, Arg};
use failure::{err_msg, Error};
use filebuffer::FileBuffer;
use indicatif::{ProgressBar, ProgressStyle};
use ring::digest;
use std::collections::HashSet;
use std::fs::{copy, create_dir_all, read_dir, remove_dir_all, remove_file, Fil... |
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
use crate::items::components::Either;
use crate::items::forms::{DefineDirective, IncludeDirective};
use crate::items::macros::{Macro, MacroName};
use crate::items::symbols::{OpenParenSymbol, QuestionSymbol};
use crate::items::tokens::{
AtomToken, CharToken, CommentKind, CommentToken, FloatToken, IntegerToken, Keywo... |
pub mod c_lib;
use memchr::memchr;
use regex::Regex;
use std::collections::HashMap;
use std::ffi::{CStr, CString};
use std::ops::Range;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::{char, fmt, mem, str};
use tree_sitter::{
Language, LossyUtf8, Parser, Point, Query, QueryCursor, QueryError, QueryPredica... |
use std::cmp;
use std::collections::HashSet;
use std::convert::{TryFrom, TryInto};
use std::error::Error;
use std::fmt;
use std::iter;
use crate::kind;
mod f4jumble;
/// The HRP for a Bech32m-encoded mainnet Unified Address.
///
/// Defined in [ZIP 316][zip-0316].
///
/// [zip-0316]: https://zips.z.cash/zip-0316
pub... |
use arithmetic_parser::{
grammars::{Features, NumGrammar, Parse, Untyped},
BinaryOp, Block, Expr, Lvalue, Spanned, SpannedExpr, Statement, UnaryOp,
};
use num_complex::Complex32;
use thiserror::Error;
use std::{collections::HashSet, error::Error, fmt, iter, mem, ops, str::FromStr};
/// Error associated with c... |
//! # The System Test Context API
//!
//! The goal of this module is to provide the user with an extensible,
//! consistent and ergonomic API to access the System Test Context. The System
//! Test Context is a file-system directory structure that contains all
//! information about the context within which the test is e... |
///! `StandardAlloc` is a general purpose allocator that divides allocations into two major
///! categories: multi-block carriers up to a certain threshold, after which allocations use
///! single-block carriers.
///!
///! Allocations that use multi-block carriers are filled by searching in a balanced
///! binary tree ... |
//! Core types and encoding operations used by the age file format.
use rand::{
distributions::{Distribution, Uniform},
thread_rng, RngCore,
};
use secrecy::{ExposeSecret, Secret};
/// The prefix identifying an age stanza.
const STANZA_TAG: &str = "-> ";
/// The length of an age file key.
pub const FILE_KEY_... |
use std::io::Write;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum ParseError {
#[error("Unknown instruction {0:X}")]
UnknownInstruction(u16),
#[error("More data necessary {0:X}")]
MoreDataNecessary(u16),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Ast {
Nop,
NextAddr,
... |
// Copyright 2021 The AccessKit Authors. All rights reserved.
// Licensed under the Apache License, Version 2.0 (found in
// the LICENSE-APACHE file) or the MIT license (found in
// the LICENSE-MIT file), at your option.
// Derived from Chromium's accessibility abstraction.
// Copyright 2018 The Chromium Authors. All ... |
// This file is part of Substrate.
// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the F... |
//! Encodes EVEX instructions. These instructions are those added by the AVX-512 extensions. The
//! EVEX encoding requires a 4-byte prefix:
//!
//! Byte 0: 0x62
//! βββββ¬ββββ¬ββββ¬ββββ¬ββββ¬ββββ¬ββββ¬ββββ
//! Byte 1: β R β X β B β R'β 0 β 0 β m β m β
//! βββββΌββββΌββββΌββββΌββββΌββββΌββββΌββββ€
//! Byte 2: β W β v... |
use regex::Regex;
use std::{
fs::{self, File},
io::BufWriter,
path::{Path, PathBuf},
};
use javaparser::Class;
use javaparser::Class as JavaClass;
use javaparser::Field as JavaField;
use javaparser::Import as JavaImport;
use javaparser::Superclass as JavaSuperclass;
use kotlinprinter::Arg as KotlinArgume... |
use std::cell::RefCell;
use std::io::Write;
use std::iter::FromIterator;
use std::rc::Rc;
use crate::{
join::{self, JoinInput},
map,
relation::Relation,
treefrog::{self, Leapers},
};
/// A type that can report on whether it has changed.
pub(crate) trait VariableTrait {
/// Reports whether the vari... |
//! Based on the naive LMD-GHOST fork choice rule implementation in the specification:
//! <https://github.com/ethereum/eth2.0-specs/blob/65b615a4d4cf75a50b29d25c53f1bc5422770ae5/specs/core/0_fork-choice.md>
//!
//! `assert`s from Python are represented by statements that either delay the processing of the
//! offendin... |
#[macro_use]
extern crate stdweb;
use std::cell::RefCell;
use std::rc::Rc;
use stdweb::traits::*;
use stdweb::unstable::TryInto;
use stdweb::web::{self, CanvasRenderingContext2d};
use stdweb::web::event::{KeyDownEvent, KeyUpEvent};
use stdweb::web::html_element::CanvasElement;
macro_rules! regx {
($x:expr) => ((... |
//! A small, self-contained SHA512 implementation
//! (C) <NAME>, public domain
#![allow(
non_snake_case,
clippy::cast_lossless,
clippy::eq_op,
clippy::identity_op,
clippy::many_single_char_names,
clippy::unreadable_literal
)]
#[inline(always)]
fn load_be(base: &[u8], offset: usize) -> u64 {
... |
use std::error;
use std::fmt;
use std::collections::HashSet;
use swasm::elements::{
BlockType, External, GlobalEntry, GlobalType, Internal, MemoryType, Module, Instruction,
ResizableLimits, TableType, ValueType, InitExpr, Type,
};
use common::stack;
use self::context::ModuleContextBuilder;
use self::func::FunctionRea... |
use std::any::Any;
use std::ops::{Deref, DerefMut};
use nalgebra::{Scalar, Transform, TCategory};
use simba::scalar::{SubsetOf, SupersetOf};
pub use std::f32::consts::PI;
pub type Vec2 = nalgebra::Vector2<f32>;
pub type Vec3 = nalgebra::Vector3<f32>;
pub type Vec4 = nalgebra::Vector4<f32>;
pub type IVec2 ... |
#![feature(type_alias_impl_trait)]
#![feature(generators, generator_trait)]
use prelude::*;
use serde::{Serialize, Deserialize};
use ast_macros::*;
use shapely::*;
pub type Stream<T> = Vec<T>;
// ============
// === Tree ===
// ============
/// A tree structure where each node may store value of `K` and has arbit... |
// Miniscript
// Written in 2018 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 received a ... |
use core::convert::Infallible;
use core::marker::PhantomData;
use embedded_hal::digital::v2::{toggleable, InputPin, OutputPin, StatefulOutputPin};
use esp8266::{GPIO, IO_MUX, RTC};
/// Extension trait to split a GPIO peripheral in independent pins and registers
pub trait GpioExt {
/// The to split the GPIO into
... |
//! A multi-column [Component Group] without header.
//!
//! Almost every type in this module is parametrized with `COLUMNS` const generic, that represents
//! the count of columns the widget will have. The default value is `3`. (see
//! [`DEFAULT_COLUMNS_COUNT`])
//!
//! The widget is defined by the [`View`].
//!
//! ... |
extern crate dotenv;
#[macro_use]
extern crate failure;
#[macro_use]
extern crate lazy_static;
extern crate memchr;
extern crate regex;
extern crate serenity;
extern crate tinycdb;
extern crate typemap;
use std::env;
use std::collections::{HashMap, HashSet};
use std::fmt;
use std::str;
use std::sync::Arc;
use dotenv:... |
use crate::scene_loader;
use rand::seq::SliceRandom;
pub struct RayTracer<'a> {
w: u32,
h: u32,
frame: &'a scene_loader::Frame,
cam_pos: glm::Vec3,
cam_ori: glm::Vec3,
cam_up: glm::Vec3,
vfov: f32,
cam_corner: glm::Vec3,
cam_horz_span: glm::Vec3,
cam_vert_span: glm::Vec3,
tris: Vec<TriangleInd... |
#[doc = "Reader of register EPINTST"]
pub type R = crate::R<u32, super::EPINTST>;
#[doc = "Reader of field `EPST0`"]
pub type EPST0_R = crate::R<bool, bool>;
#[doc = "Reader of field `EPST1`"]
pub type EPST1_R = crate::R<bool, bool>;
#[doc = "Reader of field `EPST2`"]
pub type EPST2_R = crate::R<bool, bool>;
#[doc = "R... |
use super::lexer::error;
use super::typing::TypeEnv;
use crate::types::{Field, Type};
use crate::{Error, Result};
use crate::{Int, Nat};
use serde::de;
use serde::de::{Deserialize, Visitor};
use std::collections::HashMap;
use std::fmt;
use std::ops::Deref;
#[derive(Debug, PartialEq, Clone)]
pub enum IDLValue {
Boo... |
use crate::{
Arg, Arguments, Boolop, Cmpop, Comprehension, Constant, ConversionFlag, Expr, ExprKind,
Operator,
};
use std::fmt;
mod precedence {
macro_rules! precedence {
($($op:ident,)*) => {
precedence!(@0, $($op,)*);
};
(@$i:expr, $op1:ident, $($op:ident,)*) => {
... |
use std::{cell::RefCell, collections::HashMap, sync::Arc};
use runestick::{Any, Shared};
use wasm::util::document;
use wasm_bindgen::{prelude::Closure, JsCast, JsValue};
use crate::{
clear_element, handle_vm_result,
wasm::{self, rune_lib::alert},
};
pub const MODULE_NAME: &str = "Engine";
pub fn create_modul... |
use crate::coin_helpers::assert_sent_sufficient_coin;
use crate::msg::{
CreatePollResponse, HandleMsg, InitMsg, PollResponse, QueryMsg, TokenStakeResponse,
};
use crate::state::{
bank, bank_read, config, config_read, poll, poll_read, Poll, PollStatus, State, Voter,
};
use cosmwasm_std::{
coin, log, to_binar... |
use crate::codegen::Asm;
use byteorder::{ByteOrder, LittleEndian};
use std::collections::HashMap;
use std::fmt::{self, Display};
use std::rc::Rc;
use strum_macros::EnumIter;
pub const JMP_REL_IMMEDIATE_MAX: u32 = 0b_111_1111_1111_1111_1111_1111_1111;
pub const JMP_REL_IF_IMMEDIATE_MAX: u32 = 0b_111_1111_1111_1111_1111... |
mod tableau;
mod transform;
use alphabet::Alphabet;
use cipher::Cipher;
use derive_builder::Builder;
use lfg::LFGBuilder;
use masc;
use masc::tableau::Atom;
use num::{Integer, Unsigned};
use std::cell::RefCell;
use std::collections::VecDeque;
use tableau::ReciprocalTable;
use transposition::ColumnarTranspositionCipher... |
extern crate nalgebra as na;
extern crate gnuplot;
extern crate rand;
use na::*;
use std::f64;
use std::vec::Vec;
use rand::Rng;
use std::collections::BTreeMap;
use gnuplot::{Figure, Color};
const PI: f64 = std::f64::consts::PI;
// gaussian ditribution, with controable mean and standard deviation
fn gaussian_dist(x:... |
extern crate roguelike;
//use sdl2::audio::{AudioCallback, AudioSpecDesired};
mod menu;
use crate::menu::*;
mod game;
use crate::game::*;
mod player;
mod entity;
mod attack;
mod blackboard;
use crate::blackboard::*;
mod yellowenemy;
mod redenemy;
mod blueenemy;
mod finalenemy;
//use crate::finalenemy::*;
mod uti... |
/*
* Copyright 2019 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... |
// Copyright 2016 <NAME>. 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>, at your
// option. This f... |
/// ///////////////////////////////////////////////////////////////////////////
/// File: annealing/solver/prsa.rs
/// ///////////////////////////////////////////////////////////////////////////
/// Copyright 2017 <NAME>
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use thi... |
pub mod utils;
use std::time;
use std::sync::{Arc, RwLock};
use utils::Palette;
use crate::gameboy::memory::GameboyMemory;
use crate::gameboy::memory::io::IoRegister;
const SCREEN_WIDTH: usize = 160;
const SCREEN_HEIGHT: usize = 144;
const LYC_BIT: u8 = 0x04;
const HBLANK_INT_BIT: u8 = 0x08;
const VBLANK_INT_BIT: ... |
// Copyright 2018 <NAME>
// See LICENSE-APACHE and LICENSE-MIT for license details.
//! This project provides a register access layer (RAL) for all
//! STM32 microcontrollers.
//!
//! When built, you must specify a device feature, such as `stm32f405`.
//! This will cause all modules in that device's module to be re-ex... |
/*
* Copyright (C) 2020 <NAME> (<EMAIL>)
*/
use percent_encoding::{ percent_decode, utf8_percent_encode, NON_ALPHANUMERIC };
use chrono::prelude::*;
use std::time::Instant;
use crate::client_context::ClientContext;
use crate::http::error::HttpResult;
use crate::http::*;
use crate::keyval::Key;
use crate::http::{ Ht... |
/// Polynomial expressions for "delta-T" provided by NASA
///
/// When calculating the motion of the moon, UT (Universal Time) is not
/// accurate enough, but needs TDT (Terrestrial Dynamical Time).
/// Earth's spin around the polar axis varies in time,
/// and NASA provides a look-up tables for finding,
/// so called,... |
//! Detects a `char` literal, like `'A'` or `'\u{03aB}'`.
use super::super::lexeme::LexemeKind;
const HEX: LexemeKind = LexemeKind::CharacterHex;
const PLAIN: LexemeKind = LexemeKind::CharacterPlain;
const UNICODE: LexemeKind = LexemeKind::CharacterUnicode;
const UNDETECTED: (LexemeKind, usize) = (LexemeKind::Undet... |
use aoc_macro::{generator, sol_test, solution};
use hashbrown::{HashMap, HashSet};
use petgraph::algo::astar;
use petgraph::graph::NodeIndex;
use petgraph::visit::Bfs;
use petgraph::Graph;
use std::cmp::{self, Ordering};
use std::collections::BTreeMap;
use std::fmt::{self, Write};
aoc_macro::day!();
#[derive(Copy, Cl... |
use crate::game;
use crate::table;
use rand;
use rand::seq::IteratorRandom;
use smallvec::SmallVec;
use std::cmp::max;
use std::mem::MaybeUninit;
use std::time::{Duration, Instant};
use std::vec::Vec;
#[derive(Debug)]
pub enum Error {
Quit,
Other(String),
}
pub trait AI {
fn select_move(&mut self, g: &g... |
//! A Encoder and Decoder useful for on-demand serialization and
//! deserialization of Rust compiler structures.
//!
//! This code is based on the incremental compilation cache.
//!
//! TODO Figure out how we can share as much of the data we encode here
//! with the crate metadata.
//!
use std::mem;
use rustc_data_s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.