text stringlengths 3.09k 13.9k |
|---|
use parquet2::{
encoding::Encoding,
read::{
levels::{get_bit_width, split_buffer_v1, split_buffer_v2, RLEDecoder},
Page, PageHeader,
},
types::NativeType,
};
use super::super::nested_utils::extend_offsets;
use super::ColumnDescriptor;
use super::{super::utils, utils::ExactChunksIter, Ne... |
use super::{IdTimestamp, SourceType};
use crate::{error, gql};
use chrono::prelude::*;
use juniper::{GraphQLEnum, GraphQLObject};
use lazy_static::lazy_static;
use regex::Regex;
use serde::{Deserialize, Serialize};
use slog::{debug, info};
use snafu::ResultExt;
use sqlx::{
postgres::{PgQueryAs, PgRow},
row::{Fr... |
use sdl2::pixels::Color;
use nalgebra as na;
use na::{Vector3, Vector4, Unit};
use image::Pixel;
use crate::physics;
use physics::*;
use super::*;
#[derive(Clone)]
pub struct SchwarzschildRaytracing {
pos: Vector3<f64>,
dir: Unit<Vector3<f64>>,
up: Unit<Vector3<f64>>,
near: f64,
fovy: f64,
... |
mod mutaction_executor;
mod read;
mod resolver;
mod write;
use crate::{Connection, TransactionalExecutor};
use chrono::{DateTime, Utc};
use connector::*;
use prisma_models::prelude::*;
use r2d2_sqlite::SqliteConnectionManager;
use rusqlite::{Row, Transaction, NO_PARAMS};
use std::{collections::HashSet, env};
use uuid:... |
//! This example shows the pubsub pattern in action with thespis-remote.
//! We will have Alice and Bob listening to message from Carol.
//!
//! Note that PubSub is a specific for relays. You can of course have a specific
//! node that clients can subscribe to and then you send out messages to all of
//! them. However ... |
#[cfg(unix)]
mod os {
use crate::posix;
use std::fs::File;
use std::io::{Read, Write, Result as IoResult};
use std::os::unix::io::AsRawFd;
use std::cmp::min;
fn poll3(fin: Option<&File>, fout: Option<&File>, ferr: Option<&File>)
-> IoResult<(bool, bool, bool)> {
fn to_poll(... |
use super::helper::fixture_shapes;
use geo::{Coordinate, Rect};
use geo_booleanop::boolean::compare_segments::compare_segments;
use geo_booleanop::boolean::fill_queue::fill_queue;
use geo_booleanop::boolean::possible_intersection::possible_intersection;
use geo_booleanop::boolean::subdivide_segments::subdivide;
use geo... |
//! Postgres database code
//!
//! TODO: can we prepare statements? investigate how this'd work with Rocket
use std::time::{Duration, SystemTime};
use crate::{
error::{ErrorKind, InternalError},
poll::*,
};
#[cfg_attr(test, database("test_db"))]
#[cfg_attr(not(test), database("production_db"))]
pub struct Po... |
use crate::{
error::{Error, Result},
secret::SecretPath,
};
use std::{convert::TryFrom, fmt::Display};
/// States of finite state machine for parsing secretpath
enum Pos {
Backend,
Args,
Path,
}
/// Iterator, that returns the 3 successives slices separated by a colon from an expression
/// backend:args:path. ba... |
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use vtok_common::config::Config;
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use super::{Session, Slot, Token};
use crate::defs;
use crate::pkcs11;
use crate::{Error, Result};
/// The ro... |
//! Over-the-wire messages for the file transfer (including transit)
//!
//! The transit protocol does not specify how to deliver the information to
//! the other side, so it is up to the file transfer to do that. hfoo
use crate::transit::{self, Ability, DirectHint};
use serde_derive::{Deserialize, Serialize};
#[cfg(t... |
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
use fnv::FnvHasher;
use std::collections::hash_map::DefaultHasher;
use std::hash::Hasher;
use twox_hash::XxHash64;
fn default_hash(entity: &str) -> u64 {
let mut hasher = DefaultHasher::new();
hasher.write(entity.as_bytes());
... |
use futures_util::StreamExt;
use reqwest;
use roxmltree;
use serde::{Deserialize, Serialize};
use std::cmp::min;
use std::error::Error;
use std::fs::File;
use std::io::{self, Cursor, Write};
use std::path::Path;
use tauri::api::path::download_dir;
use tauri::Manager;
use std::time::Duration;
#[derive(Serialize, Deseri... |
#![cfg_attr(not(feature = "std"), no_std)]
/// Eddispatch::{self, DispatchResultWithPostInfo}o pallet_prelude:: * s not needed.
/// }arn more about FRAME
//and the core library of Substrate FRAME pallets:
/// <https://substrate.dev/docs/en/knowledgebase/runtime/frame>
pub use pallet::*;
#[cfg(test)]
mod mock;
#[cfg(... |
//! Parser for the [ktx2](https://github.khronos.org/KTX-Specification/) texture container format.
//!
//! ## Features
//! - [x] Async reading
//! - [x] Parsing
//! - [x] Validating
//! - [ ] [Data format description](https://github.khronos.org/KTX-Specification/#_data_format_descriptor)
//! - [ ] [Key/value data](http... |
// Copyright 2017 <NAME> aka. Luxko
//
// 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 accordi... |
// Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors
// SPDX-License-Identifier: MIT
use std::fs::File;
use std::io::BufRead;
use std::path::Path;
use std::{collections::HashMap, convert::TryFrom};
use std::{env, io};
use itertools::Itertools;
use lazy_static::lazy_static;
use crypto::hash::{Block... |
use cv_core::FeatureMatch;
use eyre::{eyre, Result};
use itertools::Itertools;
use na::Const;
use nalgebra::{self as na, Matrix3, SMatrix};
type Point2 = na::Point2<f64>;
use derive_more::{AsMut, AsRef, Deref, DerefMut, Display, From, Into};
use sample_consensus::{Estimator, Model};
#[derive(
Debug, Clone, Copy, P... |
#[cfg(not(feature = "pong"))]
fn main() {
panic!("Pong needs feature pong enabled: `cargo r --example pong --features pong`")
}
#[cfg(feature = "pong")]
mod pong {
use ggez::{
event::{self, EventHandler, KeyCode, KeyMods},
graphics::{self, DrawMode, DrawParam, FilterMode, Mesh, MeshBuilder, Rec... |
// Copyright 2012-2016 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... |
use std::collections::HashMap;
use std::fs::File;
use std::io::{self, BufReader, Error};
use std::io::prelude::*;
use std::path::PathBuf;
use crate::checker;
use std::process;
pub fn parse_csv(path: &str, dryrun: bool) -> HashMap<PathBuf, PathBuf> {
let file = File::open(path).unwrap();
let buff = BufReader::... |
use super::key::SecretKey;
use super::params::{tlwe, trgsw};
use super::tlwe::{CipherTLWELv0, CipherTLWELv1};
use super::trgsw::{cmux, TRGSWMatrix, TRGSW};
use super::trlwe::{sample_extract_index, CipherTRLWE, TRLWE};
use super::util::rotate_ring;
const N: usize = trgsw::N;
const L: usize = trgsw::L;
const NBIT: usize... |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
use super::datagram::{UdpDatagram, UdpDatagramDecoder, UdpDatagramEncoder};
use crate::{
prelude::*,
protocols::{arp, icmpv4, ip, ipv4},
r#async::WhenAny,
};
use fxhash::FxHashSet;
use std::{
cell::RefCell, convert::TryFrom, net... |
use crate::constants::TYPENAME_FIELD;
use crate::objects::GqlObjectField;
use crate::query::QueryContext;
use crate::selection::{Selection, SelectionField, SelectionFragmentSpread, SelectionItem};
use crate::shared::*;
use crate::unions::union_variants;
use failure::*;
use proc_macro2::{Ident, Span, TokenStream};
use q... |
use std::ops::{Index, IndexMut};
mod graph_separation;
mod pos;
pub use self::graph_separation::*;
pub use self::pos::*;
#[derive(Debug, Clone)]
pub struct Grid<T: Clone> {
height: i32,
width: i32,
data: Vec<T>,
}
impl<T: Clone> Grid<T> {
pub fn new(height: i32, width: i32, default: T) -> Grid<T> {
... |
#![doc(test(attr(deny(warnings))))]
#![warn(missing_docs)]
#![forbid(unsafe_code)]
// We have Arc<Box<dyn ...>>. It is redundant allocation from a PoV, but arc-swap needs
// Arc<S: Sized>, so we don't have much choice in that matter.
#![allow(clippy::redundant_allocation)]
//! Crate to reroute logging messages at runt... |
// Copyright (c) The diem-devtools Contributors
// SPDX-License-Identifier: MIT OR Apache-2.0
use crate::{
cargo_cli::{CargoCli, CargoOptions},
output::{OutputContext, OutputOpts},
};
use camino::{Utf8Path, Utf8PathBuf};
use color_eyre::eyre::{bail, Result, WrapErr};
use guppy::{graph::PackageGraph, MetadataCo... |
use std::collections::HashMap;
use std::collections::VecDeque;
use std::env;
use std::fmt;
use std::fs;
#[derive(Clone, Copy, Eq, PartialEq, Hash, Debug)]
enum Tile {
Entrance,
Wall,
Passage,
Key(u8),
Door(u8),
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
struct Node {
p: geom::Point2,
t... |
//! This manages how generated files are saved as references.
//! When new or changed files are generated a save ref is saved on disk which will allow a future
//! execution of the 'origen save_ref' command to determine the source and destination of the file
//! to be saved as a the new reference version.
//! Save refs... |
use std::fmt::{Display, Formatter, Result};
use crate::{location::model::Location, units::Units, weather::model::Weather};
#[derive(Clone, Debug)]
pub struct Info<'a> {
location: &'a Location,
weather: &'a Weather,
units: Units,
verbose: bool,
}
impl<'a> Info<'a> {
pub fn new(location: &'a Locati... |
use crate::Mp4Box;
use crate::mp4box::*;
use serde::{Serialize};
use crate::mp4box::vpcc::VpccBox;
#[derive(Debug, Clone, PartialEq, Default, Serialize)]
pub struct Vp09Box {
pub version: u8,
pub flags: u32,
pub start_code: u16,
pub data_reference_index: u16,
pub reserved0: [u8; 16],
pub width:... |
//! Support for generating R1CS witness using bellperson.
use crate::traits::Group;
use ff::PrimeField;
use bellperson::{
multiexp::DensityTracker, ConstraintSystem, Index, LinearCombination, SynthesisError, Variable,
};
/// A `ConstraintSystem` which calculates witness values for a concrete instance of an R1CS ci... |
#[macro_use]
extern crate log;
use special_fun::FloatSpecial;
use std::collections::VecDeque;
use std::f64;
#[derive(Clone, Debug)]
pub struct PhiFailureDetector {
min_stddev: f64,
history_size: usize,
buf: VecDeque<u64>,
prev_heartbeat: Option<u64>,
}
impl PhiFailureDetector {
pub fn new() -> Ph... |
use proc_macro2::Span;
use syn::spanned::Spanned;
use syn::{Attribute, BinOp, Expr, ExprAssign, ItemFn};
/// enumeration that names all the standard assertions that can
/// be handled with this crate
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum StandardLibraryAssertion {
/// the assertion `assert_eq!`
Ass... |
day!(
day10,
"https://adventofcode.com/2018/day/10/input",
part1,
part2
);
use crate::vec2::{AabbIteratorEx, Vec2i};
use regex::Regex;
use std::str::FromStr;
#[derive(Debug, Clone, Eq, PartialEq)]
struct Point {
position: Vec2i,
velocity: Vec2i,
}
impl FromStr for Point {
type Err = Error... |
use gtk;
use gtk::prelude::*;
use relm_attributes::widget;
use crate::widgets::calendar::Msg::Updated as CalendarUpdated;
use crate::widgets::keywords::Msg::Updated as KeywordsUpdated;
use crate::widgets::priority::Msg::Updated as PriorityUpdated;
use crate::widgets::repeat::Msg::Updated as RepeatUpdated;
use crate::wi... |
use super::geometry::Rect;
use std::marker::PhantomData;
pub struct Texture {
data: Vec<u8>,
width: u32,
height: u32,
}
pub struct TextureViewAllocator {
data: *mut [u8],
width: u32,
height: u32,
free_space: Vec<Rect<u32>>,
}
pub struct TextureView {
data: *mut [u8],
view: Rect<u3... |
//! # Collection Module
//!
//! - [`Config`]
//! - [`Call`]
//!
//! Collection is used to represent a series of NonFungible or Fungible Tokens,
//! which can also be understood as a folder. It is one of the basic modules.
//!
//! ## Interface
//!
//! ### Dispatchable Functions
//!
//! * `create_collection` - Create a c... |
use std::fs::File;
use std::io::{BufRead, BufReader};
use regex::Regex;
type MemoryPointer = u64;
type Value = u64;
// -------------------- Mask --------------------
struct MaskValue {
bit : Value,
value : Option<Value>,
}
impl MaskValue {
pub fn new(bit : Value, value : Option<Value>) -> MaskValue {
... |
use core::fmt;
use std::error::Error;
use clap::ArgEnum;
use rusqlite::types::{FromSql, FromSqlError, FromSqlResult, ToSqlOutput, ValueRef};
use rusqlite::{params, ToSql};
use std::fmt::Formatter;
use crate::database::Database;
#[derive(Clone)]
pub(crate) struct Item {
pub(crate) id: i64,
pub(crate) jan: i64... |
extern crate faster_rs;
use faster_rs::*;
use std::env;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::mpsc::Receiver;
use std::sync::Arc;
const TABLE_SIZE: u64 = 1 << 15;
const LOG_SIZE: u64 = 17179869184;
const NUM_OPS: u64 = 1 << 25;
const NUM_UNIQUE_KEYS: u64 = 1 << 22;
const REFRESH_INTERVAL: u64... |
use std::sync::atomic::{AtomicU64, Ordering};
use crate::*;
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum CellAlignment {
Fill,
Center,
Top,
TopRight,
Right,
BottomRight,
Bottom,
BottomLeft,
Left,
TopLeft,
}
#[derive(Clone, Debug, PartialEq)]
pub struct GridCell {
pub ... |
pub use self::wall::Wall;
pub use self::portal_pad::PortalPad;
mod wall;
mod portal_pad;
use maat_graphics::DrawCall;
use maat_graphics::cgmath::{Vector2, Vector3, Vector4, Zero};
use crate::modules::collisions::CollisionType;
pub struct ObjectData {
pos: Vector2<f32>,
size: Vector2<f32>,
vel: Vector2<f32>,
... |
#![doc(html_root_url = "https://docs.rs/abnf_to_pest/0.5.0")]
//! A tiny crate that helps convert ABNF grammars to [pest][pest].
//!
//! Example usage:
//! ```
//! let abnf_path = "src/grammar.abnf";
//! let pest_path = "src/grammar.pest";
//!
//! let mut file = File::open(abnf_path)?;
//! let mut data = Vec::new();
/... |
use nginx_rs::bindings::*;
use nginx_rs::core::*;
use nginx_rs::http::*;
use nginx_rs::{ngx_modules, ngx_string, http_request_handler, ngx_null_command, ngx_log_debug_http};
use std::borrow::Cow;
use std::os::raw::{c_char, c_void};
use std::ptr;
#[no_mangle]
static mut ngx_http_hello_world_commands: [ngx_command_t; ... |
//! The **main_impl** module exists to add I/O redirection to the main program function, to allow
//! test coverage analysis for integration tests.
//!
//! ## Normal Program Behavior
//!
//! *main()* in main.rs calls *main_io_wrapper* in this module, supplying arguments and the standard
//! output and error streams.
//... |
use crate::phases::TransparentRenderPhase;
use renderer::nodes::{
RenderView, ViewSubmitNodes, FeatureSubmitNodes, FeatureCommandWriter, RenderFeatureIndex,
FramePacket, DefaultPrepareJobImpl, PerFrameNode, PerViewNode, RenderFeature,
};
use crate::features::sprite::{
SpriteRenderFeature, ExtractedSpriteDat... |
use crate::Deployment;
use crate::DeploymentResourceType;
use crate::{pool, DbError, DbResult, Paginated, DEFAULT_PAGE_SIZE};
use async_diesel::*;
use chrono::prelude::*;
use diesel::prelude::*;
use diesel_derive_more::DBEnum;
use diesel_filter::{DieselFilter, Paginate};
use log::*;
use platz_chart_ext::ChartExtActionT... |
// MIT License
//
// Copyright (c) 2019 <NAME>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merg... |
use cut_optimizer_2d::*;
use eframe::egui::{self, Color32};
use egui::math::Pos2;
use egui::Stroke;
use egui::widgets::{DragValue, Slider};
use egui::{Painter};
use std::collections::{ HashMap};
use serde::{Serialize, Deserialize};
fn draw_rect(ui: &mut egui::Ui, dim: Pos2, offset: Pos2, fill: bool) {
let mut pain... |
// Copyright 2017 <NAME> aka. Luxko
//
// 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 accordi... |
use anyhow::Result;
use async_std::task;
use futures_lite::prelude::*;
use futures_lite::stream::StreamExt;
use log::*;
use pretty_bytes::converter::convert as pretty_bytes;
use sluice::pipe::pipe;
use std::env;
use std::time::Instant;
use hypercore_protocol::schema::*;
use hypercore_protocol::{Channel, Event, Message... |
//! "Runtime" support for `magnet_derive` -- quasi-private functions.
use bson::{ Bson, Document };
/// Describes a lower or upper bound.
#[doc(hidden)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Bound {
/// The range is not bounded.
Unbounded,
/// The range is bounded, the bound is in the range.
... |
use super::ActorData;
use crate::viewport::Viewport;
use sdl2::rect::Rect;
const MAX_OBJECTS: usize = 5;
const MAX_LEVELS: i32 = 10;
/// A quadtree for minimizing collision checks between actors
pub struct Quadtree<'a, Type> {
/// The level of the current tree, (0 is root)
level: i32,
/// The actors that ... |
use crate::physical_plan::state::ExecutionState;
use crate::prelude::*;
use polars_arrow::arrow::array::ArrayRef;
use polars_core::frame::groupby::GroupTuples;
use polars_core::prelude::*;
use std::convert::TryFrom;
use std::sync::Arc;
pub struct TernaryExpr {
pub predicate: Arc<dyn PhysicalExpr>,
pub truthy: ... |
/*
* Copyright 2019 <NAME>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, di... |
use super::float_cmp;
use super::float_cmp::EPSILON;
use super::ray::Ray;
use super::vec3::Vec3;
use super::world::World;
use std::cmp::Ordering;
use std::ops::Index;
#[derive(Debug)]
pub struct State {
pub t: f32,
pub obj_id: usize,
pub point: Vec3,
pub over_point: Vec3,
pub eyev: Vec3,
pub no... |
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use cosmwasm_std::{Order, StdResult, Storage, Uint128};
use cosmwasm_storage::Bucket;
use cw20::{AllowanceResponse, Expiration};
/// this takes a v0.1.x store and converts it to a v0.2.x format
pub fn migrate_v01_to_v02(storage: &mut dyn Storage) -> StdRe... |
///////////////////////////////////////////////////////////////////////////////L
// The MIT License (MIT)
// Copyright (c) 2021 [untitled os] Team
// See LICENSE.txt and CREDITS.txt for details
///////////////////////////////////////////////////////////////////////////////L
#![allow(dead_code)]
use alloc::string::Str... |
use std::fmt::{Display, Formatter};
use inherent::inherent;
#[cfg(any(test, feature = "arbitrary"))]
use quickcheck::{Arbitrary, Gen};
use crate::{field, LookSegment, Segment};
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Hash)]
pub struct FieldBuf {
pub name: String,
// This is a very lazy optimiz... |
//! Resource manager to allocate and switch between framebuffers.
use std::ptr;
use gl;
use gl::types::*;
#[path = "../error.rs"]
mod error;
/// The target to every rendering call.
pub enum RenderTarget {
/// The screen (main framebuffer).
Screen,
/// An off-screen buffer.
Offscreen(OffscreenBuffers)... |
use as_any::AsAny;
use async_trait::async_trait;
use handlebars::Handlebars;
use std::collections::HashMap;
use std::fmt;
use std::future::Future;
use std::pin::Pin;
use std::sync::Arc;
mod slack;
#[derive(Debug)]
pub enum FactoryError {
ServiceNotFound,
ConfigError(String),
}
impl fmt::Display for FactoryEr... |
use std::net::SocketAddr;
use std::sync::{ Arc, RwLock };
use std::thread::{ JoinHandle, spawn };
use futures::future;
use futures::future::Either;
use tokio::prelude::{ Async, Future, Poll, Stream };
use tokio::net::TcpListener;
use tokio::io;
use super::agent::Agent;
use super::config::ServerConfig;
use super::state:... |
use alloc::sync::Arc;
use spin::Mutex;
use crate::{BLOCK_SZ, bitmap::{Bitmap, BLOCK_BITS}, block_cache::get_block_cache, block_dev::BlockDevice, layout::{DiskInode, DiskInodeType, SuperBlock}, vfs::Inode};
/// 文件系统: 负责将逻辑的目录、文件等抽象对应到磁盘上具体的块。
/// 主要分成5部分连续空间:
/// - 超级块:占磁盘第一个块,提供合法检测(魔数),描述磁盘整体布局,如总空间大小,inode 数量,数据块数量... |
use glib::signal;
use gtk::prelude::*;
use gtk::{BinExt, ImageExt, LabelExt, RangeExt, ScaleExt};
use std::ops::Deref;
use std::rc::Rc;
use crate::app::components::{
utils::{Clock, Debouncer},
EventListener,
};
use crate::app::state::{PlaybackAction, PlaybackEvent};
use crate::app::{ActionDispatcher, AppEvent,... |
use graph::{GraphDef, GraphShapes, ErrorKind, Result};
use id::{NodeID, DataID, OpID, PassID};
use storage::Storage;
use ops::{standard_op_name, Op, OpInstance, Pass};
use shape::{NodeShape, NodeDim};
use ndarray::{ArrayViewMutD, ArrayViewD};
use std::any::Any;
#[must_use]
#[derive(Clone, Debug)]
pub struct Scale {
o... |
// Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0.
//! Library of anonymous ciphertext voting (ACV) solution.
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate wedpr_l_macros;
pub mod config;
pub mod coordinator;
pub mod counter;
mod utils;
pub mod verifier;
pub mod voter;
#[cfg... |
use crate::game_entity::*;
use bevy::prelude::*;
/// Path to the "ZOMBIE" sprite
static ZOMBIE_ASSET_PATH: &'static str = "sprites/zombie.png";
/// Path to the "PLAYER" sprite
static PLAYER_ASSET_PATH: &'static str = "sprites/woman.png";
/// Current direction of the entity (targeting up, left, right or down)
#[derive... |
// Copyright (c) 2021 jmjoy.
//
// Apollo Puller is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan
// PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
// http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITH... |
use std::collections::HashSet;
use std::io::{self, Read};
#[derive(Copy, Clone)]
enum Dir {
E, SE, SW, W, NW, NE
}
// Axial coordinates, e.g. in the points around the origin:
// x-coord y-coord
// 0 1 -1 -1
// -1 0 1 0 0 0
// -1 0 1 1
#[derive(Copy, Clone, Debug, Hash, Eq, P... |
use std::collections::BTreeMap;
use std::fs::File;
use std::io::{self, BufWriter, Write};
use std::path::{Path, PathBuf};
use std::time::Duration;
use chrono::{DateTime, FixedOffset};
use flate2::write::GzEncoder;
use flate2::Compression;
use indicatif::{ProgressBar, ProgressStyle};
use reqwest::header::{HeaderMap, He... |
pub const SEQ_NO: i32 = 1;
pub const PROTOCOL_VERSION: usize = 2;
pub const WALLET: &'static str = "wallet_1"; // FIXME never use global names
pub const TYPE: &'static str = "default";
pub const INMEM_TYPE: &'static str = "inmem";
pub const SIGNATURE_TYPE: &'static str = "CL";
pub const TRUSTEE_SEED: &'static str = "0... |
use ::std::convert::TryInto;
use ::std::os::raw;
use ::std::mem;
use ::std::ptr;
use ::std::slice;
use ::std::mem::MaybeUninit;
use ::jvmti::jvmtiEventCallbacks;
use ::jvmti::{
jvmtiEnv,
JNIEnv,
jint,
jclass,
jobject,
jthread,
};
use ::std::ffi;
use crate::jvm::jvmti_env;
use crate::jvm::jni_env... |
//! Board file for SiFive HiFive1 RISC-V development platform.
//!
//! - <https://www.sifive.com/products/hifive1/>
//!
//! This board is no longer being produced. However, many were made so it may
//! be useful for testing Tock with.
//!
//! The primary drawback is the original HiFive1 board did not support User
//! m... |
use serde::Serialize;
use solana_sdk::{
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
client::Client,
instruction::{AccountMeta, Instruction},
loader_instruction,
message::Message,
pubkey::Pubkey,
signature::{Keypair, Signer},
system_instruction,
};
pub fn load_program<T: Clie... |
// Copyright 2016 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-MIT or ... |
//! Client connection manager
//!
//! By cluster we mean just one or more ciruela servers which see each other
//! and have same directory namespace (no specific software known as
//! ciruela-cluster exists).
//!
//! We might expose individual server connections later, but now we only
//! have higher level API.
use std... |
use anyhow::{bail, Result};
use crate::backend::modules::symbols::func::swap_args;
use crate::backend::modules::symbols::idents::IdSym;
use crate::backend::modules::types::func_type::FuncType;
use crate::backend::scopes::sym_table::SymbolTable;
use crate::backend::scopes::symbol::Symbol;
use crate::backend::scopes::ty... |
use std::fmt::Display;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use super::super::SetAttribute;
// This macro generates the Attribute enum, its iterator
// function, and the static array containing the sgr code
// of each attribute
macro_rules! Attribute {
(
$(
$(#[$inne... |
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
use tidb_query_codegen::AggrFunction;
use tidb_query_datatype::builder::FieldTypeBuilder;
use tidb_query_datatype::{FieldTypeFlag, FieldTypeTp};
use tipb::{Expr, ExprType, FieldType};
use super::*;
use tidb_query_common::Result;
use tidb_query_datatyp... |
use conch_parser::ast::Command::*;
use conch_parser::ast::ListableCommand::*;
use conch_parser::ast::PipeableCommand::*;
use conch_parser::ast::RedirectOrEnvVar::EnvVar;
use conch_parser::ast::*;
use conch_parser::lexer::Lexer;
use conch_parser::parse::DefaultParser;
use std::error::Error;
use std::fmt::Debug;
use std:... |
use color_eyre::eyre::Result;
use hyper::{header::CONTENT_TYPE, Body, Response};
use prometheus::{Encoder, TextEncoder};
use std::sync::Arc;
use warp::{path, Filter};
pub mod app;
pub mod handlers;
pub mod post;
pub mod signalboost;
use app::State;
const APPLICATION_NAME: &str = concat!(env!("CARGO_PKG_NAME"), "/", ... |
// Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
use serde::{Deserialize, Serialize};
use arena_collections::List;
use arena_trait::TrivialDrop;
use no_pos_hash::NoPosHash;
use ocamlre... |
use std::time::Duration;
use structopt::StructOpt;
use surge_ping::{Client, Config, IcmpPacket, ICMP};
use tokio::time;
#[derive(Default, Debug)]
struct Answer {
host: String,
transmitted: usize,
received: usize,
durations: Vec<Duration>,
}
impl Answer {
fn new(host: &str) -> Answer {
Answ... |
#[macro_use] extern crate log;
extern crate postgres as pg;
extern crate rustc_serialize;
extern crate curl;
extern crate flate2;
extern crate git2;
extern crate oauth2;
extern crate openssl;
extern crate r2d2;
extern crate r2d2_postgres;
extern crate rand;
extern crate s3;
extern crate semver;
extern crate time;
exter... |
//! Component and buffers
use dotrix_core::assets::{Mesh, Shader};
use dotrix_core::ecs::{Const, Mut, System};
use dotrix_core::renderer::{
BindGroup, Binding, DepthBufferMode, PipelineLayout, PipelineOptions, Sampler, Stage,
UniformBuffer,
};
use dotrix_core::{Application, Assets, Camera, CubeMap, Globals, Pi... |
// Copyright 2018 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, mer... |
/*
Copyright 2019 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 ag... |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
use std::convert::TryInto;
use std::ffi::OsString;
use std::fmt::Write;
use std::path::PathBuf;
/// The ByteString type represents... |
use std::collections::HashMap;
use std::fs::{create_dir_all, File};
use std::io::prelude::*;
use std::path::PathBuf;
use anyhow::{anyhow, bail, Result};
use config::Config;
use log::info;
use rand::Rng;
use serde_derive::{Deserialize, Serialize};
use crate::platform::directories::*;
/// All settings which are used b... |
//
// Path planning with Bezier curve.
//
// author: <NAME>(@Atsushi_twi)
// <NAME>(@rsasaki0109)
use plotlib::page::Page;
use plotlib::repr::Plot;
use plotlib::view::ContinuousView;
use plotlib::style::PointStyle;
use plotlib::style::LineStyle;
fn calc_4points_bezier_path(
x_start: (f64, f64, f64), x_goa... |
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use std::collections::BTreeMap;
use schemars::gen::{SchemaGenerator, SchemaSettings};
use schemars::schema::SchemaObject;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
/// OPEN-RPC documentation following the OpenRPC spe... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Control Register"]
pub twihs_cr: crate::Reg<twihs_cr::TWIHS_CR_SPEC>,
#[doc = "0x04 - Master Mode Register"]
pub twihs_mmr: crate::Reg<twihs_mmr::TWIHS_MMR_SPEC>,
#[doc = "0x08 - Slave Mode Register"]
pub twihs_smr:... |
#![allow(unused_parens)]
// #![feature(custom_derive, plugin)] // necessary for serde
#![feature(conservative_impl_trait)]
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate serde_yaml;
extern crate iron ;
extern crate staticfile;
extern crate mount;
extern crate router;... |
use std::collections::HashSet;
use std::io::{self, BufRead};
type Index = (isize, isize);
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum HexNeighbour {
East,
SouthEast,
SouthWest,
West,
NorthWest,
NorthEast,
}
impl HexNeighbour {
fn from_char_iter<'a>(
input: &'a mut impl Itera... |
//! This is a much more primitive way to randomly generate trips. activity_model.rs has something
//! more realistic.
use std::collections::BTreeSet;
use rand::seq::SliceRandom;
use rand::Rng;
use rand_xorshift::XorShiftRng;
use serde::{Deserialize, Serialize};
use abstutil::Timer;
use geom::{Duration, Time};
use ma... |
use crate::usize_from;
fn decode(data: &[bool]) -> String {
let mut data = data.into_iter().cloned();
let mut s = String::with_capacity(data.len() / 8);
'a: loop {
let mut val = 0u8;
for bit in (0..8).rev() {
match data.next() {
Some(true) => val |= 1 << bit,
... |
use std::collections::{BTreeMap, HashMap};
use std::sync::atomic::Ordering;
use std::sync::Arc;
use event::{Bucket, Metric};
use metrics::{Key, KeyName, Recorder, Unit};
use metrics_util::recency::{GenerationalPrimitives, Recency};
use metrics_util::{Histogram, MetricKindMask};
use parking_lot::RwLock;
use quanta::Clo... |
use anyhow::{anyhow, bail, Result};
use futures::future::try_join_all;
use log::debug;
use rumqttc::{AsyncClient, Event, MqttOptions, QoS};
use std::sync::Arc;
use std::time::{Duration, Instant};
use tokio::{sync::Barrier, task, time};
use tokio_util::sync::CancellationToken;
use crate::RoundConfig;
pub(crate) async ... |
use std::fs;
use std::collections::HashMap;
use std::cmp;
mod intcode;
#[derive(Debug)]
enum Direction {
Up,
Right,
Left,
Down
}
impl Direction {
fn from (arrow: &i64) -> Option<Self> {
match *arrow {
60 => Some(Direction::Left),
62 => Some(Direction::Right),
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.