text
stringlengths
3.09k
13.9k
use super::base::{decode_function_data, AbiError}; use ethers_core::{ abi::{Detokenize, Function, InvalidOutputType}, types::{ transaction::eip2718::TypedTransaction, Address, BlockId, Bytes, TransactionRequest, U256, }, }; use ethers_providers::{Middleware, PendingTransaction, ProviderError}; use ...
/* * 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 ...
// Copyright 2019 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::{ errors::MetaPackageError, path::{check_package_name, check_package_variant, PackagePath}, }; use serde::{Deserialize, Serialize}; use ...
#![feature(int_to_from_bytes)] #![feature(tool_lints)] #![allow(proc_macro_derive_resolution_fallback)] // FIXME Rust 2018 / Diesel 1.4+ #[macro_use] extern crate diesel; // FIXME +++ use bytes::buf::Buf; use chrono::{Duration, Utc}; use crate::db::Database; use crate::model::Item; use lazy_static::lazy_static; use mi...
use crate::Evm; use ethers::types::{Address, Bytes, U256}; use evmodin::{tracing::Tracer, AnalyzedCode, CallKind, Host, Message, Revision, StatusCode}; use eyre::Result; // TODO: Check if we can implement this as the base layer of an ethers-provider // Middleware stack instead of doing RPC calls. #[derive(Clone, De...
use std::{ path::{Path, PathBuf}, sync::atomic::{AtomicUsize, Ordering}, }; use crate::{error::fs_err, gsl, Result}; /// Removes the given `path` and all of its contents (if it is a directory). /// /// Does nothing and returns `Ok(())` if `path` does not exist. pub fn rm_rf(path: impl AsRef<Path>) -> Result<(...
use byteorder::{ByteOrder, LittleEndian}; use solana_program::{ account_info::{next_account_info, AccountInfo}, entrypoint, entrypoint::ProgramResult, info, program_error::ProgramError, pubkey::Pubkey, }; // use solana_program::{ // account_info::AccountInfo, entrypoint::ProgramResult, msg, ...
//! Various helper methods that may help with static-events based procedural derives. use crate::errors::{Error, Result}; use proc_macro::TokenStream; use proc_macro2::{Span, TokenStream as SynTokenStream}; use std::fmt::Display; use syn::*; use quote::*; /// Creates an identifier with a format-like syntax. #[macro_e...
use crate::Context; use anyhow::{Context as _, Result}; use bytes::Bytes; use flate2::read::GzDecoder; use scylla::cql_to_rust::FromCqlVal; use scylla::macros::{FromUserType, IntoUserType}; use scylla::Session; use specifications::package::PackageInfo; use std::convert::{TryFrom, TryInto}; use std::sync::Arc; use tar::...
/// The dual coordinate system support use std::borrow::{Borrow, BorrowMut}; use std::fmt::Debug; use std::ops::{Deref, DerefMut}; use super::context::{ChartContext, SeriesAnno}; use super::mesh::SecondaryMeshStyle; use crate::coord::{CoordTranslate, Ranged, RangedCoord, ReverseCoordTranslate}; use crate::drawing::ba...
use crate::days::Day; use std::collections::BTreeMap; use std::error::Error; use std::fs; use std::str::FromStr; pub struct Day12 { input: String, } impl Day12 { pub fn new() -> Day12 { let input = fs::read_to_string("res/day12.txt").unwrap(); Day12 { input } } } impl Day for Day12 { ...
//! Run states one-by one as long as they succeed (boolean AND operation). use crate::{condition::*, decision_makers::*, task::*}; /// Defines sequencer state with task and condition. pub struct SequencerState<M = ()> { condition: Box<dyn Condition<M>>, task: Box<dyn Task<M>>, } impl<M> SequencerState<M> { ...
// Copyright 2017 <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 in writing,...
use super::super::backend::Backend; use super::super::buckets::Buckets; use std::net::{ToSocketAddrs, SocketAddr, TcpStream}; use std::fmt::Write; use std::io::Write as IoWrite; use time; #[derive(Debug)] pub struct Graphite { addr: SocketAddr, last_flush_time: u64, last_flush_length: u64, flush_inter...
// Copyright (c) Facebook, Inc. and its affiliates. use anyhow::{bail, Result}; use log::trace; use std::fs; use std::io; use std::io::prelude::*; use rd_agent_intf::{ SideloaderCmd, SideloaderReport, Slice, SliceKnobs, SvcStateReport, SIDELOADER_SVC_NAME, SIDELOAD_SVC_PREFIX, }; use rd_util::*; use super::Co...
use actix_web::{http::StatusCode, web::Data, Error, FromRequest, HttpRequest}; use chrono::Utc; use jsonwebtoken::{decode, encode, DecodingKey, EncodingKey, Header, Validation}; use sea_orm::{ActiveModelTrait, ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter, Set}; use serde::{Deserialize, Serialize}; use ...
// Copyright (c) 2017 <NAME> // // Licensed under the Apache License, Version 2.0 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT // license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. All files in the project carrying such notice may not be copied, // modified, ...
mod data; use ndarray_rand::rand_distr::Normal; use tensorflake::{ initializers::Initializer, losses::naive_mean_squared_error, nn::{ activations::{relu, sigmoid}, *, }, training::TrainConfig, *, }; fn main() { let mnist = data::mnist::Mnist::load("./data/fashion-mnist"); ...
use rand::{thread_rng, Rng}; use sodalite::{ SecretboxKey, SecretboxNonce, SECRETBOX_KEY_LEN, SECRETBOX_NONCE_LEN, secretbox_open, secretbox }; pub const SECRETBOX_BOXZEROBYTES: usize = 16; pub const SECRETBOX_ZEROBYTES: usize = 32; pub const PKCS8_DIVIDER: [u8; 5] = [161, 35, 3, 33, 0]; pub const PKCS8_HEADE...
use std::f32; use std::f32::consts as math_consts; use modulator::foc_modulator as foc; use platform_traits::pwm_inverter as pwm; use platform_traits::current_sensor as cs; use platform_traits::rotor_position_sensor as encoder; use platform_traits::blocking_delay as delay; use foc_types::types as t; use pid_controller:...
use argparse::ArgumentParser; use argparse::Store; use argparse::StoreTrue; use bytes::Bytes; use futures::channel::oneshot; use futures::join; use futures::StreamExt; use futures::SinkExt; use mumble_protocol::control::msgs; use mumble_protocol::control::ClientControlCodec; use mumble_protocol::control::ControlPacket;...
use std::error::Error; use reqwest; use scraper::{Html, Selector}; use serde::Serialize; use simple_error::bail; pub type ParseResult<T> = Result<T, Box<dyn Error>>; static EXPECT_USER_INFO_TDS: usize = 5; static EXPECT_EVENT_TDS: usize = 10; // CSS selectors static PERSON_INFORMATION_SELECTOR_STR: &str = "div.deta...
//! Example of communication with flash memory over QSPI interface. This //! specific program is made for Daisy Seed board and its IS25LP064A flash //! memory chip. This demo provides a non-volatile restart counter. When it is //! odd, LED will light up, when even, it stays off. #![deny(warnings)] #![no_main] #![no_st...
/* * Copyright (C) 2017 Genymobile * * 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 ...
pub mod join; mod manual; mod order; mod plan; use { crate::{ executor::{ types::{LabelsAndRows, Row}, PlannedRecipe, }, macros::try_option, Glue, RecipeUtilities, Result, Value, }, futures::stream::{self, StreamExt, TryStreamExt}, rayon::prelude::*, serde::Serialize, sqlparser::ast::{OrderByExpr, ...
use std::{collections::HashMap, fmt, path::PathBuf}; #[derive(Clone, Debug, Eq, PartialEq, Hash)] pub struct DictionaryName(String); impl fmt::Display for DictionaryName { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.0) } } impl DictionaryName { pub fn new(name: Str...
//! Misc dev utilities. extern crate crank as serum_crank; use anyhow::Result; use clap::Clap; use serum_common::client::rpc; use serum_context::Context; use serum_dex::instruction::NewOrderInstructionV1; use serum_dex::matching::{OrderType, Side}; use serum_registry::client::Client; use solana_sdk::pubkey::Pubkey; u...
use std::rc; use std::cell; use text; use modifier; use event; use builder; use transform; use super::{ Shared }; type SharedPeek<S> = Shared<modifier::Peek<modifier::Expand<S>>>; /// Select an elements contents. pub struct SelectContent<S, B> where S: event::ElementStream, B: builder::BuildOnce<CurrentCon...
#![feature(seek_stream_len)] //! # Nintendo parameter archive (AAMP) library in Rust //! //! A simple to use library for reading, writing, and converting Nintendo parameter archive (AAMP) files //! in Rust. Supports only AAMP version 2, used in _The Legend of Zelda: Breath of the Wild_. Can //! convert from AAMP to rea...
use std::{ hash::{Hash, Hasher}, sync::Arc, }; use anymap::AnyMap; use fj_math::Point; use parking_lot::{RwLock, RwLockReadGuard}; use slotmap::{DefaultKey, SlotMap}; use crate::{ geometry::{Curve, Surface}, topology::{Cycle, Edge, Face, Vertex}, }; use super::Object; #[derive(Clone, Debug)] pub str...
#![feature(core_intrinsics)] extern crate core_affinity; extern crate rs_lockfree; #[macro_use] extern crate log; extern crate env_logger; use rs_lockfree::lockfree_stack; use rs_lockfree::util; use std::ops::Deref; use std::ops::DerefMut; use std::mem; use std::thread; use std::intrinsics; use std::time; use std::ti...
use super::memory_span::*; use std::alloc::*; use std::mem; use std::ptr::Unique; use std::sync::atomic::{AtomicPtr, AtomicUsize, Ordering}; use std::sync::{Mutex, MutexGuard}; const GC_SWEEP_BLOCK_ENTRIES: usize = 512; // 4KB on 64-bit const GC_SWEEP_BUF_INIT_SPINE_CAP: usize = 256; // Enough for 1GB heap on 64-bit ...
#![allow(clippy::excessive_precision)] struct IIRFilter<'f>(&'f [f32], &'f [f32]); impl<'f> IIRFilter<'f> { pub fn with_coefficients(a: &'f [f32], b: &'f [f32]) -> IIRFilter<'f> { IIRFilter(a, b) } // Performs the calculation as an iterator chain. pub fn apply<I: Iterator<Item = &'f f32> + 'f...
#![doc(html_root_url = "https://urschrei.github.io/ostn02_phf/")] //! Look up OSTN02 adjustments for transforming ETRS89 Eastings and Northings //! to OSGB36 Eastings and Northings const MIN_X_SHIFT: f64 = 86.275; const MIN_Y_SHIFT: f64 = -81.603; const MIN_Z_SHIFT: f64 = 43.982; use std::f64; const NAN: f64 = f64::N...
// 如果想让别人也能够使用这个creat 中的trait 为他自己的类型实现 Summary中的方法 // 我们必须声明为共有trait,在trait前加pub关键字 // 这样别人可以用过 use learntrait::Summary实;然后就可以为其类型实现Summary trait // note! 实现trait时需要注意的一个限制,只有当trait或者要实现trait的类型位于crate的本地作用域时 // 才能为该类型实现trait #![allow(unused)] use std::fmt::{Debug, Display}; pub trait Summary { fn summary(&self) ...
// Copyright Materialize, Inc. and contributors. All rights reserved. // // Use of this software is governed by the Business Source License // included in the LICENSE file. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by ...
use crate::*; impl PolygonInstance { /// Clone the instance as another drawn element. #[inline(always)] pub fn clone_instance(&self) -> PolygonInstance { PolygonInstance { polygon: self.polygon.clone(), state: self.state.clone(), shaders: self.shaders.clone(), ...
use aoc::aoc_input::get_input; use std::{collections::HashMap, str::FromStr}; fn part1(s: &str) { let mut total = 0usize; for line in s.trim().lines() { let output_values = line.split(" | ").nth(1).unwrap().split(' '); for val in output_values { total += match val.len() { ...
use ego_tree::NodeRef; use scraper::{ElementRef, Node}; use selectors::attr::CaseSensitivity; use crate::atom::{ parse_code, parse_deprecated, parse_list, parse_p, parse_portability, parse_pre, parse_text_inside, parse_unstable, Details, Paragraph, TextPart, }; pub struct Fqn<'a> { pub title: Vec<TextPart...
use std::fmt; use std::process::id; pub const OP_SIZE: usize = 4; const COND_EQ: u8 = 0b0000; const COND_NE: u8 = 0b0001; const COND_CSHS: u8 = 0b0010; const COND_CCLO: u8 = 0b0011; const COND_MI: u8 = 0b0100; const COND_PL: u8 = 0b0101; const COND_VS: u8 = 0b0110; const COND_VC: u8 = 0b0111; const COND_HI: u8 = 0b10...
/* * Copyright 2020 Fluence Labs 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 applicable law or a...
//! 第一反应: 既然全是整数, 那就开它个 1000000 的数组 //! 然而 `Box::new([-1; 1000000])` 初始化的时候会 stack overflow, //! 查了一下说可以使用 `box [-1; 1000000]`, 然而是 unstable feature... //! 那就用 `vec![-1; 1000000]` 吧, 本地倒没什么问题了, 然而交上去又 MLE ... //! ... //! 那就开个 1000 的 Vec, 其余的用链表存吧 //! 然而标准库里的链表没有 remove 方法 ??? (https://github.com/rust-lang/rust/issues/3...
extern crate byteorder; extern crate clap; #[macro_use] extern crate lazy_static; extern crate llrv; extern crate protobuf; extern crate rand; use clap::{App, Arg}; use rand::{thread_rng, Rng}; use std::sync::Arc; use std::net::{TcpStream, ToSocketAddrs}; use std::sync::atomic::{AtomicUsize, Ordering}; use std::time; ...
//! The operations. use std::collections::HashMap; use crate::compact1::number; use crate::{Result, Tape, Value}; /// An operand. pub type Operand = f32; /// An operation. pub type Operation = (Operator, Vec<Operand>); /// A collection of operations. #[derive(Clone, Debug)] pub struct Operations(pub HashMap<Operat...
//! Defines changes and additions to the reflection dump that add and fix up //! information. //! //! See the `patches/` directory for input. use std::borrow::Cow; use std::collections::HashMap; use anyhow::{anyhow, bail, Context}; use rbx_reflection::{ DataType, PropertyDescriptor, PropertyKind, ReflectionDataba...
type ChaChaBlock = [u32; 16]; fn quaterround(x: &mut ChaChaBlock, a: usize, b: usize, c: usize, d: usize) { x[a] = x[a].wrapping_add(x[b]); x[d] = (x[d] ^ x[a]).rotate_left(16); x[c] = x[c].wrapping_add(x[d]); x[b] = (x[b] ^ x[c]).rotate_left(12); x[a] = x[a].wrapping_add(x[b]); x[d] = (x[d] ^ ...
use std::any::Any; use std::process; use super::prompt::{EofError, Prompt, PromptResult}; pub mod exit_command; use self::exit_command::ExitCommand; pub mod quit_command; use self::quit_command::QuitCommand; pub mod cd_command; use self::cd_command::CdCommand; pub mod general_command; use self::general_command::Ge...
// Rust Bitcoin Library // Written in 2014 by // <NAME> <<EMAIL>> // To the extent possible under law, the author(s) have dedicated all // copyright and related and neighboring rights to this software to // the public domain worldwide. This software is distributed without // any warranty. // // You should have receiv...
extern crate clap; extern crate indicatif; #[macro_use] extern crate json; use clap::{App, Arg}; use indicatif::{ProgressBar, ProgressStyle}; use json::JsonValue; use std::fs; use std::fs::File; use std::io::BufReader; use std::path::Path; use std::path::PathBuf; use std::process; // Start of the command line tool fn...
use crate::unique_rc::UniqueRc; use std::error::Error; use std::fmt::Debug; use std::fmt::Display; use std::fmt::Formatter; use std::ops::Range; #[derive(Copy, Clone)] pub(crate) struct Position { line: usize, column: usize, } impl Debug for Position { fn fmt(&self, formatter: &mut Formatter<'_>) -> std::...
use std::time::Duration; use std::{ error::Error, fmt::{self, Debug, Display, Formatter}, }; use serde::{Deserialize, Serialize}; use yew::agent::{Agent, AgentLink, HandlerId, Job}; use yew::format::Json; use yew::services::storage::Area; use yew::services::{IntervalService, StorageService, Task}; use crate::...
use super::{BigUnixTime, CompactInt, SmallUnixTime}; use byteorder::{BigEndian, LittleEndian, ReadBytesExt}; use chrono::{TimeZone, Utc}; use std::net::{Ipv6Addr, SocketAddr}; use std::{ io, net::IpAddr::{V4, V6}, }; use super::SerializationError; type Result<R> = std::result::Result<R, SerializationError>; ...
// Symphonia // Copyright (c) 2020 The Project Symphonia Developers. // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. use super::{Mapper, MapResult}; use symphon...
use crate::error; use scroll::{IOread, IOwrite, Pread, Pwrite, SizeWith}; /// Size of a single COFF relocation. pub const COFF_RELOCATION_SIZE: usize = 10; // x86 relocations. /// The relocation is ignored. pub const IMAGE_REL_I386_ABSOLUTE: u16 = 0x0000; /// Not supported. pub const IMAGE_REL_I386_DIR16: u16 = 0x00...
#![no_std] extern crate alloc; use alloc::{string::String, vec::Vec}; use casper_contract::{ contract_api::{account, runtime, storage, system}, unwrap_or_revert::UnwrapOrRevert, }; use casper_types::{ bytesrepr, bytesrepr::{Error, FromBytes, ToBytes, U8_SERIALIZED_LENGTH}, runtime_args, ApiError,...
// Copyright 2014 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 super::message::Message; use super::peer; use crate::network::server::Handle as ServerHandle; use crossbeam::channel; use log::{debug, warn, info}; use std::sync::{Arc, Mutex}; use crate::blockchain::Blockchain; use crate::block::Block; use crate::crypto::hash::{Hashable,H256}; use std::collections::HashMap; use st...
mod binary; mod debugger; mod disasm; mod tester; use debugger::Debugger; use humansize::{file_size_opts::BINARY, FileSize}; use log::*; use serde::Serialize; use std::collections::{BTreeSet, HashSet}; use std::ffi::OsString; use std::fmt::Debug; use std::fs::File; use std::ops::Range; use std::time::Instant; use stru...
use crate::vic::raster_line_to_screen_y; use crate::vic::VicOutput; use crate::vic::{LEFT_BORDER_START, TOP_BORDER_FIRST_LINE, VISIBLE_LINES, VISIBLE_PIXELS}; use common::colors::create_palette; use common::colors::Palette; use graphics::types::Rectangle; use image::{Pixel, Rgba, RgbaImage}; /// This structure simulat...
use super::Rule; use crate::Span; use miette::{Diagnostic, NamedSource, SourceSpan}; use thiserror::Error; use pest::error::{Error, ErrorVariant, InputLocation}; pub(super) type Result<T> = std::result::Result<T, ParseError>; /// There was a problem parsing the source. #[derive(Debug, Clone)] pub struct ParseError {...
#![allow(clippy::module_inception)] use fibers::sync::oneshot::Monitored; use frugalos_raft::NodeId; use libfrugalos::entity::object::{ DeleteObjectsByPrefixSummary, Metadata, ObjectId, ObjectPrefix, ObjectSummary, ObjectVersion, }; use libfrugalos::expect::Expect; use libfrugalos::time::Seconds; use raftlog::log::...
/* SPDX-License-Identifier: (Apache-2.0 OR MIT OR Zlib) */ /* Copyright © 2021 <NAME> */ use std::path::Path; #[derive(Clone, Debug)] pub struct ConnectionSet<K> { inner: std::collections::BTreeSet<ConnectionEntry<K>>, } impl<K: Ord> Default for ConnectionSet<K> { fn default() -> Self { Self { ...
//! TPM implementation for cryptography use std::{cell::RefCell, convert::TryInto}; use openssl::hash::MessageDigest; use tss_esapi::{ constants::{ self as tpm_constants, response_code::{FormatOneResponseCode, Tss2ResponseCode}, }, handles::KeyHandle, interface_types::algorithm::Hashin...
use super::Serial; use once_cell::sync::Lazy; use parking_lot::Mutex; use std::collections::VecDeque; use std::io::{Read, Write}; use std::sync::Arc; use std::task::{Context, Poll, Waker}; static ACTIVE_CONSOLE: Lazy<Mutex<Option<Arc<Inner>>>> = Lazy::new(|| Mutex::new(None)); static AT_EXIT: std::sync::Once = std::sy...
use gvc_sys::*; use rustgym_util::*; use std::collections::HashMap; use std::ffi::c_void; use std::ffi::CString; type Attrs = Vec<(CString, CString, CString)>; fn make_attrs(pairs: Vec<(&str, &str)>) -> Attrs { pairs .into_iter() .map(|p| { ( CString::new(p.0.to_string(...
use chrono::{DateTime, Utc}; use rocket::handler::{Handler, Outcome}; use rocket::http::hyper::header::{CacheControl, CacheDirective, ContentEncoding, Encoding}; use rocket::http::{uncased::Uncased, uri::Segments, ContentType, Header, Method, Status}; use rocket::response::{self, Responder, Response}; use rocket::{Data...
use proc_macro_error::{abort, ResultExt}; use syn::parse::{Parse, ParseStream}; use syn::punctuated::Punctuated; use syn::{self, Attribute, Expr, Ident, LitStr, Token}; pub struct DescriptorAttr { ident: Ident, attribute: String, expr: Option<Expr>, value: Option<String>, } #[derive(Clone)] pub struct...
use std::ops::Range; use crate::util::ascii::Ascii; /// GBA cartridge header. /// /// The first 192 bytes at `0x8000000` in ROM are used as cartridge header. The /// same header is also used for Multiboot images at `0x2000000` (plus some /// additional multiboot entries at `0x20000C0` and up). /// /// # Header Overvi...
use std::{ f64::INFINITY, io::{stderr, Write}, time::Instant, }; use rand::{distributions::uniform, prelude::SmallRng, thread_rng, Rng, SeedableRng}; use rayon::iter::{IntoParallelIterator, ParallelIterator}; use raytracing::{ camera::Camera, hittable::{Hittable, HittableList, Sphere}, material...
use rand::prelude::*; use svg::node::element::path::Data; use svg::node::element::Path; use svg::Document; // https://docs.rs/svg/0.8.0/svg/ #[derive(Copy, Clone)] struct Bird { id: usize, x: f64, y: f64, vx: f64, vy: f64, } fn add_vec2(a: (f64, f64), b: (f64, f64)) -> (f64, f64) { (a.0 + b.0...
extern crate libc; use libc::{c_int, size_t, c_char}; use std::ffi::{CStr, CString}; use std::panic; use std::ptr; /// Allow state to be owned inside this object. C-callable functions exposed by this library /// are not object-oriented, so we create a static list of these objects and then refer to them /// by id as...
//! Itegration tests for all of the REST API. //! Very primitive approach. use rand::Rng; use ucare::{self, conversion, file, group, project, webhook}; mod testenv; fn rest_client_version(version: ucare::RestApiVersion) -> ucare::RestClient { let config = ucare::RestConfig { sign_based_auth: true, ...
//! Sphinx packet. use std::{fmt::Debug, marker::PhantomData}; use cryptraits::{ convert::{FromBytes, Len, ToVec}, hash::Hash, hmac::Hmac, key::{Blind, SecretKey}, key_exchange::DiffieHellman, stream_cipher::StreamCipher, }; use crate::{ crypto::{generate_cipher_stream, generate_shared_se...
/// Given a list of poker hands, return a list of those hands which win. /// /// Note the type signature: this function should return _the same_ reference to /// the winning hand(s) as were passed in, not reconstructed strings which happen to be equal. use Combination::{ StraightFlush, FourOfAKind, FullHouse, Flush, St...
#[macro_use] extern crate redis_module; use peerinfo::PeerInfo; use redis_module::{native_types::RedisType, Status}; use redis_module::{raw, Context, RedisError, RedisResult, RedisValue}; use seederinfo::SeederInfo; use std::os::raw::c_void; use std::time::Duration; use std::{convert::TryFrom, str::FromStr}; mod peer...
use proc_macro::TokenStream; use quote::{format_ident, quote, ToTokens}; use syn::{ parse_macro_input, Attribute, Data::Struct, DataStruct, DeriveInput, Field, Fields::Named, GenericArgument, Ident, Lit, Meta, NestedMeta, PathArguments, Type, TypePath, }; // Check that `ty` _is_ contained in the named wrapper ...
use std::cell::RefCell; use std::io; use std::fs::File; use std::rc::Rc; use crate::cpu::CPU; use crate::apu::channel::Voice; use crate::mem::Memory; const TIMER_TABLE: [u16; 16] = [ 0x01AC, 0x017C, 0x0154, 0x0140, 0x011E, 0x00FE, 0x00E2, 0x00D6, 0x00BE, 0x00A0, 0x008E, 0x0080, 0x006A, 0x0054, 0x0048,...
//! Serialization of an evaluated program to various data format. use crate::error::SerializationError; use crate::identifier::Ident; use crate::term::{MetaValue, RichTerm, Term}; use serde::ser::{Error, Serialize, SerializeMap, Serializer}; use std::collections::HashMap; /// Serializer for metavalues. pub fn serializ...
use std::collections::HashMap; use xml::attribute::OwnedAttribute; use crate::{ util::{floor_div, get_attrs, map_wrapper, parse_tag, XmlEventResult}, Error, LayerTile, LayerTileData, MapTilesetGid, Result, }; use super::util::parse_data_line; /// The raw data of a [`InfiniteTileLayer`]. Does not include a r...
use std::io::{Read, Write}; use std::net::TcpListener; use std::sync::{Arc, Mutex}; use std::thread::{spawn, JoinHandle}; use ennui::error::EnnuiError; use ennui::game::{Game, GameResult, NpcInit}; use ennui::player::npc::YamlPlayer; use ennui::player::{Player, PlayerType, Uuid}; use ennui::text::message::{Broadcast,...
use std::borrow::Cow; use reqwest::{header, ClientBuilder, StatusCode}; use serde::{Deserialize, Serialize}; use thiserror::Error as ThisError; use crate::{Prompt, TaskCompletion}; #[derive(ThisError, Debug)] pub enum Error { /// User exceeds his current Task Quota. #[error( "You are trying to calcul...
//! `refraction` is a lens library for Rust. Its design is based broadly on //! that of [the Haskell `lens` //! package](https://hackage.haskell.org/package/lens), but reworked and //! reorganized to become more Rusty. //! //! The `nightly` cargo feature flag can be used to enable some features only //! available on n...
use gears::{ glam::{Mat4, Vec3}, load_obj, Buffer, ContextGPUPick, ContextValidation, EventLoopTarget, Frame, FrameLoop, FrameLoopTarget, FramePerfReport, ImmediateFrameInfo, InputState, KeyboardInput, MultiWriteBuffer, RenderRecordInfo, Renderer, RendererRecord, SyncMode, UpdateRecordInfo, VertexBu...
use crate::position; use crate::token; use crate::error; use crate::tokenTypes::TokenTypes::*; use crate::tokenTypes; #[derive(Debug)] pub struct Lexer { pub current_index: usize, pub chars: Vec<u8>, pub position: position::Position } impl Lexer { fn get_byte(&self) -> Option<&u8> { return sel...
pub mod ast_to_ast; mod codegen; mod context; mod parser_ext; pub mod python; mod rs_ast; pub mod rust; use crate::{ config::{self, TranspileConfig}, output::TranspiledFileKind, }; use crate::{ error::ApiError, output::ModPath, output::TranspiledFile, output::TranspiledModule, output::TranspiledString,...
//! This module contains structs and functions these can be used for //! deserializing and serializing `serverinfo` API responses. //! May be useful if you want to create your local API proxy //! or something like that. use super::RequestParameters; #[cfg(feature = "raw")] use super::{Player, Response, ServerInfo}; ...
/* Copyright (c) 2020 <NAME> <<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 to use, copy, modify, merge, publish, distribute...
use crate::package; use gecko::lint::Lint; use gecko::llvm_lowering::Lower; use gecko::semantic_check::SemanticCheck; /// Serves as the driver for the Gecko compiler. /// /// Can be used to compile a single file, or multiple, and produce /// a single LLVM module. pub struct Driver<'a, 'ctx> { pub source_files: Vec<(...
// Copyright 2021 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { anyhow::{anyhow, Result}, ffx_core::ffx_plugin, ffx_trace_args::{TraceCommand, TraceSubCommand}, fidl_fuchsia_developer_bridge::{self...
use anyhow::{Context, Result}; use reqwest::header::*; use serde::{Deserialize, Serialize}; use serde_json::Value; pub const DEFAULT_USER_AGENT: &'static str = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36"; pub const DEFAULT_BEARER_TOKEN: &'...
use anyhow::Result; use http::StatusCode; use hyper::body::Bytes; use ipnetwork::IpNetwork; use mime::Mime; use std::net::SocketAddr; use uuid::Uuid; use warp::reply::{with_header, with_status}; use warp::{Rejection, Reply}; use crate::caches::{CachedResponse, CACHES}; use crate::models::{FullPostedOwner, ListParams, ...
use std::num::Wrapping; #[repr(C)] #[derive(Copy, Clone)] pub struct LinearCongruentialGenerator { seed: u64, } impl LinearCongruentialGenerator { pub const OUTPUT_BITS: u32 = 48; // Stealing values from the POXIX:2018 drand48(3) // https://pubs.opengroup.org/onlinepubs/9699919799/functions/drand48.h...
use crate::color::{ApproxBrightness, BadBasicColor, Brightness}; use crossterm::style::Color as CrosstermColor; use std::{convert::TryFrom, ops::Not}; /// A basic color used by the terminal. #[repr(u8)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum BasicColor { /// Black. Black =...
use crate::config::BldConfig; use crate::helpers::term; use crate::path; use crate::persist::{Database, FileLogger, FileScanner, Scanner}; use crate::run::{Pipeline, Runner}; use crate::server::{PipelinePool, User}; use crate::types::{BldError, ExecInfo, Result}; use actix::prelude::*; use actix_web::{error::ErrorUnaut...
use std::iter; use sdl2::event::Event; use sdl2::keyboard::Keycode; use crate::colors::Color; use crate::event::Events; use crate::renderer::Renderer; use crate::terminal::{Cell, Terminal}; pub trait TtyHandler { fn process(&mut self, input: String, tty: &mut TtyController); } pub struct TtyRepl<H: TtyHandler> ...
use std::collections::{HashMap, VecDeque}; use std::mem; use std::str; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, Mutex, RwLock, Condvar}; use std::thread; use disk_store::db::*; use futures::*; use futures_channel::oneshot; use ingest::input_column::InputColumn; use ingest::raw_val::RawVal; u...
extern crate rustc_serialize; extern crate rand; extern crate libc; extern crate time; extern crate ansi_term; extern crate pbr; extern crate csv; extern crate num_cpus; extern crate wait_timeout; extern crate ssh2; extern crate xml; extern crate ctrlc; extern crate zmq; extern crate yaml_rust; extern crate influent; ...
use std::str; use std::str::FromStr; use std::process::{Command, Stdio}; use errors::{VmctlControllerError, VmctlControllerErrorCause}; #[derive(Serialize, Deserialize, Debug)] pub struct Status { pub id: u64, pub pid: String, pub vcpus: u64, pub max_mem: String, pub cur_mem: String, pub tty: ...
use std::os::raw::{c_char, c_double, c_float, c_int, c_uint, c_void}; // link compiled lib (static) #[cfg(not(target_arch = "wasm32"))] #[link(name = "glfw3", kind = "static")] extern "C" {} // link deps (dynamic) #[cfg(target_os = "linux")] #[link(name = "X11")] extern "C" {} #[cfg(target_os = "macos")] #[link(name ...
// Copyright 2021 Pal<NAME>, Inc. // // 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 ...