text
stringlengths
3.09k
13.9k
use std::{collections::HashMap, str::Split}; use crate::input; pub fn run() { let contents = input::get_lines("day05"); let part1 = h_v_overlaps(&contents); println!("part1: {:?}", part1); let part2 = h_v_d_overlaps(&contents); println!("part2: {:?}", part2); } type Coordinates = HashMap<(u32...
use crate::sha1::Sha1Hash; macro_rules! bloom_filter { ($ty:ident, $size:expr) => { pub struct $ty { bits: [u8; $size], } impl Default for $ty { fn default() -> Self { Self::new() } } impl $ty { pub fn new() -...
//! # Algorithms used with CMS. //! Algorithms OIDs and parameter data types. use rasn::prelude::*; use rasn_pkix::AlgorithmIdentifier; pub const SHA1: ConstOid = Oid::ISO_IDENTIFIED_ORGANISATION_OIW_SECSIG_ALGORITHM_SHA1; pub const MD5: ConstOid = Oid::ISO_MEMBER_BODY_US_RSADSI_DIGEST_ALGORITHM_MD5; pub const DSA: ...
//! A crate for handling the references stored in various formats in a git repository. //! //! References are also called _refs_ which are used interchangeably. //! //! Refs are the way to keep track of objects and come in two flavors. //! //! * symbolic refs are pointing to another reference //! * peeled refs point to...
use aead::{ consts::{U15, U16, U17, U32, U48}, generic_array::{ArrayLength, GenericArray}, }; use crate::DeoxysBcType; const H_PERM: [u8; 16] = [1, 6, 11, 12, 5, 10, 15, 0, 9, 14, 3, 4, 13, 2, 7, 8]; macro_rules! gen_rcon { ($value:expr) => { [ 1, 2, 4, 8, $value, $value, $value, $val...
use super::ModuleKind; use crate::{ error::{ArgumentError, InternalError}, models, }; use enum_dispatch::enum_dispatch; pub trait FromDbRows: Sized { fn from_db_rows(rows: &[models::ModuleSetting]) -> anyhow::Result<Self>; } #[enum_dispatch] pub trait Settings { fn get_all(&self) -> Vec<(&'static str,...
use crate::Mount; use std::collections::hash_map::HashMap; /// Common HTTP Methods /// /// If a method is needed, which is not specified here, /// `Method::UNKNOWN(String)` can be used #[derive(Debug, PartialEq)] pub enum Method { GET, POST, PUT, PATCH, DELETE, UNKNOWN(String), } /// Represent...
use std::ops::Deref; use std::sync::Arc; use std::rc::Rc; use failure::Fail; use vec1::Vec1; use mail::Context; use ::resource::{EmbeddedWithCId, InspectEmbeddedResources}; use ::builder_extension::BodyPart; /// This trait needs to be implemented for creating mails based on templates. /// /// As there are many ways...
use log::LevelFilter; use std::sync::atomic::{AtomicBool, Ordering}; use crate::dialogs::msg_box_ok; pub(crate) static SHOULD_ENABLE_PANIC_HOOK: AtomicBool = AtomicBool::new(false); pub(crate) fn set_up_logging(log_file_path: Option<&str>, log_level: LevelFilter) { use fern::InitError; use std::error::Error;...
//! Implements the wasi-nn API. use crate::ctx::{ExecutionContext, WasiNnResult as Result}; use crate::witx::types::{ ExecutionTarget, Graph, GraphBuilderArray, GraphEncoding, GraphExecutionContext, Tensor, TensorType, }; use crate::witx::wasi_ephemeral_nn::WasiEphemeralNn; use crate::WasiNnCtx; use openvino::{...
// This file is part of Substrate. // Copyright (C) 2019-2021 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the F...
use std::io::{Error, ErrorKind, Read, Write}; use std::io::Result; use byteorder::{NetworkEndian, ReadBytesExt, WriteBytesExt}; use crate::sequencing::{sequence_greater_than, sequence_less_than, SequenceBuffer, SequenceNumber}; #[derive(Clone, Default)] struct Message { data: Box<[u8]>, sequence_number: Vec<Se...
use crate::render_resource::{ BindGroup, BindGroupLayout, Buffer, ComputePipeline, RawRenderPipelineDescriptor, RenderPipeline, Sampler, Texture, }; use futures_lite::future; use std::sync::Arc; use wgpu::util::DeviceExt; use super::RenderQueue; /// This GPU device is responsible for the creation of most rend...
#![allow(clippy::rc_buffer)] use crate::error::Error; use crate::ext::ustr::UStr; use crate::sqlite::connection::ConnectionHandle; use crate::sqlite::statement::{StatementHandle, StatementWorker}; use crate::sqlite::{SqliteColumn, SqliteError, SqliteRow, SqliteValue}; use crate::HashMap; use bytes::{Buf, Bytes}; use l...
#![allow(unused_variables)] #![allow(unused_must_use)] extern crate sciter; use sciter::{Value, Element, HELEMENT}; use sciter::dom::event::*; #[derive(Default)] struct Handler { progress: Option<Element>, state: bool, } impl sciter::EventHandler for Handler { fn get_subscription(&mut self) -> Option<EVENT_GROU...
// Take a look at the license at the top of the repository in the LICENSE file. use std::marker::PhantomData; use crate::ffi::cairo_user_data_key_t; pub struct UserDataKey<T> { pub(crate) ffi: cairo_user_data_key_t, marker: PhantomData<*const T>, } unsafe impl<T> Sync for UserDataKey<T> {} impl<T> UserData...
use std::collections::HashMap; use crate::dot::{font_tag, html_escape, DotGraph}; use bevy::{ reflect::TypeRegistration, render::render_graph::{Edge, NodeId, RenderGraph}, }; use itertools::{EitherOrBoth, Itertools}; /// Formats the render graph into a dot graph. pub fn render_graph_dot(graph: &RenderGraph) -...
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. use crate::deno_dir; use crate::errors::DenoResult; use crate::flags; use crate::global_timer::GlobalTimer; use crate::ops; use crate::permissions::DenoPermissions; use crate::resources; use crate::resources::ResourceId; use crate::worker::Worke...
use crate::project_context::{BuildEnv, Context}; use crate::recipe::rust::DOCKER_IMAGE; use crate::signal::Signal; use crate::util::DockerCommand; use anyhow::{anyhow, Result}; use ckb_tool::ckb_hash::new_blake2b; use include_dir::{include_dir, Dir, DirEntry}; use lazy_static::lazy_static; use serde::Serialize; use std...
// run-pass // aux-build:mir_external_refs.rs extern crate mir_external_refs as ext; struct S(u8); #[derive(Debug, PartialEq, Eq)] struct Unit; impl S { fn hey() -> u8 { 42 } fn hey2(&self) -> u8 { 44 } } trait X { fn hoy(&self) -> u8 { 43 } fn hoy2() -> u8 { 45 } } trait F<U> { fn f(self, othe...
use std::fs::File; use std::io::prelude::*; #[derive(Debug, Copy, Clone, PartialEq, Eq)] enum Action { North(i32), South(i32), East(i32), West(i32), Left(i32), Right(i32), Forward(i32), } impl From<&str> for Action { fn from(value: &str) -> Action { let (action, value) = value.s...
#![deny( missing_docs, missing_debug_implementations, missing_copy_implementations, elided_lifetimes_in_paths, rust_2018_idioms, clippy::fallible_impl_from, clippy::missing_const_for_fn )] #![doc(html_logo_url = "https://avatars0.githubusercontent.com/u/55122894")] //! Allo Isolate //! Run ...
use crate::completions::{ file_completions::file_path_completion, Completer, CompletionOptions, MatchAlgorithm, SortBy, }; use nu_parser::{unescape_unquote_string, FlatShape}; use nu_protocol::{ engine::{EngineState, StateWorkingSet}, Span, }; use reedline::Suggestion; use std::sync::Arc; pub struct Comman...
use std::io; use std::io::{Read, Write}; use std::os::unix::io::{AsRawFd, RawFd}; use async_io::Async; use log::*; pub const SIOCGIFMTU: libc::c_ulong = 0x8921; pub const _SIOCGIFINDEX: libc::c_ulong = 0x8933; pub const _ETH_P_ALL: libc::c_short = 0x0003; pub const TUNSETIFF: libc::c_ulong = 0x400454CA; pub const _IF...
use async_recursion::async_recursion; use dashmap::DashMap; use futures::future::join_all; use serde::Deserialize; use std::collections::HashMap; use std::sync::Arc; use std::{env, fs}; use tokio::process::Command; use toml; mod autocorrection; mod out; #[derive(Deserialize, Debug)] struct CommandConfig { uses: O...
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { anyhow::{format_err, Error}, fidl::endpoints::DiscoverableService, fidl_fuchsia_inspect::TreeMarker, fidl_fuchsia_inspect_deprecated:...
//! Contains the `jobs`, `disown`, `bg`, and `fg` commands that manage job //! control in the shell. use shell::Shell; use shell::job_control::{JobControl, ProcessState}; use shell::signals; use shell::status::*; /// Disowns given process job IDs, and optionally marks jobs to not receive SIGHUP signals. /// The `-a` ...
// Copyright 2017 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. //! System service for wireless networking #![deny(missing_docs)] #![recursion_limit = "256"] mod device; mod device_watch; mod future_util; mod inspect;...
// Copyright 2020-2021 the Deno authors. All rights reserved. MIT license. use super::Context; use super::LintRule; use swc_ecmascript::visit::noop_visit_type; use swc_ecmascript::{ ast::*, utils::find_ids, utils::ident::IdentLike, utils::Id, visit::Node, visit::Visit, visit::VisitWith, }; use std::collections::Ha...
use crate::{region::Region, GuestError, GuestPtr}; use std::mem; /// A trait for types which are used to report errors. Each type used in the /// first result position of an interface function is used, by convention, to /// indicate whether the function was successful and subsequent results are valid, /// or whether a...
use crate::actors::envelope::{ManagerLetter, ManagerLetterWithResponder}; use crate::actors::manager::{ActorManagerProxyCommand, ActorsManager, Manager}; use crate::actors::proxy::ActorReport; use crate::system_director::SystemDirector; use crate::{Actor, Receive, Respond}; use async_channel::{bounded as channel, Sende...
use super::core::CoordinateError; use super::service::CoordinatorConfig; use crate::common::response; use crate::common::track::TrackedFutureRegistry; use crate::common::utils::resolve_first_address; use crate::protocol::{Array, BulkStr, Resp, RespPacket, RespVec}; use crate::proxy::command::{new_command_pair, CmdType,...
use { super::*, crate::object::*, alloc::sync::Arc, core::convert::TryInto, kernel_hal::serial_write, kernel_hal::timer_now, spin::Mutex, }; static DLOG: Mutex<DlogBuffer> = Mutex::new(DlogBuffer::new()); #[cfg(not(test))] const DLOG_SIZE: usize = 128usize * 1024usize; #[cfg(test)] const DLOG_SIZE: usize = 2u...
use crate::{ active_clipmap_lod_chunks, Array3x1, ChunkMap3, ChunkedOctreeSet, ClipMapConfig3, ClipMapUpdate3, GetMut, IterChunkKeys, LodChunkKey3, LodChunkUpdate3, OctreeSet, SmallKeyHashMap, }; use building_blocks_core::prelude::*; use serde::{Deserialize, Serialize}; /// A `ChunkedOctreeSet` that inde...
//! Support function for communicating with cargo's variables and outputs. #![allow(dead_code)] use std::fmt::{Display, Formatter}; use std::path::{Path, PathBuf}; use std::{env, fmt, fs, io}; pub fn warning(warn: impl AsRef<str>) { println!("cargo:warning={}", warn.as_ref()); } pub fn output_directory() -> Pat...
mod filter; mod r#impl; mod web3_types; mod ws_subscription; use std::sync::Arc; use jsonrpsee::http_server::{HttpServerBuilder, HttpServerHandle}; use jsonrpsee::ws_server::{WsServerBuilder, WsServerHandle}; use jsonrpsee::{core::Error, proc_macros::rpc}; use common_config_parser::types::Config; use protocol::trait...
use amethyst::assets::{AssetStorage, Loader}; use amethyst::core::cgmath::{Vector3, Matrix4}; use amethyst::core::transform::{GlobalTransform, Transform}; use amethyst::ecs::prelude::{Component, DenseVecStorage}; use amethyst::input::{is_close_requested, is_key_down}; use amethyst::prelude::*; use amethyst::renderer::{...
use ::log::{Level, LevelFilter, Metadata, Record}; use esp_idf_sys::*; use crate::private::common::*; use crate::private::cstr::*; #[allow(non_upper_case_globals)] impl From<Newtype<esp_log_level_t>> for LevelFilter { fn from(level: Newtype<esp_log_level_t>) -> Self { match level.0 { esp_log_...
use anyhow::Result; use futures::executor::block_on; use futures::future::RemoteHandle; use hogan::config::ConfigDir; use hogan::error::HoganError; use riker::actors::*; use riker_patterns::ask; use std::collections::hash_map::HashMap; use std::sync::Arc; use std::time::Duration; use std::time::SystemTime; use uuid::Uu...
#![deny(warnings)] #![allow(unused_imports)] #![allow(unused_variables)] #![allow(dead_code)] use std::sync; use std::sync::{Arc, Mutex, MutexGuard, RwLock}; use std::sync::atomic::AtomicUsize; use hyper::{Body, http, Method, Request, Response, Server, StatusCode}; use hyper::body::Bytes; use hyper::http::header; use...
#[macro_use] extern crate lazy_static; use std::collections::HashSet; use std::env; use std::fs::File; use std::io::Read; use std::io::{BufRead, Write}; use std::net::TcpStream; use std::path::{Path, PathBuf}; use std::str::FromStr; use std::sync::{Arc, RwLock}; use std::{io, net::SocketAddr, time::Duration}; use fut...
use std::{fmt::Display, num::NonZeroU32, time::Duration}; use serde::{Deserialize, Serialize}; use typed_builder::TypedBuilder; use super::{ errors::GenericB2Error, AccountId, ApiUrl, ApplicationKey, ApplicationKeyId, ApplicationKeyIdRef, AuthorizationToken, BucketId, Capabilities, FileNamePrefix, JsonErrorOb...
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ use crate::signer::{OperationSigningConfig, RequestConfig, SigV4Signer, SigningError}; use aws_auth::{Credentials, CredentialsError, CredentialsProvider}; use smithy_http::middleware::MapRequest; use sm...
#![feature(used)] #![no_std] extern crate cortex_m; extern crate cortex_m_rt; extern crate stm32f30x_hal as hal; extern crate ls010b7dh01; extern crate panic_abort; extern crate embedded_graphics as graphics; use cortex_m::asm; use hal::prelude::*; use hal::spi::Spi; use hal::stm32f30x; use hal::delay::Delay; use ls01...
/*! This crate provides a range of [mutators](fuzzcheck_traits::Mutator) that can be used to run structure-aware fuzz tests using the [fuzzcheck](https://github.com/loiclec/fuzzcheck-rs) crate. It also provides the [DefaultMutator] trait, which assigns a default mutator to a type: ``` use fuzzcheck::DefaultMutator; let...
/// Base common denominator across all the mesh implementations used. pub trait Meshify { fn new() -> Self; fn with( indices: Vec<u32>, positions: Vec<[f32; 3]>, normals: Vec<[f32; 3]>, uvs: Vec<[f32; 2]>, ) -> Self; fn get_indices(&self) -> &Vec<u32>; fn get_normals(&self) -> &Vec<[f32; 3]>; ...
use super::{Body, HttpClient, Request, Response}; use futures::future::BoxFuture; use futures::prelude::*; use std::io; use std::pin::Pin; use std::task::{Context, Poll}; /// WebAssembly HTTP Client. #[derive(Debug)] pub struct WasmClient { _priv: (), } impl WasmClient { /// Create a new instance. pub f...
//! Custom wrapper for Command that supports timeouts and contains custom error handling. use crate::{error::CommandError, TmcError}; use std::io::Read; use std::time::Duration; use std::{ffi::OsStr, thread::JoinHandle}; use std::{fs::File, io::Write}; pub use subprocess::ExitStatus; use subprocess::{Exec, PopenError,...
use std::fmt; /// Content-Range, described in [RFC7233](https://tools.ietf.org/html/rfc7233#section-4.2) /// /// # ABNF /// /// ```text /// Content-Range = byte-content-range /// / other-content-range /// /// byte-content-range = bytes-unit SP /// ( byte-range-resp / un...
// Copyright (c) 2021 CRUK Cambridge Institute - Bioinformatics Core // Licensed under the MIT license (http://opensource.org/licenses/MIT). // This file may not be copied, modified, or distributed except according // to those terms. //! Sample a specified number of records from a FASTQ file. use anyhow::{ensure, Co...
use crate::{ core::Driver, Consumer, Executor, Folder, ParallelExtend, ParallelIterator, Reducer, Setup, WithSetup, }; /* Unzip */ pub struct Unzip<X> { iterator: X, } impl<X> Unzip<X> { pub fn new(iterator: X) -> Self { Self { iterator } } } impl<'a, X, P, T> Driver<'a, P, T> for Unzip<...
use super::*; use crate::resources::{ModificationTracker, PhysicsHooksWithWorld, PhysicsHooksWithWorldInstance}; use hecs::{Added, Without, World}; use std::mem::take; pub fn prepare_step(world: &mut World, modification_tracker: &mut ModificationTracker) { modification_tracker.detect_removals(world); modificat...
use std::{env, path::PathBuf}; const LIVE2D_CUBISM: &str = "LIVE2D_CUBISM"; const STATIC: &str = "static"; fn main() { if cfg!(feature = "doc") { return; } let cubism_dir = env::var(LIVE2D_CUBISM).unwrap_or_else(|_| { panic!( "The environment variable `{0}` is not set properly...
use crate::nice; use hex_literal::hex; use serde::{Deserialize, Serialize}; use std::fmt; use std::str::FromStr; use web3::types::{H160, U256}; #[derive(Debug, Clone, Serialize, Deserialize)] pub enum ActionSignature { Transfer, // transfer which is invalid InvalidTransfer, UnknownSignature, } #[deriv...
use crate::arg::TypeMismatchError; use std::ffi::CString; use std::{ptr, fmt}; use crate::{arg, to_c_str, c_str_to_slice, init_dbus, Message}; use crate::strings::ErrorName; use std::error::Error as stdError; /// D-Bus Error wrapper. /// /// This is a wrapper around the libc dbus error object. pub struct Error { e...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Hibernate Domain Status Register"] pub hdstat: HDSTAT, #[doc = "0x04 - Hibernate Domain Status Clear Register"] pub hdclr: HDCLR, #[doc = "0x08 - Hibernate Domain Status Set Register"] pub hdset: HDSET, #[doc = ...
use crate::options::cargo_errors::Args; use cargo_log_parser::parse_errors; use failure::{bail, format_err, Error, ResultExt}; use log::{error, info, warn}; use shared::{Api, MappedIndex}; use std::{ ffi::OsString, fs, io::{self, Read, Write}, path::Path, process::{Command, Stdio}, }; pub fn execut...
//! A generic lossy LRU cache use fnv::FnvHasher; use std::fmt::Debug; use std::hash::{Hash, Hasher}; use util::*; // if the LRU is GROW_RATIO% full, it will double in size on insertion const GROW_RATIO : f64 = 0.7; #[derive(Debug, PartialEq, Clone)] pub struct ApplyCacheStats { pub lookup_count: usize, pub ...
// Copyright 2018-2021 Cargill Incorporated // // 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...
#![deny(clippy::all)] #![warn(clippy::pedantic)] use ansi_term::Colour::Green; use ansi_term::Style; use std::borrow::Cow; use std::collections::btree_map::Entry::{Occupied, Vacant}; use std::collections::{BTreeMap, BTreeSet}; use std::io; use std::path::PathBuf; use std::process::exit; use structopt::StructOpt; fn g...
use super::super::super::common_rpc_types::StructuredLog; use super::super::types::{DBConnection, Log, LogQueryParams, OrderBy}; use postgres::types::ToSql; use std::borrow::Borrow; use std::rc::Rc; pub fn insert(conn: &DBConnection, node_name: &str, logs: Vec<StructuredLog>) -> postgres::Result<()> { ctrace!("Add...
#![allow(unused)] extern crate void; use serde::ser::{Serializer, SerializeStruct}; use std::error::Error; use std::fmt; use std::marker::PhantomData; use std::str::FromStr; use serde::{Deserialize, Serialize, Deserializer}; use serde::de::{self, Visitor, MapAccess}; use void::Void; use std::rc::Rc; use std::any::...
mod uploads; pub mod network; use std::process::exit; use std::mem; use std::time::Duration; use abstract_ns::Name; use failure::{Error, ResultExt}; use structopt::StructOpt; use ciruela::blocks::ThreadedBlockReader; use ciruela::index::InMemoryIndexes; use ciruela::cluster::Config; use keys::read_keys; use global_...
// 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::{ container::{ComponentIdentity, ReadSnapshot, SnapshotData}, inspect::collector::{InspectData, InspectDataCollector}, ...
use crate::switch::ToCKBCellDataTuple; use crate::utils::{ config::{PLEDGE, SIGNER_FEE_RATE, SUDT_CODE_HASH, XT_CELL_CAPACITY}, tools::{is_XT_typescript, verify_btc_witness, XChainKind}, types::{mint_xt_witness::MintXTWitnessReader, Error, ToCKBCellDataView, XExtraView}, }; use ckb_std::{ ckb_constants:...
use crate::config::Committee; use crate::core::MempoolMessage; use crate::error::{MempoolError, MempoolResult}; use bytes::Bytes; use consensus::{Block, ConsensusMessage, RoundNumber}; use crypto::Hash as _; use crypto::{Digest, PublicKey}; use futures::future::try_join_all; use futures::stream::futures_unordered::Futu...
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy // SPDX-License-Identifier: Apache-2.0 use std::{ mem::{self, size_of}, ptr, }; use winapi::{ ctypes::wchar_t, shared::{ hidusage::{HID_USAGE_GENERIC_KEYBOARD, HID_USAGE_GENERIC_MOUSE, HID_USAGE_PAGE_GENERIC}, minwindef::{TRUE, UINT...
// Copyright 2021 Datafuse Labs. // // 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 std::io::{Read, Write}; use crate::{CodePair, Color, DxfResult}; use crate::code_pair_put_back::CodePairPutBack; use crate::code_pair_writer::CodePairWriter; #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))] pub struct SectionGeometrySettings { pub section_...
#![feature(llvm_asm)] extern crate event; extern crate netutils; extern crate syscall; use std::cell::RefCell; use std::{env, process}; use std::fs::File; use std::io::{ErrorKind, Read, Result, Write}; use std::os::unix::io::{AsRawFd, FromRawFd, RawFd}; use std::sync::Arc; use event::EventQueue; use syscall::{CloneF...
#![no_main] #![no_std] extern crate panic_semihosting; use cortex_m::peripheral::syst::SystClkSource; use cortex_m_rt::{entry, exception}; use softsynth::{Adsr, Oscillator, Sound, MAX_VOL, RATE}; use stm32f1xx_hal::prelude::*; use stm32f1xx_hal::{gpio, pwm, stm32}; struct PwmSoundCard<Pwm1, Pwm2> { pwm1: Pwm1, ...
use crate::CommonWidgetImpl; use crate::cursor::MouseCursor; use crate::draw::{Dimension, Position}; use crate::environment::Environment; use crate::event::{MouseEvent, MouseEventHandler, OtherEventHandler, WidgetEvent}; use crate::layout::Layout; use crate::state::{F64State, LocalState, State}; use crate::widget::{Com...
// // Copyright 2022 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...
#[macro_use] mod utils; use utils::task::JoinHandleExt; mod cli; mod config; use config::Config; mod logic; mod service; use service::Service; use std::sync::{Arc, Mutex}; use anyhow::{Context, Result}; use dbus::channel::MatchingReceiver; use dbus::message::MatchRule; use dbus_tokio::connection; use dbus_cross...
use std::borrow::Cow; use std::collections::HashMap; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; use lazy_static::lazy_static; use crate::keymap::KeyMap; use crate::modes::{ mode::{Mode, ModeTransition}, normal::Normal, }; use crate::operations as ops; use crate::selection::Direction; use ...
use core::{cmp, ptr}; use core::borrow::{Borrow, BorrowMut}; /// A mediocre buffer that allows for block access without extra copies but memmoves more than /// necessary. /// /// wpos points to the first byte that can be written rpos points at the next byte that can be read /// /// invariants: 0 <= rpos <= wpos <= dat...
use crate::cshadow; use crate::host::context::{ThreadContext, ThreadContextObjs}; use crate::host::descriptor::{CompatDescriptor, DescriptorFlags, FileStatus, PosixFile}; use crate::host::syscall; use crate::host::syscall_types::SyscallResult; use crate::host::syscall_types::{SysCallArgs, SysCallReg}; use log::*; use n...
#![allow(non_snake_case, non_upper_case_globals)] #![allow(non_camel_case_types)] //! GPIOA //! //! Used by: stm32mp153, stm32mp157 #[cfg(not(feature = "nosync"))] pub use crate::stm32mp::peripherals::gpioa::Instance; pub use crate::stm32mp::peripherals::gpioa::{RegisterBlock, ResetValues}; pub use crate::stm32mp::per...
pub use self::config_reader::*; pub use self::flag_reader::*; use native::zcsi::RteFdirConf; use std::fmt; use interface::{FlowSteeringMode, NetSpec}; mod config_reader; mod flag_reader; #[derive(Clone)] /// `NetBricks` control configuration. In theory all applications create one of these, either through the use of /...
use crate::alert::*; use crate::connection::*; use crate::handshake::ServerHandshake; use crate::key_schedule::KeySchedule; use crate::record::{ClientRecord, ServerRecord}; use crate::traits::{Read, Write}; use rand_core::{CryptoRng, RngCore}; use crate::application_data::ApplicationData; use heapless::spsc::Queue; p...
use anyhow::Result; use reqwest::header::{HeaderMap, HeaderValue, CONTENT_TYPE, USER_AGENT}; use serde::Deserialize; use std::env; use crate::authenticators::base::{ResponseType, TokenResponse, Configs}; const GRANT_TYPE: &str = "urn:ibm:params:oauth:grant-type:apikey"; #[derive(Deserialize, Debug, Clone)] pub struct...
//! The loader module functions are used to load an instance. use crate::{backend::RunnableModule, module::ModuleInfo, types::Type, types::Value, vm::Ctx}; #[cfg(unix)] use libc::{mmap, mprotect, munmap, MAP_ANON, MAP_PRIVATE, PROT_EXEC, PROT_READ, PROT_WRITE}; use std::{ fmt::Debug, ops::{Deref, DerefMut}, }; ...
use super::*; use tags::*; #[derive(Debug)] /// Reference classic binary heap #[no_binding] pub struct DijkstraQueue<'a> { /// This is the actual heap, it contains the node_ids and are ordered based on /// self.distances[id] heap: Vec<usize>, /// The distance of every node in the graph distances: ...
/* * Copyright 2018-2021 TON Labs 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 IS" BASIS, * WITH...
use crate::cache::messagemeta::MessageMeta; use rusqlite::{params, Connection}; use std::collections::{HashMap, HashSet}; use std::path::{Path, PathBuf}; pub struct Db { dbpath: PathBuf, } impl Db { fn init_db(path: &Path) -> Result<(), String> { let conn = Connection::open(path) .map_err(...
use crate::{ color::Color, math::{vec2, Rect, Vec2}, ui::{ElementState, Id, Layout, Ui}, }; pub struct ComboBox<'a, 'b, 'c> { id: Id, label: &'a str, variants: &'b [&'c str], } impl<'a, 'b, 'c> ComboBox<'a, 'b, 'c> { pub fn new(id: Id, variants: &'b [&'c str]) -> ComboBox<'a, 'b, 'c> { ...
use std::str::FromStr; use anchor_lang::prelude::*; declare_id!("3rTQ3R4B2PxZrAyx7EUefySPgZY8RhJf16cZajbmrzp8"); #[program] pub mod example_program { use super::*; pub fn initialize(ctx: Context<Initialize>) -> Result<()> { ctx.accounts.state.set_inner(State::default()); Ok(()) } pu...
#[cfg(not(feature = "std"))] use crate::simulate_std::prelude::*; use derivative; use crate::pb::msg; // 不需要实现 Display,因为后面一定会跟 Text #[derive(Default, Debug, Clone)] pub struct MarketFace { pub name: String, pub face_id: Vec<u8>, pub tab_id: i32, pub item_type: i32, pub sub_type: i32, pub medi...
// All Rust equivalents of the protobuf files in /tests/files/proto are kept here. // Used for testing, we often use only a subset of these types per test. // Hence, lots of dead code warnings, disable at crate level. #![allow(dead_code)] #[derive(Debug, PartialEq, Default, ::twpb_derive::Message)] pub struct SimpleTy...
use fxhash::FxHashMap; use std::borrow::Cow; use std::fmt; use std::lazy::SyncLazy; use std::num::NonZeroU32; use std::sync::{Arc, Mutex}; static ID: SyncLazy<Arc<Mutex<IdentifierTable>>> = SyncLazy::new(|| Arc::new(Mutex::new(IdentifierTable::new()))); #[derive(Clone, Copy, PartialEq, Eq)] pub struct IdentId(Non...
mod args; mod clock; mod error; mod master; mod publisher; mod simtime; mod slave; mod subscriber; mod topic; pub use args::NodeArgs; use master::Master; use slave::Slave; use std::sync::Arc; use tokio::sync::Mutex; pub use self::{error::SubscriptionError, publisher::Publisher, subscriber::Subscriber}; pub use crate...
use crate::builtins::make_builtins_once; use crate::evaluator::eval_from_stack; use crate::printer::print_from_stack; use crate::reader::{read, ReaderError}; use crate::stack::{self, StackOverflowError}; use std::io::prelude::*; use std::{convert, io}; const PROMPT: &[u8] = b"phoebe> "; #[derive(Fail, Debug)] pub enu...
// Generated from definition com.github.openshift.api.build.v1.BuildTriggerPolicy /// BuildTriggerPolicy describes a policy for a single trigger that results in a new Build. #[derive(Clone, Debug, Default, PartialEq)] pub struct BuildTriggerPolicy { /// BitbucketWebHook contains the parameters for a Bitbucket webh...
extern crate bitstream; use std::io::{Read, Write}; use std::io::Result as IOResult; use std::io::Error as IOError; use std::io::ErrorKind as IOErrorKind; use std::usize; use bitstream::{BitWriter, BitReader}; mod util; use util::{LZWDict, LZWDictEntry, LZWSearchTreeNode, BitSizeEnumerator, BitIndex}; pub struct L...
/* Copyright <NAME>. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ //! Oberon allows endpoints to issue multi-factor capable tokens to consumers //! who can prove their validity with disclosing the tokens themselves without requiring //! email, SMS, or authenticator apps. Endpoints //! only need t...
use nix::sys::ptrace; use nix::sys::signal; use nix::sys::wait::{waitpid, WaitPidFlag, WaitStatus}; use nix::unistd::Pid; use std::process::Child; use std::process::Command; use std::os::unix::process::CommandExt; use std::io; use crate::dwarf_data::{DwarfData, /*Error as DwarfError*/}; use std::mem::size_of; use std::...
// SPDX-FileCopyrightText: 2021 Lutris Engineering, Inc // SPDX-License-Identifier: BlueOak-1.0.0 OR BSD-2-Clause-Patent // SPDX-FileContributor: <NAME> <<EMAIL>> use std::{collections::HashSet, hash::Hash}; use crate::{ builtin_idents, storage::Storage, AttributeIterator, Connection, Datom, DatomType, Entity...
pub mod utils; mod audio; use wasm_bindgen::prelude::*; // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global // allocator. #[cfg(feature = "wee_alloc")] #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; #[wasm_bindgen] #[repr(u8)] #[derive(Clone, Copy, Debug, Par...
use crate::blocks::BlockHash; use crate::encoding::{blake2b, blake2b_callback}; use crate::pow::difficulty::Difficulty; use crate::{hexify, Public}; use bytes::Buf; use rand::RngCore; use std::convert::TryFrom; use std::fmt::Debug; #[derive(Debug)] pub enum Subject { Hash(BlockHash), Public(Public), } impl Su...
use super::*; use crate::error::{Error, Result}; use serde::{Deserialize, Serialize}; use std::default::Default; /// "Enum" validator that selects a validator based on the value's enum variant. /// /// This validator expects a serialized Rust enum. A serialized enum consists of either a single /// string (a unit varia...