text
stringlengths
3.09k
13.9k
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. use file_system::{get_io_type, set_io_type, IOType}; use regex::Regex; use rocksdb::{ CompactionJobInfo, DBBackgroundErrorReason, FlushJobInfo, IngestionInfo, MutableStatus, SubcompactionJobInfo, WriteStallInfo, }; use tikv_util::{error, metric...
// SPDX-License-Identifier: Apache-2.0 OR MIT // // Modifications Copyright Kani Contributors // See GitHub history for details. //! Validates syntax inside Rust code blocks (\`\`\`rust). use rustc_data_structures::sync::{Lock, Lrc}; use rustc_errors::{emitter::Emitter, Applicability, Diagnostic, Handler}; use rustc_mi...
//! Utilities for saving a [crate::plugin::Plugin]'s state. use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::pin::Pin; use std::sync::atomic::Ordering; use super::util::{Bypass, BYPASS_PARAM_ID}; use crate::param::internals::{ParamPtr, Params}; use crate::param::Param; use crate::plugin::B...
// rustfmt-wrap_comments: true // Enums test #[atrr] pub enum Test { A, B(u32, A /* comment */, SomeType), /// Doc comment C, } pub enum Foo<'a, Y: Baz> where X: Whatever { A, } enum EmtpyWithComment { // Some comment } // C-style enum enum Bar { A = 1, #[someAttr(test)] ...
use std::fs::File; use std::io::{Read, Cursor, SeekFrom, Seek}; use anni_flac::{MetadataBlockData, FlacHeader}; use anni_flac::blocks::PictureType; use anni_flac::prelude::{Encode, Decode}; /// `1s` generated by: /// ```bash /// ffmpeg -f lavfi -i "sine=frequency=1000:duration=1" 1s.flac /// ``` /// /// `1s-full` has ...
// Copyright 2021. The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following // disclai...
/** * Helpers related to management of low-level Holochain entries. * * @see ../README.md * @package HDK Graph Helpers * @since 2019-05-16 */ use std::convert::{ TryFrom }; use hdk::{ holochain_persistence_api::cas::content::Address, holochain_core_types::{ entry::Entry, entry::Entry...
use std::{ collections::{BTreeMap, BTreeSet}, io::SeekFrom, }; use async_trait::async_trait; use camino::Utf8PathBuf; use tokio::{ fs::File, io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt}, }; use super::{HardCacheItem, HcCacher, HcCacherItem}; use crate::{cache_handlers::CacheHandlerError, config::Do...
//! Pure Rust implementation of the NIST P-256 elliptic curve, //! including support for the //! [Elliptic Curve Digital Signature Algorithm (ECDSA)][ECDSA], //! [Elliptic Curve Diffie-Hellman (ECDH)][ECDH], and general purpose //! elliptic curve/field arithmetic which can be used to implement //! protocols based on gr...
// get .. // read from tmpfile .. // parse // link // rename // delete use std::{ env, io, io::Write, path::{Path, PathBuf}, process, }; use tempfile::NamedTempFile; use vidir::utils::{file, file::Ft, map, map::Txt, path}; fn main() { let args = env::args().collect::<Vec<_>>(); if args.len() ...
use crate::as_ptr; use crate::fd::{AsFd, BorrowedFd}; use crate::ffi::{ZStr, ZString}; use crate::fs::{fcntl_getfl, fstat, fstatfs, openat, FileType, Mode, OFlags, Stat, StatFs}; use crate::io::{self, OwnedFd}; use crate::process::fchdir; use alloc::borrow::ToOwned; use alloc::vec::Vec; use core::fmt; use core::mem::si...
use std::cmp; use std::convert::TryInto; use merkle_mountain_range::store::Store; use nimiq_database::cursor::ReadCursor; use nimiq_database::{Database, Transaction, WriteTransaction}; use super::HistoryTreeHash; #[derive(Debug)] enum Tx<'a, 'env> { Write(&'a mut WriteTransaction<'env>), Read(&'a Transactio...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 mod wallet_utils; use std::sync::Arc; use crate::wallet_utils::WalletLibrary; use ant::{AntRouter, MixRouter}; use anyhow::Result; use futures_01::sync::mpsc::{UnboundedReceiver, UnboundedSender}; use libra_crypto::{ ed25519::{...
use analysis::c_type::{implements_c_type, rustify_pointers}; use analysis::rust_type::{Result, TypeError}; use env::Env; use library::*; use traits::*; pub fn used_ffi_type(env: &Env, type_id: TypeId, c_type: &str) -> Option<String> { let (_ptr, inner) = rustify_pointers(c_type); let type_ = ffi_inner(env, typ...
extern crate clap; #[macro_use] extern crate log; extern crate env_logger; extern crate futures; extern crate nat; extern crate secp256k1; extern crate tokio_core; extern crate tokio_io; use futures::future::Loop; use futures::{future, Async, AsyncSink, Future, Sink, Stream}; use secp256k1::{PublicKey, Secp256k1, Secr...
use std::fmt; use std::fmt::Debug; use std::marker::PhantomData; use std::process; use std::sync::Arc; use std::os::unix::io::AsRawFd; use futures_util::StreamExt; use async_trait::async_trait; use tracing::{instrument, debug, error, info}; use fluvio_future::net::{TcpListener, TcpStream}; use fluvio_future::task::sp...
// Generated from definition io.k8s.api.node.v1beta1.Scheduling /// Scheduling specifies the scheduling constraints for nodes supporting a RuntimeClass. #[derive(Clone, Debug, Default, PartialEq)] pub struct Scheduling { /// nodeSelector lists labels that must be present on nodes that support this RuntimeClass. Po...
use itertools::Itertools; use crate::space::Command; #[derive(Debug)] pub struct CompressionDict { pub a: String, pub b: String, pub c: String, } #[inline(always)] fn n_digits_div(mut n: usize) -> usize { (2..) .take_while(|_| { n /= 10; n > 0 }) .last(...
use { crate::zk_token_elgamal::pod, bytemuck::{Pod, Zeroable}, }; #[cfg(not(target_arch = "bpf"))] use { crate::{ encryption::{ elgamal::{ElGamalCiphertext, ElGamalKeypair, ElGamalPubkey}, pedersen::{Pedersen, PedersenCommitment, PedersenOpening}, }, errors::P...
use std::{ collections::{HashMap, HashSet}, fs, }; fn main() -> Result<(), Box<dyn std::error::Error>> { let filename = "src/bin/day12/input.txt"; let input = fs::read_to_string(filename).map_err(|_| "Could not read input contents")?; let graph = CaveGraph::parse_from_str(&input).ok_or("Failed to ...
use geo_types::{LineString, Polygon, Rect}; use num_traits::Float; use std::collections::BinaryHeap; use std::rc::{Rc, Weak}; use super::sweep_event::SweepEvent; use super::Operation; pub fn fill_queue<F>( subject: &[Polygon<F>], clipping: &[Polygon<F>], sbbox: &mut Rect<F>, cbbox: &mut Rect<F>, o...
use crate::crypto::{HeaderKey, PublicKey, RootKey, SecretKey}; use crate::error::Error; use crate::session::chain_ratchet::ChainRatchet; /// Ratchet both send and receive chain keys every time a message is received. /// /// Every received message is accompanied by a public key (that should get refreshed via /// the se...
use js_sys::{try_iter, Array, Function, JsString, Reflect}; use wasm_bindgen::prelude::*; use lincoln_common::traits::Access; use lincoln_compiled::{CodeRef, Context, EvalFn, ExternEntry, Permutation, Program, ValueFn}; use lincoln_ir::PreCompileProgram; use crate::lincoln_jsvalue::{ eval_function, unwrap_jsvalue...
/// A* (star) search algorithm /// /// /// Author of the port: <NAME> /// /// Date: 2021.12.14 /// /// Description: Port from Python to Rust of the original implementation from /// the github repository: /// /// GitHub - TheAlgorithms - Python /// https://github.com/TheAlgorithms/Python/blob/mas...
#[doc = "Reader of register PMC_SR"] pub type R = crate::R<u32, super::PMC_SR>; #[doc = "Reader of field `MOSCXTS`"] pub type MOSCXTS_R = crate::R<bool, bool>; #[doc = "Reader of field `LOCKA`"] pub type LOCKA_R = crate::R<bool, bool>; #[doc = "Reader of field `MCKRDY`"] pub type MCKRDY_R = crate::R<bool, bool>; #[doc ...
use alloc::boxed::Box; use core::{mem, ops::Range, ptr, slice}; use goblin::error::{Error, Result}; use crate::{ header::sys_mman, ld_so::linker::Linker, sync::mutex::Mutex, }; use super::PAGE_SIZE; #[repr(C)] pub struct Master { /// Pointer to initial data pub ptr: *const u8, /// Length of i...
use std::collections::HashMap; use std::env; use std::io::{Error, ErrorKind, BufReader}; use std::io::prelude::*; use std::fs::File; use std::path::{Path, PathBuf}; use std::fs; use regex::{Regex,Captures}; use crate::utils::*; pub struct Alias { alias: String, command: String, description: String, confirm: i8...
// Copyright 2017 The xi-editor Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
#![allow(clippy::must_use_candidate)] use seed::{prelude::*, *}; use serde::{Deserialize, Serialize}; const LOGIN: &str = "login"; const API_URL: &str = "https://martinkavik-seed-auth-example.builtwithdark.com/api"; const STORAGE_KEY: &str = "seed_auth_example"; // ------ ------ // Init // ------ ------ fn init...
//! Instruction predicates/properties, shared by various analyses. use crate::ir::immediates::Offset32; use crate::ir::instructions::BranchInfo; use crate::ir::{Block, DataFlowGraph, Function, Inst, InstructionData, Opcode, Type, Value}; use crate::machinst::ty_bits; use cranelift_entity::EntityRef; /// Preserve instr...
//! # Example: interactive demonstration. //! //! This example draws text into a bounding box that can be modified by //! clicking and dragging on the display. //! //! Press H or V to switch between different horizontal alignment modes. //! Press M to cycle through different height modes. use embedded_graphics::{ ...
//! Starts programs in autostart, runs global 'up' script, and boots theme. Provides function to //! boot other desktop files also. use crate::errors::Result; use crate::models::Manager; use std::collections::HashMap; use std::fs; use std::io; use std::iter::{Extend, FromIterator}; use std::path::{Path, PathBuf}; use s...
use std::sync::Arc; use crate::{ bitmap::Bitmap, buffer::Buffer, datatypes::{DataType, Field}, }; use super::{ display_fmt, ffi::ToFfi, new_empty_array, specification::{check_offsets, Offset}, Array, }; #[derive(Debug, Clone)] pub struct ListArray<O: Offset> { data_type: DataType,...
// Copyright 2020 <NAME> // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, ...
/// Provenance of a build. Contains all information needed to verify the full /// details about the build from source to completion. #[derive(Clone, PartialEq, ::prost::Message)] pub struct BuildProvenance { /// Required. Unique identifier of the build. #[prost(string, tag = "1")] pub id: ::prost::alloc::st...
use core::borrow::Borrow; use core::ops::Range; use crate::layout::*; #[derive(Clone, Default)] pub struct Document { pub spans: Vec<Span>, pub fragments: Vec<(u32, u32)>, pub text: String, pub roots: Vec<u32>, } impl Document { pub fn builder() -> DocumentBuilder { DocumentBuilder::defaul...
use amethyst_core::math::{convert, Isometry3, Translation3}; use amethyst_physics::{ objects::*, servers::{JointDesc, JointPhysicsServerTrait, JointPosition}, PtReal, }; use log::error; use nphysics3d::{ joint::FixedConstraint as NpFixedConstraint, object::BodyPartHandle as NpBodyPartHandle, }; use cra...
use super::*; use error::{Error, Result}; use hyper::{ header::CONTENT_TYPE, service::{make_service_fn, service_fn}, Body, Request, Response, Server, }; use log::{debug, warn}; use prometheus::{register_counter_vec, register_histogram_vec}; use prometheus::{CounterVec, HistogramVec}; use prometheus::{Encode...
//! [`Authenticator`] implementation that authenticates against a JSON REST API. //! //! [`Authenticator`]: trait.Authenticator.html use crate::auth::*; use async_trait::async_trait; use hyper::{http::uri::InvalidUri, Body, Client, Method, Request}; use percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC}; use re...
//! Contains structs used for hashing. //! //! ## Note //! **Do not** use this hasher for hashing password //! or other sensitive data since this hash does not //! use any salt, it is vulnerable to a rainbow table //! attack. use crate::error::TryFromError; #[cfg(feature = "b64")] use crate::error::DecodeError; use s...
// nixos-boot-manager // --generation-info=[json path] // --bootloader-conf=[conf path] // --bootloader=[systemd-boot,grub,extlinux] // --bios/--efi use std::collections::HashMap; use std::path::PathBuf; // facts of the system, independent of a generation // info about the generation // presentation vs instal...
/* src/ncurses/funcs.rs Copyright (c) 2019-2021 <NAME> All rights reserved. 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 ...
//! # luminance windowing //! //! This is the base, abstract crate for windowing common types and functions in luminance. The //! `luminance` crate provides you with abstracting over OpenGL, but it doesn’t give you a way to //! create an OpenGL context. This is due to the fact that creating and managing OpenGL contexts...
use crate::{ prelude::*, strobe::{SecParam, Strobe}, }; use std::{boxed::Box, fs::File, path::Path}; use hex; use serde::{de::Error as SError, Deserialize, Deserializer}; use serde_json; // This is the top-level structure of the JSON we find in the test vectors #[derive(Deserialize)] struct TestHead { pr...
/* * Copyright 2020 Fluence Labs 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 applicable law or a...
use core::panic; use std::collections::HashMap; use crate::{Atom, CharItems, Position, RegExp, Token, Trace}; use super::{AtomSet, Dag, IntegerExpr, PositionSet, RegExpSet}; impl Dag { fn r_dfs( &self, cur: usize, all_path: &mut Vec<Trace>, stack: &mut Vec<Atom>, edges: &mut HashMap<(usize, usi...
//! UI entity that allows for the selection of a visualisation. Uses the //! `drop_down_menu::DropDownMenu` but provides convenience functionality to extract map the //! indices of the `DropDownMenu` to `Path` values. //! //! TODO: If similar things are needed elsewhere, refactor this to a //! Chooser<T:Eq+Display> (or...
// Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 use crate::testutils::{ test_framework::TestFramework, test_node::{NodeId, NodeType, TestNode}, }; use aptos_config::{ config::NodeConfig, network_id::{NetworkId, PeerNetworkId}, }; use rand::{rngs::StdRng, SeedableRng}; use std::{collection...
// Constructors externos (Se declaran en Cargo.toml) extern crate xmlJSON; extern crate rustc_serialize; extern crate walkdir; // Librerias externas (Necesitan importacion en Cargo.toml o un constructor externo) use rustc_serialize::json::ToJson; use xmlJSON::XmlDocument; use rustc_serialize::json; use walkdir::WalkDir...
#![no_std] pub mod device_type; use bit_field::BitField; use core::{fmt, marker::PhantomData}; /// PCIe supports 65536 segments, each with 256 buses, each with 32 slots, each with 8 possible functions. We cram this into a `u32`: /// /// 32 16 8 3 0 /// +------...
use failure::Error; use fs2::FileExt; use log::warn; use percent_encoding::{AsciiSet, CONTROLS}; use std::fs::OpenOptions; use std::path::{Component, Path, PathBuf, Prefix, PrefixComponent}; const ENCODE_SET: AsciiSet = CONTROLS .add(b'/') .add(b'\\') .add(b'<') .add(b'>') .add(b':') .add(b'"')...
use crate::{ async_app::errors::{ResultSpotify as Result, SpotifyError}, Opt, }; use rspotify::{ client::{ApiError, Spotify}, model::{ audio::{AudioAnalysis, AudioAnalysisMeasure}, playing::Playing, track::FullTrack, }, oauth2::{SpotifyClientCredentials, SpotifyOAuth}, };...
use super::*; use core::{ cell::UnsafeCell, mem::MaybeUninit, ops::{Deref, DerefMut}, ptr, sync::atomic::{compiler_fence, Ordering}, }; #[inline(never)] fn already_locked() -> ! { panic!("This lock has already been locked by another thread.") } /// A mutex that prevents code from running in both an IRQ an...
// This is a hacked version of [ws2812-pio-rs](https://github.com/ithinuel/ws2812-pio-rs), based on // the source from commit 4f0d81e594ea9934f9c4c38ed9824ad0cce4ebb5 on December 11, 2021. // // This version removes the 60 microsecond wait before each write. This removes the dependency on // the countdown timer, which ...
use std::cmp::Ordering; use std::fmt::{self, Write}; use std::hash::{Hash, Hasher}; use std::marker::PhantomData; use serde::{Serialize, Serializer}; use typename::TypeName; use derive_new::new; use crate::binary::WasmBinary; use binary_derive::WasmBinary; /* AST nodes common to high- and low-level representations...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 #[macro_use] extern crate serde_json; use crypto::hash::HashValue; use futures01::{Future, Stream}; use hyper::{ service::{NewService, Service}, Body, Error, Request, Response, Server, StatusCode, }; use libra_types::{accoun...
//! Basic graph module without explicit support for deletion. //! //! # Panics //! //! All methods will panic if given an out-of-bounds element index. pub mod connectivity; mod dfs; pub mod flow; /// Represents a union of disjoint sets. Each set's elements are arranged in a /// tree, whose root is the set's representa...
//! Generate binary emission code for each ISA. use cranelift_entity::EntityRef; use crate::error; use crate::srcgen::Formatter; use crate::cdsl::formats::FormatRegistry; use crate::cdsl::recipes::{EncodingRecipe, OperandConstraint, Recipes}; /// Generate code to handle a single recipe. /// /// - Unpack the instruc...
#![allow( dead_code, unused_imports, clippy::needless_range_loop, clippy::ptr_arg, clippy::char_lit_as_u8 )] use std::char; use std::cmp::{max, min}; use std::fmt; use std::io::BufRead; use std::iter::*; use std::ops::*; use std::str; use std::str::FromStr; use std::{io, process}; use failure::bai...
// Generated from definition com.github.openshift.api.image.v1.TagReference /// TagReference specifies optional annotations for images using this tag and an optional reference to an ImageStreamTag, ImageStreamImage, or DockerImage this tag should track. #[derive(Clone, Debug, Default, PartialEq)] pub struct TagReferen...
mod date_fixed_roller; use std::collections::HashMap; use std::path::PathBuf; use creep::Context; use json::JsonValue; use log::{Level, LevelFilter}; use log4rs::append::console::ConsoleAppender; use log4rs::append::rolling_file::policy::compound::trigger::size::SizeTrigger; use log4rs::append::rolling_file::policy::...
mod cache; use actix::SyncArbiter; use actix_web::{ client, middleware, server, fs, App, Error, Form, HttpMessage, HttpRequest, HttpResponse, FutureResponse, Result, }; use actix_web::http::{self, header, StatusCode}; use actix_web::middleware::{Finished, Middleware, Response, Started}; use actix_web::middlewa...
use crate::{ error::{SailsDbError, SailsDbResult as Result}, schema::categories, }; use delegate_attr::delegate; use diesel::prelude::*; use rocket::FromForm; use serde::{Deserialize, Serialize}; use uuid::Uuid; // A pseudo struct for managing the categories table. pub struct Categories; impl Categories { ...
use std::time::Instant; //Alias the backend to something less mouthful use egui_backend::egui::{vec2, Color32, Image}; use egui_backend::sdl2::video::GLProfile; use egui_backend::{egui, gl, sdl2}; use egui_backend::{sdl2::event::Event, DpiScaling, ShaderVersion}; use egui_sdl2_gl as egui_backend; use sdl2::video::SwapI...
/* * Copyright 2020 to 2021 BlazifyOrg * 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 ...
#[macro_use] extern crate pest_derive; mod criterion; mod error; mod external_documents_ids; pub mod facet; mod fields_ids_map; pub mod heed_codec; pub mod index; pub mod proximity; mod search; pub mod tree_level; pub mod update; use std::collections::{BTreeMap, HashMap}; use std::convert::{TryFrom, TryInto}; use std...
use near_sdk::{ AccountId, near_bindgen, ext_contract, borsh::{self, BorshDeserialize, BorshSerialize}, json_types::{ ValidAccountId, Base58PublicKey }, env, Promise, PromiseResult, PanicOnDefault, log, }; near_sdk::setup_alloc!(); // TODO: Adjust these to minimums const DEED_S...
use clipboard_master::{Master, ClipboardHandler, CallbackResult}; use clipboard_win::{Clipboard, Getter, formats, set_clipboard}; use clipboard_win::raw::{format_name, EnumFormats, is_format_avail, get_png, get_dibv5}; // use image::{load_from_memory, DynamicImage}; use std::io::{Read, Write, Error}; use std::env; u...
extern crate sled; use crate::event::Event; use crate::event::NetEvent; use crate::frame::Frame; use crate::frame::FrameRecord; use crate::peer::FrameNumber; use crate::peer::GossipList; use crate::peer::Height; use crate::store::*; use bincode::{deserialize, serialize}; use libcommon_rs::data::DataType; use libhash_s...
use crate::{ ConditionDifferentiableDistribution, DependentJoint, Distribution, ExactEllipticalParams, IndependentJoint, MultivariateStudentT, MultivariateStudentTWrapper, RandomVariable, ValueDifferentiableDistribution, }; use crate::{DistributionError, EllipticalParams}; use opensrdk_linear_algebra::Vecto...
// Copyright 2020 <NAME> // // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // No need to use explicit 256bit AVX2 SIMD. // `-C target-cpu=native` will autovectorize it better than us. // Not even sure why explicit instructions are so slow... // // We also have t...
use crate::utils::ChunkSlab; use crate::dy::algorithm::TaskKey; use crate::dy::dyn_future::DynamicFuture; use core::cell::*; use core::ops::Deref; use crate::dy::stat::TaskRegistry; /// ChunkSlab wrapper with interior mutability. /// SAFETY: Intended only to use inside this crate. /// Provides runtime borrow checking ...
use crate::interpreter::environment::EnvironmentId; use crate::interpreter::error::Error; use crate::interpreter::interpreter::Interpreter; use crate::interpreter::library; use crate::interpreter::value::Value; pub fn format( interpreter: &mut Interpreter, _environment: EnvironmentId, values: Vec<Value>, )...
use std::fmt; use std::rc::Rc; use crate::obj::objdict::PyDictRef; use crate::pyobject::{ItemProtocol, PyContext, PyObjectRef, PyResult}; use crate::vm::VirtualMachine; /* * So a scope is a linked list of scopes. * When a name is looked up, it is check in its scope. */ #[derive(Debug)] struct RcListNode<T> { e...
use parking_lot::RwLock; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, sync::Arc}; use warp::{ body::BodyDeserializeError, cors::CorsForbidden, hyper::{Method, StatusCode}, reject::Reject, Filter, Rejection, Reply, }; #[derive(Clone, Debug, Deserialize, Serialize)] struct Que...
use super::protopack::TunnelData; use super::protopack::TunnelDataHeader; use std::future::Future; use std::io; use std::pin::Pin; use std::task::{Context, Poll}; use tokio::sync::mpsc; struct StreamBuf { datas: Vec<u8>, pos: usize, } impl StreamBuf { fn new(datas: Vec<u8>) -> StreamBuf { StreamBu...
use macroquad::prelude::*; #[derive(Copy, Clone, PartialEq, Debug)] pub struct AABB { pub min: Vec3, pub max: Vec3, } impl AABB { pub fn new(min: Vec3, max: Vec3) -> Self { Self { min, max } } #[inline] pub fn get_center(&self) -> Vec3 { (self.min + self.max) * 0.5 } ...
extern crate libc; extern crate errno; use self::libc::{c_int}; use std::{ptr, mem}; use std::fmt; use crate::libproc::helpers; // See https://opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/sys/msgbuf.h const MAX_MSG_BSIZE : c_int = (1*1024*1024); const MSG_MAGIC : c_int = 0x063061; // See /usr/include/sys/msgb...
struct CPU { registers: [u8; 16], position_in_memory: usize, memory: [u8; 0x1000], stack: [u16; 16], stack_pointer: usize, } impl CPU { fn read_opcode(&self) -> u16 { let p = self.position_in_memory; let op_byte1 = self.memory[p] as u16; let op_byte2 = self.memory[p + 1]...
//! Integration tests. //! //! These tests require a SaltyRTC server running on `localhost:8765` //! and a `saltyrtc.crt` CA certificate (PEM) in the repository root directory. use std::borrow::Cow; use std::collections::HashMap; use std::error::Error as StdError; use std::fs::File; use std::io::Read; use std::path::P...
use std::collections::HashMap; use std::fs::File; use std::io::{self, BufRead, BufReader}; use std::iter; use std::mem; use crate::config::Config; use crate::model::{EntryPlugin, ListEntry, RunFlags}; use crate::utils::{filter_log, EitherOps}; mod parsing; mod searching; use parsing::SectionReader; pub struct Freed...
// //! Copyright 2020 Alibaba Group Holding 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...
use std::collections::VecDeque; use std::marker::PhantomData; use futures::{Sink, Poll, StartSend, AsyncSink}; use rand::Rng; use ::messages::{split_message, NONCE_LEN}; struct PendingDgrams<A> { address: A, dgrams: VecDeque<Vec<u8>>, } pub struct FragMsgSender<A,R,SK,SKE> { send_sink: SK, max_dgra...
use super::*; use ciborium_io::Read; use core::marker::PhantomData; /// A parser for incoming segments pub trait Parser: Default { /// The type of item that is parsed type Item: ?Sized; /// The parsing error that may occur type Error; /// The main parsing function /// /// This function ...
use nom::bytes::complete::{is_not, tag, take_till}; use nom::character::complete::{digit1, space0}; use nom::multi::separated_list1; use nom::number::complete::float; use nom::sequence::tuple; use nom::IResult; use std::fmt::Debug; use std::slice::Iter; use std::str::FromStr; pub struct GraphDataParser { nv: usize...
mod obj_grapher; mod sink; mod text_grapher; pub use obj_grapher::{cs_diag_to_json, diag_to_json, ObjectGrapher}; pub use sink::ErrorSink; pub use text_grapher::TextGrapher; use std::{collections::HashMap, ops::Range, path::PathBuf}; use crate::{Kid, Krates}; pub use codespan_reporting::diagnostic::Severity; pub us...
use super::FranklinOp; use super::PriorityOp; use super::{AccountId, BlockNumber, Fr}; use crate::franklin_crypto::bellman::pairing::ff::{PrimeField, PrimeFieldRepr}; use crate::node::SignedFranklinTx; use crate::params::CHUNK_BIT_WIDTH; use crate::serialization::*; use chrono::DateTime; use chrono::Utc; use web3::type...
use crate::context::CommandRegistry; use crate::data::base::Block; use crate::data::value; use crate::evaluate::operator::apply_operator; use crate::prelude::*; use crate::TaggedDictBuilder; use log::trace; use nu_errors::{ArgumentError, ShellError}; use nu_parser::hir::{self, Expression, RawExpression}; use nu_protoco...
use crate::commands::anilist::utils::synopsis; use crate::core::utils::format_time; use std::time::SystemTime; use std::time::UNIX_EPOCH; #[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "UPPERCASE")] pub enum MediaType { Anime, Manga, } impl ToString for MediaType { fn ...
// Copyright 2022 Webb Technologies Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
use crate::{ components::{GlobalTransform, Link, Transform}, resources::DirtyEntities, }; use specs::prelude::*; use specs_hierarchy::{Hierarchy, HierarchyEvent, Parent}; /// Syncs Transform and GobalTransform per entity /// /// For every Transform, whether relative or absolute, there should be a GlobalTransfo...
use crate::database::DbConnection; use crate::models::host::{Host, InstallHost, NewHost, Status}; use super::rpc::client::Client; use super::util::ansible; use super::*; use std::collections::BTreeMap; use std::collections::HashMap; use std::sync::{Arc, Mutex, RwLock}; use std::thread; use dashmap::DashMap; #[deriv...
#[macro_use] extern crate clap; use std::fs; use std::fs::{DirEntry, File}; use std::io::Write; use std::net::TcpListener; use std::path::PathBuf; use std::time::SystemTime; use chrono::{DateTime, Utc}; use clap::{App, AppSettings, Arg, ArgGroup, SubCommand}; use netbug::behavior::evaluate::{BehaviorEvaluation, Behav...
// Copyright 2015-2018 <NAME>. See the LICENSE // file at the top-level directory of this distribution. // // Licensed under the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>. // This file may not be copied, modified, or distributed // except according to those terms. //! All aggregate operations ove...
use crate::actors::envelope::Letter; use crate::services::broker::MessageBroker; use crate::services::envelope::ServiceLetterWithResponders; use crate::services::handle::Listen; use crate::services::handle::Serve; use crate::services::manager::{Manager, ServiceManager, ServiceManagerCommand}; use crate::system_director...
//! Wrapper for `UnionAll`, A union of types over all values of a type parameter. use super::type_var::TypeVar; use super::{private::Wrapper, value::Value}; use crate::error::{JlrsResult, JuliaResultRef}; use crate::impl_debug; use crate::memory::frame::Frame; use crate::memory::scope::Scope; use crate::wrappers::ptr:...
//! A crate implementing a Brukhard Keller tree datastructure which allows for fast querying of //! "close" matches on discrete distances. //! //! ```rust //! use bktree::*; //! //! let mut bk = BkTree::new(hamming_distance); //! bk.insert_all(vec![0, 4, 5, 14, 15]); //! //! let (words, dists): (Vec<i32>, Vec<isize>) =...
pub use bit_vec::BitVec; use crate::{BinaryImage, Shape}; impl BinaryImage { pub fn operation( &self, other: &BinaryImage, operator: impl FnMut((&mut u8, &u8)), ) -> BinaryImage { assert_eq!(self.width, other.width); assert_eq!(self.height, other.height); let mu...
use std::sync::atomic::{AtomicU64, Ordering}; use std::time::{Duration, Instant, SystemTime}; use crossbeam_utils::atomic::AtomicCell; #[cfg(feature = "ser")] use serde::ser::SerializeMap; #[cfg(feature = "ser")] use serde::{Serialize, Serializer}; use crate::utils; /// Meters are used to calculate rate of an event...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - USCI B0 Control Register 1"] pub ucb0ctl1: crate::Reg<ucb0ctl1::UCB0CTL1_SPEC>, #[doc = "0x01 - USCI B0 Control Register 0"] pub ucb0ctl0: crate::Reg<ucb0ctl0::UCB0CTL0_SPEC>, _reserved2: [u8; 4usize], #[doc = "0x06...