text
stringlengths
3.09k
13.9k
//! # Note //! Internally there exists only one position is saved //! So if you read and write you should keep this in mind use crate::{Bytes, Cursor, BytesRead, BytesWrite, BytesSeek}; /// A Vec wrapper that implements BytesWrite and BytesRead #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct BytesOwned { ...
#[test] pub fn create_neural_network() { use crate::NeuralNetwork; let nn = NeuralNetwork::with_size(1, 1); assert_eq!(nn.nodes.len(), 3); assert_eq!(nn.edges.len(), 2); let nn = NeuralNetwork::with_size(4, 3); assert_eq!(nn.nodes.len(), 8); assert_eq!(nn.edges.len(), 15); } #[test] pub fn ...
/* ----------------------------------------------------------------------------------- * src/graphics/porc.rs - Graphics framework that hooks up to Porcupine. * beetle - Pull-based GUI framework. * Copyright © 2020 not_a_seagull * * This project is licensed under either the Apache 2.0 license or the MIT license, a...
use std::collections::{HashMap, HashSet}; use sha1::Sha1; use smallvec::SmallVec; use auth::{self, Event}; use state_map::{StateMap, WellKnownEmptyKeys}; /// Resolves a list of states to a single state. pub fn resolve_state( state_sets: Vec<&StateMap<String>>, event_map: &HashMap<String, Event>, ) -> StateMa...
//! Helper `struct`s for abstracting on-screen geometry. use std::fmt; /// Represents a single on-screen point/coordinate pair. #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub struct Point { pub x: i32, pub y: i32, } impl Point { /// Creates a new point on the specified non-negative coordinates pub fn n...
use crate::config::Config; use regex::Regex; use semver::Identifier; use std::process; #[derive(Clone, Debug)] pub enum Bump { Major, Minor, Patch, Pre(String), } #[derive(Debug)] pub struct Version { /// the full version string in Config.toml to replace /// ie. `version = "1.0.0"`. We need th...
//! Upstream Probes are synthetic questions designed to perform health checks //! //! They include an authenticated timestamp and an optional zone, for servers //! that don't send any response to zones they are not authoritative for. use base64; use byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt}; use coarsetim...
extern crate beancounter_grpc; extern crate futures; extern crate hyper; extern crate tokio_connect; extern crate tower; extern crate tower_hyper; extern crate tower_request_modifier; extern crate webpki; use futures::Future; use crate::config; use beancounter_grpc::tower_grpc::{BoxBody, Request}; use hyper::client::...
use std::collections::{HashMap, HashSet}; use itertools::Itertools; use log::log; use ordered_float::OrderedFloat; use crate::{ graph::{Graph, Node}, layout::{NodeId, StandardNodeId}, music::Breakdown, Query, }; /// How many nodes will be searched to determine which node patterns generate the require...
use base64; use bytes::Bytes; use cookie::Cookie; use failure::Error; use har::v1_2::*; use hyper::header::{self, HeaderMap, HeaderName, HeaderValue}; use hyper::{Body, Chunk, Version}; use std::borrow::Cow; use std::convert::From; #[derive(Debug, Fail)] pub enum ConversionError { #[fail(display = "Invalid HTTP ve...
use futures_core::{Future, Async, Poll}; use futures_core::never::Never; use futures_core::task::{self, Context}; use futures_channel::oneshot::{channel, Sender, Receiver}; use futures_util::FutureExt; use std::thread; use std::sync::Arc; use std::sync::atomic::Ordering; use std::panic::{self, AssertUnwindSafe}; use s...
/** * [352] Data Stream as Disjoint Intervals * * Given a data stream input of non-negative integers a1, a2, ..., an, summarize the numbers seen so far as a list of disjoint intervals. * Implement the SummaryRanges class: * * SummaryRanges() Initializes the object with an empty stream. * void addNum(int val) A...
use std::{fmt, time::Instant}; use crate::{ execution_unit::{EuType, ExecutionUnit}, mem::MainMemory, program::Program, regs::RegSet, }; #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum CpuState { Running, Stopped, } #[derive(Debug, Clone)] pub struct Start { time: Instant, } impl D...
// Copyright © 2008-2011 <NAME> // Copyright © 2010-2011 Intel Corporation // Copyright © 2012-2013 Collabora, Ltd. // // Permission to use, copy, modify, distribute, and sell this // software and its documentation for any purpose is hereby granted // without fee, provided that the above copyright notice appear in // ...
use clap::{App, Arg}; use flate2::read::MultiGzDecoder; use std::fs::File; use std::io::{BufReader, BufWriter}; //use std::String; //use fnv::{FnvHashMap, FnvHashSet}; use std::collections::HashSet; use vcf::*; fn get_header(infile: &str) -> vcf::VCFHeader { VCFReader::new(BufReader::new(MultiGzDecoder::new( ...
use std::time::Duration; use crate::coin_wallet::CoinWallet; use teloxide::{requests::{Request, Requester}, Bot}; use tokio::time::sleep; use tokio_binance::WithdrawalClient; use serde_json::Value; use chrono::Utc; const REFRESH_RATE: u64 = 60; // Refresh rate between requests; in seconds const MAX_API_RETRY_BEFOR...
use crate::{builder, ffi, util, Value}; use std; use std::fmt; use libc; use std::sync::Mutex; /// A Ruby virtual machine. pub struct VM; /// We only want to be able to have one `VM` at a time. static mut VM_EXISTS: bool = false; lazy_static! { static ref ACTIVE_VM: Mutex<VM> = Mutex::new(VM::new().expect("fai...
use crate::utils::types::CidrIP; /* @brief * * The interface for accessing the logical list of connections * of every VMs. Since there might be special cases where * the connections are not symmetric, i.e. vm1 -> vm2 * does not imply vm2 -> vm1, it is left as possibility * offered by this interface, and the impl...
use std::{cell::RefCell, cmp::max, collections::HashMap}; type Weight = i128; type Price = i128; #[derive(Clone)] struct Item { weight: Weight, price: Price, } #[derive(Clone)] struct Cell { price: Price, items: Vec<String>, } // TODO: Knapsack object isn't need. We need to store only current and pr...
//! Compile and cache copyright regexes. //! //! This module contains functions to parse existing copyright notes. Regexes //! are compiled once per comment sign and stored in a cache. use crate::get_hash; use crate::CError; use crate::CommentSign; use regex::Regex; use std::collections::HashMap; use std::future::Futu...
// This file is part of Sulis, a turn based RPG written in Rust. // Copyright 2018 <NAME> // // Sulis 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 opt...
use std::{fmt, ops}; use std::str::FromStr; use kurbo::Point; use crate::features::FeatureSet; use crate::canvas::Canvas; /// The maximum zoom level we support. /// /// This **must** be less than 32 or stuff will break. const MAX_ZOOM: u8 = 20; /// The mapping of zoom levels to details. const DETAILS: &[u8] = &[ ...
use crate::impl_helper::*; use crate::impl_local_shared_both; use crate::prelude::*; /// An Observable that combines from two other two Observables. /// /// This struct is created by the with_latest_from method on /// [Observable](Observable::with_latest_from). See its documentation for more. #[derive(Clone)] pub stru...
extern crate console; extern crate rand; #[macro_use] extern crate structopt; extern crate strum; #[macro_use] extern crate strum_macros; #[macro_use] extern crate failure; mod duration; mod homoglyph; mod percent; use duration::*; use homoglyph::*; use percent::*; use rand::Rng; use std::collections::{HashMap, HashS...
use crate::common::span::Span; use crate::error::{renderer::Renderer, Diagnostic, Label, LabelStyle}; use std::io; pub struct RichDiagnostic<'diagnostic> { diagnostic: &'diagnostic Diagnostic, } impl<'diagnostic> RichDiagnostic<'diagnostic> { pub fn new(diagnostic: &'diagnostic Diagnostic) -> RichDiagnostic<'...
use std::fmt; use std::fs::File; use std::io::{self, Write}; use std::path::{Path, PathBuf}; use failure::{Fail, ResultExt}; use futures::{Future, IntoFuture, Stream}; use serde::Deserialize; use tempfile::NamedTempFile; use crate::types::{DirectoryLayout, FileType, ObjectId, SourceFilters}; use crate::utils::futures...
use std::cmp::Ordering; use std::collections::{BinaryHeap, HashMap}; use crate::tile_type::TileType; use crate::tool::Tool; #[derive(Copy, Clone, Eq, PartialEq)] pub struct Location { position: (usize, usize), estimated_cost: usize, tile_type: TileType, tool: Tool, minutes: usize, } impl Location...
/* ----------------------------------------------------------------------------------- * src/graphics/flutter.rs - Flutterbug graphics object. * beetle - Pull-based GUI framework. * Copyright © 2020 not_a_seagull * * This project is licensed under either the Apache 2.0 license or the MIT license, at * your option...
//! Command line interfaces to various subnet recovery processes. //! Calls the recovery library. use crate::app_subnet_recovery::{AppSubnetRecovery, AppSubnetRecoveryArgs, StepType}; use crate::error::RecoveryError; use crate::{NeuronArgs, Recovery, RecoveryArgs}; use ic_types::ReplicaVersion; use slog::{info, warn, L...
use crate::TaskType; use atomicwrites::{AllowOverwrite, AtomicFile}; use log::{error, info, trace, warn}; use serde::{Deserialize, Serialize}; use std::net::SocketAddr; use std::time::Duration; use tokio::time::sleep; use std::hash::{Hash, Hasher}; use std::path::PathBuf; use std::process; use std::{collections::hash_...
use math::sqrtf; use utils::Point3; use motor::Motor; use hardware::peripherals::time::Time; pub trait MotionPlanner { fn set_target(&mut self, target: Point3); fn update(&mut self); } pub struct CartesianMotionPlanner<'a> { x_motor: &'a mut Motor, y_motor: &'a mut Motor, z_motor: &'a mut Motor, ...
use std::io::{self, SeekFrom}; use std::ops::Bound; use std::path::{Path, PathBuf}; use anyhow::{bail, ensure, Result}; use async_trait::async_trait; use betterstreams::ChunkedStreamInfo; use bytes::Bytes; use futures::prelude::*; use sysinfo::{DiskExt, System, SystemExt}; use tokio::fs::{self, OpenOptions}; use tokio...
/* * Copyright 2021 <NAME><<EMAIL>>, <NAME> * * The 3-Clause BSD License * * 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 co...
//! SPI example to communicate with the System Basis Chip on the FRDM-KEAxXXX //! dev boards. //! //! Some things to know about the setup on the devboard: //! - The SBC is connected to SPI1 default pins PTD0:PTD3 //! - SBC IO-O is connected to SW4 which has a 12k pullup to Vsup and debounce //! - SBC MuxOut is conne...
#![allow(clippy::field_reassign_with_default)] use std::env; use std::error::Error; use std::fs::File; use std::io::Write; use std::process::Command; use std::str::from_utf8; use std::sync::Arc; use dropshot::{endpoint, ApiDescription, ConfigDropshot, ConfigLogging, ConfigLoggingLevel, HttpError, HttpResponseAccepted...
//! Contains functions for tuning and controlling "The GNU Allocator", included in the `glibc` //! library. //! //! https://www.gnu.org/software/libc/manual/html_node/The-GNU-Allocator.html //! //! These functions are generally only suitable for Linux systems. use lazy_static::lazy_static; use lighthouse_metrics::*; us...
// 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::{ error::ModelError, exposed_dir::ExposedDir, hooks::{ComponentDescriptor, Event, EventPayload, RuntimeInfo...
use std::cell::RefCell; use std::fmt; use log::trace; use rustc_span::DUMMY_SP; use crate::*; /// Details of premature program termination. pub enum TerminationInfo { Exit(i64), Abort(Option<String>), UnsupportedInIsolation(String), ExperimentalUb { msg: String, url: String }, Deadlock, } impl ...
//! Module that defines the bindings for the desktop shell protocol //! See https://github.com/swaywm/sway/blob/master/protocols/desktop-shell.xml //! for more information about the spec use self::generated::server::desktop_shell::DesktopShell; use rustwlc::wayland::{get_display}; use rustwlc::handle::{wlc_handle_from...
/// Registers (bit vectors) use std::fmt; use std::mem::size_of; use vid::VID; #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Reg { nbits: usize, data: Vec<usize> } const USIZE:usize = size_of::<usize>() * 8; impl Reg { /// create a new register with the given number of bits pub fn new( n...
use anyhow::Error; use chrono::{Duration, Utc}; use clap::{AppSettings, Clap}; use fehler::throws; use octocrab::models::Repository; use tokio::sync::mpsc::{self, Receiver, Sender}; mod google_sheets; mod token; mod util; use google_sheets::Sheets; #[derive(Clap, Debug)] #[clap(setting = AppSettings::ColoredHelp)] #...
//! Contains implementation of a Handle Payment contract functionality. mod constants; mod entry_points; mod error; mod mint_provider; mod runtime_provider; use core::marker::Sized; use crate::{account::AccountHash, AccessRights, URef, U512}; pub use crate::system::handle_payment::{ constants::*, entry_points::h...
mod basic; mod control_flow; use lazy_static::lazy_static; use rustc_codegen_spirv::rspirv; use std::error::Error; use std::path::{Path, PathBuf}; use std::sync::{Mutex, MutexGuard}; // https://github.com/colin-kiegel/rust-pretty-assertions/issues/24 #[derive(PartialEq, Eq)] pub struct PrettyString<'a>(pub &'a str); ...
use gtk::prelude::{BoxExt, ButtonExt, GridExt, GtkWindowExt, OrientableExt, WidgetExt}; use relm4::{ gtk, send, AppUpdate, ComponentUpdate, Model, RelmApp, RelmComponent, Sender, WidgetPlus, Widgets, }; #[tracker::track] struct AppModel { counter: u8, classes: Vec<&'static str>, decrement: bool, } ...
use crate::Error; use serde::{Deserialize, Serialize}; /// Specification of the linear memory of a module #[derive(Debug, Clone, Serialize, Deserialize)] pub struct LinearMemorySpec<'a> { /// Specification of the heap used to implement the linear memory pub heap: HeapSpec, /// Initialization values for lin...
use near_sdk::{ borsh::{self, BorshDeserialize, BorshSerialize}, serde::{Deserialize, Serialize}, }; #[allow(unused_imports)] use near_sdk::{env, near_bindgen}; near_sdk::setup_alloc!(); mod model; use model::{ Example0, Example1, Example2User, log, }; /// Imprime a função sendo chamada. pu...
#![allow(missing_docs)] use core::{ cmp::{Ordering, PartialEq, PartialOrd}, ops::{Add, Div, Mul, Neg, Rem, Sub}, }; use num_traits::float::FloatCore; macro_rules! impl_binop { ($for:ident, $is:ident, $op:ident, $func_name:ident) => { impl<T: Into<$for>> $op<T> for $for { type Output = ...
#[macro_use] extern crate quote; extern crate syn; use std::{env, fmt}; use std::io::Write; use std::fs::File; use std::path::{Path, PathBuf}; struct Q { bits: u8, fbits: u8, } impl Q { fn ibits(&self) -> u8 { self.bits - self.fbits } } impl fmt::Display for Q { fn fmt(&self, f: &mut fmt...
// Copyright 2021 <NAME>. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
use crate::util::{parse, print_js}; use anyhow::{bail, Context, Result}; use std::{ io::Write, path::PathBuf, process::{Command, Stdio}, sync::Arc, }; use structopt::StructOpt; use swc_common::{util::take::Take, FileName, Mark, SourceMap}; use swc_ecma_ast::*; use swc_ecma_diff::Diff; use swc_ecma_minif...
use sabi_serialize::{deserialize, Deserialize, Serialize}; use crate::{ implement_node, implement_pin, LogicContext, LogicData, Node, NodeExecutionType, NodeState, NodeTrait, NodeTree, PinId, }; use sabi_serialize::typetag; #[derive(Serialize, Deserialize, Copy, Clone)] #[serde(crate = "sabi_serialize")] pub ...
//! A simple filterer in the style of the watchexec v1 filter. use std::ffi::OsString; use std::path::{Path, PathBuf, MAIN_SEPARATOR}; use ignore::gitignore::{Gitignore, GitignoreBuilder}; use tracing::{debug, trace, trace_span}; use crate::error::RuntimeError; use crate::event::{Event, FileType}; use crate::filter:...
//! Follows the design of `cw-plus/packages/controllers/src/admin.rs` use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use thiserror::Error; use cosmwasm_std::{ Addr, Deps, DepsMut, Event, MessageInfo, Response, StdError, StdResult, Storage, }; use cw_storage_plus::Item; #[derive(Error, Debug, Parti...
//! Data structures and methods which apply to or operate on a crystalline cell use crate::{DelaunayReduceError, NiggliReduceError, StandardizeError}; use spglib_sys as ffi; use std::os::raw::c_int; /// Standardization operations which can be applied to a cell #[derive(Clone, Debug)] pub enum StandardizeOps { ///...
use axum::{ extract::rejection::JsonRejection, http::{header::HeaderName, HeaderMap, HeaderValue, StatusCode}, response::{IntoResponse, Response}, Json, }; use entity::orm::DbErr; use serde::Serialize; #[derive(Debug, Serialize, Default)] pub struct APIResponse<T: Serialize> { #[serde(rename(serial...
use crate::bus::WebsocketConnectionBus; use crate::{ bind, bus::WebsocketListenerBus, message::listener::WebsocketConnectionMessage, resource::{ connection::WebsocketResource, listener::{WebsocketAuthToken, WebsocketListenerResource}, }, }; use log::{debug, error}; use lifeline::pre...
use crate::{BlockNumber, Capacity, Cycle, Timestamp, TransactionView, Uint64}; use ckb_types::core::tx_pool::{TxEntryInfo, TxPoolEntryInfo, TxPoolIds as CoreTxPoolIds}; use ckb_types::prelude::Unpack; use ckb_types::H256; use serde::{Deserialize, Serialize}; use std::collections::HashMap; /// Transaction pool informat...
#![recursion_limit = "512"] use std::convert::TryInto; use stdweb::traits::IEvent; use stdweb::web::Date; use yew::services::ConsoleService; use yew::{html, Component, ComponentLink, Html, Renderable, ShouldRender}; use egg::{EClass, Id, Pattern, RecExpr, SearchMatches, Searcher}; #[path = "../../tests/math.rs"] #[...
/*! WOW! The complete NASA/NAIF Spice toolkit is actually usable on Rust. ## Requirements 1) Install [CSPICE library][cspice install link] for your platform. 2) In your folder `/path/to/cspice/lib`, rename the static libraries to match standards: 1) `cspice.a` -> `libcspice.a` 2) `csupport.a` -> `libcsupport....
use std::{iter::once, ops::Add}; use geo::{coords_iter::CoordsIter, winding_order::Winding, LineString, Point}; use itertools::Itertools; use crate::{Rasterize, Rasterizer}; fn y_coordinates<'a>( first: &'a LineString<f64>, rest: &'a [LineString<f64>], ) -> impl Iterator<Item = isize> + 'a { once(first)....
//! `anchor_client` provides an RPC client to send transactions and fetch //! deserialized accounts from Solana programs written in `anchor_lang`. use anchor_lang::solana_program::instruction::{AccountMeta, Instruction}; use anchor_lang::solana_program::program_error::ProgramError; use anchor_lang::solana_program::pub...
use crate::*; use db::DatabaseCidr; use dialoguer::{theme::ColorfulTheme, Input}; use indoc::printdoc; use publicip::Preference; use rusqlite::{params, Connection}; use shared::{prompts, CidrContents, Endpoint, PeerContents, PERSISTENT_KEEPALIVE_INTERVAL_SECS}; use wgctrl::KeyPair; fn create_database<P: AsRef<Path>>( ...
use crate::devices::adb::Adb; use crate::devices::host::Host; use crate::devices::imd::IMobileDevice; use crate::{Arch, Platform}; use anyhow::Result; use std::path::Path; use std::process::{Child, Command}; mod adb; mod host; mod imd; #[derive(Clone, Debug)] enum Backend { Adb(Adb), Imd(IMobileDevice), H...
// Sequentializer re-orders the equations in the nodes' body // // This is done in four steps: // // 1. Generating the direct dependencies for each equation (find_dep_XXX) // This is done by adding all the Ident in the left side of each equations to the dependencies // We represent the graph using a HashMap<Strin...
// Copyright 2020 <NAME> // 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, //including without limitation the rights to use, copy, modify, merge, publish, distribute, //...
use std::collections::HashMap; fn main() { let mut prog = std::fs::read_to_string("input.txt") .unwrap() .trim() .split(',') .map(|x| x.parse::<i64>().unwrap()) .collect::<Vec<i64>>(); prog[0] = 2; let mut computer = Computer::new(&prog); //A, B, B, A, C, B, C, ...
// Copyright lowRISC contributors. // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 use anyhow::{Context, Result}; use safe_ftdi as ftdi; use std::cell::RefCell; use std::rc::Rc; use crate::io::spi::{ AssertChipSelect, ClockPolarity, SpiError, Targ...
use std::{ collections::HashMap, net::{SocketAddr, ToSocketAddrs}, sync::Arc, }; use crate::broker::{Alive, Broker, Initializing}; use kafka_connector_protocol::{ api::metadata::{MetadataRequest, MetadataRequestTopics0}, custom_types::tag_buffer::TagBuffer, }; use log::trace; use tokio::sync::mpsc:...
//! Implementation of a cursor allowing word-based traversal. use crate::prelude::*; use crate::buffer::data::unit::*; use crate::buffer::data::rope; // ================== // === WordCursor === // ================== /// Cursor allowing word-based traversal. pub struct WordCursor<'a> { cursor:rope::Cursor<'a,ro...
use alloc::{ string::String, }; use contract::{ contract_api::{runtime}, unwrap_or_revert::UnwrapOrRevert, }; use types::{ account::AccountHash, bytesrepr::{Bytes, ToBytes}, CLTyped, U256, CLValue }; use super::mappings::*; pub fn _base_uri() -> String { String::from("") } pub fn _ap...
use crate::build_support::{android, cargo, features, ios}; use std::{ fs, io, path::{Path, PathBuf}, }; /// The libraries to link with. pub mod lib { pub const SKIA: &str = "skia"; pub const SKIA_BINDINGS: &str = "skia-bindings"; pub const SK_SHAPER: &str = "skshaper"; pub const SK_PARAGRAPH: &...
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use compiled_stdlib::shim::tmp_new_transaction_scripts; use diem_crypto::HashValue; use diem_json_rpc_types::views::{ BytesView, MoveAbortExplanationView, ScriptView, TransactionDataView, VMStatusView, }; use diem_types::{ trans...
use crate::lang::table::ColumnType; use crate::lang::value::Value; use crate::lang::table::Row; use std::sync::{Mutex, Arc}; use crate::lang::command::CrushCommand; use lazy_static::lazy_static; use std::collections::{HashMap, HashSet}; use std::hash::{Hash, Hasher}; use std::cmp::Ordering; use crate::util::replace::R...
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. use crate::{new_event_feed, TestSuite}; use futures::executor::block_on; use futures::sink::SinkExt; use grpcio::WriteFlags; #[cfg(feature = "prost-codec")] use kvproto::cdcpb::event::{Event as Event_oneof_event, LogType as EventLogType}; #[cfg(not(feat...
use rand::seq::SliceRandom; use rand::thread_rng; use rand::Rng; use std::sync::atomic::Ordering; use std::time; use crate::get_worker_id; use crate::goose::{GooseTaskFunction, GooseTaskSet, GooseUser, GooseUserCommand}; use crate::metrics::{GooseMetric, GooseRawTask}; pub async fn user_main( thread_number: usize...
use std::collections::HashMap; const MEM_WIDTH: usize = 36; enum MaskValue { Zero, One, X, } impl From<char> for MaskValue { fn from(c: char) -> Self { match c { '0' => MaskValue::Zero, '1' => MaskValue::One, 'X' => MaskValue::X, c => panic!("Ill...
use rand::{thread_rng, Rng}; use std::io::{Read, Write, Cursor}; use std::iter::Filter; use std::collections::HashMap; use std::collections::hash_map::Entry::*; use std::time::Duration; use area::*; use space::*; use space::Direction::*; use action::*; use entity::*; use notification::*; use appearance::*; pub fn exe...
//! Information about radixes. use crate::{ arch::word::Word, fast_divide::{FastDivideNormalized, FastDivideSmall}, primitive::WORD_BITS, }; use static_assertions::const_assert; /// Digit and radix type. pub(crate) type Digit = u32; /// Maximum supported radix. pub(crate) const MAX_RADIX: Digit = 36; //...
pub(crate) mod drop; mod list; pub(crate) mod polars_extension; use crate::{prelude::*, PROCESS_ID}; use arrow::array::{Array, FixedSizeBinaryArray}; use arrow::bitmap::MutableBitmap; use arrow::buffer::Buffer; use polars_extension::PolarsExtension; use std::mem; /// Invariants /// `ptr` must point to start a `T` all...
use common; // use common::AocResultType; use common::AocResult; use std::str::FromStr; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; //use std::cmp::Ordering; //use std::cmp; //use std::fmt; use std::collections::HashMap; #[derive(Debug, Clone)] struct Character { hit_points: isize, d...
use crate::api::{get_sample_rate, FrameTime}; use serde::{Deserialize, Serialize}; #[cfg(test)] mod tests { use super::*; use crate::api::FrameTime; #[test] fn test_frametime() { let zero = FrameTime(0); assert_eq!(0.0, zero.to_ms()); assert_eq!(zero, FrameTime::from_ms(0f64));...
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. use std::sync::{ atomic::{AtomicBool, Ordering}, Arc, }; use raft::eraftpb::MessageType; use test_raftstore::*; // Test if a singleton can apply a log before persisting it. #[test] fn test_singleton_cannot_early_apply() { let mut cluster ...
use { std::{ rc::Rc, collections::HashMap, cell::RefCell, }, }; // Shorthand for each link in the Doubly Linked List: // - Reference Counter allows for multiple references to the same data // Stored in the HashMap // Or optionally in previous and next links // - RefCell allows...
//reminder: need to include documentation when adding new features /// # Retrieve the absolute path for the specified file relative to the current directory. /// /// return the absolute path for the specified file if the file exists otherwise it will be `None`. /// /// Exception/panic are not allowed and are not throw...
use std; use std::any::TypeId; use std::hash::Hash; use builders::statement::{ConditionDesc, StatementConditions}; use network::tests::AlphaTest; use ::builder::StatementCondition; use runtime::memory::{SymbolId, StringCache}; use std::collections::{HashMap, HashSet}; use std::fmt::Debug; use std::fmt; use ordered_floa...
use super::{Solver, SolverError, SolverResult}; use std::convert::TryFrom; use std::fmt::{self, Write}; use std::iter::Iterator; use std::str::FromStr; #[derive(Debug, Clone, Copy)] enum TokenKind { Opening, Closing, } #[derive(Debug, Clone, Copy, Eq, PartialEq)] enum Token { /// An opening ( Openin...
use chrono; use clap::Parser; use io::Write; use json; use std::io; use log; mod utils; mod dateutils; /// Simple program to greet a person #[derive(Parser)] struct Cli { /// The pattern to look for, this is the only argument, something like "history" or "last" pattern: String, } // returns true if the last ...
use std::collections; use std::str; pub fn part1(input: &str) -> Result<u64, String> { let lines = parse(input); let intersections = lines[0].plot_intersections(&lines[1]); if intersections.is_empty() { Err("No intersections found!".to_string()) } else { let mut min_distance = u64::MAX...
extern crate png; extern crate rayon; use png::HasParameters; use rayon::prelude::*; use std::cmp::{max, min}; use std::fs::File; use std::io::BufWriter; type Range = std::ops::Range<i32>; pub struct Pixels { width: usize, height: usize, data: Vec<f32>, } impl Pixels { fn new_with_data(width: usize, ...
//! A platform agnostic driver to interface the [ST][ST] LPS22 //! pressure sensor, written in Rust. Although the driver is verified //! using a [`LPS22HH`][LPS22HH] sensor, it should be in theory //! compatible to other `LPS22` sensors like the [`LPS22HB`][LPS22HB] //! and if no, it should be easy to make it so. //! /...
use std::{cell::RefCell, collections::HashMap, env, rc::Rc}; use crate::{ core::*, rep, types::{func::MalFuncPtr, MalFunc, MalList, MalString, MalSymbol, MalType}, MalError, MalResult, }; #[derive(Debug)] pub struct Env { env: RefCell<HashMap<MalSymbol, Rc<dyn MalType>>>, outer: Option<Rc<Env>...
// //! Copyright 2020 Alibaba Group Holding Limited. //! //! 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 appl...
use std::collections::HashMap; use serde::{Deserialize, Serialize}; use crate::core::{ battle::{ component::ObjType, state::{self, State}, PlayerId, TileType, }, map::{self, PosHex}, utils::roll_dice, }; #[derive(Debug, Clone, Serialize, Deserialize)] pub enum BattleType { ...
//! [egui](https://github.com/emilk/egui) editor support for NIH plug. //! //! TODO: Proper usage example, for now check out the gain_gui example use baseview::gl::GlConfig; use baseview::{Size, WindowHandle, WindowOpenOptions, WindowScalePolicy}; use crossbeam::atomic::AtomicCell; use egui::Context; use egui_baseview...
use raytracer::*; use rand::distributions::{Distribution, Uniform}; use rand::rngs::StdRng; use rand::{Rng, SeedableRng}; use indicatif::ProgressBar; use indicatif::ProgressStyle; use rayon::prelude::*; use std::convert::TryInto; use std::fs::OpenOptions; use std::io::{BufWriter, Write}; use std::sync::Arc; fn main...
use super::{generate_seed, Ecdsa}; use crate::{ didcore::{Config, KeyFormat, JWK}, traits::{DIDCore, Ecdh, Fingerprint, KeyMaterial}, AsymmetricKey, Document, Error, KeyPair, Payload, VerificationMethod, }; use p256::{ ecdsa::{signature::Signer, signature::Verifier, Signature, SigningKey, VerifyKey}, ...
pub const MONOBYTE: &[(u8, [&'static str;2])] = &[ (0x06, ["push es","pushw es"]), (0x07, ["pop es","popw es"]), (0x0e, ["push cs","pushw cs"]), (0x16, ["push ss","pushw ss"]), (0x17, ["pop ss","popw ss"]), (0x1e, ["push ds","pushw ds"]), (0x1f, ["pop ds","popw ds"]), (0x27, ["daa";2]), (0x2f, ["das";2]), (0...
use std::borrow::BorrowMut; use std::collections::{HashMap, HashSet}; use std::ops::Index; use daggy::{Dag, EdgeIndex, NodeIndex, Walker}; use crate::core::runtime::JobId; use crate::dag::execution_graph::{ExecutionEdge, ExecutionGraph, ExecutionNode}; use crate::dag::{TaskId, TaskInstance, WorkerManagerInstance}; #...
pub mod generation; mod pathfinding; use constants::*; use entities; use ggez::graphics::Color; use helpers::{Coords, Rect}; use rand::{ distributions::{Distribution, Weighted, WeightedChoice}, thread_rng, }; use std::ops::{Deref, DerefMut}; pub struct Map { tiles: Vec<Tile>, width: i32, pub items: Ve...
#![allow(dead_code)] use crate::uart::uart_write; use crate::common::bit; use crate::common::print_hex; use crate::{msr, mrs}; pub fn get_phys_addr_range() -> u64 { let mmfr0: u64; mrs!(mmfr0, "ID_AA64MMFR0_EL1"); // ID_AA64MMFR0_EL1[3:0] is PARange mmfr0 & 0xf } fn alloc_stage2_entry() -> () { ...