text
stringlengths
3.09k
13.9k
use ipnetwork::IpNetwork; use netlink_packet_core::{NetlinkMessage, NetlinkPayload, NLM_F_ACK, NLM_F_CREATE, NLM_F_REQUEST}; use netlink_packet_route::{ address, constants::*, link::{self, nlas::State}, route, AddressHeader, AddressMessage, LinkHeader, LinkMessage, RouteHeader, RouteMessage, RtnlMes...
/// An installed mod object. #[derive(Clone, Debug, PartialEq)] pub struct InstalledMod { /// The path of the mod. pub path: std::path::PathBuf, /// The info.json of the mod pub info: ModInfo, /// Whether the installed mod is zipped or unpacked. pub mod_type: InstalledModType, } /// Represents the contents of ...
use crate::crypto::PublicKey; use bonsai::subtree_index_to_general; use oof::Oof; use proof::reflist::RefNode; #[cfg(feature = "generate")] use proof::list::Provable; #[cfg(feature = "generate")] use arborist::Tree; const PUBKEY_ROOT_IDX: u128 = 4; const BALANCE_IDX: u128 = 5; const NONCE_IDX: u128 = 6; #[allow(dead...
//! Holds the [PokeSpecies](species/struct.PokeSpecies.html) constants. use evaluation::Level; use types::PokeType; mod generated_species; pub use self::generated_species::*; pub const NUM_SPECIES: u16 = 251; #[derive(Debug, Eq, PartialEq, Hash)] /// Information about a specific Pokemon species. pub struct PokeSpeci...
//! Traits, helpers, and type definitions for Fastboot host functionality. use std; use std::io::{Read, Write}; ///! Result wrapper that yields either a succesful result of a Fastboot operation ///! or an error [`String`]. pub type FbResult<T> = Result<T, String>; const GETVAR_CMD: &[u8] = b"getvar:"; const DOWNLOAD...
mod edit_distance; use std::ops::Bound::{Excluded, Unbounded}; use std::cmp::Ordering; use std::collections::BinaryHeap; use rustc_hash::FxHashMap; use smartstring::alias::String; #[cfg(feature = "perf")] use wasm_bindgen::JsCast; use morsels_common::dictionary; pub type Dictionary = dictionary::Dictionary; static...
use super::ast::*; use super::scope::*; use regex::Regex; use std::cell::RefCell; use std::collections::HashMap; use std::fs; use std::rc::Rc; lalrpop_mod!(pub grammar); pub struct VM { parser: grammar::ProgramParser, global_scope: Rc<RefCell<Scope>>, } impl VM { pub fn new() -> VM { let mut vm = VM { ...
use std::io::Write; use anyhow::Result; use console::Style; use super::table::*; use super::util::{format_code_time, format_test_groups, result_with_color}; use super::Ui; use crate::entities::{Scope, SubmissionInfo}; use crate::ui::util::styled_task_status_or_score; use crate::{service, RP}; pub fn print_submission...
#[macro_use] extern crate log; extern crate reqwest; extern crate json; extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_json; extern crate indicatif; extern crate positioned_io; use std::path::PathBuf; use std::collections::HashMap; use std::fs::{File, OpenOptions}; use std::fs; use std:...
use std::{sync::{Arc, mpsc}, env, thread, time}; use failure::Error; use log::debug; use actix_web::{ web, HttpResponse, }; use rand::rngs::OsRng; use rand::Rng; use ed25519_dalek::Keypair; use invoice_state_transition::{send_invoice, CallName}; use anonify_eth_driver::{ BlockNumDB, traits::*, }; use fr...
//! Linking for JIT-compiled code. use object::read::{Object, Relocation, RelocationTarget}; use object::{elf, File, NativeEndian as NE, ObjectSymbol, RelocationEncoding, RelocationKind}; use std::convert::TryFrom; use wasmtime_runtime::libcalls; type U32 = object::U32Bytes<NE>; type I32 = object::I32Bytes<NE>; type ...
use crate::fields::Subject; use serde::de::{self, Deserialize, Deserializer, MapAccess, Visitor}; use serde::ser::{Serialize, SerializeStruct, Serializer}; use serde_derive::{Deserialize, Serialize}; use std::default::Default; use std::fmt; use std::str::FromStr; #[derive(Serialize, Deserialize, Debug, PartialEq, Clon...
// Copyright Materialize, Inc. and contributors. All rights reserved. // // Use of this software is governed by the Business Source License // included in the LICENSE file. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by ...
use thiserror::Error as ThisError; use super::simulation::{controller::sim_control::SimControl, status::SimStatus}; use crate::proto; pub type Result<T, E = Error> = std::result::Result<T, E>; pub struct SimulationRunError { pub error: Error, pub sim_id: String, pub steps_taken: isize, } impl From<(&str...
// Copyright 2021 Cartesi Pte. Ltd. // // SPDX-License-Identifier: Apache-2.0 // 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...
// Copyright (c) 2019 - 2020 ESRLabs // // 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 ...
use ring::aead::{self, Aad, NONCE_LEN, Nonce, MAX_TAG_LEN as TAG_LEN}; use ring::rand::{SystemRandom, SecureRandom}; use indicatif::ProgressBar; use std::sync::Arc; use crate::memguard; use crate::utils; use crate::protobuf_local::KeyAndNonce::KeyAndNonce; use crate::dbmanagers; pub(crate) const KEY_LEN: usize = 2...
use std::collections::BTreeMap; use nalgebra::{Point2, Vector2}; use malen::AxisRect; use untimely::{join, EntityId, GameDt, GameTime, PlayerId}; #[derive(Default, Debug, Clone, PartialEq, Eq)] pub struct GameInput { pub left: bool, pub right: bool, pub up: bool, pub down: bool, pub shoot: bool,...
use super::{ EmulationMode, ARX_DATA_ADDRESS, ARX_INDEX_ADDRESS, ST01_READ_CGA_ADDRESS, ST01_READ_MDA_ADDRESS, }; use x86_64::instructions::port::Port; /// Represents an index for the attribute controller registers. #[derive(Debug, Copy, Clone)] #[repr(u8)] pub enum AttributeControllerIndex { /// Represent...
use scroll::{self, Pread}; use error; #[repr(C)] #[derive(Debug, PartialEq, Copy, Clone, Default)] pub struct SectionTable { pub name: [u8; 8], pub virtual_size: u32, pub virtual_address: u32, pub size_of_raw_data: u32, pub pointer_to_raw_data: u32, pub pointer_to_relocations: u32, pub poin...
use num_traits::{AsPrimitive, Bounded}; use crate::traits::{Numeric, Push}; use crate::{ByteSize, Encoder}; impl<T> Encoder for T where T: Numeric + ByteSize + num_traits::PrimInt, { fn encode(&self, w: &mut impl Push<Item = u8>) { // We need three pieces of information to generate the layout marker ...
use serde::{Serialize, Deserialize}; use crate::cube::{Cube, Color, NB_FACES}; use crate::cube::coordinates::{Coordinate3D, RotationAxis}; use super::super::permutations::{nb_permutations, decimal_from_permutation}; use super::Encoder; /// used to turn a cube into a single, unique and consecutiv, corners code /// and ...
use std::cell::RefCell; use std::rc::Rc; use gtk4::{glib, graphene, gdk}; use gtk4::subclass::prelude::*; use gtk4::traits::{GestureSingleExt, WidgetExt}; use crate::model::{Editor, BufferType}; #[derive(Default)] pub struct GtkColorPicker { pub editor: RefCell<Option<Rc<RefCell<Editor>>>>, } impl GtkColorPick...
mod app_options; mod ignore_file; mod logger; mod type_counter; mod working_indicator; use anyhow::{Context, Result}; use app_options::AppOptions; use fs_extra::dir::get_size; use ignore_file::IgnoreFile; use logger::Logger; use rayon::prelude::*; use std::cell::RefCell; use std::collections::HashMap; use std::fs; use...
use std::future::{self, Future}; use std::pin::Pin; use async_std::task::sleep; use http_types::{Request, StatusCode}; use serde::de::DeserializeOwned; use crate::client::request_strategy::{Outcome, RequestStrategy}; use crate::error::{ErrorResponse, StripeError}; pub type Response<T> = Pin<Box<dyn Future<Output = R...
#!/usr/bin/env run-cargo-script // cargo-deps: lazy_static, regex #[macro_use] extern crate lazy_static; extern crate regex; use regex::Regex; fn extract_login(input: &str) -> Option<&str> { lazy_static! { static ref RE: Regex = Regex::new( r"(?x) ^(?P<login>[^@\s]+)@ ...
use crate::prelude::*; use crate::serde::DeDataType; use serde::de::{MapAccess, Visitor}; use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; use std::borrow::Cow; use std::fmt::Formatter; impl Serialize for Series { fn serialize<S>( &self, serializer: S, ) -> std::result::Result...
use ckb_logger::debug; use ckb_types::core::EpochNumber; use ckb_types::{core, packed}; use ckb_util::{parking_lot::RwLock, shrink_to_fit}; use std::collections::{HashMap, HashSet, VecDeque}; pub type ParentHash = packed::Byte32; const SHRINK_THRESHOLD: usize = 100; const EXPIRED_EPOCH: u64 = 6; #[derive(Default)] st...
/* ----------------------------------------------------------------------------------- * src/event/porc.rs - Translate a Win32 MSG to an event. * beetle - Pull-based GUI framework. * Copyright © 2020 not_a_seagull * * This project is licensed under either the Apache 2.0 license or the MIT license, at * your optio...
use crate::{config::ResourceType, model::CachedEmoji, GuildResource, InMemoryCache, UpdateCache}; use std::borrow::Cow; use twilight_model::{ gateway::payload::incoming::GuildEmojisUpdate, guild::Emoji, id::{marker::GuildMarker, Id}, }; impl InMemoryCache { pub(crate) fn cache_emojis(&self, guild_id: I...
// Dogfood cannot run on Windows #![cfg(not(windows))] #![feature(once_cell)] use std::lazy::SyncLazy; use std::path::PathBuf; use std::process::Command; mod cargo; static CLIPPY_PATH: SyncLazy<PathBuf> = SyncLazy::new(|| cargo::TARGET_LIB.join("cargo-clippy")); #[test] fn dogfood_clippy() { // run clippy on it...
use crate::{LogicalAddr, Profile, Receiver, ReceiverStream, Target}; use futures::{prelude::*, ready}; use indexmap::IndexSet; use linkerd_addr::NameAddr; use linkerd_error::Error; use linkerd_proxy_api_resolve::ConcreteAddr; use linkerd_stack::{layer, NewService, Param}; use rand::distributions::{Distribution, Weighte...
// Copyright 2020 Parity Technologies // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except accor...
use super::*; use std::usize; #[derive(Debug)] pub(super) struct Counts { /// Acting as a client or server. This allows us to track which values to /// inc / dec. peer: peer::Dyn, /// Maximum number of locally initiated streams max_send_streams: usize, /// Current number of remote initiated ...
mod reserved_model_names; pub use reserved_model_names::is_reserved_type_name; use crate::{ ast::{self, ConfigBlockProperty, TopId, WithAttributes, WithIdentifier}, types::ScalarType, Context, DatamodelError, StringId, }; use reserved_model_names::{validate_enum_name, validate_model_name}; use std::collec...
// Copyright 2020 Tetrate // // 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 anyhow::Context; use std::os::raw::c_int; macro_rules! none_check { ($opt:expr) => { none_check!($opt, ::ffi_helpers::Nullable::NULL) }; ($opt:expr, $err_value:expr) => { if let Some(val) = $opt { val } else { ::ffi_helpers::error_handling::update_last_er...
use stm32h7xx_hal::gpio; use stm32h7xx_hal::gpio::gpioc::PC7; pub use stm32h7xx_hal::gpio::{Alternate, Analog, Input, Output, PullUp, PushPull}; use stm32h7xx_hal::stm32::Interrupt; pub use gpio::gpioa::PA0 as Daisy25; pub use gpio::gpioa::PA1 as Daisy24; pub use gpio::gpioa::PA2 as Daisy28; pub use gpio::gpioa::PA3 a...
use std::fmt; use std::future::Future; use std::io; use std::net::SocketAddr; use std::pin::Pin; use std::task::{Context, Poll}; use std::time::Duration; use log::{debug, error}; use hyper::server::accept::Accept; use tokio::time::Sleep; use tokio::io::{AsyncRead, AsyncWrite}; use tokio::net::{TcpListener, TcpStream}...
#[cfg(test)] #[path = "../../../tests/unit/solver/evolution/evolution_test.rs"] mod evolution_test; use crate::construction::heuristics::InsertionContext; use crate::solver::hyper::HyperHeuristic; use crate::solver::telemetry::Telemetry; use crate::solver::termination::*; use crate::solver::{Metrics, Population, Refin...
use proc_macro2::TokenStream; use quote::quote; use syn::{punctuated::Punctuated, DeriveInput, Token}; use crate::code::Code; use crate::diagnostic_arg::DiagnosticArg; use crate::help::Help; use crate::severity::Severity; use crate::snippets::Snippets; use crate::url::Url; pub enum Diagnostic { Struct { f...
//Mostly copy/paste from https://leudz.github.io/shipyard/book/recipes/hierarchy.html mod iter; mod debug; mod components; use shipyard::*; pub use self::iter::*; pub use self::debug::*; pub use self::components::*; pub trait HierarchyMut<T> { // Attaches an entity as a child to a given parent entity. fn att...
//use std::fmt; //use std::fmt::Write; //use std::str::from_utf8; // Deprecated since rustc 1.23 //#[allow(unused_imports)] //use std::ascii::AsciiExt; use byteorder::{BigEndian, ByteOrder}; use super::{Error}; use core::{fmt, str}; /// The DNS name as stored in the original packet /// /// This contains just a refer...
use dominator::{clone, events, html, Dom, DomBuilder}; use futures_signals::signal::{Mutable, MutableSignalCloned, Signal}; use web_sys::HtmlElement; use crate::components::input::input::input; use crate::components::input::input_props::InputProps; pub struct TextFieldProps< TLabelSignal: Signal<Item = Option<Str...
//! Deserialization of a `Value<T>` type which tracks where it was deserialized //! from. //! //! Often Cargo wants to report semantic error information or other sorts of //! error information about configuration keys but it also may wish to indicate //! as an error context where the key was defined as well (to help us...
use std::os::raw::c_void; type Function = fn(data: *const c_void, n: i64, x: *const f64) -> f64; #[repr(C)] struct Closure { data: *const c_void, function: Function, } impl Closure { pub fn new<F>(function: &F) -> Closure where F: Fn(&[f64]) -> f64 { fn wrap<F>(closure: *const c_void, n: i64, x: ...
// // A brainf*ck compiler. // // example: // $ bash run.sh // // 参考: [LLVM APIを使ってみよう! 〜 Brainf**kコンパイラをIRBuilderで書き直してみた 〜](http://itchyny.hatenablog.com/entry/2017/03/06/100000) extern crate llvm_sys_wrapper; use llvm_sys_wrapper::*; use std::io; use std::io::Read; struct Compiler { ctx: Context, build...
use egui::{CtxRef, Resize, ScrollArea, Ui, Window}; // ---------------------------------------------------------------------------- #[cfg_attr(feature = "persistence", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "persistence", serde(default))] struct Demos { open: Vec<bool>, #[cfg_att...
use std::error::Error; use std::time::{SystemTime, UNIX_EPOCH}; use base32::Alphabet::RFC4648; use colored::*; use libknox::{totp, TotpConfig_Hash, *}; use log::*; use crate::util::vault_path; pub(crate) fn configure(args: &clap::ArgMatches) -> Result<(), Box<dyn Error>> { let path = args.value_of("path").unwrap()...
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
//! Operations on ASCII `[u8]`. use crate::mem; #[lang = "slice_u8"] #[cfg(not(test))] impl [u8] { /// Checks if all bytes in this slice are within the ASCII range. #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] #[inline] pub fn is_ascii(&self) -> bool { is_ascii(self) ...
// Copyright 2020 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT mod codec; mod error; mod mh_code; mod prefix; mod to_cid; mod version; pub use self::codec::Codec; pub use self::error::Error; pub use self::mh_code::{Code, Multihash, POSEIDON_BLS12_381_A1_FC1, SHA2_256_TRUNC254_PADDED}; pub use self::p...
use nannou::prelude::*; use std::sync::Arc; fn main() { nannou::app(model).update(update).run(); } struct Model { device: Arc<vk::Device>, queue: Arc<vk::Queue>, pipeline: Arc<dyn vk::ComputePipelineAbstract + Send + Sync>, desciptor_set: Arc<dyn vk::DescriptorSet + Send + Sync>, data_buffer: ...
use super::constants::{RCON, SBOX0, SBOX1, TABLE_DEC0, TABLE_DEC1, TABLE_DEC2, TABLE_DEC3}; pub struct Aes { pub enc: Vec<u32>, pub dec: Vec<u32>, } impl Aes { pub fn expand_key(&mut self, key: &[u8]) { let key_size = key.len() / 4; let ks_size = key.len() + 28; for i in 0..key_siz...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under both the MIT license found in the // LICENSE-MIT file in the root directory of this source tree and the Apache // License, Version 2.0 found in the LICENSE-APACHE file in the root directory // of this source tree. //! This mod...
use crate::datastore::post::{DataStore, PostData, Slug}; use serde::{Deserialize, Serialize}; use std::{ fs::{File, OpenOptions}, io::{Read, Write}, path::{Path, PathBuf}, }; /// Post の front matter のデータ #[derive(Deserialize, Serialize, PartialEq, Debug)] struct PostFrontMatter { pub title: String, } ...
use std::str; use anyhow::{self, Context}; use async_std::prelude::StreamExt; use async_std::io::{stdin, stdout, Read as AsyncRead}; use async_std::io::prelude::WriteExt; use async_std::fs::{File as AsyncFile}; use bytes::BytesMut; use edgedb_client::client::Connection; use edgedb_client::errors::NoResultExpected; us...
use std::path::{Path, PathBuf}; use internal::{update_counter, InternalEvent}; use metrics::{counter, gauge}; use rdkafka::consumer::ConsumerContext; use rdkafka::{ClientConfig, ClientContext, Statistics}; use serde::{Deserialize, Serialize}; use snafu::Snafu; use crate::tls::TlsOptions; use crate::Error; #[derive(D...
use crate::models::common::Timestamp; use crate::utils::compare_floats; use hashbrown::HashMap; use std::any::Any; use std::cmp::Ordering; use std::hash::{Hash, Hasher}; use std::sync::Arc; /// Specifies location type. pub type Location = usize; /// Represents a routing profile. pub type Profile = i32; /// Specifies...
use super::{Gl, WebGL2RenderResourceContext}; use crate::{gl_call, Buffer, WebGL2RenderPass}; use bevy::render::{ pass::{LoadOp, Operations, PassDescriptor, RenderPass}, renderer::{BufferId, RenderContext, RenderResourceBindings, RenderResourceContext, TextureId}, texture::Extent3d, }; use std::sync::Arc; ...
mod basic_components; mod components; use self::components::{AboutTab, ConnectionsTab, InstallationTab, LogsTab, SettingsTab}; use crate::{ dashboard::components::StatisticsTab, theme, translation::{self, SharedTranslation, TranslationBundle}, }; use alvr_common::logging::Event; use alvr_session::{SessionD...
mod chacha; use chacha::ChaChaState; use io::{Write, stdout}; use rand::Rng; use sha2::{Digest, Sha256}; use core::panic; use std::{fs::{File, OpenOptions}, hash, io, ops::Deref, time::SystemTime}; use clap::{clap_app, SubCommand}; use memmap::{Mmap, MmapOptions}; const NONCE_LEN: usize = 12; const MAGIC_STR: &[u8; ...
use std::os::unix::fs::PermissionsExt; use std::time::{Duration, Instant}; use anyhow::Result; use notify::Watcher; use strmode::strmode; use termion::event::Key; use tui::backend::Backend; use tui::layout::{Alignment, Rect}; use tui::style::{Color, Style}; use tui::widgets::{Paragraph, Text}; use tui::Frame; use cra...
//! Thread pool, thread pool status and workers implementation. use crate::constants; use crate::errors::PConvertError; use crate::utils::min; use image::{ImageBuffer, Rgba}; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::{mpsc, Arc, Mutex}; use std::thread::{spawn, JoinHandle}; /// Thread pool used i...
#![cfg_attr(not(feature = "std"), no_std)] use rstd::result; use sr_primitives::traits::{ CheckedAdd, CheckedSub, MaybeSerializeDeserialize, Member, SimpleArithmetic, StaticLookup, }; use srml_support::{decl_error, decl_event, decl_module, decl_storage, ensure, Parameter}; // FIXME: `srml-` prefix should be used for ...
extern crate num_integer; extern crate num_traits; pub mod ops; //pub use crate::ops::ops; pub mod integer { //use std::ops::Shr; use num_traits::int::PrimInt; #[inline(always)] pub fn half<N>(n: N) -> N where N: PrimInt, //Integer + Shr<Output = N> { n.unsigned_shr(1) } ...
mod channel; mod config; mod error; mod global; mod handler; mod msg; mod request; mod state; pub use self::channel::direct_tcpip::{DirectTcpIp, DirectTcpIpParams, DirectTcpIpRequest}; pub use self::channel::session::{Process, SessionClient}; pub use self::channel::{OpenFailure, RequestFailure}; pub use self::config::...
use super::{ downloader_forky, downloader_linear, downloader_preverified, header_slice_verifier::HeaderSliceVerifier, header_slices::{align_block_num_to_slice_start, HeaderSlices}, }; use crate::{ downloader::ui_system::UISystemShared, kv, models::*, sentry::{chain_config::ChainConfig, messa...
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { crate::serialization::{json::SerializableHierarchyFields, utils::format_parts, *}, anyhow::Error, serde::ser::{Serialize, SerializeMap, S...
use std::rc::Rc; use crate::canvas::Canvas; use crate::core::Point; use crate::matrix::Matrix; use crate::objects::ray::Ray; use crate::objects::world::World; use crate::transform::transform; pub struct Camera { hsize: usize, vsize: usize, field_of_view: f64, transform: Matrix<f64>, pixel_size: f64...
use fltk::{app, app::*, group::Pack, image::*, group::*, self, button::*, draw, enums::*, frame::*, draw::*, prelude::*, widget::*, window::*}; use std::sync::{Arc, Mutex}; use crate::{DraggableCb, DND_CHANNEL, traits::*, DraggableType, CustomEmmiter, DragAction, DraggableInfo}; // use state::{Storage, LocalStorage}; u...
use crate::channel::ElementSender; use crate::net::worker_client::Client; use crate::runtime::{JobDescriptor, TaskManagerDescriptor}; use crate::storage::metadata::MetadataLoader; use crate::utils::get_runtime; use std::net::{IpAddr, SocketAddr}; use std::str::FromStr; #[derive(Clone, Debug)] pub struct WorkerClientPo...
//! Errors. use std::os::raw::{c_char, c_int}; use std::path::{Path, PathBuf}; use std::sync::atomic::{self, AtomicPtr}; use std::{cmp, fmt, io, process, ptr}; use crate::utils::*; /// Result of a fallible function. pub type Result<T> = std::result::Result<T, Error>; /// Error of a failed function. #[allow(missing_...
//! Storage for platform information for the Orchestrator use crate::gql_model::{ ApplicationStatus, Deployment, Node, Orchestrator, OrchestratorInterface, Service, }; use log::{info, warn}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::sync::{Arc, Mutex}; /// An ARC to a Database p...
/* * Copyright 2018-2020 TON DEV SOLUTIONS LTD. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS I...
use std::{collections::HashMap, path::Path}; use anyhow::{bail, Result}; use crate::cgroups::{ common, stats::{supported_page_sizes, HugeTlbStats, StatsProvider}, v1::Controller, }; use oci_spec::{LinuxHugepageLimit, LinuxResources}; pub struct HugeTlb {} impl Controller for HugeTlb { type Resource ...
//! TCP wrapper API //! //! This module is a wrapper for TCP functionality that uses noise API internally //! to automagically provide encrypted and authenticated channels. //! use crate::{ error::Error, noise::{ KKChannel, KKHandshakeActOne, KKHandshakeActTwo, KKMessageActOne, KKMessageActTwo, ...
//! Service and ServiceFactory implementation. Specialized wrapper over substrate service. use node_template_runtime::{self, opaque::Block, RuntimeApi}; use sc_client_api::RemoteBackend; use sc_executor::native_executor_instance; pub use sc_executor::NativeExecutor; use sc_service::{error::Error as ServiceError, Confi...
use std::cell::RefCell; use std::path::Path; use std::rc::Rc; use crate::env::{DefaultMemAppStore, DefaultMemEnvTypes, DefaultMemTemplateStore}; use crate::storage::StorageBuilderFn; use crate::{Config, DefaultRuntime, Env, ExternImport}; use svm_codec::api::builder::{DeployTemplateBuilder, SpawnAppBuilder, TxBuilder...
use alloc::vec::Vec; use bytes::{Buf, Bytes, BytesMut}; use super::markers; use super::JpegSegment; use crate::encoder::{EncodeAt, ImageEncoder}; use crate::util::read_checked; use crate::{Error, ImageEXIF, ImageICC, Result}; // segment size (2 byte) - segment meta (14 byte) pub const ICC_PREFIX_SIZE: usize = 2 + 14...
use crate::error::*; use log; use std::env; use std::fs; use std::path::Path; use std::process::Command; /// Generate .ll from .sk pub fn compile<P: AsRef<Path>>(filepath: P) -> Result<(), Error> { let path = filepath .as_ref() .to_str() .expect("failed to unwrap filepath") .to_stri...
use crate::model::{Cell, CellRef}; use std::collections::{HashMap, HashSet}; /// A spreadsheet of cells. pub struct Spreadsheet { /// All the cells that have been edited of are required by another cell. cells: HashMap<CellRef, Cell>, /// The dirty cells that have been updated but not read. dirty: Has...
use super::bit::UNDEFINED; use super::{AccessType, BitCollection}; use crate::Dut; use crate::Result; use indexmap::map::IndexMap; use num_bigint::BigUint; use std::sync::MutexGuard; #[derive(Debug)] /// Named collections of bits within a register pub struct Field { pub reg_id: usize, pub name: String, pub...
use crate::ItemSource; use crate::Todo; use std::collections::HashMap; use chrono::NaiveDateTime; use serde_json::json; use uuid::Uuid; pub async fn sync_down(todo: &mut Todo, token: String) -> () { let client = todoist::SyncApi::new(token); let payload = client.read_resources(None).await.unwrap(); let...
use std::collections::HashMap; use std::{io, fs, process, env}; use std::process::Command; fn main() { let mnemonicos_map: HashMap<&str, char> = [ ("zeroL", '0'), // 0 lógico ("umL", '1'), // 1 lógico ("An", '2'), // A' ("Bn", '3'), // B' ("AouB", '4'), // A + B ("AeB", '5'), // A . B ("A...
use axum::body::{boxed, Full}; use axum::http::status::StatusCode; use axum::http::HeaderValue; use serde::{Deserialize, Serialize}; use sha2::Digest; use std::borrow::Cow; #[derive(Serialize, Deserialize, Clone, Debug)] pub struct TLS { pub certfile: String, pub keyfile: String, pub port: u16, } #[derive...
use crate::types::*; use crate::errors::*; /// Represents a filter of user chats #[derive(Debug, Clone, Default, Serialize, Deserialize)] pub struct ChatFilter { #[doc(hidden)] #[serde(rename(serialize = "@type", deserialize = "@type"))] td_name: String, /// The title of the filter; 1-12 characters without...
/* Copyright 2021 Picovoice Inc. You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE" file accompanying this source. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an ...
use std::fmt; use std::path::{Path, PathBuf}; use filetype; /// Tool for linkers, like a linker script parser. #[derive(Clone, Debug)] pub enum Input { Library(bool, PathBuf), File(PathBuf), Flag(String), } impl fmt::Display for Input { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self ...
use azure_core::{ auth::{TokenCredential, TokenResponse}, error::{Error, ErrorKind, ResultExt}, }; use azure_identity::AutoRefreshingTokenCredential; use const_format::formatcp; use serde::de::DeserializeOwned; use std::sync::Arc; use url::Url; pub(crate) const API_VERSION: &str = "2021-06-01-preview"; pub(cra...
// The first collection type we'll look at is the `Vec<T>`, also known as a "vector". Vectors // all you to store more than value in a single data structure that puts all values next to each // other in memory. Vectors can only store values of the same type They are useful when you have a // list of items, such as the ...
//! Libra configuration builder. //! //! Parts adapted from upstream Libra's `SwarmConfigBuilder`: //! <https://github.com/libra/libra/blob/master/config/config-builder/src/swarm_config.rs> use crate::{ error::Error, peer_info::{self, PeerInfo}, prelude::*, }; use libra_config::{ config::{ConsensusConf...
use std::fs::File; use std::io::{BufReader, BufWriter}; use crate::cartridge::{MirrorMode, Rom, RomMapper}; use crate::savable::Savable; use super::Mapper; pub struct Mapper10 { rom: Rom, latch0: bool, latch1: bool, prg_bank: usize, prg_fixed: usize, chr_lo_fd: usize, chr_lo_fe: usize,...
use crate::header::VTFHeader; use crate::utils::get_offset; use crate::Error; use image::dxt::{DxtDecoder, DXTVariant}; use image::{DynamicImage, ImageBuffer, ImageDecoder, Pixel}; use num_enum::TryFromPrimitive; use parse_display::Display; use std::ops::Deref; use std::vec::Vec; #[derive(Debug)] pub struct VTFImage<'...
// < begin copyright > // Copyright <NAME> 2020 // // See root directory of this project for license terms. // // < end copyright > use crate::models::*; use crate::cache_fix::cache_fix; use log::*; use std::time::SystemTime; mod two_layer; //mod multi_layer; mod lower_bound_correction; pub struct TrainedRMI {...
// ω (omega) // ø / δ (delta): turn angle pub enum Instruction { MoveForward, PaintForward, Turn(f32), Save, Restore, // Used for debugging Noop(char), } // structs hold data. //#[derive(Debug, Eq, PartialEq, Clone)] type Axiom = String; #[derive(Debug, PartialEq, Clone)] pub struct Syste...
use crate::models::package_info::PackageInfo; use clap::{App, Arg, ArgMatches, SubCommand}; use reqwest::{ blocking::{multipart, Client}, StatusCode, }; use serde_json::json; use toml::Value; pub fn create_subcommand() -> App<'static, 'static> { SubCommand::with_name("publish") .about("Publish a ZI...
use crate::diverged::{DmaChDiverged, SpiDiverged}; use drone_cortexm::{fib, reg::prelude::*, thr::prelude::*}; use drone_stm32_map::periph::{ dma::ch::DmaChMap, spi::{traits::*, SpiMap}, }; use drone_stm32f4_dma_drv::{DmaChCfg, DmaStChToken}; pub struct SpiMasterDrv< Spi: SpiMap, DmaRx: DmaChMap, D...
use std::fmt; /// The different I/O operations. #[derive(Debug,Clone,Copy,PartialEq,Eq)] pub enum IoOp { ReadHex, ReadChar, WriteHex, WriteChar, } /// The different shift operations. #[derive(Debug,Clone,Copy,PartialEq,Eq)] pub enum ShiftOp { ShiftLeft, ShiftRight, RotateLeft, RotateRi...
use std::collections::HashMap; use model::variants::*; pub enum VariantStats { VariantContigStats { variants: HashMap<i64, HashMap<Variant, Base>>, variant_count: Vec<f64>, depth: Vec<i32>, tid: i32, total_indels: usize, target_name: Vec<u8>, target_len: f64...