text stringlengths 3.09k 13.9k |
|---|
use crate::*;
use mmrbi::*;
use std::io::Write;
use std::time::SystemTime;
pub fn update() {
download_extract_assets();
mmrbi::fs::write_if_modified_with("thindx/src/_examples.rs", |o|{
writeln!(o, "// This file is autogenerated by _xtask.rs")?;
writeln!(o)?;
writeln!(o, "//! # Exa... |
//! Kitsune Config Tuning Params
/// How long kitsune should wait before timing out when joining the network.
pub const JOIN_NETWORK_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(20);
/// Wrapper for the actual KitsuneP2pTuningParams struct
/// so the widely used type def can be an Arc<>
pub mod tunin... |
// Copyright 2018 <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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
use horrorshow::prelude::*;
use horrorshow::helper::doctype;
use tiny_http::Header;
use tiny_http::Response;
use tiny_http::Server as HTTPServer;
use url::Url;
use std::collections::{HashMap, HashSet};
use std::sync::{Arc, RwLock};
use crate::block_tree::BlockTree;
use std::thread;
use crate::block::Block;
use crate::n... |
//! Module for creating and managing long-running Subscriptions
//! to incoming events in the [`EventStore`].
//!
//! [`EventStore`]: ../store/trait.EventStore.html
use std::error::Error as StdError;
use std::sync::atomic::{AtomicU32, Ordering};
use std::sync::Arc;
use async_trait::async_trait;
use futures::stream::{... |
use atomic_float::AtomicF32;
use std::{
f32::consts::PI,
marker::PhantomData,
sync::{atomic::Ordering, Arc},
};
use oboe::{
AudioDeviceDirection, AudioDeviceInfo, AudioFeature, AudioOutputCallback, AudioOutputStream,
AudioOutputStreamSafe, AudioStream, AudioStreamAsync, AudioStreamBase, AudioStream... |
// Copyright 2015-2016 <NAME>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL... |
//! Registers of the SAM4L's USB controller
#![allow(dead_code)]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
use usbc::data::{Mode, Speed};
// Base address of USBC registers. See "7.1 Product Mapping"
const USBC_BASE: u32 = 0x400A5000;
registers![USBC_BASE, {
0x0000 => { "Device General C... |
// -----------------------------------------------
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
// ╚═╝ ╚═══╝ ╚═══... |
use crate::ast::Ast;
use nom::{
branch::alt,
bytes::complete::{is_a, is_not, take_while_m_n},
character::complete::{
char, digit0, digit1, hex_digit1, multispace1, oct_digit1, one_of,
satisfy,
},
combinator::{
all_consuming, map_opt, map_res, not, opt, peek, recognize, value,... |
use cgmath::Point2;
use std::time::{Duration, Instant};
use winit::{
event::{self, WindowEvent},
event_loop::{ControlFlow, EventLoop},
};
pub trait Application: 'static + Sized {
fn init(
swap_chain_desc: &wgpu::SwapChainDescriptor,
device: &wgpu::Device,
queue: &wgpu::Queue,
) ... |
mod keys;
mod sheet;
use std::collections::HashMap;
use std::path::PathBuf;
use anyhow::{Context, ensure, Result};
use csv;
use edit_distance::edit_distance;
use crate::params::Params;
use crate::strings::countable::Countable;
use crate::warnings::warn;
use keys::{Key, KeyItem};
use sheet::{Sheet, SheetRow, SheetRo... |
extern crate bytebuffer;
use self::bytebuffer::*;
use defines::*;
use types::*;
use std::io::{Read, Write, Result};
use std::mem::*;
use std::iter::FromIterator;
use std::sync::Mutex;
use std::collections::HashMap;
use std::collections::hash_map::Entry::{Occupied, Vacant};
macro_rules! total_bytes {
($e:expr) =>... |
use amethyst::{
core::HiddenPropagate,
ecs::{Entities, Join, WriteStorage},
};
use gv_core::{
ecs::{
components::{
damage_history::{DamageHistory, DamageHistoryEntries},
Dead, EntityNetMetadata, Monster, Player,
},
resources::net::EntityNetMetadataStorage,
... |
use crate::command;
use crate::connection;
use crate::db;
use crate::process_manager;
use crate::wire;
use anyhow::anyhow;
use anyhow::Result;
use async_trait::async_trait;
use model::CollaborativeSettlement;
use model::OrderId;
use model::Price;
use model::SettlementProposal;
use std::time::Duration;
use tokio_tasks::... |
use {SerialNumber, Ttl, std};
/// Associates the set of DNS types for a common format.
pub trait Format<'a> {
type Name: Name<'a>;
type RawOctets: AsRef<[u8]> + Clone + std::fmt::Debug + Eq + PartialEq;
}
/// Encapsulates a domain name.
pub trait Name<'a>: std::fmt::Display {
type LabelIter: Iterator<Item... |
use crate::use_case::{TxUseCase, UseCaseInput, UseCaseOutput};
// use super::{
// delete_all::{DeleteAllUseCase, DeleteAllUseCaseInput},
// insert::{InsertUseCase, InsertUseCaseInput},
// };
use apllodb_immutable_schema_engine_domain::{
abstract_types::ImmutableSchemaAbstractTypes,
row_projection_resul... |
// Copyright (c) 2019 - 2021 ESRLabs
//
// 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 ... |
//! Sum() aggregate function
use super::super::errors::*;
use super::super::types::*;
use arrow::datatypes::*;
use std::rc::Rc;
pub struct SumFunction {
value: ScalarValue,
data_type: DataType,
}
impl SumFunction {
pub fn new(dt: &DataType) -> Self {
let t;
match *dt {
DataTyp... |
use crate::{Library, TrainerDescriptor, TrainerStats};
use autograph::{
dataset::mnist::Mnist,
device::Device,
learn::{
neural_network::{
layer::{Conv, Dense, Forward, Layer, MaxPool, Relu},
NetworkTrainer,
},
Summarize, Train,
},
result::Result,
t... |
//! Day 9
use std::iter::FromIterator;
use itertools::Itertools;
use num_traits::{CheckedSub, NumAssignOps, Unsigned, Zero};
use crate::report_repair::find_sum;
trait Solution {
fn part_1(&self) -> u64;
fn part_2(&self) -> u64;
}
impl Solution for str {
fn part_1(&self) -> u64 {
let input = pars... |
#![feature(proc_macro_span)]
extern crate proc_macro;
use proc_macro::{Span, TokenStream};
use quote::{format_ident, quote};
use syn::{
parse::{Parse, ParseStream, Result},
parse_macro_input, Ident, ItemFn, LitInt, LitStr, Token,
};
struct AocTestAttributes {
part1: LitStr,
part2: LitStr,
file: O... |
use glium::index::PrimitiveType;
use glium::{glutin, implement_vertex, program, uniform, Surface};
use lodtree::coords::QuadVec;
use lodtree::*;
// the chunk struct for the tree
struct Chunk {
visible: bool,
cache_state: i32, // 0 is new, 1 is merged, 2 is cached, 3 is both
selected: bool,
in_bounds: ... |
use crate::{
config::{attributes::AttrError, config::Include, validate::ValidationError},
format_diagnostic::ToDiagnostic,
parser::{
ast::{Ast, AstType},
lexer, parse_error,
},
};
use codespan_reporting::{diagnostic, files};
use eww_shared_util::{AttrName, Span, Spanned, VarName};
use si... |
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
crate::{
file::{ArchiveResolver, FileResolver, Resolver, TarResolver},
manifest::{Flash, FlashManifest},
},
anyhow::{Cont... |
// use serde_json;
use std::{
fs::{self, read_dir},
path::{Path, PathBuf},
};
use tom_syntax::{TomlDoc};
use crate::util::{print_difference, test_data_dir};
enum ExpectErrors {
Yes,
No,
Maybe,
}
fn dir_tests(paths: &[&str], expect_errors: ExpectErrors) {
for path in collect_tests(paths) {
... |
// Copyright (c) 2021 <NAME> <<EMAIL>>
// All rights reserved.
//
// This software and the accompanying materials are made available under
// the terms of the ISC License which is available in the project root as LICENSE-ISC, AND/OR
// the terms of the MIT License which is available at in the project root as LICENSE-MI... |
use http::{Request, Response, StatusCode};
use hyper::Body;
use proxy_client::HttpProxyInfo;
use std::{
future::Future,
pin::Pin,
sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
};
use tokio::sync::Mutex;
use crate::auth::Authenticator;
#[derive(thiserror::Error, Debug)]
pub enum Error... |
use crate::resource::ShowState;
use crate::component::GodsNode;
use amethyst:: {
Error,
assets,
core::{
self,
SystemDesc,
math::{UnitQuaternion, Vector3, Point3, Vector2},
transform::Transform
},
derive::SystemDesc,
ecs::prelude::{
Entity, Join, Read, Rea... |
use super::bit_depth::BitDepth;
use super::file_data::FileData;
use super::file_header::FileHeader;
use super::image::BitMap;
use super::info_header::InfoHeader;
use super::rgb_quad::RgbQuad;
use super::rgba::Rgba;
pub struct File {
file: FileHeader,
info: InfoHeader,
colors: RgbQuad,
data: FileData,
}... |
//! Implements of all of the bot's commands.
#![allow(missing_docs)]
use {
rand::prelude::*,
serenity::{
framework::standard::{
Args,
CommandResult,
macros::{
command,
group,
},
},
model::prelude::*,
... |
use super::*;
use crate::Pallet as BtcRelay;
use bitcoin::{
formatter::{Formattable, TryFormattable},
types::{
Block, BlockBuilder, RawBlockHeader, Transaction, TransactionBuilder, TransactionInputBuilder,
TransactionInputSource, TransactionOutput,
},
};
use frame_benchmarking::{account, ben... |
use std::io::Read;
use std::io;
use std::fs::File;
use std::path::Path;
use std::error::Error;
use std::fmt;
use std::env;
use hyper;
use hyper::client::Client;
use hyper::header;
use hyper::net::HttpsConnector;
use hyper::status::StatusCode;
use hyper_native_tls::NativeTlsClient;
use hyper::client::IntoUrl;
use serd... |
use crate::{PingClientFactory, PingResultDto, PingResultProcessor, PortRangeList};
use std::fmt;
use std::fmt::Debug;
use std::net::{IpAddr, SocketAddr};
use std::str::FromStr;
use std::sync::{Arc, Mutex};
use std::{path::PathBuf, time::Duration};
pub const RNP_NAME: &str = "Rnp";
pub const RNP_SERVER_NAME: &str = "Rn... |
//! ELF File Loader
use crate::*;
use super::loading;
use alloc::vec::Vec;
use libutils::paths::PathBuffer;
use super::process::Process;
use super::stats::MemoryStats;
/// Elf Header Structure
#[repr(C)]
#[derive(Debug, Clone, Copy)]
struct ElfHeader
{
ident_magic: u32,
ident_class: u8,
ident_data: u8... |
use h2_support::prelude::*;
use h2_support::assert_ping;
#[test]
fn recv_single_ping() {
let _ = env_logger::try_init();
let (m, mock) = mock::new();
// Create the handshake
let h2 = client::handshake(m)
.unwrap()
.and_then(|(client, conn)| {
conn.unwrap()
.... |
#![allow(unused)]
use std::fmt::Display;
struct Point<T> {
x: T,
y: T,
}
// 为实现了Display的实例实现show方法
impl<T: Display> Point<T> {
fn show(&self) {
println!("x:{}, y:{}", self.x, self.y);
}
}
impl<T> Point<T> {
fn x(&self) -> &T {
&self.x
}
}
// 这段代码意味着 Point<f32> 类型会有一个方法distan... |
//! FLIC browser.
extern crate flic;
extern crate sdl2;
use std::env;
use std::path::Path;
use flic::{FlicFile,RasterMut};
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::pixels::PixelFormatEnum;
const SCREEN_W: u32 = 640;
const SCREEN_H: u32 = 400;
const MIN_SCREEN_W: u32 = 320;
const MIN_SCREEN_H: u... |
//! Orchestrator is a sort of specialized relayer for Althea-Gravity that runs on every validator.
//! Things this binary is responsible for
//! * Performing all the Ethereum signing required to submit updates and generate batches
//! * Progressing the validator set update generation process.
//! * Observing even... |
use std::{thread, error, result};
use std::sync::{Arc, Mutex, mpsc};
use std::io::{Read, Write};
use classify::{count_kmers_in_read, calc_scaling_factors};
use seq;
use kmer;
// number of Records that can be kept in the channel buffer at once
const BUFFER_SIZE: usize = 100;
struct CountResult {
hap_a_count: u32,
... |
/*! Thread-safe language-separated text/metadata writer.
Each language (provided by [crate::lang::LANG]) is given a [self::Writer] wrapped into an [Arc<Mutex<Writer>>].
## Warning
!*/
use std::{
collections::HashMap,
path::Path,
str::FromStr,
sync::{Arc, Mutex},
};
use crate::io::writer::Writer;
use... |
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use std::{
io::{BufRead, BufReader, Write},
process::{Command as StdCommand, Stdio},
sync::Arc,
};
#[cfg(unix)]
use std::os::unix::process::ExitStatusExt;
#[cfg(windows)]
... |
#![allow(clippy::option_map_unit_fn)]
//! General io for reading/writing from/to buffers.
use std::io::{self, SeekFrom};
use crate::blowfish::Blowfish;
use crate::constants::{
PK2_CURRENT_DIR_IDENT, PK2_FILE_BLOCK_SIZE, PK2_FILE_ENTRY_SIZE, PK2_PARENT_DIR_IDENT,
};
use crate::error::OpenResult;
use crate::raw::b... |
extern crate ggez;
extern crate rand;
use std::time::{Duration, Instant};
use ggez::graphics;
use ggez::input::keyboard;
use ggez::input::keyboard::KeyCode;
use ggez::nalgebra as na;
use rand::Rng;
const SCALE: u32 = 12;
const SIZE: u32 = 42;
#[derive(PartialEq, Eq)]
struct Point {
x: i32,
y: i32,
}
const ... |
// Copyright 2022 RisingLight Project Authors. Licensed under Apache-2.0.
use std::path::PathBuf;
use std::sync::{Arc, Mutex};
use itertools::Itertools;
use moka::future::Cache;
use tokio::fs::OpenOptions;
use tokio::io::AsyncReadExt;
use super::super::{Block, BlockCacheKey, Column, ColumnIndex, ColumnSeekPosition, ... |
/*
src/panels/funcs.rs
Copyright (c) 2019-2022 <NAME> All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
... |
#[derive(PartialEq, Debug, Clone, Copy)]
pub enum TokenKind {
// Single-character tokens.
LeftParen,
RightParen,
Subtract,
Add,
Multiply,
Power,
Comma,
// Literals.
Identifier,
Number,
// Extras.
EOF,
}
// struct to hold ths human readable components of a position ... |
//! The `Encoding` trait: common operations across all encoders
#[cfg(feature = "alloc")]
use alloc::{string::String, vec::Vec};
#[cfg(feature = "std")]
use std::{
fs::File,
io::{Read, Write},
path::Path,
};
#[cfg(all(unix, feature = "std"))]
use std::{fs::OpenOptions, os::unix::fs::OpenOptionsExt};
#[cfg(... |
use std::collections::HashMap;
use std::io::{Write as _, BufReader, BufWriter};
use std::path::Path;
use super::*;
use super::arena::{Arena, NodeKind};
pub struct ReactiveParEnforcer {
dict: LTLDict,
//n_forall: usize,
//ltl: LTLAst<usize>,
inputs: HashSet<usize>,
arena: Arena,
state: usize,
... |
//! gRPC service implementations for `router2`.
use std::sync::Arc;
use generated_types::{google::FieldViolation, influxdata::pbdata::v1::*};
use hashbrown::HashMap;
use metric::U64Counter;
use mutable_batch::MutableBatch;
use observability_deps::tracing::*;
use schema::selection::Selection;
use tonic::{Request, Resp... |
use image::{
png::{CompressionType, FilterType, PngEncoder},
ColorType,
};
use serde::Deserialize;
use std::convert::TryInto;
use worker::*;
use embedded_graphics::{
mono_font::{
ascii::{FONT_10X20, FONT_7X13_BOLD},
MonoTextStyle,
},
pixelcolor::Rgb888,
prelude::*,
primitive... |
mod parser;
mod sim;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
fn add_text(s: &str);
fn add_square(white: bool);
}
fn rule_cx(a: bool, b: bool, c:bool) -> bool{
let mut tmp = 0;
if a {tmp += 4};
if b {tmp += 2};
if c {tmp += 1};
const CX_ARR: [bool;8] = [false, true, true,... |
use std::convert::TryFrom;
use std::fs::File;
use std::path::PathBuf;
use clap::{App, Arg, ArgMatches};
use crate::command::Command;
use crate::commands::{ALPHABETICAL, LAST_MODIFIED};
use crate::commands::files::{alpabetical, last_modified, regular_ordering, iterate_over, get_files_with_filter};
use crate::rules::{... |
use parquet2::{
compression::Compression as CompressionDef,
metadata::{
ColumnChunkMetaData as ColumnChunkMetaDataDef, FileMetaData as FileMetaDataDef,
RowGroupMetaData as RowGroupMetaDataDef, SchemaDescriptor as SchemaDescriptorDef,
},
schema::{
types::{
BasicTypeInf... |
use std::collections::HashSet;
use priority_queue::DoublePriorityQueue;
use super::utils::map::*;
#[aoc_generator(day15)]
fn parse_input(input: &str) -> Vec<Vec<u64>> {
let mut output: Vec<Vec<u64>> = vec![];
for line in input.lines() {
let line = line.trim();
if line.is_empty() {
... |
use std::collections::HashSet;
use std::convert::AsRef;
use std::ffi::{c_void, CString};
use std::fmt;
use std::hash::{Hash, Hasher};
use std::rc::Rc;
use crate::def::{ClassLike, Define, Method, Parent};
use crate::interpreter::Mrb;
use crate::method;
use crate::sys;
use crate::MrbError;
pub struct Spec {
name: S... |
use crate::model::index::Index;
use crate::MapMut;
use std::borrow::Borrow;
use std::marker::PhantomData;
pub struct BinaryHeap<K, T, M> {
heap: Vec<Option<(K, T)>>,
map: M,
_phantom_data: PhantomData<T>,
}
impl<K: Clone, T: Ord, M: MapMut<K, Value = Option<Index>>> BinaryHeap<K, T, M> {
/// Constructs a new bina... |
//! Models for the entity collection.
use std::collections::{HashMap, HashSet};
use std::ops::{Deref, DerefMut};
use eyre::{bail, Result, WrapErr};
use isolanguage_1::LanguageCode;
use mongodb::bson::oid::ObjectId;
use mongodb::bson::Uuid;
use serde::{Deserialize, Serialize};
use serde_json::{Map, Value};
use url::Url... |
// The challenge here was appropriately mapping 3D points to a 2D canvas.
// It's a very simple drawing, but I wanted to explore this functionality of nannou
// to open more possibilities.
//
// Algorithm in a nutshell
// 1. start with n_lines evenly spaces points along to the top of the x axis.
// 2. for each point, a... |
// Copyright (c) 2017 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be ... |
#[link(wasm_import_module = "test")]
#[cfg(target_arch = "wasm32")]
extern "C" {
#[link_name = "inner_arrays_1"]
fn __m_generated_wrapper_func__inner_arrays_1(arg_0: u32, arg_1: u32);
}
#[cfg(not(target_arch = "wasm32"))]
extern "C" {
#[link_name = "inner_arrays_1"]
fn __m_generated_wrapper_func__inner_... |
use std::collections::HashMap;
use std::fmt;
use std::io::Cursor;
use std::rc::Rc;
use std::result;
use byteorder::{BigEndian, ByteOrder};
use bytes::Bytes;
use nom_sql::{self, ColumnConstraint, CreateTableStatement, SqlQuery, SqlType};
use crate::btree::{BTree, Cell, InteriorCell};
use crate::errors::*;
use crate::p... |
use std::{collections::HashMap, path::Path};
use sled::transaction::ConflictableTransactionError;
use crate::memguard::weak::ZeroingWords;
use super::{generate_block_id, BlockStore, Change, ChangeLog, RingContent, RingId, StoreError, StoreResult};
#[derive(Debug)]
pub struct SledBlockStore {
node_id: String,
db... |
/*
* Copyright 2018 Intel Corporation
* Copyright 2019 Cargill Incorporated
*
* 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
*
* Un... |
//! Defines the supported SPF *Mechanisms* and *Modifiers*
//!
//! Whilst *Mechanisms* and *Modifiers* differ slightly. This difference is so
//! small as to not require any distinction in the current code base.
//!
/// Defines the possible mechanisms.
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Kind {
/// ... |
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
anyhow::Error,
fuchsia_async::{self as fasync, net::TcpListener},
fuchsia_merkle::Hash,
futures::prelude::*,
hyper::{
hea... |
// Copyright (c) 2016-2021 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
// Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
// http://www.apac... |
// External Dependencies ------------------------------------------------------
use allegro::{
Core,
Color as AllegroColor,
Display,
DisplayClose,
EventQueue,
KeyUp,
KeyDown,
Timer,
TimerTick
};
use rand::{SeedableRng, XorShiftRng};
use allegro_font::{FontDrawing, FontAddon, Font, Fo... |
use num::{Bounded, Signed};
use std::{f32, f64};
use approx::{RelativeEq, UlpsEq};
use crate::scalar::ComplexField;
#[cfg(all(not(feature = "std"), not(feature = "libm_force"), feature = "libm"))]
use num::Float;
//#[cfg(feature = "decimal")]
//use decimal::d128;
/// Trait shared by all reals.
#[allow(missing_docs)... |
use core::{
char::decode_utf16,
num::NonZeroU32,
ptr::{null, null_mut},
slice,
};
use crate::base_typedef::*;
macro_rules! kernel32_fn {
(
$(#[$fn_meta:meta])*
fn $( $fn_tokens:tt )*
) => {
#[link(name = "Kernel32")]
extern "system" {
$(#[$fn_meta])*
fn $( $fn_tokens )*;
}
... |
/*---------------------------------------------------------------------------------------------
* Copyright © 2016-present Earth Computing Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE.txt in the project root for license information.
*----------------------------------------------... |
use std::cell::RefCell;
use std::rc::Rc;
use processing::errors::ProcessingErr;
use processing::Screen;
use rand::Rng;
const TARGET: &str = "to be or not to be";
// key variables to tweak for a GA
// these values were chosen specifically
// to get a solution on average in 1000 generations
// larger populations will ... |
use std::{
thread,
rc::Rc,
sync::RwLock,
collections::HashMap,
};
extern crate rand;
use rand::{Rng, seq::SliceRandom};
use super::observer::{
ICallObserver,
IStateObserver,
};
use exec::call::Call;
use exec::fd_info::Fd;
use state::id::StateTableId;
use state::state::StateInfo;
use config::F... |
use std::fs;
use std::str::FromStr;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum SomeError {
#[error("could not parse")]
ParseError,
}
#[derive(Clone)]
struct Board {
numbers: [u8; 25],
found: [bool; 25],
last_called: Option<u8>,
won: bool,
}
impl Board {
fn coord(x: u8, y: u8) ... |
use bootloader::boot_info::{FrameBufferInfo, PixelFormat};
use core::{
fmt::{self, Write},
ptr,
};
use font8x8::UnicodeFonts;
// Additional vertical space between lines
const LINE_SPACING: usize = 2;
// BLOCK_SIZE is the number of pixels in a block
pub const BLOCK_SIZE: usize = 8;
#[derive(Debug, PartialEq, ... |
use syn::{
braced, bracketed,
parse::{Parse, ParseStream, Result},
BareFnArg, Ident, Token, Type, TypePath,
};
#[derive(Debug)]
pub enum SystemType {
ForEach,
Iterator {
add_stores: Option<Vec<TypePath>>,
remove_stores: Option<Vec<TypePath>>,
},
}
impl Default for SystemType {
... |
//! Static files bundled with documentation output.
//!
//! All the static files are included here for centralized access in case anything other than the
//! HTML rendering code (say, the theme checker) needs to access one of these files.
//!
//! Note about types: CSS and JavaScript files are included as `&'static str`... |
use dkg_core::primitives::{
group::{Group, Node},
joint_feldman,
types::DKGOutput,
};
use dkg_core::{DKGPhase, Phase2Result};
use rand::rngs::ThreadRng;
use randcast_mock_demo::contract::*;
use randcast_mock_demo::test_helpers::InMemoryBoard;
use std::collections::HashMap;
use threshold_bls::{
curve::bl... |
extern crate clap;
extern crate rand;
pub const DEFAULT_ENGLISH_DICTIONARY_PATH: &'static str = "/usr/share/dict/words";
#[derive(Debug)]
pub struct EnglishPasswordOptions {
pub num_words: u8,
pub dictionary_path: String,
}
#[derive(Debug)]
pub struct KanaPasswordOptions {
pub syllable_counts: Vec<u8>,
}... |
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
attr, to_binary, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Response, StdResult,
WasmMsg,
};
use cw_storage_plus::U64Key;
use crate::state::{
read_bets_ticket, read_config, read_curr_avail_tickets, remove_bets_tick... |
use bson::{Bson, Document};
use bson::ValueAccessError;
use bson::oid::ObjectId;
use bson::spec::BinarySubtype;
use chrono::Utc;
#[test]
fn ordered_insert() {
let mut doc = Document::new();
doc.insert("first".to_owned(), Bson::I32(1));
doc.insert("second".to_owned(), Bson::String("foo".to_owned()));
do... |
//! This example will showcase the beauty of collectors.
//! They allow to await messages or reactions from a user in the middle
//! of a control flow, one being a command.
use std::collections::HashSet;
use std::env;
use std::time::Duration;
use serenity::async_trait;
use serenity::collector::{EventCollectorBuilder, ... |
//! Methods for reading hue data out of hues.mul
//!
//! Hues are represented in a continuous, unindexed file as groups -
//! `|header: u32|hues: [HueEntry..8]`
//!
//! Individual HueEntries are defined as
//! `|color_table:[u16..32]|table_start:u16|table_end:u16|name:[u8..20]|`
//!
use byteorder::{LittleEndian, ReadBy... |
use crate::{
game::tile::Letter,
util::fsm::{
small_fsm::{SmallFsm, SmallStateId, Transition},
Fsm, FsmBuilder, FsmSequence, StateId,
},
};
use serde::{Deserialize, Serialize};
use std::collections::{hash_map, HashMap};
/// A state in the [`FastFsm`]. Stores only the transitions to other st... |
use std::io;
use std::io::BufReader;
use std::fs::File;
use serde_json;
use cgmath::*;
use shape::*;
use vec3d::Vec3d;
use vec3d::Rotatable;
use light::Light;
use color;
use color::Color;
#[derive(Serialize, Deserialize)]
pub struct Scene {
shapes: Vec<Shape>,
lights: Vec<Light>,
camera_pos: Vec3d,
... |
use crate::chain::Coordinate;
use crate::node::ConsensusType;
use base64::{self, DecodeError};
use eth2::types::{
ErrorMessage, GenericResponse, Hash256, IdentityData, Slot, SyncingData, VersionData,
};
use eventsource_client as sse;
use futures::{Stream, TryStreamExt};
use reqwest::{Client, Error as HTTPError};
us... |
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any lat... |
use libc::{c_char, c_int, FILE};
use object::*;
use code::*;
use pystate::PyThreadState;
use pyarena::PyArena;
pub const PyCF_MASK : c_int = (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT |
CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION |
CO_FUTURE_UNICODE_LITERALS);
pub con... |
mod square;
use gameboy::apu::square::SquareChannel;
const AUDIO_BUFFER_LENGTH: usize = 8192;
pub struct APU {
audio_buffer: Box<[f32]>,
buffer_index: usize,
counter: u32, /* Increments at 4.2 Mhz */
timer: u32, /* Increments at 512 Hz*/
sample_rate: u32, /* Sample per second (Hz) */
square_1: SquareChannel,
... |
// `allow` required to silence warnings because only
// one variant is used in several exampleas below.
#[allow(dead_code)]
fn main () {
match_example();
// destructuring
destructuring_enums();
destructuring_pointers();
destructuring_structures();
destructuring_tuples();
// Guards
mat... |
// Copyright 2019 Google LLC
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
//! A TCP [`Transport`] that serializes as JSON.
#![feature(arbitrary_self_types, async_await)]
#![deny(missing_docs)]
use futures::{co... |
//! Point light can be represented as light bulb which hangs on wire - it is
//! spherical light source which emits light in all directions. It has single
//! parameter - radius at which intensity will be zero. Intensity of light will
//! be calculated using inverse square root law.
//!
//! # Light scattering
//!
//! P... |
pub use crate::*;
use frame_support::sp_io::TestExternalities;
use frame_support::traits::GenesisBuild;
use sp_core::crypto::Ss58Codec;
use frame_support::traits::Hooks;
use std::include_bytes;
use move_vm::genesis::GenesisConfig;
// Genesis configuration for Move VM.
pub type ModuleName = Vec<u8>;
pub type FunctionNa... |
// Copyright 2020 Contributors to the Parsec project.
// SPDX-License-Identifier: Apache-2.0
use crate::{
interface_types::algorithm::HashingAlgorithm,
structures::{PcrSelectSize, PcrSlot, PcrSlotCollection},
tss2_esys::TPMS_PCR_SELECTION,
Error, Result, WrapperErrorKind,
};
use log::error;
use std::con... |
use super::{DataSource, DataSourceReader, PartSize, SourceKey};
use sha1::{digest::Digest, Sha1};
use std::{
fmt::{self, Debug},
io::{Read, Result as IoResult},
num::NonZeroUsize,
sync::Mutex,
};
#[cfg(feature = "async")]
use {super::AsyncDataSourceReader, futures::future::BoxFuture};
pub(crate) struc... |
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum GitSpec {
Rev,
Tag,
Branch,
}
#[derive(Debug, PartialEq, Eq, Clone)]
enum DependencySource {
Version {
version: Option<String>,
path: Option<String>,
registry: Option<String>,
},
Git {
repo: String,
sp... |
use colored::Colorize;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SpaceColor {
Black,
White,
Transparent,
Unknown(char),
}
impl SpaceColor {
pub fn from_char(c: char) -> Self {
match c {
'0' => Self::Black,
'1' => Self::White,
'2' => Self::Tra... |
// Copyright 2018 The Grin 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 agree... |
// Copyright 2018 The Grin 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 agree... |
use std::marker::PhantomPinned;
use std::ops::Index;
use std::pin::Pin;
use std::ptr::NonNull;
use std::rc::Rc;
use std::sync::Arc;
use crate::co;
use crate::gui::base::Base;
use crate::gui::events::RadioGroupEvents;
use crate::gui::layout_arranger::{Horz, Vert};
use crate::gui::native_controls::radio_butto... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.