text
stringlengths
3.09k
13.9k
//! Saha Parser //! //! The parser takes in tokens which have been parsed by the Saha tokenizer, and //! generates a machine readable application structure from them. //! //! First we parse the application outline with class, function, behavior, and //! constant definitions in place. //! //! Then we hop into each class...
use futures::sync::mpsc; use crate::msg; use flatbuffers::FlatBufferBuilder; use crate::js::*; use crate::runtime::Runtime; use crate::utils::*; use libfly::*; use crate::get_next_stream_id; use futures::{Future, Stream}; use crate::cache_store::*; use crate::cache_store_notifier::*; pub fn op_cache_del(rt: &mut ...
use crate::source::SourceCoverage; use crate::source::SourceCoverageLocation; use crate::source::SourceFileCoverage; use anyhow::Context; use anyhow::Error; use anyhow::Result; use std::time::{SystemTime, UNIX_EPOCH}; use xml::writer::{EmitterConfig, XmlEvent}; pub fn cobertura(source_coverage: SourceCoverage) -> Resu...
use std::cell::RefCell; use std::collections::HashMap; use std::fmt::Debug; use std::future::Future; use std::hash::Hash; use std::pin::Pin; use std::rc::Rc; use std::sync::{Arc, Mutex}; use std::task::{Context, Poll, Waker}; use futures::task::ArcWake; struct Task { future: Pin<Box<dyn Future<Output = ()> + 'sta...
// This file is part of Substrate. // Copyright (C) 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 Free S...
use either::Either; use mpstthree::binary::struct_trait::{end::End, recv::Recv, send::Send, session::Session}; use mpstthree::role::end::RoleEnd; use mpstthree::role::Role; use std::error::Error; use rand::{thread_rng, Rng}; use mpstthree::bundle_impl; // Create new roles bundle_impl!(MeshedChannels, A, B, C); // T...
use crate::shared::{ auth::{ account_can_modify_calendar, account_can_modify_user, protect_account_route, Permission, }, usecase::{execute, execute_with_policy, PermissionBoundary, UseCase}, }; use crate::{error::NettuError, shared::auth::protect_route}; use actix_web::{web, HttpResponse}; use nettu...
use crate::error; use futures::{future, Async, Future, Poll}; use rand::{rngs::SmallRng, SeedableRng}; use tower_discover::{Change, Discover}; use tower_load::Load; use tower_ready_cache::{error::Failed, ReadyCache}; use tower_service::Service; use tracing::{debug, trace}; /// Distributes requests across inner service...
use super::*; use ssz::{Decode, DecodeError}; fn get_block_bytes<T: Store<E>, E: EthSpec>( store: &T, root: Hash256, ) -> Result<Option<Vec<u8>>, Error> { store.get_bytes(BeaconBlock::<E>::db_column().into(), &root[..]) } fn read_slot_from_block_bytes(bytes: &[u8]) -> Result<Slot, DecodeError> { let e...
use bytes::{BufMut, BytesMut}; use futures::stream::SplitSink; use futures::Sink; use std::collections::HashMap; use std::net::SocketAddr; use tokio::codec::BytesCodec; use tokio::net::UdpFramed; use crate::actor::prelude::*; use crate::primitives::functions::{try_resend_times, DEFAULT_TIMES}; use crate::traits::actor...
use arc_swap::ArcSwap; use chrono::{Duration, Local}; use hyper; use log; use once_cell::sync::OnceCell; use std::path::PathBuf; use std::sync::Arc; use thiserror::Error; use tokio::sync::broadcast; use tokio::task::{JoinError, JoinHandle}; use tokio::time::timeout; use yup_oauth2::{ self as oauth, authenticato...
use std::collections::HashMap; use std::sync::Arc; use std::sync::{Mutex}; use std::thread; use std::time::Duration; use time; use crate::backend::Backend; use crate::helpers::{TaskProgress, TaskReport}; use crate::models::Service; /// Persists a shared vector of reports to the Task store pub fn mark_done_arc( back...
use chrono::{Datelike, NaiveDate, NaiveDateTime, NaiveTime, Utc}; use rusoto_core::Region; use rusoto_ecr::{ DescribeImagesRequest, DescribeRepositoriesRequest, Ecr, EcrClient, ImageDetail, Repository, }; use std::{ error::Error, io::{stdout, Error as IoError, Write}, }; use structopt::StructOpt; use tabwri...
/* MIT License Copyright (c) 2021 <NAME> 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, including without limitation the rights to use, copy, modify, merge, publish, distrib...
/// Tests the following for each test file: /// /// - Reads file to string. /// - Parse file for `Isf`. /// - Generate GLSL for `Isf`. /// - Merge generated GLSL with original GLSL. /// - Attempt to compile merged GLSL to SPIR-V. /// /// Run with `cargo test -- --nocapture` to print result to command line. #[test] fn t...
use std::fs::File; use std::io::{self, BufWriter}; use std::path::{Path, PathBuf}; use std::sync::Arc; use std::time::Duration; use failure::{Fail, ResultExt}; use futures::{future, future::Either, Future}; use sentry::configure_scope; use sentry::integrations::failure::capture_fail; use symbolic::common::{Arch, ByteV...
// Copyright 2020 <NAME> // SPDX-License-Identifier: Apache-2.0 use crate::{ config::RestApiConfig, filters::CustomRejection::{BadRequest, ServiceUnavailable}, handlers::{BodyInner, SuccessBody}, storage::StorageBackend, types::*, NetworkId, }; use bee_message::prelude::*; use bee_pow::provide...
use atomic::Atomic; use evdev::raw::input_event; use input::{InputDeviceState, InputEvent}; use std; use std::sync::atomic::{AtomicU16, Ordering}; use framebuffer::cgmath; use framebuffer::common::{DISPLAYHEIGHT, DISPLAYWIDTH, WACOMHEIGHT, WACOMWIDTH}; const WACOM_HSCALAR: f32 = (DISPLAYWIDTH as f32) / (WACOMWIDTH as...
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ file_format::{ FieldDefinition, IdentifierIndex, ModuleHandleIndex, SignatureToken, StructDefinition, StructFieldInformation, StructHandle, StructHandleIndex, TableIndex, TypeSignature, }, propte...
extern crate reqwest; extern crate regex; extern crate chrono; use std::env; use std::collections::{HashMap, HashSet}; use std::sync::Mutex; use reqwest::Client; use chrono::prelude::*; struct Record { timestamp: DateTime<Utc>, arrival_times: String } /// Allows for instance-level timestamp. Acts as defau...
use darling::FromMeta; #[derive(Clone, Debug)] pub(crate) struct Document(mongodb::bson::Document); impl FromMeta for Document { fn from_string(value: &str) -> darling::Result<Self> { println!("{value:#?}"); let value = serde_json::from_str(value); match value { Ok(document) =>...
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR MIT use anyhow::Result; use std::ffi::OsString; use std::path::Path; use std::process::Command; use crate::session::KaniSession; use crate::util::alter_extension; use kani_metadata::{InternedString, TraitD...
use crate::errors::ApplicationErrors; use super::AcceptedType; use super::parts; use crate::ResultApp; use std::fmt; use std::path; use std::sync::Arc; use std::collections::HashMap; #[derive(Clone)] pub struct Mapping{ components: Vec<parts::Parts>, identificador: String, prefixes: Arc<HashMap<String, St...
//! The renderer refers to the set of dynamic scripts used to describe //! information about the worldstate by rendering it to HTML. //! //! For example, when the user accesses a URL like `/10/people?i=foobar`, //! the server would do the following: //! //! - Load a Lua function (call it `f`) from the file `render/pe...
// Copyright (C) 2021 <NAME> <<EMAIL>> // SPDX-License-Identifier: MIT OR Apache-2.0 //! Tests client performance against a mock server. use std::{io::ErrorKind, net::SocketAddr, num::NonZeroU32}; use bytes::Bytes; use criterion::{criterion_group, criterion_main, Criterion, Throughput}; use futures::StreamExt; use r...
use std::borrow::Cow; use std::ffi::{CStr, CString}; use std::marker::PhantomData; use std::mem; use ::libc::c_void; /// Types of ports. #[derive(Debug,PartialEq,Eq,Clone,Copy,Hash)] pub enum PortType { /// Serial port. Serial, /// USB port. USB, /// Disk or local mountpoint. Disk, /// ...
use std::ffi::OsStr; use std::io::{Read, Write}; use std::os::unix::ffi::OsStrExt; use std::path::{Path, PathBuf}; use std::time::Duration; use byteorder::{LittleEndian, NativeEndian, ReadBytesExt, WriteBytesExt}; use protobuf::Message; use unix_socket::UnixStream; pub use error::{AesmError, Error, Result}; use { ...
use binary_heap_plus::*; /* At an airport you have a timetable for arrivals and departures. You need to determine the minimum number of gates you'd need to provide so that all the planes can be placed at a gate as per their schedule. The arrival and departure times for each plane are presented in two arrays, sorted b...
//! [DVR]-related definitions and implementations. //! //! [DVR]: https://en.wikipedia.org/wiki/Digital_video_recorder use std::{ ffi::OsString, io, path::{Path, PathBuf}, time::SystemTime, }; use anyhow::anyhow; use ephyr_log::log; use futures::{future, TryFutureExt as _, TryStreamExt as _}; use once...
use failure::{Error, ResultExt}; use std::path::PathBuf; use toml::Value; #[derive(Debug, Clone)] pub struct Config { pub manifest_path: PathBuf, pub default_target: Option<String>, pub output: Option<PathBuf>, pub bootloader: BootloaderConfig, pub minimum_image_size: Option<u64>, pub run_comma...
use std::{collections::HashMap, env, fs, str, path::Path, process::Command}; use rust_util::util_os; use rust_util::util_env; use crate::{local_util, tool, misc::VERBOSE}; use plist::Value; const PATH: &str = "PATH"; const JAVA_HOME: &str = "JAVA_HOME"; const OPENJDK_MACOS: &str = "openjdk-osx"; const JDK_LINUX: &str...
use anyhow::Result; use quote::{format_ident, quote}; use std::{fs::OpenOptions, io::Write, path::Path}; use crate::{ memory::{ExternalMemoryMap, InternalMemoryMap, MemoryConfiguration}, port::{Port, Subfamily}, }; use super::prettify_file; /// Generates the `memory_map.rs` module, containing a description o...
use std::convert::TryFrom; use std::io::Read; use std::mem::size_of; use bytes::{Bytes, BytesMut}; use thiserror::Error; use crate::object::{ObjectHeader, ObjectKind}; use crate::parse; #[derive(Debug, Error)] pub(in crate::object::database::packed) enum DeltaError { #[error("the delta header is invalid")] I...
use std::convert::TryInto; use std::env; use std::io; use std::thread; use std::time::Duration; use espresso::commands::requests; use espresso::types::{ConnectionStatus, MultiplexingType, WifiMode}; use no_std_net::{Ipv4Addr, SocketAddr, SocketAddrV4}; use serialport::{DataBits, FlowControl, Parity, SerialPortSettings...
use std::cmp::max; use std::ops::{AddAssign, RangeInclusive}; const INPUT: &str = include_str!("../input/day17.txt"); pub(crate) fn day17_part1() -> isize { Probe::from(INPUT).highest_point() } pub(crate) fn day17_part2() -> usize { Probe::from(INPUT).trajectory_count() } #[derive(Debug, PartialEq)] struct ...
use std::process::Command; use std::thread::sleep; use std::time::Duration; use libc::{_exit, kill, pause, prctl, sigemptyset, sigset_t, sigwait, write, STDOUT_FILENO}; use nix::sys::signal::{ sigaction, SaFlags, SigAction, SigHandler, SigSet, Signal, SIGCHLD, SIGCONT, SIGSTOP, SIGUSR1, }; use std::ffi::c_void; u...
use std::path::Path; use std::fs::File; use std::io::{BufReader, BufRead}; use std::cmp::Ordering; mod tests; #[derive(Debug, PartialEq, Eq)] enum Operator { Add, Sub, Mul, Div, } impl Ord for Operator { fn cmp(&self, other: &Self) -> Ordering { match self { Operator::Add => m...
#![cfg(test)] use crate::merkletree::MerkleTree; use std::collections::hash_map::DefaultHasher; use std::hash::{Hash, Hasher}; fn hash_value<T>(value: T) -> u64 where T: Hash, { let mut hasher = DefaultHasher::new(); value.hash(&mut hasher); return hasher.finish(); } #[test] fn test_from_str_vec() { ...
use std::cmp::Ordering; use std::str::FromStr; use bigdecimal::BigDecimal; use rocket::futures::{stream, StreamExt}; use crate::cache::cache_operations::RequestCached; use crate::common::models::backend::balances_v2::Balance as BalanceDto; use crate::common::models::backend::balances_v2::TokenPrice as BackendTokenPri...
//! Text input (demonstrates two-way data binding) use std::ops::Range; use azul_core::{ dom::{Dom, EventFilter, FocusEventFilter, TabIndex}, window::{KeyboardState, VirtualKeyCode}, callbacks::{Ref, Redraw, DefaultCallbackInfo, DefaultCallback, CallbackReturn}, }; #[derive(Debug, Clone, Hash, PartialEq, ...
use crate::boards::idx_coord::BoardCoord; use crate::boards::{board_cols, board_rows}; use crate::constants::colors::{ BROWN, CREAM, LIGHT_BLUE, LIGHT_GRAY, PIECE_COMPUTER, PIECE_HUMAN, RED, WHITE, }; use crate::constants::Direction; use crate::senet::rules::{HOUSE_BEAUTY, HOUSE_HAPPINESS, HOUSE_REBIRTH, HOUSE_WATE...
use super::delay_buffer::DelayBuffer; use super::flags; /// A list of position counter values that trigger a "start drawing" signal for /// player sprites. Indexes are values of NUSIZx registers, masked with /// `flags::NUSIZX_PLAYER_MASK`. const PLAYER_OFFSETS: [&[i32]; 8] = [ &[156], &[156, 12], &[156, 2...
extern crate rand; use sdl2::pixels::Color; use sdl2::event::Event; use sdl2::rect::Point; use std::time::Duration; use rand::Rng; #[derive(Clone, Copy)] struct Quaternion { a: f64, b: f64, c: f64, d: f64, } impl Quaternion { fn from_v3([x, y, z]: [f64; 3]) -> Quaternion { Self { ...
use crate::{PARAM_DELIMITER, PARAM_VALUE_DELIMITER, VALUE_DELIMITER}; use parser::ical::component::{ IcalAlarm, IcalCalendar, IcalEvent, IcalFreeBusy, IcalJournal, IcalTimeZone, IcalTimeZoneTransition, IcalTodo, }; use property::Property; /// /// Emits the content of the Component in ical-format. /// pub trait...
use super::chance; use nannou::prelude::*; #[derive(Debug, Clone)] pub struct GravitationalBody { pub mass: f32, pub x: f32, pub y: f32, } impl GravitationalBody { pub fn new(mass: f32, x: f32, y: f32) -> Self { Self { mass, x, y } } // Simple generator with some usable defaults pub fn generate() -...
use serde::{Deserialize, Serialize}; use serde_big_array::big_array; use std::convert::TryFrom; pub type Digest256Bits = [u8; 32]; pub type Digest512Bits = [u8; 64]; big_array! { BigArray; } #[derive(Serialize, Deserialize, Clone)] pub enum Digest { Digest256Bits(Digest256Bits), #[serde(with = "BigArray")] ...
use std::io::BufRead; mod one { use core::borrow::Borrow; use core::convert::{TryFrom, TryInto}; use core::ops::Add; use core::ops::Mul; use core::str::FromStr; use std::collections::HashSet; #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub struct Vec2d(pub i32, pub i32); impl Vec2d { pub fn manhatt...
use std::collections::HashMap; use std::path::Path; use serde::{Deserialize, Deserializer}; use yaml_rust::Yaml; use crate::reference::Reference; use crate::templates::{ComposeService, ComposeServiceMap}; use crate::volumes::VolumeInitializer; use snafu::{ResultExt, Snafu}; #[derive(Debug, Snafu)] pub enum Error { ...
use crate::data_source_builders::{DataSourceFactory, NullDataSourceBuilder}; use crate::data_store_builders::{DataStoreFactory, InMemoryDataStoreBuilder}; use crate::events::processor_builders::{ EventProcessorBuilder, EventProcessorFactory, NullEventProcessorBuilder, }; use crate::{ServiceEndpointsBuilder, Streami...
use std::ops::Range; use super::utf8_input_text::Utf8InputText; use crate::dic::category_type::{CategoryType, CategoryTypes}; use crate::dic::grammar::Grammar; /// Builder of Uuf8InputText /// /// This handles modifications of the original text pub struct Utf8InputTextBuilder<'a> { grammar: &'a Grammar<'a>, /...
//! # Header Block //! //! [slack api docs 🔗] //! //! A header is a plain-text block that displays in a larger, bold font. //! //! Use it to delineate between different groups of content in your app's surfaces. //! //! [slack api docs 🔗]: https://api.slack.com/reference/block-kit/blocks#header use std::borrow::Cow; ...
use anyhow::Result; use std::result::Result as StdResult; type BingoNumber = u8; struct BingoField { number: BingoNumber, marked: bool, } impl From<BingoNumber> for BingoField { fn from(number: BingoNumber) -> Self { Self { number, marked: false, } } } impl st...
use num_traits::Bounded; use std::fmt::Debug; #[cfg(feature = "serde_support")] use serde::{Deserialize, Serialize}; /// Represents an enum that can contain unsafe values. /// /// These are enums which may potentially be used as indices, offsets, or used in some other /// calculation. This wrapper type exists since t...
use std::convert::AsRef; use std::ffi::CString; use std::fmt; use std::path::Path; use std::thread::{self, ThreadId}; use anyhow::anyhow; use liblumen_llvm as llvm; use liblumen_llvm::enums::{CodeGenOptLevel, CodeGenOptSize}; use liblumen_llvm::target::{TargetMachine, TargetMachineRef}; use liblumen_llvm::utils::{Mem...
use diesel::prelude::*; use malvolio::prelude::*; use mercutio::Apply; use portia::form::{FormStyle, FormSubmitInputStyle, FormTextInputStyle}; use rocket::response::Redirect; use rocket::serde::json::Json; use thiserror::Error as ThisError; use crate::utils::default_head; use crate::utils::error_messages::database_er...
use std::{ collections::HashMap, ops::Deref, sync::{Arc, Mutex}, }; use graphql_parser::{ query::{Definition, Document, FragmentDefinition, SelectionSet, VariableDefinition}, schema::Directive, }; use crate::{error::GqlError, Variables}; #[derive(Debug)] pub struct OperationInner<'a> { pub op...
pub use crate::encoding::envelope::Envelope; pub use crate::encoding::EwpError; pub fn unmarshal(msg: &[u8]) -> Result<Envelope,EwpError> { let index = msg.iter().position(|&r| r == '\n' as u8); let index = index.ok_or( EwpError::new("message request must contain 2 lines") )?; let hdr = &msg[0..index]; ...
use std; use std::cmp::max; use { Buffer2d, Packer, Rect, }; struct Skyline { pub x: u32, pub y: u32, pub w: u32, } pub struct SkylinePacker<B: Buffer2d> { buf: B, width: u32, height: u32, skylines: Vec<Skyline>, margin: u32, } impl<B: Buffer2d> SkylinePacker<B> { f...
use memchr::memchr; use std::borrow::Cow; use std::io; use std::str; pub use crate::core::{QualRecordPosition, SeqRecordPosition}; pub trait BaseRecord { /// Return the header line of the record as byte slice fn head(&self) -> &[u8]; /// Return the record sequence as byte slice. With FASTA and multi-line...
use pixels::{Error, Pixels, SurfaceTexture}; use rand::prelude::*; use winit::{ dpi::LogicalSize, event::{Event, WindowEvent}, event_loop::{ControlFlow, EventLoop}, window::WindowBuilder, }; fn main() -> Result<(), Error> { println!("Random start: {}", random::<i32>()); let width = 400; let...
#[cfg(test)] #[macro_use] extern crate log; #[macro_use] extern crate serial_test; use std::sync::Arc; use bytes::Bytes; use test_case::test_case; use tchannel_rs::handler::{HandlerResult, RequestHandler}; use tchannel_rs::messages::MessageChannel; use tchannel_rs::messages::RawMessage; use tchannel_rs::Config; use ...
#![allow(clippy::if_same_then_else)] use std::env; use std::path::PathBuf; macro_rules! cargo { ($value:expr) => { println!("cargo:{}", $value) } } macro_rules! warning { ($message:expr) => { cargo!(format!("warning={}", $message)); }; ($message:expr $(, $extra:expr)*) => { ...
use std::{env, fs}; use std::path::Path; use std::process::Command; use std::time::Duration; use clap::{App, arg}; use directories_next::ProjectDirs; use rpg_compiler::{Config}; use rpg_compiler::user_output::CompileError; use simple_colors::{blue, green}; use spinner::{SpinnerHandle, SpinnerBuilder}; use spinners::uti...
//! ArcDPS exports. use crate::{api::CoreColor, game::Profession}; use arcdps::{ e0 as e0_config_path, e5 as e5_colors, e6 as e6_ui_settings, e7 as e7_modifiers, imgui::sys::ImVec4, }; use std::{ffi::OsString, mem::MaybeUninit, os::windows::prelude::*, path::PathBuf, slice}; /// Retrieves the config path from...
#[doc = "Reader of register IDR"] pub type R = crate::R<u32, super::IDR>; #[doc = "Reader of field `IDR15`"] pub type IDR15_R = crate::R<bool, bool>; #[doc = "Reader of field `IDR14`"] pub type IDR14_R = crate::R<bool, bool>; #[doc = "Reader of field `IDR13`"] pub type IDR13_R = crate::R<bool, bool>; #[doc = "Reader of...
//! Implementierung für das derive-Macro des EnumArgument-Traits. use std::fmt::{self, Display, Formatter}; use proc_macro2::TokenStream; use quote::quote; use syn::{parse2, Attribute, Data, DataEnum, DeriveInput, Fields, Ident, Variant}; use crate::utility::{ crate_name, split_klammer_argumente, Argument, Argum...
//! A simple status bar use crate::{ client::Client, data_types::{Region, WinId}, draw::{Color, Draw, DrawContext, Widget, WindowType}, hooks::Hook, Result, WindowManager, }; /// The position of a status bar #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum Position { /// Top of the screen ...
use anyhow::{Context, Error}; use reqwest::{Body, Client}; use serde::Deserialize; use std::borrow::Cow; use std::collections::HashMap; use std::io::Write; use std::marker::PhantomData; use std::sync::Arc; use url::Url; pub enum New {} pub enum Complete {} pub enum Timestamp { Now, } pub enum Value<'a> { Flo...
/* this pass changes certain operations to only take atoms (literals or variables) as their operands i.e. (+ 2 (+ 2 2)) will be change to let [tmp.0 (+ 2 2)] (+ 2 tmp.0) */ #[cfg(test)] mod decomplify_tests; use crate::types::{IdString}; use super::ast::{AstNode, LetBinding, Progra...
use artichoke_core::value::Value as ValueLike; use std::convert::TryFrom; use std::iter::Iterator; use std::str::FromStr; use crate::convert::{Convert, TryConvert}; use crate::sys; use crate::types::Int; use crate::value::Value; use crate::Artichoke; #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)] pub enum Error<'...
use std::{cell::RefCell, collections::HashMap}; use itertools::Itertools; #[derive(Debug, PartialEq, Eq, Clone, Copy)] pub enum Param { Number(i64), Variable(char), } #[derive(Debug, PartialEq, Eq, Clone, Copy)] pub enum Expr { Input(char), Add(char, Param), Mul(char, Param), Div(char, Param)...
use crate::{ error::{PromError, PromErrorKind, Result}, label::{valid_metric_name, Label}, }; use std::{borrow::Cow, fmt}; pub struct RegistryBuilder { inputs: Option<Vec<Box<dyn Collectable + Send + Sync>>>, } impl RegistryBuilder { pub fn new() -> Self { Self { inputs: None } } pub ...
// Copyright (c) 2021 <NAME> and WormieCorp. // Licensed under the MIT license. See LICENSE.txt file in the project #[cfg(feature = "serialize")] use serde::{Deserialize, Serialize}; use url::Url; /// The type or location of the license for the packaged software. #[derive(Debug, PartialEq)] #[cfg_attr(feature = "seri...
use crate::cfg::global::setup::{GlobalProjectSetupCfg, SetupName}; use crate::cfg::SetupsCfg; use anyhow::{Context, Result}; use serde::de::{MapAccess, Visitor}; use serde::export::Formatter; use serde::ser::SerializeMap; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::cell::RefCell; use std::fm...
use chrono::{NaiveDateTime, Duration}; use linked_list::LinkedList; use bit_vec::BitVec; use timer::Timer; use std::cmp; // todo: get it working one way or another // add tests to cover all kinds of stuff on insert, remove and expire // add benchmarks // refactor until happy pub struct TimerWheel<'a, T: 'a> { las...
// Copyright 2021 <NAME> <<EMAIL>> <<EMAIL>> use std::{ env, io, path::{Component, Path, PathBuf, StripPrefixError}, }; use dirs; use thiserror::Error; #[derive(Debug, Error)] pub enum Error { #[error("Could not find user's home directory.")] CouldNotFindHome, #[error("Could not find current direc...
//! A simple implementation of a persistent list //! following along with <https://rust-unofficial.github.io/too-many-lists/third.html> #![warn(missing_docs)] use std::rc::Rc; // ------------------- Core data structure and List API ---------------------------------- /// A PersistentList cannot be changed - addin...
/* Copyright 2020 <NAME> 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, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, ...
use chrono::{NaiveDateTime, Timelike}; use std::collections::HashMap; use std::ops::Range; pub struct Record { id: u32, time_intervals: Vec<Range<u32>>, } #[aoc_generator(day4)] pub fn input_generator(input: &str) -> Vec<Record> { // Record example // [1518-11-01 00:00] Guard #10 begins shift // [...
use std::f32; use super::*; // -------------------------------------------------------------------------------------------------------------------------------------------------- // Public data types // --------------------------------------------------------------------------------------------------------------------...
use std::fs::File; use std::io::BufReader; use serde::{Deserialize, Serialize}; use serde_yaml::Value; use crate::cli::Args; /// Contains all the configuration parameters #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Config { // General pub instance_path: String, pub solution_path: Option<St...
use logging::PruneLogger; use w_arenas::PathCount; use super::*; pub trait PPFactory { type ProgressBar: StyledProgressBar; fn new_progress_bar(&self, len: u64) -> Self::ProgressBar; } /// A trait allowing for flexibility for the user to choose what underlying ProgressBar they want to /// use. In essence, t...
use std::fmt; use std::str; use chrono::NaiveDateTime; use diesel::prelude::*; use crate::api::errors::{ApiAvroErrorCode, ApiError}; use super::schema::*; use super::Subject; #[derive(Debug, Identifiable, Queryable, Associations, Serialize)] #[table_name = "configs"] #[belongs_to(Subject)] pub struct Config { p...
//! This crate provides a zero-allocation, iterator/slice-based parser for extracting HTTP //! [content encoding](https://tools.ietf.org/html/rfc7231#section-3.1.2) types as they //! appear in the `Content-Encoding` request header. [Standard //! encodings](http://www.iana.org/assignments/http-parameters/http-parameters...
// You can run this example on different databases (Docker files provided in // the repository root). // Select the database by compiling this example with the corresponding feature: // * sqlite and barrel-sqlite // * mysql and barrel-mysql // Also make sure that the correct type DbBackend is uncommented, see below. //...
use crate::{Operator, Result, Token}; #[derive(Debug, PartialEq)] pub struct ParseProgress<'a, T> { pub tail: &'a str, pub token: Option<T>, } pub type ParseResult<'a, T> = Result<ParseProgress<'a, T>>; impl<'a, T> ParseProgress<'a, T> { fn none(tail: &'a str) -> ParseResult<'a, T> { Ok(ParseProg...
use std::{mem::size_of, sync::Arc}; use crate::{SmolStr, TextUnit, SyntaxKind}; /// Internal node in the immutable tree. /// It has other nodes and tokens as children. #[derive(Debug, Clone)] pub struct GreenNode { kind: SyntaxKind, text_len: TextUnit, //TODO: implement llvm::trailing_objects trick ch...
use atsamd_hal::{ delay::Delay, gpio::v2::{Pin, PushPullOutput, PA04, PA10, PA11}, prelude::_atsamd_hal_embedded_hal_digital_v2_OutputPin, }; use embedded_hal::digital::v2::PinState; use utils::time::{Microseconds, U32Ext}; use crate::settings::{DT_MIN_U32, STEPS_PER_RESOLUTION_I16, STEPS_PER_RESOLUTION_I1...
use cosmwasm_std::{ from_binary, to_binary, CanonicalAddr, CosmosMsg, Decimal, DepsMut, Env, MessageInfo, Order, Response, Uint128, WasmMsg, }; use cosmwasm_storage::{ReadonlyBucket, ReadonlySingleton}; use cw20::Cw20ReceiveMsg; use pylon_token::gov_msg::{ AirdropMsg, Cw20HookMsg, ExecuteMsg, InstantiateMsg...
use std::collections::HashSet; use proc_macro2::{TokenStream as Tokens, Span}; use syn::{Data, DeriveInput, Fields, DataEnum, Ident}; use quote::quote; pub fn derive(input: &DeriveInput) -> Tokens { let name = &input.ident; let generics = super::add_trait_bounds( input.generics.clone(), &HashS...
use std::fs::File; use std::path::Path; use indicatif::ProgressStyle; use crate::{ canvas::Canvas, light::{self, LightProps}, }; pub(crate) fn create_file(filepath: &str) -> File { let path = Path::new(filepath); let display = path.display(); match File::create(&path) { Err(why) => panic...
use reqwest::blocking::Client; use reqwest::StatusCode; use scraper::{Html, Selector, ElementRef}; use chrono::NaiveDate; use regex::Regex; use std::thread::sleep; use std::time::Duration; use std::error::Error; use crate::tagger::{Track, MusicPlatform, TrackMatcher, AudioFileInfo, TaggerConfig, MatchingUtils, Tr...
use crate::csv; use anyhow::Result; use regex::Regex; use std::cmp::min; use std::sync::{Arc, Mutex, MutexGuard}; use std::thread::{self}; use std::time::Instant; pub struct Finder { internal: Arc<Mutex<FinderInternalState>>, cursor: Option<usize>, row_hint: usize, target: Regex, } #[derive(Clone, Deb...
use wasmer::wasmparser::Operator; use wasmer::{ FunctionMiddleware, LocalFunctionIndex, MiddlewareError, MiddlewareReaderState, ModuleMiddleware, }; /// A middleware that ensures only deterministic operations are used (i.e. no floats) #[derive(Debug)] pub struct Deterministic {} impl Deterministic { pub f...
use proc_macro2::TokenStream; use quote::{quote, ToTokens}; use syn::parse::{Parse, ParseStream}; use syn::{ Attribute, Block, FnArg, GenericParam, Generics, Ident, Item, ItemFn, Result, ReturnType, Type, Visibility, }; pub struct ComponentFunctionName { pub component_name: Ident, pub generics: Generic...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00..0x08 - Cluster GPIO_QSPI%s, containing GPIO_QSPI_*_STATUS, GPIO_QSPI_*_CTRL"] pub gpio_qspisclk: GPIO_QSPI, #[doc = "0x08..0x10 - Cluster GPIO_QSPI%s, containing GPIO_QSPI_*_STATUS, GPIO_QSPI_*_CTRL"] pub gpio_qspiss: GPIO_Q...
use super::Error; use crate::prelude::*; use core::fmt; use super::{ dfs, CPUSource, ClockControlConfig, FastRTCSource, SlowRTCSource, CLOCK_CONTROL, CLOCK_CONTROL_MUTEX, }; impl<'a> super::ClockControlConfig { // All the single word reads of frequencies and sources are thread and interrupt safe // as...
use crate::commands::WholeStreamCommand; use crate::prelude::*; use indexmap::set::IndexSet; use log::trace; use nu_errors::ShellError; use nu_protocol::{ did_you_mean, ColumnPath, PathMember, Primitive, ReturnSuccess, ReturnValue, Signature, SyntaxShape, UnspannedPathMember, UntaggedValue, Value, }; use nu_sou...
//! Adds support for capturing Sentry errors from `failure` types. //! //! Failure errors and `Fail` objects can be logged with the failure integration. //! This works really well if you use the `failure::Error` type or if you have //! `failure::Fail` objects that use the failure context internally to gain a //! backtr...
#[derive(Copy, Clone)] #[repr(u8)] pub enum KeyCode { None = 0x00, Delete = 0x07, Backspace = 0x08, Tab = 0x09, Enter = 0x0d, Caps = 0x10, Shift = 0x11, Control = 0x12, Menu = 0x13, Alt = 0x14, Escape = 0x1b, Space = 0x20, ArrowLeft = 0x21, ArrowUp = 0x22, ArrowRight = 0x23, ArrowDo...