text
stringlengths
3.09k
13.9k
//! //! The lexical token keyword lexeme. //! use std::convert::TryFrom; use std::fmt; use std::ops::RangeInclusive; use std::str; #[derive(Debug, Clone, PartialEq)] pub enum Keyword { // declarations Let, Mut, Const, Type, Struct, Enum, Fn, Mod, Use, Impl, // controls...
// Copyright © 2022 // Author: <NAME> <<EMAIL>> // SPDX-License-Identifier: MIT use std::{fs::File, io::BufWriter, path::Path}; use super::*; #[derive(Default)] pub struct Image { pub id: usize, /// Row major, top-left origin pub color_type: ColorType, buffer: Vec<u8>, width: u32, height: u...
use futures::channel::oneshot::Sender; use wasm_bindgen::JsValue; /// This struct represent a font. /// It is useful when using the [Text struct](../text/struct.Text.html). /// /// # Example /// /// ```rust /// use wasm_game_lib::graphics::font::Font; /// use wasm_game_lib::graphics::text::Text; /// /// # async fn ...
// 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 terms. // Tests with simul...
use std::collections::HashMap; use std::hash::Hash; fn input_data() -> Vec<&'static str> { vec![ "Player 1 starting position: 4", "Player 2 starting position: 8", ] } fn parse_input_data(input_data: Vec<&str>) -> (u64, u64) { ( input_data[0].chars().last().unwrap().to_digit(10).unw...
#![feature(plugin)] #![plugin(rocket_codegen)] #[macro_use] extern crate serde_derive; extern crate rocket; extern crate rocket_contrib; extern crate oping; extern crate rusqlite; extern crate time; extern crate serde; extern crate serde_json; use std::thread; use std::time::Duration; use oping::Ping; use rusqlite::...
use super::{ RunningService, Service, ServiceImpl, ServiceName, ServicePool, ServiceState, StoppedService, }; use crate::lua::Sandbox; use crate::source::Source; use crate::task::SandboxPool; use crate::ErrorKind::{self, ServiceNotFound, ServiceStopped}; use crate::{Config, Error, Result}; use mlua::RegistryKey; use ...
use scheme::base::*; use scheme::base::numeric::Operator::*; use scheme::reader::Reader; use scheme::env::Environment; use scheme::value::{Sexp, HostFunction1, HostFunction2}; use scheme::LispResult; use scheme::machine::LispMachine; use scheme::error::LispError; use std::fs::File; use std::process::exit; use std::io:...
use clap::Parser; use needletail::bitkmer::BitNuclKmer; use needletail::parse_fastx_file; use serde::Deserialize; use std::collections::HashMap; use std::io::Write; use std::str; mod utils; use crate::utils::get_all_snps; // first, reproduce the appproach from // https://github.com/jeremymsimon/SPLITseq/blob/main/Prep...
// Copyright 2022. The Tari Project // // 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 // di...
use std::collections::HashMap; use std::fs; use std::str::FromStr; #[derive(Debug)] /// Representation of a rule from the problem input. enum Rule { Char(char), Or(Box<Rule>, Box<Rule>), Seq(Vec<usize>), } impl FromStr for Rule { type Err = (); fn from_str(line: &str) -> Result<Self, Self::Err> {...
use std::{collections::HashSet, fs::File, io::BufReader, path::Path, path::PathBuf}; use serde::de::DeserializeOwned; use crate::state::{ workspace::Workspace, workspace::{Config, WorkspaceTab}, workspace_err::LoadYamlError, workspace_err::WorkspaceError, workspace_err::WorkspaceResult, }; use su...
pub const REG_CTRL: u32 = 0x0000; pub const REG_STATUS: u32 = 0x0008; pub const REG_EEPROM: u32 = 0x0014; pub const REG_CTRL_EXT: u32 = 0x0018; pub const REG_IMASK: u32 = 0x00D0; pub const REG_RCTRL: u32 = 0x0100; pub const REG_RXDESC...
use core::time::Duration; use futures; #[cfg(not(target_arch = "wasm32"))] use async_std::task:: {block_on}; #[cfg(not(target_arch = "wasm32"))] use colored::*; use std::sync::{Arc, Mutex, RwLock}; use crate::protocol_stack::node::node_services::{AddressMapService, PeerChannelService}; use crate::protocol_stack::node...
// extern crate ini; extern crate mosquitto_client as mosq; use super::whois::Whois; use super::wx::Weather; use ini::Ini; use log::{debug, error, info, warn}; use mosq::Mosquitto; // const MQTT_SERVER_HOST: &str = "localhost"; // const MQTT_SERVER_PORT: u32 = 1883; // const MQTT_TOPIC_INCOMING: &str = "Master/4601/In...
#[doc = "Register `P9IV` reader"] pub struct R(crate::R<P9IV_SPEC>); impl core::ops::Deref for R { type Target = crate::R<P9IV_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl core::convert::From<crate::R<P9IV_SPEC>> for R { fn from(reader: crate::R<P9IV_SPEC>) ->...
use crate::component::{ComponentId, ComponentRegistry}; use crate::query::QueryResponse; use crate::{query::Query, BorrowMutError, Entities, Entity}; pub struct ResourceId(ComponentId); #[derive(Debug)] pub struct World { entities: Entities, component_registry: ComponentRegistry, // The current storage im...
use crate::prosafe_switch::{Link, ProSafeSwitch}; use failure::Error; use hyper::rt::{self, Future}; use hyper::service::service_fn_ok; use hyper::{Body, Response, Server, Uri}; use lazy_static::lazy_static; use prometheus::{Encoder, Gauge, GaugeVec, Opts, Registry, TextEncoder}; use url::form_urlencoded; // ---------...
#![cfg_attr(not(feature = "std"), no_std)] use frame_support::{ decl_error, decl_event, decl_module, decl_storage, dispatch, ensure, traits::EnsureOrigin, }; use frame_system::{self as system, ensure_signed, RawOrigin}; use pallet_did::did::Did; use sp_std::{if_std, prelude::*, vec::Vec}; pub trait Config: frame_...
#[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ coin, from_binary, to_binary, Addr, BankMsg, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, StdResult, SubMsg, WasmMsg, }; use cw20::{Cw20ExecuteMsg, MinterResponse}; use protobuf::Message; use p...
use crate::core::pbrt::{Float, INFINITY}; use std::sync::Arc; use crate::core::texture::{TextureSpec, TextureFloat, Texture}; use crate::core::bssrdf::{BSSRDFTable, compute_beam_diffusion_bssrdf, TabulatedBSSRDF}; use crate::core::material::{Material, Materials, TransportMode, bump}; use log::warn; use crate::core::int...
use bevy::{ core_pipeline::Transparent3d, ecs::system::{lifetimeless::*, SystemParamItem}, pbr::{ DrawMesh, MeshPipeline, MeshPipelineKey, MeshUniform, SetMeshBindGroup, SetMeshViewBindGroup, }, prelude::*, reflect::TypeUuid, render::{ camera::PerspectiveCameraBundle,...
use futures::StreamExt; use kube::api::{Api, ListParams}; use kube_derive::CustomResource; use kube_runtime::{reflector::reflector, reflector::store::Writer, watcher::watcher}; use log::*; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::convert::TryFrom; use std::error::Error; use std::io::Write...
use aorist_primitives::Dialect; use crate::flow::{ CompressibleTask, CompressionKey, ETLFlow, StandaloneTask, TaskBase, UncompressiblePart, }; use crate::parameter_tuple::ParameterTuple; use crate::python::task::key::PythonBasedTaskCompressionKey; use crate::python::task::uncompressible::PythonBasedTaskUncompressib...
//! Quadrature decoder interface use core::marker::PhantomData; use core::task::Poll; use embassy::waitqueue::AtomicWaker; use embassy_hal_common::unborrow; use futures::future::poll_fn; use crate::gpio::sealed::Pin as _; use crate::gpio::{AnyPin, Pin as GpioPin}; use crate::interrupt::InterruptExt; use crate::perip...
#![no_std] #![feature(maybe_uninit_uninit_array)] #![feature(maybe_uninit_slice)] mod device; pub mod events; mod gpio; mod timer; use core::cmp::Ordering; use core::mem::MaybeUninit; use device::TimerID; use gpio::InputPin; use gpio::OutputPin; use once_cell::unsync::OnceCell; use device::Pin; use device::Port; use...
#![recursion_limit = "4096"] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #[macro_use] extern crate stdweb; extern crate connect_four_cli; mod connect_4_computer; mod connect_4_human; mod how_to_connect_4; mod how_to_toot; mod scoreboard; mod scores; mod toot_otto_computer; mod toot_otto_human; mod welco...
use crate::datetime; use core::fmt::Write; use embedded_graphics::coord::Coord; use embedded_graphics::fonts::Font8x16; use embedded_graphics::prelude::*; use epd_waveshare::epd2in9::Display2in9; use epd_waveshare::graphics::Display; use epd_waveshare::prelude::{Color, DisplayRotation}; use heapless::{consts::*, Strin...
//! Datastructures for manipulating the SAM4L USB Controller use core::fmt; use core::ptr; use kernel::common::VolatileCell; use usbc::common::register::*; #[derive(Copy, Clone, PartialEq, Debug)] pub enum Mode { Host, Device { speed: Speed, config: Option<EndpointConfig>, state: Devic...
// 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 { component_manager_lib::{capability::*, model::testing::breakpoints::*, model::*}, fidl::endpoints::ServerEnd, fidl_fuchsia_test_breakpoin...
use clap::crate_version; use crossbeam_channel::{bounded, Receiver, Sender}; use gnverify::{Format, GNVerify}; use log::{error, info}; use std::fs::File; use std::io::{self, Read}; use std::path; use std::process; use std::thread; use std::time::Instant; use stderrlog::{self, Timestamp}; #[macro_use] extern crate clap...
use crate::shapes::{Cone, Cylinder}; use bevy::{prelude::*, render::camera::Camera}; pub struct WorldAxesPlugin; impl Plugin for WorldAxesPlugin { fn build(&self, app: &mut AppBuilder) { app.init_resource::<WorldAxes>() .add_startup_system(world_axes_setup_system.system()) .add_sys...
/* * The MIT License (MIT) * * Copyright (c) 2020 NVIDIA Corporation * uapi-test contributors * * 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,...
// Copyright <NAME> 2018. // Dual-licensed under either the MIT License or the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) //! Vulkan implementation for adi_gpu. extern crate libc; /// Transform represents a transformation matri...
use std::fs::File; use std::io::prelude::*; use serde_json; use std::error::Error; use engine; use engine::command; use engine::bitwise_engine; use engine::constants::*; pub fn read_bitwise_state_from_file(filename: &str) -> Result<bitwise_engine::BitwiseGameState, Box<Error>> { let mut file = File::open(filename...
// Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors // SPDX-License-Identifier: MIT use std::convert::TryInto; use crypto::hash::BlockHash; use tezos_messages::p2p::{binary_message::MessageHash, encoding::peer::PeerMessage}; use crate::{ mempool::mempool_actions::BlockInjectAction, peer::...
use imap::error::Result; use imap::Session; use std::{thread, time}; use super::config::Config; /// Secured connection or not ? /// Whichever is chosen, user has to give the port as parameter #[derive(Debug, Clone, Deserialize, Serialize)] pub enum Secure { No(u16), Yes(u16), } /// mail config /...
use tokio::net::{TcpStream, TcpListener}; use failure::Error; use crate::connection::{copy,Connection}; use crate::socks5::*; use crate::req_addr::ReqAddr; #[derive(Clone, Debug)] pub(crate) struct Socks5Incoming { listen_addr: SocketAddr, } struct Socks5Connected { _local_addr: SocketAddr, _remote_addr:...
use std::collections::HashMap; use std::ops::Deref; use std::sync::Arc; use async_channel::{Receiver, Sender, unbounded}; use log::error; use tokio::net::TcpStream; use tokio::sync::mpsc; use crate::{RegisterCommand, SectorIdx, serialize_register_command, SystemRegisterCommand}; #[async_trait::async_trait] /// We do...
use chocopy_rs_common::*; use std::cell::*; use std::mem::*; use std::process::exit; use std::ptr::*; mod gc; #[repr(transparent)] #[derive(Clone, Copy)] struct AllocUnit(u64); thread_local! { static INIT_PARAM: Cell<*const InitParam> = Cell::new(std::ptr::null()); static GC_HEAD: Cell<Option<NonNull<Object>...
use std::fmt; use ark_crypto_primitives::prf::Blake2sWithParameterBlock; use ark_ec::{AffineCurve, ProjectiveCurve}; use ark_ff::{One, PrimeField}; use ark_mnt6_753::{Fq, G1Affine, G1Projective}; use blake2_rfc::blake2s::Blake2s; use nimiq_hash::HashOutput; use crate::utils::big_int_from_bytes_be; use crate::{Compre...
//! Window manager implementation. use std::sync::Arc; use crate::events; use crate::prelude::*; pub mod actions; pub mod config; pub mod desktop; pub mod ewmh; pub mod layout; use actions::{Action, ActionType}; use events::Event; /// The "state" of the window manager. Processing of /// events will depend on this....
use std::{ sync::{ mpsc::{self, Receiver, Sender}, Arc, }, time::Duration, }; use cpal::{ traits::{DeviceTrait, HostTrait, StreamTrait}, BufferSize, Stream, StreamConfig, }; use lewton::{ header::{read_header_comment, read_header_ident, read_header_setup}, inside_ogg::async...
//! Sprite rendering utilities pub use crate::sprite::*; use crate::*; use crate::io::StaticFile; use crate::windows::*; use crate::windows::d3d9::{BasicTextureCache, Vertex}; use winapi::shared::d3d9::*; use winapi::shared::d3d9types::*; use winapi::shared::minwindef::UINT; use std::convert::*; use std::ops::Range...
use std::{ borrow::Cow, fmt::{self, Debug, Display, LowerHex, UpperHex}, num::{NonZeroU64, ParseIntError}, str::FromStr, sync::Mutex, time::{Duration, SystemTime}, }; use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer}; /// 64-bit id value. /// FFI-safe. #[derive(Clone, Co...
// bits lifted from the skim project use crate::database::ActionType; use crate::database::{ExecutedAction, LinkedItemId}; use std::fs::File; use std::io::prelude::*; use std::io::{BufReader, BufWriter, ErrorKind}; use std::path::Path; use std::path::PathBuf; use std::str::FromStr; use std::time::{Duration, SystemTime}...
use super::state_prelude::*; use amethyst::assets::ProgressCounter; use amethyst::ecs::{Join, ReadStorage, WriteStorage}; use amethyst::ui::{UiText, UiTransform}; use std::collections::HashMap; const UI_RON_PATH: &str = "ui/win_game_menu.ron"; #[derive(Default)] pub struct WinGameMenu { campaign: Campa...
use { aloene::Aloene, std::{borrow::Cow, collections::HashMap, ops::Range}, }; #[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] pub struct Id(Cow<'static, str>); impl Id { pub fn len(&self) -> usize { self.0.len() } pub fn is_empty(&self) -> bool { self.0.is_empty() ...
use quircs::Quirc; #[test] fn empty_jpeg() { empty("jpeg"); } #[test] fn empty_png() { empty("png"); } fn empty(ext: &str) { let mut q = Quirc::default(); let empty_image = image::open(&format!("./tests/data/1x1.{}", ext)) .unwrap() .into_luma(); q.identify( empty_image....
//! Mocks for the currencies module. #![cfg(test)] use super::*; use bholdus_support::parameter_type_with_key; use frame_support::{construct_runtime, parameter_types, PalletId}; use frame_system::EnsureRoot; use sp_core::H256; use sp_runtime::{ testing::Header, traits::{AccountIdConversion, IdentityLookup}, ...
use gloo::events::EventListener; use yew::{html, Component, ComponentLink, Html, ShouldRender}; use crate::{ dto::User, service::HistoryService, utils::{location_path, PageData}, widget::{self, ButtonStyle, TableCell, TableRow}, }; pub struct Root { user_name: String, current_page: Page, l...
use rand::distributions::{IndependentSample, Range}; use rand::{weak_rng, Rng}; pub fn random_position(lower_space: f64, upper_space: f64, dimensions: usize) -> Vec<f64> { let between = Range::new(lower_space, upper_space); let mut rng = weak_rng(); (0..dimensions) .map(|_| between.ind_sample(&mut ...
/* Heavy Light Decomposition: It partitions a tree into disjoint paths such that: 1. Each path is a part of some leaf's path to root 2. The number of paths from any vertex to the root is of O(lg(n)) Such a decomposition can be used to answer many types of queries about vertices or edges on a particular path. It is ofte...
use std::fmt; /// Mode represents a file's mode and permission bits. /// The bits have the same definition on all systems, /// but not all bits apply to all systems. /// /// It is modelled after Go's `os.FileMode`. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct Mode(pub u32); impl Mode { /// d: is ...
// This module contains types relating to playing cards, their values and suits. use core::fmt; use std::char; use substring::Substring; use crate::*; pub const JOKER_CARD: Card = Card { n: Value(0), suit: Suit::Joker, }; /// Defines the canonical value of a playing card, according to the /// rules of Rummy...
/* IAY | Minimalist prompt for Bash/Zsh! Copyright (C) 2021 <NAME> */ use git2::{Oid, Repository, Status, StatusOptions}; use iay::colors; use lazy_static::lazy_static; use std::cell::Cell; use std::env; use std::path::Path; // Taken from: https://github.com/Ryooooooga/almel/blob/467e8f699e840c418a7eed5e0e22cf9c34ed1d...
//! Extraction of data from 2bit files use std::fs::File; use std::io::{BufReader, Cursor, Read, Seek, SeekFrom}; use std::mem::size_of; use std::path::Path; use crate::block::Blocks; use crate::error::{Error, Result}; use crate::{SequenceRecord, SequenceRecords}; // 2bit field type (uint32) pub type Field = u32; //...
//! Implementations of the callbacks exposed by wlc. //! These functions are the main entry points into Way Cooler from user action. use rustwlc::handle::{WlcOutput, WlcView}; use rustwlc::types::*; use super::keys; use super::layout::{lock_tree, try_lock_tree, TreeError}; use super::lua; use ::modes::{write_current_...
use crate::ty; use crate::ty::purity::Purity; use crate::ty::var_usage::Variance; use crate::ty::Ty; fn ty_has_subtypes<M: ty::Pm>(ty: &Ty<M>) -> bool { match ty { Ty::Any | Ty::Bool | Ty::Num | Ty::Sym | Ty::TopFun(_) | Ty::TopRecord | Ty::RecordClass(_) => ...
use std::collections::{BinaryHeap, HashMap, HashSet}; use std::io::BufRead; const DATA_FILE: &str = "15.txt"; pub fn data<P: AsRef<std::path::Path>>(data_dir: P) -> impl Iterator<Item = String> { let data_file = data_dir.as_ref().join(DATA_FILE); let data = std::io::BufReader::new(std::fs::File::open(&data_fi...
#[cfg(target_arch = "x86")] use std::arch::x86::*; #[cfg(target_arch = "x86_64")] use std::arch::x86_64::*; // # define z_validate_utf8 z_validate_utf8_avx2 // # define z_validate_vec z_validate_vec_avx2 // # define V_LEN (32) pub(crate) const V_LEN: usize = 32; // // Vector and vector mask type...
use crate::mcl_methods; use primitive_types::U256; use std::ops::{Add, AddAssign}; use std::ops::{Div, DivAssign}; use std::ops::{Mul, MulAssign}; use std::ops::{Sub, SubAssign}; use std::os::raw::c_int; #[link(name = "mcl", kind = "static")] #[link(name = "mclbn384_256", kind = "static")] #[link(name = "stdc++")] #[a...
use clap::{App, Arg, Values, crate_name, crate_version, crate_authors, crate_description}; use crate::file_checker::FileChecker; use regex::Regex; use crate::syncer::Syncer; use simplelog::{SimpleLogger, ConfigBuilder}; use log::{info, error, LevelFilter}; use std::time::Duration; use std::ops::Add; pub type Error = B...
// Copyright 2022 RisingLight Project Authors. Licensed under Apache-2.0. //! Secondary's [`Column`] builders and iterators. //! //! A column stores data of the same kind, e.g. Int32. On the storage format //! side, a column is composed of multiple blocks and an index. The type of //! blocks might not be the same. For...
//! Relay chain runtime mock. use frame_support::{ construct_runtime, parameter_types, traits::{Everything, Nothing}, weights::Weight, }; use sp_core::H256; use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32}; use polkadot_parachain::primitives::Id as ParaId; use polkadot_runtime_parachains::{co...
#![cfg_attr(not(feature = "std"), no_std)] extern crate alloc; #[cfg(feature = "runtime-benchmarks")] mod benchmarks; mod crypto; #[cfg(any(feature = "runtime-benchmarks", test))] mod mock; mod module_impl; mod offchain_error; #[cfg(test)] mod tests; mod weights; use alloc::vec::Vec; use frame_support::{ debug, ...
// The Nature of Code // <NAME> // http://natureofcode.com // // Example 7-3: Conways Game of Life // A basic implementation of <NAME>'s Game of Life CA // Each cell is now an object! use nannou::prelude::*; use std::ops::Range; fn main() { nannou::app(model).update(update).run(); } #[derive(Clone)] struct Cell...
use hyper::error as herror; use std::error::Error; use std::fmt; use std::io::Error as IOError; use url::ParseError; use webdriver::error as wderror; /// An error occured while attempting to establish a session for a new `Client`. #[derive(Debug)] pub enum NewSessionError { /// The given WebDriver URL is invalid. ...
extern crate semver; extern crate serde; extern crate serde_repr; use semver::Version; use serde::{Deserialize, Serialize}; /// Contains custom types used by Info pub mod info { use super::{Deserialize, Serialize}; /// Represents a game environment #[derive(Serialize, Deserialize, Debug)] pub enum En...
use binance::futures::websockets::*; use binance::api::*; use binance::futures::userstream::*; use binance::futures::websockets::FuturesWebsocketEvent; use std::sync::atomic::{AtomicBool, Ordering}; fn main() { market_websocket(); } #[allow(dead_code)] async fn user_stream_websocket() { let keep_running = At...
use self::nodesearch::NodeSearch; use crate::annis::db::AnnotationStorage; use crate::{ annis::operator::{BinaryOperatorBase, EstimationType}, errors::Result, graph::Match, }; use graphannis_core::{ annostorage::MatchGroup, types::{AnnoKey, NodeID}, }; use std::collections::BTreeMap; use std::sync:...
/*-------------------------------------------------------------------------- Deno-MiniFB The MIT License (MIT) Copyright (c) 2021 <NAME> (sinclair) <<EMAIL>> 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 ...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use starcoin_logger::prelude::*; use starcoin_vm_types::account_config::ACCOUNT_MODULE; use starcoin_vm_types::errors::VMError; use starcoin_vm_types::vm_status::{AbortLocation, StatusCode, VMStatus}; //should be consistent with Error...
//! <https://github.com/EOSIO/eosio.cdt/blob/4985359a30da1f883418b7133593f835927b8046/libraries/eosiolib/core/eosio/crypto.hpp#L93-L120> use crate::{NumBytes, Read, SerializeData, UnsignedInt, Write}; use alloc::string::ToString; use core::{ convert::TryInto, str::FromStr, }; use codec::{Encode, Decode}; #[cfg(...
use crate::gdt; use crate::{print, println}; use lazy_static::lazy_static; use pic8259_simple::ChainedPics; use spin; use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame}; /* just for reference full IDT struct: #[repr(C)] pub struct InterruptDescriptorTable { pub divide_by_zero: Entry<Hand...
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
#![warn(clippy::all, rust_2018_idioms)] #![allow(unknown_lints)] use cargo_registry::{boot, App, Env}; use std::{ borrow::Cow, fs::File, process::Command, sync::{mpsc::channel, Arc, Mutex}, time::Duration, }; use civet::Server as CivetServer; use conduit_hyper::Service; use futures_util::future::F...
/* * Drag is merely a lightweight state machine to track: * 1. Whether the pointer has moved enough to start dragging * 2. The current drag position * * The consumer is expected to: * 1. create/stash it on mouse down * 2. update it on global mouse move * 3. drop it on global mouse up * * In addition to the _t...
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![allow(unsafe_code)] use eframe::egui; use egui::mutex::Mutex; use std::sync::Arc; fn main() { let options = eframe::NativeOptions { initial_window_size: Some(egui::vec2(350.0, 380.0)), ...
mod error; mod framed_read; mod framed_write; pub use self::error::{RecvError, SendError, UserError}; use self::framed_read::FramedRead; use self::framed_write::FramedWrite; use crate::frame::{self, Data, Frame}; use bytes::Buf; use futures_core::Stream; use futures_sink::Sink; use std::pin::Pin; use std::task::{Co...
use crate::{ flavor::Hoi4Flavor, tokens::TokenLookup, FailedResolveStrategy, Hoi4Date, Hoi4Error, Hoi4ErrorKind, PdsDate, }; use jomini::{BinaryTape, BinaryToken, TextWriterBuilder, TokenResolver}; use std::collections::HashSet; /// Convert a binary gamestate to plaintext #[derive(Debug)] pub struct Melter { ...
use embedded_hal::blocking::i2c::{self, Read}; use std::cmp; use std::io::{self, Error, ErrorKind}; use std::thread; use std::time::Duration; const BUFFER_WAIT: Duration = Duration::from_millis(4); /// Encodes a single byte of data. pub trait Encoding { fn encode(&self, byte: u8) -> Option<Vec<u8>>; } /// Wrappe...
use std::sync::Arc; use std::collections::HashMap; use tracing::{debug, trace, instrument}; use async_lock::Mutex; use dataplane::ReplicaKey; use dataplane::api::Request; use dataplane::api::RequestMessage; use fluvio_types::SpuId; use fluvio_socket::{MultiplexerSocket, SharedMultiplexerSocket, SocketError, AsyncResp...
use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; use quote::{format_ident, quote}; use syn::parse::{self, Parse, ParseStream}; use syn::punctuated::Punctuated; use syn::spanned::Spanned; use syn::{Error, Field, GenericParam, Generics, Ident, LitStr, Token, Type, TypeParam}; /// Error message ...
//! Environmental Information use std::cell::RefCell; use std::{io, rc::Rc}; use ckb_vm::instructions::Register; use ckb_vm::memory::Memory; use protocol::{types::Address, Bytes}; use crate::vm::cost_model::CONTRACT_CALL_FIXED_CYCLE; use crate::vm::syscall::common::{get_arr, get_str}; use crate::vm::syscall::conventi...
pub mod params; mod type_support; pub use self::type_support::*; use std::iter::Iterator; use std::ops::{AddAssign, BitAnd, BitXor, BitXorAssign, Mul, Shl, Shr, Sub}; use std::str::FromStr; use std::fmt::Display; extern crate num_traits; use num_traits::{Bounded, One, Zero, Unsigned, PrimInt}; /** * A low-discre...
use std::str::FromStr; use postgres::{Connection as PostgresConnection, TlsMode}; error_chain! { types { ConnectionError, ConnectionErrorKind, ConnectionResultExt, ConnectionResult; } foreign_links { PostgresConnect(::postgres::error::Error); } errors { MalformedConnectionS...
// Copyright 2011 Google Inc. // Copyright 2020 <NAME> // // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use alloc::vec::Vec; use crate::{Point, Path}; use crate::edge::{Edge, LineEdge, QuadraticEdge, CubicEdge}; use crate::edge_clipper::EdgeClipperIter; use c...
use gen_common::*; use mat_common::*; use util::*; use std::iter::*; pub fn template_postfix(gen: &MatGen) -> String { format! {"\ {fn_transpose}\ ", fn_transpose = fn_transpose(gen), }} pub fn fn_transpose(gen: &MatGen) -> String { format! {"\ /// Returns transpose of the matrix. /// /// # Exampl...
//! The console appender. //! //! Requires the `console_appender` feature. use log::Record; #[cfg(feature = "file")] use serde_derive::Deserialize; use std::error::Error; use std::fmt; use std::io::{self, Write}; use crate::append::Append; use crate::encode::pattern::PatternEncoder; use crate::encode::writer::console...
mod command; mod downstream; mod telemetry; mod ttn; mod x509; use actix_web::{ get, middleware, web::{self, Data}, App, HttpResponse, HttpServer, Responder, }; use drogue_cloud_endpoint_common::{ auth::AuthConfig, command::{Commands, KafkaCommandSource, KafkaCommandSourceConfig}, }; use drogue_clo...
/// Second argument to futex syscall pub const FUTEX_WAIT: i32 = 0; pub const FUTEX_WAKE: i32 = 1; pub const FUTEX_FD: i32 = 2; pub const FUTEX_REQUEUE: i32 = 3; pub const FUTEX_CMP_REQUEUE: i32 = 4; pub const FUTEX_WAKE_OP: i32 = 5; pub const FUTEX_LOCK_PI: i32 = 6; pub const FUTEX_UNLOCK_PI: i32 = 7; pub const FUTEX...
use std::fmt::{Display, Formatter}; use log::debug; #[repr(u64)] #[derive(Debug, Clone, Copy, Eq, PartialEq)] pub enum TokenType { // Comments Comment, // Keywords Function, Const, Var, // Type keywords N64, // Identifiers Identifer, // Literals IntegerLiteral, // Symbols OpenParenthesis, CloseParenthe...
// // Copyright 2018-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://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in w...
use crate::{node::KubeletIps, PodServerRx}; use anyhow::{anyhow, Result}; use dashmap::{mapref::entry::Entry, DashMap}; use linkerd_policy_controller_core::{ ClientAuthentication, ClientAuthorization, DiscoverInboundServer, InboundServer, InboundServerStream, NetworkMatch, }; use std::{collections::HashMap, net...
/* --- PyStatus ----------------------------------------------- */ use crate::ffi::Py_ssize_t; use libc::wchar_t; use std::os::raw::{c_char, c_int, c_ulong}; #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum _PyStatus_TYPE { _PyStatus_TYPE_OK = 0, _PyStatus_TYPE_ERROR = 1, _PyStatus_TYPE_EXIT = 2, } ...
use { crate::{Config, LoopCounter, Package}, crate::util::writer, byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}, serde_json::{self, Value}, flate2::bufread::ZlibDecoder, std::{ io::{self, Cursor, Read, Write}, net::{TcpStream, ToSocketAddrs}, str, sync::mpsc...
use pin_project_lite::pin_project; use std::future::Future; use std::marker::PhantomData; use std::pin::Pin; use std::{io, task}; pin_project! { /// We use this future to mark certain methods /// as callable in both sync and async modes. #[repr(transparent)] pub struct SyncFuture<S, T: Future> { ...
// 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...
//! Components for GPIO pins. //! //! //! Usage //! ----- //! ```rust //! let gpio = components::gpio::GpioComponent::new( //! board_kernel, //! components::gpio_component_helper!( //! nrf52840::gpio::GPIOPin, //! // left side of the USB plug //! 0 => &nrf52840::gpio::PORT[Pin::P0_13], /...