text
stringlengths
3.09k
13.9k
use std::{ collections::HashMap, io, path::{Path, PathBuf}, slice, stringify, }; use detour::GenericDetour; use log::{debug, error}; use widestring::{WideCStr, WideCString}; use crate::virtual_sqpack::{VirtualArchiveFileHandle, VirtualSqPackPackage}; use crate::winapi::{get_proc_address, FnCloseHandle...
//! Text widget for rendering icons. //! //! Nearly a complete copy of the `iced_native::Text` widget, but with the //! icons font as a default font. Maybe I'll find a better way in the future. //! //! //! *This API requires the following crate features to be activated: `icon_text`* use std::hash::Hash; use iced_nativ...
use gloo::storage::{LocalStorage, Storage}; use state::{Entry, Filter, State}; use strum::IntoEnumIterator; use web_sys::HtmlInputElement as InputElement; use yew::{ classes, events::{FocusEvent, KeyboardEvent}, html, html::Scope, Classes, Component, Context, Html, NodeRef, TargetCast, }; mod state...
pub struct Scanner<R: std::io::Read> { reader: R, } impl<R: std::io::Read> Scanner<R> { /// let stdin = std::io::stdin(); /// let mut sc = Scanner::new(stdin.lock()); pub fn new(reader: R) -> Self { Self { reader: reader } } pub fn scan<T: std::str::FromStr>(&mut self) -> T { use std::io::...
// 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. use std::convert::TryFrom; use std::fmt::{self, Display}; use std::path::{Path, PathBuf}; use eq_modulo_pos::EqModuloPos; use no_pos_ha...
#[allow(unused_imports)] use builtin::*; mod pervasive; use pervasive::*; use pervasive::seq::*; use state_machines_macros::state_machine; #[spec] pub fn ids_distinct(ids: Seq<nat>) -> bool { forall(|i: int, j: int| i != j && 0 <= i && i < ids.len() && 0 <= j && j < ids.len() >>= ids.index(i) !=...
#[cfg(feature = "emulate")] use crate::CURRENT_TEST_NAME; #[cfg(not(feature = "emulate"))] use scale::{Channel, Reveal}; use scale::{Player, SecretModp}; use scale_std::slice::Slice; #[cfg(feature = "emulate")] use once_cell::sync::Lazy; #[cfg(feature = "emulate")] use std::{collections::HashMap, sync::Mutex}; #[cfg(...
// Copyright © 2020, Oracle and/or its affiliates. // // Copyright (c) 2019 Intel Corporation. All rights reserved. // Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. // // Copyright 2017 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license ...
extern crate itertools; extern crate ndarray; use ndarray::prelude::*; use ndarray::Zip; // Edge Cases for Windows iterator: // // - window size is 0 // - what is the behaviour of the standard for this situation? // "Panics if size is 0." // - window size of 1 // - should a warning be printed? // - ...
use anyhow::Result; use itertools::Itertools; use petgraph::{graph::NodeIndex, Graph, Undirected}; use std::collections::HashMap; use smallvec::{smallvec, SmallVec}; pub fn solve_puzzle() -> Result<()> { const INPUT: &str = include_str!("../assets/day12.txt"); println!("Part1: {}", part1(parse_input(INPUT))); ...
use crate::Result; use anyhow::anyhow; use bytes::Bytes; use openssl::{derive, hash, pkey, rand, sha, sign, symm}; use std::convert::TryInto; use std::fs::File; use std::io::Read; use std::path::Path; const AES_128_CTR_KEY_LEN: usize = 16; const AES_128_CTR_IV_LEN: usize = 16; pub(crate) const NONCE_LEN: usize = AES_1...
use rltk::{Algorithm2D, BaseMap, Point, Rltk, RGB}; use shipyard::UniqueView; use std::cmp::{max, min}; #[derive(Clone, Copy, PartialEq, Eq)] pub enum Tile { Floor, Wall, } #[allow(unused)] pub struct Map { pub tiles: Vec<Tile>, pub rooms: Vec<Room>, pub width: u32, pub height: u32, pub re...
use serde::{Deserialize, Serialize}; pub use data_rate::*; pub mod data_rate { use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; use std::cmp::PartialEq; use std::str::FromStr; use std::string::ToString; #[derive(Debug, Clone, Default, PartialEq)] pub struct DataRate(Spreading...
use ecs; use toml; use glium; use std::rc; use std::cell; use na; use obj; use info; use components; #[derive(Debug, Clone)] pub struct Station(pub rc::Rc<cell::RefCell<StationObj>>); #[derive(Debug)] pub struct StationObj { program: glium::Program, vbuf1: glium::VertexBuffer<Vertex>, ibuf1: glium::Index...
// pub use inner::*; // Workaround to disable snake_case warning for the struct. // Annotating struct/fields didn't work for some reasons // mod inner { // #![allow(non_snake_case)] use std::cmp::max; use derive_more::{Add, AddAssign, Mul}; use crate::core::dna::{Nucleotide, ReqNucleotide}; #[derive(Clone, Cop...
use std::io::BufRead; // rustc incorrectly suggests `std::os::ext::process::CommandExt`. // <https://github.com/rust-lang/rust/issues/39175> use std::os::unix::process::CommandExt; use std::process::Command; use std::str; use diesel; use diesel::prelude::*; use diesel::sqlite::SqliteConnection; use diesel::types::*; u...
#![cfg(feature = "googlevr")] use {VRGamepad, VRGamepadData, VRGamepadHand, VRGamepadState, VRGamepadButton}; use rust_webvr_api::utils; use gvr_sys as gvr; use gvr_sys::gvr_controller_api_status::*; use gvr_sys::gvr_controller_button::*; use gvr_sys::gvr_controller_connection_state::*; use gvr_sys::gvr_controller_hand...
use crate::CliOptions; use clap::Clap; use genome_graph::bigraph::traitgraph::algo::components::is_strongly_connected; use genome_graph::bigraph::traitgraph::algo::predefined_graphs::{ compute_m_from_n_and_c, create_random_graph, }; use genome_graph::bigraph::traitgraph::implementation::petgraph_impl; use genome_gr...
//! Atomic hash table. Allows thread-safe atomic hash table insertions without //! needing locks #![no_std] extern crate alloc; use core::sync::atomic::{AtomicUsize, Ordering}; use core::marker::PhantomData; use alloc::vec::Vec; use alloc::boxed::Box; /// An atomic hash table that allows insertions and lookups in p...
/* * Copyright 2018 The Starlark in Rust Authors. * Copyright (c) Facebook, Inc. and its affiliates. * * 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 * * https://www.apache.org/lic...
// Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). #![deny(warnings)] // Enable all clippy lints except for many of the pedantic ones. It's a shame this needs to be copied and pasted across crates, but there doesn't appear to be a way to...
use crate::text::Font; use sdl2::pixels::Color; use sdl2::rect::{Point, Rect}; use sdl2::render; use std::collections::HashMap; use crate::entity::EntityKind; use crate::geometry::Vertex; use crate::text; use crate::world::{Entities, Geometries, Healths, GRID_HEIGHT, GRID_WIDTH, PLAYER_HEALTH_MAX}; // Screen coordin...
use crate::drivers::display::get_display_for_sure; use crate::utils::colors; use crate::utils::font; use core::fmt::Write; use embedded_graphics::{ mono_font::{MonoFont, MonoTextStyle}, pixelcolor::Rgb888, prelude::*, text::{renderer::CharacterStyle, Baseline, Text}, }; use fs::*; once_mutex!(pub CONSO...
// Copyright Materialize, Inc. 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 the Apache License...
// Copyright 2019-present, the HuggingFace Inc. team, The Google AI Language Team and Facebook, Inc. // Copyright 2019 <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://ww...
use crate::fields::Field256; use crate::proofs::compute_challenge; use crate::secp256k1::{pedersen_commitment, point_add, point_inverse, point_mul, Point}; use crate::serialization::{Deserialize, Serialize}; /// Commitment to x given: (g, h, l = g^x*h^y). /// /// Interactive protocol for verifying a pedersen commitmen...
extern crate getopts; use anyhow::anyhow; use std::env; use std::path::Path; use crate::{load, progress::ConsoleProgress, trace, work}; // The result of starting a build. enum BuildResult { /// A build task failed. Failed, /// Regenerated build.ninja rather than the requested build. The caller /// m...
#![no_std] elrond_wasm::imports!(); elrond_wasm::derive_imports!(); use elrond_wasm::elrond_codec::TopEncode; #[derive(TypeAbi, TopEncode, TopDecode, Clone)] pub struct IdGenerator<M: ManagedTypeApi> { pub timestamp: u64, pub caller_address: ManagedAddress<M>, } #[derive(TypeAbi, TopEncode, TopDecode, ...
use crate::patch::Patch; use std::cmp::min; use std::collections::HashMap; use std::collections::HashSet; use crate::dom_updater::ActiveClosures; use virtual_node::DynClosure; use wasm_bindgen::JsCast; use wasm_bindgen::JsValue; use web_sys::{CharacterData, Element, Node, Text}; /// Apply all of the patches to our ol...
use core::convert::Infallible; use hyper::Body; use hyper::Method; use hyper::Request; use hyper::Response; use hyper::StatusCode; use libc::{c_char, c_int}; use serde_json; use serde_json::json; use std::ffi::CStr; use std::ffi::CString; #[repr(C)] #[derive(Debug)] struct CResult { message: *mut c_char, stat...
use nalgebra::{Isometry3, Point3, Vector3}; use ncollide3d::query::{Ray, RayCast}; use ncollide3d::shape::Triangle; use crate::shared::{ HtmIndex, vec3, BIT_MASK_N, BIT_MASK_S, BIT_MASK_0, BIT_MASK_1, BIT_MASK_2, BIT_MASK_3, }; type TrianglePoints = [Vector3<f32>; 3]; pub struct Trixe...
use ramp::{ Int, RandomInt, }; use std::str::FromStr; use rand; use util::mod_exp; // Returns True if probability that `n` is composite is less then 4**(`number_of_rounds`) pub fn rabin_miller(potential_prime: &Int, number_of_rounds: u32) -> bool { // check if number is even if potential_prime & 1 == ...
//! Create a private bids. use anchor_lang::{prelude::*, AnchorDeserialize}; use anchor_spl::token::{Mint, Token, TokenAccount}; use mpl_auction_house::{ self, constants::{AUCTIONEER, FEE_PAYER, PREFIX}, cpi::accounts::AuctioneerBuy as AHBuy, program::AuctionHouse as AuctionHouseProgram, AuctionHo...
use ecs_disk_manager::{disk_types::*, *}; fn main() { let mut manager = DiskManager::default(); if let Err(why) = manager.scan() { eprintln!("failed to scan devices: {}", why); return; } for (entity, device) in manager.devices() { if manager.is_disk(entity) { list_...
use std::{fs, io, str::FromStr, sync, thread, time}; use ckb_logger::{error, info}; use ckb_metrics::metrics; use jemalloc_ctl::{epoch, stats}; use crate::rocksdb::TrackRocksDBMemory; macro_rules! je_mib { ($key:ty) => { if let Ok(value) = <$key>::mib() { value } else { er...
use std::cmp::Ordering; use std::fmt; use crate::collection::schema::Column; use crate::error; use crate::scalar::*; use crate::{Match, TCResult, TryCastFrom, TryCastInto}; use super::collator::Collator; use super::Key; #[derive(Clone, Eq, PartialEq)] pub struct BTreeRange(Vec<Bound>, Vec<Bound>); impl BTreeRange {...
use crate::model::ParsingContext; use crate::pb::*; use tract_hir::internal::*; pub fn slice( ctx: &ParsingContext, node: &NodeProto, ) -> TractResult<(Box<dyn InferenceOp>, Vec<String>)> { let v = ctx.onnx_operator_set_version; if v >= 1 && v < 10 { slice1(ctx, node) } else if v == 10 { ...
use codespan::ByteSpan; use name::{Ident, Name}; use syntax::concrete; use syntax::core; use var::{Named, Var}; pub trait ToCore<T> { fn to_core(&self) -> T; } impl<'input> ToCore<Result<core::Module, ()>> for concrete::Module<'input> { fn to_core(&self) -> Result<core::Module, ()> { match *self { ...
// 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. use std::cell::{Cell, RefCell}; use std::cmp::max; use std::sync::atomic::{AtomicUsize, Ordering}; use crate::{block::Header, Allocator...
#[macro_use] extern crate clap; #[macro_use] extern crate serde_derive; extern crate serde_yaml; #[macro_use] extern crate log; extern crate env_logger; #[macro_use] extern crate structopt; extern crate xblockchain; extern crate xblockchain_storage; extern crate exe_common; extern crate protocol_tokio as protocol; ext...
use std::collections::HashMap; use crate::rand_chacha::rand_core::SeedableRng; use crate::rand_chacha::rand_core::RngCore; use crate::rand_chacha; const CHARS: [char; 13] = [ '\u{2060}', '\u{2061}', '\u{2062}', '\u{2063}', '\u{206A}', '\u{206B}', '\u{206C}', '\u{206D}', '\u{206E}', ...
/* Copyright 2017 <NAME> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * ...
//! The refresh_repo module owns the 'refresh-repo' subcommand and provide methods for //! refreshing and re-signing the metadata files of a given TUF repository. use crate::repo::{ error as repo_error, get_signing_key_source, repo_urls, set_expirations, set_versions, }; use crate::Args; use chrono::{DateTime, Utc...
// Copyright 2021 <NAME> // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those...
use std::collections::HashMap; use anyhow::anyhow; use chrono::{DateTime, Datelike, NaiveDateTime, NaiveTime, Timelike, Utc}; use log::*; use rocket::http::Status; use rocket::serde::json::Json; use rocket::{get, State}; use scylla::{IntoTypedRows, Session}; use uuid::Uuid; use crate::date::Date; use crate::db; use c...
use crate::{ create_camera_entity, open_voxel_database, save_map_to_db, BevyConfig, CameraConfig, CameraPlugin, Config, CursorPositionPlugin, EditToolsPlugin, ImmediateModePlugin, VoxelPickingPlugin, }; use feldspar::{ bb::core::prelude::*, bb::storage::prelude::*, prelude::{VoxelEditor, VoxelR...
// Zinc, the bare metal stack for rust. // Copyright 2014 <NAME> <<EMAIL>> // // 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 // // Unles...
use tui::layout::{Constraint, Direction, Layout, Rect}; use super::prelude::*; use crate::session::EncodedRequest; use crate::ui::commands; use crate::ui::sub_views::{DetailsPane, FilterPane, TableView}; pub struct MainView { details_view: DetailsPane, requests_state: TableView<EncodedRequest>, filter_pa...
// // Copyright (C) 2019 Kubos Corporation // // 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 agree...
use crate::adjacency::add_hydrogen; use crate::structure::AtomicStructure; use itertools::Itertools; use pyo3::prelude::*; use std::convert::TryInto; use vasp_poscar::Poscar; mod generation; #[pyclass(module = "agnr_ml")] #[derive(Default, Debug, Clone, PartialOrd, PartialEq, Eq, Ord, Hash)] pub struct AGNR { spe...
// 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, Error}, fidl::endpoints::RequestStream, fidl_fuchsia_bluetooth_host::{HostControlHandle, HostMarker, HostRequest, Ho...
use crate::colors::*; use crate::constants::{ BAR_WIDTH, INVENTORY_WIDTH, MAP_HEIGHT, MAP_WIDTH, PANEL_HEIGHT, PANEL_Y, SCREEN_WIDTH, SCREEN_HEIGHT, MSG_HEIGHT, MSG_WIDTH, MSG_X, PLAYER, }; use crate::{ state::GameState, element::Element, }; use tcod::colors::{sel...
use super::{runge_kutta4, Domain, Observation, Reward}; use crate::{ consts::{G, PI_OVER_2}, spaces::{discrete::Ordinal, real::Interval, ProductSpace}, }; use std::f64::consts::PI; // Link masses: const M1: f64 = 1.0; const M2: f64 = 1.0; // Link lengths: const L1: f64 = 1.0; #[allow(dead_code)] const L2: f64...
pub mod test { /// Triple Read Slow for PBIST and STC ROM pub const TRIPLEREADSLOW: u32 = 0x0000_0001; /// Triple Read Flast for PBIST and STC ROM pub const TRIPLEREADFAST: u32 = 0x0000_0002; /// March13 N Algo for 2 Port mem pub const MARCH13N_DP: u32 = 0x0000_0004; /// March13 N Algo for 1 Port mem pub const MARCH13N...
#![no_std] #[macro_use] extern crate nb; extern crate nrf51_hal; extern crate nrf51; extern crate embedded_hal; extern crate cortex_m; extern crate cortex_m_rt; extern crate cortex_m_semihosting; extern crate cortex_m_rtfm as rtfm; extern crate fpa; extern crate byteorder; extern crate panic_halt; pub mod ble; #[mac...
mod ines_header; mod mapper_000; mod mapper_001; mod mapper_002; mod mapper_003; mod mapper_004; mod mapper_007; mod mapper_066; use alloc::boxed::Box; use alloc::vec; use alloc::vec::Vec; use core::convert::TryFrom as _; use self::ines_header::{Flags6, INesHeader}; use self::mapper_000::Mapper000; use self::mapper_0...
/* Day 13: Shuttle Search Each bus has an ID number that also indicates how often the bus leaves for the airport. Bus schedules are based on the number of minutes since some fixed reference point. At time 0, every bus simultaneously departed the same location. Part 1 The first line of the puzzle input is ...
// This file contains code from external sources. // Attributions: https://github.com/wasmerio/wasmer/blob/master/ATTRIBUTIONS.md //! Memory management for tables. //! //! `Table` is to WebAssembly tables what `LinearMemory` is to WebAssembly linear memories. use crate::trap::{Trap, TrapCode}; use crate::vmcontext::{...
// "ami" crate - Licensed under the MIT LICENSE // * Copyright (c) 2017 <NAME> // * Copyright (c) 2017-2018 <NAME> <<EMAIL>> use std::fmt; use std::ops; /// 3-dimensional vector #[derive(Clone, Copy, PartialEq)] pub struct Vec3 { /// X coordinate pub x: f32, /// Y coordinate pub y: f32, /// Z coordinate pub...
use std::error::Error; use std::io::{Error as IoError, ErrorKind, Read}; use std::os::unix::fs::FileExt; use std::path::PathBuf; use std::process::exit; use ctrlc; use structopt::StructOpt; use sys_mount; use rcore_fs::dev::std_impl::StdTimeProvider; use rcore_fs::vfs::FileSystem; use rcore_fs_cli::fuse::VfsFuse; use...
extern crate clap; use std::env; use std::process::Command; use std::time::Duration; use std::thread; use std::fs; use std::path::Path; use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; use clap::{Arg, App}; pub struct TTYRecorder { pub shell: String, pub window_id: String, pub delay_scre...
// Copyright 2022 <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 i...
// Copyright 2019 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 std::fmt; use std::io; use std::path::PathBuf; use getopts::Options; type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>; #[deriv...
use core::fmt::Debug; #[cfg(feature = "chrono")] use chrono; #[cfg(feature = "chrono")] use chrono::{Datelike, Local, TimeZone, Timelike}; /// A DOS compatible date. /// /// Used by `DirEntry` time-related methods. #[derive(Copy, Clone, Eq, PartialEq, Debug)] pub struct Date { /// Full year - [1980, 2107] pub...
use std::collections::HashMap; use std::convert::TryInto; use crate::kv::{KeyValue, RouteCollection}; use crate::KvsError; /// Front-end Key/Value store for [KeyValue](struct.KeyValue.html) pairs that can be encoded/decoded as /// BGP Update announcements /// /// As contained [KeyValue](struct.KeyValue.html)s are add...
mod identifier; mod metadata; #[cfg(test)] mod testutil; use self::metadata::{Metadata, Source}; use std::borrow::Cow; use std::str::FromStr; pub use self::identifier::identify; /// A Feature is an identifying object found on a given item that can be used /// for comparison and clustering. #[derive(Debug)] pub str...
use rangoon::*; struct Snake { time: i32, gfx: Graphics, direction: Direction, width: i32, height: i32, world: World, head: Entity, made_move: bool, } enum Direction { Left, Right, Up, Down, } // ECS components struct SnakeHead(i32); struct SnakeBody(i32); struct Food;...
//! Helper functions for deriving `EthCall` use ethers_contract_abigen::{ethers_contract_crate, ethers_core_crate}; use proc_macro2::{Span, TokenStream}; use quote::quote; use syn::{parse::Error, spanned::Spanned as _, AttrStyle, DeriveInput, Lit, Meta, NestedMeta}; use ethers_core::abi::{param_type::Reader, AbiParse...
use std::{error, fmt}; use super::{ alternate_bases, chromosome, filters, genotypes, ids, info, position, quality_score, reference_bases, Field, Filters, Genotypes, Info, QualityScore, Record, FIELD_DELIMITER, MISSING_FIELD, }; use crate::Header; /// An error returned when a raw VCF record fails to parse....
use std::ffi::{OsStr, OsString}; use std::fmt::Display; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; use std::time::{SystemTime, UNIX_EPOCH}; use std::{env, fs}; /// A helper macro to `unwrap` a result except also print out details like: /// /// * The file/line of the panic /// * The expression ...
use std::collections::{HashMap}; #[derive(Clone, Hash, Copy, Eq, Ord, PartialOrd, PartialEq, Debug)] pub struct Job { pub id: JobID, pub num_people: u32, pub period: u32, } impl Job { pub fn new(id: JobID, num_people: u32, period: u32) -> Job { Job { id, num_people, ...
use crate::pathfind::node_map::{deserialize_nodemap, NodeMap}; use crate::{ Lane, LaneID, LaneType, Map, Path, PathConstraints, PathRequest, PathStep, Turn, TurnID, }; use fast_paths::{FastGraph, InputGraph, PathCalculator}; use geom::Distance; use serde_derive::{Deserialize, Serialize}; use std::cell::RefCell; use...
use anyhow::{Context, Result}; use std::collections::BTreeSet; use std::env; use std::fs; use std::io::prelude::*; use std::io::BufReader; use std::path::Path; mod phoneme; use phoneme::{Phoneme, Word}; fn make_dict<P: AsRef<Path>>(path: P) -> Result<BTreeSet<Word>> { let mut dict = BTreeSet::new(); let file...
// 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. //! This module contains methods for creating OpenID requests and interpreting //! responses. use crate::constants::USER_INFO_URI; use crate::error::{Auth...
// Text Widget // Pushrod // // 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,...
//! Saga actions, core implementations, and related facilities //! //! This file contains a generic [`Action`] trait that is not intended to be //! used by Steno consumers, though it is exposed. Users are expected to //! use [`crate::ActionFunc`] in saga_action_func.rs. use crate::saga_action_error::ActionError; use ...
use std::f64::consts::PI; use std::time::Instant; use rand::{Rng, thread_rng}; use rayon::iter::{IndexedParallelIterator, IntoParallelIterator}; use rayon::iter::ParallelIterator; use crate::geometry::{NormalizedVec3, Vec3}; use crate::ray_tracing::scene::camera::Camera; use crate::ray_tracing::scene::Collision; use ...
//! Working with recorded timesheets (lists of events). use std::{ fs::File, io::{Read, Write}, path::{Path, PathBuf}, }; use chrono::{DateTime, Duration, Utc}; use directories::ProjectDirs; use serde::{Deserialize, Serialize}; use thiserror::Error; use crate::Event; /// List of events, together compris...
// Copyright 2020 Parity Technologies (UK) Ltd. // This file is part of Polkadot. // Polkadot 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 late...
use crate::interpreter::environment::EnvironmentId; use crate::interpreter::error::Error; use crate::interpreter::interpreter::Interpreter; use crate::interpreter::value::Value; use crate::interpreter::library; use crate::interpreter::value::Function; pub fn apply( interpreter: &mut Interpreter, environment_i...
use serde::{Deserialize, Serialize}; use tracing::warn; use crate::{ collections::{FillVecMap, P2ps, VecMap}, crypto_tools::{hash, paillier, vss}, gg20::keygen::{r3, SecretKeyShare}, sdk::{ api::{Fault::ProtocolFault, TofnResult}, implementer_api::{serialize, Executer, ProtocolBuilder, ...
use anyhow::{anyhow, bail, Result}; use std::{ borrow::Cow, collections::{hash_map::Entry, HashMap, HashSet}, }; use wasmparser::{ types::Types, Encoding, ExternalKind, FuncType, Parser, Payload, Type, TypeRef, ValidPayload, Validator, }; use wit_parser::{ abi::{AbiVariant, WasmSignature, WasmType},...
extern crate chan; extern crate clap; #[macro_use] extern crate error_chain; extern crate rand; use std::io::{self, Write}; use std::u8; use clap::{App, Arg}; use rand::{Rng, XorShiftRng}; use errors::*; #[allow(unused_doc_comment)] mod errors { error_chain! { foreign_links { Io(::std::io::E...
use std::{error::Error, io::Stdout, fmt}; use tui::{ backend::CrosstermBackend, layout::{Alignment, Constraint, Direction, Layout, Rect}, widgets::{Block, Borders, Paragraph, Wrap}, text::{Spans, Text}, Terminal, }; use crate::{ nominatim, interface, operations, viewer::details::geo_tile_text_l...
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ //! Rust `tracing` and Python `logging` setup and utilities. use pyo3::prelude::*; use tracing::Level; use tracing_subscriber::filter::LevelFilter; use tracing_subscriber::{prelude::*, EnvFilter}; /// ...
// Copyright 2020 The Grin Developers // // 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 agree...
use std::cell::{Cell, RefCell}; use std::rc::Rc; pub use cursive; use cursive::{ Cursive, Printer, direction::Orientation, event::{Event, EventResult, Key}, theme::{BaseColor, Color, ColorStyle}, vec::Vec2, view::View, views::{BoxView, LinearLayout}, }; mod game; use game::{ Actio...
use std::panic::AssertUnwindSafe; use async_std::future::timeout; use chrono::{DateTime, Utc}; use futures::FutureExt; use handlebars::TemplateRenderError; use log::{debug, error, info, trace, warn}; use chord_core::action::{Action, Scope}; use chord_core::step::StepState; use chord_core::value::json; use chord_core:...
// Copyright (C) 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 to i...
//! Parse PO files. extern crate linereader; use super::escape::unescape; use crate::catalog::{Catalog, InvalidCatalogError}; use crate::message::*; use crate::metadata::CatalogMetadata; use linereader::LineReader; use std::error::Error; use std::path::Path; fn append_str(buf: &mut String, content: &str) { buf.pu...
//! Implementation of the [DBSCAN](https://en.wikipedia.org/wiki/DBSCAN) //! clustering algorithm. use matrix::SymmetricMatrix; use std::collections::VecDeque; /// Implementation of the [DBSCAN](https://en.wikipedia.org/wiki/DBSCAN) /// clustering algorithm. #[derive(Debug)] pub struct DBSCAN<T> { eps: T, min...
use std::collections::VecDeque; use super::astr; use super::data; use super::conz; use super::astr::*; use super::astr::{AStr}; //use std::time::{SystemTime, UNIX_EPOCH}; pub enum InputType{ Text, DateTime, U16, Bool, } pub enum PromptType{ Reprompt, //ask until good or user cancels -> push go...
//! //! This is a Rust implementation of the [bip39][bip39-standard] standard for Bitcoin HD wallet //! mnemonic phrases. //! //! //! [bip39-standard]: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki //! //! ## Quickstart //! //! ```rust //! use bip39::{Mnemonic, MnemonicType, Language, Seed}; //! //! //...
use grid::IsEmpty; use mino_core::common::{Cell, FallingPiece, GameData, TSpin}; use mino_core::tetro::Piece; use std::io; use std::io::Read; use termion::raw::{IntoRawMode, RawTerminal}; use tui::backend::TermionBackend; use tui::layout::Rect; use tui::style::{Color, Style}; use tui::widgets::{Paragraph, Text, Widget}...
use std::{fs::File, path::Path}; use anyhow::*; use log::trace; use nalgebra::Rotation; use serde::{Deserialize, Deserializer}; use opencv::{calib3d::{RANSAC, find_essential_mat_matrix, fisheye_undistort_points, recover_pose_camera}, core::{CV_32F, no_array}, prelude::{Mat, MatExprTrait, MatTrait, MatTraitManual}}; us...
#[macro_use] extern crate rustful; use std::sync::RwLock; use std::error::Error; #[macro_use] extern crate log; extern crate env_logger; use rustful::{Server, DefaultRouter, Context, Response}; use rustful::filter::{FilterContext, ResponseFilter, ResponseAction, ContextFilter, ContextAction}; use rustful::response::...
// Copyright 2020 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT mod mock; pub use self::mock::*; use crate::{PoStProof, Randomness, RegisteredPoStProof, SealVerifyInfo, SectorInfo}; use address::Address; use commcid::{cid_to_data_commitment_v1, cid_to_replica_commitment_v1}; use filecoin_proofs_api::...
extern crate ansi_term; extern crate hyper; extern crate hyper_native_tls; extern crate regex; #[macro_use(chan_select)] extern crate chan; extern crate iron; extern crate router; extern crate rustc_serialize; extern crate catcache; use rustc_serialize::json; use ansi_term::Colour::*; use std::io::{stdout, Read, Write...
// Copyright (c) 2017 tyr 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. All files in the project carrying such notice may not be copied, // mo...
use parity_scale_codec::{Compact, Encode}; use serde::Serialize; use std::env; use std::fmt::{Debug, Display}; fn main() { match parse_args().unwrap() { RunCommand::Compact => compacts(), RunCommand::Int => ints(), } } enum RunCommand { Int, Compact, } fn parse_args() -> Result<RunCom...