text
stringlengths
3.09k
13.9k
use serde::{Deserialize, Serialize}; #[derive(Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct CatRecord { pub group_identifier: String, pub parent_group_identifier: String, pub top_group: bool, pub sequence: i32, pub name: String, pub short_description: String, pub long_...
use glam::Vec3A; use image::{ColorType::Rgba8, save_buffer}; use specs::prelude::*; use camera::Camera; use color::Colorf32; use components::*; use hitable::{hit, Hitable, HitRecord}; use material::{Material, scatter}; use ray::Ray; use resources::*; use utils::{lerp_vec3, random_float_01}; use std; fn color<'a>( ...
use super::distribution::frequency; use super::phone::*; use super::{Condition, PhonemeCondition, PhonemeDifference, Rule, SoundSystem}; use crate::wgl::{Environment, TransformationRule, AST}; use std::collections::HashMap; use std::convert::{Into, TryFrom}; impl SoundSystem { pub fn compile(ast: AST<'_>) -> Self ...
//! Statuses interface extern crate serde_json; extern crate serde; use self::super::{Github, Result}; use users::User; /// interface for statuses associated with a repository pub struct Statuses<'a> { github: &'a Github, owner: String, repo: String, } impl<'a> Statuses<'a> { #[doc(hidden)] pub f...
//! Exporting our R1CS to bellman use ::bellman::{Circuit, ConstraintSystem, LinearCombination, SynthesisError, Variable}; use ff::{PrimeField, PrimeFieldBits}; use gmp_mpfr_sys::gmp::limb_t; use log::debug; use std::collections::HashMap; use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::Path; use st...
use std::string::ToString; use crate::{token_test::*, tokens::Tokens}; use dada_ir::{ code::syntax::op::Op, diagnostic::DiagnosticBuilder, filename::Filename, span::Span, token::Token, token_tree::TokenTree, }; mod code; mod items; mod parameter; mod ty; pub(crate) struct Parser<'me> { db: &'me dyn crat...
use env::{Environment, Point}; use graph::{BasicBlockIndex, FuncGraph}; use graph_algorithms::Graph; use graph_algorithms::bit_set::{BitBuf, BitSet, BitSlice}; use nll_repr::repr; use region::Region; use regionck::RegionCheck; use std::collections::HashMap; pub struct LoansInScope<'cx> { env: &'cx Environment<'cx>...
use crate::Clock; use std::{ fmt, io, sync::{ atomic::{AtomicBool, Ordering}, Arc, }, thread::{self, JoinHandle}, time::Duration, }; static GLOBAL_UPKEEP_RUNNING: AtomicBool = AtomicBool::new(false); /// Ultra-low-overhead access to slightly-delayed time. /// /// In some applicatio...
use crate::utils::{ is_type_diagnostic_item, match_def_path, path_to_local, path_to_local_id, paths, snippet, span_lint_and_sugg, }; use if_chain::if_chain; use rustc_ast::ast::LitKind; use rustc_errors::Applicability; use rustc_hir::{BindingAnnotation, Block, Expr, ExprKind, HirId, Local, PatKind, QPath, Stmt, Stm...
/* * Copyright 2019 Bitwise IO, 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 agree...
use crate::{ admin::{ Mutation as AdminMutation, Query as AdminQuery, Schema as AdminSchema, }, client::{ build_root_node_from_schemas, Schema as ClientSchema, }, context::Context, util::{ graphql_get, graphql_post, playground, ...
//! A Serde ast, parsed from the Syn ast and ready to generate Rust code. use internals::attr; use internals::check; use internals::{Ctxt, Derive}; use syn; use syn::punctuated::Punctuated; /// A source data structure annotated with `#[derive(Serialize)]` and/or `#[derive(Deserialize)]`, /// parsed into an internal r...
use crate::error::{ballista_error, BallistaError}; use crate::plan::Action; use crate::protobuf; use crate::logicalplan::{Expr, LogicalPlan, LogicalPlanBuilder, Operator, ScalarValue}; use arrow::datatypes::{DataType, Field, Schema}; use std::convert::TryInto; impl TryInto<LogicalPlan> for protobuf::LogicalPlanNode...
use std::borrow::Cow; use std::io; use std::mem::size_of; use byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt}; use roaring::RoaringBitmap; /// This is the limit where using a byteorder became less size efficient /// than using a direct roaring encoding, it is also the point where we are able /// to determine t...
use core::default::Default; use core::fmt; use nanos_sdk::bindings::*; use nanos_sdk::io::SyscallError; use ledger_log::*; use base64; pub const BIP32_PATH: [u32; 5] = nanos_sdk::ecc::make_bip32_path(b"m/44'/535348'/0'/0/0"); /// Helper function that derives the seed over Ed25519 pub fn bip32_derive_eddsa(path: &[u32...
use std::{io, path::Path, result}; use thiserror::Error; use tokio::fs; use toml::{de::Error as TomlError, Value as TomlValue}; use crate::tipos::{self, Ambiente, Modelo, Servico, Uf}; #[derive(Error, Debug)] pub enum WebServicesError { /// Erros relacionados a I/O. #[error(transparent)] Io(#[from] io::E...
//! Repositories discovery. use std::{ fs, io, iter, path::{Path, PathBuf}, }; use anyhow::anyhow; use git2::{Repository, RepositoryOpenFlags}; use thiserror::Error as ThisError; use crate::vcs::Vcs; /// Repository discovery error. #[derive(Debug, ThisError)] #[error(transparent)] pub struct Error { ///...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { _reserved0: [u8; 0x04], #[doc = "0x04 - Analog Macroblock Identity registers, Flash Status registers"] pub analog_ctrl_status: crate::Reg<analog_ctrl_status::ANALOG_CTRL_STATUS_SPEC>, _reserved1: [u8; 0x04], #[doc = "0x0c - Frequency M...
#![allow(dead_code)] use crate::closure_table; use crate::print::*; use crate::types::*; #[cfg(feature = "gc")] use crate::gc; use core::fmt::Write; #[cfg(feature = "gc")] pub(crate) unsafe fn dump_heap() { print_closure_table(); print_static_roots(); print_heap(); } pub(crate) unsafe fn print_closure_...
use super::development as scintilla_dev; use super::*; use plygui_qt::common::*; use scintilla_sys::*; pub type Scintilla = Member<Control<ScintillaQt>>; #[repr(C)] pub struct ScintillaQt { base: QtControlBase<Scintilla, ScintillaEditBase>, h_command: (bool, SlotSCNotificationPtr<'static>), } impl scintilla...
#![deny(rust_2018_idioms, unsafe_code, missing_docs)] //! This crate defines the API exposed by the connectors to the migration engine core. The entry point for this API is the [MigrationConnector](trait.MigrationConnector.html) trait. mod database_migration_step_applier; mod destructive_change_checker; mod diff; mod...
//! Indexing cargo metadata. use std::collections::{BTreeMap, HashMap, HashSet}; use anyhow::format_err; use anyhow::{Error, Result}; use cargo_metadata::Node; use cargo_metadata::Package; use cargo_metadata::PackageId; use cargo_metadata::{Metadata, NodeDep}; use itertools::Itertools; use serde::Deserialize; use ser...
mod list_item; pub use list_item::*; mod check_list_item; pub use check_list_item::*; mod radio_list_item; pub use radio_list_item::*; mod list_index; pub use list_index::ListIndex; mod selected_detail; pub use selected_detail::{IndexDiff, SelectedDetail}; mod action_detail; pub use action_detail::ActionDetail; m...
use super::bsr::*; use crate::api::*; use crate::def::*; use crate::tracer::*; /***************************************************************************** * SBAC structure *****************************************************************************/ #[derive(Default)] pub(crate) struct EvcdSbac { pub(crate) ...
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 mod mngtok; use std::collections::HashSet; use std::process::Command; use std::rc::Rc; use std::sync::atomic::Ordering; use std::time::{Duration, Instant}; use log::{debug, error, info, warn}; use nix::{s...
use crate::{NNSplitLogic, NNSplitOptions}; use ndarray::prelude::*; use std::error::Error; use tract_onnx::prelude::*; struct TractBackend { model: TypedModel, n_outputs: usize, length_divisor: usize, } impl TractBackend { fn new(model: TypedModel, length_divisor: usize) -> TractResult<Self> { ...
use crate::sys::{MemoryType, Pages, TableType}; use std::ptr::NonNull; use std::sync::Arc; use target_lexicon::PointerWidth; use wasmer_compiler::{Target, Tunables}; use wasmer_vm::MemoryError; use wasmer_vm::{ LinearMemory, LinearTable, Memory, MemoryStyle, Table, TableStyle, VMMemoryDefinition, VMTableDefinit...
//! Implementation of basic Stochastic Average Gradient (SAG) //! //! The Stochastic Averaged Gradient Descent as described in the paper: //! "Minimizing Finite Sums with the Stochastic Average Gradient" (2013, 2016) //! M.Schmidt, N.LeRoux, F.Bach //! //! f(x) = 1/n ∑ fᵢ(x) , with fᵢ such that there exist a consta...
extern crate proc_macro; use proc_macro::TokenStream; use proc_macro2::Literal; use quote::quote; use syn::parse::{Parse, ParseStream, Result}; use syn::{parse_macro_input, Ident, Token}; struct Groups(proc_macro2::TokenStream); struct Group(proc_macro2::TokenStream); struct Instruction(proc_macro2::TokenStream); s...
//! Rust bindings to [RenderDoc], a popular graphics debugger. //! //! [RenderDoc]: https://renderdoc.org/ //! //! RenderDoc is a free and open source graphics debugging tool. RenderDoc allows game developers //! to take frame captures of their applications, replay them, examine the graphics pipeline state, //! and pot...
//! ## Environment //! //! `environment` is the module which provides Path and values for the system environment /** * MIT License * * termscp - Copyright (c) 2021 <NAME> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "S...
use std::prelude::v1::*; use std::collections::HashMap; use errors::VMError; use value::Value; use object::Object; use object_info::{ObjectInfo, ObjectHandle, TypedObjectHandle}; use static_root::StaticRoot; use call_stack::CallStack; use errors; /// An object pool that provides the backing object storage for executor...
#![cfg(feature = "fruits")] mod catch_object; mod difficulty_object; mod fruit_or_juice; mod gradual_difficulty; mod gradual_performance; mod movement; mod pp; mod slider_state; use catch_object::CatchObject; use difficulty_object::DifficultyObject; use fruit_or_juice::FruitOrJuice; pub use gradual_difficulty::*; pub...
use crate::play::{Play, PlayKind}; use crate::cards::Card; use crate::Cards; // TODO: since this entire module is based off of this one file, it should be refactored heavily pub fn all_plays(cards: Cards) -> Vec<Play> { let mut plays = Vec::new(); let mut rank_blocks = RankBlocks::new(cards); plays.push(...
use display::Display; use memory::Memory; use rand::Rng; use std::{io::Result, time::Instant}; use std::{thread, time::Duration}; use crate::display; use crate::memory; pub struct Chip8 { memory: memory::Memory, display: display::Display, st_cooldown: Instant, } impl Chip8 { pub fn new() -> Self { ...
//! This module contains a unified Predicate structure for IOx qieries //! that can select and filter Fields and Tags from the InfluxDB data //! mode as well as for arbitrary other predicates that are expressed //! by DataFusion's `Expr` type. use std::collections::BTreeSet; use arrow_deps::{ datafusion::logical_...
#![feature(test)] extern crate test; use std::{ collections::VecDeque, fs::File, io::{BufRead, BufReader}, mem::swap, }; fn parse_input<I: Iterator<Item = String>>(mut lines: I) -> ([u8; 512], VecDeque<VecDeque<u8>>) { let algorithm: [u8; 512] = lines.next().unwrap().as_bytes().try_into().unwrap()...
use crate::{ kernel::kernel, proc::Cpu, riscv::{intr_get, intr_off, intr_on}, }; use core::cell::UnsafeCell; use core::marker::PhantomData; use core::ops::{Deref, DerefMut}; use core::ptr; use core::sync::atomic::{spin_loop_hint, AtomicPtr, Ordering}; /// Mutual exclusion lock. pub struct RawSpinlock { ...
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT use anyhow::Result; use serde::{Deserialize, Serialize}; use serde_json::Value; use std::{ collections::HashMap, fs, io::{BufRead, BufReader}, path::PathBuf, process::{...
// 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 ...
use crate::firewall; use crate::network::types; use iptables; use iptables::IPTables; use log::debug; use std::error::Error; // NAT constant for iptables const NAT: &str = "nat"; const PRIV_CHAIN_NAME: &str = "NETAVARK_FORWARD"; const FILTER: &str = "filter"; // Iptables driver - uses direct iptables commands via th...
use alloc::boxed::Box; use alloc::sync::Arc; use alloc::vec::Vec; use core::slice; use async_trait::async_trait; use hashbrown::{HashMap, HashSet}; use spin::Mutex; use naive::ep_server::EP_SERVER; use naive::lmp::LmpListener; use naive::objects::{CapSlot, EpRef}; use naive::path::{Path, PathBuf}; use naive::rpc::{se...
//! Module defining script options. use std::ops::{Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, Not, Sub, SubAssign}; #[cfg(feature = "no_std")] use std::prelude::v1::*; /// A type representing the access mode of a function. #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] pub enum FnAccess { /// P...
use crate::{ config::{element::WidgetDefinition, window_definition::WindowName}, eww_state::*, value::AttrName, }; use anyhow::*; use gtk::prelude::*; use itertools::Itertools; use std::collections::HashMap; use std::process::Command; use widget_definitions::*; pub mod widget_definitions; pub mod widget_n...
use log::{debug, trace}; use rustc_middle::mir::*; use rustc_mir_dataflow::ResultsVisitor; use rustc_span::Span; use super::{ analysis::{FlowAnalysis, FlowDomain}, FlowResults, }; use crate::{ block_timer, indexed::{ impls::{LocationSet, PlaceIndex, PlaceSet}, IndexedDomain, }, mir::utils::PlaceExt...
// 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 // disclai...
use super::*; use enumx_derive::Exchange; #[ derive( Exchange, Debug )] enum ReadU32Error { IO( std::io::Error ), Parse( std::num::ParseIntError ), } fn read_u32( filename: &'static str ) -> Result<u32, Cex<ReadU32Error>> { use std::io::Read; let mut f = std::fs::File::open( filename ).may_throw...
#![warn(missing_docs)] #![warn(missing_doc_code_examples)] //! # Compresstimator //! //! Simple file compressibility estimation //! use std::fs::File; use std::io::{self, Read, Seek, SeekFrom, Write}; use std::path::Path; use lz4::EncoderBuilder; #[derive(Debug, Default)] struct WriteCount { written: u64, } im...
use std::collections::HashMap; // The machine ------------------------------------------------------------------ // The register set. // The Operations works on a slice. // A vector to host the slice is allocated at machine start. type Registers = [i64]; // Type of all Operation. // All operations returned the delta...
use ::actix::prelude::{Actor, Supervised, Handler, Context, SystemService, Message, ActorFuture, WrapFuture, ResponseActFuture}; use ::regex::Regex; use ::futures::{future, Future}; use ::encoding::codec::japanese::Windows31JEncoding as ShiftJS; use ::encoding::types::{Encoding, DecoderTrap}; use ::{HttpDate, Response...
/* Portions Copyright 2019-2021 ZomboDB, LLC. Portions Copyright 2021-2022 Technology Concepts & Design, Inc. <<EMAIL>> All rights reserved. Use of this source code is governed by the MIT license that can be found in the LICENSE file. */ use crate::datum::time::USECS_PER_SEC; use crate::{direct_function_call_as_datu...
use crate::artos::common::{Error, ErrorKind}; use crate::artos::common::{FlowController, FlowType}; use crate::artos::message::server::{LogEntry, LogValueType, NULL_UUID}; use crate::artos::server::channel::{Context, ServerRole, ServerState}; use crate::artos::server::replication::{NullReplicationProtocol, ReplicationP...
use std::{io, mem}; use std::sync::{Arc, Mutex, Once}; use marslander::cartesian::{Line, LineValue, Point2, Vector2}; use marslander::lander::LanderState; use marslander::physics::{Particle, Speed}; use crate::env::is_prod; macro_rules! parse_input { ($x:expr, $t:ident) => ($x.trim().parse::<$t>().unwrap()) } typ...
use quote::quote; use syn::{ punctuated::Punctuated, Error, FnArg, ItemFn, Pat, PatIdent, Path, ReturnType, Token, Type, TypePath, }; pub(crate) fn node_test(input: ItemFn) -> Result<(ItemFn, NodeReturn, NodeCtx), Error> { let ret = NodeReturn::new(&input)?; ret.node_test_checks(&input)?; let ctx ...
// pathfinder/examples/canvas_glutin_minimal/src/main.rs // // Copyright © 2019 The Pathfinder Project Developers. // // 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 // ...
use alloc::vec::Vec; use core::ops::Range; use device_tree::{DeviceTree as DeviceTreeInner, PropError}; use crate::{DeviceError, DeviceResult, PhysAddr, VirtAddr}; pub use device_tree::{util::StringList, Node}; /// A unified representation of the `interrupts` and `interrupts_extended` /// properties for any interru...
use crate::lang::scope::Scope; use crate::lang::errors::{CrushResult, argument_error}; use crate::lang::{value::Value, r#struct::Struct}; use crate::lang::command::CrushCommand; use crate::lang::execution_context::{ExecutionContext, This}; use crate::lang::argument::{column_names, Argument}; use crate::lang::execution_...
// Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). #![deny(warnings)] // Enable all clippy lints except for many of the pedantic ones. It's a shame this needs to be copied and pasted across crates, but there doesn't appear to be a way to...
use crate::pager; use crate::types::response; use crate::types::{Block, BlockStatsInfo, BlockStatsResponse, BlocksList}; use bitcoin::hashes::hex::FromHex; use bitcoincore_rpc::RpcApi; use bitcoincore_rpc_json as json; use cached::proc_macro::cached; use json::bitcoin; use std::hash::{Hash, Hasher}; use std::time::Dura...
use std::fs::{self, File}; use std::io::{ErrorKind as IoErrorKind, Read}; use std::path::PathBuf; use std::{mem, time}; use futures::future::*; use futures::sync::mpsc::SendError; use futures::{Async, Future, Poll, Sink, Stream}; use hyper::header::Headers; use hyper::server::{Request, Response, Service}; use hyper::...
use crate::config_file::JuliaupConfig; use crate::config_file::JuliaupConfigChannel; use crate::config_file::JuliaupConfigVersion; use crate::get_bundled_julia_full_version; use crate::jsonstructs_versionsdb::JuliaupVersionDB; use crate::utils::get_arch; use crate::utils::get_juliaserver_base_url; use crate::utils::get...
// This file is dual licensed under the terms of the Apache License, Version // 2.0, and the BSD License. See the LICENSE file in the root of this repository // for complete details. use crate::asn1::{big_asn1_uint_to_py, PyAsn1Error}; use crate::x509; use crate::x509::ocsp; use std::sync::Arc; #[ouroboros::self_refe...
//! Generate human readable digests for UUIDs //! //! Based on https://github.com/zacharyvoase/humanhash //! Should be compatible extern crate uuid; use uuid::Uuid; /// Class for custom humanhashers pub struct HumanHasher { words: Wordlist, } /// List of 256 strings usable for human readable hash digests pub typ...
// Copyright 2018 The Exonum Team // // 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 quick_xml::{events::Event, Reader}; use reqwest::header::{HeaderMap, DATE}; use std::collections::HashMap; use super::auth::*; use super::errors::Error; use super::oss::OSS; #[derive(Clone, Debug)] pub struct ListBuckets { prefix: String, marker: String, max_keys: String, is_truncated: bool, n...
use traits::FloatEFT; #[inline] pub fn split<T: FloatEFT>(a: T) -> (T, T) { let tmp = a.clone() * T::split_coef(); let x = tmp.clone() - (tmp - a.clone()); (x.clone(), a - x) } #[inline] pub fn safesplit_branch<T: FloatEFT>(a: T) -> (T, T) { // unsafe when usp(a) >= 2^997 (a >= 0x1.FFFFFF8000000p+1022...
use bitflags::bitflags; use wasm_bindgen::UnwrapThrowExt; use crate::event::{impl_event_target_traits, impl_try_from_event_target}; bitflags! { pub struct CompareDocumentPosition: u16 { const DISCONNECTED = 0b00000001; const PRECEDING = 0b00000010; const FOLLOWING = 0b00000100; con...
//! This crate is based on [seccomp_sys](https://crates.io/crates/seccomp-sys) and provides //! a higher level wrapper for [libseccomp](https://github.com/seccomp/libseccomp). //! //! //! Example usage: //! //! ```rust,no_run //!extern crate seccomp; //!extern crate libc; //! //!use seccomp::*; //! //!fn main() { //! ...
use crate::element::DamlPackage; use crate::error::{DamlLfError, DamlLfResult}; use crate::lf_protobuf::com::daml::daml_lf::archive_payload::Sum; use crate::lf_protobuf::com::daml::daml_lf::ArchivePayload; use crate::lf_protobuf::com::daml::daml_lf_1; use crate::lf_protobuf::com::daml::daml_lf_1::module::Name; use crat...
use std::convert::TryFrom; use std::sync::Arc; use tracing::debug; use once_cell::sync::OnceCell; use fluvio_socket::{AllMultiplexerSocket, SharedAllMultiplexerSocket}; use fluvio_future::task::run_block_on; use fluvio_future::native_tls::AllDomainConnector; use semver::Version; use crate::config::ConfigFile; use cr...
use libsynchro::{SynchroConnection, Event, Command}; use std::collections::HashMap; use std::net::SocketAddr; use std::sync::{Arc, Mutex}; use futures_channel::mpsc; use async_std::prelude::*; use async_std::net::{TcpListener, TcpStream}; use async_std::task; struct ClientInfo { name: Option<String>, file_s...
use sdl2::{ event::Event, image::{InitFlag, LoadSurface, Sdl2ImageContext}, keyboard::Keycode, pixels::Color, rect::{Point, Rect}, render::{BlendMode, Canvas, RenderTarget, Texture, TextureCreator}, surface::Surface, ttf::{Font, Sdl2TtfContext}, video::Window, VideoSubsystem, }; ...
/* * Copyright (c) 2021 Arm Limited. * * SPDX-License-Identifier: MIT * * 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 ...
// Copyright (c) 2020 Via Technology Ltd. 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...
use std::collections::HashMap; use std::time::Duration; use reqwest::RequestBuilder; use reqwest::{self, Url, Method, StatusCode}; use reqwest::header::{HeaderMap, HeaderValue, USER_AGENT, CONTENT_TYPE, REFERER}; use crate::database::Database; use crate::error::CouchError; use crate::types::system::{CouchResponse, Couc...
use iox_catalog::{ create_or_get_default_records, interface::Catalog, mem::MemCatalog, postgres::{PostgresCatalog, PostgresConnectionOptions}, }; use observability_deps::tracing::*; use snafu::{OptionExt, ResultExt, Snafu}; use std::{ops::DerefMut, sync::Arc, time::Duration}; #[derive(Debug, Snafu)] pu...
#![feature(test)] #![allow(soft_unstable)] #[macro_use] extern crate diesel; extern crate test; use diesel::prelude::*; #[derive(diesel::Insertable)] #[table_name = "users"] pub struct NewUser<'a> { name: &'a str, hair_color: Option<&'a str>, } impl<'a> NewUser<'a> { pub fn new() -> Self { NewUs...
mod download_utils; use std::hash::Hash; use std::collections::{HashSet, HashMap}; use std::ptr::null; use frankenstein::{Api, GetFileParams, Message, SendMessageParams, TelegramApi}; use frankenstein::api_params::{SendMessageParamsBuilder, GetFileParamsBuilder, InputFile}; use rusqlite::{Connection, Result, params, S...
// This file is part of rust-web/twig // // For the copyright and license information, please view the LICENSE // file that was distributed with this source code. //! Extension loader. use extension::api::{self, Extension}; use std::collections::HashMap; use engine::Engine; use engine::error::ExtensionRegistryError; ...
/* * BSD 3-Clause License * * Copyright (c) 2021, <NAME> * All rights reserved. * * 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...
use crate::{ audio_key::{AudioKey, AudioKeyDispatcher}, connection::{ codec::{ShannonDecoder, ShannonEncoder, ShannonMessage}, Credentials, Transport, }, error::Error, item_id::{FileId, ItemId}, mercury::{MercuryDispatcher, MercuryRequest}, util::deserialize_protobuf, }; use ...
//! Simple wrapper for const generics. //! # Usage //! Currently 'the type of const parameters must not depend on other generic parameters' (E0770). //! ```compile_fail //! struct A<N, const C : N>(N); //! ``` //! With this crate we can solve this by wrapping cosnt generic. //! ``` //! # use core::mem; //! # use core::...
#![allow(unsafe_code)] use super::str_buf::StrBuf; use crate::utf8::CharEncodeUtf8; pub struct ToStr<T>(pub T); impl ToStr<&str> { pub const fn output_len(&self) -> usize { self.0.len() } pub const fn const_eval<const N: usize>(&self) -> StrBuf<N> { StrBuf::from_str(self.0) } } impl...
// 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 { failure::Fail, fdio::fdio_sys, fuchsia_async as fasync, fuchsia_runtime as runtime, fuchsia_zircon as zx, futures::{ io::{sel...
use wasm_bindgen::prelude::*; use hound::{WavSpec, SampleFormat}; use rustfft::{FftPlanner, num_complex::Complex}; use std::io::Cursor; const AUDACITY_MAX_FREQ: u32 = 8000; #[wasm_bindgen] pub struct Image { data: Vec<u8>, pub height: usize, pub width: usize, } fn rgb_to_luma(r: u8, g: u8, b: u8, a: u8) ...
use futures::executor::block_on; use libp2prs_core::{ identity::Keypair, multiaddr::Protocol, transport::{memory::MemoryTransport, upgrade::TransportUpgrade}, }; use libp2prs_core::{Multiaddr, PeerId}; use libp2prs_gossipsub::{ control::Control as GossipControl, gossipsub::{Gossipsub, MessageAuthent...
//! Libary for parsing environment files into an in-memory map. //! //! ```rust //! extern crate envfile; //! //! use envfile::EnvFile; //! use std::io; //! use std::path::Path; //! //! fn main() -> io::Result<()> { //! let mut envfile = EnvFile::new(&Path::new("examples/test.env"))?; //! //! for (key, valu...
//! The Watch API provides an event-based interface for asynchronously monitoring changes to keys. //! //! # Examples //! //! Watch key `foo` changes //! //! ```no_run //! //! use etcd_client::*; //! use futures::stream::StreamExt; //! //! fn main() -> Result<()> { //! smol::block_on(async { //! let client ...
use std::fmt::{self, Debug}; use async_trait::async_trait; use cast_trait_object::dyn_upcast; use crate::graph::{stage, Inlet, Outlet, OutletsShape, Port, SinkShape, Stage, UniformFanOutShape, PORT_DATA}; use crate::{AppData, ProctorResult, SharedString}; /// Fan-out the stream to several streams emitting each incom...
// 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...
use ed25519_dalek::{SecretKey, ExpandedSecretKey}; #[cfg(feature = "server")] use ed25519_dalek::PublicKey; #[cfg(any(feature = "server",feature = "client"))] use serde::Deserialize; #[cfg(any(feature = "server", feature = "client"))] use sha2::{Digest, Sha256}; use std::convert::TryInto; #[cfg(any(feature = "server",f...
// Copyright Amazon.com, Inc. or its affiliates. //! [`Error`] and [`Result`] types for parsing PartiQL. use std::borrow::Cow; use std::fmt::{Debug, Display}; use partiql_ast::ast; use partiql_source_map::location::{LineAndColumn, Located}; use thiserror::Error; /// [`Error`] type for errors in the lexical structur...
use crate::{Real, Vector2}; /// Holds the result of finding the intersect between a line segment and a circle. #[derive(Debug, Copy, Clone)] pub enum CircleCircleIntr<T> where T: Real, { /// No intersects found. NoIntersect, /// One tangent intersect point found. TangentIntersect { /// Hold...
use aliases::{ByteStream}; use bytes::{Buf, Bytes, IntoBuf, LittleEndian}; use futures::{Async, Poll, Stream}; use snap; use std::collections::VecDeque; use std::convert::TryFrom; use std::io; use shared::{crc32c_masked, FrameType}; // special snappy stream magic header const MAGIC: &'static [u8] = b"sNaPpY"; #[deri...
#![doc(html_root_url = "https://docs.rs/reaper-macros/0.1.0")] #![deny(broken_intra_doc_links)] //! This crate is part of [reaper-rs](https://github.com/helgoboss/reaper-rs) and contains a //! [simple attribute macro](attr.reaper_extension_plugin.html) to simplify bootstrapping REAPER //! extension plug-ins. use darli...
//! Demo implementation of WTP consensus rules. //! //! The demo program implements a dual-hash-lock encumbrance with the following form: //! //! > `hash = BLAKE2b_256(preimage_1 || BLAKE2b_256(preimage_2))` //! //! The two preimages are revealed in sequential transactions, demonstrating how WTPs can //! impose constra...
use serde_derive::{Deserialize, Serialize}; pub(crate) use serde_xml_rs::{from_reader, from_str, to_string}; // documentation, element, enum, extension, implementation_note, restriction, EBMLSchema pub(crate) mod custom_serde { pub(crate) mod hexadecimal { use serde::{de::Error as _, Deserialize, Deserial...
use amethyst::core::Transform; use amethyst::core::timing::Time; use amethyst::assets::{AssetStorage}; use amethyst::ecs::{Join, Read, ReadStorage, ReadExpect, System, Write, WriteStorage}; use amethyst::ui::UiText; use utils; use game; use game::components::ui::{ScoreText}; use game::components::gameplay::{BALL_NUM, ...
use std::{collections::HashMap, env::args, ffi::CStr}; use gio::prelude::*; use glib::Sender; use gtk::{prelude::*, TreeIter}; use once_cell::sync::OnceCell; static SENDER: OnceCell<Sender<NetHogsData>> = OnceCell::new(); #[derive(Debug, Clone, Copy)] enum Columns { Pid, User, Program, Device, Se...
mod utils; use wasm_bindgen::prelude::*; // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global // allocator. #[cfg(feature = "wee_alloc")] #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; // Wrap web-sys console log function in a println! style macro macro_rules!...