text stringlengths 3.09k 13.9k |
|---|
use std::{collections::HashMap, fmt::Debug};
use toposort_scc::IndexGraph;
use crate::{
frontend::{make_nonempty, parser, Arg, Binop, Cmp, Declaration, Expr, Function},
jit, sarus_std_lib,
validator::ExprType,
};
#[derive(Debug, Clone)]
pub struct Node {
pub func_name: String,
pub port_defaults: ... |
use std::array::TryFromSliceError;
use std::fs::{self, File};
use std::io::Write;
use anyhow::Context;
use hyper::body::HttpBody;
use hyper::{Body, Request, Response, Uri};
// TODO: Start using tokio file IO again once we fix .write_all()
// use tokio::fs::File;
// use tokio::io::AsyncWriteExt;
use thiserror::Error;... |
#![no_std]
#![no_main]
mod blob;
mod draw;
mod hangman;
mod invaders;
mod life;
mod mathemagic;
mod maze;
mod memory;
mod system;
mod tanks;
mod wordsearch;
#[cfg(feature = "music")]
mod music;
use cortex_m_rt::entry;
use log::info;
use picosystem::display::{Display, HEIGHT, WIDTH};
use picosystem::fps_monitor::FpsM... |
// Copyright 2019 The Gotts Developers
//
// 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 agre... |
use std::fs::File;
use std::io::BufReader;
use chrono::{ DateTime, Duration, Local };
use serde::Deserialize;
use crate::{
Error,
Result,
};
use super::{ Announcer, AnnouncementCriteria };
const DATA: &str = "drakeema-data/contents/periodic_contents.json";
#[derive(Debug, Clone, Deserialize)]
pub struct PeriodicCon... |
use std::collections::HashMap;
use geom::{HashablePt2D, Polygon, Time};
use sim::Problem;
use widgetry::mapspace::ToggleZoomed;
use widgetry::{EventCtx, GfxCtx, Outcome, Panel, Toggle, Widget};
use crate::app::App;
use crate::layer::{header, problems, Layer, LayerOutcome, PANEL_PLACEMENT};
pub struct RelativeProblem... |
use dqcsim::{
common::{log::tee_file::TeeFileConfiguration, log::*},
host::configuration::*,
};
/// Structure containing the NONfunctional options for a plugin, i.e. the
/// options that only affect how the plugin represents its output.
///
/// This differs from `PluginProcessNonfunctionalConfiguration` in tha... |
use std::pin::Pin;
use futures_channel::mpsc;
use futures_core::{
stream::Stream,
task::{Context, Poll},
};
use futures_sink::Sink;
use futures_util::{sink::SinkExt, stream::StreamExt};
use pin_project::pin_project;
use tokio::sync::Mutex;
use tower_service::Service;
use tracing::info;
use crate::*;
use commo... |
//! A `TextChunk` implementation for borrowed string slices (`&str`) that knows
//! what position in its original source string it is at. This is useful for
//! zero-copy parsing of in-memory UTF-8 strings.
use core::str::CharIndices;
use core::iter::{self, Peekable, Map, Zip, Repeat, Enumerate};
use crate::text;
us... |
use crate::{
conversion::to_u32,
environment::Environment,
memory::{validate_region, Region},
static_analysis::ExportInfo,
BackendApi, CommunicationError, CommunicationResult, Querier, Storage, VmError, VmResult,
};
use parity_wasm::elements::FunctionType;
use wasmer::{Array, HostFunction, Instance ... |
mod jmespath;
use crate::awssdk::awssdk::{Api, ResolvedInput, Shape};
use crate::awssdk::load_and_parse_service;
use crate::parser::jmespath::{parse_jmespath_query, JmespathQuery};
use crate::text::{capitalize, kebab_to_camel_case, kebab_to_pascal_case};
use std::collections::HashMap;
static AWS_COMMAND: [&str; 2] = ... |
use crate::page::Renderer;
use crate::utils::{px, AttributeSet, StyleSet};
use color_eyre::Result;
use onenote_parser::contents::{List, OutlineElement};
use onenote_parser::property::common::ColorRef;
const FORMAT_NUMBERED_LIST: char = '\u{fffd}';
impl<'a> Renderer<'a> {
pub(crate) fn render_list<'b>(
&mu... |
mod ui;
use std::collections::BTreeSet;
use abstio::MapName;
use abstutil::Timer;
use geom::{Duration, Time};
use map_gui::tools::compare_counts::CompareCounts;
use map_model::{Path, PathConstraints, PathRequest, Pathfinder, RoadID};
use synthpop::{Scenario, TrafficCounts, TripEndpoint, TripMode};
use widgetry::Event... |
use chrono::prelude::*;
use chrono_tz::Asia::Tokyo;
use chrono_tz::Tz;
use futures::stream::*;
use scraper::{Html, Selector};
use serde::{Deserialize, Serialize};
use crate::cli::Args;
#[derive(Clone, Debug)]
pub enum LiveStreamStatus {
Ended,
Live,
Upcoming,
}
#[derive(Clone, Debug)]
pub struct Holodule... |
#[derive(Ord, PartialOrd, Eq, PartialEq, Debug, Copy, Clone)]
pub enum Window {
Lower,
Upper,
}
#[derive(Eq, PartialEq, Debug, Copy, Clone)]
pub struct TextStyle(pub u16);
impl TextStyle {
pub fn new(flags: u16) -> TextStyle {
TextStyle(flags)
}
pub fn roman(self) -> bool {
self.0 ... |
use std::collections::HashMap;
use std::fs::{self, DirBuilder};
use std::path::{Path, PathBuf};
use crate::error::Error;
use crate::helpers;
use crate::Object;
use crate::Result;
use crate::modify_toml_table;
/// A struct holding the common export options.
#[derive(Debug, Clone)]
pub struct ExportOptions {
stric... |
///! Different `Read` wrappers, useful for file uploading.
///! These can be composed to combine their effects
use bytes::Bytes;
use futures::{ready, Stream, TryStreamExt};
use pin_project::pin_project;
use sha1::Sha1;
use std::io::Error as IoError;
use std::pin::Pin;
use std::task::{Context, Poll};
use std::time::Dura... |
use std::cmp::Ordering;
use std::convert::TryFrom;
use std::fmt::{self, Debug};
use itertools::Itertools;
use proctor::elements::{PolicyOutcome, TelemetryType, TelemetryValue, ToTelemetry};
use proctor::error::{DecisionError, TelemetryError};
use proctor::graph::stage::{self, ThroughStage};
use proctor::{AppData, Proc... |
// Copyright 2017 <NAME> (IRCAM)
// 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 wri... |
#![cfg_attr(feature = "cargo-clippy", allow(needless_range_loop, inline_always))]
use digest::{Input, BlockInput, FixedOutput, Reset};
use digest::generic_array::typenum::{Unsigned, U64};
use digest::generic_array::{GenericArray, ArrayLength};
use block_buffer::BlockBuffer;
use block_buffer::block_padding::ZeroPadding;... |
// run-pass
// We disable tail merging here because it can't preserve debuginfo and thus
// potentially breaks the backtraces. Also, subtle changes can decide whether
// tail merging succeeds, so the test might work today but fail tomorrow due to a
// seemingly completely unrelated change.
// Unfortunately, LLVM has no... |
//! `Spawn App` Receipt Raw Format Version 0
//!
//! On success (`is_success = 1`)
//! +-----------------------------------------------------+
//! | tx type | version | is_success | App Address |
//! | (1 byte) | | (1 byte) | (20 bytes) |
//! +___________|____________|_____________|________... |
use std::{
collections::HashMap,
sync::{
atomic::{AtomicU64, Ordering},
Arc,
},
};
use async_trait::async_trait;
use rpds::RedBlackTreeMapSync;
use tokio::sync::Mutex;
use crate::data::kv::{KeyValueStore, KvError, KvKeyIterator, KvTransaction};
use anyhow::Result;
/// A mocked KV store that simulates M... |
// Copyright 2019 MesaTEE Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to... |
/*
# Git Testing Support
## Creating a git dependency
`git::new()` is an easy way to create a new git repository containing a
project that you can then use as a dependency. It will automatically add all
the files you specify in the project and commit them to the repository.
Example:
```
let git_project = git::new("de... |
//! ASN.1 `ANY` type.
use crate::{
BitString, ByteSlice, Choice, Decodable, Decoder, Encodable, Encoder, Error, ErrorKind,
GeneralizedTime, Header, Ia5String, Length, Null, OctetString, PrintableString, Result,
Sequence, Tag, UtcTime, Utf8String,
};
use core::convert::{TryFrom, TryInto};
#[cfg(feature = "... |
use std::collections::HashMap;
use ash::{
vk,
Device,
Instance,
};
use ash::extensions::khr::{
Surface,
};
use crate::constants;
#[derive(Debug, Clone)]
pub struct QueueFamilyIndices {
pub _graphics_queue_index: u32,
pub _present_queue_index: u32,
pub _compute_queue_index: u32,
pub _t... |
// 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 in the LICENSE-APACHE file or at:
// https://www.apache.org/licenses/LICENSE-2.0
//! Wrapper around mutliple themes, supporting run-time swi... |
//! Handle JSON messages when writing to delta tables
use crate::writer::DeltaWriterError;
use arrow::{
array::{as_primitive_array, Array},
datatypes::{
DataType, Int16Type, Int32Type, Int64Type, Int8Type, Schema as ArrowSchema, UInt16Type,
UInt32Type, UInt64Type, UInt8Type,
},
json::rea... |
//! AssemblyScript string implementation.
use std::{
alloc::{self, Layout, LayoutErr},
fmt::{self, Debug, Formatter},
mem,
ops::Deref,
slice,
string::FromUtf16Error,
};
/// Internal representation of an AssemblyScript string.
///
/// AssemblyScript strings are length prefixed utf-16 strings. T... |
use proc_macro2::{Span, TokenStream};
use proc_macro_error::emit_error;
use quote::{quote, ToTokens};
use syn::spanned::Spanned;
use syn::visit_mut::VisitMut;
use syn::{
parse_quote, parse_quote_spanned, token, visit_mut, FnArg, GenericParam, Ident, Lifetime, Pat,
Receiver, ReturnType, Signature, Type, TypeImpl... |
use anyhow::{anyhow, bail, Result};
use chrono::{NaiveDate, Utc};
use derive_builder::Builder;
use select::document::Document;
use select::predicate::Class;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, PartialEq, Debug)]
pub struct Comic {
pub date: NaiveDate,
pub title: String,
pu... |
// 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.
//! A task that is run to process communication with an individual watcher.
use crate::{directory::watchers::event_producers::EventProducer, execution_sco... |
use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, Error, PartialEq)]
#[non_exhaustive]
pub enum Error {
#[error("raw is too small for a SCTP chunk")]
ErrChunkHeaderTooSmall,
#[error("not enough data left in SCTP packet to satisfy requested length")]
ErrChunkHead... |
use crate::game::*;
use ndarray::s;
use std::fmt;
use std::iter::FromIterator;
use ggpf_gym::*;
#[derive(Clone)]
/// OpenAI Gym game instance.
///
/// Each instance is connected to a remote runner. This is because of Rust limitations
/// somehow it's not possible to have both `tensorflow` and `pyo3` in the same cra... |
// Copyright 2018 First Rust Competition Developers.
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// ... |
use anyhow::*;
use futures::executor::block_on;
use std::io::Write;
use wgpu::util::{BufferInitDescriptor, DeviceExt};
use wgpux::Vertex;
#[repr(C)]
#[derive(Copy, Clone, Debug, Vertex)]
struct ColoredVertex {
position: [f32; 2],
color: [f32; 4],
}
unsafe impl bytemuck::Pod for ColoredVertex {}
unsafe impl by... |
// externs
//pub mod fix_parser;
//pub mod protocol;
// System allocator default from 1.32
//use std::alloc::System;
//#[global_allocator]
//static A: System = System;
use std::env;
use std::fs::File;
use std::io;
use std::io::{BufRead, BufReader, Write};
use std::iter::FromIterator;
use std::process::exit;
use std::... |
use crate::core::{
nvme::StatusCodeType::{
CommandSpecificStatus,
GenericCommandStatus,
MediaDataIntegrityErrors,
Reserved,
VendorSpecific,
},
Bio,
};
use spdk_sys::spdk_bdev_io_get_nvme_status;
#[derive(Debug, Copy, Clone, Eq, PartialOrd, PartialEq)]
pub enum Status... |
use crate::{
ark_std::string::ToString,
poseidon::sbox::PoseidonSbox,
utils::{from_field_elements, to_field_elements},
};
use ark_crypto_primitives::Error;
use ark_ff::{fields::PrimeField, BigInteger};
use ark_serialize::Read;
use ark_std::{error::Error as ArkError, rand::Rng, vec::Vec};
pub mod sbox;
#[derive(Deb... |
#![allow(clippy::needless_lifetimes)]
use crate::token::{TokenKind, Tokens};
use serde::Deserialize;
use std::fmt;
use std::io;
#[derive(Debug)]
pub struct Expr {
pub collection: String,
pub oper: Oper,
}
#[derive(Debug)]
pub enum Oper {
Find {
doc: Option<String>,
proj: Option<String>,
... |
//! Wrapper for enums introduced in C.
use std::{convert::TryFrom, fmt::Display};
use crate::{
bindings::{
IS_ARRAY, IS_CALLABLE, IS_CONSTANT_AST, IS_DOUBLE, IS_FALSE, IS_LONG, IS_MIXED, IS_NULL,
IS_OBJECT, IS_PTR, IS_REFERENCE, IS_RESOURCE, IS_STRING, IS_TRUE, IS_UNDEF, IS_VOID,
_IS_BOOL,... |
//! Algorithm implementation for finding winner of the Connect6.
//!
//! Algorithm finds the continuous 6 stones on 4 directions, vertical, horizontal, two diagonals.
//! Use dynamic programming to implement algorithm and swaping memories to obtain the memory efficiency.
//!
//! # Examples
//! ```rust
//! # extern crat... |
use super::{Type, Value};
use crate::types::{FromSqlError, FromSqlResult};
use rust_decimal::prelude::*;
/// An absolute length of time in seconds, milliseconds, microseconds or nanoseconds.
/// Copy from arrow::datatypes::TimeUnit
#[derive(Copy, Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum TimeUnit ... |
//! This file implements a test that launches a simple echo server, which is then used for roundtrip
//! tests with different types of values, including custom structs.
use std::collections::HashMap;
use std::time::Duration;
use dxr::axum::http::HeaderMap;
use dxr::chrono::{DateTime, SubsecRound, Utc};
use dxr::{Call... |
// Copyright 2020 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
use crate::account::Account;
use std::{collections::HashMap, env, fs::OpenOptions, io::Write};
use bech32::ToBase32;
use blake2::{
digest::{Update, VariableOutput},
VarBlake2b,
};
use dialoguer::Confirm;
use hmac::Hmac;
use iota::{common:... |
/// This needs to be booted in a TTY terminal to work
extern crate framebuffer;
use framebuffer::{Framebuffer, KdMode};
use std::time::Instant;
use aftershock::rasterizer::*;
use aftershock::color::*;
use aftershock::drawables::*;
use aftershock::image::*;
use aftershock::font::*;
use aftershock::vector2::*;
pub s... |
use core::marker::PhantomData;
/**
A marker trait that is used to represent unique type in Rust.
`mononym` guarantees that any two `impl Name` generated by
the library are always considered distinct types by Rust.
This is mainly used as a type parameter inside types such as
[`Seed`]. For example, the type `impl ... |
use fltk::frame::*;
use fltk::image::*;
use fltk::{enums::*, prelude::*};
use std::cell::RefCell;
use std::ops::{Deref, DerefMut};
use std::rc::Rc;
const POWER: &str = r#"<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg vers... |
use assignment_2_solution::{
run_register_process, serialize_register_command, ClientCommandHeader, ClientRegisterCommand,
ClientRegisterCommandContent, Configuration, PublicConfiguration, RegisterCommand, SectorVec,
MAGIC_NUMBER,
};
use assignment_2_test_utils::system::*;
use hmac::{Mac, NewMac};
use ntest... |
mod abi;
use self::abi::{MemberAddedFilter, Semaphore};
use crate::ethereum::{Ethereum, EventError, ProviderStack};
use core::future;
use ethers::{
providers::Middleware,
types::{Address, U256},
};
use eyre::{eyre, Result as EyreResult};
use futures::{Stream, StreamExt, TryStreamExt};
use semaphore::Field;
use... |
use anyhow::{anyhow, bail, Context, Result};
use serde_derive::Deserialize;
use serde_json::{json, Value as JsonValue};
#[derive(Deserialize, Debug)]
pub struct QueueInfo {
pub name: String,
pub state: String,
pub stat: QueueStat,
}
#[derive(Deserialize, Debug)]
pub struct QueueStat {
pub stat_type: S... |
#[inline]
fn is_digit(val: u8) -> bool {
b'0' <= val && val <= b'9'
}
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub enum NumberError {
LeadingZero,
NegativeZero,
InvalidByte,
Overflow,
Truncated,
Trailing,
}
#[derive(Copy, Clone, Eq, PartialEq)]
enum NumberState {
Initial,
Negat... |
use {
anyhow::Result,
crate::{
pos::{
Dir,
Pos,
PosArea,
PosMap,
},
},
std::{
ops::Range,
},
super::{
Actor,
ActorKind,
ActorState,
},
};
/// a non nullable id of an actor, for use in the
/// ac... |
/*!
Utilities for const contexts.
*/
use crate::std_types::StaticStr;
use std::{
marker::PhantomData,
};
use core_extensions::prelude::*;
pub use abi_stable_shared::const_utils::{
low_bit_mask_u64,
};
//////////////////////////////////////////////////////////////////
// Used to test trait bounds in proc... |
// 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... |
// =======================================================================
// Copyleft SnowFlakeOS Team 2018-∞.
// Distributed under the terms of the 3-Clause BSD License.
// (See accompanying file LICENSE or copy at
// https://opensource.org/licenses/BSD-3-Clause)
// ==============================================... |
use std::borrow::Cow;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
use thiserror::Error;
use tokenizers::{EncodeInput, Encoding, InputSequence, Tokenizer};
use wonnx::utils::Shape;
use crate::Tensor;
#[derive(Error, Debug)]
pub enum PreprocessingError {
#[error("text tokenization err... |
use crate::arch::riscv::qemu::fs::{ BSIZE, MAXOPBLOCKS };
use crate::arch::riscv::qemu::param::NDEV;
use crate::lock::spinlock::Spinlock;
use crate::lock::sleeplock::SleepLock;
use crate::process::CPU_MANAGER;
use super::pipe::Pipe;
use super::inode::Inode;
use super::devices::DEVICE_LIST;
use super::stat::Stat;
use su... |
//! A button that allows for toggling boolean state.
use crate::{Borderable, Color, Colorable, FontSize, Labelable, Scalar};
use crate::position::{self, Align};
use crate::text;
use crate::widget;
/// A pressable widget for toggling the state of a bool.
///
/// Like the Button widget, it's reaction is triggered upon ... |
use std::fmt;
use std::fs::File;
use std::io::{self, Read};
use std::net::{IpAddr, SocketAddr};
use bgp_rs::{AFI, SAFI};
use ipnetwork::IpNetwork;
use serde::{self, Deserialize, Deserializer, Serialize, Serializer};
use toml;
use crate::api::rpc::{FlowSpec, RouteSpec};
use crate::rib::Family;
struct Defaults {}
imp... |
//! Utilities for emulating HKTs (over lifetimes) in Rust.
use std::mem;
use std::ops::{Deref, DerefMut};
/// Type lambda application, with a lifetime.
pub trait ApplyL<'a> {
type Out;
}
/// Type lambda taking a lifetime, i.e. `Lifetime -> Type`.
pub trait LambdaL: for<'a> ApplyL<'a> {}
impl<T: for<'a> ApplyL<'... |
use hyper::Method;
use hyper::{Body, Request, Response, StatusCode};
use regex::{Regex, RegexSet};
use smallvec::SmallVec;
pub use error::Error;
mod error;
pub type Captures<'r> = Option<SmallVec<[&'r str; 4]>>;
type RouteHandler = Box<dyn Fn(Request<Body>, Captures) -> Response<Body> + Send + Sync>;
/// The Router... |
//
//
// This file is a part of Aleph
//
// https://github.com/nathanvoglsam/aleph
//
// MIT License
//
// Copyright (c) 2020 Aleph Engine
//
// 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 Softwar... |
// Copyright 2020 <NAME>. All rights reserved.
// Copyright (C) 2021 Alibaba Cloud. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0
//! A dummy implementation of the [BlobCacheMgr](trait.BlobCacheMgr.html) trait.
//!
//! The [DummyCacheMgr](struct.DummyCacheMgr.html) is a dummy implementation of the
//!... |
mod interpreter;
mod program;
pub use interpreter::Interpreter;
pub use program::{Program, ProgramError};
use image::{Pixel, Rgb};
use std::convert::TryFrom;
use std::error::Error;
use std::fmt;
use std::fmt::{Debug, Display, Formatter};
#[derive(Debug, Clone, Copy, PartialEq)]
enum Color {
Chromatic(ChromaticCo... |
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use rate_limiter::{RateLimiter, TokenBucket};
use std::io;
/// Wrapper for configuring the microVM boot source.
pub mod boot_source;
/// Wrapper for device configurations.
pub mod device_config;
/// Wrapp... |
// Copyright 2015 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... |
use maat_graphics::DrawCall;
use maat_graphics::cgmath::{Vector2, Vector4, Zero};
use crate::modules::world_generation::{EnviromentSquare, TreeEnviroment, CityEnviroment,
DesertEnviroment, IceEnviroment};
use crate::modules::entity::{GenericEntity, Player};
use ... |
// Copyright 2020 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
use super::beacon_entries::BeaconEntry;
use ahash::AHashMap;
use async_std::sync::RwLock;
use async_trait::async_trait;
use bls_signatures::{PublicKey, Serialize, Signature};
use byteorder::{BigEndian, WriteBytesExt};
use clock::ChainEpoch... |
use cgmath::Point2;
use ggez::event::{KeyCode, KeyMods};
use ggez::graphics::{self, Canvas, DrawParam, Text};
use ggez::{timer, Context, GameResult};
use image_convert::frame_to_surface;
use scene::{BoxedScene, Scene, SceneChangeEvent, SceneName};
use std::cmp;
use std::fs::File;
use std::io::Result;
use std::path::Pat... |
use std::{
env,
fs::{self, OpenOptions},
io::Write,
mem,
path::PathBuf,
};
use chrono::Local;
use ggez::{
conf::WindowMode,
event::{self, ErrorOrigin, EventHandler, KeyCode, KeyMods},
graphics::{self, Color},
Context, ContextBuilder, GameError, GameResult,
};
use crate::{
cons... |
use failure::Error;
use flat_projection::{FlatProjection, FlatPoint};
use ord_subset::OrdSubsetIterExt;
cfg_if! {
if #[cfg(feature = "rayon")] {
use rayon::slice;
use rayon::prelude::*;
fn opt_par_iter<T: Sync>(x: &[T]) -> slice::Iter<T> {
x.par_iter()
}
fn opt... |
use udfs::block::Block;
use udfs::config;
use udfs::config::Config;
use udfs::datanode::DataNode;
use udfs::error::Result;
use udfs::proto;
use udfs::utils::proto_utils;
use prost::Message;
use tempdir::TempDir;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpStream;
use tokio::sync::oneshot;
use to... |
use std::{
collections::HashMap,
convert::TryInto,
fs::{self, OpenOptions},
io::{BufWriter, Read, Seek, SeekFrom, Write},
path::{Path, PathBuf},
};
use fastcdc::FastCDC;
use crate::{error::Error, Manifest};
use super::{Chunk, ChunkProvider, Operation, SyncPlan, AVG_CHUNK, MAX_CHUNK, MIN_CHUNK};
... |
use std::collections::HashMap;
use std::io::{stdin, stdout, Write};
use bodhi::{Karma, Update};
use chrono::{DateTime, Utc};
use crate::output::{print_update, proper_plural};
/// This struct represents the user's progress through the list of installed updates.
#[derive(Debug)]
pub struct Progress {
update_no: us... |
//! Low-level bindings to API-specific functions for interfacing with foreign controls on Windows.
#![allow(non_camel_case_types, non_snake_case)]
use libc::{c_char, c_int, c_long, c_ulong, c_uint, c_ushort, c_void, intmax_t, size_t, wchar_t};
use uiControl;
#[repr(C)]
pub struct uiWindowsControl {
pub c: uiCont... |
// 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... |
// Copyright 2020 <NAME> <<EMAIL>> and collaborators
// Licensed under the MIT License.
//! Information about a single project within the repository.
//!
//! Here, a project is defined as something that’s assigned version numbers.
//! Many repositories contain only a single project, but in the general case
//! (i.e., ... |
//! A wrapper for the CLI tool pg_basebackup
//!
//! This is used to generate backup files from a running Postgres database
//! https://www.postgresql.org/docs/12/app-pgbasebackup.html
const APP_NAME: &str = "pg_basebackup";
const MODULE_VERSION: &'static str = env!("CARGO_PKG_VERSION");
use super::*;
use anyhow::{Co... |
use std::time::Duration;
use instant::Instant;
use rand;
use crate::default;
use crate::backoff::Backoff;
use crate::clock::Clock;
#[derive(Debug)]
pub struct ExponentialBackoff<C> {
/// The current retry interval.
pub current_interval: Duration,
/// The initial retry interval.
pub initial_interval:... |
// universe.rs
// holds the definition of the universe,
// where all cells will develop.
//
// by ltabis
extern crate piston_window;
use std::{ vec::Vec, time::Instant };
use piston_window::*;
use super::cell::{ Cell, CellState, CELL_SIZE };
const DEFAULT_PLAYGROUND_X_SIZE: u32 = 40;
const DEFAULT_PLAYGROUND_Y_SIZE... |
use crate::data::{Primitive, Value};
use crate::prelude::*;
use crate::traits::{DebugDocBuilder as b, PrettyDebug};
use derive_new::new;
use getset::Getters;
use indexmap::IndexMap;
use pretty::{BoxAllocator, DocAllocator};
use serde::{Deserialize, Serialize};
use std::cmp::{Ordering, PartialOrd};
#[derive(Debug, Defa... |
// Copyright 2020 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
extern crate rustc_serialize;
extern crate docopt;
extern crate memmap;
#[cfg(not(windows))]
extern crate nix;
use std::process::exit;
use docopt::Docopt;
#[cfg(not(windows))]
use nix::unistd::{fork, ForkResult};
const USAGE: &'static str = "
Rmate client written in Rust.
Usage:
rmate [--host=<H> --port=<P> -w] <n... |
use crate::vfs::file_like::FileLike;
use crate::vfs::vfs_header::{header_from_bytes, ArchiveType, CompressionType};
use crate::vfs::virtual_file::VirtualFile;
use std::collections::HashMap;
use std::cell::RefCell;
use std::io;
use std::io::Read;
use std::path::{Path, PathBuf};
use std::rc::Rc;
use tar::EntryType;
use z... |
#[macro_use]
extern crate clap;
extern crate chrono;
extern crate chrono_humanize;
#[macro_use]
extern crate failure;
extern crate pager;
use clap::{App, AppSettings, Arg, ArgMatches, SubCommand};
use pager::Pager;
use reqwest::blocking::{ClientBuilder, Response};
use std::fmt;
use crate::crates::CratesResp;
mod cra... |
use hirofa_utils::js_utils::{JsError, Script, ScriptPreProcessor};
use std::sync::Arc;
use swc::Compiler;
use swc::config::util::BoolOrObject;
use swc::config::{Config, IsModule, JsMinifyOptions, ModuleConfig, TerserSourceMapOption};
use swc::ecmascript::ast::EsVersion;
use swc_common::errors::{ColorConfig, Handler};
... |
use arc_swap::ArcSwap;
use async_trait::async_trait;
use itertools::Itertools;
use once_cell::sync::OnceCell;
use rayon::iter::ParallelIterator;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use smartstring::alias::CompactString;
use std::{borrow::Cow, sync::Arc};
use tap... |
use std::marker::PhantomData;
use specs::{storage::ComponentEvent, world::Index, Join, ReadStorage, ReaderId, System, SystemData, WriteExpect, WriteStorage, World};
use crate::{colliders::PhysicsCollider, pose::Pose, Physics, PhysicsParent, PhysicsWorld};
use nalgebra::RealField;
use nphysics::object::{BodyPartHandle... |
// 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 {
failure::{bail, Error, ResultExt},
fdio::{SpawnAction, SpawnOptions},
fidl::endpoints::{ClientEnd, ServerEnd},
fidl_fuchsia_io::{Direc... |
/// Attribute in a tag.
pub struct Attrib {
/// attribute name.
name: String,
/// attibute value.
val: String,
}
impl Attrib {
/// Returns Attrib.
///
/// # Arguments
/// * `nm` - attribute name.
/// * `val` - attribute value.
pub fn new(nm: &str, val: String) -> Attrib {
... |
//! An implementation of the [`Groth16`] zkSNARK.
//!
//! [`Groth16`]: https://eprint.iacr.org/2016/260.pdf
#![cfg_attr(not(feature = "std"), no_std)]
#![warn(unused, future_incompatible, nonstandard_style, rust_2018_idioms)]
#![allow(clippy::op_ref, clippy::suspicious_op_assign_impl)]
#![cfg_attr(not(use_asm), forbid(... |
use std::vec::Vec;
use regex::Regex;
use matching::*;
use files::*;
use tokens::*;
use support::*;
pub fn get_token_types<'a>() -> Vec<(&'a str, &'a str)>
{
// TODO: Read types from rules file
let mut token_types: Vec<(&str, &str)> = Vec::new();
token_types.push(("comment.line", r"//[^\n]*"));
... |
//! Utilities to shuffle [`Array`] content.
use itertools::Itertools;
use smallvec::SmallVec;
use super::*;
use crate::for_all_variants;
/// Transform an [`Array`] to `Vec<Option<Item>>`.
pub trait ArrayToVecExt: Array {
/// Transform an [`Array`] to `Vec<Option<Item>>`.
///
/// ```
/// use risinglig... |
use std::collections::{hash_map::Entry, HashMap};
use rocket::{
fairing::AdHoc,
http::{
hyper::header::{ACCESS_CONTROL_ALLOW_ORIGIN, HOST},
Header, Status,
},
request::{FromRequest, Outcome},
response::Redirect,
tokio::{sync::Mutex, time::Instant},
Request, State,
};
struct... |
extern crate libc;
use libc::{c_char, c_float, c_int, c_uchar, c_void};
use std::ptr;
use std::slice::from_raw_parts;
use std::fmt::{Debug, Error, Formatter};
extern crate serde;
use serde::ser::{Serialize, Serializer};
use serde::de::{Deserialize, Deserializer};
/// Wrapper type for a pointer to an FSA object in `O... |
// Copyright 2018 <NAME>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those... |
use std::convert::TryInto;
use std::net::Ipv6Addr;
use pnet_packet::icmpv6::{self, Icmpv6Code, Icmpv6Type};
use pnet_packet::Packet;
use pnet_packet::PacketSize;
use crate::error::{MalformedPacketError, Result, SurgeError};
#[allow(dead_code)]
pub fn make_icmpv6_echo_packet(ident: u16, seq_cnt: u16, size: usize) -> ... |
// This file is part of Substrate.
// Copyright (C) 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
//
// http://... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.