text
stringlengths
3.09k
13.9k
#[macro_use] mod actions; mod conditions; use crate::base::{Align, Bytes, Range}; use crate::html::{LocalName, LocalNameHash, Namespace, TextType}; use crate::parser::state_machine::{FeedbackDirective, StateMachine, StateResult}; use crate::parser::{ ParserDirective, ParsingAmbiguityError, TreeBuilderFeedback, Tre...
// SPDX-License-Identifier: Apache-2.0 OR MIT // // Modifications Copyright Kani Contributors // See GitHub history for details. use std::convert::TryFrom; use std::fmt; use std::path::PathBuf; use std::str::FromStr; use rustc_session::config::{ErrorOutputType, Externs}; use rustc_session::lint::Level; use rustc_sessi...
//! This module provides color brightness utilies. use std::{convert::TryFrom, ops::Not}; /// The brightness of a color. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Brightness { /// Level of brightness. The lower the brightness, the darker the color is. pub level: u16, } im...
extern crate libsyntax2; extern crate superslice; extern crate itertools; extern crate join_to_string; #[cfg(test)] #[macro_use] extern crate test_utils as _test_utils; mod extend_selection; mod symbols; mod line_index; mod edit; mod code_actions; mod typing; mod completion; mod scope; #[cfg(test)] mod test_utils; us...
use async_ctrlc::CtrlC; use futures::{ channel::mpsc, executor, future, future::LocalBoxFuture, AsyncReadExt, FutureExt as _, SinkExt as _, StreamExt as _, }; use rhymuweb::{ Request, Response, }; use rhymuweb_server::{ Connection, FetchResults, HttpServer, Resour...
use crate::{parser::grammar::name, Parser, SyntaxKind, Token, TokenKind, S, T}; /// See: https://spec.graphql.org/October2021/#InputValueDefinition /// /// *Type*: /// NamedType /// ListType /// **[** Type **]** /// NonNullType /// NamedType **!** /// ListType **!** // NOTE(lrlna):...
// Copyright 2020 The Vega 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 in ...
use crate::{ app_ref, brain::{ infer::{type_of_and_infer, InferResults}, type_of, Term, TermRef, }, interactive::Frame, library::prelude::eq, parser::{fix_wild_scope, BinOp, InferGenerator}, Abstraction, }; use super::{deny_arg, get_one_arg, next_arg, next_arg_constant, Erro...
use std::sync::Arc; use std::collections::HashMap; use chashmap::CHashMap; use chashmap::ReadGuard; use chashmap::WriteGuard; use async_channel::Sender; use async_channel::SendError; use async_rwlock::RwLock; use tracing::debug; use tracing::warn; use tracing::trace; use tracing::error; use fluvio_controlplane_metada...
use rand::Rng; use std::collections::HashSet; use std::iter::repeat; #[derive(Debug)] pub struct WordStonksGame { vocabulary: HashSet<String>, word_to_guess: String, current_word_interval: WordInterval, game_over: bool, } #[derive(Clone, Debug, PartialEq)] pub struct WordInterval { pub lower_bound...
// Copyright 2019 <NAME> <<EMAIL>> // // 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...
// SPDX-License-Identifier: (Apache-2.0 OR MIT) use pyo3::ffi::*; use std::os::raw::c_char; use std::ptr::NonNull; use std::sync::Once; pub static mut HASH_SEED: u64 = 0; pub static mut NONE: *mut PyObject = 0 as *mut PyObject; pub static mut TRUE: *mut PyObject = 0 as *mut PyObject; pub static mut FALSE: *mut PyObje...
use std::{io, io::Write, pin::Pin, task::Context, task::Poll, time::Instant}; use crate::http::body::{BodySize, MessageBody}; use crate::http::error::PayloadError; use crate::http::h1; use crate::http::header::{HeaderMap, HeaderValue, HOST}; use crate::http::message::{RequestHeadType, ResponseHead}; use crate::http::p...
//! Implementation of the full-automatic tuple trait implementation. //! //! The full-automatic implementation uses the trait definition to generate the implementations for //! tuples. This has some limitations, as no support for associated types, consts, return values or //! functions with a default implementation. u...
use log::*; use std::fmt; use std::path::PathBuf; #[derive(Debug, Clone)] pub enum TestStatus { /// The test passed. Passed, /// The test failed due to a bug either in the SUT or the test. Failed, /// The test failed due to an issue that is not going to be fixed soon. /// It's basically a pass ...
#![allow(non_snake_case)] use pyo3::exceptions::PyNotImplementedError; use pyo3::prelude::*; use pyo3::wrap_pyfunction; #[pyclass] struct UFOReader {} #[pymethods] impl UFOReader { #[new] fn new() -> PyResult<Self> { Ok(UFOReader {}) } pub fn close(&self) {} pub fn fileStructure(&self) {...
use super::port; use crate::driver; use alloc::vec::Vec; const CONFIG_ADDRESS: u16 = 0xCF8; const CONFIG_DATA: u16 = 0xCFC; const ENABLE: u32 = 1 << 31; const VENDOR_ID: u8 = 0; pub const COMMAND: u8 = 4; const CLASS: u8 = 10; const HEADER_TYPE: u8 = 14; const BAR: u8 = 16; pub fn init() { let devices = discover...
//! A graph manipulation library. //! //! Implements a directional graph //! on top of some data type held //! at each node. use std::num; use std::collections::VecDeque; use std::collections::HashSet; /// Error returned when the graph /// has a problem. #[derive(Fail, Debug)] pub enum GraphError { #[fail(display =...
use crate::common::control::StreamStats; use crate::common::data::TestParameters; use crate::common::ui; use anyhow::{bail, Result}; use futures::FutureExt; use log::{debug, warn}; use std::convert::TryInto; use std::time::Duration; use tokio::fs::File; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::TcpS...
//! This library offers the ability to represent XML documents as DOM trees, //! allowing querying with CSS selectors. //! //! ``` //! extern crate rquery; //! //! use rquery::Document; //! //! fn main() { //! let document = Document::new_from_xml_file("tests/fixtures/sample.xml").unwrap(); //! //! let title = docu...
// Copyright 2022 Datafuse Labs. // // 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 ...
/* The MIT License Copyright 2016 Ahseya. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, ...
use std::io; use std::io::{stdin, Read, BufReader,BufRead}; use std::env; use std::fs::File; use std::path::{PathBuf}; use std::process::{Stdio, Command, exit}; // trait methods use std::io::Write; // flush stdout static BUILTINS: [&'static str; 3] = ["exit", "cd", "pwd"]; struct CommandLine { // command name ...
// // Map Projections // Copyright (c) 2022 <NAME> <<EMAIL>> // // This project is licensed under the terms of the MIT license // (see the LICENSE file for details). // use glium::Surface; use std::cell::RefCell; use std::rc::Rc; mod clipboard_support; pub struct Runner { event_loop: glium::glutin::event_loop::E...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - ICCSC"] pub iccsc: ICCSC, #[doc = "0x02 - ICCMVS"] pub iccmvs: ICCMVS, #[doc = "0x04 - ICCILSR0"] pub iccilsr0: ICCILSR0, #[doc = "0x06 - ICCILSR1"] pub iccilsr1: ICCILSR1, #[doc = "0x08 - ICCILSR2"] ...
use crate::{ self as http, client_addr::SetClientAddr, glue::{Body, HyperServerSvc}, h2::Settings as H2Settings, trace, upgrade, Version as HttpVersion, }; use futures::prelude::*; use linkerd2_drain as drain; use linkerd2_error::Error; use linkerd2_io::{self as io, PeerAddr, PrefixedIo}; use linker...
use super::super::common::get_base_reward; use super::validator_statuses::{TotalBalances, ValidatorStatus, ValidatorStatuses}; use super::Error; use types::*; /// Use to track the changes to a validators balance. #[derive(Default, Clone)] pub struct Delta { rewards: u64, penalties: u64, } impl Delta { //...
use crate::error::ArrowError; pub mod read; pub mod write; const ARROW_SCHEMA_META_KEY: &str = "ARROW:schema"; impl From<parquet2::error::ParquetError> for ArrowError { fn from(error: parquet2::error::ParquetError) -> Self { ArrowError::External("".to_string(), Box::new(error)) } } #[cfg(test)] mod ...
// Copyright 2021 The AccessKit Authors. All rights reserved. // Licensed under the Apache License, Version 2.0 (found in // the LICENSE-APACHE file) or the MIT license (found in // the LICENSE-MIT file), at your option. use std::{convert::TryInto, num::NonZeroU64}; use accesskit::{ ActionHandler, ActionRequest, ...
use bdk::bitcoin::secp256k1::Secp256k1; use bdk::bitcoin::util::key::{PrivateKey, PublicKey}; use bdk::bitcoin::util::psbt::PartiallySignedTransaction as PSBT; use bdk::bitcoin::Network; use bdk::blockchain::{noop_progress, ElectrumBlockchain}; use bdk::database::memory::MemoryDatabase; use bdk::electrum_client::Client...
use crate::OpaqueMetadata; use core::ops; use num_traits::int::PrimInt; use strum::EnumMetadata; #[derive(Clone, Debug, Eq, PartialEq)] pub struct MaskIterator< R: PrimInt + ops::Shr + ops::Shl + ops::BitOrAssign + ops::BitAndAssign + ops::BitXorAssign + ops::ShrAssi...
use super::camel_case; use itertools::Itertools; use models::{self, tables}; use std::fmt::Write; use std::path; use url::Url; #[derive(Debug)] pub enum MethodType { Shuffle, Publish, Update, } impl MethodType { pub fn method_name(&self, transform: &models::Transform) -> String { let mut w = c...
//! Numerical and named addresses for the HACK assembly language. use crate::hack::Label; use crate::hack::Sym; use crate::parser; use crate::Buf; use crate::Byte; use atoi::FromRadix10Checked; use derive_more::Display; use derive_more::From; use std::convert::TryFrom; /// Address instructions (A-instructions) as def...
//! Link: https://adventofcode.com/2019/day/3 //! Day 3: Crossed Wires //! //! The gravity assist was successful, and you're well on your way to the Venus refuelling station. //! During the rush back on Earth, the fuel management system wasn't completely installed, //! so that's next on the priority list. #[derive(...
//! Definitions for events emited from the KitsuneP2p actor. use crate::types::agent_store::AgentInfoSigned; use std::{sync::Arc, time::SystemTime}; /// Gather a list of op-hashes from our implementor that meet criteria. #[derive(Debug)] pub struct FetchOpHashesForConstraintsEvt { /// The "space" context. pub...
use config; use config::{Config, Project, Settings}; use errors::*; use git2::Repository; use slog::Logger; use slog::{debug, info, o, warn}; use std::collections::BTreeMap; use std::fs; use std::path::{Path, PathBuf}; use ws::github; pub fn setup(workspace_dir: &str, logger: &Logger) -> Result<()> { let setup_logge...
use anyhow::Context; use byteorder::{ByteOrder, NativeEndian}; use netlink_packet_utils::{ nla::{DefaultNla, Nla, NlaBuffer, NlasIterator, NLA_F_NESTED}, parsers::parse_u32, DecodeError, Emitable, Parseable, }; use crate::{EthtoolAttr, EthtoolHeader}; const ETHTOOL_A_RINGS_HEADER: u16 = 1; const E...
use std::{ cmp::{self, Ordering}, collections::HashMap, fs::{File, OpenOptions}, }; use bit_vec::BitVec; use handlegraph::{handle::Handle, handlegraph::HandleGraph, hashgraph::HashGraph}; use crate::args_parser; use std::io::{prelude::*, BufWriter}; use std::path::Path; #[inline] /// Needed for adaptive ...
use crate::common::*; use super::{ rel::GenericRelTree, Context, ContextKey, Rel, RelT, Table, TableMeta, ValidateError, ValidateResult, }; use crate::opt::ContextError; fn children_locations(node: &Rel<Step>) -> ValidateResult<HashSet<&BlockType>> { let mut locs = HashSet::new(); node.map(&mut |child...
use crate::{ analyzer::{util::ResultExt, Analyzer, Ctx}, errors::Error, ty::{Array, Type}, validator::{Validate, ValidateWith}, ValidationResult, }; use swc_common::{Spanned, Visit, VisitMut, VisitMutWith, VisitWith}; use swc_ecma_ast::*; use swc_ecma_utils::{ExprExt, Value::Known}; impl Analyzer<'...
extern crate proc_macro; #[macro_use] extern crate quote; extern crate syn; use proc_macro::TokenStream; use syn::MetaItem::List; use syn::MetaItem::NameValue; use syn::NestedMetaItem::MetaItem; use syn::*; fn impl_build_query_input( name: &Ident, visibility: &Visibility, variant_data: VariantData, ty...
use super::value; use crate::{plugin_capnp::evaluated_call, EvaluatedCall}; use nu_protocol::{ShellError, Span, Spanned, Value}; pub(crate) fn serialize_call( call: &EvaluatedCall, mut builder: evaluated_call::Builder, ) -> Result<(), ShellError> { let mut head = builder.reborrow().init_head(); head.se...
use anyhow::{Context, Result}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::path::PathBuf; use std::future::Future; use std::error::Error; use crate::utils::{version, META_OS}; use super::{Args, TelemetryCommand}; const API_KEY: &str = "<KEY>"; const EVENT_NAME: &str = "synth-command...
use core::cell::UnsafeCell; use core::marker::PhantomData; use objc2::rc::{AutoreleasePool, Id, Owned, Shared}; use objc2::runtime::{Bool, Class, Object}; use objc2::{class, msg_send, sel}; use objc2::{Encoding, Message, RefEncode}; use super::menu::NSMenu; use super::menubar::MenuBar; /// Helper to make various func...
use eyre::{eyre, Result}; use serde_json::Value; use strum::{self, IntoEnumIterator}; use strum_macros::{EnumIter, IntoStaticStr}; use std::collections::{HashMap, HashSet}; use std::iter::FromIterator; use std::path::{Path, PathBuf}; use std::str::FromStr; // FIXME: This abstraction should be in the `ps-importer` cra...
use crate::error::{DotError, Result}; use serde_derive::{Deserialize, Serialize}; use std::env; use std::fs; use std::path::{Path, PathBuf}; fn bool_is_false(b: &bool) -> bool { !*b } #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "lowercase")] pub enum Location { Home, Co...
use accelerometer::vector::{F32x3, I16x3}; use accelerometer::{Accelerometer, RawAccelerometer}; use stm32f3xx_hal::gpio; use stm32f3xx_hal::gpio::{gpiob, OpenDrain}; use stm32f3xx_hal::i2c; use stm32f3xx_hal::pac; use stm32f3xx_hal::prelude::*; use stm32f3xx_hal::rcc; type Lsm303 = lsm303dlhc::Lsm303dlhc<i2c::I2...
use crate::client::*; use crate::errors::*; use crate::rest_model::*; use crate::util::*; use serde_json::{from_str, Value}; use std::collections::BTreeMap; static API_V3_DEPTH: &str = "/api/v3/depth"; static API_V3_TICKER_PRICE: &str = "/api/v3/ticker/price"; static API_V3_AVG_PRICE: &str = "/api/v3/avgPrice"; static...
//! The calibration stage. The fuzzer measures the average exec time and the bitmap size. use crate::{ bolts::current_time, bolts::tuples::MatchName, corpus::{Corpus, PowerScheduleTestcaseMetaData}, events::{EventFirer, LogSeverity}, executors::{Executor, ExitKind, HasObservers}, feedbacks::Map...
// Copyright 2020 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 agre...
//! [GET /_matrix/client/r0/capabilities](https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-capabilities) use std::{borrow::Cow, collections::BTreeMap}; use maplit::btreemap; use ruma_api::ruma_api; use ruma_identifiers::RoomVersionId; use ruma_serde::StringEnum; use serde::{Deserialize, Serializ...
use lazy_static::lazy_static; use regex::Regex; #[derive(PartialEq, Debug)] pub enum InputToken { Address(String, Option<(Option<usize>, Option<usize>)>), Negation, Addition(i64, u128, u128), None, } fn to_int(m: Option<regex::Match>) -> Option<usize> { if let Some(m) = m { if !m.range().i...
use super::rbtree::RedBlackBST; use rand::distributions::{Distribution, Standard}; use rand::Rng; use std::borrow::Borrow; use std::f64; use std::fmt; use std::vec::IntoIter; #[derive(Clone, Copy, PartialEq, PartialOrd, Debug)] pub struct Point2D { pub x: f64, pub y: f64, } impl Point2D { pub fn new(x: f6...
#![deny(clippy::disallowed_method)] use std::fmt::{Debug, LowerExp}; use derive_more::{ Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Rem, RemAssign, Sub, SubAssign, }; use num::{Num, NumCast, One, ToPrimitive, Zero}; // f64 with Debug impl in scientific notation #[derive( Clone, Copy, Partial...
use crate::config::Config; use crate::datanode::datanode_storage::DataNodeStorage; use crate::datanode::handler::DataTransferHandler; use crate::error::{Result, UdfsError}; use crate::proto; use crate::proto::node_protocol_client::NodeProtocolClient; use crate::proto::HeartbeatMessage; use std::future::Future; use std...
//! tests against local ganache for local debug purposes #![allow(unused)] use crate::init_tracing; use ethers::{ abi::Address, contract::{Contract, ContractFactory}, core::k256::SecretKey, prelude::{abigen, Middleware, Signer, SignerMiddleware, TransactionRequest, Ws}, providers::{Http, Provider}, ...
use crate::internal::*; use num_traits::AsPrimitive; use std::iter::Sum; use crate::ops::cnn::pools::PoolSpec; use crate::ops::cnn::Patch; use crate::ops::nn::DataShape; #[derive(Debug, Clone, new, Default, Hash)] pub struct AvgPool { pub pool_spec: PoolSpec, pub count_include_pad: bool, } impl AvgPool { ...
mod ip; use ip::get_ip_addresses; use std::collections::HashSet; use std::convert::TryInto; use std::error::Error; use std::fs::{self, File}; use std::io::{Read, Write}; use std::net::{TcpListener, TcpStream}; use std::path::Path; use std::process::exit; use walkdir::WalkDir; const HELP_COMMANDS: [&str; 3] = ["-h", "...
#[macro_use] extern crate lazy_static; extern crate pathfinding; extern crate rand; use pathfinding::{astar, idastar}; use rand::os::OsRng; use rand::Rng; use std::time::Instant; #[cfg(test)] const SIDE: u8 = 3; #[cfg(not(test))] const SIDE: u8 = 4; const LIMIT: usize = (SIDE * SIDE) as usize; macro_rules! absdiff {...
#![no_std] #![no_main] use panic_halt as _; use core::fmt::Write; use cortex_m::interrupt::{free as disable_interrupts, CriticalSection}; use cortex_m::peripheral::NVIC; use heapless::consts::U16; use heapless::spsc::Queue; use vl53l0x::VL53L0x; use wio_terminal as wio; use wio::hal::clock::GenericClockController; us...
#[macro_use] extern crate log; #[macro_use] extern crate serde_derive; use anyhow::Result; use mdbook::book::Book; use mdbook::book::BookItem; use mdbook::errors::Error; use mdbook::preprocess::Preprocessor; use mdbook::preprocess::PreprocessorContext; use pulldown_cmark::{Event, Options, Parser, Tag}; use pulldown_c...
use std::process::exit; use std::fmt; use std::collections::HashMap; use indexmap::map::IndexMap; #[derive(Copy, Clone, Debug)] pub enum ParameterMode { Position, Literal, Relative, Any, Address, } #[derive(Debug)] pub struct Environment { pub variables: IndexMap<String, i64>, pub labels: ...
use cosmwasm_std::{ entry_point, from_binary, to_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, ReplyOn, Response, StdError, StdResult, SubMsg, Uint128, WasmMsg, }; use crate::error::ContractError; use crate::state::{Config, CONFIG}; use astroport::staking::{ConfigResponse, Cw20HookMs...
use bincode; use context::Context; use error::Error; use file::FileType; use fixed::MutFixed; use layer::{Layer, LayerStack}; use result::Result; use serde::ser::{Serialize, Serializer}; use std::{fmt, mem, ptr, slice, str}; use vec::SafeVec; /// Writer metadata. #[derive(Serialize, Deserialize, Debug)] pub struct Met...
#[macro_use] extern crate bitflags; //#[macro_use] extern crate arr_macro; mod util; mod compare; use waffle_iron :: { Solver, Generator }; use std :: { env }; const PUZZLES: [&str; 9] = [ "309000400200709000087000000750060230600904008028050041000000590000106007006000104", "295743861431865900876192543387459...
// Copyright 2016 <NAME> // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, ...
mod fetch; mod parse; pub use fetch::*; use web3::{ types::{Filter, H256}, Transport, Web3, }; use crate::{ core::{GlobalRoot, StarknetBlockNumber}, ethereum::{EthOrigin, RpcErrorCode}, }; /// Describes a state update log event. Is always emitted /// as a pair with [StateTransitionFactLog]. /// /// ...
// // optimisation.rs // Copyright (C) 2019 <NAME> <<EMAIL>> // Distributed under terms of the MIT license. // use log::debug; use rand::distributions::Uniform; use rand::prelude::*; use rand_pcg::Pcg64Mcg; use crate::traits::*; pub struct MCOptimiser { kt_start: f64, kt_ratio: f64, max_step_size: f64, ...
// Copyright 2022 <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...
//! The suite of traits allowing CPAL to abstract over hosts, devices, event loops and stream IDs. use { BuildStreamError, DefaultFormatError, DeviceNameError, DevicesError, Format, InputDevices, OutputDevices, PauseStreamError, PlayStreamError, StreamDataResult, SupportedFo...
extern crate chrono; extern crate serde; extern crate serde_json; use chrono::NaiveDate; use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; use std::collections::HashMap; use crate::error::CapTableError; // This is our Record where we model the contents of the CSV file, we don't actually use an arr...
use super::*; use format::{MiscInfoFlags, MINIDUMP_MISC_INFO_2 as MDRawMiscInfo}; use std::time::Duration; /// From <usr/include/mach/time_value.h> #[repr(C)] #[derive(Copy, Clone)] struct TimeValue { seconds: i32, microseconds: i32, } impl From<TimeValue> for Duration { fn from(tv: TimeValue) -> Self { ...
use adventofcode2021::{default_sub_command, parse_usize, CommandResult, Problem}; use clap::{value_t_or_exit, App, Arg, ArgMatches}; use nom::{ bytes::complete::take, character::complete::newline, combinator::map_parser, multi::{many1, separated_list0}, IResult, }; use std::collections::HashSet; use...
#![allow(proc_macro_derive_resolution_fallback, unused_attributes)] use std::{collections::HashMap, fs::File, io::Write, sync::Arc, time::Duration}; use error::StreamFinderError; use futures::{stream::FuturesUnordered, StreamExt}; use shared::{ http_client::{HttpClient, RequestSettings}, messages::stream_find...
use std::cell::{Cell, RefCell}; use std::ops::Deref; use std::ptr::NonNull; use std::rc::Rc; pub struct GcState { pub(crate) inner: RefCell<GcInner>, } // #[derive(Clone, Copy, PartialEq, Eq)] // enum Color { // White, // Black, // Grey, // } // #[derive(Clone, Copy, PartialEq, Eq)] // enum Mark #[repr(...
use crate::error::Error; use engine::engine_option::EngineOption; use engine::option_type::OptionType; use std::collections::HashMap; use std::fmt; use std::str::FromStr; #[derive(Clone, Default)] pub struct EngineOptions { options: HashMap<String, OptionType>, buttons: HashMap<String, fn() -> ()>, } impl Eng...
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; const MAX_ANT_STEPS: u32 = 200; #[wasm_bindgen] #[repr(u8)] #[derive(Clone, C...
// `error_chain!` can recurse deeply #![recursion_limit = "1024"] #[macro_use] extern crate error_chain; #[macro_use] extern crate glium; #[macro_use] extern crate serde_derive; extern crate bytes; extern crate futures; extern crate rand; extern crate serde; extern crate serde_json; extern crate tokio_codec; extern cr...
extern crate regex; use std::env; use std::fs; use std::collections::HashMap; use regex::Regex; use std::borrow::Borrow; use std::collections::hash_map::RandomState; trait Rule { fn to_regex(&self, rule_map: &HashMap<i32, Box<dyn Rule>>) -> String; } struct BaseRule { c: char } impl Rule for BaseRule { fn ...
#[macro_use] extern crate log; mod forward; mod header; mod resolver; #[cfg(feature = "user-management")] mod usermg; use std::{ collections::HashMap, fs::File, io::{self, BufReader}, net::{Ipv6Addr, SocketAddr, SocketAddrV6}, path::{Path, PathBuf}, sync::Arc, }; use sha2::Digest; use thiserr...
/*! # Interrupt Management Interrupts can be enabled, disabled and cleared. ## Example ```rust enable_interrupt(TimerCh0); // ... #[no_mangle] fn TimerCh0() { // .. clear_interrupt(TimerCh0); } ``` ## The following functions can be implemented as interrupt handlers ...
// SPDX-License-Identifier: MIT use std::convert::TryInto; use std::fs::{File, OpenOptions}; use std::os::unix::io::RawFd; use std::io::Write; use serde::{Serialize, Deserialize}; use serde_big_array::big_array; big_array!{BigArray;} const HID_MAX_DESCRIPTOR_SIZE: usize = 4096; enum Bus { PCI, ISAPNP, ...
use crate::components::utils; use crate::game::{ ClientGame, FootballersGame, Game, HostGame, GAME_CANVAS_HEIGHT, GAME_CANVAS_WIDTH, }; use crate::utils::global_window; use log::error; use serde::{Deserialize, Serialize}; use wasm_bindgen::closure::Closure; use wasm_bindgen::{JsCast, JsValue}; use wasm_peers::{get_...
use bme280::BME280; use chrono::{DateTime, Local, NaiveDateTime}; use hal::{Delay, I2cdev}; //use rand::Rng; use crate::models::{NewValue, Value}; use average::{Estimate, Mean}; use bigdecimal::ToPrimitive; use diesel; use diesel::pg::PgConnection; use diesel::prelude::*; use dotenv::dotenv; use std::env; #[derive(Ser...
use fantoch::command::Command; use fantoch::config::Config; use fantoch::executor::Executor; use fantoch::id::ProcessId; use fantoch::protocol::{Action, Protocol}; use fantoch::time::RunTime; use fantoch::util; use fantoch::{HashMap, HashSet}; use stateright::actor::{Actor, Id}; use std::marker::PhantomData; const SHA...
extern crate csv; use csv::Writer; use std::env; use std::error::Error; use std::fs; use std::path::PathBuf; use std::process::Command; const STD_VEC: &str = "std-vec"; const IM_RS_VECTOR_BALANCED: &str = "im-rs-vector-balanced"; const IM_RS_VECTOR_RELAXED: &str = "im-rs-vector-relaxed"; const PVEC_RRBVEC_BALANCED:...
use crate::proto::ClientSentences; use core::fmt; use std::io; /// A NUT-native error. #[derive(Debug)] pub enum NutError { /// Occurs when the username/password combination is rejected. AccessDenied, /// Occurs when the specified UPS device does not exist. UnknownUps, /// The specified UPS doesn't...
/*! Glue code for SDL support */ #![allow(dead_code)] use std::fmt; pub use rokol_ffi::gfx::sg_context_desc as SgContextDesc; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use crate::gfx as rg; /// Enum compatible with [`PixelFormat`] in `rokol::gfx` /// /// [`PixelFormat`]: crate::gfx::PixelForm...
use crate::to_rows; use async_trait::async_trait; use cubestore::cluster::Cluster; use cubestore::config::{env_parse, Config, CubeServices}; use cubestore::table::TableValue; use cubestore::util::strings::path_to_string; use cubestore::CubeError; use flate2::read::GzDecoder; use std::any::Any; use std::io::Cursor; use ...
// ATA Driver! use crate::println; use alloc::{string::String, vec::Vec}; use bit_field::BitField; use core::hint::spin_loop; use lazy_static::lazy_static; use spin::Mutex; use x86_64::instructions::port::{Port, PortReadOnly, PortWriteOnly}; // Commands to send to the drives #[repr(u16)] enum Command { Read = 0x20...
use std::collections::HashMap; use std::error::Error; fn get_prev_char(s: &str, i: usize) -> Option<char> { assert!( i < s.len() && i > 0, "i should not be zero index and should not exceed the len on str" ); get_nth_char_from(&s, i, -1) } fn get_next_char(s: &str, i: usize) -> Option<char>...
use crate::drivers::ble::mesh::bearer::{Bearer, BearerError, Handler}; use crate::drivers::ble::mesh::{MESH_MESSAGE, PB_ADV}; use core::future::Future; use core::mem; use core::num::NonZeroU32; use core::ptr::slice_from_raw_parts; use heapless::Vec; use nrf_softdevice::ble::central::{ScanConfig, ScanError}; use nrf_sof...
// use std::env; // #![feature(once_cell)] // use std::lazy::SyncLazy; // use std::sync::RwLock; use once_cell::sync::OnceCell; use config::{Config, File as ConfigFile/*, Environment*/}; use serde_derive::{Serialize, Deserialize}; extern crate log; extern crate log4rs; // use log4rs; use crate::error::{...
// Copyright (C) 2020 <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, publish, // dis...
//! An implementation of a `ByteBuf` based on virtual memory. //! //! This implementation uses `mmap` on POSIX systems (and should use `VirtualAlloc` on windows). //! There are possibilities to improve the performance for the reallocating case by reserving //! memory up to maximum. This might be a problem for systems t...
use crate::errors::{InternalErrorSource, SicCliOpsError}; use crate::TResult; use sic_image_engine::engine::{EnvItem, Instr}; use sic_image_engine::wrapper::filter_type::FilterTypeWrap; use sic_image_engine::wrapper::image_path::ImageFromPath; use sic_image_engine::wrapper::overlay::OverlayInputs; use sic_image_engine:...
//! Wrapper for a `Layer` to allow it to be dynamically reloaded. //! //! This module provides a [`Layer` type] which wraps another type implementing //! the [`Layer` trait], allowing the wrapped type to be replaced with another //! instance of that type at runtime. //! //! This can be used in cases where a subset of `...
use rustc::hir::intravisit as visit; use rustc::hir::{self, *}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::middle::expr_use_visitor::*; use rustc::middle::mem_categorization::{cmt_, Categorization}; use rustc::ty::layout::LayoutOf; use rustc::ty::{self, Ty}; use rustc::util::nodemap::...
use std::{ collections::BTreeMap, env, fs, io::Write as _, path::Path, time::{Instant, SystemTime, UNIX_EPOCH}, }; use anyhow::{bail, format_err}; use xshell::{cmd, Shell}; use crate::flags; type Unit = String; impl flags::Metrics { pub(crate) fn run(self, sh: &Shell) -> anyhow::Result<()> {...
pub fn to_shortnum(n: f64) -> String { // let ne = n > 0.0; // let v = match n { // 0.0..=1e3 => {}, // 1e3..=1e6 => {}, // 1e6..=1e9 => {}, // _ => {} // }; // v = match ne { // true => v = v * 1.0, // false => v = v * -1.0 // }; // if ne { /...