text
stringlengths
3.09k
13.9k
//! Update the settings for a channel’s stream schedule. This can be used for setting vacation details. //! //! [`update-channel-stream-schedule`](https://dev.twitch.tv/docs/api/reference/#update-channel-stream-schedule) //! //! # Accessing the endpoint //! //! ## Request: [UpdateChannelStreamScheduleRequest] //! //! T...
use crate::unix::{aligned_buffer::U32AlignedBuffer, Fd}; use crate::IfEvent; use async_io::Async; use ipnet::{IpNet, Ipv4Net, Ipv6Net}; use netlink::NetlinkIterator; use std::{ collections::VecDeque, io::{Error, Result}, mem::MaybeUninit, net::IpAddr, os::unix::prelude::*, }; mod netlink; mod rtnet...
/* Copyright 2019 ETCDEV GmbH 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 dis...
// Copyright 2021 <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 writ...
//! # Playfair Cipher //! //! Implements the functionality for the Playfair cipher. //! //! The following excerpt is from [Wikipedia](https://en.wikipedia.org/wiki/Playfair_cipher). //! > The Playfair cipher or Playfair square or Wheatstone-Playfair cipher is a manual symmetric //! encryption technique and was the firs...
use log::info; use serde_json::Value; use sp_core::H256 as Hash; use std::{ sync::{mpsc::channel, Arc, Mutex}, thread, thread::JoinHandle, }; use substrate_api_client::{ rpc::{ json_req, ws_client::{ on_extrinsic_msg_submit_only, on_extrinsic_msg_until_broadcast, ...
use std::io::prelude::*; use std::io::{Error, ErrorKind, Result, SeekFrom}; pub trait SeekExt: Seek { fn pos(&mut self) -> Result<u64>; } impl<S: Seek> SeekExt for S { fn pos(&mut self) -> Result<u64> { self.seek(SeekFrom::Current(0)) } } pub trait ReadExt: Read { fn read_u8(&mut self) -> Res...
use xsd_codegen::XMLElement; use xsd_types::{to_field_name, XsdIoError, XsdName, XsdParseError, XsdType}; use super::{ annotation::Annotation, choice::Choice, general_xsdgen, max_occurences::MaxOccurences, sequence::Sequence, xsd_context::{XsdContext, XsdImpl, XsdImplType}, XsdError, }; #[d...
// Copyright 2020-2021 the Deno authors. All rights reserved. MIT license. use deno_ast::swc::common::comments::Comment; use deno_ast::swc::common::comments::CommentKind; use deno_ast::swc::common::Span; use deno_ast::swc::common::Spanned; use deno_ast::view as ast_view; use deno_ast::view::RootNode; use once_cell::syn...
use syn::Fields; use crate::{config::*, ext::GenericsExt}; pub fn derive_struct_impl( name: syn::Ident, mut generics: syn::Generics, container: syn::DataStruct, config: &Config, ) -> proc_macro2::TokenStream { let mut list = vec![]; let crate_root = &config.crate_root; generics.add_trait_b...
// Copyright 2020 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { anyhow::Error, fidl::endpoints::{create_proxy, ProtocolMarker}, fidl_fuchsia_device_manager as fdevicemanager, fidl_fuchsia_hardware_...
use anyhow::{bail, ensure, Context, Result}; use probe_rs::{ config::{get_target_by_name, search_chips}, DebugProbeSelector, Probe, Target, }; use serde::Deserialize; use std::{ convert::TryInto, ffi::OsStr, path::{Path, PathBuf}, }; ///! # DUT Defintions ///! ///! This module handles the definition...
// Copyright © 2016-2017 VMware, Inc. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 use std::convert::{From, Into}; use rabble::{self, Pid, CorrelationId, Envelope}; use time::SteadyTime; use msg::Msg; use vr::vr_fsm::{Transition, VrState, State}; use vr::vr_msg::{self, VrMsg}; use vr::vr_ctx::VrCtx; use...
// Copyright 2018 The Druid 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...
//! Prover process: generate proofs in the tree. //! //! Struct responsible for syncing Prover use ethers::core::types::H256; use rocksdb::DB; use optics_base::db::UsingPersistence; use optics_core::accumulator::{ merkle::{merkle_root_from_branch, MerkleTree, MerkleTreeError, Proof}, TREE_DEPTH, }; /// A dep...
use crate::net_time_checker::{NetTimeChecker, NetTimeProtocol, TOLERANT_OFFSET}; use ckb_app_config::NetworkConfig; use ckb_network::{ multiaddr::{Multiaddr, Protocol}, CKBProtocol, DefaultExitHandler, EventHandler, NetworkState, ServiceBuilder, ServiceControl, SessionId, SupportProtocols, TargetProtocol, }...
// // Copyright 2021 The Project Oak 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 o...
#![no_main] #![no_std] use bbqueue::{consts::*, framed::FrameGrantW, BBBuffer, ConstBBBuffer}; use embedded_hal::blocking::delay::{DelayMs, DelayUs}; use embedded_hal::digital::v2::OutputPin; use key_003 as _; // global logger + panicking-behavior + memory layout use nrf52840_hal::{ self as hal, gpio::{p0::Par...
//! Safe wrapper for [*3Delight*](https://www.3delight.com/)’s //! [*OpenVDB*](https://www.openvdb.org/) metadata query API. //! //! This is a simple API to query: //! //! * The bounding box. //! * The names of the grids. //! * A simplified representation of a density grid as points. //! //! ``` //! let sphere_vdb = //...
use std::convert::TryFrom; use color_eyre::Result; use ethers::types::transaction::eip2718::TypedTransaction; use ethers::{ prelude::{Address, TransactionRequest, U256}, providers::{Http, Middleware, Provider}, signers::{AwsSigner, Signer}, }; use once_cell::sync::OnceCell; use rusoto_core::{credential::En...
use graphql_parser::query; use graphql_parser::query::refs::SelectionSetRef; use graphql_parser::schema::*; use graphql_parser::{parse_query, Pos}; use std::collections::HashMap; use crate::helpers::directive_args_as_map; #[derive(Debug, PartialEq)] struct FederationTypeMetadata<'q> { is_value_type: HashMap<Pos, ...
//! Startup configuration. extern crate toml; use std::env; use std::fs::File; use std::io::prelude::*; use std::net::{SocketAddr, ToSocketAddrs}; use std::path::Path; /// Representation of configuration file contents. #[derive(Deserialize, Clone)] #[warn(unused_must_use)] pub struct Config { api: Api, db: D...
use crate::overlay; use crate::widget::tree::{self, Tree}; use crate::{Element, Widget}; use iced_native::event::{self, Event}; use iced_native::layout::{self, Layout}; use iced_native::mouse; use iced_native::renderer; use iced_native::widget::scrollable; use iced_native::{Clipboard, Length, Point, Rectangle, Shell, ...
extern crate cc; extern crate fs_extra; extern crate metadeps; use std::env; #[cfg(not(feature = "build-cmake"))] use std::ffi::OsString; use std::fs; use std::path::PathBuf; #[cfg(not(feature = "build-cmake"))] use std::process::Command; fn main() { // Rerun if the c-ares source code has changed. println!("c...
//! The `algorithm` module defines traits and structs for implementing //! concrete algorithms such as the `ga::GeneticAlgorithm` and various //! operators as defined in the `operator` module. use crate::{ genetic::{Fitness, Genotype}, random::Prng, }; use chrono::{DateTime, Local}; use std::{error::Error, fmt...
use clap::{App, Arg, ArgGroup, ArgMatches}; use cluster_test::{ aws::Aws, cluster::Cluster, experiments::{Experiment, RebootRandomValidator}, health::{AwsLogTail, HealthCheckRunner}, }; use std::{ collections::HashSet, env, sync::mpsc::{self, TryRecvError}, thread, time::{Duration, I...
//! Rust Subroutines for SPAIK LISP use crate::r8vm::{ArgSpec, R8VM}; use crate::nkgc::{PV, SPV, VLambda, Traceable, Arena}; use crate::error::{Error, ErrorKind}; use crate::nk::*; use crate::fmt::{LispFmt, VisitSet}; use crate::sym_db::SymDB; use std::convert::{TryInto, TryFrom}; use std::fmt; use std::ptr; /// The ...
use core::num; use std::collections::HashSet; struct Solution{ } impl Solution { // pub fn find_repeate_number(nums: Vec<i32>) -> i32 { /* 由于对语法的不熟悉,用for很不友好 */ let mut n =0; while n<nums.len() { let mut j = n + 1 ; while j < nums.len() { ...
use super::*; use getset::{CopyGetters, Getters, MutGetters}; use serde::Serialize; use std::cell::RefCell; use std::fmt::{self, Display}; /// # A structure to hold the root document as well as its state. #[derive(Debug, Getters, MutGetters, CopyGetters)] pub struct SparseRoot<S: DeserializeOwned + Serialize + Sparsab...
// Copyright (c) 2020 , Texas Instruments. // Licensed under the BSD-3-Clause license // (see LICENSE or <https://opensource.org/licenses/BSD-3-Clause>) All files in the project // notice may not be copied, modified, or distributed except according to those terms. use std::convert::TryFrom; use std::ops; use std::str;...
use crate::error::{Error, Result}; use crate::mapper::{Kind, Mapper}; use crate::sstable::{Key, Merged, SSTable}; use std::collections::BTreeMap; use std::path::PathBuf; use std::sync::mpsc::{channel, Receiver, Sender}; use std::sync::Arc; use std::thread::{self, JoinHandle}; type TableVec = Vec<BTreeMap<Key, SSTable...
use std::collections::HashMap; use std::ffi::OsString; use std::env; use crate::stacked_borrows::Tag; use crate::*; use rustc::ty::layout::Size; use rustc_mir::interpret::{Memory, Pointer}; #[derive(Default)] pub struct EnvVars { /// Stores pointers to the environment variables. These variables must be stored as...
use super::lexer::*; use super::Ltl; use std::fmt; use std::iter::Peekable; /// Parse the given input string to an LTL formula. pub fn parse(input: &str) -> ParserResult { Parser::new(Lexer::new(input.chars())).parse() } impl Operator { fn precedence(&self) -> usize { match self { Operator...
use crate::fst_traits::{ExpandedFst, Fst}; use crate::semirings::Semiring; use crate::tr::Tr; use crate::{StateId, Trs}; use crate::algorithms::tr_filters::TrFilter; use std::marker::PhantomData; use unsafe_unwrap::UnsafeUnwrap; #[derive(PartialOrd, PartialEq, Copy, Clone)] enum DfsStateColor { /// Undiscovered. ...
use futures::stream::StreamExt; use rayon::prelude::*; use reqwest::header; use reqwest::Client; use std::collections::HashMap; use crate::config::{Config, SearchEngine}; use crate::error::{Error, Result}; use crate::tui::markdown; use crate::tui::markdown::Markdown; use super::api::{Answer, Api, Question}; use super...
/// Register remote services: /// - list services. /// - assign them a stable ID /// - change ownership of their directory so they can read/write in it. use log::error; use std::collections::HashMap; use std::fs::{read_dir, File}; use std::io::{self, Read, Write}; use std::path::Path; use thiserror::Error as ThisError;...
use std::cell::RefCell; use std::iter; use std::rc::Rc; use std::sync::mpsc::channel; use anyhow::{Context, Result}; use bdf::Font; use chrono::{Local, Timelike}; use flipdot::{Address, Page, PageId, SerialSignBus, Sign, SignBus, SignType}; use flipdot_testing::{VirtualSign, VirtualSignBus}; use structopt::StructOpt; ...
//! # Definition of Hubbub messages use std::str::from_utf8; use bytes::Bytes; use chrono::{DateTime, Utc}; use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; use serde_reflection::{ContainerFormat, Samples, Tracer, TracerConfig}; /// A message used to exhange Rust data structures between Hubbub no...
// // Copyright 2020 bplist Developers // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://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 ...
use colored::Color; use serde::Deserialize; use std::collections::HashMap; /// Configuration struct for the program #[derive(Debug, Deserialize)] pub struct SysStatusConfig { /// Configuration for the general section. pub general_info: Option<GeneralInfoConfig>, /// Configuration for the storage section. ...
use crate::xsd::{ annotation::Annotation, complex_type::ComplexType, max_occurences::MaxOccurences, rust_types_mapping::RustTypesMapping, simple_type::SimpleType, Implementation, XsdContext, }; use heck::{CamelCase, SnakeCase}; use log::{debug, info}; use proc_macro2::{Span, TokenStream}; use std::io::prelude::*; u...
use crate::elf::{ ElfFileHeader, ElfProgramHeader, EI_CLASS, EI_DATA, ET_DYN, ELFMAG, SELFMAG, ELFCLASS64, ELFDATA2LSB, ELFDATA2MSB, EM_AARCH64, EM_RISCV, EM_X86_64, PF_X, PT_LOAD, }; use crate::{ ParseElfError, Elf, ProgramHeaders }; use core::slice::{ self, Iter }; use core::mem; pub fn try_pa...
use std::sync::Arc; use anyhow::*; use vulkano::{ command_buffer::{ AutoCommandBufferBuilder, CommandBufferUsage, PrimaryAutoCommandBuffer, SecondaryCommandBuffer, SubpassContents, }, device::{Device, Queue}, format::Format, image::ImageViewAbstract, render_pass::{Framebuffer, F...
#![allow(clippy::many_single_char_names,clippy::explicit_counter_loop, clippy::redundant_closure)] use super::{byte_chunks_64, Tabulation}; use chapter01::interface::USet; use lazy_static::lazy_static; use rand::{thread_rng, Rng}; use std::hash::Hash; lazy_static! { pub static ref TAB: [[u64; 256]; 8] = { ...
use std::marker::PhantomData; use cosmwasm_std::{Addr, ContractInfo, Timestamp, Empty, OwnedDeps, Querier, Api, StdResult, StdError, CanonicalAddr, VerificationError, RecoverPubkeyError}; use cosmwasm_std::{BlockInfo, Env}; use crate::store::IdbStorage; pub fn set_panic_hook() { // When the `console_error_pan...
// Copyright (c) 2018 <NAME> #![allow(unused_variables)] #![allow(dead_code)] extern crate perplex_runtime; use std::iter::Peekable; #[derive(Debug, Copy, Clone)] enum Token { A, B, C, D, E, Eof, } #[derive(Debug)] enum NodeS { NodeS0(Token, NodeA, Token), NodeS1(Token, NodeB, Token)...
use std::collections::{HashMap, VecDeque}; use std::sync::Arc; use std::time::{Duration, SystemTime}; use futures::task::{Context, Poll}; use ip_network::IpNetwork; use libp2p::core::connection::ConnectionId; use libp2p::core::multiaddr::Protocol; use libp2p::core::ConnectedPoint; use libp2p::core::Multiaddr; use libp...
/* * Copyright 2018-2021 TON DEV SOLUTIONS LTD. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS I...
//! This module contains a virtual filesystem backed by a SLF file. #![allow(dead_code)] use std::collections::HashMap; use std::collections::HashSet; use std::convert::TryFrom; use std::fmt; use std::io; use std::io::{Seek, SeekFrom}; use std::rc::Rc; use std::sync::{Arc, Mutex}; use crate::file_formats::slf::{SlfEn...
use std::io::{Cursor, Seek, SeekFrom}; use byteorder::{ReadBytesExt, LittleEndian}; use ndarray::prelude::*; use std::fmt::{Debug, Formatter}; use crate::errors::*; /// Defines the header of a Dc6 image #[derive(Clone)] pub struct Dc6Header { /// Version of the file format (always 6) pub version: u32...
#[macro_use] extern crate serde_derive; extern crate serde_json; pub mod cmd; pub mod ui; pub mod hooks; use std::collections::HashMap; use std::str::FromStr; use std::io::{ Read, Write, BufReader, BufWriter, }; use std::path::Path; use std::fs::{ File, OpenOptions, }; use std::fmt::{ Display, For...
use crossbeam::channel::*; use thiserror::Error; use super::{super::base::*, ParsedUserLevelConfig, WorkshopConfig}; use crate::{drawables::black, prelude::*}; #[derive(Debug)] enum State { Starting, CreatingItem, Uploading, Finished(u64), Error(UploadError), } impl State { fn is_final(&self)...
//! A module for elements that can be embedded into vector spaces. use ordered_float::NotNan; use super::{angular, Dist, ElementContainer, ExtendableElementContainer}; use crate::io; use crate::slice_vector::{FixedWidthSliceVector, VariableWidthSliceVector}; use crate::{math, FiveByteInt, ThreeByteInt}; use std::io::...
//! Node Manager (Node Man, the superhero that we deserve) use crate::{ nodes::types::{NodeStatus, TransportList, TransportMode, TransportStatus, TransportType}, Method, Request, Response, ResponseBuilder, }; use minicbor::{encode::Write, Decoder}; use ockam::{Address, Context, Result, Routed, TcpTransport, Wo...
use rand::rngs::SmallRng; use rand::{Rng, SeedableRng}; use crate::{MpcContext, MpcDealer, MpcField}; use super::{SpdzDealer, SpdzShare}; /// Insecure dealer for SPDZ protocol that can be used for tests. pub struct FakeSpdzDealer<T> { auth_key: FakeAuthKey<T>, beaver_triple_gen: FakeShareGenerator<T>, bi...
use crate::module::ModuleLoader; use dice_core::{ error::Error, protocol::class::NEW, runtime::Runtime, value::{NativeFn, Value, ValueKind}, }; impl<L> crate::Runtime<L> where L: ModuleLoader, { pub fn register_float(&mut self) { let class = self.any_class.derive("Float"); // N...
// P_2_2_3_01 // // Generative Gestaltung – Creative Coding im Web // ISBN: 978-3-87439-902-9, First Edition, Hermann Schmidt, Mainz, 2018 // <NAME>, <NAME>, <NAME>, <NAME> // with contributions by <NAME> and <NAME> // Copyright 2018 // // http://www.generative-gestaltung.de // // Licensed under the Apache License, Ver...
// TODOS: // * create a command to request the PeerState of a particular peer // * for some events use a oneshot channel to return success/failure // of the request // * allow to configure 'autoconnect' for 'AddPeer' command // * allow to disconnect from a peer, but keep it in the peer list // * add 'ConnectPeer' com...
use std::collections::BTreeMap; use std::convert::TryFrom; use std::ops::Sub; use super::chunk::Chunk; use super::compiler::InterpretResult; use super::opcode::OpCode; use super::value::Value; struct Vm<'a> { chunk: Option<&'a Chunk>, ip: Option<std::iter::Peekable<std::iter::Enumerate<std::slice::Iter<'a, u8...
use manarimo_lib::geometry::{dislike, Edge, Point}; use manarimo_lib::types::{Pose, Problem}; use std::cmp::Reverse; pub struct Xorshift(u64); impl Xorshift { pub fn get(&mut self) -> u64 { let mut x = self.0; x ^= x << 13; x ^= x >> 7; x ^= x << 17; self.0 = x; x ...
use std::collections::HashMap; use crate::defines::{FRAME_BUFFER_WIDTH, FRAME_BUFFER_HEIGHT, INVALID_PALETTE}; use crate::game_strings::init_game_strings; use crate::font::FONT; use crate::poly::{Poly, draw_poly_to_buffer}; const NUM_PAGES: usize = 4; pub struct Video { pages: [Vec<u8>; NUM_PAGES], frontbuffer_pa...
use clap::{crate_authors, crate_name, crate_version, App, AppSettings, Arg, SubCommand}; use serde_json::{from_value, to_value, Map, Value}; use std::{ env, fs::{read_to_string, write}, io::{Error, ErrorKind}, path::{Path, PathBuf}, process::exit, }; fn file_path() -> PathBuf { let path = if le...
use crate::{Channel, Consumer, ConsumerOptions, Exchange, FieldTable, Get, Result}; use amq_protocol::protocol::queue::{Declare, Delete}; /// Options passed to the server when declaring a queue. /// /// The [`default`](#impl-Default) implementation sets all boolean fields to false and has an empty /// set of arguments...
use super::set_on_input_handler; use crate::bool_to_option; use crate::text_inputs::validity_state::ValidityStateJS; use crate::text_inputs::{TextFieldType, ValidityState, ValidityTransform}; use gloo::events::EventListener; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use web_sys::Node; pub use web_sys::Val...
// Copyright (C) 2020 <NAME>. Distributed under the zlib license. use rgb::RGB8; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::{ borrow::Cow, convert::{TryFrom, TryInto}, fmt::{self, Display}, str::FromStr, }; use thiserror::Error; #[derive(Clone, Debug, Eq, Hash, PartialEq)]...
//! Amazon MWS Orders API - Version 2013-09-01 //! //! [Documentation](http://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_Overview.html) use chrono::{DateTime, Utc}; use client::{Client, Method}; mod types; pub use self::types::*; use result::MwsResult; static PATH: &'static str = "/Orders/2013-0...
use geom::{Point, Size}; use rand::Rng; use std::mem; type Cell = u64; const BITS: usize = 64; const MSB: Cell = 1 << (BITS - 1); #[derive(Debug, Clone)] pub struct Board { size: Size, hsize: i32, table: Vec<Cell>, ls: Vec<Cell>, rs: Vec<Cell>, buffer: Vec<Cell>, } impl Board { pub fn new...
use nalgebra::*; pub struct Camera { pub view_matrix: Isometry3<f32>, pub proj_matrix: Perspective3<f32>, camera_up: Vector3<f32>, camera_target: Vector3<f32>, current_button_pressed: Option<winit::event::MouseButton>, is_first_mouse_press: bool, last_mouse_pos: Vector2<f32>, trans_sc...
use super::dummy; use super::netcombiner::NetCombiner; use std::convert::TryInto; use std::net::IpAddr; use hex; use rand_chacha::ChaCha8Rng; use rand_core::{RngCore, SeedableRng}; use x25519_dalek::{PublicKey, StaticSecret}; use pnet::packet::ipv4::MutableIpv4Packet; use pnet::packet::ipv6::MutableIpv6Packet; pub ...
/* Copyright 2021 <NAME> (<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, software...
use sidekick::app::App; use sidekick::entities::line::Line; use sidekick::entities::rectangle::Rectangle; use sidekick::input::Key; use sidekick::types::vector2::Vector2; use rand::Rng; const WIDTH: u32 = 800; const HEIGHT: u32 = 600; const PLAYER_SIZE: Vector2 = Vector2 { x: 20., y: 80. }; const PLAYER_INIT_POSITIO...
// Copyright 2020 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { crate::config::{BridgeControlRegister, SecondaryStatusRegister, Type01Config}, crate::device::Device, crate::util::format_bytes, std::...
// <NAME> // https://github.com/oberzs/duku #![cfg(feature = "glsl")] use glsl_dep::CompilationArtifact; use glsl_dep::Compiler; use glsl_dep::ShaderKind; use std::collections::HashMap; use crate::error::Error; use crate::error::Result; #[derive(Debug)] struct Defines { values: HashMap<String, String>, } pub(c...
use core::iter; use std::collections::HashSet; use std::io; use std::io::BufRead; use std::iter::FromIterator; use std::num::ParseIntError; use std::str::FromStr; #[derive(Eq, PartialEq, Hash, Default, Copy, Clone, Debug)] struct Point { x: i32, y: i32, } impl Point { fn distance(self) -> i32 { se...
/* This module generates code to try efficiently convert some arbitrary `T: 'static` into a `Primitive`. It's used by both the `build.rs` script and by the source itself. There are currently two implementations here: - When the compiler version is less than `1.46.0` we check type ids at runtime. This means generating ...
use std::{ cell::UnsafeCell, marker::PhantomData, mem::size_of, ptr::{null_mut, NonNull}, sync::Arc, }; use crate::{ api::{vtable_of, Collectable, Gc, HeapObjectHeader, VTable}, gc_base::{GcBase, TLAB}, mutator::MutatorRef, small_type_id, utils::align_usize, }; /// Simple threa...
use tcod::input::{ Key, Mouse}; use tcod::map::{ Map as FovMap}; use super::data::{ Object, Game, Tcod, PlayerAction, MessageLog }; use super::movement; use super::items; use super::menu; use super::mapping; use crate::{PLAYER, LEVEL_UP_BASE, LEVEL_UP_FACTOR, CHARACTER_SCREEN_WIDTH}; pub fn handle_keys( key: Key,...
use serial_test::serial; use std::env; use std::thread::sleep; use std::time::Duration; use behindthename::{lookup, random, session, types::*}; use Gender::*; use RateLimited::*; #[test] fn test_env_session_key() { let key_string = env::var("BTN_API_KEY").unwrap_or_else(|_| "none".to_string()); let key = key_...
extern crate cannyls; use cannyls::lump::{LumpData, LumpId}; use cannyls::nvm::FileNvm; use cannyls::storage::{JournalSnapshot, Storage, StorageBuilder}; use std::path::Path; use std::str; fn lumpdata_to_string(data: &LumpData) -> String { String::from_utf8(data.as_bytes().to_vec()).expect("should succeed") } pu...
// <NAME> // use std::io::prelude::*; use std::fs::File; use serde_json::{Result, Value}; const _META_MAIN_KEY: &str = "Meta Data"; const _META_RFSH_KEY: &str = "3. Last Refreshed"; const DATA_TIME_KEY: &str = "Time Series (5min)"; const DATA_OPEN_KEY: &str = "1. open"; const DATA_CLOSE_KEY: &str = "4. close"; c...
extern crate cfg_if; extern crate js_sys; extern crate wasm_bindgen; use cfg_if::cfg_if; mod utils; use std::fmt; use wasm_bindgen::prelude::*; #[wasm_bindgen] extern "C" { #[wasm_bindgen(js_namespace = console)] fn log(msg: &str); } // A macro to provide `println!(..)`-style syntax for `console.log` logging. ...
use libc::{c_char, c_void}; use std::ffi::CStr; use std::mem; use std::ptr; mod bt { use libc::{c_char, c_int, c_void}; extern { pub fn backtrace(buffer: *mut *mut c_void, size: c_int) -> c_int; pub fn backtrace_symbols(buffer: *mut *const c_void, ...
/** * [12] Integer to Roman * * Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. * * Symbol Value * I 1 * V 5 * X 10 * L 50 * C 100 * D 500 * M 1000 * For example, 2 is written as II ...
//! Raspberry Pi library for the SG90 servo //! //! The SG90 is a lightweight and cheap servo motor that can rotate aproxiamately //! 180 degrees. //! //! Like many servo motors the rotation is controlled by a PWM signal, which //! in this case will be generated by the PWM pins on the RPi (check the rppal crate for //!...
use crate::metadata::Metadata; use crate::package::Artifact; use crate::pom::Pom; use anyhow::Result; use pubgrub::error::PubGrubError; use pubgrub::range::Range; use pubgrub::report::{DefaultStringReporter, Reporter}; use pubgrub::solver::{Dependencies, DependencyProvider}; use std::borrow::Borrow; use std::error::Err...
#![feature(const_fn)] #![feature(never_type)] #![feature(non_exhaustive)] #![feature(unsize)] #![no_main] #![no_std] #[cfg(not(feature = "use_semihosting"))] extern crate panic_abort; #[cfg(feature = "use_semihosting")] extern crate panic_semihosting; #[cfg(feature = "use_semihosting")] use cortex_m_semihosting::hepri...
use zksync_crypto::{ circuit::{ account::{Balance, CircuitAccount, CircuitBalanceTree}, utils::eth_address_to_fr, }, franklin_crypto::bellman::pairing::ff::Field, pairing::ff::PrimeField, params::{MIN_NFT_TOKEN_ID, NFT_STORAGE_ACCOUNT_ADDRESS, NFT_TOKEN_ID}, primitives::GetBits, ...
use crate::capabilities::server_capabilities; use crate::handlers; use crate::handlers::formatting::{ to_format_options, FormatOnTypeParams, FormatParams, FormatRangeParams, }; use crate::line_index::LineIndex; use crate::requests::syntax_tree::{syntax_tree, SyntaxTreePayload, SYNTAX_TREE_REQUEST}; use crate::sessi...
use std::sync::Arc; use error::check_error; use vulkano::{buffer::BufferAccess, VulkanHandle, VulkanObject}; use crate::{ config::{Config, ConfigGuard}, error, }; use std::pin::Pin; use vk_sys as vk; use std::ptr::addr_of_mut; use derive_more::{Display, Error}; #[derive(Display, Debug, Error)] pub enum BuildE...
use crate::cartridge::Rom; use crate::cpu::Mem; use crate::ppu::NesPPU; use crate::ppu::PPU; use crate::joypad::Joypad; const RAM: u16 = 0x0000; const RAM_MIRRORS_END: u16 = 0x1FFF; const PPU_REGISTERS_MIRRORS_END: u16 = 0x3FFF; pub struct Bus<'call> { cpu_vram: [u8; 2048], prg_rom: Vec<u8>, ppu: NesPPU, ...
use bevy::app::startup_stage; use bevy::prelude::*; use bevy_index::{ComponentIndex, ComponentIndexes}; use rand::distributions::{Bernoulli, Distribution}; const MAP_SIZE: isize = 10; const GAME_INTERVAL: f32 = 0.5; const FRACTION_ALIVE: f64 = 0.2; const GRAPHICS_SCALE: f32 = 10.0; const COL_ALIVE: Color = Color::rg...
// Copyright 2015-2020 Parity Technologies (UK) Ltd. // This file is part of Open Ethereum. // Open Ethereum is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your o...
use futures01::sync::mpsc::Sender; use lazy_static::lazy_static; use std::collections::HashMap; use std::env; use std::str::FromStr; use graph::components::subgraph::{MappingError, SharedProofOfIndexing}; use graph::prelude::*; lazy_static! { static ref MAX_DATA_SOURCES: Option<usize> = env::var("GRAPH_SUBGRAPH_...
use crate::{ app::{ color::ColorTheme, command::{Command, CommandHandler, NO_COMMANDS}, main::TICKS_PER_SECOND, }, clock::{ countdown::Countdown, ticker::{TickHandler, Ticker}, }, game::game_item::{GameItem, GameItemKind}, view::{ coordinates::Coor...
// Copyright 2021 The Propverify authors // // 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 ac...
use std::{convert::TryInto, io, net::Ipv6Addr}; use super::{AtLeastOne, CompactSizeMessage}; /// The maximum length of a Zcash message, in bytes. /// /// This value is used to calculate safe preallocation limits for some types pub const MAX_PROTOCOL_MESSAGE_LEN: usize = 2 * 1024 * 1024; /// Consensus-critical serial...
//! Loading themes from files. //! //! This module consists of two parts: A macro for declaring 'themes' //! (a typed collection of keys and values) and a widget for loading declared //! themes from files on disk. //! //! ## File format //! //! Currently, this module uses a custom text format for themes. This format //...
extern crate chrono; #[macro_use] extern crate lazy_static; #[macro_use] extern crate log; extern crate regex; extern crate rusqlite; #[cfg(feature = "web")] #[macro_use] extern crate serde; #[cfg(feature = "web")] #[macro_use] extern crate serde_json; #[cfg(test)] extern crate tempfile; use rusqlite::Connection; use ...
// Copyright 2022 The Engula 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...
use assert_cmd::assert::Assert; use predicates::Predicate; use std::path::Path; use std::time::Duration; use std::{fs, str}; use tempdir::TempDir; const TIMEOUT: Duration = Duration::from_secs(10); #[test] fn for_samples() -> anyhow::Result<()> { let tempdir = TempDir::new("cargo-atcoder-test-test-for-samples")?;...