text
stringlengths
3.09k
13.9k
use super::*; use bytes::{Buf, BufMut, Bytes, BytesMut}; //// Return code in connack #[derive(Debug, Clone, Copy, PartialEq)] #[repr(u8)] pub enum UnsubAckReason { Success = 0x00, NoSubscriptionExisted = 0x11, UnspecifiedError = 0x80, ImplementationSpecificError = 0x83, NotAuthorized = 0x87, To...
// Copyright 2020, 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...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 #![forbid(unsafe_code)] use anyhow::Result; use bytecode_verifier::VerifiedModule; use libra_state_view::StateView; use libra_types::{ access_path::AccessPath, account_address::AccountAddress, account_config, contract_...
use druid::kurbo::{Point, Rect, Size}; use druid::piet::{ CairoTextLayout, Color, FontBuilder, InterpolationMode, PietText, RenderContext, Text, TextLayout, TextLayoutBuilder, UnitPoint, }; use druid::{ BoxConstraints, Env, Event, EventCtx, LayoutCtx, LifeCycle, LifeCycleCtx, PaintCtx, UpdateCtx, Widget...
use adventofcode2021::{default_sub_command, CommandResult, Problem}; use clap::{value_t_or_exit, App, Arg, ArgMatches}; use nom::{ branch::alt, bytes::complete::tag, character::complete::newline, combinator::{map, value}, multi::{many1, separated_list0}, sequence::separated_pair, IResult, };...
use std::sync::{Arc, Mutex}; use super::Canvas; use super::glwrap::{GlTexture, TexFilters}; ///////////////////////////////////////////////////////////////////////////////////////////////////// Texture #[derive(Clone, Debug)] pub enum Texture { None, Static (StaticTexture), Dynamic (DynTexture), Sub (SubTextu...
//! The REPL (Read-Eval-Print-Loop) use codespan::{CodeMap, FileMap, FileName}; use codespan_reporting; use codespan_reporting::termcolor::{ColorChoice, StandardStream}; use failure::Error; use rustyline::error::ReadlineError; use rustyline::Editor; use std::path::PathBuf; use term_size; use semantics; use syntax::co...
use crate::app::App; use crate::colors::ColorScheme; use crate::helpers::ID; use crate::render::{DrawOptions, Renderable, OUTLINE_THICKNESS}; use ezgui::{Color, Drawable, GeomBatch, GfxCtx, Line, Prerender, Text}; use geom::{Angle, ArrowCap, Distance, PolyLine, Polygon, Pt2D}; use map_model::{Map, TurnType}; use sim::{...
use clap::{App, Arg}; use lazy_static::lazy_static; use regex::Regex; use std::{ cmp::Reverse, collections::{BinaryHeap, HashMap}, convert::TryFrom, io::{self, Write}, path::PathBuf, }; use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; use hyperpolyglot::{get_language_brea...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Version ID Register"] pub ver: VER, #[doc = "0x04 - Parameter Register"] pub par: PAR, _reserved2: [u8; 24usize], #[doc = "0x20 - Transmit Register"] pub tr: [TR; 4], _reserved3: [u8; 16usize], #[doc = "0x40 - Receive Reg...
use std::rc::Rc; use std::cell::RefCell; use std::collections::{HashSet, HashMap}; use std::ops; use std::iter::Iterator; use byteorder::{BigEndian, WriteBytesExt}; use super::mast::{State, Mast, StateId}; #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Op(pub u8); const OPCODE_MASK: ...
#![cfg_attr(feature = "sgx", no_std)] #![feature(const_fn)] #![feature(thread_local)] #![feature(const_fn_fn_ptr_basics)] #![feature(duration_zero)] #![feature(duration_constants)] #![feature(duration_saturating_ops)] #[cfg(feature = "sgx")] #[macro_use] extern crate sgx_tstd as std; extern crate alloc; pub mod confi...
use std::sync::{ atomic::{AtomicBool, Ordering::Relaxed}, mpsc::{sync_channel, Receiver, SyncSender}, }; use crate::*; static ID_GEN: AtomicUsize = AtomicUsize::new(0); /// An event that happened to a key that a subscriber is interested in. #[derive(Debug, PartialEq, Eq, PartialOrd, Ord)] pub enum Event { ...
//! Real-Time Interrupt-driven Concurrency (RTIC) framework for ARM Cortex-M microcontrollers //! //! **HEADS UP** This is an **beta** pre-release; there may be breaking changes in the API and //! semantics before a proper release is made. //! //! **IMPORTANT**: This crate is published as [`cortex-m-rtic`] on crates.io...
use lang_data::data::*; use lang_data::rule::*; use lang_data::typed_part::*; use lang_data::annotations::*; use descr_lang::gen::ast::*; use descr_lang::gen::visitor::Visitor; use std::collections::HashMap; pub struct BuildParsers<'a, 'd: 'a> { data: &'a mut LangData<'d>, } impl<'a, 'd: 'a> BuildParsers<'a, 'd> {...
extern crate nom; extern crate classfile_parser; use classfile_parser::class_parser; use classfile_parser::constant_info::ConstantInfo; #[test] fn test_valid_class() { let valid_class = include_bytes!("../java-assets/compiled-classes/BasicClass.class"); let res = class_parser(valid_class); match res { ...
// 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. //! Service-wide definitions. //! //! # Summary //! //! The base mod houses the core definitions for communicating information //! across the service. Note...
use std::{ time::Duration, sync::atomic::{AtomicU64, Ordering}, }; struct Query { total_queries: AtomicU64, total_fail: AtomicU64, total_time: AtomicU64, fail_time: AtomicU64, min_sucess_time: AtomicU64, max_sucess_time: AtomicU64, min_fail_time: AtomicU64, max_fail_time: Atomic...
mod receiver; mod sender; use crate::metainfo::Metainfo; use crate::storage::PieceStore; use bitvec::{bitvec, BitVec}; use receiver::Receiver; use sender::Sender; use std::collections::HashSet; use std::collections::{HashMap, VecDeque}; use std::fmt; use std::io::{self, BufReader, BufWriter}; use std::net::{TcpStream,...
use std::vec::Vec; use chunk::{Chunk, Param, TupleMode}; use codegen::translate_from_glib::TranslateFromGlib; use codegen::translate_to_glib::TranslateToGlib; use env::Env; use super::primitives::*; pub trait ToCode { fn to_code(&self, env: &Env) -> Vec<String>; } impl ToCode for Chunk { fn to_code(&self, en...
use crate::partition::PartitionID; use std::{ ffi::OsString, fmt::{self, Display, Formatter}, fs::File, io::{self, BufRead, BufReader, Error, ErrorKind}, os::unix::prelude::OsStringExt, path::{Path, PathBuf}, str::FromStr, }; #[derive(Debug, Default, Clone, Hash, Eq, PartialEq)] pub struct M...
use crate::cartridge::Cartridge; use crate::joypad::Joypad; use crate::joypad::JOYPAD_REGISTER; use crate::lcd::Lcd; use crate::lcd::CONTROL_REGISTER; use crate::lcd::WINDOW_X_REGISTER; use crate::lcd::OAM_START; use crate::lcd::OAM_END; use crate::lcd::VRAM_START; use crate::lcd::VRAM_END; use crate::timer::Timer; use...
// Copyright 2019 EinsteinDB a Project Housed by WHTCORPS INC ALL RIGHTS RESERVED. // // 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 req...
//! Provides fetcher for Node distributions use std::fs::{read_to_string, write, File}; use std::path::{Path, PathBuf}; use super::NodeVersion; use crate::error::{Context, ErrorKind, Fallible}; use crate::fs::{create_staging_dir, create_staging_file, rename}; use crate::hook::ToolHooks; use crate::layout::volta_home;...
use super::{Client, ClientBuilder, InboundSubscriptions}; use crate::blockcfg::HeaderHash; use crate::network::{ grpc, p2p::{comm::PeerComms, Address}, security_params::NONCE_LEN, Channels, ConnectionState, }; use chain_core::mempack::{self, ReadBuf, Readable}; use chain_network::data::{AuthenticatedNod...
// Chunk's read_completely_times updated on Iter::Drop // // Chunk's iteration synchronization occurs around [ChunkStorage::storage_len] acquire/release access // use crate::sync::Ordering; use std::ptr::{NonNull}; use crate::event_queue::{CleanupMode, EventQueue, foreach_chunk, Settings}; use std::ops::ControlFlow::{...
use core::{ alloc::Layout, cell::UnsafeCell, ptr::{self, NonNull}, sync::atomic::{AtomicUsize, Ordering}, }; use alloc::vec::Vec; #[derive(PartialEq, Eq)] pub(crate) struct DropQueue { inner: NonNull<DropQueueInner<[UnsafeCell<u32>]>>, } /// # Safety /// /// This is basically `Arc<DropQueueInner>...
use super::{Number, Position, Size}; #[derive(Debug, Copy, Clone, PartialEq)] pub struct Region<N: Number = f32> { pub x: N, pub y: N, pub width: N, pub height: N, } pub type Viewport<N = f32> = Region<N>; impl<N: Number> Region<N> { pub fn new(x: N, y: N, width: N, height: N) -> Self { S...
#![feature(step_by, inclusive_range_syntax, heap_api, alloc)] extern crate libc; extern crate byteorder; extern crate cpuprofiler; extern crate alloc; use std::fs::File; mod instr; mod disasm; mod thumb_disasm; mod mem; mod emu; mod binutil; mod pp; mod gui; // mod analysis; // mod cell; // mod store; use mem::Store...
use std::collections::{HashMap, HashSet}; use amir::{ amir::Amir, block::{ABasicBlock, BlockId}, scope::ScopeId, stmt::{AStmt, ATerminator, LinkId, StmtBind}, var::{AVar, VarId}, }; use thir::LinkName; use types::Type; use crate::{block_proto::BlockProto, scope_proto::ScopeProto}; pub struct Amir...
use super::{BTreeMap, Felt, FieldElement, RangeChecker}; use rand_utils::rand_array; use vm_core::{utils::ToElements, StarkField}; #[test] fn range_checks() { let mut checker = RangeChecker::new(); let values = [0, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 100, 355, 620].to_elements(); for &value in values.iter() { ...
use fs::{off_t, FileDesc}; use prelude::*; use process::{get_current, Process, ProcessRef}; use std::fmt; // TODO: Rename VMSpace to VMUniverse #[macro_use] mod vm_range; mod process_vm; mod vm_area; mod vm_domain; mod vm_space; pub use self::process_vm::ProcessVM; pub use self::vm_range::{VMRange, VMRangeTrait}; /...
//! Crate wrapping parser API in nice-to-use Rust code. //! //! The Parser is a library written in scala. There are two implementations of Rust wrappers to //! this parser: one for local parser which binds scala parser compiled to WebAssembly to the Rust //! crate. The second is calling a Parser running remotely using ...
// At any given time, you can have either one mutable reference or any number of immutable references. // References must always be valid. use std::mem::replace; // Ownership is Rust’s most unique feature, and it enables Rust to make memory safety guarantees without needing a garbage collector. // memory is managed ...
//! The plic module contains the platform-level interrupt controller (PLIC). //! The plic connects all external interrupts in the system to all hart //! contexts in the system, via the external interrupt source in each hart. It's the global interrupt controller in a RISC-V system. //! The implementation compliant with ...
use crate::common::*; #[derive(Debug, Snafu)] #[snafu(visibility(pub(crate)))] pub(crate) enum Error { #[snafu(display("Failed to parse announce URL: {}", source))] AnnounceUrlParse { source: url::ParseError }, #[snafu(display("Failed to parse byte count `{}`: {}", text, source))] ByteParse { text: String,...
// RGB standard library // Written in 2020 by // Dr. <NAME> <<EMAIL>> // // To the extent possible under law, the author(s) have dedicated all // copyright and related and neighboring rights to this software to // the public domain worldwide. This software is distributed without // any warranty. // // You should ha...
use mpstthree::binary::struct_trait::{end::End, recv::Recv, send::Send, session::Session}; use mpstthree::meshedchannels::MeshedChannels; use mpstthree::role::broadcast::RoleBroadcast; use petgraph::dot::Dot; // Get roles use mpstthree::role::a::RoleA; use mpstthree::role::b::RoleB; use mpstthree::role::c::RoleC; use...
use crate::{ProfileIdentifier, ProfileTrait}; pub mod authentication; pub use authentication::*; pub mod change; pub use change::*; pub mod contacts; pub use contacts::*; pub mod identifiers; pub use identifiers::*; pub mod secrets; pub use secrets::*; /// An Entity represents an identity in various authentication co...
use crate::editor::*; use cotton::prelude::*; use regex::Regex; use std::error::Error; const NEW_LINE: &str = "\n"; #[derive(Debug)] pub struct LinesEditor { lines: Vec<String>, } #[derive(Debug)] pub enum LinesEditorError { InvalidPairOrSeparator, MultipleCandidates, NotApplicable(String), } impl ...
//! Accumulate the results of running groups of functions against a single object //! //! There two primary use cases that I can think of. //! //! 1) Bulk processing - This is items like inserting to a database or parsing tabular data. I don't //! want to throw away completed work if there is one error. Even though ...
use crate::derives::attrs::{Attrs, Kind, Name, DEFAULT_CASING, DEFAULT_ENV_CASING}; use crate::derives::{from_argmatches, into_app, spanned::Sp}; use proc_macro2::{Ident, Span, TokenStream}; use proc_macro_error::{abort, abort_call_site}; use quote::{quote, quote_spanned}; use syn::{ punctuated::Punctuated, spanne...
use maplit::hashmap; use std::collections::HashMap; pub trait Bucket: 'static { const DB_NAME: &'static str; } pub trait DupSort { const AUTO_KEYS_CONVERSION: bool = false; const CUSTOM_DUP_COMPARATOR: Option<&'static str> = None; const DUP_FROM_LEN: Option<usize> = None; const DUP_TO_LEN: Option<...
use crate::os_input_output::ClientOsApi; use crate::InputInstruction; use std::collections::HashMap; use terminfo::{capability as cap, Database as TerminfoDatabase}; use termion::input::TermReadEventsAndRaw; use zellij_utils::channels::SenderWithContext; use zellij_utils::input::mouse::MouseEvent; use zellij_utils::ter...
/*- * ========================LICENSE_START================================= * PREvant REST API * %% * Copyright (C) 2018 - 2019 aixigo AG * %% * 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 ...
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unl...
use super::*; use cpu_models::get_edge_embedding_method_name_from_string; use numpy::PyArray2; /// #[pyclass] #[derive(Debug, Clone)] #[text_signature = "(*, edge_embedding_method_name, number_of_epochs, number_of_edges_per_mini_batch, sample_only_edges_with_heterogeneous_node_types, learning_rate, random_state)"] pub...
use std::collections::BTreeMap; use anyhow::Result; use log::debug; use crate::{ analysis::dis, aspace::AddressSpace, module::{Module, Permissions}, VA, }; use lancelot_flirt::*; const EMPTY_CONTEXT: zydis::ffi::RegisterContext = zydis::ffi::RegisterContext { values: [0u64; 257] }; /// make a best g...
use crate::{header_vec, HeaderVec}; use core::ops::Deref; #[test] fn eq() { let foo_empty: HeaderVec<_, i32> = header_vec!["foo";]; assert_eq!(header_vec!["foo"; 1, 2, 3], header_vec!["foo"; 1, 2, 3]); assert_eq!(foo_empty, foo_empty); assert_eq!(header_vec!["foo"; 1, 2], *header_vec!["foo"; 1, 2].dere...
#![allow(clippy::many_single_char_names)] use fere::prelude::{fere_resources::Texture, *}; use fere_window::*; use rand::prelude::*; use rayon::prelude::*; use std::sync::Arc; struct Scene { renderer: Fere, world: Option<Box<World>>, resources: Arc<Resources>, frame_count: usize, } struct Resources ...
use rayon::prelude::*; use super::math::Vec4; use super::math::Ray; use super::image; use super::parameters::Parameters; use super::parameters::DebugMode; use super::statistics::Statistics; use super::scene::Scene; use super::materials; pub struct Renderer<'a> { parameters: Option<&'a Parameters>, scene: Optio...
use std::fs::File; //use std::path::PathBuf; use gdk::EventMask; use gtk::Orientation::Horizontal; use gtk::{ //OrientableExt, ContainerExt, //BoxExt, DrawingArea, GtkWindowExt, Inhibit, LabelExt, ListBoxExt, //ListBoxRowExt, WidgetExt, WidgetExtManual, Window, Windo...
use bson::{from_bson, Bson}; use bson::oid::ObjectId; use mongodb::{self, ThreadedClient}; use mongodb::db::{Database, ThreadedDatabase}; use na::{DMatrix, DVector}; use serde_enum; use std::error; use std::fmt::{self, Display, Formatter}; use db::{self, Weighting}; use cfg; use model::Metric; #[derive(Serialize, Des...
//! This module implements the `kill` system call, which allows to send a signal to a process. use crate::errno::Errno; use crate::errno; use crate::file::Uid; use crate::process::Process; use crate::process::Regs; use crate::process::State; use crate::process::pid::Pid; use crate::process::signal::Signal; use crate::...
use anyhow::*; use cursive::theme::BaseColor; use cursive::theme::Color; use ini::Ini; use lazy_static::*; use std::fs; use std::path::PathBuf; const CONFIG_FILE: &str = "config.ini"; const CONFIG_DIR: &str = ".config"; const APP_DIR: &str = "wiki-tui"; lazy_static! { pub static ref CONFIG: Config = Config::new()...
use ::image::{load_from_memory_with_format, ImageFormat}; use futures::channel::mpsc::{self, Sender}; use iced::image::{self, Image}; use iced::{ button, pick_list, text_input, Align, Button, Column, Command, Container, Element, Length, Row, Subscription, Text, TextInput, }; use once_cell::sync::OnceCell; use s...
//! A stream encoder that gets the audio samples from PulseAudio. //! //! Currently, Opus (in a WebM streamable container) and MP3 (in an MPEG-1 container) are //! supported, which should cover all of the major browsers. mod mp3; mod opus; use anyhow::{bail, Context, Result}; use byte_slice_cast::*; use pulse::sample...
use std::sync::Arc; use crate::{ block::{ Block, Commitment::{self, ChainHistoryActivationReserved}, }, history_tree::NonEmptyHistoryTree, parameters::{Network, NetworkUpgrade}, sapling, serialization::ZcashDeserializeInto, }; use color_eyre::eyre; use eyre::Result; use zebra_t...
use std::sync::Arc; use async_trait::async_trait; use futures::{ future::{self, BoxFuture, FutureExt}, lock::Mutex, }; use log::info; use crate::server::ServerPersistence; use crate::{ accessory::HapAccessory, config::Config, event::{Event, EventEmitter}, pointer, server::Server, stor...
use crate::error::LoadError; use crate::string_helpers::append_word; use crate::types::{scope::Scope, variable::Variable}; use crate::vcd::VCD; use std::collections::HashMap; use std::str::FromStr; #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, EnumString, ToString)] enum ParserState { #[strum(serialize = "end"...
use super::super::path::*; use super::super::graph_path::*; use super::super::is_clockwise::*; use super::super::super::curve::*; use super::super::super::normal::*; use super::super::super::super::geo::*; use smallvec::*; /// /// Winding direction of a particular path /// #[derive(Copy, Clone, PartialEq, Debug)] p...
use crate::db::id::UserID; use crate::db::models::User; use crate::db::{Pool, PooledConnection, SearchIndex}; use crate::email::Mailer; use crate::schema::users; use anyhow::{anyhow, Result}; use chrono::{DateTime, Utc}; use diesel::{query_dsl::methods::FindDsl, RunQueryDsl}; use once_cell::sync::Lazy; use std::net::Ip...
//! Heap layout generation. use super::TraceMap; use anyhow::Result; use drone_config::format_size; use std::io::Write; const WORD_SIZE: u32 = 4; /// Generates a new empty layout for the given `size` and `pools`. pub fn empty(size: u32, pools: u32) -> Vec<(u32, u32)> { let pool_min = WORD_SIZE; let pool_max ...
//! User-side server extern crate hyper; extern crate serde_json; use std::sync::Mutex; use std::fmt; use std::collections::hash_map::HashMap; use self::hyper::server::{Handler, Server, Request, Listening}; use self::hyper::server::Response as SResponse; use self::hyper::status::StatusCode; use self::hyper::method::Me...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00..0x34 - Channel Control Register (channel = 0)"] pub tc_channel0: TC_CHANNEL, _reserved1: [u8; 0x0c], #[doc = "0x40..0x74 - Channel Control Register (channel = 0)"] pub tc_channel1: TC_CHANNEL, _reserved2: [u8; 0x0c],...
use std::{ convert::TryInto, io::{Cursor, Result}, }; use byteorder::{BigEndian, ReadBytesExt}; use crate::{ api::{ get_group_info, get_group_member_info_v2, get_group_member_list, send_group_msg, set_group_anonymous, set_group_ban, set_group_kick, set_group_whole_ban, Convert, }, ...
use crate::mock_graph::{ arbitrary::{GuidedArbGraph, Limit, NonUnique, TwoVerticesIn, Uniqueness}, TestGraph, }; use graphene::{ algo::{Bfs, Dfs}, core::{ property::{AddEdge, RemoveEdge, VertexInGraph}, Ensure, Graph, GraphDerefMut, ReleaseUnloaded, }, impl_ensurer, }; use quickcheck::Gen; use rand::Rng; use ...
use std::ffi::{CStr, CString, OsStr}; use std::io; use std::os::unix::prelude::*; use std::ptr::NonNull; use std::sync::Arc; use crate::util; use super::{FileType, Metadata}; #[derive(Debug)] struct Dstream { dir: NonNull<libc::DIR>, } impl Dstream { #[inline] fn as_ptr(&self) -> *mut libc::DIR { ...
// Copyright 2018-2020 <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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in wri...
use std::convert::Infallible; use std::num::NonZeroU8; use std::io::{stdin, stdout, Write}; use std::str::FromStr; use anyhow::{anyhow, Result}; use clap::Parser; #[derive(Debug, Copy, Clone, Eq, PartialEq)] enum Answer { Yes, No, Retry, } #[derive(Debug, Copy, Clone, Eq, PartialEq)] enum ReaderType { ...
use crate::{ collections::TypedUsize, crypto_tools::paillier::{ zk::{mta, ZkSetup}, Ciphertext, EncryptionKey, Plaintext, Randomness, }, gg20::sign::SignShareId, sdk::api::TofnResult, }; use serde::{Deserialize, Serialize}; use zeroize::Zeroize; #[derive(Debug, Clone, Serialize, Des...
use crate::errors::Result; use crate::{AtomicPageId, PageId, PAGE_SIZE}; use slog::Logger; use std::fs::{File, OpenOptions}; use std::io::{Read, Seek, SeekFrom, Write}; use std::sync::atomic::Ordering; // DiskManager takes care of the allocation and deallocation of pages within a database. It performs the reading and ...
use std::error::Error; use std::fs; #[derive(Debug, Copy, Clone, PartialEq)] struct Point { x: i32, y: i32, } impl Point { fn zero() -> Point { Point { x: 0i32, y: 0i32 } } fn to_zero(&self) -> i32 { self.x.abs() + self.y.abs() } fn move_by(&self, op: &str) -> Point { ...
use chrono::{DateTime, Duration, NaiveDate, Utc}; use multimap::MultiMap; use percent_encoding::utf8_percent_encode; use std::hash::Hash; use std::iter::*; use std::string::ToString; use std::time::{Instant, SystemTime}; const CHARACTER_LIMIT: usize = 300; #[inline] pub fn encode(s: &str) -> String { ...
use actix_web::{http::header, HttpRequest, HttpResponse}; use futures::TryStreamExt; use std::{ io::Write, path::{Component, Path, PathBuf}, }; use crate::errors::ContextualError; use crate::listing::{self}; /// Saves file data from a multipart form field (`field`) to `file_path`, optionally overwriting /// e...
use std::sync::Arc; use anyhow::Result; use async_trait::async_trait; use tonic::metadata::MetadataValue; use tonic::transport::{Channel, ClientTlsConfig}; use tonic::Request; use crate::api::dgraph_client::DgraphClient; use crate::client::lazy::{ILazyChannel, ILazyClient}; use crate::client::tls::LazyTlsChannel; use...
#![deny(rustdoc::broken_intra_doc_links, rustdoc::bare_urls, rust_2018_idioms)] #![warn( missing_copy_implementations, missing_debug_implementations, clippy::explicit_iter_loop, clippy::future_not_send, clippy::use_self, clippy::clone_on_ref_ptr )] use data_types::{ chunk_metadata::{ChunkAd...
extern crate serde; use censor::*; use oorandom::Rand32; use specs::prelude::*; use specs::saveload::{SimpleMarker, SimpleMarkerAllocator}; use crate::animation::{AnimationSystem, DisappearingSystem}; use crate::carry::{CarrySystem, PickUpSystem}; use crate::components::*; use crate::crab_ai::CrabAISystem; use crate:...
use crate::{Key, linux_common}; use super::{ffi, Context, Error, KeyInfo, PlatformError}; use std::{thread, time::Duration, os::raw::{c_int, c_uint}}; fn key_event(ctx: &Context, key: Key, down: bool) -> Result<(), Error> { unsafe { let key_code = (linux_common::to_key_code(key) + 8) as c_uint; let...
use std::{ sync::atomic::{AtomicUsize, Ordering}, time::{Duration, Instant}, fmt, hash::{Hash, Hasher}, }; use { dom::UpdateScreen, app_resources::AppResources, }; /// Should a daemon terminate or not - used to remove active daemons #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum Terminat...
use kernel::hil::led::Led; use kernel::process::{Error, ProcessId}; use kernel::syscall::{CommandReturn, SyscallDriver}; use kernel::{debug, ErrorCode}; use kernel::hil::time::{Alarm, AlarmClient, ConvertTicks}; use kernel::grant::Grant; use kernel::processbuffer::{ReadOnlyProcessBuffer, ReadableProcessBuffer}; use cor...
/*! PE headers. */ use std::slice; use std::ops::Range; use super::Pe; use super::image::*; /// Describes the PE headers. #[derive(Copy, Clone)] pub struct Headers<P> { pe: P, } impl<'a, P: Pe<'a>> Headers<P> { pub(crate) fn new(pe: P) -> Headers<P> { Headers { pe } } /// Gets the PE instance. pub fn pe(&se...
#[macro_use] extern crate sirka; use std::path::Path; use std::io::{BufReader,Read}; use std::fs::File; use sirka::*; static USAGE: &'static str = "usage: search <indexdir> <term>"; fn create_reader(dirname: &Path, filename: &str) -> BufReader<File> { let path = dirname.join(Path::new(filename)); let reader ...
//! # Smart Leds //! //! Smart leds is a collection of crates to use smart leds on embedded devices with rust. //! //! Examples of smart leds include the popular WS2812 (also called Neopixel), //! APA102 (DotStar) and other leds, which can be individually adressed. //! //! Other driver crates implement these indivdual ...
use anyhow::anyhow; use std::fmt::{self, Display, Formatter}; #[derive(Debug, Clone, PartialEq, Eq)] pub struct Program { pub instructions: Vec<Instruction>, pub instruction_ptr: i64, } pub const REGISTERY_SIZE: usize = 4; pub type Registers = [i64; 4]; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum V...
extern crate clap; extern crate pwhash; extern crate termios; extern crate users; use clap::{App, Arg}; use std::error; use std::fmt; use std::fs::File; use std::io::{self, BufRead, BufReader, Write}; use std::path::Path; use termios::{tcsetattr, Termios}; #[derive(Debug)] enum Error { Io(io::Error), PwHash(p...
extern crate raster; use std; use raster::Color; use geometric::Geometric2D; use geometric::Point2D; /// Represents a 2D Circle #[derive(Debug)] pub struct Circle2D { /// Radius of the Circle pub r: f64, /// Center-Point of the Circle pub m: Point2D } impl Circle2D { /// Returns a Circle with gi...
// Copyright (C) 2022 <NAME> <<EMAIL>> // This file is subject to the terms and conditions defined in // file 'LICENSE', which is part of this source code package. #![deny(future_incompatible)] #![deny(nonstandard_style)] #![deny(missing_docs)] #![deny(rustdoc::broken_intra_doc_links)] //! tokio-process-stream is a s...
use crate::auth::Auth; use crate::common::UdpStream; use crate::inbound::{Inbound, InboundAccept, InboundRequest}; use crate::outbound::Outbound; use crate::utils::count_stream::CountStream; use anyhow::{anyhow, bail, Context, Error, Result}; use futures::{future::try_select, SinkExt, StreamExt, TryStreamExt}; use log:...
use std::collections::HashMap; use std::process::{Command, Stdio}; use strum::*; use crate::manager::WindowManager; use crate::x::{ core::XConn, event::KeypressEvent, }; use crate::types::Point; use crate::{ToaruError, Result}; //* Re-exports pub mod keysym { pub type KeySym = u32; pub use x11::keysy...
use crate::data::Data; use super::ecs::*; use super::events::*; use super::level::{TileType, Level, EntityGrid}; use super::path::PathFinder; use crate::ai::Ai; use specs::{Entities, Entity, ReadStorage, System, Write, WriteExpect, WriteStorage}; #[derive(Debug, Clone, PartialEq)] pub enum PlayerAction { Move(i32,...
use std::fs::File; use std::io::Read; use indoc::indoc; use ordered_float::OrderedFloat; use std::collections::HashMap; fn main() { let map = get_contents("input"); let (_, maxp) = get_maxnum(&map); let mut positions = get_asteroid_positions(&map); positions.remove(positions.iter().position(|x| *x ...
//! Omit parts of a URL for friendlier display. //! //! This is a Rust port of [shorten-url][]. //! //! See the [shorten][] documentation for usage info. //! //! [shorten-url]: https://github.com/goto-bus-stop/shorten-url //! [shorten]: fn.shorten.html #![deny(future_incompatible)] #![deny(nonstandard_style)] #![deny(r...
extern crate clap; extern crate libpulse_binding as pulse; extern crate ctrlc; use clap::{Arg, App}; use std::rc::Rc; use std::cell::RefCell; use std::ops::Deref; use std::process; use std::boxed::Box; use std::vec::Vec; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use pulse::context::Context; ...
use crate::{ constraint::{ConstraintInfo, ConstraintStoreRef}, crd::Constraint, events::{ConstraintEvent, ConstraintEventData, EventSender}, }; use kube::api::{admission::AdmissionRequest, DynamicObject}; use lazy_static::lazy_static; use prometheus::register_counter_vec; use prometheus::CounterVec; use pyo...
use crate::prelude::*; day!(13, parse => pt1, pt2); pub fn pt1((current_time, bus_lines): &(u64, Vec<Option<u64>>)) -> Result<u64> { bus_lines .iter() .cloned() .filter_map(|x| x) .map(|bus_line| (bus_line, current_time + bus_line - current_time % bus_line)) .min_by_key(|&(...
// pathfinder/renderer/src/scene.rs // // Copyright © 2019 The Pathfinder Project Developers. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may...
pub use super::*; // shader pub struct Shader { pub program_gl_handle: types::GLuint, pub vertex_gl_handle: types::GLuint, pub fragment_gl_handle: types::GLuint, pub vertex_source: String, pub fragment_source: String, /// Store a Rc to the Gl instance to ensure that we can destroy this resource...
use bb8::{Builder as PoolBuilder, Pool}; use tonic::transport::ClientTlsConfig; use crate::{Client, DatabaseId, Error, InstanceId, ProjectId, SessionManager}; use derive_builder::Builder; /// Configuration for building a [`Client`]. /// /// # Example /// /// ```no_run /// use spanner_rs::Config; /// #[tokio::main] //...
use crate::dwarf_data::{DwarfData, Error as DwarfError}; use std::mem::size_of; use nix::sys::ptrace; use nix::sys::signal; use nix::sys::wait::{waitpid, WaitPidFlag, WaitStatus}; use nix::unistd::Pid; use std::process::{Child, Command}; use std::os::unix::process::CommandExt; use nix::sys::stat::stat; use core::num::F...