text
stringlengths
3.09k
13.9k
use std::{collections::VecDeque, rc::Rc}; use crate::{ api::prelude::*, proc_macros::*, shell::prelude::WindowRequest, themes::theme_orbtk::*, }; // --- KEYS -- pub static STYLE_WINDOW: &str = "window"; // --- KEYS -- // internal type to handle dirty widgets. type DirtyWidgets = Vec<Entity>; #[derive(Clone)] en...
use std::{ convert::{TryFrom, TryInto}, ops::Range, }; use crate::{ codegen::anchor_lang_crate_name, ErrorItem, ErrorStruct, ErrorVariant, ErrorVariantMessage, }; use crate::{ErrorEnum, ErrorTarget}; use proc_macro2::{Span, TokenStream}; use quote::quote; use syn::{Error, FieldsNamed, FieldsUnnamed, Ident,...
/*! Glue code for `app` and `gfx` ([`FFI`]) [`FFI`]: rokol_ffi::glue */ use std::ffi::CString; use crate::{app, gfx}; /// For [`crate::gfx::setup`] /// /// Creates [`crate::gfx::SetupDesc`] considering [`crate::app`]. pub fn app_desc() -> rokol_ffi::gfx::sg_desc { let mut desc: rokol_ffi::gfx::sg_desc = Default...
use crate::f32ext::F32Ext; /// `f64` extension providing various arithmetic approximations and polyfills /// for `std` functionality. pub trait F64Ext: Sized { /// Compute absolute value with a constant-time, data-independent /// implementation. fn abs(self) -> f64; /// Approximate `asin(x)` in radian...
extern crate stork_search as stork; use std::env; use std::fs::File; use std::io::{BufReader, Read}; use std::time::Instant; mod argparse; mod display_timings; mod test_server; use num_format::{Locale, ToFormattedString}; use stork::config::Config; use stork::LatestVersion::structs::Index; pub type ExitCode = i32;...
use glam::{Mat4, Vec2, Vec3}; //clockwise pub fn edge_function(v0: Vec2, v1: Vec2, p: Vec2) -> f32 { (p.x - v0.x) * (v1.y - v0.y) - (p.y - v0.y) * (v1.x - v0.x) } pub fn barycentric_coordinates( point: Vec2, v0: Vec2, v1: Vec2, v2: Vec2, area: f32, ) -> Option<Vec3> { let a = 1.0 / area; ...
extern crate rand; use rand::{Rng, SeedableRng, StdRng}; static mut RNG: Option<StdRng> = None; use std::process::Command; use std::fs::File; use std::env; use std::path::Path; use std::io::Write; use std::fs::OpenOptions; use std::time::{SystemTime, UNIX_EPOCH}; mod code_gen; use code_gen::PuzzleType; fn main() ...
//! This example is an overtone instrument. Keyboard is the user input. //! The tone is a very simple function (nothing like a real instrument). It's purpose is //! only testing. //! See also: [Overtone flute](https://en.wikipedia.org/wiki/Overtone_flute) extern crate scaleless_music; #[macro_use] extern crate conrod;...
use std::sync::atomic; use bitflags::bitflags; use linux_io_uring_sys as sys; use crate::util::{ Mmap, unsync_load }; use crate::mmap_offset; pub struct SubmissionQueue { pub(crate) head: *const atomic::AtomicU32, pub(crate) tail: *const atomic::AtomicU32, pub(crate) ring_mask: *const u32, pub(crate) ...
use crate::value::{Function, Object}; use crate::*; use byteorder::{LittleEndian, ReadBytesExt}; use std::io::Cursor; use value::*; pub struct BytecodeReader<'a> { pub bytes: Cursor<&'a [u8]>, } pub const TAG_STRING: u8 = 0; pub const TAG_FLOAT: u8 = 1; pub const TAG_DBGINFO: u8 = 2; pub const TAG_FUN: u8 = 3; i...
extern crate dictawav; use std::collections::{HashMap, HashSet}; use dictawav::DictaWav; use std::path::PathBuf; use std::f64; // KernelCanvas parameters const KERNELS_COUNT: usize = 2048; const KERNELS_DIMENSION: usize = 13; const OUTPUT_FACTOR: usize = 10; // WiSARD parameters const RETINA_SIZE: usize = KERNELS_C...
/* tag::catalog[] Title:: Basic HTTP requests from canisters Goal:: Ensure simple HTTP requests can be made from canisters. Runbook:: 0. Instantiate a universal VM with a webserver 1. Instantiate an IC with one applications subnet with the HTTP feature enabled. 2. Install NNS canisters 3. Install the universal canist...
use anyhow::{Context, Result}; use cust::context::{Context as CuContext, ContextFlags}; use cust::device::{Device, DeviceAttribute}; use cust::memory::{CopyDestination, DeviceBox, DeviceBuffer, DevicePointer, DeviceVariable}; use cust::stream::{Stream, StreamFlags}; use cust::CudaFlags; use cust::DeviceCopy; use optix:...
use core::fmt::{Debug, Formatter, Result}; use core::mem::size_of; use core::sync::atomic::{AtomicIsize, Ordering}; use crate::arch::vmm::{Vcpu, VcpuAccessGuestState}; use crate::arch::{HostPageTable, LinuxContext}; use crate::cell::Cell; use crate::consts::{HV_STACK_SIZE, LOCAL_PER_CPU_BASE}; use crate::error::HvResu...
extern crate gio; extern crate cairo; extern crate gtk; use std::error::Error; use std::f64::consts::PI; use gio::prelude::*; use gtk::prelude::*; use gtk::DrawingArea; use cairo::Context; use crate::display::Display; use base::Color; static mut LEDS: Vec<Color> = Vec::new(); struct EmulatorDisplay { offset: ...
// TODO: Could we leverage SIMD here?? #[cfg(test)] mod spec_tests; use crate::{ cart::Cart, ppu::{control_register::ControlRegister, vram::IVram}, }; #[derive(Default)] pub struct BackgroundRenderer { palettes: [u8; 16], shift_registers: [u16; 4], // [pattern_low, pattern_high, palette_low, palette_...
use analyze; use analyze::definition::{Param, TypeParam}; use analyze::resolve::scope::Scope; use parse::tree::{ClassType, Lambda, Name, ParameterizedType, Type}; use semantics::expr::method_call::coerce_from_primitive_to_class; use semantics::{block, expr, Context}; use std::cell::RefCell; use std::ops::Deref; pub fn...
use std::{ collections::VecDeque, fs::File, io::BufWriter, path::Path, time::{Duration, Instant, SystemTime, UNIX_EPOCH}, }; use anyhow::{Context, Result}; use log::{debug, info}; use gb_rs::{ cartridge::Cartridge, gameboy::GameBoy, joypad::Button, AudioSink, FrameSink, SCREEN_HEIGHT, SCRE...
use std::collections::HashSet; use image::ColorImage; use image::RGB; #[derive(Debug,Clone,Copy,Hash,PartialEq,Eq)] struct Coord { pub x: i32, pub y: i32, } impl Coord { fn new(x: i32, y: i32) -> Self { Coord { x, y } } } struct Triangle { a: Coord, b: Coord, c: Coord, } pub fn sier...
//! Keyboards. use context::Context; use os::{OsKeyboardState, OsKeysym, OsKeycode}; use super::{DeviceID, KeyState, Result}; /// There's nothing in here, for now. #[derive(Debug, Clone, PartialEq, Eq)] pub struct KeyboardInfo; /// Most platforms provide a (supposedly) efficient way to query /// the whole keyboard's...
use nannou_osc::rosc::OscMessage; use nannou_osc::rosc::OscType; use std::net::SocketAddr; use std::time::{Duration, SystemTime, UNIX_EPOCH}; #[derive(Clone, Debug)] pub struct MuseMessage { //TODO Add message receive time here pub time: Duration, // Since UNIX_EPOCH, the beginning of 1970 pub ip_address: ...
use std::{cmp::Ordering, iter::Peekable}; /// Produce an iterator over the full join of two sorted iterators over /// key-value pairs. /// /// Full join here means that elements from both iterators are returned, /// whether they match by key or not. /// /// The iterators are assumed to be sorted by the key in ascendin...
// Copyright 2017 The nom-lua project developers // // 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 // e...
use libc::{c_char, c_int, c_uchar, c_uint, c_ulong, c_void, size_t}; pub type SSL_CTX_keylog_cb_func = Option<unsafe extern "C" fn(ssl: *const ::SSL, line: *const c_char)>; pub type SSL_custom_ext_add_cb_ex = Option< unsafe extern "C" fn( ssl: *mut ::SSL, ext_type: c_uint, context: c_u...
//! Vec-Like Operations that also work in `no_std` and without `alloc`. /// Represents anything that can be used to store the resulting data /// of a LZ4 operation. /// /// Contains different required Vec-Like operations, that are also /// applyable to an array or slice. pub trait Buf<T: Copy> { /// Push an item t...
use super::structs::*; pub fn print_report_header(path: &str) { println!("RustQC Report"); println!("=============\n"); println!("File: {}", path); println!(); } pub fn print_qual_by_position_report(qual_by_position: &QualityByPosition) { println!("Quality by Sequence Position"); println!("---...
use crate::*; use indexmap::IndexMap; use serde::{Deserialize, Serialize}; // http://json.schemastore.org/swagger-2.0 /// The transfer protocol of the API. Values MUST be from the list: "http", "https", "ws", "wss". /// If the schemes is not included, the default scheme to be used is the one used to access the Swagge...
use crate::components::Config; use clap::{App as Clap, Arg as ClapArg, ArgMatches as ClapArgMatches}; use regex::Regex; use std::fs; use std::path::Path; #[derive(Clone, Debug)] /// The App object is here to determine arguments and know what configuration(s) should run and how pub struct App { configurations: Vec<...
use wasm_bindgen::prelude::*; use std::convert::{TryFrom, TryInto}; use ergo_lib::chain::contract::Contract; use ergo_lib::chain::ergo_box::BoxId; use ergo_lib::chain::ergo_box::BoxValue; use ergo_lib::chain::ergo_box::NonMandatoryRegisters; use ergo_lib::chain::ergo_box::{ErgoBox, ErgoBoxCandidate}; use ergo_lib::ch...
//! Pipe implementation for oshit-kernel use _core::convert::TryInto; use bitflags::*; use alloc::sync::{Arc, Weak}; use alloc::collections::VecDeque; use alloc::vec::Vec; use spin::{Mutex, MutexGuard}; use crate::{memory::UserBuffer, process::suspend_switch}; bitflags! { /// Flags to mark read/write end of pipe. ...
use std::sync::Arc; #[macro_use] mod macros; pub mod asset; mod camera; pub mod common; pub mod ecs; mod editor; mod game_state; mod graph; mod io; pub mod math; pub mod render; mod time; mod visit; use time::Time; use game_state::GameState; use ecs::prelude::*; use io::event::Event; #[derive(Debug, PartialEq, Eq)...
use chrono::{DateTime, TimeZone, Utc}; use itertools::Itertools; use plotters::prelude::*; use rayon::prelude::*; use regex::Regex; use serde::Deserialize; use std::{ops::Add}; use tar::Archive; use time::{macros::date, Date, OffsetDateTime}; #[derive(Debug, Deserialize)] struct Map { pub name: String, } #[derive...
// std imports use std::io::{Read, Write}; use std::sync::Arc; use crate::fittypes::{ Endianness, FitFileContext, FitFieldDefinition, FitDeveloperFieldDefinition, FitDefinitionMessage, FitDataType}; use crate::fitread::{fit_...
use render::*; use crate::buttonlogic::*; use crate::widgetstyle::*; #[derive(Clone)] pub struct TabClose { pub bg: Quad, pub animator: Animator, pub _bg_area: Area, } impl TabClose { pub fn proto(cx: &mut Cx) -> Self { Self { bg: Quad::proto(cx), animator: Animator::de...
// Copyright (c) 2016 The vulkano developers // 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. All files in the project carrying such // notice may not be ...
// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceColumnDefinition /// CustomResourceColumnDefinition specifies a column for server side printing. #[derive(Clone, Debug, Default, PartialEq)] pub struct CustomResourceColumnDefinition { /// JSONPath is a simple ...
//! This crate provides an encoder/decoder for Reed-Solomon erasure code. //! //! Please note that erasure coding means errors are not directly detected or corrected, //! but missing data pieces (shards) can be reconstructed given that //! the configuration provides high enough redundancy. //! //! You will have to impl...
use std::{ convert::TryFrom, fs::File, io::{BufRead, BufReader, Write}, path::{Path, PathBuf}, }; use anyhow::{anyhow, bail, Error}; use simctl::{get_app_container::Container, Device}; use tempfile::TempDir; use tracing::{debug, info, instrument}; use crate::{ bundle::create_bundles, ios::{ ...
use proc_macro2::{Ident, TokenStream}; use quote::{format_ident, quote}; use yarte_hir::{Struct, HIR}; use crate::EachCodeGen; use crate::{CodeGen, IfElseCodeGen}; pub struct BytesCodeGen<'a, T: CodeGen> { codegen: T, s: &'a Struct<'a>, parent: Ident, buf: Ident, } impl<'a, T: CodeGen> BytesCodeGen<...
#![no_std] #![no_main] /// Makes the wio_terminal appear as a USB serial port, and display /// the time on the screen. /// /// You can tell the terminal the time by running (on linux): /// - sudo stty -F /dev/ttyACM0 115200 raw -echo /// - sudo bash -c "echo 'time=hour:minute:second' > /dev/ttyACM0" use embedded_gra...
use std::collections::BTreeSet; use std::fs::File; use futures_channel::mpsc; use abstio::{DataPacks, Manifest, MapName}; use widgetry::{EventCtx, Key, Transition}; use crate::load::FutureLoader; use crate::tools::{ChooseSomething, PopupMsg}; use crate::AppLike; // Update this ___before___ pushing the commit with "...
//! This module contains the bindings of the OpenSlide library and its rust wrappers. //! //! The api of the wrappers should be consistent with the C API of OpenSlide //! `https://openslide.org/api/openslide_8h.html`. //! //! For a more rust convenient api, use the OpenSlide struct. //! use failure::Error; use libc; u...
/* Copyright The containerd 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 agreed to...
//! Pass for rendering all symbols. use crate::prelude::*; use crate::system::gpu::*; use crate::display::render::pass; use crate::display::scene; use crate::display::scene::layer; use crate::display::scene::Scene; use crate::display::symbol::registry::SymbolRegistry; use crate::display::symbol::MaskComposer; // =...
#![cfg(test)] #![feature(test)] extern crate test; use bitvec::prelude::*; use test::Bencher; // `BitSlice::empty` is not benched, because the compiler const-folds it. It // is not a `const fn`, but it has exactly one function call, which is `const`, // and creates a value object from that function. As such, the ...
use super::{Point, LatLon}; use projection::Projection; use layer::Layer; /// /// Represents a map view /// /// A map uses three coordinate systems: /// /// * Latitude/longitude /// * Map coordinates: Map coordinates are in arbitrary units, as defined by the projection. /// The only constraint on map coordinates is ...
use std::prelude::v1::*; mod error; mod hash; mod state; use { self::state::State, super::{ context::{AggregateContext, BlendContext, FilterContext}, evaluate::{evaluate, Evaluated}, filter::check_expr, }, crate::{ ast::{Aggregate, Expr, SelectItem}, data::Value...
use crate::api::sign_in_api; use crate::components::nav::NavComponent; use crate::router::Route; use crate::store::{AuthState, UserStore}; use log::info; use reqwasm::Error; use std::rc::Rc; use wasm_bindgen::JsCast; use web_sys::{EventTarget, FocusEvent, HtmlInputElement}; use yew::{events::Event, html, Callback, Comp...
extern crate pyo3; use py_file::PyFile; use pyo3::class::PyIterProtocol; use pyo3::exceptions as exc; use pyo3::prelude::*; use pyo3::types::PyBytes; use pyo3::types::PyObjectRef; use pyo3::types::PyString; use pyo3::PyObject; use pyo3::PyRawObject; use pyo3::PyResult; use pyo3::Python; use record; use util::get_option...
//! # 'ROM Functions' Example //! //! This application demonstrates how to call functions in the RP2040's boot ROM. //! //! It may need to be adapted to your particular board layout and/or pin assignment. //! //! See the `Cargo.toml` file for Copyright and licence details. #![no_std] #![no_main] // The macro for our ...
#[macro_use] extern crate clap; #[macro_use] extern crate failure_derive; #[macro_use] extern crate log; #[macro_use] extern crate serde_json; use crate::naming::Naming; pub use crate::{build::BuildSpec, cli::cli, container::{BuildContext, ContainerImage}, ...
/* * Copyright 2021 sukawasatoru * * 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...
// Copyright 2016 <NAME>, The Alacritty Project 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 ...
extern crate bitflags; use lazy_static::lazy_static; use bitflags::bitflags; bitflags! { pub struct FlagsECX: u32 { const SSE3 = 1 << 0; const PCLMUL = 1 << 1; const DTES64 = 1 << 2; const MONITOR = 1 << 3; const DS_CPL = 1 << 4; const...
// Copyright 2018 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::account_handler_context::AccountHandlerContext; use account_common::{AccountManagerError, LocalAccountId, ResultExt as AccountResultExt}; use fa...
use crate::error::{ErrorKind, LoftyError, Result}; use crate::file::FileType; use crate::tag::{Tag, TagType}; use crate::{ape, iff, mp3}; #[cfg(feature = "id3v1")] use crate::id3::v1::tag::Id3v1TagRef; #[cfg(feature = "id3v2")] use crate::id3::v2::{self, tag::Id3v2TagRef, Id3v2TagFlags}; #[cfg(feature = "mp4_ilst")] u...
use bevy::{app::AppExit, prelude::*}; use bevy_mod_picking::*; use crate::pieces::*; pub struct BoardPlugin; impl Plugin for BoardPlugin { fn build(&self, app: &mut AppBuilder) { app.init_resource::<SelectedSquare>() .init_resource::<SelectedPiece>() .init_resource::<PlayerTurn>() ...
use super::{ visibility_blocking, CommandBlocking, CommandInfo, Component, DrawableComponent, }; use crate::{keys::SharedKeyConfig, strings, ui, version::Version}; use asyncgit::hash; use crossterm::event::Event; use itertools::Itertools; use std::{borrow::Cow, cmp, convert::TryFrom}; use tui::{ backend::Ba...
use serde::Serialize; use std::fs::{self, metadata}; use std::path::{Path, PathBuf}; use tempfile::{self, tempdir}; /// The result of the `read_dir` function. /// /// A DiskEntry is either a file or a directory. /// The `children` Vec is always `Some` if the entry is a directory. #[derive(Debug, Serialize)] pub struct...
extern crate byteorder; extern crate crypto; extern crate hex; extern crate regex; use self::byteorder::ByteOrder; use self::byteorder::{LittleEndian, WriteBytesExt}; use self::crypto::digest::Digest; use self::crypto::sha1::Sha1; use self::regex::Regex; use std::error; use std::fs; use std::fs::OpenOptions; use std::...
extern crate postgres; extern crate postgres_openssl; extern crate postgres_array; extern crate openssl; extern crate r2d2; extern crate r2d2_postgres; extern crate jobsteal; extern crate git2; extern crate iron; extern crate router; extern crate logger; extern crate env_logger; extern crate rand; extern crate to...
use serde::{de, Deserialize, Serialize}; use std::fs::File; use std::fmt; use crate::{ arch, kvm::vcpu::VcpuConfig, }; type Result<E> = std::result::Result<(), E>; pub const DEFAULT_MEM_SIZE_MIB: usize = 128; pub const DEFAULT_KERNEL_CMDLINE: &str = "reboot=k panic=1 pci=off nomodules 8250.nr_uarts=0 \ ...
//! Common collision handling code use crate::core::math::{BoundingBox, Ray, RayHitInfo, Rectangle, Vector2, Vector3}; use crate::core::models::Model; use crate::ffi; impl Rectangle { /// Check collision between two rectangles #[inline] pub fn check_collision_recs(&self, other: &Rectangle) -> bool { ...
//! module to provide some handy interfaces atop the hashes so we have //! the common interfaces for the project to work with. use std::{ borrow::Cow, error, fmt, hash::{Hash, Hasher}, result, str::FromStr, }; use cryptoxide::blake2b::Blake2b; use cryptoxide::digest::Digest; use cryptoxide::sha3::...
use std::fmt; use crate::errors::Result; use crate::indicators::ExponentialMovingAverage as Ema; use crate::{Close, Nexta, Period, Reset}; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; /// The relative strength index (RSI). /// /// It is a momentum oscillator, /// that compares the magnitude of recen...
use crate::{ command_history::CommandHistory, commands::{Args, Auth}, Error, }; use indexmap::IndexMap; use serenity::{model::prelude::*, utils::parse_username}; use std::sync::Arc; use tracing::info; /// Send a reply to the channel the message was received on. pub async fn send_reply(args: Arc<Args>, me...
//! Box registers use crate::ast::Constant; #[cfg(feature = "with-serde")] use serde::{Deserialize, Serialize}; use sigma_ser::serializer::SerializationError; use std::{collections::HashMap, convert::TryFrom}; use thiserror::Error; /// newtype for additional registers R4 - R9 #[derive(PartialEq, Eq, Hash, Debug, Clon...
//! Some utilities to help choose LSH parameters. use crate::dist::l2_norm; use crate::prelude::*; use fnv::FnvHashSet; use ndarray::aview1; use rayon::prelude::*; use statrs::{ consts::SQRT_2PI, distribution::{ContinuousCDF, Normal}, }; use std::f64::consts::PI; use std::time::Instant; /// Hash collision prob...
use std::{ io::Write, fs::{self, File}, }; use tempfile; use regex::*; use super::*; fn compile_test_shader(stage: Stage, entry_point: &str, src: &str) -> ConvertedShader { let tmp_dir = tempfile::tempdir() .expect("faild to create temp dir for shader") .into_path(); let result = { ...
use p2p::multiaddr::Multiaddr; use std::collections::BTreeMap; use std::net::{IpAddr, SocketAddr}; use std::time::Instant; use fnv::{FnvHashMap, FnvHashSet}; use serde_derive::{Deserialize, Serialize}; // See: bitcoin/netaddress.cpp pchIPv4[12] pub(crate) const PCH_IPV4: [u8; 18] = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
use alloc::vec::Vec; use byteorder::{ByteOrder, BigEndian}; use super::{Opcode, ResponseCode, Header, QueryType, QueryClass}; /// Allows to build a DNS packet /// /// Both query and answer packets may be built with this interface, although, /// much of functionality is not implemented yet. #[derive(Debug)] pub struct...
use clap::{App, AppSettings, Arg, SubCommand}; use cron::Schedule; use nix::unistd::User; use std::str::FromStr; use url::Url; /// Struct of default key downloading schedules #[derive(Debug)] pub enum DefaultCron { Hourly, Daily, Weekly, Monthly, } /// FromStr implementation impl FromStr for DefaultCr...
use aravis::prelude::{CameraExt, CameraExtManual, StreamExt}; use image::DynamicImage; use std::path::PathBuf; use std::sync::Arc; use std::sync::mpsc; use std::time::{Duration, Instant, SystemTime}; use structopt::StructOpt; type ArcImage = Arc<image::DynamicImage>; type ImageCallback = Box<dyn FnMut(usize, SystemTim...
// Copyright (c) 2018-2021 The MobileCoin Foundation use bip39::ErrorKind as Bip39Error; use displaydoc::Display; use mc_attest_ake::Error as AkeError; use mc_attest_core::VerifyError as AttestVerifyError; use mc_crypto_box::Error as CryptoBoxError; use mc_crypto_keys::KeyError; use mc_crypto_noise::CipherError; use m...
use crate::webassembly::module::Module; use crate::webassembly::Instance; use byteorder::{ByteOrder, LittleEndian}; use libc::stat; use std::ffi::CStr; use std::mem::size_of; use std::os::raw::c_char; use std::slice; /// We check if a provided module is an Emscripten generated one pub fn is_emscripten_module(module: &...
use std::time::Duration; use super::poll_new::{do_poll_new, PollFd}; use crate::fs::IoEvents; use crate::prelude::*; pub fn do_select( num_fds: FileDesc, mut readfds: Option<&mut libc::fd_set>, mut writefds: Option<&mut libc::fd_set>, mut exceptfds: Option<&mut libc::fd_set>, timeout: Option<&mut ...
// modified from crossbeam use std::cell::RefCell; use std::fmt; use std::mem; use std::panic; use std::rc::Rc; use std::sync::Arc; use std::thread; use crate::coroutine_impl::{spawn, Coroutine}; use crate::join::JoinHandle; use crossbeam::atomic::AtomicCell; /// Like `coroutine::spawn`, but without the closure boun...
extern crate rand; extern crate rand_core; extern crate rand_xorshift; mod hippocampus; mod responder; mod util; use super::models::Factoid; use super::models::NewFactoid; use hippocampus::Hippocampus; use rand::prelude::IteratorRandom; use rand_core::SeedableRng; use rand_xorshift::XorShiftRng; use responder::Respon...
use crate::scales::{Scale, ScaleType}; use std::collections::HashMap; use std::collections::HashSet; /// The scale to represent categorical data. #[derive(Debug)] pub struct ScaleBand { /// The domain limits of the dataset that the scale is going to represent. domain: Vec<String>, /// The range limits of t...
use crate::forest::{GrammarReflector, Node, OwnedParseForestAndNode, ParseForest}; use crate::high::ErasableL; use crate::input::{Input, InputMatch, Range}; use indexing::{self, Index, Unknown}; use std::collections::HashMap; pub struct Parser<'a, 'i, G: GrammarReflector, I: Input, Pat> { state: &'a mut ParserStat...
use itertools::Itertools; use regex::Regex; use reqwest; use rust_htslib::bcf; use rust_htslib::bcf::{Format, Read}; use serde::{Deserialize, Serialize}; use std::collections::{HashMap, HashSet}; use std::error::Error; use std::str; #[derive(Serialize, Deserialize, Debug)] struct Dgidb { #[serde(rename = "matchedT...
use rand::Rng; use std::sync::{Arc, Mutex, RwLock}; use crate::skk::test_unix::{Path, MANY_THREAD_MUTEX_LOCK}; use crate::skk::yaskkserv2::{ BufRead, DictionaryFile, File, GoogleCache, Server, ServerDebug, Shutdown, Yaskkserv2, INITIAL_DICTIONARY_FILE_READ_BUFFER_LENGTH, }; pub(in crate::skk) trait Yaskkserv2...
use proc_macro::TokenStream; use quote::*; use syn::__private::TokenStream2; use syn::*; fn fix_raw_ident(ident: Ident) -> Ident { let s = ident.to_string(); if s.contains('#') { Ident::new(s.split_once('#').unwrap().1, ident.span()) } else { ident } } fn is_field_type_of(f: &Field, ta...
/* PORTIONS OF THIS FILE WERE ORIGINALLY DISTRIBUTED WITH THE FOLLOWING LICENSE """ MIT License Copyright (c) 2017 Rust for Robotics Developers 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 with...
/* * The Shadow Simulator * See LICENSE for licensing information */ //! Utilities helpful for writing Rust integration tests. use std::collections::HashSet; use std::fmt; use std::io::Write; pub mod socket_utils; #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum TestEnvironment { Shadow, Libc,...
use crate::util; use lazy_static::lazy_static; use memchr::memchr; use regex::Regex; use std::io; use std::io::BufRead; use std::io::Write; use structopt::*; #[derive(StructOpt, Debug)] #[structopt(rename_all = "kebab-case")] pub struct Opt { #[structopt(long)] col: Option<String>, #[structopt(long)] ...
extern crate thread_id; // 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 s...
// Copyright 2017 <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, ...
extern crate iron; extern crate hoedown; extern crate hyper; extern crate handlebars_iron; extern crate rustc_serialize; use self::iron::prelude::*; use self::iron::status; use self::hoedown::{Markdown, Render}; use self::hoedown::renderer::html::{Flags, Html}; use std::fs; use std::io::prelude::*; use std::fs::File...
#![feature(slice_concat_ext)] extern crate compiletest_rs as compiletest; extern crate colored; use colored::*; use std::slice::SliceConcatExt; use std::path::{PathBuf, Path}; use std::io::Write; macro_rules! eprintln { ($($arg:tt)*) => { let stderr = std::io::stderr(); writeln!(stderr.lock(), $...
// Copyright 2017 <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,...
use futures::future; use futures::Future; use net2::TcpBuilder; #[cfg(not(windows))] use net2::unix::UnixTcpBuilderExt; use num_cpus; use std::io; use std::net::ToSocketAddrs; use std::sync::Arc; use std::thread; use tokio; use tokio::net::{TcpStream, TcpListener}; use tokio::prelude::*; use tokio_codec::Framed; use s...
#![no_std] //! The [ProFont](https://web.archive.org/web/20180412214402/http://tobiasjung.name/profont/) //! monospace programming font for use with //! [embedded-graphics](https://github.com/jamwaffles/embedded-graphics). Font data taken from the //! [ProFont homepage](https://web.archive.org/web/20180412214402/http:...
#![feature(proc_macro_hygiene)] use ink_core::storage; use ink_lang2 as ink; #[ink::contract(version = "0.1.0")] mod erc721 { /// A token ID. pub type TokenId = u32; #[derive(scale::Encode, scale::Decode)] #[cfg_attr(feature = "ink-generate-abi", derive(type_metadata::Metadata))] pub enum Error {...
/* Copyright The containerd 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 agreed to...
// Copyright (c) 2016-2018 <NAME> <<EMAIL>> // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE.txt or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT.txt or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed /...
use crate::ledger::Ledger; use crate::types::*; use common::account_identifier::{AccountIdentifierStruct, Subaccount}; use common::principal_id::PrincipalId; pub use ic_kit::candid::Principal; use ic_kit::ic::trap; use cap_sdk::insert; use cap_sdk::DetailValue; use cap_sdk::IndefiniteEvent; use std::convert::TryInto...
// Copyright 2015-2021 Swim 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 to ...
use std::collections::HashMap; use anyhow::{anyhow, Result}; use itertools::Itertools as _; use crate::Challenge; pub struct Day04; type Passport = HashMap<String, String>; impl Challenge for Day04 { const DAY_NUMBER: u32 = 4; type InputType = Vec<Passport>; type OutputType = usize; fn part1(inpu...
use crate::api::*; use crate::services::cookie::CookieService; use crate::services::router; use serde::{Deserialize, Serialize}; use serde_json::to_string; use wasm_bindgen::prelude::*; use yew::{ format::{Json, Nothing}, prelude::*, }; use yew_material::text_inputs::*; use yew_material::{MatButton, MatFormfiel...