text stringlengths 8 4.13M |
|---|
//! HTTP Server for starting the server.
/// HttpServer
#[derive(Debug)]
pub struct HttpServer {
}
impl HttpServer {
/// run
pub fn run(_s: HttpServer) {
}
}
|
use crate::{
certificate::Certificate,
fee::FeeAlgorithm,
fragment::Fragment,
header::HeaderId,
testing::data::AddressData,
testing::witness_builder,
transaction::{
AuthenticatedTransaction, Input, Output, Transaction, TransactionSignDataHash, Witness,
},
txbuilder::{self, Ou... |
use std::ffi::{c_void, CString};
use std::os::raw::c_int;
use std::ptr::{null, null_mut};
use std::rc::Rc;
use std::sync::atomic::{AtomicBool, Ordering};
use crate::visual::generated::glfw;
static FRAMEBUFFER_SIZE_DIRTY: AtomicBool = AtomicBool::new(true);
struct GlfwInner;
pub struct Glfw(Rc<GlfwInner>);
pub struc... |
use rand_os::rand_core::RngCore;
use rand_os::OsRng;
use wasm_bindgen::prelude::*;
use crate::display::Display;
use crate::font::FONT_SET;
use crate::keypad::Keypad;
use crate::MEM_SIZE;
#[wasm_bindgen]
pub struct CPU {
// Index register
i: usize,
// Program counter
pc: usize,
// registers
... |
use std::fmt::{Display, Error, Formatter};
use std::io::Write;
use std::str::FromStr;
use rand::prelude::*;
use crate::traits::{Generator, ReadResult, Testcase};
use crate::utils::{generate_testcasefile, u8_to_string_variable, u8_to_string};
use crate::{SecretBoxGenerator, TestcaseEnum};
use microsalt::secretbox::xsal... |
#[allow(unused_imports)]
use tracing::{info, warn, debug, error, trace, instrument, span, Level};
use super::api::*;
use super::attr::*;
pub struct OpenHandle
where Self: Send + Sync
{
pub dirty: seqlock::SeqLock<bool>,
pub inode: u64,
pub fh: u64,
pub spec: FileSpec,
pub kind: FileKind,
pub ... |
use std::borrow::Borrow;
use std::collections::VecDeque;
/// An iterator that consumes another iterator and replaces every matching
/// sequence with a different sequence.
///
/// Replacer will stop reading from the source iterator once it has received
/// the first None, otherwise it would not be able to output tails... |
mod ast;
mod parser;
use parser::Parser;
fn main() {
let code_example = r#"
let x = 3;
print("hello, world! my favorite number is $x");
"#;
let mut parser = Parser::new(code_example);
while let Some(stmt) = parser.statement() {
println!("{:?}", stmt);
}
}
|
use super::Database;
use super::models::*;
use super::super::neo4j_ops;
use neo4j_ops::Neo4jStatement;
use std::error;
use std::fmt;
type Result<T> = std::result::Result<T, Error>;
impl Database {
pub async fn post_project(&self, project: Project) -> Result<()> {
let mutate_str = "\
MERGE (project:Proje... |
// Copyright 2020 Datafuse Labs.
//
// 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 ... |
// This file is part of Substrate.
// Copyright (C) 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://www.a... |
use std::str;
use actix_web::{web, HttpRequest, HttpResponse};
use chrono::SecondsFormat;
use meilisearch_auth::{Action, AuthController, Key};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use crate::extractors::authentication::{policies::*, GuardedData};
use meilisearch_error::ResponseError;
pub fn c... |
// * Daily Coding Problem January 9 2021
// * [Easy] -- Apple
// * Return the nth number in the fibbonacci sequence
use std::env;
// * Recursive nth fibbonacci number in O(1) space (if we're not counting memory used by the stack)
fn nth_fibbonacci(n: u32) -> u32 {
match n {
0 => 0,
1 => 1,
... |
use commons::io::load_file_lines;
use std::cmp::Ordering;
fn sum_to_target(ints: &[u32], target: u32) -> Option<(u32, u32)> {
let mut lower_idx = 0;
let mut upper_idx = ints.len() - 1;
while lower_idx != upper_idx {
let lower = ints[lower_idx];
let upper = ints[upper_idx];
let sum ... |
use crate::footer::Footer;
use deciduously_com_ui as ui;
use pinwheel::prelude::*;
#[derive(children, Default, new)]
#[new(default)]
pub struct Layout {
pub children: Vec<Node>,
}
impl Component for Layout {
fn into_node(self) -> Node {
div()
.class("layout")
.child(header().child(Topbar))
.child(main().... |
extern crate pkg_config;
extern crate cmake;
use std::env;
use std::fs::{self};
use std::path::PathBuf;
pub fn find_or_build(lib: &str) -> Result<(), String> {
// force behavior for static libraries (risks over-linking, but better than missing transitive dependencies)
env::set_var("PKG_CONFIG_ALL_STATIC", "")... |
// extern crate actix;
extern crate actix_web;
extern crate althea_types;
extern crate bytes;
extern crate clarity;
#[macro_use]
extern crate failure;
extern crate futures;
extern crate guac_core;
extern crate num256;
extern crate qutex;
extern crate serde;
extern crate serde_json;
extern crate tokio;
extern crate web... |
use std::fs;
use std::path::PathBuf;
pub trait Peripheral: Sized {
fn attached(&self) -> bool;
/// Returns Some(self) if the flysight is attached, None otherwise
fn get(self) -> Option<Self> {
if self.attached() {
Some(self)
} else {
None
}
}
}
pub trai... |
extern crate time;
use byteorder::{NetworkEndian, ReadBytesExt, WriteBytesExt};
use conv::TryFrom;
use errors::*;
use formats::{
LeapIndicator,
Version,
Mode,
Stratum,
ReferenceIdentifier,
PrimarySource
};
use formats::timestamp::{ShortFormat, TimestampFormat};
#[derive(Debug, PartialEq, Def... |
use std::io;
use std::fmt;
use bytes::BlockBuf;
use httparse;
use tokio_proto::Parse;
use tokio_proto::pipeline::Frame;
use super::response::Response;
/// Enum representing HTTP request methods.
///
/// ```rust
/// match req.method {
/// Method::GET => {}, // handle GET
/// Method::POST => {}, // handle P... |
mod mutex;
mod parking_lot_rwlock;
mod rwlock;
mod atomic_bool; |
#[derive(Debug, Clone, PartialEq)]
pub enum LevenshteinOp {
Keep(char),
Insert(char),
Delete(char),
Substitute(char, char),
}
pub type Levenshtein = Vec<LevenshteinOp>;
/// Calculates the minimum number of insertions, deletions, and substitutions
/// required to change one sequence into the other.
pub... |
use std::fmt;
use rand::Rng;
use crate::game::{Game, Player, Infoset};
/// no rng can make some analyses easier, but it's not accurate to the real game
const FORCE_NO_RNG: bool = false;
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum Card {
Skull,
Flower,
}
#[derive(Copy, Clone, Debug, PartialEq)]
pub enu... |
use crate::smt::Error as SMTError;
cfg_if::cfg_if! {
if #[cfg(feature = "std")] {
use thiserror::Error;
#[derive(Error, Debug, Eq, PartialEq, Clone)]
pub enum Error {
#[error("{_0}")]
SMT(SMTError),
#[error("Amount overflow")]
AmountOverflow,
... |
//! # PERF - benchmark game generation performance.
//!
//! Usage: `cargo run --release --bin perf`
//!
//! Performance is tested on 5x5 breakthrough/PUCT.
#![allow(non_snake_case)]
use ggpf::deep::evaluator::PredictionEvaluatorChannel;
use ggpf::deep::tf;
use ggpf::game::breakthrough::{Breakthrough, BreakthroughBuil... |
// Vorbis decoder written in Rust
//
// Copyright (c) 2016 est31 <MTest31@outlook.com>
// and contributors. All rights reserved.
// Licensed under MIT license, or Apache 2 license,
// at your option. Please see the LICENSE file
// attached to this source distribution for details.
#![cfg_attr(not(cargo_c), forbid(unsaf... |
use aes::Aes128;
use block_modes::{Cbc, BlockMode};
use block_modes::block_padding::Pkcs7;
type AesCbc = Cbc<Aes128, Pkcs7>;
use crate::models::{CookieDataRaw, DecryptedCookie, Result, GetChromeCookieError};
use crate::key::get_chrome_key;
const IV: [u8; 16] = [0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0... |
use std::collections::HashSet;
use std::fs;
use std::io;
use std::ops::Deref;
use std::os::unix::fs::MetadataExt;
use std::path::{Path, PathBuf};
use hex;
use multi_map::MultiMap as TwoKeyMap;
use pathdiff;
use regex::Regex;
use sha2::{Digest, Sha256};
use walkdir::{DirEntry, WalkDir};
use error::ResultExt;
use state... |
use std::fmt;
use {Header, Raw, Preference};
use parsing::{from_comma_delimited, fmt_comma_delimited};
/// `Preference-Applied` header, defined in [RFC7240](http://tools.ietf.org/html/rfc7240)
///
/// The `Preference-Applied` response header may be included within a
/// response message as an indication as to which `P... |
extern crate serde;
use serde::Deserialize;
#[derive(Deserialize)]
pub struct FormData {
pub email: String,
pub name: String
} |
extern crate console;
use console::style;
use console::Term;
use rand::Rng;
#[derive(PartialEq, Eq)]
pub enum MenuEnum {
Arms,
Train,
Disband,
Diplomacy,
Warroom,
Demand,
Invade,
Main,
Realm,
Quit,
TributeDemanded,
Notification,
}
use super::StatusEnum;
pub fn print_he... |
//! Useful synchronization primitives.
pub mod linked_list;
pub mod soft_atomic;
pub mod spsc;
mod mutex;
pub use self::linked_list::LinkedList;
pub use self::mutex::{Mutex, MutexGuard};
|
#[macro_use]
extern crate criterion;
extern crate walkdir;
mod compare_functions;
mod external_process;
mod iter_with_large_drop;
mod iter_with_large_setup;
mod iter_with_setup;
mod with_inputs;
criterion_main!{
compare_functions::fibonaccis,
external_process::benches,
iter_with_large_drop::benches,
i... |
// Copyright 2016 Eli Friedman.
//
// 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 t... |
use crate::read;
fn clean(file_data: &String) -> Vec<u16> {
return file_data.split("\n")
.map(|temp_num| temp_num.parse().unwrap())
.collect();
}
fn part1(data_clean: &Vec<u16>) -> u16 {
let mut sonar_inc = 0;
let mut sonar_last = None;
for itr_num in data_clean {
if let Some(sonar_ping) = sonar_last {
i... |
#![allow(clippy::all)]
#![deny(clippy::correctness)]
mod audio_entity;
mod ball;
mod bat;
mod controls;
mod game;
mod global_state;
mod graphic_entity;
mod impact;
mod state;
use std::env;
use std::path::PathBuf;
use ggez::{event, GameResult};
use global_state::GlobalState;
const RESOURCES_DIR_NAME: &str = "resour... |
use crate::schema::system_configs;
use chrono::NaiveDateTime;
#[derive(Debug, Queryable, Identifiable)]
#[primary_key(scid)]
pub struct SystemConfig {
pub scid: i64,
pub key: String,
pub value: String,
pub modify_time: NaiveDateTime,
pub created_time: NaiveDateTime,
}
#[derive(Debug, Queryable, In... |
{{doc_comment}}
{{debug}}
pub type {{rust_local}}{{generic_args}} = {{definition}};
|
mod ProcessInjection;
fn main() {
let current_dir = std::env::current_exe().unwrap();
let dll_path = current_dir.as_path().parent().unwrap().join("control_cheat_dll.dll");
if !dll_path.exists(){
println!("ERROR: {} does not exists!!", dll_path.to_str().unwrap());
return;
}
let pid = ProcessInjection::find_pr... |
use std::fs::File;
fn main() {
// let v = vec![1, 2, 3];
// v[10];
// panic!("Something went wrong. Cannot proceed");
let f = File::open("main.jpg");
match f {
Ok(f) => {
println!("file found {:?}", f);
},
Err(e) => {
println!("file not found\n{:?}",... |
// https://leetcode.com/problems/minimum-space-wasted-from-packaging/
// You have n packages that you are trying to place in boxes, one package in each box. There are
// m suppliers that each produce boxes of different sizes (with infinite supply). A package can
// be placed in a box if the size of the package is less... |
use crate::errors::E;
use chrono::prelude::*;
use crc::crc32;
use crypto::blowfish::Blowfish;
use crypto::symmetriccipher::{BlockDecryptor, BlockEncryptor};
use std::collections::HashMap;
use std::io::prelude::*;
use std::io::BufReader;
use std::str::FromStr;
const PERMIT_RECORD_LENGTH: usize = 8 + 8 + 16 + 16 + 16;
... |
fn main() {
println!("TODO: redbox-cli");
}
|
// Copyright (c) Anthony Wilcox and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project
// root for full license information.
mod art;
mod flags;
use flags::*;
use simplelog::*;
use art::{ych, comm, req};
use self_update::backends::github::Update;
use clap::{crate_auth... |
extern crate time;
use self::time::Timespec;
use self::time::at;
use self::time::strftime;
use self::time::now;
pub fn ts2str(ts: i64) -> String {
let timespec = Timespec::new(ts, 0);
let tm = at(timespec);
let result = strftime("%F %T", &tm).unwrap();
return result;
}
pub fn timestamp() -> i64 {
... |
use nimiq_primitives::networks::NetworkId;
use wasm_bindgen::JsError;
/// Convert a NetworkId to u8
pub fn from_network_id(network_id: NetworkId) -> u8 {
match network_id {
NetworkId::Test => 1,
NetworkId::Dev => 2,
NetworkId::Bounty => 3,
NetworkId::Dummy => 4,
NetworkId::M... |
use std::collections::{BTreeSet, HashMap};
use std::sync::{Arc, Mutex};
use helpers::sanitize;
/// A `Target` for the bot to reply to.
pub trait Target: Sync + Clone {
fn new(name: &str) -> Self;
fn send(&self, bot: &Arc<Mutex<::Bot>>, text: &str);
}
/// A `Room` implements `Target`. If the bot replies to a ... |
use std::io::{BufReader, Write};
use std::process::{ChildStdin, ChildStdout, Command, Stdio};
use super::io::read_stdout;
use crate::algorithm::meta::{Meta, Nodes};
use crate::board::generator::Generator;
use crate::board::position::Position;
use crate::engine::{Engine, EngineResult};
pub struct Slagzet {
stdin: ... |
pub use request::Request;
pub use method::Method;
pub mod method;
pub mod request; |
#[allow(unused_imports)]
use tracing::{error, info, warn, debug, trace};
use std::sync::Arc;
use multimap::MultiMap;
use std::ops::Deref;
use error_chain::bail;
#[allow(unused_imports)]
use serde::{Serialize, Deserialize, de::DeserializeOwned};
use fxhash::FxHashMap;
#[allow(unused_imports)]
use crate::crypto::{Encrypt... |
/**
* [4] Median of Two Sorted Arrays
*
* There are two sorted arrays nums1 and nums2 of size m and n respectively.
*
* Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
*
* You may assume nums1 and nums2 cannot be both empty.
*
* Example 1:
*
*
* nums1 = [1, ... |
#[derive(Debug)]
struct LinkedList {
head: Link,
}
impl LinkedList {
pub fn new() -> Self {
Self { head: Link::Empty }
}
}
#[derive(Debug)]
enum Link {
Empty,
More(Box<Node>),
}
#[derive(Debug)]
struct Node {
elem: i32,
next: Link,
}
pub fn run() {
main_function();
}
fn main_fu... |
//! Interfaces for serializing bin data to string
//!
//! Two serializers are implemented:
//!
//! - [JsonSerializer], for JSON serialization, simpler but drop type details
//! - [TextTreeSerializer], for custom text format that retains detailed type information
use std::io;
use super::{
BinEntry,
PropFile,
... |
// This file is part of Substrate.
// Copyright (C) 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://www.a... |
pub(super) mod sse;
|
use ws::Sender;
use protocol::client_command::ClientCommand;
pub enum ChannelMessage {
SocketOpen(Sender),
ClientData(u32, ClientCommand),
WorldUpdate
} |
pub mod list;
pub mod note;
pub mod period;
pub mod recurrence;
pub mod task;
pub use self::list::List;
pub use self::note::Note;
pub use self::period::Period;
pub use self::recurrence::Recurrence;
pub use self::task::Task;
|
// Copyright 2017 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 ... |
use crate::types::{Action, Command, Script};
use email::MimeMessage;
pub fn run(script: &Script, email: &MimeMessage) -> Vec<Action> {
run_commands(&script.commands, email)
}
fn run_commands(commands: &[Command], email: &MimeMessage) -> Vec<Action> {
commands
.iter()
.flat_map(|c| {
... |
// Copyright 2017 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 ... |
use std::str;
use nom::{alphanumeric, is_digit, multispace, IResult};
use super::ast::*;
// rule attribute
// name _ "=>" _ value
// <LogStash::Config::AST::Attribute>
// end
// rule value
// plugin / bareword / string / number / array / hash
// end
// rule array_value
// bareword / string / number / array... |
extern crate maat_graphics;
use maat_graphics::winit;
use maat_graphics::{
glam::{Vec3, Vec4},
Draw, MaatEvent, MaatGraphics, VkWindow,
};
use winit::event_loop::EventLoop;
const APP_NAME: &str = "MaatGraphics - Minimal 2D Example";
fn main() {
let create_window_size: [u32; 2] = [1280, 720];
let mut screen_r... |
use proc_macro2::TokenStream;
use quote::quote;
use crate::{
project::Application,
};
use std::{
path::PathBuf,
};
use syn::{
ItemMod,
};
pub async fn main(args: TokenStream, body: TokenStream) -> TokenStream {
std::panic::set_hook(
Box::new(crate::Error::report_panic)
);
match main_r... |
//! Provides a bunch of short type names for easier declaration. All follow a pattern of LittleEndian<BASETY> = BASETYPEle and BigEndian<BASETYPE> = BASETYPEbe
#![allow(non_camel_case_types)]
use super::*;
/// Shorthand for `LittleEndian<u16>`
pub type u16le = LittleEndian<u16>;
/// Shorthand for `BigEndian<u16>`
p... |
//! This crate provides the utf16! macro, that takes a string literal and produces
//! a &[u16; N] containing the UTF-16 encoded version of that string.
//!
//! ```
//! #![feature(proc_macro_hygiene)] // Needed to use the macro in an expression
//! extern crate utf16_literal;
//!
//! # fn main() {
//! let v = utf16_lit... |
mod certpath;
mod filters;
mod handlers;
mod reboot;
mod server_impl;
pub use certpath::CertPath;
pub use reboot::RebootableServer as Server;
|
//! Paseto is everything you love about JOSE (JWT, JWE, JWS) without any of
//! the many design deficits that plague the JOSE standards.
//!
//! # Getting Started
//!
//! The Paseto crate provides Builders which can help in the ease of building
//! tokens in an ergonomic way, these are enabled by default. However, they... |
use super::TestNode;
use osmgraphing::routing;
#[test]
fn simple_stuttgart() {
let mut astar = routing::factory::new_shortest_path_astar();
let expected_paths = expected_paths_simple_stuttgart();
let filepath = "resources/maps/simple_stuttgart.fmi";
super::assert_correct(&mut astar, expected_paths, fil... |
pub fn execute_exercises() {
println!("Collision at: {:?}", exercise_1(607331));
println!("Collision at: {:?}", exercise_2(vec!(6u8,0,7,3,3,1)));
//println!("Final cart at: {:?}", exercise_2(a, b))
}
fn exercise_1(input: usize) -> Vec<u8> {
let mut recipe_grades = Vec::with_capacity(input ... |
use super::data::BUILTINS;
use crate::{
corejs3::{
compat::DATA as CORE_JS_COMPAT_DATA,
data::{
COMMON_ITERATORS, INSTANCE_PROPERTIES, POSSIBLE_GLOBAL_OBJECTS, PROMISE_DEPENDENCIES,
STATIC_PROPERTIES,
},
},
util::DataMapExt,
version::should_enable,
Ver... |
use crate::audio::SoundSource;
use crate::tests;
use crate::*;
#[test]
fn audio_load() {
let (c, _e) = &mut tests::make_context();
{
// TODO: Test different sound formats
let mut sound = audio::Source::new(c, "/pew.ogg").unwrap();
sound.play().unwrap();
}
// TODO: This is awkwa... |
use crate::schema::users::dsl as user_dsl;
use crate::util::{
db::{can_connect, get_database},
gen_random,
};
use crate::{error::StratError, schema::users};
use argon2::{self, Config};
use chrono::{DateTime, NaiveDateTime, Utc};
use diesel::{
result::Error as dsl_err, ExpressionMethods, PgConnection, QueryD... |
use serde::{Deserialize, Serialize};
use colored::*;
use dialoguer::Input;
use glob::glob;
use std::collections::HashMap;
use std::env;
use std::fs;
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use std::path::{Path, PathBuf};
#[derive(Serialize, Deserialize)]
struct Workspaces {
packages: V... |
use std::fmt;
use nom::{branch::alt, IResult};
use super::enum_utils::enum_element;
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub enum Frequency {
Secondly,
Minutely,
Hourly,
Daily,
Weekly,
Monthly,
Yearly,
}
impl fmt::Displ... |
use crate::{
engine::{bomb::BombId, explosion::ExplosionId, position::MapPosition},
error::{ZError, ZResult},
utils::misc::Timestamp,
};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::convert::TryFrom;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Se... |
#![no_std]
#![no_main]
#[macro_use]
extern crate ruspiro_boot;
extern crate ruspiro_allocator;
use ruspiro_brain::*;
use ruspiro_console::*;
come_alive_with!(kernel_alive);
run_with!(kernel_run);
pub fn kernel_alive(core: u32) {
if core == 0 {
init_brain();
}
// your one-time initialization goe... |
use libc::{c_char, c_int};
use std::ffi::{CStr, CString};
use std::ptr;
use constants::PamResultCode;
use constants::PamMessageStyle;
use items::Item;
use module::PamResult;
#[repr(C)]
struct PamMessage {
msg_style: PamMessageStyle,
msg: *const c_char,
}
#[repr(C)]
struct PamResponse {
resp: *const c_cha... |
mod mmh3_128;
pub use mmh3_128::Murmur3State as Murmur3Hasher;
|
use std::result;
use entity_store::*;
use spatial_hash::SpatialHashTable;
use entity_store::EntityStore;
use observation::shadowcast;
use knowledge::PlayerKnowledgeGrid;
use entity_observe;
use renderer::GameRenderer;
#[derive(Debug)]
pub enum Error {
ObservationFailed(entity_observe::Error),
MissingPosition,
... |
//! Every repository consists of issues
use serde_json::{Map, Value};
use super::Reducer;
use super::reducers::BasicIssueReducer;
#[derive(Debug, Error)]
pub enum ReductionError<Err: ::std::error::Error + ::std::fmt::Debug> {
ImplementationError(Err)
}
/// Issue is a topic or a problem for debate, discussion
//... |
//! Update agent actor.
use super::{UpdateAgent, UpdateAgentState};
use crate::rpm_ostree::{self, Release};
use actix::prelude::*;
use failure::Error;
use futures::prelude::*;
use libsystemd::daemon::*;
use log::trace;
use prometheus::IntGauge;
use std::collections::BTreeSet;
use std::time::Duration;
lazy_static::laz... |
#[derive(Debug)]
pub enum SpRaError {
Crypto(sgx_crypto::error::CryptoError),
IO(std::io::Error),
IAS(IasError),
Serialization(std::boxed::Box<bincode::ErrorKind>),
IntegrityError,
SigstructMismatched,
EnclaveInDebugMode,
EnclaveNotTrusted,
InvalidSpConfig(String),
GenericError(S... |
mod utils;
use wasm_bindgen::prelude::*;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
#[wasm_bindgen]
extern "C" {
fn alert(s: &str);
#[wasm_bindgen(js_n... |
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::ffi::OsStr;
use std::os::windows::ffi::OsStrExt;
use winapi::ctypes::wchar_t;
use winapi::shared::minwind... |
use anyhow::{anyhow, Result};
use gw_common::H256;
use gw_types::packed::LogItem;
use gw_types::prelude::*;
use std::{convert::TryInto, usize};
pub const GW_LOG_SUDT_TRANSFER: u8 = 0x0;
pub const GW_LOG_SUDT_PAY_FEE: u8 = 0x1;
pub const GW_LOG_POLYJUICE_SYSTEM: u8 = 0x2;
pub const GW_LOG_POLYJUICE_USER: u8 = 0x3;
#[de... |
use utils::is_char_in_range::*;
use constants::JAPANESE_RANGES;
/// Tests a character. Returns true if the character is [Katakana](https://en.wikipedia.org/wiki/Katakana).
///
/// @param {String} char character string to test
///
pub fn is_char_japanese(char: char) -> bool {
return JAPANESE_RANGES
.iter(... |
mod mitm;
pub use mitm::*;
pub use http_mitm::NoopMessageHandler;
|
pub use super::bag::Bag;
pub use super::stack::Stack;
pub use super::queue::Queue;
pub use super::deque::Deque;
pub use super::graph::Graph;
pub use super::graph::Digraph;
pub use super::priority_queue::{IndexMinPQ, MaxPQ, MinPQ};
pub use super::tries::TernarySearchTrie;
pub use super::rope::{IntoRope, Rope};
... |
//! A collection of migration helpers for keeping older nip repos relevant; controlled by the
//! `migrations` feature.`
mod object_v1;
use failure::{Error, Fail};
use ipfs_api::IpfsClient;
use crate::{
constants::{NIP_PROTOCOL_VERSION, SUBMODULE_TIP_MARKER},
index::NIPIndex,
object::NIPObject,
util:... |
use crate::schema::props_random_treasure_chest_category_attribute_assets;
use chrono::NaiveDateTime;
use serde::{Serialize,Deserialize};
#[derive(Queryable, Identifiable,Serialize,Deserialize, Debug, Clone)]
pub struct PropsRandomTreasureChestCategoryAttributeAsset {
pub id: i64,
pub item_id: i64,
pub attr... |
use super::*;
#[test]
fn test_binding_from_struct() {
Tester::new_single_source_expect_ok("top level", "
struct Foo{ u32 field }
func foo() -> u32 {
if (let Foo{ field: thing } = Foo{ field: 1337 }) { return thing; }
return 0;
}
").for_function("foo", |f| {
... |
// models/mod.rs - Things that go in scenes and can be rendered.
// Written by quadfault
// 10/19/18
mod plane;
mod sphere;
pub use self::plane::*;
pub use self::sphere::*;
use crate::materials::Material;
use crate::math::{ Point, Ray, Vector };
pub struct HitResult<'a> {
pub t: f64,
pub hit_point: Point,
... |
use std::time;
pub fn current_unix_time() -> u32 {
time::SystemTime::now()
.duration_since(time::UNIX_EPOCH)
.unwrap()
.as_secs() as u32
}
|
use crate::rope::{
interval::Interval,
tree::{Leaf, Node, NodeInfo, TreeBuilder},
};
#[derive(Clone, Copy, Debug)]
pub enum BlockClass {
Code,
Heading1,
Heading2,
Heading3,
Heading4,
Heading5,
Heading6,
Paragraph,
Quote,
UnorderedList,
}
#[derive(Clone, Debug)]
pub stru... |
//! This module defines request and response types for the various actions supported by ECS.
pub mod ecs_action;
pub mod list_clusters;
|
// Copyright 2019 Conflux Foundation. All rights reserved.
// Conflux is free software and distributed under GNU General Public License.
// See http://www.gnu.org/licenses/
#[derive(Clone, Debug, Default, PartialEq, RlpEncodable, RlpDecodable)]
pub struct NodeMerkleProof {
pub delta_proof: Option<TrieProof>,
p... |
use crate::prelude::{ChunkKey, ChunkKey2, ChunkKey3};
use building_blocks_core::prelude::*;
use core::ops::{Bound, RangeInclusive};
pub trait DatabaseKey<N> {
type OrdKey: Copy + Ord;
type KeyBytes: AsRef<[u8]>;
fn into_ord_key(self) -> Self::OrdKey;
fn from_ord_key(key: Self::OrdKey) -> Self;
... |
use std::collections::{HashMap, HashSet};
use genome::{Genome, GenomeConfig, Population};
pub struct SpeciationConfig {
/// The maximum compatible distance between two genomes which are still part of the same species.
pub compatibility_threshold: f32,
// TODO(orglofch): Maybe add compatibility_excess_coe... |
#![doc = "Peripheral access API for STM32F042X microcontrollers (generated using svd2rust v0.13.0)\n\nYou can find an overview of the API [here].\n\n[here]: https://docs.rs/svd2rust/0.13.0/svd2rust/#peripheral-api"]
#![deny(missing_docs)]
#![deny(warnings)]
#![allow(non_camel_case_types)]
#![no_std]
extern crate bare_m... |
use std::{
cmp::Ordering,
ops::{Add, Mul, Sub},
};
use num::Zero;
use num_bigint::BigInt;
/// Type implementing arbitrary-precision decimal arithmetic
#[derive(Debug, PartialEq, Eq, Ord, Clone)]
pub struct Decimal {
digits: BigInt,
n: i32,
}
impl Decimal {
pub fn try_from(input: &str) -> Option<D... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.