text stringlengths 3.09k 13.9k |
|---|
use winit::{
event::{Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::Window
};
use anyhow::{Result, anyhow};
use winit::event::{KeyboardInput, ElementState, VirtualKeyCode};
mod camera;
mod uniform;
mod input;
use camera::Camera;
use uniform::UniformData;
use input::Input;
async fn ru... |
//! Wrapper for some commonly used guppy calls
use anyhow::Result;
use guppy::graph::{DependencyDirection, PackageGraph, PackageMetadata};
use guppy::PackageId;
use semver::Version;
use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet};
use std::iter;
#[derive(Serialize, Deserialize, Debug, Cl... |
//! Match strings against a simple wildcard pattern.
//! Tests a wildcard pattern `p` against an input string `s`. Returns true only when `p` matches the entirety of `s`.
//!
//! See also the example described on [wikipedia](https://en.wikipedia.org/wiki/Matching_wildcards) for matching wildcards.
//!
//! No escape cha... |
//! This module contains `Domain` structure and related implementations and trait implementations.
use crate::{isi::prelude::*, prelude::*};
use iroha_derive::*;
use parity_scale_codec::{Decode, Encode};
use std::collections::BTreeMap;
type Name = String;
/// Named group of `Account` and `Asset` entities.
#[derive(De... |
// Copyright 2022 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.
//! Recognizes Alt+Shift+i as the immersive mode shortcut, and passes
//! an event to downstream handlers indicating that immersive mode
//! should be togg... |
use async_trait::async_trait;
use creep::Context;
use crate::traits::{ExecutorParams, ExecutorResp};
use crate::types::{
Address, Block, Bytes, Hash, MerkleRoot, Metadata, Proof, Receipt, SignedTransaction, Validator,
};
use crate::{traits::mempool::MixedTxHashes, ProtocolResult};
#[derive(Clone, Debug, PartialEq... |
#[doc(hidden)]
pub use tokenizer::Tokenizer;
pub mod branch;
pub mod expires;
pub mod maddr;
pub mod method;
pub mod q;
pub mod received;
pub mod tag;
pub mod ttl;
pub mod user;
pub use branch::Branch;
pub use expires::Expires;
pub use maddr::Maddr;
pub use method::Method;
pub use q::Q;
pub use received::Received;
pu... |
//! table_cache implements a cache providing access to the immutable SSTables on disk. It's a
//! read-through cache, meaning that non-present tables are read from disk and cached before being
//! returned.
use crate::cache::{self, Cache};
use crate::error::{err, Result, StatusCode};
use crate::key_types::InternalKey;... |
//! Add extra information to the binary package through `cargo run [...] z1info=extra_information`
//!
//! # Use
//!
//! ### add code
//!
//! ### add dependencies
//! - z1info_rust = "0.1.3"
//!
//! ```no_run
//! fn main() {
//! z1info_rust::run("z1template");
//! // z1info_test::run("z1_info:{z1_info},git_inf... |
use crate::custom_serde::*;
use chrono::{serde::ts_nanoseconds, DateTime, Utc};
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, fmt};
pub mod attributes;
use self::attributes::AttributeValue;
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
... |
/*
* MinIO Rust Library for Amazon S3 Compatible Cloud Storage
* Copyright 2019 MinIO, Inc.
*
* 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/LICE... |
#![allow(non_camel_case_types)]
extern crate libc;
extern crate eina_sys;
extern crate ethumb_sys;
use eina_sys::*;
use ethumb_sys::*;
use libc::*;
/* automatically generated by rust-bindgen */
pub enum Ethumb_Client { }
pub enum Ethumb_Exists { }
pub type EthumbClientConnectCb = Option<unsafe extern "C" fn(data: *mu... |
// Copyright rafawo (<EMAIL>). All rights reserved.
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// All files in the project carrying such notice may not be ... |
use super::constants::*;
use super::super::types::{Data, Addr};
#[derive(Debug)]
pub struct Square {
index: usize,
// $4000
is_length_counter_enabled: bool,
is_envelope_enabled: bool,
is_envelope_loop_enabled: bool,
envelope_period_and_volume: usize,
// $4001
is_sweep_enabled: bool,
sweep_unit_divide... |
mod json_parse;
mod rate_limiter;
use json_parse::{JsonPath, RateLimiterJson, Rule};
use proxy_wasm::traits::*;
use proxy_wasm::types::*;
use rate_limiter::RateLimiter;
use serde::Deserialize;
use std::collections::HashMap;
use std::time::SystemTime;
// We need to make sure a HTTP root context is created and initial... |
use ordered_float::OrderedFloat;
use skia_safe::{scalar, Color, Image, Matrix, Path, Rect, Vector};
use std::cmp::{max, min};
use std::collections::hash_map::DefaultHasher;
use std::collections::HashMap;
use std::fmt::{Debug, Error, Formatter};
use std::hash::{Hash, Hasher};
/// The amount of frames after which a cach... |
use std::collections::HashMap;
use std::fmt::Display;
use svg::node::Node;
use svg::node::element::Group;
use crate::components::scatter::{ScatterPoint, MarkerType, PointLabelPosition};
use crate::colors::Color;
use crate::{Scale, LineSeries};
use crate::views::datum::PointDatum;
use crate::views::View;
use crate::comp... |
#[macro_use]
mod utilities;
pub mod onion;
pub mod auth;
pub mod rps;
pub mod p2p;
use errors::*;
use messages::auth::*;
use messages::onion::*;
use messages::rps::*;
use messages::p2p::P2PMessage;
use num::FromPrimitive;
use serde::{Deserialize, Serialize};
use rmps::{Deserializer, Serializer};
pub enum Message {
... |
/*
* Copyright 2020 UT OVERSEAS INC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
use clap::{App, Arg};
use walkdir::WalkDir;
use std::collections::HashMap;
use std::path::{PathBuf, Path};
use std::{fs, io};
use sha1::{Sha1, Digest};
use std::io::{Error, Write};
use lol_html::{HtmlRewriter, Settings, element};
use url::Url;
use std::ffi::OsStr;
fn main() {
let matches = App::new("cache-buster"... |
use crate::object::{AeonObject, Macro, AeonProperty};
use crate::value::{AeonValue};
use std::net::IpAddr;
macro_rules! serialize_arg(
($s:ident, $idx:ident, $val:expr) => {
if $idx == 0 {
$s.push_str($val);
} else {
$s.push(',');
$s.push(' ');
$s.pus... |
#![feature(drain_filter)]
#![feature(iter_intersperse)]
mod alignment;
mod cli;
use std::io::{self, Read, Write};
use alignment::Alignment;
use cli::{ColumnsHide, ColumnsTitles};
fn main() {
// Read cli params
let matches = cli::get_cli_params();
let file = matches.value_of("file");
let separator = m... |
use std::{
sync::{
atomic::{AtomicBool, Ordering},
Arc, RwLock,
},
time::Duration,
{thread, thread::JoinHandle},
};
use anyhow::{bail, Context, Result};
use chrono::{DateTime, Utc};
use log::error;
use serde_json::Value;
/// A collection of Workers for managing easily.
pub(crate) struc... |
use log::debug;
use log::info;
use log::warn;
use std::ops::AddAssign;
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
use std::sync::mpsc::{Receiver, Sender};
use std::sync::Arc;
use std::thread;
use std::time::{Duration, SystemTime};
use futures01::sink::{Sink, Wait};
use futures01::sync::mpsc::UnboundedSe... |
extern crate rand;
extern crate docopt;
extern crate rustc_serialize;
extern crate crossbeam;
extern crate simple_parallel;
use rand::Rng;
use docopt::Docopt;
// Write the Docopt usage string.
const USAGE: &'static str = "
Usage:
illuminated-inmates [--prisoner-count=<prisoner-count>] [--repetitions=<repetitions... |
use std::collections::BTreeSet;
use decorum::R64;
use parry3d_f64::{
bounding_volume::AABB,
math::Isometry,
query::{Ray, RayCast as _},
shape::Triangle as Triangle3,
};
use crate::{
debug::{DebugInfo, TriangleEdgeCheck},
kernel::geometry::Surface,
math::Point,
};
use super::edges::Edges;
... |
// ----- Imports -----
use std::{
convert::TryInto,
sync::{
atomic::{AtomicBool, AtomicUsize, Ordering},
Arc, Mutex,
},
thread,
time::{Duration, Instant, SystemTime, UNIX_EPOCH},
};
use serde::{Deserialize, Serialize};
use sysinfo::{ProcessExt, System, SystemExt};
use tauri::Manager;
use thiserror::E... |
use std::{collections::HashSet, convert::TryInto, env, ops::Deref};
use anyhow::{anyhow, bail};
use defmt_decoder::{Locations, Table};
use object::{
read::File as ObjectFile, Object as _, ObjectSection as _, ObjectSymbol as _, SymbolSection,
};
use crate::cortexm;
pub(crate) struct Elf<'file> {
elf: ObjectFi... |
// Copyright 2019 Authors of Red Sift
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according t... |
mod rainbow;
mod spiral;
mod spin;
mod rows;
mod twinkle;
use std::{env, thread};
use rs_ws281x::{ChannelBuilder, Controller, ControllerBuilder, StripType};
use std::time::{Duration, Instant};
use hsl::HSL;
use crate::twinkle::Twinkle;
use crate::rainbow::Rainbow;
use crate::rows::Rows;
use crate::spin::Spin;
use crat... |
use crate::algorithms::AlphaBetaSearch;
/// Differing kinds of agents that can play the game
use crate::algorithms::Heuristics;
use crate::engine::*;
use crate::game::Agent;
use crate::game_state::GameState;
use crate::moves::*;
use crate::pieces::Color;
use crate::pieces::PieceType;
use crate::Position;
use std::io::{... |
use proc_macro::TokenStream;
use proc_macro2::TokenStream as TokenStream2;
use quote::{quote, quote_spanned};
use syn::spanned::Spanned;
use syn::*;
pub fn derive_interactive(input: TokenStream) -> TokenStream {
let ast = parse_macro_input!(input as ItemStruct);
interactive_impl(&ast).into()
}
pub fn derive_... |
#![allow(non_camel_case_types, non_snake_case)]
use pdcurses::*;
use libc::c_int;
use std::ffi::{CStr, CString};
pub mod constants;
use self::constants::*;
use input::Input;
#[cfg(any(feature = "win32a", all(not(feature = "win32"), not(feature = "win32a"))))]
mod win32a;
#[cfg(any(feature = "win32a", all(not(featur... |
use crate::cli::{GlobalConfig, LoggingOpts};
use sha2::{Digest, Sha256};
use std::collections::BTreeMap;
use std::fs;
use std::path::{Path, PathBuf};
use std::process::Command;
use tracing::debug;
use tracing::level_filters::LevelFilter;
pub const GLOBAL_STATE_FILE_NAME: &str = "global-state.json";
pub const TOOL_REMO... |
// Copyright © 2021-present <NAME>
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// https://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in w... |
// This file is part of Substrate.
// Copyright (C) 2019-2020 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... |
use std::env;
use std::io;
use std::io::Write;
mod types;
use types::*;
fn main() {
// Call with --part-two to calculate part 2 answer
let _part_two = env::args()
.nth(1)
.map_or(false, |arg| "--part-two".eq(&arg));
let mut raw_program = String::new();
print!("Enter Intcode string: ")... |
use std::fmt;
use std::convert::{Into, From};
use self::OpCode::*;
/// Operation codes as part of rfc6455.
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
pub enum OpCode {
/// Indicates a continuation frame of a fragmented message.
Continue,
/// Indicates a text data frame.
Text,
/// Indicates a bina... |
use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use serenity::model::{guild::Emoji, id::EmojiId};
use strum::{Display, EnumIter};
use tokio::sync::oneshot;
use utility::config::EmojiStats;
use super::prelude::*;
#[derive(Debug, Serialize, Deserialize, EnumIter, Display, PartialEq, Eq, Hash, Clone... |
use logger::debug;
use std::collections::{BTreeSet, HashMap};
use std::fmt::Formatter;
use std::{cmp, fmt};
#[derive(Debug)]
pub enum Error {
AllocSizeZero,
PoolSizeZero,
PoolOverflow { base: u64, size: u64 },
BadAlignment,
BadAlloc(Alloc),
ExistAlloc(Alloc),
OutOfSpace,
RegionOverlap {... |
use crate::ArgConstant;
use bip39::{Language, Mnemonic, Seed};
use clap::values_t;
use rpassword::prompt_password_stderr;
use solana_sdk::{
pubkey::Pubkey,
signature::{
keypair_from_seed, keypair_from_seed_phrase_and_passphrase, read_keypair_file, Keypair,
KeypairUtil,
},
};
use std::{
e... |
use std::collections::HashMap;
use std::env::args;
use std::time::Instant;
// This solution assumes that there is no more than 16 different nodes.
// This is very important for the memoization function
trait Set<T> {
fn empty() -> Self;
fn with(&self, node: T) -> Self;
fn contains(&self, node: T) -> boo... |
use std::path::PathBuf;
use som_interpreter_bc::compiler;
use som_interpreter_bc::frame::FrameKind;
use som_interpreter_bc::interpreter::Interpreter;
use som_interpreter_bc::universe::Universe;
use som_interpreter_bc::value::Value;
use som_lexer::{Lexer, Token};
use som_parser::lang;
fn setup_universe() -> Universe {... |
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GoogleMessage1 {
#[prost(string, tag = "1")]
pub field1: std::string::String,
#[prost(string, tag = "9")]
pub field9: std::string::String,
#[prost(string, tag = "18")]
pub field18: std::string::String,
#[prost(bool, tag = "80")]
pu... |
//! Provides the parser for Llanfair splits files.
use std::io::{self, Read, Seek, SeekFrom};
use std::result::Result as StdResult;
use std::str::{Utf8Error, from_utf8};
use byteorder::{ReadBytesExt, BE};
use imagelib::{png, ColorType, ImageBuffer, Rgba};
use {Image, RealTime, Run, Segment, Time, TimeSpan};
quick_err... |
use std::collections::HashMap;
use std::error::Error;
use std::fmt::{self, Debug, Formatter};
use std::io::{self, Read};
use std::mem;
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
struct Point(i32, i32);
impl Point {
fn climb(&self, delta: i32) -> Self {
Point(self.0, self.1 + delta)
}
fn slide(&self, delta... |
#[doc(hidden)]
pub use tokenizer::Tokenizer;
use crate::{Error, Port, Scheme};
/// Simple enum that holds the transport type used (for instance in the `Via` header).
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
pub enum Transport {
Udp,
Tcp,
Tls,
TlsSctp,
Sctp,
Ws,
Wss,
}
impl Trans... |
use std::fs::{canonicalize, File};
use std::io::Read;
use std::path::PathBuf;
use std::vec;
use md5;
use csv;
#[derive(Clone, Debug, RustcDecodable, PartialEq)]
pub enum Outcome {
Match,
Mismatch { expected: String, actual: String },
}
#[derive(Clone, Debug, RustcDecodable, PartialEq)]
pub struct ChecksumRec... |
// Copyright 2021 Vector 35 Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... |
use std::{iter::Peekable, str::Chars};
#[derive(Debug, PartialEq)]
pub enum Token {
// Illegal chars
Illegal,
// Single-character tokens.
LeftParen,
RightParen,
LeftBrace,
RightBrace,
Comma,
Dot,
Minus,
Plus,
Semicolon,
Slash,
Star,
// One or two charac... |
use clap::{App, Arg, SubCommand};
use lib::{decrypt, encrypt, keygen, parse_key, push_64bit};
use std::io::Read;
mod lib;
fn main() {
let matches = App::new("des")
.about("DES cipher")
.subcommand(SubCommand::with_name("keygen")
.about("generate new key by random"))
.arg(Arg::... |
use std::{
env,
rc::Rc,
sync::{Arc, RwLock},
time::{Duration, Instant},
};
use async_std::path::{Path, PathBuf};
use clap::{Arg, App as ClapApp};
use glow::{self, Context};
use glutin::{
event::{ElementState, Event, MouseButton, StartCause, VirtualKeyCode, WindowEvent},
event_loop::{ControlFlow... |
#![allow(non_snake_case)]
use ndarray::{Array1, Array2, ArrayBase, Axis, Data, Ix1, Ix2};
use ndarray_stats::DeviationExt;
use std::collections::HashMap;
/// K-means clustering aims to partition a set of observations
/// into `self.n_clusters` clusters, where each observation belongs
/// to the cluster with the neares... |
#[derive(Debug,PartialEq)]
struct Admin { username: &'static str}
#[derive(Debug)]
struct Operador { username: &'static str}
#[derive(Debug)]
struct BasicUser { username: &'static str}
trait User{
fn new(username: &'static str) -> Self;
fn username(&self) -> &'static str;
fn login(&self) -> &'static str;
fn ... |
use counters::flavors::{Counter, CounterType};
use counters::Counters;
use crossbeam_queue::ArrayQueue;
use efd::Efd;
use fwd::intf::Interface;
use graph::Driver;
use graph::{Dispatch, Gclient, VEC_SIZE};
use log::Logger;
use msg::R2Msg;
use names::l2_eth_decap;
use packet::BoxPkt;
use sched::hfsc::Hfsc;
use std::sync:... |
use std::{error::Error, f32::RADIX, fs, path::Path};
use crate::d00_aoc::InputReader;
pub struct BinaryDiagnostic {
gamma: u32,
epsilon: u32,
oxygen: u32,
co2: u32,
}
impl InputReader<Vec<u32>> for BinaryDiagnostic {
fn string_to_vector(input_str: String) -> Vec<Vec<u32>> {
let mut input_... |
use byteorder::{ByteOrder, LittleEndian};
use datafusion::scalar::ScalarValue;
#[derive(Debug, PartialEq)]
pub struct ResponsePayload {
pub bytes: Vec<u8>,
}
impl ResponsePayload {
pub fn new(length: usize) -> Self {
let body: Vec<u8> = Vec::with_capacity(length);
ResponsePayload... |
//! # [Day 14: Reindeer Olympics](https://adventofcode.com/2015/day/14)
//!
//! This year is the Reindeer Olympics!
//! Reindeer can fly at high speeds, but must rest occasionally to recover their energy. Santa
//! would like to know which of his reindeer is fastest, and so he has them race.
//!
//! Reindeer can only e... |
//! This is a test for the ibc metadata proposal, which is a way to set the denom metadata for a given
use crate::airdrop_proposal::wait_for_proposals_to_execute;
use crate::happy_path_v2::deploy_cosmos_representing_erc20_and_check_adoption;
use crate::utils::{vote_yes_on_proposals, ValidatorKeys};
use crate::{get_dep... |
// Implements the glamor shot from the bonus sof shadows chapter
// TODO: implement YAML file reading
use ray_tracer_challenge::camera::Camera;
use ray_tracer_challenge::color::Color;
use ray_tracer_challenge::constants::red;
use ray_tracer_challenge::constants::white;
use ray_tracer_challenge::light::rectangle_light:... |
use std::{collections::HashSet, time::Instant};
use log::Level;
use trust_dns_server::{
client::{
op::{Header, Query, ResponseCode},
rr::{self, Name},
},
server::Request,
};
use crate::config::Config;
use super::{Fqdn, RecordSet};
pub(super) struct QueryContext<'a> {
request: &'a Req... |
//! The wl_pointer interface represents one or more input devices, such as mice,
//! which control the pointer location and pointer_focus of a seat. the wl_pointer
//! interface generates motion, enter and leave events for the surfaces that the
//! pointer is located over, and button and axis events for button presses,... |
use std::convert::TryInto;
use std::fs::File;
use std::io;
use std::io::prelude::*;
use std::str::FromStr;
use actix::prelude::*;
use actix_web::{get, web, App, HttpResponse, HttpServer, Responder};
use log::info;
use rand::{thread_rng, Rng};
use serde::{Deserialize, Serialize};
use limit::*;
#[derive(Serialize, Des... |
#![no_std]
#![no_main]
#![feature(used)]
extern crate cortex_m;
#[macro_use(exception, entry)]
extern crate cortex_m_rt;
extern crate cortex_m_semihosting;
#[macro_use(interrupt)]
extern crate stm32f429 as board;
extern crate stm32_eth as eth;
extern crate panic_itm;
use core::cell::RefCell;
use core::default::Defaul... |
use crate::board::Board;
use crate::pgn::move2pgn;
use crate::piece::{Action, Color, Piece};
use crate::pos::Pos;
use itertools::Itertools;
use rand::Rng;
fn piece_value(piece: Piece) -> f32 {
match piece {
Piece::Pawn {
orientation: _,
status: _,
} => 1.,
Piece::Kni... |
use clap::Parser;
use crossterm::{
event::{self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode},
execute,
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
};
use oxidebpf::ProgramBlueprint;
use std::{error::Error, io};
use tui::text::Spans;
use tui::widget... |
use std::ptr;
use anyhow::anyhow;
use liblumen_profiling::SelfProfilerRef;
use crate::enums::{CodeGenOptLevel, CodeGenOptSize};
use crate::profiling::{self, LlvmSelfProfiler};
use crate::target::{TargetMachine, TargetMachineRef};
use crate::{Module, ModuleRef};
mod ffi {
use super::*;
extern "C" {
... |
use std::collections::hash_map::Entry;
use crate::{
utils::{self, error_label_needs_world, image_texture_conversion},
Context, Inspectable,
};
use bevy::{
app::Events,
asset::{Asset, HandleId},
prelude::*,
render::texture::Image,
utils::HashMap,
};
use bevy_egui::{
egui::{self, Color32,... |
// This renders a rectangular wgpu::Texture using a pair of triangles.
// based on https://github.com/gfx-rs/wgpu-rs/blob/master/examples/cube/main.rs
use bytemuck::{Pod, Zeroable};
use std::{borrow::Cow, mem};
use wgpu::util::DeviceExt;
use crate::{
life_params::LifeParams,
texture::Texture,
};
pub struct R... |
use ckb_jsonrpc_types::{BlockNumber, CellOutput, JsonBytes, OutPoint, Script, Uint32};
use serde::{Deserialize, Serialize};
macro_rules! jsonrpc {
(
$(#[$struct_attr:meta])*
pub struct $struct_name:ident {$(
$(#[$attr:meta])*
pub fn $method:ident(&mut $selff:ident $(, $arg_n... |
use core::iter::IntoIterator;
use core::ops::{Index, IndexMut};
use core::slice::Iter as SliceIter;
use core::slice::IterMut as SliceIterMut;
use super::RetainMut;
pub struct SegmentedVec<T> {
chunks: Vec<Vec<T>>,
chunk_size: usize,
}
impl<T> SegmentedVec<T> {
pub fn retain(&mut self, f: impl FnMut(&T) ->... |
use core::panic;
use std::io::{self, Read};
use bytes::buf::Reader;
use bytes::{Buf, Bytes};
use chunked_bytes::ChunkedBytes;
use lazy_static::lazy_static;
use parquet::data_type::AsBytes;
use parquet::errors::Result;
use parquet::file::reader::{ChunkReader, Length};
use regex::Regex;
use rusoto_core::Region;
use ruso... |
use {
executable_path::executable_path,
reqwest::{blocking::Response, header, redirect::Policy, StatusCode, Url},
scraper::Html,
std::{
fs,
io::{BufRead, BufReader, Read},
path::{Path, PathBuf},
process::{Child, ChildStderr, Command, Stdio},
},
tempfile::TempDir,
};
pub struct AgoraTestCont... |
/*! <span class="stab portability" title="This is supported on crate feature `use_rustls` only"><code>use_rustls</code></span> utilities to help with rustls.
```
use async_acme::{
acme::LETS_ENCRYPT_STAGING_DIRECTORY,
rustls_helper::order,
};
async fn get_new_cert(){
let cache = "./cachedir/".to_string();
... |
///!
///! A set of mathematical utility functions.
///! TODO: T might be a signed integer! Everything in here only considers unsigned really.
///!
use crate::prelude::*;
mod ct_poly;
pub mod ct_util;
pub mod poly;
use ct_poly::*;
use poly::*;
/// polynomial subtraction, calculates a - b mod modulo
#[cfg_attr(feature... |
//! Config objects, to be read from Yarner.toml
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use once_cell::sync::Lazy;
use regex::Regex;
use serde::{de::Error as _, Deserialize, Deserializer};
use crate::{files, util::Fallible};
use toml::value::Table;
pub const LINK_PATTERN: &str = r"\[([^\[\]]*)... |
use std::fmt::{self, Debug};
use std::sync::Arc;
use async_trait::async_trait;
use cast_trait_object::dyn_upcast;
use tokio::sync::broadcast;
use crate::error::PlanError;
use crate::graph::stage::{Stage, WithMonitor};
use crate::graph::{stage, Inlet, Outlet, Port, SinkShape, SourceShape, PORT_CONTEXT, PORT_DATA};
use... |
use crate::Point;
use crate::primitives::{AbstractPoint, Mode, Sector};
use crate::units::Coordinate;
#[derive(PartialEq, Debug, Clone)]
pub struct Bounds {
top: Coordinate,
left: Coordinate,
bottom: Coordinate,
right: Coordinate
}
impl Bounds{
pub fn top(&self) -> Coordinate { self.top }
pub f... |
use crate::santa;
use rand::seq::SliceRandom;
use rand::Rng;
use std::time::Instant;
pub struct ILS {
families: santa::FamilyData,
families_per_day: Vec<Vec<usize>>,
all_fams: Vec<usize>,
move_depth: usize,
max_choice: usize,
}
impl ILS {
pub fn new(families: santa::FamilyData, move_depth: usi... |
use gtk::{ButtonsType, DialogFlags, MessageDialog, MessageType};
use gtk::prelude::*;
use flowclib::model::flow::Flow;
use flowrlib::loader::Loader;
use flowrstructs::manifest::Manifest;
use crate::build_ui::{widgets, MANIFEST_PAGE, FLOW_GRAPH_PAGE};
use crate::build_ui::widgets::WidgetRefs;
use std::rc::Rc;
pub str... |
//! [command - 生成された子プロセスとの間で複数回パイプできない](https://tutorialmore.com/questions-1733265.htm)
//! [Struct std::process::Command](https://doc.rust-lang.org/std/process/struct.Command.html)
//! [External Command](https://rust-lang-nursery.github.io/rust-cookbook/os/external.html)
//! [Rustで外部コマンド実行](https://qiita.com/imos/ite... |
/* the parser:
parses the token list prodused by the lexer and ouputs and outputs an ast.
*/
use crate::lexer;
use clay_lib::Token;
// use std::collections::HashMap;
#[derive(Debug, Clone)]
pub struct Node {
pub parent_id: Option<NodeID>,
pub id: NodeID,
pub children: Vec<Node>,
pub data: Option<... |
//
// frame.rs
// Copyright (C) 2019 <NAME> <<EMAIL>>
// Distributed under terms of the MIT license.
//
//! A frame type with a number of useful functions
use crate::distance::min_image;
use gsd::GSDFrame;
use nalgebra::{Point3, Quaternion, UnitQuaternion, Vector4};
use rstar::{PointDistance, RTree, RTreeObject, AABB... |
use crate::config::{ServiceConfig, ServiceLevel};
use crate::ServiceOperator;
use anyhow::Result;
use maplit::{btreemap, convert_args};
use serde::ser::SerializeMap;
use serde::{Serialize, Serializer};
use std::collections::BTreeMap;
use std::env;
use std::fs;
use std::fs::File;
use std::io::Write;
use std::process::Co... |
extern crate strum;
#[macro_use]
extern crate strum_macros;
extern crate chrono;
extern crate clap;
extern crate serde;
extern crate toml;
extern crate libc;
extern crate termion;
extern crate glutin;
extern crate cpal;
mod bit_utils;
mod machinecode;
mod disassembler;
mod config;
mod bus;
mod cpu;
mod dos;
mod bios;
... |
use specs::{Entities, ReadStorage};
use quicksilver::geom::{Rectangle, Vector};
use quicksilver::lifecycle::Window;
use quicksilver::Result;
use crate::game::level::{Level, Tile};
use crate::game::ecs::{Character, Position, Rect};
use crate::game::fov::Fov;
use crate::color::{Palette};
use super::Tileset;
use super::Wi... |
//! This demo shows how to embed 3D rendering using [`glow`](https://github.com/grovesNL/glow) in `eframe`.
//!
//! This is very advanced usage, and you need to be careful.
//!
//! If you want an easier way to show 3D graphics with egui, take a look at:
//! * [`bevy_egui`](https://github.com/mvlabat/bevy_egui)
//! * [`... |
use crate::vm::opcodes::{get_args_num, op};
use std::collections::HashMap;
pub fn opcode_to_s(c: u8) -> &'static str {
match c {
op::RESERVE => "reserve",
op::LOAD_CONST => "load_const",
op::LOAD_SMALL_INT => "load_small_int",
op::LOAD_TRUE => "load_true",
op::LOAD_FALSE => ... |
use geoengine_datatypes::{dataset::DatasetProviderId, spatial_reference::SpatialReferenceOption};
use snafu::Snafu;
use strum::IntoStaticStr;
use warp::reject::Reject;
pub type Result<T, E = Error> = std::result::Result<T, E>;
#[derive(Debug, Snafu, IntoStaticStr)]
#[snafu(visibility = "pub(crate)")]
pub enum Error {
... |
use std::str;
use std::string::FromUtf8Error;
use std::error::Error;
use std::fmt::{self, Display};
use std::io::Write;
use std::io;
pub fn encode(data: &str) -> String {
let mut escaped = Vec::with_capacity(data.len());
encode_into(data, &mut escaped).unwrap();
// Encoded string is guaranteed to be ASCII
... |
/*
* Copyright (c) 2014 <NAME>
*
* Permission to use, copy, modify, and 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 AUTHOR DISCLAIMS ALL W... |
#![deny(clippy::pedantic)]
#![allow(clippy::unused_async)]
mod errors;
mod highlight;
mod io;
mod params;
use crate::{
errors::{InternalServerError, NotFound},
highlight::highlight,
io::{generate_id, get_paste, store_paste, PasteStore},
params::{HostHeader, IsPlaintextRequest},
};
use actix_web::{
... |
use crate::algo::{Dfs, DfsListener};
use crate::graph::{Edge, UndirectedEdge};
use crate::provide;
/// Finds connected components of an undirected graph.
///
/// # Examples
/// ```
/// use prepona::prelude::*;
/// use prepona::storage::Mat;
/// use prepona::graph::MatGraph;
/// use prepona::algo::ConnectedComponents;
... |
use byteorder::{ByteOrder, NetworkEndian};
use crossbeam::crossbeam_channel;
use std::io::{Read, Write};
use std::net::{IpAddr, SocketAddr, UdpSocket};
use super::dns;
const DEFAULT_DOT_PORT: u16 = 853;
const DEFAULT_DNS_PORT: u16 = 53;
pub struct DNSConfig {
port: u16,
address: IpAddr,
}
pub struct DOTConf... |
use super::{Arg, ArgDef};
#[derive(PartialEq, Eq, Debug)]
pub enum ParseError {
NotFound,
}
impl std::error::Error for ParseError {}
impl std::fmt::Display for ParseError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}
pub type Result<T> = std::r... |
/*
Copyright 2021 Integritee AG and Supercomputing Systems AG
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... |
/*!
* 数据同步,可以计算数据的差异,并根据差异和原有数据构建出新的数据
* 算法原理参考http://blog.csdn.net/russell_tao/article/details/7240661
*/
#![feature(nll)]
extern crate crc;
extern crate adler32;
use std::collections::HashMap;
use adler32::RollingAdler32;
use crc::crc32::{Digest, IEEE};
use crc::Hasher32;
pub struct RSync{
... |
use crate::bin::Bin;
use crate::commitment::{CommitmentArc, CommitmentRes};
use crate::fr::{FrArc, FrRes};
use rustler::{Env, ListIterator, ResourceArc};
use serde::{Deserialize, Serialize};
use threshold_crypto::poly::Poly;
use threshold_crypto::{Fr, IntoFr};
use zeroize::Zeroize;
/// Struct to hold Polynomial
#[deri... |
use std::{
// TODO: make PR to cargo fmt to fix the following line to just `fs,`
fs::{self},
io::Read,
path::{Path, PathBuf},
process::{Command, Stdio},
};
use anyhow::{bail, Result};
use cargo_witgen::Witgen;
use clap::Parser;
use near_sdk_witgen::ImplVisitor;
use walrus::{Module, RawCustomSection... |
//! Data about the current session
//!
//! The F1 games provide information about the current session, for example weather and temperature
//! as well as settings like the type of safety car in use.
use std::time::Duration;
use derive_new::new;
use getset::{CopyGetters, Getters};
use crate::packet::header::Header;
u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.