text
stringlengths
3.09k
13.9k
use crate::common::cluster::{MigrationTaskMeta, Range, RangeList, RangeMap}; use crate::common::utils::{generate_slot, get_resp_bytes, get_resp_strings, ThreadSafe}; use crate::protocol::{Array, BinSafeStr, BulkStr, RedisClientError, Resp, RespSlice, RespVec}; use crate::proxy::backend::CmdTask; use crate::proxy::block...
// Copyright 2018 Developers of the Rand project. // Copyright 2013 The Rust Project Developers. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This fil...
use crate::{command, config, currency::Currency, db, module, prelude::*, stream_info, utils}; use chrono::{DateTime, Utc}; use parking_lot::RwLock; use std::sync::Arc; #[derive(Clone)] pub struct Reward { user: String, amount: i64, } pub struct Handler { enabled: Arc<RwLock<bool>>, cooldo...
//! This is an echo server that returns all incoming bytes, without framing. It is used for the tests in //! ws_stream_wasm. // #![ feature( async_closure ) ] // mod error; mod server; mod user; // use error::*; use server::*; use user::*; mod import { pub(crate) use { async_runtime :: { rt ...
// 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. //! # Building the JSON data model from parsed dictionaries. //! //! Use [model_from_dictionaries] to build a parsed data model for internationalized //! m...
use crate::core::ribosome::CallContext; use crate::core::ribosome::HostFnAccess; use crate::core::ribosome::RibosomeT; use holochain_types::prelude::*; use holochain_wasmer_host::prelude::WasmError; use std::sync::Arc; use futures::future::join_all; use holochain_p2p::HolochainP2pCellT; pub fn call_remote( _riboso...
//! The asynchronous implementation of a websocket server. use bytes::BytesMut; use futures; use futures::{Future, Stream}; use server::upgrade::async::{IntoWs, Upgrade}; use server::InvalidConnection; use server::{NoTlsAcceptor, OptionalTlsAcceptor, WsServer}; use std; use std::io; use std::net::SocketAddr; use std::n...
//! Alacritty - The GPU Enhanced Terminal. #![warn(rust_2018_idioms, future_incompatible)] #![deny(clippy::all, clippy::if_not_else, clippy::enum_glob_use)] #![cfg_attr(feature = "cargo-clippy", deny(warnings))] // With the default subsystem, 'console', windows creates an additional console // window for the program. ...
use crate::font::FontSize; use crate::theme::Theme; use crate::widgets::{color_for_recognition_step_index, color_for_step_index, solve_time_string}; use egui::{Pos2, Rect, Ui, Vec2}; use tpscube_core::{AnalysisStepSummary, AnalysisSubstepTime}; const MIN_GRAPH_WIDTH: f32 = 200.0; pub struct TimerPostAnalysis { st...
#![feature(iterator_fold_self)] #![feature(entry_insert)] use clap::clap_app; mod day1; mod day10; mod day11; mod day12; mod day13; mod day14; mod day15; mod day16; mod day17; mod day18; mod day19; mod day2; mod day20; mod day21; mod day22; mod day23; mod day24; mod day25; mod day3; mod day4; mod day5; mod day6; mod da...
use super::{Instance, InstanceRef}; use crate::vmcontext::{VMMemoryDefinition, VMTableDefinition}; use crate::VMOffsets; use std::alloc::{self, Layout}; use std::convert::TryFrom; use std::mem; use std::ptr::{self, NonNull}; use wasmer_types::entity::EntityRef; use wasmer_types::{LocalMemoryIndex, LocalTableIndex, Modu...
use crate::client::TimeoutSettings; use crate::client_table::TableServiceChannelPool; use crate::errors::*; use crate::grpc::grpc_read_operation_result; use crate::session::Session; use async_trait::async_trait; use std::collections::vec_deque::VecDeque; use std::ops::{Add, Sub}; use std::sync::{Arc, Mutex, Weak}; use ...
// Copyright 2016 <NAME>. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. // // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARR...
/* main.rs: The main file of the RLisp Interpreter. Use with Commandline-Argument: argument is interpreted as filename and try to load it Use without Commandline-Argument: Read-Eval-Print Loop is executed , User can input commands line by line */ // hook in submodules (Defines module-structure) mod env; mod eval; mod...
// Copyright 2019 Parity Technologies (UK) Ltd. // // 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, ...
use std::str::FromStr; fn main() { let input = include_str!("../../input/day04.txt"); let result = input .split("\n\n") .map(|x| x.parse::<Passport>()) .filter(|x| match x { Ok(v) => v.is_valid(), Err(_) => false, }) .count(); println!("{:?}...
use std::env; use std::fs::File; use std::io::prelude::*; use std::process; use std::time::Instant; use arrow::datatypes::{DataType, Field, Schema}; use arrow::record_batch::RecordBatch; extern crate ballista; use ballista::cluster; use ballista::dataframe::{max, min, sum, Context, DataFrame, CSV_BATCH_SIZE}; use ba...
use super::{CartridgeReadTarget, Mapper, Mirroring}; const CHR_MODE_MASK: u8 = 0b10000; const PRG_MODE_MASK: u8 = 0b01100; pub struct Mapper001 { prg_banks: u8, prg_bank_selector_32: u8, prg_bank_selector_16_lo: u8, prg_bank_selector_16_hi: u8, chr_bank_selector_8: u8, chr_bank_selector_4_lo: ...
use core::f64; use nalgebra::DMatrix; use rand::thread_rng; use rand_distr::{Distribution, Normal}; use std::{collections::HashMap, usize}; struct VolatilitySimulation { num_days: usize, daily_volatility: f64, } impl VolatilitySimulation { fn new(num_days: usize, daily_volatility: f64) -> Self { V...
use std::collections::BTreeMap; use std::io::Error; use crate::cli::Database; use crate::mysql::get_table_columns; type DbName = String; type TableName = String; type Column = String; #[derive(Debug)] pub struct DbStore { dbs: BTreeMap<DbName, TableStore>, db_params: Database, } #[derive(Debug)] pub struct T...
use futures::channel::mpsc::Sender; use futures::prelude::*; use std::any::Any; use std::collections::VecDeque; use std::sync::{Arc, Mutex}; use crate::runtime::buffer::vulkan::BufferEmpty; use crate::runtime::buffer::vulkan::BufferFull; use crate::runtime::buffer::BufferBuilder; use crate::runtime::buffer::BufferRead...
#[derive(Clone, PartialEq, ::prost::Message)] pub struct ApplyRequest { /// Diff is the descriptor of the diff to be extracted #[prost(message, optional, tag = "1")] pub diff: ::core::option::Option<super::super::super::types::Descriptor>, #[prost(message, repeated, tag = "2")] pub mounts: ::prost::...
use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] pub struct LegSecondaryAssetGrp { /// NoLegSecondaryAssetClasses #[serde(skip_serializing_if = "Option::is_none")] #[serde(rename = "2076")] pub leg_secondary_asset_classes: Option<fix_common::RepeatingValues<...
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
extern crate bit_vec; //extern crate rand; //use rand::Rng; //use rand::prelude::*; use rand::thread_rng; use rand::Rng; use bit_vec::BitVec; pub type IndexT= u64; #[derive(Debug)] pub struct BloomFilter{ pub hashes:IndexT, pub size:IndexT, pub count:IndexT, //pub table:&'a IndexT pub table:bit_vec...
use std::iter::Iterator; use std::ops::{Add, Deref, DerefMut, BitOr, BitAnd, Not}; use std::str::FromStr; use std::fmt::Display; use strum_macros::EnumIter; use super::Color; use crate::ChessError; #[repr(u8)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Ord, PartialOrd, EnumIter)] pub enum Square { A1, B1, C...
#![no_std] #![recursion_limit = "1024"] pub use atsamd_hal as hal; #[cfg(feature = "rt")] use cortex_m_rt; #[cfg(feature = "rt")] pub use cortex_m_rt::entry; use hal::prelude::*; use hal::*; pub use hal::common::*; pub use hal::samd51::*; pub use hal::target_device as pac; use gpio::{Floating, Input, Port}; use ha...
#![allow(missing_docs)] use crate::ExitStatus; use getopts::Options; use std::{ path::{Path, PathBuf}, str::FromStr, }; /// Command line arguments. #[derive(Debug)] #[non_exhaustive] pub struct Args { pub list: bool, pub filter: Option<String>, pub filter_exact: bool, pub run_ignored: bool, ...
use super::{ jwt::{self, Algorithm, Header, Key}, Entry, TokenResponse, }; use crate::{ error::{self, Error}, token::{RequestReason, Token, TokenOrRequest, TokenProvider}, }; const GRANT_TYPE: &str = "urn:ietf:params:oauth:grant-type:jwt-bearer"; /// Minimal parts needed from a GCP service acccount ke...
/** * MIT License * * tui-realm - 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, co...
//! Widgets and utilities for making widgets to integrate VIZIA with NIH-plug. //! //! # Note //! //! None of these widgets are finalized, and their sizes or looks can change at any point. Feel free //! to copy the widgets and modify them to your personal taste. use nih_plug::prelude::{GuiContext, Param, ParamPtr}; us...
// Part of the Crubit project, under the Apache License v2.0 with LLVM // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception use proc_macro2::{Span, TokenStream}; use quote::quote; use std::collections::HashMap; use std::env; use std::fs::File; use std::io::Buf...
use core::result::Result; use gw_common::{h256_ext::H256Ext, merkle_utils::calculate_state_checkpoint, state::State, H256}; use gw_state::{ ckb_smt::smt::{Pair, Tree}, kv_state::KVState, }; use gw_types::{ core::ScriptHashType, packed::{ChallengeTarget, L2Transaction, RawL2Block, RollupConfig, ScriptVec...
//! There are few ambigious cases where we can't determine correct //! parsing context having a limited information about the current //! state of tree builder. This caused issues in the past where //! Cloudflare's security features were used as XSS gadgets //! (see <https://portswigger.net/blog/when-security-features-...
// Copyright (c) Microsoft. All rights reserved. use std::collections::HashMap; use std::str; use std::sync::{Arc, Mutex}; use bytes::Bytes; use futures::future::{self, Either}; use futures::{Future, Stream}; use http::Uri; use hyper::header::{HeaderValue, CONTENT_LENGTH, CONTENT_TYPE, IF_MATCH}; use hyper::service::...
use std::collections::LinkedList; use std::io; use std::io::*; use ansi_term::Colour::*; use rand::prelude::*; pub fn print_header() { println!("Treasure Hunter!\n"); println!("Use -h to get extra help"); println!("Use w, a, s, d to move"); println!("Use q to quit"); println!("Collect all the trea...
use std::collections::HashMap; use vlsir::{ circuit::{connection::Stype, port, Connection, ExternalModule, Package, Port, Signal, Slice}, reference::To, Module, QualifiedName, Reference, }; use crate::{save_bin, tech::all_external_modules}; use self::conns::{conn_width, get_conn}; pub fn signal(name: im...
// Copyright 2015 Google Inc. All rights reserved. // // 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, ...
extern crate cab; extern crate chrono; extern crate clap; use cab::{Cabinet, CabinetBuilder, CompressionType, FileEntry, FolderEntry}; use chrono::NaiveDateTime; use clap::{App, Arg, SubCommand}; use std::fs::{self, File}; use std::io; use std::path::PathBuf; use std::time::UNIX_EPOCH; // ============================...
//! A module for the `Components` type. Through a `Components` you can add and remove //! any type that implements `Any` and has no non-static references. //! Should be used through the `World` and not directly. extern crate anymap; use self::anymap::AnyMap; use std::any::{Any, TypeId}; /// This type holds a `Vec<Any...
// console-server.rs use anyhow::anyhow; use log::*; use std::{net::SocketAddr, time}; use structopt::StructOpt; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net; use tokio::sync::{broadcast, mpsc}; use tokio_serial::{self, SerialPortBuilderExt}; use net_serial_console::*; const BUFSZ: usize = 1024; cons...
// Copyright 2020 Google LLC // // Use of this source code is governed by an MIT-style license that can be found // in the LICENSE file or at https://opensource.org/licenses/MIT. //! A handler and associated types for the filesystems action. //! //! The filesystems action lists all mounted filesystems on the client, /...
/*! Small example that shows how to append text to a rich text box with styling */ extern crate native_windows_gui as nwg; extern crate native_windows_derive as nwd; use nwd::NwgUi; use nwg::NativeUi; use std::fs; use std::cell::RefCell; #[derive(Default)] pub struct StyleSection { start: u32, end: u32, ...
use std::collections::HashMap; use std::pin::Pin; use std::time::{Duration, Instant}; use futures::{Stream, StreamExt}; use crate::limit::RateLimiter; use crate::retry::Retry; use crate::types::body::IngestBodyBuffer; use crate::types::client::Client as HttpClient; use crate::types::error::HttpError; use crate::types...
use crate::{ hardware::dac::DacCode, hardware::design_parameters::TIMER_FREQUENCY, }; use core::convert::TryFrom; use miniconf::Miniconf; use serde::Deserialize; /// Types of signals that can be generated. #[derive(Copy, Clone, Debug, Deserialize, Miniconf)] pub enum Signal { Cosine, Square, Triangle, ...
use std::i32; use smallvec::smallvec; use crate::subword::{BucketIndexer, Indexer, IndicesScope, NGramVec, StrWithCharLen}; /// fastText-compatible subword indexer. #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub struct FastTextIndexer { // fastText is inconsistent with types when it comes to buckets, // th...
//! General game objects to which [`Components`](Component) are attached. use super::component::{Component, ComponentManager}; use super::TypeNotFoundError; use crate::snowflake::Snowflake; use crate::util::Result; use std::any; use std::any::TypeId; use std::collections::HashSet; use std::fmt; use std::result; use s...
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
// Copyright Rivtower Technologies LLC. // // 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 ...
// Copyright 2019-2021 Parity Technologies (UK) Ltd. // // 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, mod...
use base64::{decode, encode}; use std::collections::HashMap; use std::str; use conduit::RequestExt; use conduit_middleware::{AfterResult, BeforeResult}; use cookie::{time::Duration, Cookie, Key, SameSite}; use super::RequestCookies; const MAX_AGE_DAYS: i64 = 90; pub struct SessionMiddleware { cookie_name: Strin...
use crate::common::{self, *}; pub type ProgressBar = AMember<AControl<AProgressBar<TestableProgressBar>>>; #[repr(C)] pub struct TestableProgressBar { base: common::TestableControlBase<ProgressBar>, progress: types::Progress, } impl HasProgressInner for TestableProgressBar { fn progress(&self,...
#[macro_use] extern crate serde_derive; extern crate toml; extern crate chan; extern crate chan_signal; use chan_signal::Signal; extern crate clap; use clap::{App, Arg}; extern crate threadpool; use threadpool::ThreadPool; use std::process::{Command, exit, Stdio}; use std::io::{Read, BufRead, BufReader}; use std::...
/* * Copyright (c) 2021 gematik GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
use std::{ fs, io, path::{Path, PathBuf}, }; use crate::api::{ResourceIdentifier, ResourceKind, ResourcePath}; /* dMMMMMMP dMMMMb .aMMMb dMP dMMMMMMP .dMMMb dMP dMP.dMP dMP"dMP amr dMP dMP" VP dMP dMMMMK" dMMMMMP dMP dMP VMMMb dMP dMP"AMF dMP dMP dMP dMP dP .dMP dMP dMP dMP dM...
use anyhow::{anyhow, Result}; use log::info; use prettytable::{color, Attr, Cell, Row, Table}; use serde::{Deserialize, Serialize}; use std::collections::HashSet; use std::{fs, path::Path, path::PathBuf}; use crate::command::hoard_command::{HoardCommand, Parameterized}; use crate::config::HoardConfig; const CARGO_VE...
//! Helper functions to send the kernel data over the serial port. use std::fs; use std::{convert::TryInto, io::prelude::*}; use std::{error::Error, fs::File}; use console::{style, Term}; use dialoguer::{theme::ColorfulTheme, Select}; use indicatif::{ProgressBar, ProgressStyle}; use log::{debug, error, info,...
/// Request message for UI detection. #[derive(Clone, PartialEq, ::prost::Message)] pub struct UiDetectionRequest { /// Required. Required field that represents a PNG image. #[prost(bytes="bytes", tag="1")] pub image_png: ::prost::bytes::Bytes, /// Required. Required field that indicates the detection t...
use core::prelude::*; use core::raw; use core::{ptr, mem}; use core::borrow::IntoCow; use libc::c_void; use jni::{jobject, jclass, jmethodID, JNIEnv}; use jni_constants::{JNI_TRUE, JNI_FALSE}; use android::bitmap::{AndroidBitmap_getInfo, AndroidBitmap_lockPixels, AndroidBitmap_unlockPixels, AndroidBitmapInfo}; use andr...
/* src/mouse/mouseevents.rs Copyright (c) 2019-2021 <NAME> All rights reserved. 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 limitat...
// This file is part of Substrate. // Copyright (C) 2019-2021 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // 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 // // ht...
//! Main entry point to the Julia api. use std::io::Read; use std::ffi::CStr; use sys::*; use error::{Result, Error}; use version::Version; use string::IntoCString; /// This macro checks for exceptions that might have occurred in the sys::* /// functions. Should be used after calling any jl_* function that might th...
use crate::ifaces::get_iface_name_by_index; use crate::Iface; use crate::Ipv4AddrInfo; use crate::Ipv4Info; use crate::Ipv6AddrInfo; use crate::Ipv6Info; use netlink_packet_route::rtnl::address::nlas::Nla::{ Address, CacheInfo, Local, }; use netlink_packet_route::rtnl::AddressMessage; use std::collections::HashMap;...
use crate::backend::DNSBackend; use log::warn; use std::collections::HashMap; use std::fs::{metadata, read_dir, read_to_string}; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; use std::vec::Vec; // Parse configuration files in the given directory. // Configuration files are formatted as follows: // The name of the file w...
mod buffer; mod camera; mod color; mod compute; mod hittable; mod hittable_list; mod material; mod number; mod pixel; mod ray; mod vec3; use crate::buffer::Buffer; use crate::camera::Camera; use crate::color::Color; use crate::compute::Compute; use crate::hittable::{Hittable, Sphere}; use crate::hittable_list::Hittabl...
pub mod tbqueue; pub mod tchan; pub mod tqueue; pub mod tvecdequeue; use crate::StmResult; /// Transactional queue-like structure. /// /// This is a common interface between the various implementations in <NAME> book. pub trait TQueueLike<T>: Clone + Send { /// Pop the head of the queue, or retry until there is a...
// Copyright The pipewire-rs Contributors. // SPDX-License-Identifier: MIT /// Generate `pipewire-rs/pipewire/src/auto/keys.rs` from `pipewire/src/pipewire/keys.h` use std::{ fs::File, io::{BufRead, BufReader, Read}, path::PathBuf, }; use anyhow::Result; use regex::Regex; use structopt::StructOpt; const ...
use crate::{ error::AppError, resources::course::{Course, CourseStatus, Grade}, }; use std::collections::HashMap; fn contains_course_number(str: &str) -> bool { for word in str.split_whitespace() { let course_number = word.parse::<u32>(); match course_number { Ok(number) if 1000...
/* Copyright 2021 Volt 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 Unless required by applicable law or agreed to in writing, software d...
mod fmt; use std::fs; use clap::{ErrorKind, IntoApp, Parser}; use scylla::{Session, SessionBuilder, QueryResult}; use std::io::{Error, Write}; use std::time::Duration; use std::borrow::Cow; use std::fmt::Display; #[derive(Parser, Debug)] #[clap(about = "I am a cqlsh alternative, just pass `-h`")] struct Cli { #[...
//! Backend for Swift use crate::flavored::*; use crate::{Options, EXT}; use backend::PackageProcessor; use core::errors::Result; use core::{Handle, Spanned}; use genco::prelude::*; use genco::tokens::{FormatInto, ItemStr}; use trans::{self, Packages, Translated}; /// Documentation comments. pub(crate) struct Comment...
extern crate cipher_crypt; extern crate clap; use cipher_crypt::{Cipher, ColumnarTransposition, Vigenere}; use clap::{Arg, App}; // // Elonka ciphertext // EMUFPHZLRFAXYUSDJKZLDKRNSHGNFIVJ // YQTQUXQBQVYUVLLTREVJYQTMKYRDMFD // VFPJUDEEHZWETZYVGWHKKQETGFQJNCE // GGWHKK?DQMCPFQZDQMMIAGPFXHQRLG // TIMVMZJANQLVKQEDAGDVF...
use std::{ convert::TryFrom, fmt::{self, Display}, str::FromStr, }; use http::Method; use crate::{error::UnknownVersionError, AuthScheme}; /// Metadata about an API endpoint. #[derive(Clone, Debug)] #[allow(clippy::exhaustive_structs)] pub struct Metadata { /// A human-readable description of the end...
mod binance_all; mod binance_option; mod binance_spot; use std::collections::HashMap; use crypto_market_type::MarketType; use crypto_msg_type::MessageType; use crate::{BboMsg, FundingRateMsg, OrderBookMsg, TradeMsg}; use serde_json::Value; use simple_error::SimpleError; const EXCHANGE_NAME: &str = "binance"; pub(...
// 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 zerocopy::{AsBytes, FromBytes, Unaligned}; #[repr(C, packed)] #[derive(Eq, PartialEq, Hash, AsBytes, FromBytes, Unaligned, Copy, Clone, Debug)] pub st...
// Copyright 2017-2018 <NAME> <<EMAIL>> and collaborators // Licensed under the MIT license. //! The Slurm version requirement here is totally made up. //! //! I want the docs of slurm-rs to be available on docs.rs, which requires us //! to be able to compile this bindings module on that platform. The code //! doesn't...
use crate::encoding::EwpError; use std::mem::transmute; use byteorder::{BigEndian, WriteBytesExt}; pub use super::envelope::{Envelope}; /// Marshal takes a parsed message and encodes it to a wire protocol message pub fn marshal(msg: &Envelope) -> Result<Vec<u8>, EwpError> { let mut outbytes: Vec<u8> = Envelope:...
use crate::label::*; use crate::pretty; use anyhow::*; use crossterm::tty::IsTty; use log::*; use std::time::*; use structopt::*; /// For each pair of benchmarks (x and y), shows, for each metric (̄x /// and ̄y), the CI of (̄y - ̄x) / ̄x #[derive(StructOpt)] pub struct Options { /// The significance level of the c...
use qr_spec::{ count_length, identify_data_mode, DataMode, ErrorCorrectionLevel, ALPHANUMERIC_TABLE, }; use crate::bitstring::Bitstring; mod bitstring; #[allow(dead_code)] mod qr_spec; fn main() { // let data = "Hello, World!"; let data = "HELLO WORLD"; // let data = "1123581321"; let qr = QrCode...
use std::io; use std::pin::Pin; use actix::prelude::*; use actix_web::web::Bytes; use tokio::io::{AsyncWrite, AsyncWriteExt}; use tokio::stream::{Stream, StreamExt}; use crate::broadcaster::BroadcasterStream; use crate::tuner::StopStreamingMessage; pub use crate::tuner::TunerSubscriptionId as MpegTsStreamId; pub str...
use super::app; use super::Error; use super::{ templates::{render, render_list}, Config, Target, }; use async_trait::async_trait; use futures::{pin_mut, select, FutureExt}; use std::sync::Arc; use tokio::process::Command; #[cfg(unix)] use std::convert::TryInto; #[async_trait] pub trait Launcher: Send + Sync ...
use cart; use base64; mod config; use std::process; use std::fs::{read_to_string, remove_file, write}; use std::path::Path; use json::JsonValue; fn main() { // Parse configuration variables let params = config::Config::new().unwrap_or_else(|err| { eprintln!("Problem parsing arguments: {}", err); ...
//! Aliasable `Box`. use core::fmt; use core::mem::ManuallyDrop; use core::ops::{Deref, DerefMut}; use core::pin::Pin; use core::ptr::NonNull; pub use alloc::boxed::Box as UniqueBox; /// Basic aliasable (non `core::ptr::Unique`) alternative to /// [`alloc::boxed::Box`]. pub struct AliasableBox<T: ?Sized>(NonNull<T>)...
use crate::collection::buffers::WorkingBuffers; use crate::util::{self, BufferLike, ByteLines, LazyQuantity}; use std::fs::File; use std::io::{Read, Seek, SeekFrom}; #[derive(Copy, Clone, PartialEq)] pub struct Empty; /// Tries to read the given file handle, /// and directly write the contents as a field to the next ...
extern crate firebase; extern crate url; extern crate rustc_serialize; use firebase::*; use url::Url; use std::sync::{Arc, Mutex}; #[test] fn builds_auth_url() { let f = Firebase::authed("https://db.rifebass.com/", "deadbeaf").ok().unwrap(); assert_eq!(f.get_url(), "https://db.rifebass.com/?auth=deadbeaf"); ...
// error-pattern:yummy #![feature(box_syntax)] #![feature(rustc_private)] #![allow(unknown_lints, missing_docs_in_private_items)] use std::collections::HashMap; use std::process; use std::io::{self, Write}; extern crate cargo_metadata; use std::path::Path; const CARGO_CLIPPY_HELP: &str = r#"Checks a package to catc...
mod commands; extern crate vertex; #[cfg(feature = "allocator-mimalloc")] #[global_allocator] static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; #[cfg(any(feature = "allocator-jemalloc", feature = "extensions-jemalloc"))] #[global_allocator] static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc; exter...
// Public Key Generation with verifiable randomness use curve25519_dalek::ristretto::RistrettoPoint; use curve25519_dalek::scalar::Scalar; use rand_os::OsRng; use sha3::{Digest, Sha3_512}; // generating a base point, and another point for Pedersen pub fn crs_gen() -> ((RistrettoPoint, RistrettoPoint),Scalar...
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
use {api, url, reqwest, tokio_core, Error, Event, Sender, TxType, WsMessage}; use futures::sync::{mpsc, oneshot}; use futures::{Future, Stream, Sink}; use futures::future::{err, ok, IntoFuture}; use tokio_core::net::TcpStream; use native_tls::TlsConnector; use tokio_tls::TlsConnectorExt; use std::net::ToSocketAddrs; us...
use crate::error::{ParallelError, Response, Result}; use crate::host_config::HostConfig; use once_cell::sync::Lazy; use regex::Regex; use std::collections::HashMap; use std::fs::File; use std::path::Path; #[derive(Debug)] pub struct Context { pub context_path: String, pub status: String, pub alive_session:...
use crate::image::search::state::ImageSearchCheckboxKind; use super::{ actions::{search, fetch_init_data, upload_file}, state::State, types::*, }; use dominator::{clone, html, Dom}; use futures_signals::{signal::SignalExt, signal_vec::SignalVecExt}; use shared::{domain::jig::module::body::Image, media::Med...
//! Example: //! ``` //! use loading::Loading; //! use std::thread; //! use std::time::Duration; //! //! fn main() { //! let mut loading = Loading::new(); //! //! loading.start(); //! //! for i in 0..100 { //! loading.text(format!("Loading {}", i)); //! thread::sleep(Duration::from_millis(50...
//! `provider_states` module contains all the logic for dealing with provider states. //! See `https://docs.pact.io/getting_started/provider_states` for more info on provider states. use std::cmp::Eq; use std::collections::HashMap; use std::hash::{Hash, Hasher}; use maplit::*; use serde::{Deserialize, Serialize}; use...
use helpers::input_lines; use std::iter::Peekable; use std::str::Chars; use std::str::FromStr; const INPUT: &str = include_str!("../input.txt"); #[derive(Clone, Debug)] struct ValueDepth { value: usize, depth: usize, } // Ideally we could represent the input as a tree // where the leaf are the literal values...
//! Dungeon maps. #![allow(missing_docs)] use std::collections::HashMap; use std::convert::TryInto as _; use rand::distributions::Bernoulli; use rand::distributions::Distribution as _; use rand::distributions::Open01; use rand::distributions::Uniform; use crate::geo::Point; use crate::geo::Rect; use crate::geo::Rec...
/** * [1411] Number of Ways to Paint N × 3 Grid * * You have a `grid` of size `n x 3` and you want to paint each cell of the grid with exactly one of the three colours: Red, Yellow or Green while making sure that no two adjacent cells have the same colour (i.e no two cells that share vertical or horizontal sides hav...
#![no_std] extern crate alloc; #[cfg(feature = "serde")] pub mod ser; #[cfg(feature = "serde")] use serde::{Deserialize, Deserializer, Serialize, Serializer}; use core::iter::FromIterator; use alloc::vec::Vec; use parity_scale_codec::Codec; use sp_core::storage::ChildInfo; use sp_core::Hasher; use sp_state_machine...
use std::{ net::{TcpListener, TcpStream}, pin::Pin, task::{Context, Poll}, }; use async_dup::Arc; use futures_core::Stream; use http::{header, HeaderValue, Response}; use log::info; use once_cell::sync::OnceCell; use smol::{ io::{AsyncBufReadExt, AsyncWriteExt, BufReader, Lines}, prelude::*, As...
use chrono::{Duration, Utc}; use clap::Parser; use indicatif::{ProgressBar, ProgressStyle}; use std::collections::BTreeMap; use std::fs; use std::io::{self, BufRead, Write}; use std::sync::atomic::{AtomicUsize, Ordering::SeqCst}; use std::sync::Arc; use std::thread; mod lib; use crate::lib::{archive_url, ArchiveError,...