text
stringlengths
3.09k
13.9k
pub mod lexer; pub mod parser; pub mod token; pub mod opcode; pub mod cond; pub mod register; pub mod immediate; pub mod shift; pub mod psrf; pub mod cpn; pub mod label; use crossterm::{QueueableCommand, style::{self, Stylize}}; use lexer::Lexer; use opcode::OpCode; use token::{Token, TokenType}; use label::Label; u...
use crate::bme280::BME280Config; use crate::dht22::DHT22Config; use crate::dht22_expander::DHT22ExpanderConfig; use crate::ds18::DS18Config; use crate::gpio::GPIOConfig; use crate::mcp23017::MCP23017Config; use crate::mcp23017_input::MCP23017InputConfig; use crate::pca9685::PCA9685Config; use crate::Result; use alloy::...
use vm::FuncData; use vm::Block; use std::collections::HashMap; use std::collections::HashSet; pub type Dominators = HashSet<Block>; pub type AllDominators = HashMap<Block, Dominators>; pub type DominanceFrontier = HashSet<Block>; pub type DominanceFrontiers = HashMap<Block, DominanceFrontier>; pub fn compute_domina...
use crate::errors::SectionExceptionStreamError; use crate::minidump_format::*; use crate::minidump_writer::{CrashingThreadContext, DumpBuf, MinidumpWriter}; use crate::sections::MemoryWriter; type Result<T> = std::result::Result<T, SectionExceptionStreamError>; #[allow(non_camel_case_types, unused)] #[repr(u32)] enum...
// Copyright 2019 Zhizhesihai (Beijing) Technology 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 a...
// Copyright 2022 slashook Developers // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according t...
use bytes::{Buf, BytesMut}; use failure::Error; use lazy_static::lazy_static; use tokio_util::codec::{Decoder, Encoder}; #[cfg(test)] use bytes::BufMut; use crate::net::operation::Operation; #[cfg(test)] use crate::net::operation; use super::{ encdec, error::CodecError, header::{ Header, ...
use std::{collections::HashMap, collections::HashSet, sync::Arc, time::Instant}; use tokio::sync::{Mutex, RwLock}; use crate::{ build_events::hydrated_stream, buildozer_driver::Buildozer, config::Config, index_table, }; use self::{ command_line_runner::ExecutionResult, process_user_defined_actions::UserD...
use prometheus::HistogramVec; use std::time::Instant; /// `HistogramTimer` alternative that allows setting label values incrementally. /// /// Oftentimes we measure latency in a `HistogramVec` where we do not know all /// label values when starting the timer. This can usually be addressed in /// synchronous code by re...
use clams::console::ask_for_confirmation; use clap::{App, Arg, ArgMatches, SubCommand}; use hubcaps::{Credentials, Github}; use hubcaps::issues::{Issue, IssueOptions}; use std::env; use std::ffi::OsString; use std::fs::File; use std::io::Read; use std::path::{Path, PathBuf}; use std::process::Command; use tempfile::Nam...
use super::{ trace_reader::{resolve_trace_name, TraceReaderBackend}, trace_stream::{substreams_data, Substream, TraceStream, SUBSTREAM_COUNT}, }; use crate::{trace::lexical_key::LexicalKey128, util::get_num_cpus}; use capnp::{message, serialize_packed}; use owning_ref::{OwningRef, RcRef}; use rocksdb::{ColumnFa...
#![feature(custom_attribute)] extern crate serde; extern crate serde_json; #[macro_use] extern crate serde_derive; use uuid::Uuid; /// This enum represents various keys which should /// exist in our database. They each have a namespace /// parameter `ns`, which indicates a common "root" /// shared by all data for thi...
use env_logger; use std::env; use std::error::Error; use std::thread; use std::time::Duration; use diesel::{Connection, PgConnection}; use dotenv::dotenv; use env_logger::Env; use getopts::Options; use log::{debug, error, info}; use read_rust::categories::Categories; use read_rust::mastodon::Mastodon; use read_rust:...
use std::num::NonZeroU32; use std::sync::mpsc; use std::sync::mpsc::Receiver; use std::thread; use crate::high_level_fighter::HighLevelFighter; use crate::renderer::app::state::InvulnerableType; use crate::renderer::camera::Camera; use crate::renderer::draw::draw_frame; use crate::renderer::wgpu_state::WgpuState; ///...
/** * 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 applica...
//! Outputs which elements draw to. use std::fmt::{Display, Write}; use unicode_width::UnicodeWidthChar; use crate::{Cursor, Style, Vec2}; /// An output to which elements draw themselves. /// /// See [`Ext`] for some higher-level methods on outputs. pub trait Output { /// Get the size of the output. /// ...
#![no_main] #![no_std] use clock_frequency_measurement as _; // global logger + panicking-behavior + memory layout use clock_frequency_measurement::hal; use hal::rcc::{Enable, Reset}; use hal::stm32; fn configure_core_timer(timer_core: stm32::TIM14, rcc: &mut hal::rcc::Rcc) -> stm32::TIM14 { stm32::TIM14::enable(...
use std::cell; use std::mem; use gc::{GcPtr, Trace, NullTrace}; use crate::{Gc, GcStore}; pub unsafe trait Reroot<'root> { type Rerooted: ?Sized + 'root; } pub unsafe fn reroot<'root, T>(data: GcPtr<T>) -> GcPtr<T::Rerooted> where T: Reroot<'root> + ?Sized, T::Rerooted: Trace, { let ptr: GcPtr<T::Re...
use std::io::Read; use serde::de::Deserialize; use serde::Serialize; use rocket::http::{Accept, ContentType, HeaderMap, QMediaType, Status}; use rocket::outcome::Outcome::*; use rocket::request::{self, FromRequest, Request}; use rocket::response::{self, Responder, Response}; use rocket::{ data::{Data, FromData, O...
// An item is line of text that read from `find` command or stdin together with // the internal states, such as selected or not use ansi::{ANSIParser, AnsiString}; use field::*; use regex::Regex; use std::borrow::Cow; use std::cmp::Ordering; use std::default::Default; use std::sync::Arc; // An item will store everyth...
#![warn(missing_docs)] //! Defines the way our files are stored use lazy_static::lazy_static; use mla::{config::ArchiveWriterConfig, ArchiveReader, ArchiveWriter, Layers}; use std::{ ffi::OsString, fs::{File, OpenOptions}, io::{self, BufReader, BufWriter, ErrorKind, Write}, path::{Path, PathBuf}, }; u...
//! ATA PIO mode driver: https://wiki.osdev.org/ATA_PIO //! Slow disk transfer supported by all ATA drives. //! This driver only supports primary ATA bus and only the first drive. use cpuio::{inb, inw, outb}; use super::error; pub const SECTOR_SIZE: usize = 0x200; const PORT_DATA: u16 = 0x1F0; const PORT_SECCOUNT: ...
use anyhow::Result; use clap::{crate_description, crate_name, crate_version, App, AppSettings, Arg}; use reqwest::multipart::{Form, Part}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::fs; use std::fs::OpenOptions; use std::io; use std::io::{Read, Write}; use std::io::{Seek, SeekFrom}; u...
//! The `tpu` module implements the Transaction Processing Unit, a //! multi-stage transaction processing pipeline in software. use crate::bank::Bank; use crate::banking_stage::BankingStage; use crate::blocktree::Blocktree; use crate::broadcast_service::BroadcastService; use crate::cluster_info::ClusterInfo; use crate...
use crate::state::{Waiter, AcquireStep, Permits}; use std::cell::UnsafeCell; use std::marker::{PhantomPinned, PhantomData}; use crate::{Semaphore, SemaphoreGuard, SemaphoreGuardArc}; use std::sync::Arc; use std::panic::{UnwindSafe, RefUnwindSafe}; use std::fmt::{Debug, Formatter}; use std::{fmt}; use std::task::{Contex...
use anyhow::Result; use http_types::cookies::SameSite; use std::cell::RefCell; use std::convert::TryFrom; use wasmtime::Linker; use wasmtime_wasi::WasiCtx; witx_bindgen_wasmtime::import!({ paths: ["crates/runtime/witx/functions.witx"], async: ["request::body"] }); type Tables = functions::FunctionsTables<Host...
//! automation_tasks_rs for cargo_crev_web_admin use cargo_auto_lib::*; // use unwrap::unwrap; /// automation_tasks_rs for cargo_crev_web_admin fn main() { exit_if_not_run_in_rust_project_root_directory(); // get CLI arguments let mut args = std::env::args(); // the zero argument is the na...
#![allow(dead_code)] //! Standard clipboard formats. //! //! Header: Winuser.h //! //! Description is taken from [Standard Clipboard Formats](https://msdn.microsoft.com/en-us/library/windows/desktop/ff729168%28v=vs.85%29.aspx) use crate::{SysResult, Getter, Setter}; use winapi::um::winuser; ///A handle to a bitmap (...
#![allow(unused)] use std::path::Path; use clap::Parser; use serde_derive::Deserialize; use serde_derive::Serialize; pub const DEFAULT_READ_AGENT_TIMEOUT_SECONDS: u64 = 20; pub const DEFAULT_CONNECT_TARGET_RETRY: u16 = 2; pub const DEFAULT_CONNECT_TARGET_TIMEOUT_SECONDS: u64 = 20; pub const DEFAULT_TARGET_STREAM_SO_...
use std::collections::HashMap; use std::fmt::Debug; use std::path::Path; use std::process::Command; use clap::Clap; use cpp_demangle::Symbol; use defs::ProcessInfo; use object::Object; use process_ext::ProcessExt; use std::string::ToString; use tracing::{debug, warn}; use tracing_subscriber; mod breakpoint; mod cli; ...
//! Containers for several elements. //! //! # Which 1D layout to use? //! //! Toon's 1D container, [`Container1D`], can use multiple [layouts](Layout1D) to draw its elements. //! //! - [`Static`] gives each element as much space as it wants, and any extra space is left blank. //! - [`Stretch`] gives all the elements e...
// Copyright 2018 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 chromiumos.LICENSE file. use std; use std::fmt; use std::io; use std::io::{ErrorKind, Read, Write}; use std::mem; use std::ops::{Deref, DerefMut}; use std::string::S...
use crate::{ config::Config, data::{Id, IdRef, Kind, Navigator}, io, }; use color_eyre::{eyre::eyre, Result, Section, SectionExt}; use console::{style, Style}; use std::{ fs::File, io::ErrorKind, path::{Path, PathBuf}, process::Command as Proc, }; pub(crate) fn current(color: String) -> boo...
use std::collections::hash_map::DefaultHasher; use std::collections::HashSet; use std::collections::VecDeque; use std::fs; use std::hash::{Hash, Hasher}; fn main() { println!("part 1 result: {:?}", part1(&read_input_file())); println!("part 2 result: {:?}", part2(&read_input_file())); } fn read_input_file() -...
use std::env; use std::fs; use cli::Config; fn first() { // GREP /* - organizing code via modules - vectors / strings - handling errors - trait / lifetime where right - tests - closures, iterators, trait object CLI ARG `cargo run searchstring example-filename.txt` std:...
//! Technical implementation of a subset of CSS Fonts Module Level 4 (WD). use std::str::FromStr; use strum_macros::EnumString; use crate::geometry::Dimension; /// Controls the thickness of outlines rendered to a text element. #[derive(Copy, Clone, Debug, PartialEq, EnumString)] pub enum FontWeight { /// Accepts...
#![feature(bool_to_option)] use std::borrow::Cow; use std::io::{BufRead, BufReader}; use std::process::{Command, Stdio}; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; use goblin::{mach, Object}; mod args; mod decode; mod demangler; mod replace; #[macro_export] macro_rules! exit { () => {{ ...
// Copyright 2020 <NAME>. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to th...
use std::ffi::OsStr; use std::path::Path; use std::str; use self::BuiltinVar::*; use error::CliResult; use io::input::{InputOptions, InputType}; use io::output::OutputOptions; use io::Record; use var::*; pub struct BuiltinHelp; impl VarHelp for BuiltinHelp { fn name(&self) -> &'static str { "Standard var...
#![forbid(unsafe_code)] #![deny(clippy::all)] use pest::iterators::{Pair, Pairs}; use pest::prec_climber::*; use pest::Parser; use rand::{rngs::SmallRng, Rng, SeedableRng}; use serde_derive::Deserialize; use std::iter; use thiserror::Error; use yozuk_helper_english::normalized_eq; use yozuk_helper_preprocessor::{Token...
/* * Copyright 2021 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed t...
//! Defines methods for spawning commands into futures. use crate::ExitStatus; use async_trait::async_trait; use futures_core::future::BoxFuture; mod and_or; mod case; mod for_cmd; mod func_exec; mod if_cmd; mod local_redirections; mod loop_cmd; mod pipeline; mod sequence; mod simple; mod subshell; mod substitution; ...
use crate::interpreter::environment::EnvironmentId; use crate::interpreter::error::Error; use crate::interpreter::interpreter::Interpreter; use crate::interpreter::library; use crate::interpreter::value::Value; use std::cmp; // todo: maybe change function spec pub fn substr( interpreter: &mut Interpreter, _env...
use std::{ cell::RefCell, cmp::Ordering, collections::{hash_map::DefaultHasher, HashMap}, fmt, hash::{Hash, Hasher}, ops::Deref, rc::Rc, }; const DEFAULT_BUF_SIZE: usize = 4096; type CacheDataRef = Rc<RefCell<StringCacheData>>; #[derive(Clone)] pub struct CaString { source: Rc<String>,...
#[macro_use] extern crate log; #[macro_use] extern crate anyhow; use std::fs; use std::path::{Path, PathBuf}; use structopt::StructOpt; use url::Url; #[cfg(feature = "server")] use axum::{http::StatusCode, service, Router}; #[cfg(feature = "server")] use std::{convert::Infallible, net::SocketAddr}; #[cfg(feature = "...
mod build; mod command; mod dependencies; mod packaging; mod version; use alvr_filesystem as afs; use pico_args::Arguments; use std::{env, fs, time::Instant}; const HELP_STR: &str = r#" cargo xtask Developement actions for ALVR. USAGE: cargo xtask <SUBCOMMAND> [FLAG] [ARGS] SUBCOMMANDS: prepare-deps ...
//! `Middleware` for compressing response body. use std::cmp; use std::marker::PhantomData; use std::str::FromStr; use actix_http::body::MessageBody; use actix_http::encoding::Encoder; use actix_http::http::header::{ContentEncoding, ACCEPT_ENCODING}; use actix_http::{Error, Response, ResponseBuilder}; use actix_servic...
use proc_macro2::TokenStream; use quote::{quote, ToTokens}; use std::fmt::Display; use syn::Error; pub fn component(attr: TokenStream, fn_item: syn::ItemFn) -> Result<TokenStream, Error> { #![allow(non_snake_case)] fn error(tokens: impl ToTokens, message: impl Display) -> Result<TokenStream, Error> { ...
/******************************************************************************* * (c) 2021 Zondax GmbH * * 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/lic...
use path_slash::PathBufExt; use std::collections::{HashMap, HashSet}; use std::path::Path; use swc_atoms::JsWord; use swc_common::{SourceMap, SyntaxContext, DUMMY_SP}; use swc_ecmascript::ast; use swc_ecmascript::visit::{Fold, FoldWith}; use crate::dependency_collector::{DependencyDescriptor, DependencyKind}; use cra...
use std::collections::HashMap; use tera::{Context, Tera}; use errors::{bail, Result}; static DEFAULT_TPL: &str = include_str!("default_tpl.html"); macro_rules! render_default_tpl { ($filename: expr, $url: expr) => {{ let mut context = Context::new(); context.insert("filename", $filename); ...
use std::vec::Vec; use std::cmp; use std::ops::{Index,IndexMut}; use std::f32; struct Map<T>{ data: Vec<T>, outside: T, x_size: isize, y_size: isize, } impl<T> Index<(isize,isize)> for Map<T> where T : Clone + Default{ type Output = T; fn index(&self,(x,y):(isize,isize)) ->&Self::Output ...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. mod emit_memoize_function; use hhbc_by_ref_ast_scope::{self as ast_scope, Scope, ScopeItem}; use hhbc_by_ref_emit_attribute as emit_att...
use crate::{ geometry::{ mesh_geometry_3d::{Face, MeshGeometry, VertexPosition}, vertex_index::{VertIdx3f, WithVertexIndex}, }, rendering::buffered_geometry::{BufferedVertexData, VertexType}, }; use bytemuck::{Pod, Zeroable}; use glam::{vec3, Vec3}; use super::MeshVertex; #[repr(C)] #[deri...
#![crate_name = "uu_hostname"] /* * This file is part of the uutils coreutils package. * * (c) <NAME> <<EMAIL>> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ extern crate getopts; extern crate libc; #[cfg(windows)] extern crate...
use std::time::{Duration, Instant}; use avro_rs::{ schema::Schema, types::{Record, ToAvro, Value}, Reader, Writer, }; fn nanos(duration: Duration) -> u64 { duration.as_secs() * 1_000_000_000 + duration.subsec_nanos() as u64 } fn seconds(nanos: u64) -> f64 { (nanos as f64) / 1_000_000_000f64 } /*...
//! Minimalist Thread Pool in Rust //! //! Glanceable source code for prototypes seeking brevity with transparency. use std::thread; use std::time::Instant; use crossbeam::channel::{ Sender, Receiver, unbounded }; use uuid::Uuid; use std::ops::Sub; type Job = Box<dyn FnOnce() + Send + 'static>; enum Mes...
// TODO: Make -w flag work with decimals // TODO: Support -f flag // spell-checker:ignore (ToDO) istr chiter argptr ilen #[macro_use] extern crate uucore; use clap::{App, AppSettings, Arg}; use std::cmp; use std::io::{stdout, Write}; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Display nu...
#[macro_use] extern crate log; use anyhow::Context; use futures::StreamExt; use k8s_openapi::{api::core::v1::ConfigMap, apimachinery::pkg::apis::meta::v1::ObjectMeta}; use kube::{ api::{ListParams, Patch, PatchParams}, Api, Client, CustomResource, }; use kube_runtime::{ controller::{Context as Ctx, Controll...
//! This module defines a wrapper around Minecraft's //! [ServerListPing](https://wiki.vg/Server_List_Ping) use std::time::Duration; use serde::Deserialize; use thiserror::Error; use tokio::net::TcpStream; use crate::protocol::{self, AsyncReadRawPacket, AsyncWriteRawPacket}; #[derive(Error, Debug)] pub enum ServerE...
use std::collections::HashMap; use std::thread::sleep; use std::time::Duration; use anyhow::Result; use chrono::Local; use crossterm::style::{Attribute, Color}; use pueue_lib::network::protocol::GenericStream; use pueue_lib::task::{Task, TaskResult, TaskStatus}; use crate::display::helper::style_text; use crate::{co...
//! Token Owner Record Account use crate::{ error::GovernanceError, tools::account::{get_account_data, AccountMaxSize}, PROGRAM_AUTHORITY_SEED, }; use crate::state::enums::GovernanceAccountType; use borsh::{BorshDeserialize, BorshSchema, BorshSerialize}; use solana_program::{ account_info::AccountInf...
use std::str; use actix_web::{web, HttpRequest, HttpResponse}; use serde::{Deserialize, Serialize}; use serde_json::Value; use time::OffsetDateTime; use uuid::Uuid; use meilisearch_auth::{error::AuthControllerError, Action, AuthController, Key}; use meilisearch_types::error::{Code, ResponseError}; use crate::extract...
use image::io::Reader; use std::io; use std::io::Write; use std::path::Path; use std::process::Command; use crate::cmd::library::generate::config::Config; use crate::cmd::library::generate::task::{CleanupScope, Task}; use crate::error::Error; use crate::manifest::icon::Icon; use crate::manifest::item::Item; use crate:...
use serde::{Deserialize, Serialize}; use solana_sdk::fee_calculator::FeeCalculator; use solana_sdk::hash::Hash; use solana_sdk::timing::timestamp; use std::collections::HashMap; #[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)] struct HashAge { fee_calculator: FeeCalculator, hash_height: u64, ...
// Copyright © 2019 Intel Corporation // // SPDX-License-Identifier: Apache-2.0 // use super::AcpiNotificationFlags; use acpi_tables::{aml, aml::Aml}; use std::sync::{Arc, Barrier}; use std::time::Instant; use vm_device::interrupt::InterruptSourceGroup; use vm_device::BusDevice; use vm_memory::GuestAddress; use vmm_sy...
// Copyright 2015 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-MIT or ...
use crypto::digest::Digest; use crypto::sha2::Sha256; use preamble::*; #[derive(PartialEq, Eq, Debug, Clone, Copy)] pub struct Transactions<'a> { pub count: u64, pub slice: &'a [u8], } #[derive(PartialEq, Eq, Debug, Clone, Copy)] pub struct Transaction<'a> { pub version: u32, pub txid: Hash, pub t...
//! # Error and Result Type use std::error; use std::fmt; use crate::users::MfaInfo; use reqwest; use reqwest::StatusCode; use serde::{Deserialize, Serialize}; /// A result type that uses [`FirebaseError`] as an error type pub type Result<T> = std::result::Result<T, FirebaseError>; /// The main error type used thro...
use async_trait::async_trait; use futures01::sync::mpsc::Sender; use lazy_static::lazy_static; use std::collections::HashMap; use std::env; use std::str::FromStr; use graph::prelude::{SubgraphInstance as SubgraphInstanceTrait, *}; use web3::types::Log; lazy_static! { static ref MAX_DATA_SOURCES: Option<usize> = ...
use gst::event::{Seek, Step}; use gst::prelude::*; use gst::{Element, SeekFlags, SeekType, State}; use anyhow::Error; use termion::event::Key; use termion::input::TermRead; use termion::raw::IntoRawMode; use std::{io, thread, time}; #[path = "../tutorials-common.rs"] mod tutorials_common; // Commands that we get f...
use std::fs; use std::net::SocketAddr; use std::path::PathBuf; use std::sync::Arc; use anyhow::{Context, Result}; use dirs::home_dir; use env_logger::Builder; use futures::future::try_join; use futures::{StreamExt, TryFutureExt}; use log::LevelFilter; use log::{error, info}; use structopt::{self, StructOpt}; use tokio...
use std::convert::From; use std::default::Default; use std::fmt; use std::io::{self, BufRead, BufReader, Cursor, Read}; use std::mem; use std::net::TcpStream; use std::str; use httparse; #[derive(Debug)] pub struct Request { pub version: (u8, u8), pub method: String, pub path: String, pub headers: Vec...
/// A helper for reading bits from a stream of bytes. /// /// The bit order is most-significant bit first, both inside of individual bytes, and between /// bytes (ie this simulates an arbitrarily long binary string where the first bit is the /// highest). pub struct Bitstream<'a> { bytes: &'a [u8], bits_left_i...
use std::cmp::Ordering; use std::fs::File; use std::path::{Path, PathBuf}; use anyhow::Result; use cursive::traits::{Boxable, Identifiable}; use cursive::views::{Dialog, TextView}; use cursive::{Cursive, CursiveExt}; use cursive_table_view::{TableView, TableViewItem}; use dcmpipe_dict::dict::stdlookup::STANDARD_DICOM...
use std::borrow::Cow; use crate::error::{IntErr, Interrupt}; use crate::eval::evaluate_to_value; use crate::num::Number; use crate::scope::GetIdentError; use crate::value::Value; mod builtin; #[derive(Copy, Clone, Eq, PartialEq, Debug)] pub(crate) enum PrefixRule { NoPrefixesAllowed, LongPrefixAllowed, L...
#![allow(dead_code)] use std::iter::FromIterator; use super::bitvec::BitVec; use super::block::Block; pub struct Blocks(Vec<Block>); impl From<&str> for Blocks { fn from(data: &str) -> Blocks { Blocks::new(data.as_bytes(), false) } } impl Blocks { /// `new` will take bytes and convert them to 16 ...
// Copyright 2019-2021 AXIA Technologies (UK) Ltd. // // 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...
///! GIT REQ! mod git; mod remotes; use clap::{crate_authors, crate_version, App, Arg, ArgGroup}; use colored::*; use git2::ErrorCode; use log::{debug, error, info, trace}; use std::io::{self, Write}; use std::{env, process}; use tabwriter::TabWriter; /// Get the remote url fn get_remote_url(remote_name: &str) -> Str...
use byteorder::{BigEndian, LittleEndian, WriteBytesExt}; use crc::{crc32, Hasher32}; use crate::decode; use crate::encode::lzma2; use crate::encode::util; use std::io; use std::io::Write; // TODO: move to some common file for encoder & decoder const XZ_MAGIC: &[u8] = &[0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00]; const XZ_MAG...
use serde_json; use chrono::UTC; use std::path::{Path, PathBuf}; use std::fs; use std::vec::Vec; use std::io::prelude::*; use std::collections::BTreeMap; use std::env; use super::{Container, LalResult, CliError}; use storage::BackendConfiguration; fn find_home_dir() -> PathBuf { // Either we have LAL_CONFIG_HOME ...
// Copyright 2018-2021 Cargill Incorporated // // 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...
/*! Builders for raw requests. */ use fluent_builder::TryIntoValue; use std::marker::PhantomData; use crate::{ client::{ requests::RequestBuilder, Client, }, endpoints::Endpoint, http::sender::{ NextParams, NodeAddresses, SendableRequest, SendableRequest...
//! This module provides a microfacet model for transmission (a BTDF), see //! [Walter et al. 07](https://www.cs.cornell.edu/~srm/publications/EGSR07-btdf.pdf) //! for details. use enum_set::EnumSet; use std::f32; use bxdf::fresnel::{Dielectric, Fresnel}; use bxdf::microfacet::MicrofacetDistribution; use bxdf::{self,...
// SPDX-License-Identifier: Apache-2.0 use crate::config::{Config, ReadOnly, WriteOnly}; use crate::virtfs::TarDirEntry; use std::convert::TryFrom; use std::rc::Rc; use wasi_common::virtfs::{pipe::ReadPipe, pipe::WritePipe, FileContents}; /// The error codes of workload execution. #[derive(Debug)] pub enum Error { ...
//! ```rust,no_run //! use ashpd::desktop::settings::SettingsProxy; //! //! async fn run() -> ashpd::Result<()> { //! let proxy = SettingsProxy::new().await?; //! //! println!( //! "{:#?}", //! proxy //! .read::<String>("org.gnome.desktop.interface", "clock-format") //! ....
//! # Day 07: //! //! [Benchmarking report](../../../day07/target/criterion/report/index.html): //! //! * [Part 1](../../../day07/target/criterion/day07_part1/report/index.html) //! * [Part 2](../../../day07/target/criterion/day07_part2/report/index.html) //! //! //! ## Part One //! //! //! //! ## Part Two //! //! //! ...
///! An item is line of text that read from `find` command or stdin together with ///! the internal states, such as selected or not use std::cmp::min; use std::default::Default; use std::ops::Deref; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; use crate::spinlock::{SpinLock, SpinLockGuard}; use ...
#[allow(dead_code)] mod util; use crate::util::{ event::{Event, Events}, StatefulList, }; use std::{error::Error, io}; use termion::{event::Key, input::MouseTerminal, raw::IntoRawMode, screen::AlternateScreen}; use tui::{ backend::TermionBackend, layout::{Constraint, Corner, Direction, Layout}, sty...
//! Utilities for dealing with annotated strings. //! //! This module contains the `split` and `join` function to destructure and recombine strings by //! redaction remarks. This allows to quickly inspect modified sections of a string. //! //! ### Example //! //! ``` //! use relay_general::types::{Meta, Remark, RemarkT...
use crate::deck::{rand_card, rand_suit, Card, Rank}; use crate::hand::{rand_hand, Hand}; use crate::playstats::PlayStats; use crate::table::{GameDesc, Table}; use rand::distributions::WeightedIndex; use rand::prelude::*; /// Generate a weighted-random next hand using player's statistics pub fn rand_next_hand(stats: &T...
//! Create and map Rust to WebAssembly values. use wasmer::Val; use wasmer::ValType; /// Represents all possibles WebAssembly value types. /// /// See `wasmer_value_t` to get a complete example. #[allow(non_camel_case_types)] #[repr(u32)] #[derive(Clone)] pub enum wasmer_value_tag { /// Represents the `i32` WebAs...
// Copyright 2015 <NAME>. // See LICENSE for details. //! tba provides native interaction with [The Blue Alliance](http://thebluealliance.com/) //! in the [Rust programming language](http://rust-lang.org/) extern crate hyper; extern crate rustc_serialize; use std::io::Read; use hyper::Client; use rustc_serialize::j...
use crate::lang::execution_context::ExecutionContext; use crate::{ lang::{ table::Row, value::ValueType, value::Value, }, lang::errors::CrushError, }; use std::io::{BufReader, Read, Write}; use crate::lang::{r#struct::Struct, list::List, table::Table}; use crate::lang::errors::{Crus...
#![deny(rust_2018_idioms, warnings)] #![deny(clippy::all, clippy::pedantic)] #![allow( clippy::cognitive_complexity, clippy::large_enum_variant, clippy::similar_names, clippy::module_name_repetitions, clippy::use_self, clippy::match_same_arms, clippy::must_use_candidate, clippy::missing_...
//! Asynchronous interfaces for integrating Rendezvous with Tokio //! //! This module contains all the Tokio support for interacting //! with Rendezvous event streams asynchronously. use futures::stream::Stream; use futures::{Async, Future, Poll}; use mio; use std::sync::mpsc; use tibrv_sys::*; use tokio::reactor::{Ha...
#![cfg(test)] use crate::activations::Activation; use crate::network::Network; use ndarray::prelude::*; fn get_model(output_size: usize, lr: f32) -> Network { let dim = vec![2, 3, output_size]; let act = vec![Activation::ReLU, Activation::None]; // increase the probability of all neurons being selected by ...
// Copyright (c) 2018-2021 The MobileCoin Foundation //! Client Builder use crate::client::Client; use fog_ledger_connection::{ FogKeyImageGrpcClient, FogMerkleProofGrpcClient, FogUntrustedLedgerGrpcClient, }; use fog_uri::{FogLedgerUri, FogViewUri}; use fog_view_connection::FogViewGrpcClient; use grpcio::EnvBuil...
use core::cell::Cell; use crate::ble::gatt_client; use crate::ble::types::*; use crate::error::Error; use crate::raw; use crate::util::*; #[derive(defmt::Format)] pub(crate) struct OutOfConnsError; #[derive(defmt::Format)] pub struct DisconnectedError; // We could make the public Connection type simply hold the sof...
mod camera; mod image; mod intersection; mod material; mod math; use math::Color; use math::Ray; use math::Vec3; use rand::Rng; use std::sync::Arc; use crate::intersection::Intersectable; use crate::intersection::IntersectableList; use camera::Camera; use intersection::HitRecord; use intersection::Sphere; extern c...