text
stringlengths
3.09k
13.9k
// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. //since this is going to get included in examples that might not use everything, clear out warnings //that are unnece...
use crate::constants::*; use anyhow::Context; use byteorder::{ByteOrder, NativeEndian}; use netlink_packet_utils::{ nla::{Nla, NlaBuffer, NlasIterator}, parsers::*, traits::*, DecodeError, }; use std::mem::size_of_val; mod mcast; mod oppolicy; mod ops; mod policy; pub use mcast::*; pub use oppolicy::*...
use crate::data::Data; use itertools::Itertools; use std::fmt; use std::ops::Range; #[derive(Debug, Copy, Clone, PartialEq)] enum Cube { Active, Inactive, } #[derive(Clone)] struct CubeSpace { /// `values[S * S * S * S * w + S * S * z + S * y + z]` values: Vec<Cube>, offset: i32, size: usize, ...
// Copyright (c) 2018-2021 <NAME> <<EMAIL>> // Distributed under the MIT License // (See acoompanying LICENSE file or a copy at http://opensource.org/licenses/MIT) //! Parser del Building Description Language (BDL) de DOE //! //! Bloques genéricos de BDL use super::AttrMap; use anyhow::{bail, Error}; // Objetos ---...
// Copyright 2017 Mozilla // // 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, software...
/** * [391] Perfect Rectangle * * Given an array rectangles where rectangles[i] = [xi, yi, ai, bi] represents an axis-aligned rectangle. The bottom-left point of the rectangle is (xi, yi) and the top-right point of it is (ai, bi). * Return true if all the rectangles together form an exact cover of a rectangular reg...
use crate::VaultError; use ockam_core::compat::boxed::Box; use ockam_core::vault::storage::Storage; use ockam_core::vault::{KeyId, SecretAttributes, SecretKey, SecretPersistence, VaultEntry}; use ockam_core::{async_trait, Result}; use ockam_node::compat::asynchronous::RwLock; use serde::{Deserialize, Serialize}; use st...
use serde::{Deserialize, Serialize}; use smart_default::SmartDefault; mod input; pub use input::{InputConfig, TitleBoost}; mod output; pub use output::OutputConfig; mod stemming; pub use stemming::StemmingConfig; mod frontmatter; pub use frontmatter::FrontmatterConfig; mod file; pub use file::{DataSource, File, Fi...
// Copyright 2019 The Exonum Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
use std::cmp::min; use serde_json::{Map, Value}; use crate::{Patch, Path}; /// Compute the diff between two JSON Documents /// /// `before` represents the document before the patches are applied /// `after` represents the document after the patches are applied /// /// For example: /// ```rust /// # use serde_json::j...
use super::merkle::MerkleTree; use crate::pwg::{self, input_to_value}; use acir::{circuit::gate::GadgetCall, native_types::Witness, OPCODE}; use aztec_backend::barretenberg_rs::Barretenberg; use blake2::Blake2s; use noir_field::FieldElement; use sha2::Digest; use std::collections::BTreeMap; // Note that the outputs fo...
//! The different types of `Any` for use in a map. //! //! This stuff is all based on `std::any`, but goes a little further, with `CloneAny` being a //! cloneable `Any` and with the `Send` and `Sync` bounds possible on both `Any` and `CloneAny`. use std::fmt; use std::any::Any as StdAny; #[doc(hidden)] pub trait Clon...
use crate::{ error::{Result, WindowError}, ffi::{body, canvas, ctx, document, request_animation_frame}, traits::Widget, types::{Color, Point, Region, Values}, }; use std::{cell::RefCell, collections::VecDeque, rc::Rc}; use wasm_bindgen::{prelude::Closure, JsCast}; use web_sys::{console, CanvasRenderingC...
// Copyright (C) 2022 Nydus Developers. All rights reserved. // // SPDX-License-Identifier: Apache-2.0 use std::collections::HashSet; use std::convert::TryFrom; use std::path::{Path, PathBuf}; use anyhow::{Context, Result}; use nydus_utils::compress; use nydus_utils::digest::{self}; use rafs::metadata::{RafsInode, R...
// Configurable Implementation // New configuration module, as described by u/JayDepp on Reddit - THANKS!!! // // 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/lic...
//! Contains the [BaseArray] type as well as the [BorrowedArray] Subtype. use crate::array_trait::{Array, Initialize}; /// A n-dimensional array pub struct BaseArray<T, const N: usize> { /// Pointer to the first element ptr: *mut T, /// Number of bytes between successive elements. Different Axes are allow...
use anyhow::{Error, Result}; use chrono::prelude::*; use serde::{Deserialize, Serialize}; use sqlx::{Done, Executor, Postgres}; use tracing::instrument; use url::Url; use super::ListParams; use crate::problem::forbidden_permission; #[derive(Debug, Serialize, Deserialize, Clone)] pub struct Shop { pub id: i32, ...
use std::{ collections::{hash_map::RandomState, HashSet}, path::{Path, PathBuf}, }; use generic_filesystem_cache::*; #[cfg(feature = "parallel_loading")] use rayon::prelude::*; use vid_dup_finder_lib::*; use super::{cache_entry::CachedVideoData, generic_cache_if::GenericCacheIf}; use crate::*; /// A disk-back...
use std::{ collections::{BTreeMap, HashMap}, io::Write, iter::Iterator, }; use crossterm::{ cursor, queue, style::{self, ContentStyle}, }; use super::Rect; use crate::models::Style; #[derive(Clone, Copy, PartialEq, Debug, Default)] pub struct Pixel { pub text: Option<char>, pub style: Style, } #[derive(Clone...
use crate::socket::Config; use crate::Error; use crate::Message; use crate::Socket; use async_trait::async_trait; use std::future::Future; use std::time::Duration; use tokio::sync::mpsc; use tokio::sync::oneshot; use tokio::time::Instant; use tokio_tungstenite::tungstenite; use url::Url; const DEFAULT_RECONNECT_INTERV...
// #![deny(warnings)] use std::convert::Infallible; use hyper::http; use http::{ Method, Request, Response, StatusCode }; use hyper::{ Body, Server }; use hyper::service::{ make_service_fn, service_fn }; use hyper::header::HeaderValue; use lazy_static::lazy_static; use tracing as log; use riven::{ RiotApi, RiotApiCo...
use chrono::NaiveTime; use nom::{ bytes::complete::{take_until, take_while}, character::complete::{char, one_of}, combinator::{map_parser, opt}, number::complete::float, sequence::preceded, IResult, }; use super::{ parse_faa_modes, utils::{number, parse_hms, parse_lat_lon}, FaaModes...
pub mod sqlite; use std::time::SystemTime; use crate::sqerror::Result; use fuse::{FileAttr, FileType}; use time::Timespec; use chrono::{DateTime, Utc, NaiveDateTime}; pub trait DbModule { /// Create tables (if not found) and add root directory (if not found) fn init(&mut self) -> Result<()>; /// Get metada...
use std::error::Error; use crate::buffer::{AudioBuffer, AudioBufferOptions}; use crate::media::MediaStream; use crate::SampleRate; /// Sample rate converter and buffer chunk splitter. /// /// A stream can be wrapped inside a `Resampler` to yield `AudioBuffer`s /// of the desired sample_rate and length /// /// ```igno...
#![allow(unused_imports)] use crossbeam_channel; use crate::{ button_handlers, ClientController, Task, }; use self::crossbeam_channel::Sender; use edit_common::commands::*; use serde_json; use std::cell::RefCell; use std::rc::Rc; use std::sync::atomic::AtomicBool; use std::sync::atomic::Ordering; use std...
use std::fs::File; use std::io::Write; use std::path::PathBuf; use std::{collections::HashMap, path::Path}; use futures::{stream, StreamExt}; use std::error::Error; use steamgriddb_api::query_parameters::GridDimentions; // 0.3.1 use steam_shortcuts_util::shortcut::ShortcutOwned; use steamgriddb_api::Client; use crat...
use anyhow::{Context, Result}; use diesel::connection::SimpleConnection; use diesel::prelude::*; use image::GenericImageView; #[cfg(feature = "mount")] use indicatif::{ProgressBar, ProgressIterator}; use std::{ io::{Seek, Write}, path::{Path, PathBuf}, time::SystemTime, }; table! { #[allow(non_snake_c...
use std::sync::mpsc::{Sender, Receiver, channel}; use ::gameboy::cpu::interrupts::{InterruptLine, Interrupt}; //pub type SerialCallback = (FnMut(u8) -> u8) + Send; #[derive(Serialize, Deserialize)] pub struct Serial { // Callback that is called when a byte is shifted through the serial port using the internal clock....
use crate::rendering::imgui::interface::{show_help_marker, size, size_a, ImguiColour}; use crate::rendering::imgui::state::{DebugState, GuiState, Notification}; use crate::GLOBAL_APP_STATE; use imgui::*; use nanoserde::*; use std::str::FromStr; use std::time::Duration; use crate::data::state::{DisplayColourConfigurabl...
#![crate_name = "file_data_splitter"] use std::fs::{create_dir, read_dir, File, OpenOptions}; use std::io::{ prelude::{BufRead, Write}, BufReader, BufWriter, Error, ErrorKind, }; use std::path::Path; use std::time::Instant; #[inline(always)] fn create_folder_path(parent: &str, name: &str) -> String { let ...
// The MIT License (MIT) // // Copyright (c) 2022 <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, mo...
use std::io::{stdin, BufRead}; use std::str::FromStr; use std::iter::repeat; #[derive(Debug, Clone)] struct Bits { data: Vec<u8>, pos: usize, } impl FromStr for Bits { type Err = (); fn from_str(s: &str) -> Result<Self, ()> { let s = s.trim(); let first_digits = s.chars().step_by(2); ...
// let mut dict = [0u8; 256]; // for i in 0..=255u8 { // let mut x = i; // for _j in 8..0u8 { // if (x & 0x80) != 0 { // x = (x << 1) ^ 0x07 // } else { // x = (x << 1) ^ 0 // } // ...
use std::io; use std::path::Path; use std::str::FromStr; use std::io::prelude::*; use std::fs::{self, File}; use std::process::Command; use crate::pure; use crate::utils; const CONFIGPATH: &str = "~/.config/koneko/config.ini"; fn read_raw() -> Option<String> { let mut f = File::open(CONFIGPATH).ok()?; let mu...
#![feature(proc_macro_hygiene, decl_macro)] #[macro_use] extern crate rocket; use std::io::prelude::*; use std::path::{Path, PathBuf}; use std::thread; use std::time::Duration; use rocket::config::Environment; use rocket::fairing::AdHoc; use rocket::response::content::Html; use rocket::response::NamedFile; use rocke...
//! Support for piet Direct2D back-end. use std::fmt; use direct2d::enums::BitmapOptions; use direct2d::image::Bitmap; use direct2d::render_target::RenderTag; use direct2d::RenderTarget; use direct3d11::flags::{BindFlags, CreateDeviceFlags}; use direct3d11::helpers::ComWrapper; use dxgi::flags::Format; use piet::{Er...
// Copyright (c) 2018-2021 <NAME> <<EMAIL>> // Distributed under the MIT License // (See acoompanying LICENSE file or a copy at http://opensource.org/licenses/MIT) //! Parser del Building Description Language (BDL) de DOE //! //! Composiciones constructivas de cerramientos opacos (LAYERS) use std::{collections::HashM...
use std::{cell, ops, rc}; use std::num::NonZeroU32; #[derive(Clone)] pub struct Texture { pub inner: rc::Rc<cell::RefCell<InnerT>>, } pub struct InnerT { pub texture: wgpu::Texture, pub view: wgpu::TextureView, pub sampler: Option<wgpu::Sampler>, pub size: (u32, u32), pub filter_mode: crate::F...
use std::{convert::TryInto, io, path::Path, time::Duration}; use v4l::control::{ Control, MenuItem as ControlMenuItem, Type as ControlType, Value as ControlValue, }; use v4l::video::Capture; use v4l::Device as CaptureDevice; use v4l::Format as CaptureFormat; use v4l::FourCC as FourCC_; use crate::control; use cra...
//! `metering` is a middleware for tracking how many operators are executed in total //! and putting a limit on the total number of operators executed. use std::fmt; use std::sync::Mutex; use wasmer::wasmparser::{ Operator, Result as WpResult, Type as WpType, TypeOrFuncType as WpTypeOrFuncType, }; use wasmer::{ ...
// // Sysrepo-examples. // utils // //#[allow(non_upper_case_globals)] use std::ffi::CStr; use std::sync; use nix::sys::signal; use sysrepo::*; /// Print value. pub fn print_val(value: &sr_val_t) { let sr_val_p: *const sr_val_t = value as *const sr_val_t; if sr_val_p.is_null() { return; } ...
extern crate eth_pairings; use eth_pairings::public_interface::eip196::EIP196Executor; // use pyo3::types::PyInt; use pyo3::prelude::*; use pyo3::wrap_pyfunction; fn put_u8(input: &[u128]) -> [u8; 32] { let mut res: [u8; 32] = [0; 32]; let n_elem = 128/8; let n_total_elem = 256/8; for i in 0..n_total...
// Copyright 2019 Parity Technologies (UK) Ltd. // This file is part of Substrate. // Substrate 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 option) any la...
use super::{Solver, SolverError, SolverResult}; use std::fmt::{self, Write}; use std::str::FromStr; #[derive(Debug, Clone, Copy)] enum FoldInstruction { // fold x=value X(usize), // fold y=value Y(usize), } impl FromStr for FoldInstruction { type Err = &'static str; fn from_str(s: &str) -> ...
use crossbeam_channel::SendError; use std::cell::RefCell; use std::ops::Deref; use std::rc::Rc; extern crate cursive; // use self::cursive::align::HAlign; use self::cursive::event::{Callback, Event, EventResult, Key}; use self::cursive::Cursive; use self::cursive::{traits::*, view::Selector}; use self::cursive::{ ...
use std::cmp; use amethyst::{ ecs::{Entity, Read, World, WriteStorage}, shred::{ResourceId, SystemData}, }; use asset_model::{config::AssetType, loaded::AssetId}; use asset_selection_model::play::AssetSelection; use asset_selection_ui_model::play::ApwPreview; use asset_ui_model::play::AssetSelectionParent; use...
#[macro_use] extern crate clap; use clap::App; extern crate url; use colored::*; use std::env; use std::fs::create_dir; use std::path::PathBuf; pub fn from_extension(extension: impl AsRef<str>) -> Option<tide::http::mime::Mime> { match extension.as_ref() { "html" => Some(tide::http::mime::HTML), "j...
use regex::Regex; use std::fmt::Write as _; use std::fs; use std::path::Path; use std::path::PathBuf; use std::path::MAIN_SEPARATOR; use std::str; use protobuf_test_common::build::copy_tests_v2_v3; use protobuf_test_common::build::glob_simple; use std::process::Command; use std::process::Stdio; fn to_paths(iter: impl...
use std::rc::Rc; use sdl2::mouse::{MouseButton, MouseState}; use sdl2::pixels::Color; use sdl2::rect::Point as SDLPoint; use sdl2::rect::Rect as SDLRect; use specs::prelude::*; use super::profession_tree::SKILL_NODE_SIZE; use crate::after_image::prelude::*; use crate::atlas::prelude::*; use crate::clash::{EquipmentIt...
use std::{clone::Clone, collections::HashMap, iter::Peekable, str::Chars}; use crate::{lox, lox_type::LoxType, token::Token, token_type::TokenType}; pub struct Scanner<'a> { source: String, chars: Peekable<Chars<'a>>, tokens: Vec<Token>, keywords: HashMap<&'a str, TokenType>, start: usize, cur...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // // @generated SignedSource<<3cb85492b506c5f5fab76682c095751b>> // // To regenerate this file, run: // hphp/hack/src/oxidized_by_rc/r...
//! Demonstrates how to use the fly camera use amethyst::{ assets::{PrefabLoader, PrefabLoaderSystem, RonFormat}, controls::{ArcBallControlBundle, ArcBallControlTag}, core::{ shrev::{EventChannel, ReaderId}, transform::{Transform, TransformBundle}, Float, }, ecs::prelude::{ ...
/// Traits and types for all system components. pub mod components; /// Common data types used throughout The Graph. pub mod data; /// Utilities. pub mod util; /// Extension traits for external types. pub mod ext; /// Logging utilities pub mod log; /// `CheapClone` trait. pub mod cheap_clone; pub mod ipfs_client;...
//! This module contains code to read command line arguments for the ja2 executable use std::path::PathBuf; use std::str::FromStr; use getopts::Options; use log::warn; use crate::config::{EngineOptions, Resolution, VanillaVersion}; use crate::fs::canonicalize; #[cfg(not(windows))] static GAME_DIR_OPTION_EXAMPLE: &s...
// Based on src/dir.rs from nix use crate::old::snapshot_0::hostcalls_impl::FileType; use libc; use nix::{Error, Result}; use std::os::unix::io::{AsRawFd, IntoRawFd, RawFd}; use std::{ffi, ptr}; #[cfg(target_os = "linux")] use libc::dirent64 as dirent; #[cfg(not(target_os = "linux",))] use libc::dirent; /// An open ...
use std::borrow::Cow; use std::collections::HashMap; use std::collections::HashSet; use std::time::Duration; use rand::distributions::Distribution; use rand::distributions::Uniform; use rand::Rng; use simulator::NetworkConfig; use simulator::Node; use crate::actors::honest::HonestActor; use crate::actors::Timing; us...
use std::collections::HashSet; use std::convert::AsRef; use std::ffi::{c_void, CString}; use std::fmt; use std::hash::{Hash, Hasher}; use crate::def::{ClassLike, Define, EnclosingRubyScope, Method}; use crate::method; use crate::sys; use crate::value::Value; use crate::{Artichoke, ArtichokeError}; pub struct Spec { ...
use std::fmt::Debug; /** * Variables own resources. * When vairables goes out of scope, resource is destroyed. * Destructor is provided via Drop trait. * * Avoiding memory leaks */ fn raii() { let box1 = Box::new(42); { let box2 = Box::new(32); assert_eq!(box2.as_ref(), &32); //b...
// This file is part of galacticcouncil/warehouse. // Copyright (C) 2020-2022 Intergalactic, Limited (GIB). // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the Lic...
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ counters::*, create_access_path, data_cache::StateViewCache, diem_vm::DiemVMImpl, transaction_metadata::TransactionMetadata, VMValidator, }; use diem_logger::prelude::*; use diem_state_view::StateView; use diem_type...
use crate::model::ParsingContext; use crate::pb::*; use tract_hir::internal::*; use tract_onnx_opl::einsum::Expr; pub fn einsum( _ctx: &ParsingContext, node: &NodeProto, ) -> TractResult<(Box<dyn InferenceOp>, Vec<String>)> { let expr = node.get_attr::<String>("equation")?; let expr = expr.replace("......
//! Draw 2D graphics for your users. //! //! A [`Canvas`] widget can be used to draw different kinds of 2D shapes in a //! [`Frame`]. It can be used for animation, data visualization, game graphics, //! and more! //! //! [`Canvas`]: struct.Canvas.html //! [`Frame`]: struct.Frame.html use crate::{Backend, Defaults, Prim...
//! Bus Components for Intel8080 Parallel Interface, I2C, SPI //! //! Example //! //! Intel 8080 Parallel Interface //! //! let bus = components::bus::Bus8080BusComponent::new().finalize( //! components::bus8080_bus_component_helper!( //! // bus type //! stm32f412g::fsmc::Fsmc, //! // bus //...
use atty::Stream; use std::collections::HashMap; /// Represents colors in an ANSI terminal. Represents the color of the text printed to the screen. /// This is used in the Console API to tell `currant` what color to print the command metadata. /// Each command should get a different color to visually differentiate out...
// Copyright (c) 2019 DDN. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. use crate::{ agent_error::ImlAgentError, cmd::cmd_output_success, fs::{read_file_to_end, stream_dirs, write_tempfile}, }; use futures::prelude::*; use std:...
#![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] include!(concat!(env!("OUT_DIR"), "/bindings.rs")); extern crate clipboard; use clipboard::ClipboardProvider; use clipboard::ClipboardContext; use winapi::shared::minwindef::*; use winapi::shared::windef::*; use win...
use eyros::{DB,Row,Point,Mix,Mix3}; use random::{Source,default as rand}; use failure::Error; use random_access_disk::RandomAccessDisk; use tempfile::Builder as Tmpfile; use std::cmp::Ordering; type P = Mix3<f32,f32,u64>; type V = u32; #[test] fn mix3() -> Result<(),Error> { let dir = Tmpfile::new().prefix("eyros")...
// Copyright 2021 Contributors to the Parsec project. // SPDX-License-Identifier: Apache-2.0 //! Rust PKCS11 new abstraction //! //! The items in the new module only expose idiomatic and safe Rust types and functions to //! interface with the PKCS11 API. All the PKCS11 items might not be implemented but everything //! ...
use { crate::networking::ServerMessage, std::{ collections::HashMap, cell::RefCell, rc::Rc, }, serde::{Serialize, Deserialize}, }; #[cfg(test)] mod test; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum InvalidMove { PieceAlreadyPresent, Suicide, ...
use std::borrow::Borrow; use std::fmt::Debug; use crate::draw::{Dimension, Position, Rect}; use crate::prelude::*; //use crate::render::text::Text as RenderText; use crate::render::new_primitive; use crate::render::PrimitiveKind; use crate::text::{ FontStyle, FontWeight, Glyph, NoStyleTextSpanGenerator, TextDecora...
// Copyright lowRISC contributors. // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 //! Provides a "cursor" over a mutable byte buffer. //! //! [`Cursor`] provides a `consume()` function, which can be called repeatedly //! to take portions of the buffer...
use super::{ load::{Source, Specifier}, Bundler, }; use crate::{id::Id, load::Load, resolve::Resolve}; use indexmap::IndexMap; use swc_atoms::{js_word, JsWord}; use swc_common::{FileName, SyntaxContext}; use swc_ecma_ast::*; use swc_ecma_utils::find_ids; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, Visit...
use futures::executor::block_on; use imgui::{Context, FontSource, Ui}; use imgui_wgpu::{Renderer, RendererConfig}; use imgui_winit_support::WinitPlatform; use std::time::Instant; use winit::{ dpi::LogicalSize, event::{Event, WindowEvent}, event_loop::{ControlFlow, EventLoop}, window::Window, }; pub str...
use super::HeaderName; /// The `Content-Encoding` Header pub const CONTENT_ENCODING: HeaderName = HeaderName::from_lowercase_str("content-encoding"); /// The `Content-Language` Header pub const CONTENT_LANGUAGE: HeaderName = HeaderName::from_lowercase_str("content-language"); /// The `Content-Length` Header pub const ...
use super::types::*; pub fn tokenizer(contents: &str) -> Vec<Token> { let mut tokens = TokenParser::new(contents); let mut is_close_single_line = true; while let Some(&c) = tokens.peek() { if is_close_single_line { match c { '{' => tokens.push(Token::OpenBrace), ...
use crate::int_code::Program; use std::collections::{HashSet, VecDeque}; #[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)] enum Direction { NORTH, EAST, SOUTH, WEST, } impl Direction { fn reverse(self) -> Direction { match self { Direction::NORTH => Direction::SOUTH, ...
use std::collections::HashMap; use std::io::{Cursor, Error}; use std::net::{Ipv4Addr, SocketAddr}; use std::str; use std::time::Duration; use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use futures::{Future, Stream}; use tokio::timer::Interval; use tokio_core::reactor::Handle; use trust_dns::op::{Message, Mes...
use super::*; use crate::time::{clockid_t, itimerspec_t, timespec_t, ClockID}; use atomic::{Atomic, Ordering}; use std::time::Duration; /// Native Linux timerfd #[derive(Debug)] pub struct TimerFile { host_fd: HostFd, host_events: Atomic<IoEvents>, notifier: IoNotifier, } impl TimerFile { pub fn new(...
use std::ops::{Add, Sub, Mul, Div, Neg}; use std::convert::From; pub use std::f64::consts::PI; use aliases::*; #[derive(Clone, Copy, Debug)] pub struct V3 { pub x: f64, pub y: f64, pub z: f64, } /// Vector class of 3 dimensions /// Can also be used to store colors (x=r, y=g, z=b) /// Arithmetic support...
use timely::order::TotalOrder; use timely::dataflow::*; use timely::dataflow::operators::probe::Handle as ProbeHandle; use differential_dataflow::operators::*; use differential_dataflow::difference::DiffPair; use differential_dataflow::operators::reduce::ReduceCore; use differential_dataflow::operators::ThresholdTotal...
// Copyright 2018 The Chromium OS 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::pci::ac97_regs::*; // AC97 Vendor ID const AC97_VENDOR_ID1: u16 = 0x8086; const AC97_VENDOR_ID2: u16 = 0x8086; // Extented Audio ID const A...
use curve25519_dalek::scalar::Scalar; use zkvm::{Commitment, Contract, Predicate, Program, String, Value}; /// Represents a ZkVM Token with unique flavor and embedded /// metadata protected by a user-supplied Predicate. #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct Token { issuance_predicate: Predicate, ...
use crate::frame::Command; use crate::frame::{Frame, Transmission}; use crate::header::{Header, HeaderList}; use bytes::BytesMut; use nom::IResult; use tokio_io::codec::{Decoder, Encoder}; use nom::branch::alt; use nom::bytes::streaming::{is_a, tag}; use nom::character::complete::{anychar, line_ending}; use nom::combi...
use js_sys::Array; use once_cell::sync::{Lazy, OnceCell}; use spinning_top::Spinlock; use std::future::Future; use std::pin::Pin; use std::sync::Arc; use std::task::{Context, Poll, Waker}; use std::time::Duration; use wasm_bindgen::prelude::*; use web_sys::Worker; #[wasm_bindgen] pub struct SpawnEntry { inner: Bo...
use multihash_derive::Multihash; /// Default (cryptographically secure) Multihash implementation. /// /// This is a default set of hashing algorithms. Usually applications would use their own subset of /// algorithms. See the [`Multihash` derive] for more information. /// /// [`Multihash` derive]: crate::derive #[deri...
// Copyright 2019 Twitter, 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...
/*! # `CheckSame` `CheckSame` is a recursive, cumulative Blake3 file hasher for x86-64 Linux machines. It is "cumulative" in the sense that it computes a _single_ hash representing all of the files passed to it, rather than individual hashes for each file. By default, this hash is simply printed to STDOUT. However,...
use std::path::PathBuf; use wolfram_app_discovery::{WolframApp, WolframVersion}; fn main() { // Ensure that changes to environment variables checked by wolfram-app-discovery will // cause cargo to rebuild the current crate. wolfram_app_discovery::config::set_print_cargo_build_script_instructions(true); ...
//! # Module de lancement des services //! //! Ce module ne contient pour l'instant qu'une seule fonction, qui démarre "réellement" le programme. C'est le point d'entrée si Robert doit être ajouté dans un autre projet : vous pouvez intégrer cette fonction pour servir un port TCP. //! // --- --- --- --- --- --- --- ---...
// 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::{Context as _, Error}; use fidl::endpoints::ServiceMarker; use fidl_fuchsia_ui_input2 as ui_input; use fidl_fuchsia_ui_shortcut as ui_shortcut;...
use crate::datasets::listing::Provenance; use geoengine_datatypes::collections::VectorDataType; use geoengine_datatypes::primitives::{ FeatureDataType, Measurement, TimeGranularity, TimeInterval, }; use geoengine_datatypes::raster::RasterDataType; use geoengine_datatypes::spatial_reference::SpatialReference; use ge...
use arrow::array::{Array, ArrayRef, BinaryArray, PrimitiveArray}; use arrow::datatypes::{DataType, Field, Schema}; use snafu::ensure; use std::collections::HashMap; use std::sync::Arc; use crate::datatype::ScalarValue; use crate::error::{self as error, Error}; use crate::{as_array, Idx}; #[derive(Clone, Debug)] pub ...
use nu_engine::column::get_columns; use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Value, }; #[derive(Clone)] pub struct Trans...
use std::str::FromStr; use std::cmp::{min, max, Eq, PartialEq}; #[derive(Copy, Clone)] pub struct Point { x: i32, y: i32, } #[derive(Copy, Clone)] pub struct Line { p1: Point, p2: Point, } impl Point{ pub fn new(x: i32, y: i32) -> Self { return Point{x: x, y: y}; } pub fn len(&se...
extern crate bindgen; extern crate cc; extern crate flate2; extern crate tar; use flate2::read::GzDecoder; use std::{ env, fs::{create_dir_all, File}, path::{Path, PathBuf}, }; // Prebuilt tarball locations #[cfg(target_os = "windows")] const LATEST_PREBUILT_URL: &'static str = "https://github.com/goo...
mod modules_worker; mod plain_text; mod project_assets; mod service_worker; mod text_blob; mod wasm_module; use anyhow::Result; use reqwest::blocking::multipart::Form; use std::fs; use std::path::Path; use std::path::PathBuf; use crate::settings::binding; use crate::settings::toml::{Target, TargetType, UploadFormat, ...
//! This module contains tests for macro expansion. Effectively, it covers `tt`, //! `mbe`, `proc_macro_api` and `hir_expand` crates. This might seem like a //! wrong architecture at the first glance, but is intentional. //! //! Physically, macro expansion process is intertwined with name resolution. You //! can not ex...
//! [GLFW](https://crates.io/crates/glfw) backend for [luminance](https://crates.io/crates/luminance) //! and [luminance-windowing](https://crates.io/crates/luminance-windowing). #![deny(missing_docs)] use gl; use glfw::{self, Context, CursorMode as GlfwCursorMode, SwapInterval, Window, WindowMode}; use glfw::{InitEr...
mod hybrid; mod memory; #[cfg(test)] mod test; pub use hybrid::Hybrid; pub use memory::Memory; #[cfg(test)] pub use test::Test; use crate::error::Result; use std::fmt::Display; use std::ops::{Bound, RangeBounds}; /// A log store. Entry indexes are 1-based, to match Raft semantics. pub trait Store: Display + Sync + ...
use indexmap::IndexMap; use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ Category, Config, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Value, }; use quick_xml::events::{BytesEnd, BytesSt...