text stringlengths 8 4.13M |
|---|
extern crate find_folder;
extern crate piston_window;
extern crate conrod_piston;
extern crate sprite;
extern crate piston;
use sprite::Scene;
use self::piston_window::{PistonWindow, Window, WindowSettings};
use self::piston_window::{G2d, G2dTexture, TextureSettings, Texture, Flip};
use self::piston_window::OpenGL;
u... |
use crate::util::{Direction, Point2};
use std::iter;
use std::str::FromStr;
impl Point2 {
fn move_in_direction(&mut self, direction: Direction) {
self.x += match direction {
Direction::Right => 1,
Direction::Left => -1,
_ => 0,
};
self.y += match directio... |
//! Schemas and processing logic for GoodReads data.
//!
//! This module contains the code for processing GoodReads data from the UCSD Book Graph.
//! The data layout is documented at <https://bookdata.piret.info/data/goodreads.html>.
pub mod author;
pub mod book;
pub mod genres;
pub mod interaction;
pub mod simple_int... |
extern crate llvm_sys;
extern crate iron_llvm;
use self::llvm_sys::prelude::LLVMValueRef;
use self::iron_llvm::core;
use self::iron_llvm::core::types::{RealTypeCtor, RealTypeRef};
use self::iron_llvm::{LLVMRef, LLVMRefCtor};
use parser::{ParseResult, AST, ASTNode, Prototype, Function, Expression};
pub fn compile_as... |
// Copyright 2019, 2020 Wingchain
//
// 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... |
use super::{Object, TaggedValue};
use crate::runtime::Symbol;
use crate::SchemeExpression;
macro_rules! impl_from {
($T:ty, $as:ty, $constructor:path) => {
impl From<$T> for Object {
fn from(x: $T) -> Object {
$constructor(x as $as)
}
}
};
}
impl_from!(i... |
use super::Block;
impl super::Block {
/// Constructor.
pub fn new(value: u16, length: u8) -> Block {
Block { value, length }
}
/// Returns a content (total rank to go) of the block.
pub fn value(&self) -> u16 {
self.value
}
/// Returns size of the block.
pub fn length(... |
mod cone;
pub use self::cone::*;
|
#![feature(test)]
extern crate fnv;
extern crate rand;
extern crate rayon;
extern crate rayon_hash;
extern crate test;
use rand::{Rng, SeedableRng, XorShiftRng};
use std::collections::{HashMap as StdHashMap, HashSet as StdHashSet};
use rayon_hash::{HashMap as RayonHashMap, HashSet as RayonHashSet};
use std::iter::Fro... |
#[cfg(test)]
mod test;
use crate::{
bson::{doc, Document},
cmap::{Command, RawCommandResponse, StreamDescription},
error::Result,
operation::{append_options, remove_empty_write_concern, OperationWithDefaults},
options::{DropIndexOptions, WriteConcern},
Namespace,
};
pub(crate) struct DropIndex... |
use super::regex_handle::*;
use ego_tree::NodeRef;
use reqwest::blocking::Response;
use scraper::{ElementRef, Html, Node};
pub(super) fn graphql_response_parse(rep: Response) -> Result<serde_json::Value, String> {
match rep.text() {
Ok(c) => {
//dbg!(&c);
serde_json::from_str(&c).ma... |
pub use board::*;
pub use entity::*;
mod board;
mod entity;
|
/*
Copyright (c) 2016 Saurav Sachidanand
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, distribu... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use crate::models::*;
use reqwest::StatusCode;
use snafu::{ResultExt, Snafu};
pub mod dimensions {
use crate::models::*;
use reqwest::StatusCode;
use snafu::{ResultExt, Snafu};
pub async f... |
use std::error;
use std::fmt;
#[derive(Debug, PartialEq)]
pub enum CryptoError {
BadPadding,
}
impl fmt::Display for CryptoError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
CryptoError::BadPadding => write!(f, "Bad PKCS7 padding"),
}
}
}
impl error::... |
use lv2_raw::midi;
use lv2_raw::urid;
use lv2::atom;
#[derive(Debug)]
pub enum MidiEvent {
AfterTouch { note_num: u8, pressure: u8 },
Bender { value: u16 },
ChannelPressure { pressure: u8 },
Controller { controller_num: u8, controller_val: u8 },
NoteOn { note_num: u8, velocity: u8 },
NoteOff {... |
use chrono::{DateTime, Local};
use std::collections::VecDeque;
use zellij_tile::prelude::*;
#[derive(Default)]
struct State {
log: VecDeque<DateTime<Local>>,
}
register_plugin!(State);
impl ZellijPlugin for State {
fn load(&mut self) {
// Setup the timer event subscription
subscribe(&[EventTy... |
use alloc::vec;
use alloc::vec::Vec;
use crate::{Read, Write, NumBytes, UnsignedInt, WriteError, ReadError};
use codec::{Encode, Decode};
#[derive(Clone, Debug, Default, Encode, Decode, PartialEq)]
pub struct FlatMap<K, V> {
maps: Vec<(K, V)>,
}
impl<K, V> FlatMap<K, V> {
pub fn new(key: K, value: V) -> Self ... |
use clap::{App, Arg};
use tablespanner::render_json_table;
fn main() {
let opts = App::new(env!("CARGO_PKG_NAME"))
.author(env!("CARGO_PKG_AUTHORS"))
.version(env!("CARGO_PKG_VERSION"))
.about("Calculates JSON table layouts")
.arg(Arg::with_name("SPANINFO")
.help(r#"
... |
use std::collections::BTreeMap;
use std::io::{Error, ErrorKind, Result};
use std::ops::Bound::Included;
use std::pin::Pin;
use std::task::{Context, Poll};
use crypto::digest::Digest;
use crypto::md5::Md5;
use crate::backend::AddressEnable;
use crate::{AsyncReadAll, AsyncWriteAll, Request, Response};
use hash::Hash;
u... |
use std::fs::File;
use std::io;
use std::io::{BufRead, BufReader};
fn read_input() -> Result<Vec<String>, io::Error> {
let filename = "input";
let file = File::open(filename)?;
let reader = BufReader::new(file);
let input: Vec<String> = reader.lines().collect::<Result<_, _>>().unwrap();
Ok(input... |
#[derive(Clone)]
pub struct Reindeer {
speed: u32,
run_time: u32,
rest_time: u32,
run_timer: u32,
rest_timer: u32,
total_distance: u32,
points: u32,
}
impl Reindeer {
pub fn new(speed: u32, run_time: u32, rest_time: u32) -> Reindeer {
Reindeer {
speed,
ru... |
use crate::{
errors::{AddrError, Error},
peer_store::{
peer_id_serde, PeerId, Score, SessionType, ADDR_MAX_FAILURES, ADDR_MAX_RETRIES,
ADDR_TIMEOUT_MS,
},
};
use ipnetwork::IpNetwork;
use p2p::multiaddr::{self, multihash::Multihash, Multiaddr, Protocol};
use serde::{Deserialize, Serialize};
... |
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct InstantiateMsg {
pub currency: String,
pub count: u32,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_ca... |
/*
* Datadog API V1 Collection
*
* Collection of all Datadog Public endpoints.
*
* The version of the OpenAPI document: 1.0
* Contact: support@datadoghq.com
* Generated by: https://openapi-generator.tech
*/
/// AwsLogsServicesRequest : A list of current AWS services for which Datadog offers automatic log colle... |
//! Module containing the implementation of a SPSC RingBuffer built on futures_rs.
use futures::{
Async,
Future,
Poll,
task
};
use std::{
cmp
};
use std::sync::{
Arc,
Mutex
};
/// The sending end of the SPSC RingBuffer.
#[derive( Debug )]
pub struct Sender< T : Clone + Default > {
inne... |
use std::collections::{BTreeMap, HashMap, HashSet};
use std::time::Instant;
const INPUT: &str = include_str!("../input.txt");
fn read_data() -> (
HashMap<&'static str, usize>,
HashMap<&'static str, HashSet<&'static str>>,
) {
let mut allergen_to_ingredients = HashMap::new();
let mut ingredient_counts... |
#![allow(clippy::needless_return)]
use clap::{crate_version, App, Arg};
use rofuse::consts::FOPEN_DIRECT_IO;
#[cfg(feature = "abi-7-26")]
use rofuse::consts::FUSE_HANDLE_KILLPRIV;
#[cfg(feature = "abi-7-31")]
use rofuse::consts::FUSE_WRITE_KILL_PRIV;
use rofuse::TimeOrNow::Now;
use rofuse::{
Filesystem, KernelConf... |
fn main() {
// Listing 8-1: Creating a new, empty vector to hold values of type i32
let v: Vec<i32> = Vec::new() ;
// Lissting 8-2: Creating a new vector containing values
let v = vec![1, 2, 3] ;
// Listing 8-3: Using the push method to add values to a vector
let mut v = Vec::new() ;
v.push(5) ;
v.push(6) ;... |
#[doc = "Register `EXTI_FTSR3` reader"]
pub type R = crate::R<EXTI_FTSR3_SPEC>;
#[doc = "Register `EXTI_FTSR3` writer"]
pub type W = crate::W<EXTI_FTSR3_SPEC>;
#[doc = "Field `FT65` reader - FT65"]
pub type FT65_R = crate::BitReader;
#[doc = "Field `FT65` writer - FT65"]
pub type FT65_W<'a, REG, const O: u8> = crate::B... |
/// Interface to run a child process for the shim.
///
/// Most of this module, especially the part setting up the shild process, is
/// based on how Pip creates an EXE launcher for console scripts, from
/// [distlib], developed in C by Vinay Sajip.
///
/// [distlib]: https://github.com/vsajip/distlib/blob/master/PC/la... |
pub fn find_saddle_points(input: &[Vec<u64>]) -> Vec<(usize, usize)> {
let mut results: Vec<(usize, usize)> = vec![];
for row in 0..input.len() {
for column in 0..input[row].len() {
let candidate = input[row][column];
if input[row].iter().all(|&x| candidate >= x) {
... |
use super::*;
use std::str::from_utf8;
pub struct NameSection<'a> {
pub count: u32,
pub entries_raw: &'a [u8],
}
pub struct NameEntryIterator<'a> {
count: u32,
local_count: u32,
iter: &'a [u8]
}
pub enum NameEntry<'a> {
Function(&'a str),
Local(&'a str),
}
impl<'a> NameSection<'a> {
... |
use crate::{types::CalendarMonth, Ledger, Transaction};
use chrono::Datelike;
use decimal::d128;
use std::borrow::Cow;
use std::collections::{BTreeMap, HashMap};
use uuid::Uuid;
type CategoryID = Uuid;
#[derive(Default)]
pub struct Budget {
/// a list of the transactions that make up the budget
transactions: ... |
fn main() {
let mut matrix_to_reduce: Vec<Vec<f64>> = vec![vec![1.0, 2.0 , -1.0, -4.0],
vec![2.0, 3.0, -1.0, -11.0],
vec![-2.0, 0.0, -3.0, 22.0]];
let mut r_mat_to_red = &mut matrix_to_reduce;
let rr_mat_to_red ... |
#![feature(globs)]
#![crate_type = "bin"]
extern crate bmp;
use std::os;
use std::rand::{Rng,Isaac64Rng,SeedableRng};
fn main() {
let args = os::args();
let orig_file_path = args[1].as_slice();
let b_img = bmp::BMPimage::open(orig_file_path);
let width = b_img.width as uint;
let height = b_img.height as u... |
//extern crate diesel;
//extern crate r2d2;
//extern crate r2d2_diesel;
use actix_web::{
HttpResponse,
web,
};
//use diesel::MysqlConnection;
//use r2d2::Pool;
use super::super::{
service,
request,
response,
};
pub fn index(
payload: web::Query<request::design::Index>,
// db: web::Data<Pool... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use super::{models, API_VERSION};
#[non_exhaustive]
#[derive(Debug, thiserror :: Error)]
#[allow(non_camel_case_types)]
pub enum Error {
#[error(transparent)]
BillingAccounts_List(#[from] billing_... |
// Copyright 2018-2020, Wayfair GmbH
//
// 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... |
use super::local_player::LocalPlayer;
use super::offsets;
use crate::sdk::player::Player;
use log::*;
use memlib::memory::{get_module, read_memory, set_global_handle, Address, Handle, Module};
// The context passed into the hack loop containing all of our
pub struct GameContext {
pub client_module: Module,
pu... |
use std::mem;
use std::sync::Arc;
use tuikit::prelude::*;
use unicode_width::UnicodeWidthStr;
use crate::event::{Event, EventHandler, UpdateScreen};
use crate::options::SkimOptions;
use crate::theme::{ColorTheme, DEFAULT_THEME};
use crate::util::clear_canvas;
#[derive(Clone, Copy, PartialEq)]
enum QueryMode {
Cm... |
use serde::{Deserialize, Serialize};
use rmp_serde::{Deserializer, Serializer};
#[derive(Debug, PartialEq, Deserialize, Serialize)]
pub struct Player {
name: String,
pos: (f32, f32, f32),
}
#[cfg(test)]
mod test {
#[test]
fn send() {
let player = Player {
pos: (0., 1., 0.),
... |
use crate::Result;
use crossterm::{
cursor::{self, MoveTo},
style,
terminal::{self, ClearType},
ExecutableCommand, QueueableCommand,
};
use std::io::Write;
pub struct Graphics<W: Write> {
// 64 * 32 display
pub pixels: [[u8; 64]; 32],
out: W,
debugger_layout: DebuggerLayout,
}
impl<W: ... |
mod boolean;
mod comment;
mod ident;
mod keyword;
mod number;
mod regex;
mod string;
mod template;
pub mod prelude {
pub use super::{
Boolean, Comment, Ident, Keyword, Number, Punct, RegEx, StringLit, Template,
TemplateLiteral, Token,
};
}
pub use boolean::Boolean;
pub use comment::{Comment, C... |
use std::fmt;
use std::io;
extern crate nalgebra as na;
use na::{Point3, Real, Rotation3, Vector3};
struct CubicUfo {
base: Vec<Point3<f32>>,
vertices: Vec<Point3<f32>>,
}
impl CubicUfo {
fn new() -> CubicUfo {
let base = vec![
Point3::new(0.5, 0.0, 0.0),
Point3::new(0.0, ... |
// error-pattern:giraffe
fn main() {
fail do { fail "giraffe" } while true;
}
|
use crate::path::{
is_child_filter, is_child_filter_value_match, matches_pattern, parse_array_child_filter,
parse_array_indexing_operation, ArrayIndices, ParseError, SPLAT,
};
use log::{debug, error};
use yaml_rust::yaml::{Array, Hash};
use yaml_rust::Yaml;
#[derive(Debug)]
pub struct VisitedNode<'a> {
pub... |
pub struct Stack<T> {
elements: Vec<T>,
}
impl<T> Stack<T> {
pub fn with_capacity(capacity: usize) -> Self {
Self {
elements: Vec::with_capacity(capacity),
}
}
pub fn capacity(&self) -> usize {
return self.elements.capacity();
}
pub fn len(&self) -> usize {... |
/*!
Column oriented field storage for tantivy.
It is the equivalent of `Lucene`'s `DocValues`.
Fast fields is a column-oriented fashion storage of `tantivy`.
It is designed for the fast random access of some document
fields given a document id.
`FastField` are useful when a field is required for all or most of
the ... |
pub mod message;
pub mod types;
|
use std::{
fs,
io::{self, Read, Seek},
};
use terminal::util::Point;
/// Returns an iterator over the points from `start_point` to `end_point`.
pub fn get_line_points(start_point: Point, end_point: Point) -> impl Iterator<Item = Point> {
line_drawing::Bresenham::new(
(start_point.x as i16, start_po... |
use crate::tool::Tool;
use clap::arg_enum;
use std::path::PathBuf;
use structopt::StructOpt;
use thiserror::Error;
#[derive(Error, Debug)]
/// Error types for vulkan devices
pub enum ConfigError {
#[error("stepover must be between 1 and 100")]
StepOver,
#[error("angle must be between 1 and 180")]
Angle... |
pub mod alternative;
pub mod application;
pub mod assignment;
pub mod boxes;
pub mod closure;
pub mod constant;
pub mod definition;
pub mod expression;
pub mod fixlet;
pub mod function;
pub mod import;
pub mod keyword;
pub mod let_continuation;
pub mod library;
pub mod noop;
pub mod program;
pub mod reference;
pub mod ... |
use serde::{Deserialize, Serialize};
//TODO: 'typing.rs' is deprecated and should be replaced by 'thick_triple.rs'
//the difference is
//1. structs for 'Members' and 'DistinctMembers'
//2. encoding of 'Objects' (requiring 'datatype' key)
//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
// ... |
use std::collections::{HashSet, VecDeque};
use crate::util::lines_from_file;
pub fn day9() {
println!("== Day 9 ==");
let input = lines_from_file("src/day9/input.txt");
let a = part_a(&input);
println!("Part A: {}", a);
let b = part_b(&input);
println!("Part B: {}", b);
}
fn part_a(input: &Ve... |
use amethyst::ecs::{Component, DenseVecStorage};
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum Direction {
Left,
Right,
Up,
Down
}
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum Action {
None,
Move(Direction)
}
#[derive(Debug)]
pub struct Intent {
action: Action
}
impl Intent {
... |
mod math;
use std::path::Path;
use sdl2::VideoSubsystem;
use sdl2::event::Event;
use sdl2::gfx::primitives::DrawRenderer;
use sdl2::keyboard::Keycode;
use sdl2::pixels::Color;
use sdl2::rect::Rect;
use sdl2::render::{Canvas, Texture, TextureCreator, TextureQuery};
use sdl2::ttf::Font;
use sdl2::video::{Window, Window... |
use indexmap::map::IndexMap;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
Category, Config, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span,
Spanned, Value,
};
#[derive(Clone)]
pub struct FromXml;
impl Command for FromXml {
fn ... |
// 2019-03-12
// Rédigeons une fonction qui renvoie la plus grande de deux tranches de chaîne
// de caractère. (the longer of two string slices).
use std::fmt::Display;
fn main() {
// Déclarer les deux chaînes
let string1 = String::from("abcd"); // une String
let string2 = "xyz"; // un... |
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[derive(Clone, Debug)]
pub type Error;
#[wasm_bindgen(constructor)]
pub fn new(msg: &str) -> Error;
}
|
#[doc = "Reader of register SENSE_DUTY"]
pub type R = crate::R<u32, super::SENSE_DUTY>;
#[doc = "Writer for register SENSE_DUTY"]
pub type W = crate::W<u32, super::SENSE_DUTY>;
#[doc = "Register SENSE_DUTY `reset()`'s with value 0"]
impl crate::ResetValue for super::SENSE_DUTY {
type Type = u32;
#[inline(always... |
mod bot;
mod telegram;
mod tools;
use crate::bot::constants::*;
use crate::bot::handlers::Handlers;
use crate::telegram::helpers::*;
use crate::telegram::messages::*;
use crate::telegram::structures::*;
use crate::tools::read_key_env;
use log::LevelFilter;
use redis::Commands;
use reqwest::Client;
use simple_logger::... |
#[repr(packed)]
#[derive(Copy, Clone, Debug, Default)]
pub struct Setup {
pub request_type: u8,
pub request: u8,
pub value: u16,
pub index: u16,
pub len: u16,
}
impl Setup {
pub fn get_status() -> Setup {
Setup {
request_type: 0b10000000,
request: 0x00,
... |
#[doc = "Reader of register TICKS"]
pub type R = crate::R<u32, super::TICKS>;
#[doc = "Reader of field `CNT128HZ`"]
pub type CNT128HZ_R = crate::R<u8, u8>;
impl R {
#[doc = "Bits 0:5 - 128Hz counter (msb=2Hz) When SECONDS is written this field will be reset."]
#[inline(always)]
pub fn cnt128hz(&self) -> CNT... |
use std::fmt::{Display, Formatter};
// We could use std::ops::RangeInclusive, but we would have to extend it to
// normalize self (not much trouble) and it would not have to handle pretty
// printing for it explicitly. So, let's make rather an own type.
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub struct Clos... |
#![cfg(feature = "ast-parent")]
use crate::{
ast::*,
token::{ByteValue, ControlOperator, Value},
visitor::{self, *},
};
use std::{borrow::Cow, fmt};
/// Parent visitor result
pub type Result<T> = std::result::Result<T, Error>;
/// Parent visitor error
#[derive(Debug)]
pub enum Error {
/// Tree overwrite err... |
use midir::{MidiInput, MidiOutput};
pub struct LaunchKey {
note_in: MidiInput,
control_in: MidiInput,
control_out: MidiOutput
}
impl LaunchKey {
pub fn new() -> LaunchKey {
println!("{}", MidiInput::new("test").unwrap().port_count());
LaunchKey {
note_in: MidiInput::new("no... |
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct CommitMeta {
pub created: Option<String>,
pub sha: Option<String>,
pub url: Option<String>,
}
impl CommitMeta {
/// Create a builder for this object.
#[inline]
pub fn builder() -> CommitMetaBuilder {
CommitMetaBuilder {... |
use std::{collections::HashSet, fs::File, io::Seek, str::FromStr, time::Instant};
use bbs::issuer::Issuer;
use bbs_revocation::{RegistryBuilder, RegistryReader};
use clap::{App, Arg};
use rand::{distributions::Uniform, rngs::OsRng, Rng};
fn build_test_registry(
output: &str,
block_size: u16,
index_count: ... |
const MAX_LEAF_SIZE: usize = 50;
pub trait Point: Copy + std::fmt::Debug {
type Dtype: PartialOrd + Copy + Into<f64> + std::fmt::Debug;
const NUM_DIMENSIONS: u8;
// Dimension parameter guaranteed to be less than NUM_DIMENSIONS.
fn get_val(&self, dimension: u8) -> Self::Dtype;
// Returns the dista... |
extern crate hyper;
extern crate futures;
use futures::future;
use hyper::{Body, Request, Response, Method, StatusCode, Server};
use hyper::Client;
use hyper::rt::{self, Future};
use hyper::service::service_fn;
static SERVICE_NAME: &str = "echo server";
type BoxFuture = Box<dyn Future<Item=Response<Body>, Error=hyper... |
use rand::prelude::*;
use libra_crypto::{
hash::{CryptoHasher, TestOnlyHasher},
HashValue,
};
use sgtypes::s_value::SValue;
use std::time::{SystemTime, UNIX_EPOCH};
fn get_unix_ts() -> u64 {
let start = SystemTime::now();
let since_the_epoch = start
.duration_since(UNIX_EPOCH)
.expec... |
extern crate "cargo-registry" as cargo_registry;
extern crate civet;
extern crate green;
extern crate rustuv;
extern crate git2;
use std::os;
use std::sync::Arc;
use std::io::{mod, fs, File};
use civet::Server;
fn main() {
let url = env("GIT_REPO_URL");
let checkout = Path::new(env("GIT_REPO_CHECKOUT"));
... |
#[doc = "Register `APB1FZR2` reader"]
pub type R = crate::R<APB1FZR2_SPEC>;
#[doc = "Register `APB1FZR2` writer"]
pub type W = crate::W<APB1FZR2_SPEC>;
#[doc = "Field `DBG_LPTIM2_STOP` reader - DBG_LPTIM2_STOP"]
pub type DBG_LPTIM2_STOP_R = crate::BitReader<DBG_LPTIM2_STOP_A>;
#[doc = "DBG_LPTIM2_STOP\n\nValue on reset... |
use async_trait::async_trait;
use uuid::Uuid;
use common::cache::Cache;
use common::error::Error;
use common::infrastructure::cache::InMemCache;
use common::result::Result;
use crate::domain::content_manager::{ContentManager, ContentManagerId, ContentManagerRepository};
use crate::mocks;
pub struct InMemContentManag... |
use crate::{error, helpers};
use std::path::{Path, PathBuf};
use std::{env, io};
use structopt::StructOpt;
mod gui;
mod tmux;
trait OpenBackend {
fn run(&mut self, path: PathBuf, name: &str, opts: crate::EditorOpts) -> error::Result<()>;
}
#[derive(StructOpt, Debug)]
pub struct OpenOpts {
#[structopt(flatten... |
//! This example demonstrates using the [attribute macro](https://doc.rust-lang.org/reference/procedural-macros.html#attribute-macros)
//! [`display_with`] to seamlessly augment field representations in a [`Table`] display.
//!
//! * [`display_with`] functions act as transformers during [`Table`] instantiation.
//!
//!... |
use std::collections::HashMap;
use std::io::{self, BufRead};
/// A key input constraint to note is that `numbers` contains a set of natural
/// numbers starting from one. The first value in `numbers` to swap into place
/// is `max`, with each subsequent value being less by one. Using `indices` to
/// access the index ... |
extern crate clap;
extern crate log;
extern crate rand;
extern crate serde;
extern crate serde_derive;
extern crate tokio;
pub mod agent;
pub mod conf;
pub mod play;
pub mod playexpert;
pub mod start;
pub mod util;
|
use chrono::{DateTime, Utc};
use serde::Deserialize;
use std::collections::HashMap;
#[derive(Debug, Deserialize)]
pub struct MyConfig {
pub projects: HashMap<String, MyProjectConfig>,
}
#[derive(Debug, Deserialize)]
pub struct MyProjectConfig {
pub gid: String,
pub horizon: DateTime<Utc>,
pub cfd_stat... |
fn main() {
let nth_prime = 10_001;
let mut counter = 0;
let mut current = 0;
let mut current_prime = 0;
while counter < nth_prime {
if is_prime(current as f64) {
current_prime = current;
counter += 1;
}
current += 1;
}
println!("{}", curren... |
use serde::Serialize;
#[derive(Serialize, Debug)]
#[serde(untagged)]
pub enum Response {
Error {
error: String,
},
CheckResponse {
online: bool,
#[serde(skip_serializing_if = "Option::is_none")]
response_time: Option<usize>,
},
}
impl Response {
pub fn error(error: ... |
use crate::prelude::*;
pub mod prelude {
pub use super::{
ShiftLeft
};
}
mod marker {
use crate::prelude::*;
use crate::ExprMarker;
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct ShiftLeftMarker;
impl ExprMarker for ShiftLeftMarker {
const EXPR_KIND: ExprKi... |
//! Tests for MetroRail Client
#[cfg(test)]
use super::*;
#[cfg(test)]
use tokio_test::block_on;
#[test]
fn test_constructor() {
let client = Client::new("9e38c3eab34c4e6c990828002828f5ed");
assert_eq!(client.key, "9e38c3eab34c4e6c990828002828f5ed");
}
#[test]
fn test_lines() {
let client: Client = "9e3... |
#[doc = "Records the full path to items"];
export mk_pass;
fn mk_pass() -> pass { run }
type ctxt = {
srv: astsrv::srv,
mutable path: [str]
};
fn run(srv: astsrv::srv, doc: doc::cratedoc) -> doc::cratedoc {
let ctxt = {
srv: srv,
mutable path: []
};
let fold = fold::fold({
... |
use std::io;
fn knot_hash(lengths: &Vec<usize>, rounds: usize) -> Vec<u32> {
let mut list: Vec<u32> = (0..256).collect();
let mut pos = 0;
let mut skip_size = 0;
for _i in 0..rounds {
for length in lengths {
for i in 0..(length / 2) {
let start = (pos + i) % list.le... |
#[macro_use]
extern crate lazy_static;
extern crate ndarray;
extern crate mvdist_sys;
use mvdist_sys::{mvcrit as sys_mvcrit, mvdist as sys_mvdist};
use ndarray::prelude::*;
use std::sync::Mutex;
#[derive(Clone, Debug, Copy)]
pub enum BoundType {
Unbounded,
Above,
Below,
Both,
}
impl Into<i32> for Bou... |
pub struct Player;
pub struct TerrainBlock; |
/*
* Copyright (c) 2020 Adel Prokurov
* 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 a... |
/// Similar to tag population.
macro_rules! make_styles {
// Create shortcut macros for any style; populate these functions in the submodule.
{ $($st_pascal_case:ident => $st:expr),+ } => {
/// The St enum restricts element-creation to only valid styles.
#[derive(Clone, Debug, PartialEq, Eq, Ha... |
#[derive(Debug)]
pub enum Stmt {
Define(String),
Assign(String, Box<Expr>),
ExprStmt(Box<Expr>)
}
#[derive(Debug)]
pub enum Expr {
Number(i64),
Variable(String),
Binary(Op, Box<Expr>, Box<Expr>),
Call(String, Vec<Expr>)
}
#[derive(Debug)]
pub enum Op {
Mul,
Div,
Add,
Sub,
... |
use crate::command_prelude::*;
use cargo::ops;
use std::path::PathBuf;
pub fn cli() -> App {
subcommand("vendor")
.about("Vendor all dependencies for a project locally")
.arg_quiet()
.arg_manifest_path()
.arg(
Arg::new("path")
.value_parser(clap::value_pa... |
use std::fmt;
use std::collections::HashMap;
use std::collections::hash_map::Entry;
use std::collections::HashSet;
use rand;
use rand::Rng;
use rustc_serialize::hex::ToHex;
use hash::Sha1;
use response::Peer;
use metainfo::Metainfo;
use tracker::Tracker;
pub type TorrentMap = HashMap<Sha1, Metainfo>;
pub type Tracke... |
use crate::clients::BufferResponse;
use crate::clients::InputMessage;
use directory_client::presence::Topology;
use futures::channel::{mpsc, oneshot};
use futures::future::FutureExt;
use futures::io::Error;
use futures::SinkExt;
use sphinx::route::{Destination, DestinationAddressBytes};
use std::borrow::Borrow;
use std... |
//! Growth rate
/// Pokemon growth rate
#[derive(PartialEq, Eq, Clone, Copy, Hash, Debug)]
#[derive(serde::Serialize, serde::Deserialize)]
pub enum GrowthRate {
MediumFast = 0,
Erratic = 1,
Fluctuating = 2,
MediumSlow = 3,
Fast = 4,
Slow = 5,
}
impl GrowthRate {
/// Returns the `C` name of ... |
extern crate actix_web;
extern crate handlebars;
#[macro_use]
extern crate serde_json;
extern crate rand;
extern crate serde;
use actix_web::{http, server, App, HttpRequest, HttpResponse};
use handlebars::Handlebars;
use rand::Rng;
use serde::Serialize;
struct State {
handlebars: Handlebars,
}
fn main() {
let se... |
use cosmwasm_std::{
to_binary, Api, BankMsg, Coin, CosmosMsg, Env, Extern, HandleResponse, HandleResult, HumanAddr,
InitResponse, InitResult, Querier, QueryResult, StdError, StdResult, Storage, Uint128,
};
use cosmwasm_storage::{ReadonlySingleton, Singleton};
use rand::{RngCore, SeedableRng};
use rand_chacha::C... |
mod config;
use clap::Parser;
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
struct Args {
#[clap(global = true, long)]
check: bool,
}
fn main() {
let args = Args::parse();
println!("{:?}", args);
}
|
use openssl::{aes::{AesKey, aes_ige}, symm::Mode};
use openssl::rand::rand_bytes;
fn main() {
// plaintext we want to encrypt
let plaintext = "levitathan comes from the depths";
let size = plaintext.len();
// random bytes for key generation
let mut key_buff = [0; 16];
rand_bytes(&mut key_b... |
#![feature(test)]
extern crate ruruby;
extern crate test;
use ruruby::test::*;
use ruruby::*;
#[test]
fn bool_lit1() {
let program = "(3==3)==true";
let expected = Value::bool(true);
eval_script(program, expected);
}
#[test]
fn bool_lit2() {
let program = "(3==9)==false";
let expected = Value::boo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.