text
stringlengths
3.09k
13.9k
// Copyright 2020-2021 <NAME> // SPDX-License-Identifier: Apache-2.0 use core::fmt::Display; use core::fmt::Formatter; use core::fmt::Result; use crypto::ciphers::aes::Aes128Gcm; use crypto::ciphers::aes::Aes192Gcm; use crypto::ciphers::aes::Aes256Gcm; use crypto::ciphers::aes_cbc::Aes128CbcHmac256; use crypto::cipher...
//! This module contains the top level netlink header code and attribute parsing. Every netlink //! message will be encapsulated in a top level `Nlmsghdr`. //! //! `Nlmsghdr` is the structure representing a header that all netlink protocols require to be //! passed to the correct destination. //! //! # Design decisions...
//! The interrupt module contains all the interrupt kinds and the function to handle interrupts. use crate::{ cpu::{Cpu, Mode}, csr::*, }; /// All the interrupt kinds. #[derive(Debug)] pub enum Interrupt { UserSoftwareInterrupt, SupervisorSoftwareInterrupt, MachineSoftwareInterrupt, UserTimerI...
//! A simpler implementation of (GcContext)[`::zerogc::GcContext`] //! that doesn't support multiple threads/contexts. //! //! In exchange, there is no locking :) //! //! Also, there is `#![no_std]` support use core::cell::{Cell, UnsafeCell, RefCell}; use core::mem::ManuallyDrop; use core::fmt::{self, Debug, Formatter...
use std::iter::once; type Range = [std::ops::RangeInclusive<i32>; 3]; struct Grid { on: Vec<Range>, } impl Grid { fn set(&mut self, range: Range, val: bool) { if val { let mut cur_vec = vec![range]; for on in self.on.iter().cloned() { let mut new_cur_vec = Vec:...
use crate::human_size::Bytes; use rusoto_core::region::Region; use slog::{o, warn, Logger}; use sloggers::types::Severity; use sloggers::Build; use std::str::FromStr; const MAX_ASSET_SIZE_DEFAULT: u32 = 10_000_000; const MAX_ASSETS_PER_DOCUMENT_DEFAULT: u32 = 20; fn max_assets_per_document(logger: &Logger) -> u32 { ...
// Copyright 2017 The xi-editor Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
#![feature(asm)] #![feature(const_fn)] #![feature(const_fn_fn_ptr_basics)] #![feature(const_mut_refs)] #![deny(unsafe_op_in_unsafe_fn)] #![deny(unsupported_naked_functions)] #![no_std] #![no_main] #![cfg(target_os = "none")] use r3::{ kernel::{cfg::CfgBuilder, StartupHook, Task}, prelude::*, sync::Mutex, };...
use std::num::{NonZeroU16, NonZeroU32}; use std::str::FromStr; use std::string::ParseError; use crate::app::publisher::PublishingInfo; use structopt::StructOpt; use uom::si::f32::ThermodynamicTemperature; use uom::si::thermodynamic_temperature; use url::Url; #[derive(Debug, StructOpt)] #[structopt( name = "outdoo...
use criterion::{criterion_group, criterion_main, Criterion}; use image::{ImageBuffer, Rgb, RgbImage}; use rand::{prelude::*, thread_rng}; use rayon::prelude::*; use std::sync::{Arc, Mutex}; use std::thread; use crab_rt::camera::Camera; use crab_rt::materials::{Dielectric, Lambertian, Metal}; use crab_rt::objects::Sphe...
use super::node_handle::*; use crate::inner_prelude::*; use crate::query::colfind::CollisionHandler; struct InnerRecurser<'a, 'b, T: Aabb, NN: NodeHandler, KK: CollisionHandler<T = T>, B: Axis> { anchor: DestructuredNode<'a, 'b, T, B>, handler: NN, sweeper: &'a mut KK, prevec: &'a mut PreVec<T>, } imp...
use lazy_static::lazy_static; use std::cmp::max; use crate::{ app::{App, WidgetPosition}, canvas::{drawing_utils::get_variable_intrinsic_widths, Painter}, constants::*, }; use tui::{ backend::Backend, layout::{Constraint, Rect}, terminal::Frame, widgets::{Axis, Block, Borders, Chart, Datas...
extern crate rand; use rand::Rng; use std::fmt::Debug; use std::collections::{HashMap, HashSet}; #[allow(unused_variables)] // Because these are passed without & to some functions, // it will probably be necessary for these two types to be Copy. pub type CellID = u64; pub type CallbackID = u64; enum Cell<'a, T: Deb...
use rand::{Rng, SeedableRng}; use rand::rngs::StdRng; use std::hash::{BuildHasher, BuildHasherDefault, Hash, Hasher}; use crate::minhash::{compute_minhash_similarity, MinHasher, MinHashType}; use crate::minhash::hashers::{SipHasher24BuildHasher}; use rand::distributions::{Distribution, Uniform}; use rand::seq::SliceRa...
use std::convert::TryInto; use std::io; use std::io::{BufRead, BufReader}; use std::num; #[derive(Debug)] pub enum Error { IndexOutOfBounds(usize), PcOutOfBounds(i64), UnknownOpcode { pc: usize, opcode: i64 }, ReadIoError(io::Error), ParseIoError(num::ParseIntError), InvalidParameterMode { inde...
// Copyright (c) 2015, 2016, 2017 <NAME> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, pub...
use serde::Deserialize; use bevy::{prelude::*, reflect::TypeUuid}; use bevy_retrograde::prelude::*; // // Game and level components // /// The current map level the player is in #[derive(Clone)] pub struct CurrentLevel(pub String); impl_deref!(CurrentLevel, String); #[derive(Clone)] pub struct CurrentLevelMusic { ...
//! //! Process command creation and execution //! use std::error::Error; use std::ffi::OsStr; use std::marker; use std::process::Stdio; use crate::pg_errors::{PgEmbedError, PgEmbedErrorType}; use async_trait::async_trait; use log; use tokio::io::{AsyncBufReadExt, AsyncRead, BufReader}; use tokio::process::Child; use ...
#![feature(proc_macro_hygiene)] #[macro_use] extern crate hdk; extern crate hdk_proc_macros; extern crate serde; #[macro_use] extern crate serde_derive; #[macro_use] extern crate serde_json; extern crate holochain_json_derive; use hdk::holochain_core_types::{ dna::entry_types::Sharing, entry::{AppEntryValue, E...
use core::{mem, slice}; use crate::spi::{BinData, UnsafeBin}; use crate::{Bin, DefaultExcessShrink, RcCounter, RcDecResult, RcMeta, RcUtils}; #[repr(C)] pub struct RcData<TCounter: RcCounter> { /// pointer to the data. Note: This is not always the same as the vector data (if you /// slice the rc-data this mig...
use multi_token_standard::{core::MultiTokenCore, metadata::MultiTokenMetadata, Token}; use near_account::Account; use near_internal_balances_plugin::{ InternalBalanceHandlers, SudoInternalBalanceHandlers, TokenId, }; use near_sdk::{ assert_one_yocto, borsh::{self, BorshDeserialize, BorshSerialize}, coll...
// Copyright 2021 Parity Technologies (UK) Ltd. // This file is part of Polkadot. // Polkadot is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any late...
//! Types to parse the actions that triggered a `Build` use serde::{self, Deserialize, Serialize}; use crate::helpers::Class; pub mod causes; pub mod git; pub mod maven; pub mod parameters; pub mod pipeline; /// Trait implemented by specialization of Action pub trait Action {} /// A node of a pipeline #[derive(Ser...
#[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ BankMsg, Binary, Coin, Decimal, Deps, DepsMut, Empty, Env, MessageInfo, Order, Response, StdResult, Uint128, }; use crate::msg::{ExecuteMsg, InstantiateMsg}; use crate::state::{State, STATE}; use cw721::Cw721Execute; use cw721_...
/* This code is part of the WhiteboxTools geospatial analysis library. Authors: Dr. <NAME> Last Modified: 13/09/2018 License: MIT */ /// NMinimizer is can be used to find the 'n' lowest values in a set of values of type T. /// It is useful as an alternative to an approach that would use a priority queue, which /// wou...
// 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, software // distributed ...
mod common; use std::fs::{self, File}; use std::io::{self, BufRead, BufReader, Cursor}; use std::process::Command; use assert_cmd::cargo::CommandCargoExt; use inferno::differential::{self, Options}; use log::Level; use pretty_assertions::assert_eq; use testing_logger::CapturedLog; fn test_diff_folded( infile1: &...
//! Contains the routing control for the `auth` endpoint. use crate::{ database::CoreDbConn, models::{AuthInsert, AuthResponse, AuthValidate}, schema::{ Auth::dsl::{PublicKey as AuthPublicKey, *}, Users::dsl::{PublicKey as UsersPublicKey, *}, }, TIMEOUT_SECONDS, }; use chrono::{Dura...
//! CMAC(Block Cipher-based Message Authentication Code) //! SP 800-38B use crate::{Cipher, CryptoError, Digest, CryptoErrorKind}; use crate::cmac::const_tables::{RB_128, RB_64, RB_32, RB_48, RB_96, RB_160, RB_192, RB_224, RB_256, RB_320, RB_384, RB_448, RB_512, RB_768, RB_1024, RB_2048}; /// CMAC(Block Cipher-b...
use core::fmt::{Result, Write}; use crate::device::cpu::registers::{control_regs}; pub mod registers; bitfield! { pub struct MachineId(u32); get_implementer, _: 31, 24; get_variant, _: 23, 20; get_architecture, _: 19, 16; get_part_number, _: 15, 4; get_revision, _: 3, 0; } enum ImplementerID...
use std::{net, time}; use std::rc::Rc; use futures::Future; use futures::unsync::oneshot; use tokio_core::net::TcpStream; use tokio_core::reactor::Handle; use net2::TcpStreamExt; #[cfg(feature="tls")] use futures::future; #[cfg(feature="tls")] use native_tls::TlsAcceptor; #[cfg(feature="tls")] use tokio_tls::TlsAccept...
use rand::Rng; use rustc_hash::FxHashSet; use std::fs::File; use std::iter::FromIterator; use crate::skk::test_unix::*; use crate::skk::yaskkserv2_make_dictionary::JisyoReader; use crate::skk::*; #[test] fn quote_skk_jisyo_static_test() { let static_not_quote_table = [(r#"abc"#, r#"/abc"#), (r#"ABC"#, r#"/ABC"#)]...
use jtd::Type; #[derive(Debug)] pub struct InferredNumber { min: f64, max: f64, int: bool, } impl InferredNumber { pub fn new() -> Self { Self { min: f64::MAX, max: f64::MIN, int: true, } } pub fn infer(&self, n: f64) -> Self { Self ...
extern crate hashbrown; use std::collections::BinaryHeap; use hashbrown::{HashMap, HashSet}; //use std::time::Instant; use hashbrown::hash_map::DefaultHashBuilder as RandomState; use itertools::Itertools; use crate::io::{ItemId, Time, TrainingSessionId}; use crate::vmisknn::{SessionScore, SessionTime}; use crate::vm...
use warp::crypto::rand::{self, prelude::*}; use warp::multipass::identity::{Identifier, Identity}; use warp::multipass::{Friends, MultiPass}; use warp::pocket_dimension::PocketDimension; use warp::sync::{Arc, Mutex}; use warp::tesseract::Tesseract; use warp_mp_solana::solana::anchor_client::anchor_lang::prelude::Pubkey...
// 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 in the LICENSE-APACHE file or at: // https://www.apache.org/licenses/LICENSE-2.0 //! Data list example (direct representation) //! //! Objec...
#![allow(warnings, unused)] #[allow(clippy::float_cmp)] use image::{ImageBuffer, RgbImage}; use indicatif::ProgressBar; pub mod vec3; pub mod ray; pub mod color; pub mod shapes; pub mod tools; pub mod camera; pub mod material; use vec3::Vec3; use ray::Ray; use color::Color; use shapes::Hitrec; use shapes::Sphere; use ...
use crate::crossover::genome_crossover::Crossover; use crate::genome::fitness_function::FitnessFunction; use crate::mutation::genome_mutation::Mutate; use crate::selection::genome_selection::SelectIndividual; use serde::{Deserialize, Serialize}; use std::fs::File; #[derive(Copy, Clone, Debug, Default, Serialize, Deser...
//! Structs representing the components within Zcash transactions. use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use std::fmt::Debug; use std::io::{self, Read, Write}; use crate::legacy::Script; use super::amount::Amount; pub mod builder; pub trait Authorization: Debug { type ScriptSig: Debug + ...
use neon::prelude::*; use neon::types::Value; use pairing::bls12_381::{Fr, Bls12}; use pairing::{Field, PrimeField, PrimeFieldRepr}; use rand::os::OsRng; use rand::Rng; use std::mem::transmute; use std::io::Cursor; use bellman::{Circuit, ConstraintSystem, SynthesisError}; use sapling_crypto::jubjub::{JubjubEngine,...
//! Code generation //! //! # Generated code //! The generated code consists of a single enum (called by default `Lang`), //! which expose pub(crate)lic method for each of the translation keys. These //! methods returns a `&'static str` where possible, otherwise a `String`. //! //! # Usage //! The code generator is con...
#![deny(missing_docs, missing_debug_implementations)] #![cfg_attr(test, deny(warnings))] #![doc(html_root_url = "https://docs.rs/scoped-mut-tls/0.1.0")] //! Scoped, mutable, thread-local storage //! //! This module provides the ability to generate *scoped* thread-local variables. In this sense, //! scoped indicates th...
pub use super::go::{GoArch, GoOs}; use std::collections::HashMap; #[derive(Debug, Fail)] #[allow(clippy::large_enum_variant)] pub enum ImageSpecError { #[fail(display = "JSON Error: {:?}", _0)] JsonError(serde_json::Error), } /// Image structure. /// /// # Spec /// /// > # Image JSON /// > /// > * Each image ...
use bcm2835::*; use bcm2835::gpio::*; use bcm2835::spio::*; pub mod doodle; pub const RST_PIN: Pin = Pin::PI_GPIO_P1_11; pub const DC_PIN: Pin = Pin::PI_GPIO_P1_22; pub const CS_PIN: Pin = Pin::PI_GPIO_P1_24; pub const BUSY_PIN: Pin = Pin::PI_GPIO_P1_18; pub const WIDTH: usize = 104; pub const HEIGHT: usize = 212; p...
// use crate::peer_store::Behaviour; use crate::{network::FEELER_PROTOCOL_ID, NetworkState}; use ckb_logger::{debug, trace}; use ckb_protocol::{ flatbuffers::FlatBufferBuilder, get_root, Identify as FbsIdentify, IdentifyBuilder as FbsIdentifyBuilder, }; use p2p::{ context::ProtocolContextMutRef, multiad...
// fn fn is_divisible_by(lhs: u32, rhs: u32) -> bool { if rhs == 0 { return false; } lhs % rhs == 0 } fn fizzbuzz(n: u32) { if is_divisible_by(n, 15) { println!("fizzbuzz"); } else if is_divisible_by(n, 3) { println!("fizz"); } else if is_divisible_by(n, 5) { pr...
use log::error; use std::collections::HashSet; use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; use crate::model::error::ApplicationError; use crate::model::mono::Mono; pub trait OmiseRepo { fn new() -> Self; fn get(&self, client_id: &String, omise_id: &String) -> Result<Omise, Appli...
use crate::search_expr::{OperatorNegation, SearchOperator}; use gtk::prelude::*; use relm::Widget; use relm_derive::{widget, Msg}; use std::collections::BTreeSet; const INVALID_SEARCH_STACK_NAME: &str = "invalid-search"; const VALID_SEARCH_STACK_NAME: &str = "valid-search"; #[derive(Copy, Clone)] pub enum CombineOper...
//! Code for transforming test suite configs into something that [`crate::runner`] //! can efficiently use. use std::{collections::HashMap, path::Path, pin::Pin, sync::Arc, time::Duration}; use futures::{Sink, SinkExt}; use itertools::Itertools; use path_slash::PathBufExt; use crate::config::JudgeTomlTestConfig; use...
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT use std::{cell::Cell, ffi::OsStr, iter::once, os::windows::prelude::OsStrExt, ptr}; use windows_sys::Win32::{ Foundation::*, Graphics::Gdi::*, System::Com::*, UI::Window...
use std::io; use std::io::prelude::*; extern crate regex; use regex::{Captures, Regex}; #[derive(Clone)] struct Sue { id: u32, children: Option<u32>, cats: Option<u32>, samoyeds: Option<u32>, pomeranians: Option<u32>, akitas: Option<u32>, vizslas: Option<u32>, goldfish: Option<u32>, ...
// Copyright 2017 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. pub mod sys; use std::fmt::{self, Display}; use std::io::{Read, Write}; use std::net; use std::num::ParseIntError; use std::os::raw::*; use std::str::F...
use std::{ collections::BTreeMap, // i want sorted keys env, error::Error, fs, io::{self, BufRead, Write}, path::PathBuf, process::{self, Command, Stdio}, }; pub(crate) fn db_path() -> PathBuf { #[allow(deprecated)] let home_dir = env::home_dir().expect("home directory should be def...
use std::fs::File; use std::io::prelude::*; use std::path::PathBuf; use std::str; use byteorder::ByteOrder; use byteorder::LittleEndian; use nom::bytes::complete::take; use nom::combinator::map; use nom::multi::many1; use nom::number::complete::le_u16; use nom::IResult; #[derive(Debug)] struct RawRecord<'a> { ta...
use core::identifier::Class; use serde::{ ser, Serialize, }; use crate::error::{Error, Result}; use super::Serializer; /// Serializer used solely to encode octet strings properly. pub(crate) struct PrefixSerializer { pub output: Serializer<Vec<u8>>, pub class: Option<Class>, pub tag: Option<u32>, ...
use std::{collections::VecDeque, fmt::Debug, ops::Range}; use iced::{button, Element}; use plotters::prelude::*; use plotters_iced::{Chart, ChartBuilder, ChartWidget, DrawingBackend}; use crate::{ style, time_manager::{base::TimeBase, unit::VehicleTime, TimeManager}, }; use super::{data_view::View, instrumen...
// Copyright 2019 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. pub mod rate_estimator_bindings; use std::error; use std::fmt; use std::time::Duration; #[derive(Debug)] pub enum Error { InvalidSmoothFactor(f64...
use crate::start_node::ProtoType; use crate::transport::tcp::socketaddr_to_multiaddr; use crypto::x25519::{PrivateKey, PublicKey}; use parity_multiaddr::Multiaddr; use std::collections::HashMap; use std::fs::File; use std::io::{self, BufRead}; use std::net::{Ipv4Addr, SocketAddr}; use std::path::{Path, PathBuf}...
use crate::mass_properties::MassProperties; use crate::math::{Matrix, Point, Real, DIM}; use crate::shape::Tetrahedron; use crate::utils; use num::Zero; impl MassProperties { /// Computes the mass properties of a convex polyhedron. pub fn from_convex_polyhedron( density: Real, vertices: &[Point...
#![allow(dead_code)] use std::{collections::HashMap, collections::VecDeque}; //[a-z] -> a|b|c|d|e..... fn convert_series_to_unions( input_data: &str ) -> String{ let mut result: String = String::new(); let mut bracket_opend: bool = false; let ( mut char_from, mut char_to, mut last_char ): ( char, char, cha...
use log::{info}; use pnet::datalink; use serde::{Serialize, Deserialize}; use serde_json::Value; use std::collections::HashMap; use std::error::Error; use std::process::Command; use std::time::Instant; pub struct Agent { api_endpoint: String, start_time: Instant, client: reqwest::Client, agent_info: Ag...
use crate::RafxResult; use ash::version::DeviceV1_0; use ash::vk; use std::sync::{Arc, Mutex}; struct RafxDescriptorHeapPoolConfig { pool_flags: vk::DescriptorPoolCreateFlags, descriptor_sets: u32, samplers: u32, combined_image_samplers: u32, sampled_images: u32, storage_images: u32, unifor...
extern crate parking_lot; mod key_code; pub use self::key_code::KeyCode; use stdweb::web::{window, EventListenerHandle, IEventTarget}; use stdweb::web::event::{IKeyboardEvent, KeypressEvent}; use stdweb; use std::sync::Arc; use std::collections::hash_map::{Entry, HashMap}; use self::parking_lot::Mutex; quick_error! ...
use std::{cell::RefCell, rc::Rc}; use cursive::views::{DummyView, EditView, HideableView, LinearLayout, ResizedView, SelectView}; use cursive::Cursive; use cursive::View; use log::{error, trace}; use crate::model::Model; use crate::model::{AudioMediator, PlaybackMediator, StateMediator}; use crate::term_ui::dialogs::...
// 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 ...
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
//! YubiHSM2 command codes use super::{Error, ErrorKind}; use serde::{de, ser, Deserialize, Serialize}; /// Command IDs for `YubiHSM 2` operations #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] #[allow(missing_docs)] #[repr(u8)] pub enum Code { Unknown = 0x00, Echo = 0x01, CreateSession = 0...
// Copyright 2015-2021 Swim 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 ...
use std::{ io::Write, pin::Pin, task::{Context, Poll}, }; use actix_codec::Framed; use actix_http::{ body::{BodySize, MessageBody}, error::PayloadError, h1, http::{ header::{HeaderMap, IntoHeaderValue, EXPECT, HOST}, StatusCode, }, Error, Payload, RequestHeadType, Re...
use std::error::Error; use std::fmt; pub mod state_machine; #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub enum ParseError<L, T, E> { /// Generated by the parser when it encounters a token (or EOF) it did not /// expect. InvalidToken { location: L }, /// Generated by the parser when it e...
use crate::controller::DesktopController; use dioxus_core::ScopeState; use wry::application::event_loop::ControlFlow; use wry::application::event_loop::EventLoopProxy; use wry::application::window::Fullscreen as WryFullscreen; use UserWindowEvent::*; pub type ProxyType = EventLoopProxy<UserWindowEvent>; /// Get an i...
//! `mdbook`'s low level rendering interface. //! //! # Note //! //! You usually don't need to work with this module directly. If you want to //! implement your own backend, then check out the [For Developers] section of //! the user guide. //! //! The definition for [RenderContext] may be useful though. //! //! [For D...
use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition; use kube::{ core::object::{HasSpec, HasStatus}, CustomResource, CustomResourceExt, Resource, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; /// Our spec for Foo /// /// A struct with our chosen Kind will be created for us, using ...
//! Utilities for building with rustdoc. use crate::core::compiler::context::Context; use crate::core::compiler::unit::Unit; use crate::core::compiler::CompileKind; use crate::sources::CRATES_IO_REGISTRY; use crate::util::errors::{internal, CargoResult}; use cargo_util::ProcessBuilder; use std::collections::HashMap; u...
// Copyright 2020 <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 writ...
use async_trait::async_trait; use bson::doc; use bytes::Bytes; use mockall_double::double; use mqtt3::{proto::Publication, proto::QoS}; use serde_json::json; use tracing::{debug, error}; #[double] use crate::client::PublishHandle; use crate::{ pump::PumpMessageHandler, upstream::{CommandId, ConnectivityState}...
//! The `hash` module provides functions for creating SHA-256 hashes. use { crate::{sanitize::Sanitize, wasm_bindgen}, borsh::{BorshDeserialize, BorshSchema, BorshSerialize}, sha2::{Digest, Sha256}, std::{convert::TryFrom, fmt, mem, str::FromStr}, thiserror::Error, }; pub const HASH_BYTES: usize =...
use std::rc::Rc; use glutin::event_loop::EventLoop; use glutin::{Context, ContextBuilder, PossiblyCurrent}; use tinygl::wrappers::GlHandle; use crate::image::{gpu::GpuImageData, ImageDim}; use crate::Result; /// txkit internal context for GPU computations #[allow(dead_code)] pub struct GpuContext { /// gl funct...
extern crate cc; extern crate bindgen; use std::env; use std::fs; use std::path::PathBuf; fn link(name: &str, bundled: bool) { use std::env::var; let target = var("TARGET").unwrap(); let target: Vec<_> = target.split('-').collect(); if target.get(2) == Some(&"windows") { println!("cargo:rustc-...
mod disk_session; mod list; mod login; mod logout; mod oauth; mod view; mod watch; mod ws; use crate::prelude::*; use gotham::router::builder::{DefineSingleRoute as _, DrawRoutes as _}; use gotham::state::FromState as _; #[derive(Clone, gotham_derive::StateData)] struct Config { server_address: (String, std::net...
use crate::error::{Error, Result}; use crate::raft; use crate::sql; use crate::sql::engine::{Engine as _, Mode}; use crate::sql::execution::ResultSet; use crate::sql::schema::{Catalog as _, Table}; use crate::sql::types::Row; use crate::storage::{kv, log}; use ::log::{error, info}; use futures::sink::SinkExt as _; use...
use oxide7::SNES; macro_rules! make24 { ($hi:expr, $lo:expr) => { (($hi as u32) << 16) | ($lo as u32) }; ($hi:expr, $mid:expr, $lo:expr) => { (($hi as u32) << 16) | (($mid as u32) << 8) | ($lo as u32) }; } pub fn debug_mode(snes: &mut SNES) { // Debug mode. snes.start_frame(); ...
//! Day 4: //! I encoded the board into row and column indices for each possible ball. //! I took a huge performance penalty for using `method(self)` instead of //! `method(&self)` at first. use crate::prelude::*; use itertools::Itertools; const NUMBER_ENTRIES: usize = 100; const NUMBER_SQ_ROOT: usize = 5; // ------...
use crate::write::WriteFmt; use crate::{Flag, LibraryKind, LinkKind}; use std::ffi::OsString; impl IntoIterator for Flag { type Item = OsString; type IntoIter = iter::Iter; fn into_iter(self) -> Self::IntoIter { let mut flags = Vec::new(); match self { Flag::Help => { ...
// 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 anyhow::Error; use fidl::endpoints::ServerEnd; use fidl_fuchsia_net_oldhttp as oldhttp; use fuchsia_async as fasync; use fuchsia_component::server::Ser...
/* * Copyright 2019 Comcast Cable Communications Management, 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicab...
use core::mem; use hal::blocking::i2c; use hal::blocking::spi; use hal::digital::OutputPin; use generic_array::typenum::consts::*; use generic_array::{ArrayLength, GenericArray}; use Register; /// Releasable describes a type that can be destroyed /// with a released asset. pub trait Releasable { /// The type to...
use std::collections::BTreeMap; use std::error::Error; use abstio::slurp_file; use abstutil::{prettyprint_usize, Tags, Timer}; use geom::{GPSBounds, LonLat, Pt2D}; use map_model::osm::{NodeID, OsmID, RelationID, WayID}; // References to missing objects are just filtered out. // Per https://wiki.openstreetmap.org/wiki...
use seed::{prelude::*, *}; use std::borrow::Cow; use std::mem; use wasm_bindgen::JsCast; use web_sys::{ self, console::{log_1, log_2}, File, FormData, }; pub const TITLE: &str = "Example E"; pub const DESCRIPTION: &str = "Fill form and click 'Submit` button. Server echoes the form back. See console log...
use super::{Mapping, Path, Stash, Vec}; use object::elf::{ELFCOMPRESS_ZLIB, SHF_COMPRESSED}; use object::read::elf::{CompressionHeader, FileHeader, SectionHeader, SectionTable, Sym}; use object::read::StringTable; use object::{BigEndian, Bytes, NativeEndian}; use std::io::Cursor; #[cfg(target_pointer_width = "32")] ty...
use thiserror::Error; #[derive(Debug, Error, PartialEq)] pub enum Error { /// Indicates an error with Unknown info. #[error("Unknown type")] ErrUnknownType, /// Indicates the scheme type could not be parsed. #[error("unknown scheme type")] ErrSchemeType, /// Indicates query arguments are ...
//! Implementation of infinite continued fractions use super::block::{Block, DualBlock}; use super::simple::ContinuedFraction; use crate::traits::WithUnsigned; use num_integer::Integer; use num_traits::{Num, NumRef, RefNum}; use core::ops::{Add, AddAssign}; use core::iter::IntoIterator; /// Represents a simple contin...
use crate::beacon_node_fallback::{BeaconNodeFallback, RequireSynced}; use crate::http_metrics::metrics; use environment::RuntimeContext; use eth2::types::StateId; use futures::future::FutureExt; use parking_lot::RwLock; use slog::Logger; use slog::{debug, trace}; use slot_clock::SlotClock; use std::ops::Deref; use std:...
#[macro_use] extern crate clap; extern crate exitfailure; extern crate failure; extern crate msgpack_simple; extern crate quicli; extern crate regex; extern crate rpassword; extern crate sodiumoxide; use msgpack_simple::{MsgPack, MapElement}; use quicli::prelude::*; use regex::Regex; use sodiumoxide::crypto::secretbox...
//! Posix Message Queue functions //! //! [Further reading and details on the C API](http://man7.org/linux/man-pages/man7/mq_overview.7.html) use crate::Result; use crate::errno::Errno; use libc::{self, c_char, c_long, mqd_t, size_t}; use std::ffi::CString; use crate::sys::stat::Mode; use std::mem; libc_bitflags!{ ...
use bevy::math; use bevy::{prelude::*, render::camera::Camera}; // use bevy_tiled_prototype::level; use super::level; use bevy_tiled_prototype::TiledMapCenter; pub(crate) fn intersect_dist(shape: &level::CollisionShape, rect: &math::Rect<f32>) -> Vec2 { match shape { level::CollisionShape::Rect(shape) => {...
use crate::*; pub struct Edges { program: core::Program, translation_buffer: VertexBuffer, direction_buffer: VertexBuffer, cylinder_index_buffer: core::ElementBuffer, cylinder_vertex_buffer: VertexBuffer, index_pairs: std::collections::HashSet<(usize, usize)>, no_edges: u32, tube_radiu...
use size_hint; use Itertools; use std::mem::replace; use std::fmt; /// Head element and Tail iterator pair /// /// `PartialEq`, `Eq`, `PartialOrd` and `Ord` are implemented by comparing sequences based on /// first items (which are guaranteed to exist). /// /// The meanings of `PartialOrd` and `Ord` are reversed so ...
//! The unix fiber implementation has some platform-specific details //! (naturally) but there's a few details of the stack layout which are common //! amongst all platforms using this file. Remember that none of this applies to //! Windows, which is entirely separate. //! //! The stack is expected to look pretty stand...
// Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 use crate::{ common::types::{CliError, CliTypedResult}, genesis::git::from_yaml, }; use aptos_config::config::HANDSHAKE_VERSION; use aptos_crypto::{ed25519::Ed25519PublicKey, x25519}; use aptos_types::{ chain_id::ChainId, network_address::{D...