text
stringlengths
3.09k
13.9k
use crate::RectToInsert; #[cfg(not(std))] use alloc::collections::BTreeMap as KeyValMap; #[cfg(std)] use std::collections::HashMap as KeyValMap; use alloc::{ collections::{btree_map::Entry, BTreeMap}, vec::Vec, }; use core::{fmt::Debug, hash::Hash}; /// Groups of rectangles that need to be placed into bins. ...
use std::fmt::Write; use std::net::SocketAddr; use bytes::{BufMut, BytesMut}; use url::Url; use crate::body::{Body, BodyKind}; use crate::body_kind; use crate::error::{InvalidUrl, Result}; use crate::error::Error; use crate::header::{CONNECTION, HeaderMap, HeaderName, HeaderValue, InvalidHeaderName}; use crate::proto...
extern crate chrono; extern crate nannou; use nannou::color::*; use nannou::draw::Draw; use nannou::prelude::*; mod util; use util::args::ArgParser; use util::captured_frame_path; const HEIGHT: u32 = 1024; const WIDTH: u32 = 1024; // ExpandoBlob is an arbitrary closed shape whose points expand until they hit anothe...
use rexpect::errors::Result; use rexpect::spawn_bash; use super::utils::BINARY_NAME; const ARCH_VERSION: &str = "2020.03.01"; const SHARED_DIR: &str = "/tmp/archlinux/shared"; const CONFIG_NAMES: &str = "./ci/configs/*.conf"; // An absolutely end-to-end test of ruwi: // * Downloads and starts a Linux VM // * Starts ...
use image::{Pixel, Rgba}; use crate::{reader::AseReader, AsepriteParseError, ColorPalette, PixelFormat, Result}; use std::{borrow::Cow, io::Read}; // From Aseprite file spec: // PIXEL: One pixel, depending on the image pixel format: // Grayscale: BYTE[2], each pixel have 2 bytes in the order Value, Alpha. // Indexed:...
use ark_ec::models::TEModelParameters; use ark_ff::PrimeField; use ark_std::{marker::PhantomData, vec::Vec}; use plonk::{ circuit::Circuit, constraint_system::StandardComposer, error::Error, prelude::Variable, }; #[derive(Debug, Default)] struct SetMembershipCircuit<F: PrimeField, P: TEModelParameters<BaseField = F>>...
use borsh::BorshSerialize; pub use dapla_wasm::{alloc, dealloc}; use dapla_wasm::{ database::{execute, query, Value}, WasmSlice, }; use mindup_common::{Response, Task}; use sql_builder::{quote, SqlBuilder, SqlBuilderError}; use thiserror::Error; const TASKS_TABLE_NAME: &str = "Tasks"; #[no_mangle] pub unsafe ...
// Copyright 2019 Zhizhesihai (Beijing) Technology Limited. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by a...
#![deny(intra_doc_link_resolution_failure)] #[macro_use] extern crate log; #[macro_use] extern crate num_derive; extern crate num_traits; use log::{LevelFilter, SetLoggerError}; use log4rs::append::console::ConsoleAppender; use log4rs::config::{Appender, Config, Logger, Root}; use log4rs::encode::pattern::PatternEnco...
extern crate alloc; extern crate std; use alloc::vec; use alloc::vec::Vec; use std::collections::HashMap; use std::mem::MaybeUninit; use std::sync::Once; use svm_sdk_storage::Storage; /// Regarding why we don't use any concurrency primitives for initializing `STORAGE` /// see the explanation of `MockHost`. static ...
//! Crate for computing function over iterator in a streaming fashion //! using multi-threading while preserving order. //! //! # Examples //! ``` //! let xs: &[u64] = &[100, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5]; //! let mut ys = Vec::new(); //! let f = |x| x*x; //! let res: Result<usize, ()> = parstream::run( //! xs, 4, ...
// Copyright 2020 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 { fidl_fuchsia_bluetooth_a2dp::Role, fuchsia_async as fasync, fuchsia_inspect::{self as inspect, Node, NumericProperty, Property}, fuch...
#![cfg_attr( all(not(debug_assertions), target_os = "windows"), windows_subsystem = "windows" )] use ws::{Message, Sender}; use tauri::WebviewMut; use serde::{Serialize, Deserialize}; mod cmd; mod keystore; use crate::cmd::{JsonRpcBody, JsonRpcResponse, DecryptKeystoreResponse, JsonRpcResponseError}; #[derive(Clone...
use bit_util::{bit, extract}; use mmu::{Mmu, MemoryUnit}; use mmu::gba::Gba as GbaMmu; use shared::Shared; use super::IoReg; const CHANNELS: usize = 4; #[derive(Copy, Clone, Default, Serialize, Deserialize)] pub struct Dma<'a> { chs: [DmaCh; CHANNELS], #[serde(skip)] io: Shared<IoReg<'a>>, active_l...
use { std::{ collections::{ hash_map::{ Entry, RandomState }, HashMap }, hash::{ BuildHasher, Hash }, marker::{ PhantomData } } }; #[derive(Clone, PartialEq, E...
use std::collections::BTreeMap; use std::collections::HashSet; use conhash::{ConsistentHash, Node}; use crossbeam_utils::sync::ShardedLock; use smol_str::SmolStr; use uuid::Uuid; use neuromancer::{read_lock, write_lock, DefaultHasher}; pub(crate) struct Executor { pub(crate) identifier_mappings: ShardedLock<BTre...
use crate::common::names::Name; use crate::mir::ops::*; #[derive(Clone, Debug)] pub struct Root { pub externs: Vec<Param>, pub data: Vec<Data>, pub procs: Vec<Proc> } #[derive(Clone, Debug)] pub struct Data { pub ty: Type, pub name: Name, pub init: Lit, } #[derive(Clone, Debug, PartialEq, Eq...
use std::{cell::RefMut, time::Instant}; use super::event::EventContext; use crate::{ consts::{item_type, items, packet::TankUpdatePacket, packet_type}, item::iteminfo_manager::ITEM_MANAGER, utils::{ error::{Error, Result}, math::Vec2f, variant_function::VariantFunction::*, }, ...
//! Implement [`Protocol`] to create your own protocol implementation and use //! it in [`ServerConfig`](crate::ServerConfig) or [`ClientConfig`](crate::ClientConfig). //! //! Built-in protocols are listed in the [`protocols`](crate::protocols) module. use io::Write; use std::fmt::{Debug, Formatter}; use std::io; use ...
extern crate skimmer; use model::{ model_issue_rope, EncodedString, Model, Node, Rope, Renderer, Tagged, TaggedValue }; use model::style::CommonStyles; use std::any::Any; use std::borrow::Cow; use std::default::Default; use std::iter::Iterator; pub static TAG: &'static str = "tag:yaml.org,2002:null"; #[derive ...
use log::{trace}; use anyhow::{Result}; use crawler::NotifyData; use crate::settings::Site; pub struct HotlineParser {} impl HotlineParser { pub fn parse_json(&self, response: String, site: &Site) -> Result<Option<NotifyData>> { trace!("Parsing json"); let json: RootObject = serde_json::from_str(r...
use chrono::Duration; use chrono::{DateTime, Utc}; use db::{Database, QueryUtils}; use errors::*; use experiments::{Assignee, Experiment}; use server::tokens::Tokens; use std::collections::HashSet; /// Number of seconds without an heartbeat after an agent should be considered unreachable. const INACTIVE_AFTER: i64 = 3...
//! Signal flow analysis components. use super::math::*; use num_complex::Complex64; use tinyvec::TinyVec; /// Contents of a mono signal. Used in latency and frequency response analysis. #[derive(Clone, Copy)] pub enum Signal { /// Signal with unknown properties. Unknown, /// Constant signal with value. ...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ counters, logging::{self, LogEntry, LogEvent, LogField}, }; use anyhow::Result; use consensus_types::{common::Author, safety_data::SafetyData}; use libra_crypto::ed25519::{Ed25519PrivateKey, Ed25519PublicKey}; use ...
use std::collections::HashMap; use std::time::Instant; use crate::world::{ chunk::{chunk::Chunk, pos::*}, constants::*, block::blocks::BlockID, world::World, }; use crate::render::{ low::{ renderer::Renderer, context::Context, }, meshing::chunkmeshing::ChunkMesh, drawabl...
use ecc::{maingate::RegionCtx, EccConfig, GeneralEccChip}; use ecdsa::ecdsa::{AssignedEcdsaSig, AssignedPublicKey, EcdsaChip}; use halo2wrong::halo2::{ arithmetic::{CurveAffine, FieldExt}, circuit::{Layouter, SimpleFloorPlanner}, plonk::{Circuit, ConstraintSystem, Error}, }; use integer::{IntegerInstructions, Range,...
// Steve Operating System // <NAME> // 21 Sep 2019 #![no_main] #![no_std] #![feature(panic_info_message, asm, llvm_asm, global_asm, allocator_api, alloc_error_handler, alloc_prelude, const_raw_ptr_to_usize_cast, lang_items)] #[lang = "eh_personality"] ext...
mod wiring { use std::collections::HashSet; // Why is this not part of the stdlib? fn crop_letters(s: &str, pos: usize) -> &str { match s.char_indices().skip(pos).next() { Some((pos, _)) => &s[pos..], None => "", } } #[derive(PartialEq, PartialOrd, Eq, Hash, ...
//! Cache configuration // Visually appealing constructs like (1 << 0) or (0x0000_0000 | [non-zero number]) #![allow(clippy::identity_op)] use core::ptr; use cortex_m::asm; const SCB_CCR: *mut u32 = 0xE000_ED14 as *mut u32; const SCB_MPU_CTRL: *mut u32 = 0xE000_ED94 as *mut u32; const SCB_MPU_RBAR: *mut u32 = 0xE000...
//! The module that deals with function. //! //! The main type in this module is [`Func`](Func). It allows you to define your own function with custom behaviour. //! //! # Example //! ``` //! # use std::collections::HashMap; //! # use std::f64; //! use rusty_yard::{Ctx,functions::Func, evaluator::eval_str_with_vars_and...
#![no_std] #![no_main] #![deny(warnings)] extern crate cortex_m; extern crate cortex_m_rt as rt; extern crate panic_halt; extern crate rtic; extern crate stm32g0xx_hal as hal; extern crate ushell; use core::fmt::Write; use core::usize; use hal::{gpio::*, prelude::*, serial, stm32, timer::*}; use ushell::{ autoco...
//! Functions used to create HTML nodes use seed::prelude::{El, Node, Tag, UpdateEl}; use std::borrow::Cow; // TODO: support arguments in some functions, e.g. h1("title"), // div(vec![child, child]), p("text") macro_rules! create_html_elements { ( $( $fn_name:ident => $tag:stmt $(,)? )* ) => { $( ...
extern crate gl; extern crate glutin; #[macro_use] extern crate glium; extern crate image; #[macro_use] extern crate imgui; extern crate imgui_glium_renderer; extern crate nalgebra; extern crate nalgebra_glm as glm; extern crate specs; #[macro_use] extern crate specs_derive; extern crate shred; extern crate shred_...
use crate::config::{ Config, DATE_FMT, META_KEY_CATEGORY, META_KEY_CREATION_DATE, META_KEY_MODIFIED_DATE, META_KEY_TAGS, META_KEY_TEMPLATE, META_KEY_TITLE, META_TAG_SEPARATOR, META_VALUE_SEPARATOR, SOURCE_META_KEY, }; use pulldown_cmark::{CodeBlockKind, Event, Parser, Tag}; use std::collections::HashMap; u...
/* MIT License Copyright (c) 2021 <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, distrib...
// Copyright 2018 <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 writi...
use core::cmp::min; use core::fmt; use core::mem::size_of; use log::info; use pretty_hex::*; use crate::crc::{Crc, CrcAccum}; pub const SOF: u8 = 0x7e; // Start of Frame pub const ESC: u8 = 0x7d; pub const ESC_FLIP: u8 = 0x20; pub trait PacketBuffer { /// Returns the capacity of the packet buffer. fn capacit...
use super::*; /// NFA (Non-deterministic Finite Automaton) without null moves implementation #[derive(Debug, Clone)] pub struct Nfa { states: Vec<State>, } impl Nfa { pub fn from_program(prog: &Program) -> Nfa { Builder::new().build(prog) } pub fn states(&self) -> &[State] { &self.sta...
//! Linux `timerfd` implementation #[cfg(feature = "no_std")] core::compile_error!("no_std is not supported for timerfd implementation"); use crate::std::io; use core::future::Future; use core::pin::Pin; use core::{mem, ptr, task, time}; use libc::c_int; #[cfg(target_os = "android")] mod sys { #[repr(C)] pu...
/* * Copyright 2019 <NAME> and Contributors * * 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 o...
// Copyright 2021 <NAME>. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to th...
use crate::gpio; use crate::rcc::RccPeripheral; use crate::time::Hertz; use core::marker::PhantomData; use embassy::util::Unborrow; use embassy_hal_common::unborrow; use stm32_metapac::timer::vals::Ocm; pub struct Pwm<'d, T: Instance> { phantom: PhantomData<&'d mut T>, } // TIM2 pub struct Ch1 {} pub struct Ch2 ...
use libc::{c_char, c_int}; pub const ETH_ALEN: usize = 6; // BNEP UUIDs pub const BNEP_BASE_UUID: u128 = 0x0000000000001000800000805F9B34FB; pub const BNEP_UUID16: i32 = 0x02; pub const BNEP_UUID32: i32 = 0x04; pub const BNEP_UUID128: i32 = 0x16; pub const BNEP_SVC_PANU: i32 = 0x1115; pub const BNEP_SVC_NAP: i32 = 0x11...
//! Introduces the Middleware and Pipeline concepts provided by the Gotham web framework. extern crate futures; extern crate gotham; #[macro_use] extern crate gotham_derive; extern crate hyper; extern crate mime; use futures::{future, Future}; use gotham::handler::HandlerFuture; use gotham::helpers::http::response::c...
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { anyhow::{format_err, Context as _, Error}, fidl_fuchsia_net as fnet, fidl_fuchsia_net_dhcpv6 as fdhcpv6, fidl_fuchsia_net_interfaces as f...
/// MessagePack Format Markers. For internal use only. #[derive(Clone, Copy, Debug, PartialEq)] pub enum Marker { PosFixInt(u8), FixMap(u8), FixArray(u8), FixStr(u8), Nil, Reserved, False, True, Bin8, Bin16, Bin32, Ext8, Ext16, Ext32, F32, F64, UInt8, ...
// Copyright 2015-2020 Parity Technologies (UK) Ltd. // This file is part of Open Ethereum. // Open Ethereum is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your o...
use std::cmp::max; use std::cmp::min; use std::collections::BTreeMap; use std::ops::Bound::Excluded; use std::ops::Bound::Included; use std::ffi::OsStr; use log::debug; use log::trace; use log::error; use kf_protocol::api::Offset; use crate::segment::ReadSegment; use crate::StorageError; use crate::ConfigOption; use...
// Adopted from https://github.com/ajmwagar/rascii [MIT] use image::{DynamicImage, RgbImage}; use std::error::Error; use crate::opt::Opt; // 10 levels of grayscale const GSCALE_10: &[char] = &[' ', '.', ':', '-', '=', '+', '*', '#', '%', '@']; const GSCALE_70: &str = " .\"`^\",:;Il!i~+_-?][}{1)(|\\/tfjrxnuvczXYUJCLQ...
// Copyright 2020-2021 <NAME> // SPDX-License-Identifier: Apache-2.0 use crate::{ endpoints::{ config::{RestApiConfig, ROUTE_WHITE_FLAG}, filters::{ with_bus, with_message_requester, with_requested_messages, with_rest_api_config, with_storage, with_tangle, }, permission:...
// Copyright 2020-2021 <NAME> // SPDX-License-Identifier: Apache-2.0 use futures::{channel::mpsc, Sink, SinkExt, Stream}; use std::{ collections::VecDeque, pin::Pin, task::{Context, Poll, Waker}, }; /// Configure how the network should behave in the case that the capacity of the [`EventChannel`] is reache...
use rustc_errors::Applicability; use rustc_hir::{ intravisit::{walk_expr, NestedVisitorMap, Visitor}, Expr, ExprKind, Stmt, StmtKind, }; use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::hir::map::Map; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::{source_map::Span, sym...
use abi_stable::std_types::ROption; use aorist_primitives::AOption; use crate::constraint::TConstraintEnum; use crate::constraint::{OuterConstraint, TBuilder}; use crate::constraint_state::ConstraintState; use aorist_primitives::Dialect; use crate::driver::{ConstraintsBlockMap, Driver}; use crate::flow::{ETLFlow, Flow...
#[cfg(feature = "modbus-rtu")] pub fn main() { use chrono::{DateTime, Utc}; use env_logger::Builder as LoggerBuilder; use futures::{future::Either, Future, Stream}; use std::{cell::RefCell, env, io::Error, rc::Rc, time::Duration}; use stream_cancel::{StreamExt, Tripwire}; use tokio::timer::Inter...
// 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 std::ffi::CStr; use std::time::{Duration, Instant}; use onnxruntime::*; use structopt::{clap, StructOpt}; #[structopt( name = "run", about = "Run a benchmark on an onnx model. Each worker runs the model in a loop in its own thead. Once done it will print the average time to run the model.", settin...
//! Contains aggregation trees which is used during collection in a segment. //! This tree contains datastructrues optimized for fast collection. //! The tree can be converted to an intermediate tree, which contains datastructrues optimized for //! merging. use std::fmt::Debug; use super::agg_req::MetricAggregation; ...
use super::allowed_mentions::{AllowedMentions, AllowedMentionsBuilder, Unspecified}; use crate::request::prelude::*; use reqwest::{ multipart::{Form, Part}, Body, }; use std::{ collections::HashMap, error::Error, fmt::{Display, Formatter, Result as FmtResult}, }; use twilight_model::{ channel::{...
use rayon::prelude::*; use std::io; use std::io::Write; use std::process::{Command, Stdio}; #[macro_use] extern crate rust_embed; #[derive(RustEmbed)] #[folder = "dict"] struct Asset; fn print_license() { let beep_ak = Asset::get("beep/ACKNOWLEDGEMENTS").unwrap(); let ak = std::str::from_utf8(beep_ak.as_ref(...
use std::borrow::Cow; use std::error::Error; use libc; use proc_maps::Region; use nwind::arch::Registers; use nwind::DwarfRegs; use crate::args; use perf_event_open::{Event, CommEvent, Mmap2Event}; use crate::perf_group::PerfGroup; use crate::perf_arch; use crate::archive::{ContextSwitchKind, Packet}; use crate::pro...
#![allow(clippy::not_unsafe_ptr_arg_deref)] use rust_kernel_rdma_base::*; // linux kernel module use explicitly use rust_kernel_rdma_base::linux_kernel_module; use linux_kernel_module::{Error, KernelResult, println}; use core::option::Option; use alloc::string::String; use crate::net_util::gid_to_str; /// The type ...
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 //! Prover task runner that runs multiple instances of the prover task and returns //! as soon as the fastest instance finishes. use crate::cli::Options; use async_trait::async_trait; use futures::{future::FutureExt, pin_mut, select}; ...
// Copyright (c) 2019 <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, distri...
#[cfg(test)] #[path = "../../tests/unit/checker/assignment_test.rs"] mod assignment_test; use super::*; use crate::format::solution::activity_matcher::try_match_job; use crate::format::{get_coord_index, get_job_index}; use std::collections::HashSet; /// Checks assignment of jobs and vehicles. pub fn check_assignment(...
//! Linear Algebra eXtension (LAX) //! =============================== //! //! ndarray-free safe Rust wrapper for LAPACK FFI //! //! Linear equation, Inverse matrix, Condition number //! -------------------------------------------------- //! //! As the property of $A$, several types of triangular factorization are used...
// 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 writi...
use ash::vk; use ash::version::DeviceV1_0; use crate::core::GsDevice; use crate::image::instance::sampler::sampler::GsSampler; use crate::descriptor::binding::DescriptorMeta; use crate::descriptor::{ GsDescriptorType, ImageDescriptorType }; use crate::types::{ vkuint, vkfloat, VK_TRUE, VK_FALSE }; use crate::error...
//! Dotrix core crate crate provides generic features. #![doc(html_logo_url = "https://raw.githubusercontent.com/lowenware/dotrix/master/logo.png")] #![warn(missing_docs)] mod application; mod color; mod cubemap; mod frame; mod globals; mod id; mod pipeline; mod pose; mod world; pub mod animation; pub mod assets; pu...
#![allow(dead_code)] // runtime init functions not used during testing #[cfg(test)] mod tests; use crate::ffi::OsString; use crate::fmt; use crate::os::windows::prelude::*; use crate::path::PathBuf; use crate::slice; use crate::sys::c; use crate::sys::windows::os::current_exe; use crate::vec; use core::iter; pub un...
use super::any_child_tag::AnyChildTag; use super::common_tag_fields::CommonTagFields; use crate::fibroblast::data_types::{DecodingContext, SimpleValue, TagVariables, XmlAttrs}; use crate::to_svg::svg_writable::{ClgnDecodingError, ClgnDecodingResult}; use serde::{Deserialize, Serialize}; use std::{borrow::Cow, path::Pat...
extern crate js_sys; extern crate wasm_bindgen; extern crate web_sys; use js_sys::{Float32Array, Uint16Array, WebAssembly}; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use web_sys::WebGlRenderingContext; #[allow(dead_code)] mod utils; use utils::{compile_shader, link_program, set_panic_hook}; #[allow(non_...
use std::collections::BTreeSet; use aoc::*; #[derive(Debug)] struct ParsedInput { segments: Vec<SegmentDisplayInfo>, } #[derive(Debug)] struct SegmentDisplayInfo { full_cycle: Vec<SegmentInstruction>, output: Vec<SegmentInstruction>, } #[derive(Debug)] struct SegmentInstruction { wires: BTreeSet<Seg...
use crate::commands::WholeStreamCommand; use crate::prelude::*; use nu_errors::ShellError; use nu_protocol::{ ColumnPath, ReturnSuccess, Signature, SyntaxShape, TaggedDictBuilder, UntaggedValue, Value, }; use nu_source::Tagged; pub struct Histogram; #[async_trait] impl WholeStreamCommand for Histogram { fn na...
use serde::{Deserialize, Serialize}; /// A WebAssembly global along with its export specification. /// /// The lifetime parameter exists to support zero-copy deserialization for the `&str` fields at the /// leaves of the structure. For a variant with owned types at the leaves, see /// [`OwnedGlobalSpec`](owned/struct....
// The Nature of Code // <NAME> // http://natureofcode.com // // Example 3-11: Spring use nannou::prelude::*; fn main() { nannou::app(model).update(update).run(); } // Spring Type describes an anchor point that can connect to "Bob" objects via a spring // Thank you: http://www.myphysicslab.com/spring2d.html struc...
use std::{fs::File, io::Read}; use serde::Deserialize; use serde_json; use datamodel::{Datamodel, Source}; use prisma_models::{DatamodelConverter, InternalDataModelTemplate}; use crate::{utilities, PrismaError, PrismaResult}; /// Wrapper type to unclutter the interface pub struct DatamodelV2Components { pub dat...
use core::fmt; use core::ops::{Deref, DerefMut}; const PAGE_SIZE: u64 = 4096; const MAX_MEMORY_MAP_SIZE: usize = 64; /// A map of the physical memory regions of the underlying machine. #[repr(C)] pub struct MemoryMap { entries: [MemoryRegion; MAX_MEMORY_MAP_SIZE], // u64 instead of usize so that the structur...
//! RPC dispatcher. use std::collections::HashMap; use anyhow::Result; use thiserror::Error; use super::{ context::Context, types::{Body, Request, Response}, }; /// Dispatch error. #[derive(Error, Debug)] enum DispatchError { #[error("method not found: {method:?}")] MethodNotFound { method: String },...
use std::collections::HashMap; use glam::{ivec2, IVec2}; use priority_queue::DoublePriorityQueue; use crate::helpers::Grid; struct Cave { width: usize, height: usize, values: Vec<u8>, } impl Grid<u8> for Cave { fn width(&self) -> usize { self.width } fn height(&self) -> usize { ...
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause use std::borrow::{Borrow, BorrowMut}; use std::ops::DerefMut; use std::sync::{Arc, Mutex}; use virtio_device::{VirtioConfig, VirtioDeviceActions, VirtioDeviceType, VirtioMmioDevice}; use v...
//! Utility functions. use crate::color::Color; use ansi_term::Color::Red; use anyhow::{bail, Result}; use serde::{de, ser}; use signal_hook::{iterator::Signals, SIGINT, SIGQUIT, SIGTERM}; use std::{ env, ffi::CString, fs::OpenOptions, io::{prelude::*, ErrorKind}, os::unix::{ffi::OsStrExt, io::AsRa...
use actix_web::{ http::Method, middleware, App, http::NormalizePath, }; use tesseract_core::{Backend, Schema, CubeHasUniqueLevelsAndProperties}; use crate::db_config::Database; use crate::handlers::{ aggregate_handler, aggregate_default_handler, aggregate_stream_handler, aggregate_stream...
use logos::Logos; use std::fmt; #[derive(Debug, Copy, Clone, PartialEq, Logos)] pub enum TokenKind { #[regex("[ \n]+")] Whitespace, #[token("fn")] FnKw, #[token("call")] CallKw, #[token("let")] LetKw, #[token("if")] IfKw, #[token("else")] ElseKw, #[regex("[A-Za...
use anyhow::{anyhow, Context}; use splashsurf_lib::mesh::{MeshWithData, TriMesh3d}; use splashsurf_lib::nalgebra::Vector3; use splashsurf_lib::vtkio; use splashsurf_lib::vtkio::model::{ Attributes, CellType, Cells, UnstructuredGridPiece, VertexNumbers, }; use splashsurf_lib::Real; use std::fs::create_dir_all; use s...
use crate::{ error::{Error, Result}, lexer::{Lexer, Token}, value::Value, FnvIndexSet, }; use smol_str::SmolStr; use std::cmp::PartialEq; use Token::*; pub type AstPtr = u32; pub type StrId = u32; pub const NIL: AstPtr = 0; const LPAR: AstPtr = 1; #[derive(Debug, Clone, Copy, PartialEq)] pub enum Expr...
use crate::blob::Blob; use crate::codes::{AttributeType, HasAttribute, MemberRefParent, TypeDefOrRef}; use crate::element_type::ElementType; use crate::row::Row; use crate::tables::TypeDef; use crate::types::{Enum, TypeName}; use crate::TypeReader; #[derive(Copy, Clone, PartialEq, PartialOrd, Eq, Ord)] pub struct Attr...
use std::collections::hash_map::{HashMap, Entry}; use std::hash::Hash; use std::fmt; use std::io; use std::net::SocketAddr; use rotor::mio::tcp::TcpStream; use url::Url; use net::{HttpStream, HttpsStream, Transport, SslClient}; use super::dns::Dns; use super::Registration; /// A connector creates a Transport to a re...
/* * Rust-music-player - Copyright (c) 2014 <NAME>. * * This software is provided 'as-is', without any express or implied warranty. * In no event will the authors be held liable for any damages arising from * the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including...
// Rust Elements Library // Written in 2018 by // <NAME> <<EMAIL>> // // To the extent possible under law, the author(s) have dedicated all // copyright and related and neighboring rights to this software to // the public domain worldwide. This software is distributed without // any warranty. // // You should have re...
use crate::{ThresholdEcdsaError, ThresholdEcdsaResult}; use std::fmt; use zeroize::Zeroize; const LIMBS: usize = 256 / 64; /// The secp256k1 modulus - see SEC2 [https://www.secg.org/sec2-v2.pdf] section 2.4.1 const MODULUS: FieldElement = FieldElement::from_u64x4( 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0...
//! An I/O object for waking up threads blocked on the reactor. //! //! We use the self-pipe trick explained [here](https://cr.yp.to/docs/selfpipe.html). //! //! On Unix systems, the self-pipe is a pair of unnamed connected sockets. On Windows, the //! self-pipe is a pair of TCP sockets connected over localhost. use s...
//! This module use crate::simulation_parsing::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Constants { /// Space step [m] #[serde(default)] pub dx: f64, /// Time step, depends on dx [m] pub dt: f64, /// Blood dynamic viscosity [Pa.s = kg.m...
use scaly::containers::{Array, HashSet, Ref, String, Vector}; use scaly::io::Stream; use scaly::memory::Region; use scaly::Page; use scalyc::errors::ParserError; use scalyc::lexer::Lexer; use scalyc::lexer::Position; pub struct Parser { lexer: Ref<Lexer>, file_name: String, _keywords: Ref<HashSet<String>>,...
use super::{Position, RecordIndex, RecordIndexerConfig}; use crate::{ error::{Error, Result}, record::Record, utils, }; use async_std::{ fs::File, io::BufReader, path::{Path, PathBuf}, }; use futures::{ io::{AsyncRead, AsyncSeek, AsyncSeekExt as _}, stream, stream::{Stream, StreamExt...
use std::borrow::Cow; // The `Relations` enum enumerates program relations use tutorial_ddlog::Relations; // Type and function definitions generated for each ddlog program use tutorial_ddlog::typedefs::*; // The differential_datalog crate contains the DDlog runtime that is // the same for all DDlog programs and simp...
use std::collections::HashMap; use std::sync::Arc; use failure::bail; use snips_nlu_utils::token::Token; use crate::errors::*; use crate::models::FeatureFactory; use crate::resources::SharedResources; use crate::slot_filler::features::*; pub struct ProbabilisticFeatureProcessor { features_offsetters: Vec<Feature...
use std::fmt::Display; use crate::AoStatus; use crate::AoType; use crate::AoVM; /// The argument of the opcode. #[derive(Debug, PartialEq, Clone)] pub enum AoArg { /// Program counter. PC, /// Pointer for accessing data. DP, /// Pointer for accessing memory. MP, /// Pointer to the bottom o...
use std::convert::TryFrom; use std::net::TcpStream; use std::io::{self, BufWriter, BufReader, Read, Write}; use log::{info, debug, warn, error}; use xml::reader::{XmlEvent as XmlReadEvent, EventReader}; use xml::writer::EmitterConfig; use crate::xml_node::{XmlNode, FromXmlNode}; use crate::util::SCResult; use crate::pl...
// Copyright (c) 2019 E.S.R.Labs. All rights reserved. // // NOTICE: All information contained herein is, and remains // the property of E.S.R.Labs and its suppliers, if any. // The intellectual and technical concepts contained herein are // proprietary to E.S.R.Labs and its suppliers and may be covered // by German a...
/*! Library module for one-to-one network topology in simple tunnel connection. After connection is established both peers are treated equally and have an opportunity to send messages with [NetworkManager::send_message] method. # Example This example shows two peers sending `ping` and `pong` messages to each other. ...