text
stringlengths
3.09k
13.9k
//#[cfg(test)] //#[macro_use] use rand::Rng; use serde::{Serialize, Deserialize}; use crate::crypto::hash::{H256, Hashable}; use crate::transaction::{self, SignedTransaction}; use crate::crypto::merkle::MerkleTree; extern crate chrono; use chrono::prelude::*; #[derive(Serialize, Deserialize, Debug,Clone)] pub struct...
use packed_struct::prelude::*; #[derive(Debug, Default)] pub struct CRegisters (pub CR0, u64, pub CR2, pub CR3, pub CR4); impl CRegisters { pub fn get(&self, v: usize) -> Option<&dyn CRAccess> { match v { 0 => Some(&self.0), 2 => Some(&self.2), 3 => Some(&self.3), ...
use lalrpop_util::ParseError; use std::fmt; use miniscript::bitcoin::{self, hashes}; use miniscript::descriptor; use miniscript::policy::compiler::CompilerError; use crate::ast::{Ident, InfixOp}; use crate::runtime::Value; pub type Result<T> = std::result::Result<T, Error>; #[derive(thiserror::Error, Debug)] pub en...
// Copyright 2019 MesaTEE Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to...
use crate::{BallAttractionVfxEvent, BlockCollisionEvent, LifeEvent, ScoreEvent, StopBallAttractionEvent}; use components::{AttractionLine, Ball, Block, Paddle, StickyBall}; use resources::{ARENA_HEIGHT, ARENA_WIDTH}; use amethyst::{ core::{ math::{Isometry2, RealField, Rotation2, Unit, Vector3}, T...
use crate::{ command::CommandProcessor, engine::{ error::EngineError, graphics::{self, Color}, log::{error, info}, Context, EngineContext, State, }, saves::Player, state::MainStates, load::LoadContext, }; use worldcli::worldlib::events::{split, Receiver, Sender};...
extern crate rand; use rand::prelude::*; use std::collections::{HashMap, VecDeque}; use std::hash::Hash; // This is a workaround while we wait for https://github.com/rust-lang/rust/issues/41517 to be merged // Copied for here: https://github.com/aatxe/markov/blob/stable/src/lib.rs#L59 pub trait Token: Clone + Eq + Ha...
mod camera; use crate::camera::Camera; use glam::DVec3; use image::{ImageBuffer, RgbImage}; use render_3d::canvas::SymmetricCanvas; use serde::Deserialize; type Color = DVec3; fn reflect_ray(ray: DVec3, normal: DVec3) -> DVec3 { 2.0 * normal.dot(ray) * normal - ray } #[derive(Debug, Clone, Copy, Deserialize)] #...
// Adapted from https://github.com/Alexhuszagh/rust-lexical. // FLOAT TYPE use super::num::*; use super::rounding::*; use super::shift::*; /// Extended precision floating-point type. /// /// Private implementation, exposed only for testing purposes. #[doc(hidden)] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub(cra...
use crate::{ParameterStore, TextureNode}; use nannou::prelude::*; use nannou::wgpu::{ CommandEncoderDescriptor, Device, Texture, TextureBuilder, TextureUsage, TextureView, }; pub struct Shader2DNode { bind_group: wgpu::BindGroup, render_pipeline: wgpu::RenderPipeline, vertex_buffer: wgpu::Buffer, u...
extern crate wasm_bindgen; extern crate web_sys; use engine::canvas_board::CanvasBoardRenderer; use engine::canvas_board::piece_at; use engine::piece::Color; use engine::piece::Piece; use engine::piece::PieceType; use engine::player::Player; use self::web_sys::HtmlTextAreaElement; pub struct GameController<'a> { r...
pub mod ast_lower; pub mod tir_infer; pub mod visit; use crate::ast::{self, Span}; use crate::error_context::ErrorContext; use crate::ir::{ self, AssignOp, BinOp, FloatSpecifier, InlineCParamType, IntegerSpecifier, Path, UnaryOp, }; use crate::mod_gen::ModGenError; use crate::ty::Ty; use std::cell::{Cell, RefCell}...
use comrak::{markdown_to_html, ComrakExtensionOptions, ComrakOptions}; use serde_json::Value; use std::io::Write; use std::process::{Command, Stdio}; pub struct Generator { title: String, theme: String, } impl Generator { const CALLBACKS: [(&'static str, fn(&serde_json::Value) -> String); 7] = [ (...
#[macro_use] extern crate jsonrpc_core_client; extern crate futures; extern crate substrate_rpc; extern crate node_primitives; extern crate hyper; extern crate sr_primitives; extern crate node_runtime; extern crate substrate_test_runtime; extern crate substrate_keyring; extern crate parity_codec; extern crate srml_syst...
use rltk::{a_star_search, Algorithm2D, BaseMap, NavigationPath, Point, Rltk}; use crate::model::{idx_to_xy, xy_to_idx, Position, Rectangle}; use crate::spatial_index::*; pub mod tile; pub use tile::*; pub mod tile_backgrounds; pub use tile_backgrounds::*; pub mod tile_entities; pub use tile_entities::*; pub mod tile_...
/* Reference [1] Tutorial on Permutation Tree (析合树) - Codeforces https://codeforces.com/blog/entry/78898 [2] 析合树学习小记_Cold_Chair的博客-CSDN博客 https://blog.csdn.net/Cold_Chair/article/details/91358311 Description p: {0, 1, ..., n-1} の順列 p の permutation tree を計算する。 p の成す permutation graph の modular decompositi...
use std::convert::From; use std::fmt::{Debug, Display}; use actix_web::error::BlockingError; use actix_web::{error::ResponseError, HttpResponse}; use derive_more::{Display, From}; use psn_api_rs::psn::PSNError; use redis_tang::RedisPoolError; use tokio_postgres_tang::PostgresPoolError; // res errors use from trait to...
//! Class and function declarations. use super::expr::assign_expr; use super::pat::pattern; use super::typescript::*; use crate::syntax::function::function_body; use crate::{SyntaxKind::*, *}; pub const BASE_METHOD_RECOVERY_SET: TokenSet = token_set![ T!['['], T![ident], T![yield], T![await], T![;], T!['}'], J...
const PIF_ROM_START: u32 = 0x1fc0_0000; const PIF_ROM_LENGTH: u32 = 0x0000_07c0; const PIF_ROM_END: u32 = PIF_ROM_START + PIF_ROM_LENGTH - 1; const PIF_RAM_START: u32 = 0x1fc0_07c0; pub const PIF_RAM_LENGTH: u32 = 0x0000_0040; const PIF_RAM_END: u32 = PIF_RAM_START +...
const TABLE_SIZE: u16 = 0x400; const NAME_TABLE_SIZE: u16 = 0x3c0; const TABLE_WIDTH: u16 = 256; const TABLE_HEIGHT: u16 = 240; const BLOCK_WIDTH: u16 = 8; const BLOCK_HEIGHT: u16 = 8; const ATTRIBUTE_BLOCK_WIDTH: u16 = 32; const ATTRIBUTE_BLOCK_HEIGHT: u16 = 32; #[derive(Clone, Copy)] enum MirroringMode { Vertic...
// Copyright 2015 <NAME> (IRCAM) // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in wri...
#![feature(test)] extern crate test; use smallvec::*; use std::sync::{Arc}; use std::rc::Rc; use std::cell::RefCell; use test::Bencher; #[derive(Debug)] pub struct World { pub sex: Vec<bool>, pub alive: Vec<bool>, pub childs: Vec<SmallVec<[usize; 10]>>, pub parents: Vec<(Option<usize>, Option<usize>...
#![feature(concat_idents)] use std::{ fs::File, io::{BufRead, BufReader}, path::Path, process::Command, }; use riscv_simulator::{ elf::{parse_file, ParseResult}, Bus, Cpu, Isa, }; fn compile_source(name: &str) -> ParseResult { let project_path = Path::new(env!("CARGO_MANIFEST_DIR")); ...
//! This module defines bulletin for the Source stage. use anyhow::Result; use serde::{Deserialize, Serialize}; use std::fmt; use std::iter::FromIterator; use std::str::FromStr; use super::BulletinEntry; use crate::cache::records::*; use crate::cache::{ReadCache, Transaction, WriteCache}; use crate::checksum::{Digest...
/*! ## LQE (Kalman) filter This module implements **Linear Quadratic Estimation** (LQE) filter which also known as Kalman filter. Filter has four parameters: - `F` - factor of actual value to previous actual value - `H` - factor of measured value to actual value - `Q` - measurement noise - `R` - environment noise ...
use std::cmp::{max, min}; use std::fs::File; use std::io::prelude::*; use regex::Regex; #[derive(Clone, Debug, Eq, PartialEq)] struct Moon { position: [isize; 3], velocity: [isize; 3], } impl Moon { // fn new(x: isize, y: isize, z: isize) -> Self { // Moon { // position: [x, ...
use ffi; use std::slice; use std::mem::{transmute, replace, forget}; use std::mem; use alloc::heap::{allocate, deallocate}; use std::ptr::null_mut; use libc; use std::ops::{Deref, DerefMut}; pub trait UTF16Ext { fn units<'a>(&'a self) -> &'a [u16]; fn to_string(&self) -> String; } impl UTF16Ext for ffi::cef_s...
use crate::league::{ LeagueSettings, Schedule, ScheduleError, ScheduleGenerator, ScheduleItem, ScheduleTour, Season, }; use crate::utils::DateUtils; use chrono::prelude::*; use chrono::Duration; use chrono::NaiveDate; use log::{warn}; // const DAY_PLAYING_TIMES: [(u8, u8); 4] = [(13, 0), (14, 0), (16, 0), (18, 0)]...
use { crate::{request, Meta, KAKAO_LOCAL_API_BASE_URL}, serde::Deserialize, }; #[derive(Debug, Clone)] pub struct Address { pub address: Option<String>, pub land_lot: Option<LandLotAddress>, pub road: Option<RoadAddress>, } #[derive(Debug, Clone)] pub struct LandLotAddress { pub address: Strin...
use {Pattern, PatternValue, MatchResult, Adjustment, AdjustmentApplication}; use mir; use adjustment; pub trait Selectable : ::std::fmt::Debug { } /// Selects instructions. pub struct Selector<S: Selectable + 'static, V: PatternValue> { pub patterns: Vec<Pattern<S, V>>, } /// A pattern that matched with a node. ...
use std::{collections, error, fmt, result}; pub mod inputs; // it doesn't make sense to ever have both kinds of errors // as it should be impossible for us to validate if we couldn't // first succesfully parse the value // this purposely doesn't impl std::error::Error to allow the from // impls below. // // This make...
use crate::model::{ board::{Board, IntersectionIndex, RoadIndex}, common::{ AbsoluteDirection, Around, AxisDirection, CarIndex, InOutDirection, LaneDirection, LaneIndex, }, stateful, stateless, }; #[derive(Clone, Debug)] pub struct Road { pub lane_to_high: Vec<Lane>, pub lane_to...
//! Everything related to terrains. #![allow(missing_docs)] // Temporary use crate::core::math::aabb::AxisAlignedBoundingBox; use crate::resource::texture::{TextureKind, TexturePixelKind}; use crate::{ core::{algebra::Vector3, arrayvec::ArrayVec, pool::Handle, visitor::prelude::*}, resource::texture::Texture,...
//! # Subreddit Responses use serde::Deserialize; /// SubredditResponse #[derive(Debug, Deserialize)] pub struct SubredditResponse { /// Should be "t5" for subreddits. pub kind: Option<String>, /// Data about subreddit. pub data: SubredditData, } /// SubredditData #[derive(Debug, Deserialize)] pub str...
use { super::double_line::DoubleLine, crate::{ app::*, display::{Screen, W}, errors::ProgramError, kitty::{self, KittyImageId}, skin::PanelSkin, }, crossterm::{ cursor, style::{ Color, SetBackgroundColor, }, ...
//! Ported to Rust from <https://www.shadertoy.com/view/MtX3Ws> //! //! Original comment: //! ```glsl //! // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. //! // Created by <NAME> 2015 //! ``` use crate::SampleCube; use shared::*; use spirv_std::glam::{vec2, vec3, vec4, Mat2, Vec2...
use std::str::FromStr; use regex::Regex; use std::collections::BTreeMap; use super::utils::{preprocess_input, ParseError}; #[derive(Debug, PartialEq, PartialOrd, Eq, Ord)] enum Action { Starts(u32), FallsAsleep, WakesUp } #[derive(Debug, PartialEq, PartialOrd, Eq, Ord)] struct Timestamp { pub year: u32, pu...
use super::*; /// The Function type, corresponds to `TUPLE ARROW BLOCK` #[derive(Debug, Clone)] pub struct Function<'a> { pub args: Vec<FunctionArg>, pub body: AST<'a>, pub has_self: bool, pub has_lhs: bool, pub has_new: bool, pub closure: Vec<(String, AST<'a>)>, pub refs: Vec<(String, Loca...
use std::{env, fs}; // Day 03 // https://adventofcode.com/2020/day/3 // Given a grid of #'s and .'s find the number of #'s while traversing through the grid in the diagonal direction. // The `#` are referred to as trees, and `.` are referred to as squares. // Input: Diagonal Along right 3, down 1. // ..##....... // ...
use ::{KeyType, ValueType}; use wal_file::KeyValuePair; use std::collections::{BTreeMap, BTreeSet}; use std::collections::btree_map::Entry::Occupied; use std::collections::btree_map; use std::collections::btree_set; use std::collections::btree_set::Iter; pub struct MultiMap<K: KeyType, V: ValueType> { multi_map:...
use crate::*; use std::os::raw::c_char; /// Represents a type which does pairwise randomness and triple generation as a /// client for client-malicious SPDZ pub trait ClientGen { type Keys; /// The type of messages passed between client and server type MsgType; /// Create new ClientGen object fn n...
//! This module defines a [polygon mesh](https://en.wikipedia.org/wiki/Polygon_mesh). use crate::data::dirty::traits::*; use crate::prelude::*; use crate::control::callback; use crate::data::dirty; use crate::debug::stats::Stats; use crate::system::Context; use enso_shapely::shared; use num_enum::IntoPrimitive; /...
// Copyright 2019 The vault713 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 a...
#![no_main] #![no_std] #![allow(unused_variables, unused_mut)] use embedded_hal::digital::v2::OutputPin; use embedded_hal::blocking::delay::DelayMs; use nrf52840_hal::{ gpio::{p0::Parts as P0Parts, p1::Parts as P1Parts, Level}, pac::{Peripherals, SPIS1, SPIM0,}, spim::{Frequency, Pins as SpimPins, Spim, M...
use hv::{prelude::*, resources::Resources, script::ScriptContext}; #[derive(Debug)] pub struct SceneScript { table: LuaRegistryKey, } impl<'lua> FromLua<'lua> for SceneScript { fn from_lua(lua_value: LuaValue<'lua>, lua: &'lua Lua) -> LuaResult<Self> { Self::from_table(lua, LuaTable::from_lua(lua_valu...
// Copyright (C) 2021 <NAME> <<EMAIL>> // SPDX-License-Identifier: Apache-2.0 use cmake; use glob::glob; const SOURCE_DIR: &str = "build/KTX-Software"; const CMAKELISTS: &str = "build/KTX-Software/CMakeLists.txt"; #[cfg(feature = "run-bindgen")] mod run_bindgen { const INCLUDE_DIRS: &[&str] = &[ "build/"...
use bj_bin::prompt; use bj_bin::utils::{create_if_not_exist, read_maybexz, write_maybexz}; use bj_core::deck::{Card, Deck}; use bj_core::hand::Hand; use bj_core::playstats::PlayStats; use bj_core::resp::resps_from_buf; use bj_core::table::Table; use bj_core::utils::rand_next_hand; use clap::{arg_enum, crate_authors, cr...
//! Demonstrates a mutable application state manipulated over a number of UIs extern crate iui; use iui::controls::{ Entry, Group, HorizontalBox, HorizontalSeparator, Label, MultilineEntry, PasswordEntry, ProgressBar, Slider, Spacer, Spinbox, VerticalBox, }; use iui::prelude::*; use std::cell::RefCell; use std...
use crate::data::{ ast::Interval, error_info::ErrorInfo, position::Position, primitive::Data, primitive::PrimitiveType, Literal, }; use crate::error_format::*; use lettre::{ message::{header, Mailbox, MultiPart, SinglePart}, transport::smtp::authentication::Credentials, }; use std::collections::HashMap;...
#![cfg_attr(feature = "ci_run", deny(warnings))] extern crate clap; extern crate ton_node; #[macro_use] extern crate log; extern crate ton_block; extern crate ton_types; extern crate ton_vm as tvm; extern crate ed25519_dalek; extern crate log4rs; extern crate reqwest; extern crate http; extern crate parking_lot; exter...
use crate::core::ribosome::CallContext; use crate::core::ribosome::InvocationAuth; use crate::core::ribosome::RibosomeT; use holochain_types::prelude::*; use holochain_wasmer_host::prelude::WasmError; use holochain_zome_types::info::CallInfo; use std::sync::Arc; pub fn call_info( _ribosome: Arc<impl RibosomeT>, ...
use core::cell::UnsafeCell; use core::sync::atomic::{AtomicUsize, Ordering}; use util::cpu_relax; /// A synchronization primitive which can be used to run a one-time global /// initialization. Unlike its std equivalent, this is generalized so that The /// closure returns a value and it is stored. Once therefore acts ...
use eval::{eval, Value}; use gtk::{ ContainerExt, Entry, EntryExt, EntryIconPosition, Grid, GridExt, GtkWindowExt, Inhibit, Label, LabelExt, WidgetExt, Window, WindowType, }; use permutator::CartesianProduct; // useful trait trait AddIfNotExists<T> { fn add_if_not_exists(&mut self, _e: T) {} } impl<T: Par...
use std::ptr::copy_nonoverlapping; use std::slice::from_raw_parts; use crate::Slice; use byteorder::{BigEndian, ByteOrder}; pub struct RingSlice { ptr: *const u8, cap: usize, start: usize, offset: usize, end: usize, } impl Default for RingSlice { fn default() -> Self { RingSlice { ...
extern crate libc; extern crate serde; extern crate serde_json; use libc::syscall; use serde::Deserialize; use std::env; use std::error::Error; use std::fs; use std::fs::File; use std::io::{ErrorKind, Read}; use std::ffi::CString; use std::os::raw::{c_int, c_char}; #[link(name = "grpc_ratls_client")] extern "C" { ...
use std::{iter, slice::Iter}; use crate::{ catch::{ difficulty_object::DifficultyObject, slider_state::SliderState, SECTION_LENGTH, STAR_SCALING_FACTOR, }, curve::CurveBuffers, parse::{HitObject, Pos2}, Beatmap, Mods, }; use super::{ calculate_catch_width, catch_object::Cat...
use super::*; use bluez::{ client::*, interface::{controller::*, event::Event}, }; use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, str::FromStr}; use tokio::time::{sleep, Duration}; #[derive(Clone, Debug, Serialize, Deserialize)] struct Reading { rssi: ...
use crate::{ ash::version::InstanceV1_1, errors::{HandleType, Result, VkTracerError}, SwapchainHandle, VkTracerApp, }; use ash::{version::DeviceV1_0, vk}; #[derive(Copy, Clone)] pub struct ImageViewFatHandle { pub(crate) handle: vk::Image, pub(crate) view: vk::ImageView, pub(crate) format: vk::...
use winit::EventsLoop; use winit::WindowBuilder; use winit::{Event, WindowEvent}; use winit::dpi::LogicalSize; use vulkano::instance::{Instance, InstanceExtensions, ApplicationInfo, Version, layers_list, PhysicalDevice, QueueFamily}; use std::sync::Arc; use vulkano::instance::debug::{DebugCallback, MessageTypes}; use v...
pub use crate::backend::texture::{Texture, TextureKey}; use crate::backend::{self}; use crate::blob::{load_blob, AssetPath, Blob}; pub use ash::{vk, vk::Format}; use snoozy::*; #[derive(Serialize, Debug, PartialEq, Eq, Abomonation, Clone, Copy)] pub enum TexGamma { Linear, Srgb, } #[derive(Serialize, Debug,...
use crate::input::Input; use std::collections::HashMap; #[derive(Eq, PartialEq, Debug)] enum JsonValue<'a> { String(&'a [u8]), Number(i32), Array(Vec<JsonValue<'a>>), Object(HashMap<&'a [u8], JsonValue<'a>>), Comma, Colon, EndOfArray, EndOfObject, EndOfInput, } fn parse<'a>(input: ...
use futures::prelude::*; use linkerd2_proxy_api::inbound::{ self as api, inbound_server_policies_client::InboundServerPoliciesClient as ApiClient, }; use linkerd_app_core::{ exp_backoff::{ExponentialBackoff, ExponentialBackoffStream}, proxy::http, svc::Service, Error, IpNet, Recover, Result, }; use ...
use anyhow::Result; use wasmer::WasmerEnv; wit_bindgen_wasmer::export!("./tests/runtime/lists/imports.wit"); use imports::*; use wit_bindgen_wasmer::Le; #[derive(WasmerEnv, Clone)] pub struct MyImports; impl Imports for MyImports { fn list_param(&mut self, list: &[u8]) { assert_eq!(list, [1, 2, 3, 4]); ...
use crate::encoding::Reader; use crate::key; use crate::{Error, KEYTYPE_ED25519, KEYTYPE_RSA}; use bcrypt_pbkdf; #[cfg(feature = "openssl")] use openssl::bn::BigNum; /// Decode a secret key given in the OpenSSH format, deciphering it if /// needed using the supplied password. pub fn decode_openssh(secret: &[u8], passw...
use graphql_client::*; use crate::blocking::StudioClient; use crate::operations::subgraph::list::types::*; use crate::shared::GraphRef; use crate::RoverClientError; type Timestamp = String; #[derive(GraphQLQuery)] // The paths are relative to the directory where your `Cargo.toml` is located. // Both json and the Gra...
use crate::{arena::CStringArena, PropFlags}; use quijine_core::{self as qc, raw}; use std::{mem::transmute, os::raw::c_int}; #[derive(Clone)] #[repr(transparent)] pub struct CFunctionListEntry(qc::CFunctionListEntry); impl<'a> CFunctionListEntry { /// # Safety /// The lifetime must be valid. pub unsafe fn...
use ahash::AHashSet as HashSet; use winit::event::{Event, MouseButton, VirtualKeyCode}; use winit::event_loop::EventLoopProxy; use crate::gfx::UserEvent; use crate::math; use crate::platform::{EventReceiver, EventSender}; pub struct InputState { event_sender: EventSender, event_receiver: EventReceiver, cl...
//! Pipeline-wide utilities //! //! This module includes general-purpose utilities that could potentially be //! used by more than a single stage. The entry point to this utilities is //! desgined as singelton [`Utils`] instance shared by all stages through an Arc //! pointer. use std::sync::Arc; use pallas::network:...
//! High level example, feature and many other types. use noisy_float::types::R64; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use std::{ collections::HashMap, iter, ops::Neg, sync::{ atomic::{AtomicUsize, Ordering}, RwLock, }, }; /// The high level example, whic...
use std::io; use std::io::Read; use bytes::Bytes; use std::task::Poll; use futures::stream::Stream; use std::future::Future; use tokio::io::AsyncRead; use tokio::io::AsyncWrite; use tokio::io::AsyncWriteExt; use crate::error; use crate::error::Error; use crate::result; use crate::result::Result; use crate::solici...
use crate::engine::Engine; use crate::input::MyGameInput; use crate::message::{MainMessage, Message}; use crate::server; use crate::ui::widget::button; use crate::ui::widget::button::Button; use crate::ui::widget::text::Text; use crate::ui::{Column, Element}; use crate::util; use coffee::graphics::{Color, Frame, Image,...
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors. // // 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 ...
pub mod snake_functions { use super::snake_data::*; use crate::game::game_data::*; use bevy::prelude::*; pub fn snake_movement( time: Res<Time>, mut timer: ResMut<GameTimer>, keyboard_input: Res<Input<KeyCode>>, mut move_tail: ResMut<Events<EventMoveTail>>, game:...
use std::error::Error; use dominator::{clone, events, html, Dom, DomBuilder}; use futures_signals::map_ref; use futures_signals::signal::{Mutable, MutableSignal, Signal}; use wasm_bindgen::__rt::std::rc::Rc; use wasm_bindgen::prelude::Closure; use wasm_bindgen::JsCast; use web_sys::HtmlElement; use crate::futures_sig...
use super::{CellRange, SheetCoordinate, SheetRange}; use crate::size_check::NonNegativeIsize; use crate::{Cell, Sheet}; use im::vector::Focus; use im::Vector; use std::cmp; use std::isize; /// A trait that allows you to create an IntoIterator-like with the context of T pub trait IntoIteratorWith<'a, T> { type Item...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Chip Select Address Register"] pub csar0: CSAR, #[doc = "0x04 - Chip Select Mask Register"] pub csmr0: CSMR, #[doc = "0x08 - Chip Select Control Register"] pub cscr0: CSCR, #[doc = "0x0c - Chip Select Address Re...
// 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 { anyhow::{Context, Error}, cm_fidl_validator, fidl::endpoints::{create_endpoints, ServerEnd}, fidl_fuchsia_component_decl as fcdecl, f...
use anyhow::anyhow; use hyper::{Body, Method, Request, Response, StatusCode}; use policy_evaluator::validation_response::ValidationResponse; use serde_json::json; use tokio::sync::{mpsc, oneshot}; use tracing::{debug, error, info, span::Span, warn}; use crate::admission_review::AdmissionRequest; use crate::communicati...
use log::{trace, warn}; use url::Url; use tokio::prelude::*; use tokio::sync::mpsc; use tokio::{io::BufReader, net::TcpStream}; use crate::chunk::{Chunk, Signal}; use crate::message::*; use super::bufreadwriter::BufReadWriter; use super::handshake::{Handshake, HandshakeProcessResult, PeerType}; // private connectio...
use crate::generational_index::generational_index::EntryValue::Empty; #[derive(Clone, Copy)] pub struct GenerationalIndex { pub index : usize, pub generation: u64 } impl GenerationalIndex { pub fn index(&self) -> usize { self.index } } pub enum EntryValue { // Generation // PackedIndex...
/* * (c) Copyright 2016 Hewlett Packard Enterprise Development LP * * 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 super::passport_record::PassportRecord; use super::passport_record_attribute_key::PassportRecordAttributeKey; use anyhow::{Context, Error, Result}; use regex::Regex; lazy_static! { /// Matches passport record hair colors. static ref PASSPORT_RECORD_HAIR_COLOR_PATTERN: Regex = Regex::new(r"^#[0-9a-f...
use aoc_runner_derive::{aoc, aoc_generator}; use regex::Regex; use std::collections::HashMap; static MAX_LOOP: u32 = 5; #[derive(Debug, Clone)] enum Op { Or(Box<Op>, Box<Op>), Concat(Vec<u32>), Lit(String), } #[aoc_generator(day19)] fn parse_input(input: &str) -> (HashMap<u32, Op>, Vec<String>) { let...
use crate::engine::gameobject::GameObject; use log::info; use serde_json; /// /// It consists of 9 characters, 3 lots of 3, reading left to right, top to bottom. /// - is a blank space. X and O are represented by those letters (uppercase). pub struct Board { data: String, } impl Default for Board { fn default...
#![no_std] extern crate alloc; use alloc::vec; use alloc::vec::Vec; use core::convert::TryInto; use core::mem::{size_of, transmute, transmute_copy}; use cortex_m::prelude::*; use eeprom24x::addr_size::TwoBytes; use eeprom24x::page_size::B32; use eeprom24x::Eeprom24x; use stm32f1xx_hal_bxcan::delay::Delay; use ross_co...
use std::collections::HashMap; use hdk::prelude::holo_hash::*; use hdk::prelude::*; use crate::{ game::{build_game_state, get_game, verify_we_see_previous_move_hash}, game_move::{GameMoveEntry, MoveInfo}, signal::{self, SignalPayload}, turn_based_game::TurnBasedGame, }; /** Public handlers */ /** *...
use delay::Delay; use ic_agent::export::Principal; use ic_agent::identity::BasicIdentity; use ic_agent::{Agent, Identity}; use ic_identity_hsm::HardwareIdentity; use ic_utils::call::AsyncCall; use ic_utils::interfaces::management_canister::MemoryAllocation; use ic_utils::interfaces::ManagementCanister; use ring::signat...
// use std::convert::TryInto; // use std::collections::HashSet; use std::io::{self, BufRead}; fn solve1(v: &Vec<String>) -> i64 { let mut curr = vec![vec![vec![false; v[0].len() + 14]; v.len() + 14]; 15]; let mut prev = vec![vec![vec![false; v[0].len() + 14]; v.len() + 14]; 15]; for (i, l) in v.iter().enum...
use core::cell::Cell; use gpio; use kernel; use kernel::common::VolatileCell; use kernel::common::take_cell::TakeCell; use kernel::hil; use sysctl; #[allow(dead_code)] #[repr(C)] struct UARTRegisters { dr: VolatileCell<u32>, rsr: VolatileCell<u32>, _reserved0: [u32; 4], fr: VolatileCell<u32>, _rese...
// 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...
use std::{ io::{Error, ErrorKind, Read, Result, Seek}, path::{Path, PathBuf}, }; use d4_framefile::{Blob, Directory, OpenResult}; use reqwest::IntoUrl; use crate::{ d4file::validate_header, index::{D4IndexCollection, DataIndexRef, DataSummary, SecondaryFrameIndex}, ptab::PRIMARY_TABLE_NAME, st...
#[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; #[macro_use] extern crate lazy_static; #[macro_use] extern crate log; mod app; mod app_context; mod browser_states; mod commands; mod conf; mod errors; mod external; mod file_sizes; mod flat_tree; mod fuzzy_patterns; mod regex_patterns...
use std::str::FromStr; use clap::{Arg, App, ArgMatches}; use humanize_rs::bytes::Bytes; use args::{Args, EXCLUDES, DedupAction}; fn is_numeric(s : String) -> Result<(), String> { match Bytes::<u64>::from_str(&s) { Ok(_) => { Ok(()) }, Err(e) => { Err(format!("Failed to parse number {}: {}", s, e)...
use anyhow::Result; use aoc_next::{aoc_main, parser, solution, solver, Aoc}; use rust_advent_of_code_2021::{ day01, day02, day03, day04, day05, day06, day07, day08, day09, day10, day11, day12, day13, day14, day15, day16, day17, day18, day19, day20, day21, day22, day23, day24, day25, }; const AOC: Aoc = Aoc { ...
#[doc = r" Register block"] #[repr(C)] pub struct RegisterBlock { _reserved0: [u8; 120usize], #[doc = "0x78 - Enable constant latency mode"] pub tasks_constlat: TASKS_CONSTLAT, #[doc = "0x7c - Enable low power mode (variable latency)"] pub tasks_lowpwr: TASKS_LOWPWR, _reserved1: [u8; 136usize], ...
use std::{fs, io, sync::Arc, time::Instant}; use hdrhistogram::Histogram; use rumqttc::{ AsyncClient, Event, EventLoop, Incoming, MqttOptions, Outgoing, QoS, Transport, }; use tokio::{ task, time::{self, Duration}, }; use crate::{bench::ConnectionError, BenchConfig}; pub struct Publisher { id: String...
//! Module implementing an Open Metrics exemplars for counters and histograms. //! //! See [`CounterWithExemplar`] and [`HistogramWithExemplars`] for details. use super::counter::{self, Counter}; use super::histogram::Histogram; use owning_ref::OwningRef; use std::collections::HashMap; use std::sync::atomic::AtomicU64...
use crate::*; use squote::{quote, TokenStream}; #[derive(Debug)] pub struct Delegate { pub name: TypeName, pub guid: TypeGuid, pub method: Method, } impl Delegate { pub fn from_type_name(name: TypeName) -> Self { let method = name .def .methods() .find(|meth...
use eyre::{eyre, Result}; use reqwest::blocking::{Client, Response}; use reqwest::header::RETRY_AFTER; use reqwest::StatusCode; use serde_derive::Deserialize; use serde_json::Value; use std::panic; use std::sync::mpsc; use std::time::Duration; pub trait DriveItemHandler<DriveItem> { // remove all data and start fr...
// plic.rs // Platform Level Interrupt Controller (PLIC) // <NAME> // 1 Nov 2019 use crate::uart::Uart; use crate::virtio; const PLIC_PRIORITY: usize = 0x0c00_0000; const PLIC_PENDING: usize = 0x0c00_1000; const PLIC_INT_ENABLE: usize = 0x0c00_2000; const PLIC_THRESHOLD: usize = 0x0c20_0000; const PLIC_CLAIM: usize =...