text
stringlengths
3.09k
13.9k
use crypto_market_type::MarketType; use super::super::utils::http_get; use crate::{MessageType, Order, OrderBookMsg, TradeMsg, TradeSide}; use lazy_static::lazy_static; use serde::{Deserialize, Serialize}; use serde_json::{Result, Value}; use std::collections::HashMap; const EXCHANGE_NAME: &str = "zbg"; lazy_static...
//! Lightweight read-only runtime reflection. //! //! See [`Inspect`] for more info. #![warn(missing_docs)] use std::{ any::{Any, TypeId}, fmt::{self, Debug}, }; /// A value of a property. pub trait PropertyValue: Any + Debug { /// Casts `self` to a `&dyn Any` fn as_any(&self) -> &dyn Any; } impl<T:...
use ic_cdk_macros::{query, update}; use std::io::{Read, Write}; #[cfg(target_arch = "wasm32")] use std::convert::TryInto; // type FileSystem = fatfs::FileSystem< // fatfs::StdIoWrapper<fscommon::BufStream<icfs::StableMemory>>, // icfs_fatfs::TimeProvider, // fatfs::LossyOemCpConverter, // >; type FileSyst...
use crate::text::Tokens; use std::collections::HashMap; #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct InputContext { pub country: Option<String>, pub region: Option<String>, pub languages: Option<Vec<String>>, } #[derive(Debug, PartialEq, Clone)] pub struct Context { pub country: Stri...
use advent_of_code::*; use std::collections::VecDeque; fn main() { let hex = read_input_as_string("2021/day16/src/input.txt") .trim() .to_string(); let answer1 = sum_packet_versions(&consume_packet(&mut to_bits(&hex))); let answer2 = evaluate_packet(&consume_packet(&mut to_bits(&hex))); ...
use crate::{ tool_behaviors::ToolBehavior, tools::{pan::Pan, Tool, ToolEnum}, }; use glifparser::{ glif::{HistoryEntry, Layer, MFEKPointData}, Guideline, MFEKGlif, }; pub use skulpin::skia_safe::Contains as _; pub use skulpin::skia_safe::{Canvas, Matrix, Path as SkPath, Point as SkPoint, Rect as SkRect...
pub fn test_array_refs(arg: &Vec<Vec<String>>) -> &Vec<Vec<Vec<Vec<String>>>> { unimplemented!() } #[cfg(target_arch = "wasm32")] #[export_name = "test_array_refs"] #[no_mangle] #[doc(hidden)] #[allow(clippy::all)] pub unsafe fn __m_generated_wrapper_func_test_array_refs(arg_0: u32, arg_1: u32) { unsafe fn __m_...
use crate::parser::constants::attribute; #[derive(Debug, PartialEq)] pub enum ElementType { All, Annotation, Any, AnyAttribute, AppInfo, Attribute, AttributeGroup, Choice, ComplexContent, ComplexType, Documentation, Element, Extension(ExtensionType), Field, G...
use std::{fmt::Display, fs, path::Path, sync::Mutex}; use futures::channel::oneshot; use once_cell::sync::{Lazy, OnceCell}; use serde::{Deserialize, Serialize}; use tonic::Status; use crate::{ bdev::VerboseError, core::{runtime, Cores, Mthread, Reactor, Share}, grpc::rpc_submit, lvs::{Error as LvsErro...
use std::net::SocketAddr; use std::sync::{atomic::AtomicUsize, Arc}; use hashbrown::HashMap; use parking_lot::Mutex; use serde::{Deserialize, Serialize}; use aquatic_udp_protocol::*; #[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)] pub struct ThreadId(pub u8); #[derive(Clone, Debug, Serialize, Deserialize)] #[ser...
use crate::cli::TemplateCommand; use crate::utils::{defaults, SWAY_GIT_TAG}; use anyhow::{anyhow, Context, Result}; use forc_pkg::{ fetch_git, fetch_id, find_dir_within, git_commit_path, pin_git, Manifest, SourceGit, }; use forc_util::validate_name; use fs_extra::dir::{copy, CopyOptions}; use std::fs::File; use std...
use crate::{message::*, util::*, NodeId, NodeRecord}; use array_init::array_init; use arrayvec::ArrayVec; use primitive_types::H256; use std::{ collections::{BTreeMap, VecDeque}, convert::TryFrom, }; use tracing::*; pub const BUCKET_SIZE: usize = 16; pub const REPLACEMENTS_SIZE: usize = 16; const ADDRESS_BYTE...
use crate::error::NdkError; use std::fs::File; use std::io::Write; use std::path::Path; #[derive(Debug)] pub struct Manifest { pub package_name: String, pub package_label: String, pub version_name: String, pub version_code: u32, pub target_name: String, pub target_sdk_version: u32, pub min_...
use crate::cargo::TestBinary; use crate::config::*; use crate::errors::*; use crate::event_log::*; use crate::path_utils::*; use crate::process_handling::*; use crate::report::report_coverage; use crate::source_analysis::{LineAnalysis, SourceAnalysis}; use crate::test_loader::*; use crate::traces::*; use std::fs::creat...
// RGB standard library // Written in 2020 by // Dr. <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 ha...
// Copyright 2014 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
use crate::flow::Flow; use core::mem; use std::cmp::{max, min}; struct Edge<F> { dst: usize, rev: usize, flow: F, upper: F, } #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Debug, Hash)] pub struct EdgeId(usize, usize); struct TemporaryData { n: usize, s: usize, t: usize, label...
/*! This tool carries out a package or variant build using Docker. It is meant to be called by a Cargo build script. To keep those scripts simple, all of the configuration is taken from the environment, with the build type specified as a command line argument. The implementation is closely tied to the top-level Docke...
//! Example JWT authorization/authentication. //! //! Run with //! //! ```not_rust //! JWT_SECRET=secret cargo run -p example-jwt //! ``` use axum::{ async_trait, body::{Bytes, Full}, extract::{FromRequest, RequestParts, TypedHeader}, handler::{get, post}, http::{Response, StatusCode}, response...
use crate::{ math::Rect, os::window::{ WindowBuilder, WindowStyle }, EngineBuilder, Module, Register, }; use std::{ sync::Mutex, sync::atomic::{ AtomicBool, Ordering }, collections::HashMap, any::{ TypeId, Any }, time::Instant, process, }; pub use crate::os::window::{ ...
use anyhow::{Context, Result}; use argh::FromArgs; use oxdi::apis::entries::{Field, Param}; //use tracing::{info, Level}; //use tracing_subscriber::{EnvFilter, FmtSubscriber}; #[derive(Debug, FromArgs)] /// Search in Oxford Dictionary from CLI! struct Args { #[argh(option, short = 'w', from_str_fn(parse_word))] ...
use crate::gui::make_dropdown_list_option; use crate::sidebar::make_section; use crate::{ send_sync_message, sidebar::{make_f32_input_field, make_text_mark, COLUMN_WIDTH, ROW_HEIGHT}, }; use rg3d::gui::message::UiMessage; use rg3d::gui::numeric::NumericUpDownMessage; use rg3d::gui::{BuildContext, UiNode, UserIn...
// Copyright (c) 2017-2020 <NAME> //! Representation of the input and output arguments of functions, processes, //! and entitites. use crate::{ ir::{Arg, Unit}, table::PrimaryTable, ty::Type, }; /// A description of the input and output arguments of a unit. #[derive(Default, Clone, Serialize, Deserialize...
use crate::archive::{self, FileContents}; use super::Scheme; use anyhow::Context; use bytes::{Bytes, BytesMut}; use encoding_rs::SHIFT_JIS; use positioned_io::{RandomAccessFile, ReadAt}; use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; use scroll::{ctx, Pread, BE, LE}; use std::{ fs::File, io::Wri...
use regex::Regex; use std::process::Command; use std::path::PathBuf; use slog::{trace}; use std::fs; use failure::Error; use regex::NoExpand; use serde::{Serialize, Deserialize}; /// Contains config of the linter #[derive(Serialize, Deserialize, Debug, Clone)] pub struct LinterConfig { pub name: String, pub cm...
extern crate find_folder; extern crate piston_window; extern crate rand; use piston_window::*; mod food; mod menu; mod snake; mod text; use food::{Food, FOOD_HEIGHT, FOOD_WIDTH}; use menu::{Menu, MenuOption}; use rand::{thread_rng, Rng}; use snake::{Snake, SnakeDirection, GAME_HEIGHT, GAME_WIDTH}; use std::process::exi...
use std::fs; use std::collections::HashMap; // fn step(cups: &Vec<u32>, current_cup: u32) -> (Vec<u32>,u32) { // let cc_index = cups.into_iter().position(|c| *c==current_cup).unwrap(); // let first_cup = cups[(cc_index + 1) % cups.len()]; // let second_cup = cups[(cc_index + 2) % cups.len()]; // let th...
use async_trait::async_trait; use db::DbInstance; use crate::traits::{Embedable, CreateEmbed, RawEventHandlerRef}; use std::sync::atomic::{Ordering, AtomicBool}; use std::fmt::{self, Write}; use std::sync::Arc; use std::time::Duration as StdDuration; use chrono::{Duration, Utc}; use serenity::client::Context; use seren...
//! Parsing logic use quote::{quote, ToTokens}; use syn::parse::{Parse, ParseStream}; use syn::punctuated::Punctuated; use syn::{ parenthesized, parse_quote, token, Attribute, Expr, ExprLet, Field, Generics, Ident, Pat, Result, Token, Visibility, }; #[derive(Clone)] pub struct Program { pub relations: Vec...
// This file is part of Substrate. // Copyright (C) 2020-2021 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // ht...
use crate::services::submission::support::{ ProblemSupport, SubmissionGenerationPayload, SubmissionGenerationResult, SubmissionTestGenerationPayload, SubmissionTestGenerationResult, VerificationPayload, VerificationResult, }; use rand::prelude::*; use rand::{rngs::StdRng, RngCore, SeedableRng}; use rand_dis...
// 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::types::{decode_opcode, StatusCode}, anyhow::Error, fidl_fuchsia_hardware_bluetooth::HciProxy, fuchsia_async as fasync, fuc...
// Copyright 2019 Google LLC // // 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/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
#[macro_use] extern crate clap; #[macro_use] extern crate log; mod art; mod audio; mod clock; mod network; mod render; mod ssh; mod usb; mod weather; use audio::*; use clock::*; use render::*; use ssh::*; use weather::*; use std::env; use std::io::Write; use std::net::{IpAddr, Ipv4Addr}; use chrono::prelude::*; us...
// Data Format // // Data is streamed asynchronously to the client and framed in order to support the various reply bodies, ie: // // [x][x][x][x][x][x][x][x][x][x][x][x]... // | (int32) || (int32) || (binary) // | 4-byte || 4-byte || N-byte // ------------------------------------... // size frame type ...
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT use crate::cli::Args; use anyhow::Error; use futures::TryFutureExt; use hyper::header::CONTENT_LENGTH; use hyper::http::uri::Authority; use hyper::service::{make_service_fn, serv...
use candid::{Int, Nat}; use num_traits::cast::ToPrimitive; #[test] fn test_numbers() { check("0", "00", "00"); check("127", "ff00", "7f"); check("-1", "7f", ""); check("-123456", "c0bb78", ""); check("624485", "e58e26", "e58e26"); check("2000000", "8089fa00", "80897a"); check( "6000...
extern crate glob; #[macro_use] extern crate lazy_static; extern crate sysfs_gpio; use std::fs::File; use std::io::BufReader; use std::io::prelude::*; use glob::glob; use sysfs_gpio::Pin; /// CHIP GPIO pins by name #[allow(non_camel_case_types)] #[derive(Eq,PartialEq,Debug,Copy,Clone)] pub enum ChipPin { PWM0, ...
use spa::GBA; pub fn debug_mode(gba: &mut GBA) { println!("Debug mode."); println!("Enter 'h' for help."); let mut breaks = std::collections::BTreeSet::new(); let mut stack_trace = Vec::new(); loop { let mut input = String::new(); match std::io::stdin().read_line(&mut input) { ...
use std::rc::Rc; use std::collections::LinkedList; use polodb_bson::{Document, Value}; use crate::page_handler::PageHandler; use crate::page::RawPage; use crate::btree::*; use crate::DbResult; use crate::data_ticket::DataTicket; #[derive(Clone)] struct CursorItem { node: Rc<BTreeNode>, index: us...
#![deny(missing_docs)] //! SVD objects. //! This module defines components of an SVD along with parse and encode implementations /// Endian objects pub mod endian; pub use self::endian::Endian; /// Cpu objects pub mod cpu; pub use self::cpu::{Cpu, CpuBuilder}; /// Interrupt objects pub mod interrupt; pub use self::i...
use std::process::{Command, Child, Stdio}; use std::net::{SocketAddrV4, Ipv4Addr, TcpListener}; use std::thread; use std::time::Duration; use std::fmt; use std::fs; use tempdir::TempDir; fn which(command: &str) -> Result<String, ()> { let mut cmd = if cfg!(target_os = "windows") { Command::new("where") ...
extern crate pty; extern crate nix; extern crate libc; extern crate structopt; #[macro_use] extern crate simple_error; use structopt::StructOpt; use std::os::unix::io::AsRawFd; use std::os::unix::io::RawFd; use simple_error::SimpleError; use std::io::Write; struct Child { shell: std::ffi::CString, } impl Child ...
use alloc::boxed::Box; use core::{ cell::UnsafeCell, ops::{Deref, DerefMut}, }; use windows_kernel_sys::{ base::EX_PUSH_LOCK, ntoskrnl::{ ExAcquirePushLockExclusive, ExAcquirePushLockShared, ExInitializePushLock, ExReleasePushLockExclusive, ExReleasePushLockShared, KeEnterCriticalRegion...
//! Argument reduction. use crate::{ common::*, preproc::{PreInstance, RedStrat}, }; /// Argument reduction. /// /// Applies the technique from /// [Redundant argument filtering of logic programs][paper]. /// /// [paper]: https://link.springer.com/chapter/10.1007%2F3-540-62718-9_6 /// (Redundant argument filt...
// Copyright 2020, The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following // di...
#![cfg_attr(all(test, feature = "bench"), feature(test))] use std::env::consts::DLL_EXTENSION; use std::env::current_exe; use std::error::Error as StdError; use std::ffi::OsStr; use clap::{App, FromArgMatches, IntoApp}; use kaspa_miner::PluginManager; use log::{error, info}; use rand::{thread_rng, RngCore}; use std::...
//! Flexible generic virtual dom representation. //! //! The types here can be used to generically represent a virtual dom tree. This generic //! representation can be used to plug various concrete virtual dom representations into the //! [`diff`] and [`patch`] algorithms implemented in this crate. //! //! [`diff`]: .....
use futures::ready; use std::{ future::Future, marker::Unpin, pin::Pin, task::{self, Poll}, }; use tokio::io::{self, AsyncBufRead, AsyncReadExt}; pub async fn retry_on_fail<R, T, E: std::fmt::Debug>(mut f: impl FnMut() -> R) -> Result<T, E> where R: Future<Output = Result<T, E>>, { let mut coun...
use anyhow::Error; use relative_path::RelativePathBuf; use std::collections::HashMap; use std::{ fmt::{self, Display, Formatter}, io::{self, Write}, path::Path, sync::{Arc, RwLock}, }; use swc::{ config::{JscConfig, SourceMapsConfig}, Compiler, }; use swc_bundler::{Bundler, Config, Hook, Load, M...
use crate::common::*; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Config { pub logging: LoggingConfig, pub training: TrainingConfig, pub dataset: DatasetConfig, } impl Config { pub fn open<P>(path: P) -> Result<Self> where P: AsRef<Path>, { let text = fs::read_to...
use std::io; use vm::Visit; use vm::Module; use vm::BlockData; use vm::FuncData; use vm::Inst; use vm::InstData; use vm::Term; use vm::Reg; use vm; struct Writer<'dst, W> where W: io::Write + 'dst, { dst: &'dst mut W, } impl<'dst, W> Visit for Writer<'dst, W> where W: io::Write + 'dst { fn visit_modul...
use errors::*; use gdk::enums::key; use glib; use glib::translate::ToGlibPtr; use glib::Value; use gobject_sys; use gtk_sys; use gtk; use gtk::prelude::*; use rand::Rng; use std::thread; use std::time::Duration; use xmz_server::Kombisensor; fn update_tree_store(tree_store: &gtk::TreeStore) { if let Some(mut iter)...
use conllu::graph::Sentence; use lazy_static::lazy_static; use ohnomore::transform::delemmatization::{ RemoveAlternatives, RemoveReflexiveTag, RemoveSepVerbPrefix, RemoveTruncMarker, }; use ohnomore::transform::lemmatization::{ AddReflexiveTag, AddSeparatedVerbPrefix, FormAsLemma, MarkVerbPrefix, RestoreCase, }...
/* * Rust-FMOD - Copyright (c) 2016 <NAME>. * * The Original software, FMOD library, is provided by FIRELIGHT TECHNOLOGIES. * * This software is provided 'as-is', without any express or implied warranty. * In no event will the authors be held liable for any damages arising from * the use of this software. * * Permissio...
use std::collections::{BTreeMap, HashMap}; use lambda_http::{lambda, Request, Response, Body, RequestExt}; use maplit::hashmap; use rusoto_core::Region; use rusoto_dynamodb::{DynamoDbClient}; use serde::{Serialize, Deserialize}; use commentable_rs::models::comment::{Comment as CommentRecord, CommentId}; use commentab...
use crate::cbor::CborAny; use minicbor::data::Type; use minicbor::encode::{Error, Write}; use minicbor::{Decode, Decoder, Encode, Encoder}; use std::cmp::Ordering; use std::fmt::Debug; pub mod attributes; pub use attributes::AttributeSet; pub type AttributeId = u32; #[derive(Clone, Debug)] pub struct Attribute { ...
use std::iter; use num::FromPrimitive; use gb_emu::mmu::Memory; use gb_emu::graphics; use values::Direction; use data::{Party, BATTLE_DATA_SIZE, BattleData, PokemonData, MovementData}; use offsets; use text; pub fn movement_data(mem: &Memory) -> MovementData { MovementData { map_id: mem.lb(offsets::MAP_...
use std::process::Command; use ansi_term::Color; use super::{Context, Module}; /// Creates a module with the current Java version /// /// Will display the Java version if any of the following criteria are met: /// - Current directory contains a file with a `.java`, `.class` or `.jar` extension /// - Current ...
// Advent of Code 2019 - day 3 // https://adventofcode.com/2019/day/3 // Takes as input either // 1. a text file with two comma-separated wire paths on separate lines // 2. two comma-separated wire paths as arguments #[derive(Copy, Clone, Debug)] struct Point { x: i32, y: i32, steps: i32, } impl std::fmt::Display...
//! Expression structures. prelude! {} pub mod data; pub mod variant; pub use self::{data::Data, variant::Variant}; pub type Variants = idx::VariantMap<Variant>; pub type Exprs = idx::ExprMap<Expr>; #[derive(Debug, Clone)] pub struct Expr { e_idx: idx::Expr, generics: rust::Generics, variants: Varia...
pub use self::error::TimeProbeError; use crate::resources::LockFile; use chrono::{DateTime, Utc}; use std::thread::sleep; use std::time::{Duration, Instant, UNIX_EPOCH}; pub struct TimeProbeConfig { /// The time in seconds between samples in ms. pub interval: u64, /// The amount of time to wait before che...
/*! This code is based on src/lib.rs from [jp2k](https://crates.io/crates/jp2k) (https://github.com/kardeiz/jp2k), version 0.3.1, which was previously forked from https://framagit.org/leoschwarz/jpeg2000-rust before its GPL-v3 relicensing. ## Original warnings and license statement ### Warning Please be advised that...
#[macro_use] extern crate log; mod types; use bollard::container::{InspectContainerOptions, ListContainersOptions}; use bollard::models::ContainerSummary; use bollard::Docker; use env_logger; use std::collections::HashMap; use std::default::Default; use std::fs; use std::fs::File; use std::path::Path; use std::time:...
use steamworks::*; use macroquad::prelude::*; use macroquad::ui::*; use std::sync::mpsc; use clipboard::{ClipboardContext, ClipboardProvider}; //MAYBE IT'S NOT GOOD GAME ARCHITECTURE struct GameState { state: Box<States>, } enum States { Menu(MenuState), Chat(ChatState) } struct MenuState { lobby_inp...
// Copyright 2017-2019 Parity Technologies (UK) Ltd. // // 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...
//! Implement port-based policies //! //! These are also known as "short policies" or "policy summaries". use std::fmt::Display; use std::str::FromStr; use std::sync::Arc; use super::{PolicyError, PortRange}; use crate::util::intern::InternCache; /// A policy to match zero or more TCP/UDP ports. /// /// These are us...
use std::{cmp::min, time::Duration}; use anyhow::{anyhow, Context}; use postgres::{types::ToSql, NoTls, Row}; use rand::prelude::*; // DbLocker wraps a regular DbConn, only allowing access using the // `lock` method. This method will acquire the advisory lock before // allowing access to the database, and then releas...
use repr::var_label::*; use std::fmt; use std::hash::{Hash, Hasher}; use std::mem; extern crate quickcheck; use repr::var_label; use self::quickcheck::{Arbitrary, Gen}; /// number of bits allocated for a table index (limit on total BDDs of each /// variable) const INDEX_BITS: usize = 64 - VAR_BITS - 1; // reserve 1 bi...
use rand::Rng; /// Represents a 32-bit RGBA color /// /// This is a newtype struct wrapping a u32 value. It provides methods to manipulate individual /// components of a color, either using u8 or f32 values. Manipulating through f32 values has a /// performance cost and is provided for convinience when performance...
// Copyright 2018 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::{anyhow, Error}, cobalt_sw_delivery_registry as metrics, fidl::endpoints::ServerEnd, fidl_fuchsia_io::DirectoryMarker, fi...
use std::rc::Rc; use som_core::bytecode::Bytecode; use crate::block::Block; use crate::class::Class; use crate::compiler::Literal; use crate::method::{Method, MethodKind}; use crate::value::Value; use crate::SOMRef; /// The kind of a given frame. #[derive(Clone)] pub enum FrameKind { /// A frame created from a b...
use core::format_args; use embedded_hal::serial; use heapless::Vec; use simple_clock::SimpleClock; use crate::{ module::{CarretCondition, Module, OkCondition}, net::{IpAddr, SocketAddr}, parser::CommandResponse, reader_part::{ReadData, ReaderPart}, Error, }; /// Network session information. #[der...
#[macro_use] extern crate mjolnir_api; use serde_json; #[macro_use] extern crate serde_derive; use std::collections::HashMap; use std::env; use std::process; use std::io::{self, Write}; use mjolnir_api::{Alert, Discover, RemediationResult, Remediation}; #[cfg(test)] mod tests { use super::*; fn it_parses...
use curve25519_dalek::scalar::Scalar; use rand::thread_rng; use std::net::{IpAddr, Ipv4Addr}; use tokio::io; use tokio::prelude::*; use tokio::task; use p2p::cybershake; use p2p::{Node, NodeConfig, NodeHandle, NodeNotification, PeerID}; fn main() { // Create the runtime. let mut rt = tokio::runtime::Runtime:...
extern crate quick_xml; use super::identifiers::*; use super::migrate::migrate_inline_content; use foxml::FoxmlControlGroup; use log::info; use quick_xml::events::attributes::Attribute; use quick_xml::events::{BytesDecl, BytesStart, Event}; use quick_xml::{Reader, Writer}; use std::io::Cursor; use std::path::Path; //...
//! Historical data loader. use super::fxcm; use arrayvec::ArrayString; use chrono::{Datelike, Duration, NaiveDate}; use csv::{DeserializeRecordsIntoIter, Reader}; use enum_map::EnumMap; use flate2::read::GzDecoder; use std::{fmt::Write, io::Read}; /// Iterator to get historical data for all symbols. pub struct Histor...
use std::convert::{From, Into, TryInto}; use std::fmt::Display; use std::marker::PhantomData; use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign}; use typenum::Unsigned; /// Finite field of prime `P` /// /// `P` must be an instance of `typenum::Unsigned` and a prime number. /// /// ``` ...
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
// Monero Swap Rust Library // Written in 2019 by // h4sh3d <<EMAIL>> // // 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 // t...
#![allow(unused)] use std::convert::AsRef; use std::path::{PathBuf, Path}; use std::string::ToString; use tar::Archive; use flate2::read::GzDecoder; /////////////////////////////////////////////////////////////////////////////// // UTILS - ENVIROMENT //////////////////////////////////////////////////////////////////...
use core::fmt; use core::hash::{Hash, Hasher}; use static_assertions::const_assert_eq; use crate::language::{IntType, FloatType}; use crate::runtime::types::{Tuple, UserData, UserIterator, Marker}; use crate::runtime::function::{Function, NativeFunction}; use crate::runtime::strings::{StringValue, StringSymbol, InlineS...
use crate::cartridge::mappers::{Mapper, Nrom128, Nrom256}; use crate::cartridge::{MirroringType, CHR_ROM_BANK_SIZE, PRG_ROM_BANK_SIZE}; use crate::Byte; use anyhow::{anyhow, bail, Result}; use bitflags::bitflags; /// "NES" followed by MS-DOS end-of-file used to recognize .NES (iNES) files const NES_TAG: [Byte; 4] = [0...
use std::collections::HashMap; use std::net::{IpAddr, Ipv4Addr}; //use log::*; use serde::{Deserialize, Serialize}; use crate::manager::*; #[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] pub struct PublicKeyWithTime { pub key: String, // base64 encoded pub priv_key_creation_time: u64, } ...
use std::collections::HashMap; use std::fmt::{Display, Formatter}; use std::io::{prelude::*, Result}; use std::net::TcpStream; use crate::headers::Headers; const BUFFER_SIZE: usize = 512; #[derive(Clone, Debug, PartialEq)] pub enum Method { Delete, Get, Post, } impl Display for Method { fn fmt(&self...
use std::fmt; use std::fmt::{Display, Write}; use console::StyledObject; pub struct Table { min_widths: Vec<usize>, content: Vec<Line>, } pub type TableRow = Vec<TableCell>; enum Line { Row(TableRow), Separator, } pub struct TableCell { allow_hiding: bool, content: String, length: usize...
use alloc::vec::Vec; use alloc::vec; use crate::renderer::{LockedRenderer}; use embedded_graphics::{ image::{Image, ImageRaw}, mono_font::{ascii::FONT_6X12, MonoTextStyle}, pixelcolor::Rgb888, prelude::*, primitives::{PrimitiveStyleBuilder, Rectangle}, text::Text, }; use embedded_layout::{layout...
#[cfg_attr(rustfmt, rustfmt_skip)] use na::Matrix4; #[test] fn col_piv_qr() { let m = Matrix4::new( 1.0, -1.0, 2.0, 1.0, -1.0, 3.0, -1.0, -1.0, 3.0, -5.0, 5.0, 3.0, 1.0, 2.0, 1.0, -2.0, ); let col_piv_qr = m.col_piv_qr(); assert!(relative_eq!( col_piv_qr.determinant(), 0.0, ...
/*! A C interface to the filter library. */ /// C `enum` type for filters. #[allow(non_camel_case_types)] #[repr(C)] pub enum rbj_eq_t { /// Lowpass filter. LOW_PASS_FILTER, /// Highpass filter. HIGH_PASS_FILTER, /// Bandpass filter, with constant skirt gain and peak gain Q. BAND_PASS_Q_FILTE...
use crate::devices::{Device, Probe}; use crate::memory::{MemException::*, MemResult, Memory}; /// EP9302 Power States (see page 5-10) #[derive(Debug, Clone, Copy)] pub enum PowerState { Run, Halt, Standby, } /// System Controller module /// /// As described in section 5 of the EP93xx User's Guide. #[deriv...
//! Create embed fields. use std::{ error::Error, fmt::{Display, Formatter, Result as FmtResult}, }; use twilight_model::channel::embed::EmbedField; /// Error creating an embed field. /// /// This is returned from [`EmbedFieldBuilder::new`]. #[derive(Clone, Debug, Eq, PartialEq)] #[non_exhaustive] pub enum Em...
pub use super::{Computer, ComputerWord}; use num::traits::{One, ToPrimitive, Zero}; use std::fmt::{Debug, Display, Error, Formatter}; use super::InstructionSize; #[derive(Clone, Eq, PartialEq, Hash)] pub enum OpArg { Literal(ComputerWord), Reference(usize), Relative(i32), } impl Debug for OpArg { fn fmt(&sel...
use teensycore::*; use teensycore::clock::*; use teensycore::debug::*; use teensycore::phys::pins::*; const fn micros(time: uNano) -> uNano { return MICRO_TO_NANO * time; } pub struct Max31820Driver { pin: usize, } impl Max31820Driver { pub fn new(data_pin: usize) -> Self { pin_mux_config(data_pi...
#[macro_use] extern crate glium; extern crate alice; extern crate rand; use std::fs::File; use std::io::Cursor; use glium::{DisplayBuild, Surface}; use glium::glutin::{Event, ElementState, VirtualKeyCode, MouseScrollDelta, MouseButton}; use alice::model::rendering::{ModelRenderer, prepare_model}; use alice::model::{Mo...
use bevy::{gltf::Gltf, prelude::*, scene::InstanceId}; use log::info; use mav_sdk::grpc::telemetry::{Position, Quaternion}; pub struct DronePlugin; // Resource to hold the scene `instance_id` until it is loaded #[derive(Default)] struct SceneInstance(Option<InstanceId>); #[derive(Component)] struct DroneComponent; ...
//use std::fs::File; use std::{collections::HashSet, error::Error, fs::{self, File, OpenOptions, read_to_string}, path::PathBuf, str::FromStr}; use std::io::prelude::*; // This is a must for all `File` functionality to work // use office_align::high_zip::extract; use walkdir::{DirEntry, WalkDir}; use zip::write::Fil...
use crate::entities::attributes::attribute_container::AttributeContainer; use crate::entities::attributes::attribute_factory::get_attribute_container; use crate::entities::attributes::attribute_info::AttributeInfo; use crate::entities::constants::constant_container::ConstantContainer; use crate::entities::read_bytes::R...
use crate::views::sidebar::Pages; use crate::views::sidebar::SidebarView; use crate::views::toolbar::ToolbarView; use virtual_dom_rs::prelude::*; pub struct TasksView {} impl TasksView { pub fn new() -> TasksView { TasksView {} } } impl View for TasksView { fn render(&self) -> VirtualNode { ...
//! A log thread implementation. use crate::{ common::{ error::{err, Result}, log::{ callback::LogCallback, deinit, init, proxy::LogProxy, tee_file::{TeeFile, TeeFileConfiguration}, Log, LogRecord, Loglevel, LoglevelFilter, PID, },...
use regex::Regex; use std::error::Error; use std::path::Path; use std::path::PathBuf; use clap::ArgMatches; use simple_error::bail; use simplelog::*; #[cfg(target_os = "macos")] use crate::macos::*; #[cfg(target_os = "windows")] use crate::windows::*; #[cfg(target_os = "linux")] use crate::linux::*; use crate::es...