text stringlengths 8 4.13M |
|---|
use anyhow::{anyhow, Result};
use protocol::{
api_client::ApiClient, status_response, IssueJwtRequest, SpawnRequest, StatusRequest,
StopRequest, StreamLogRequest, StreamLogResponse,
};
use std::collections::HashMap;
use tonic::{
metadata::MetadataValue,
transport::{Certificate, Channel, ClientTlsConfig,... |
#[doc = "Register `JSQR` reader"]
pub type R = crate::R<JSQR_SPEC>;
#[doc = "Register `JSQR` writer"]
pub type W = crate::W<JSQR_SPEC>;
#[doc = "Field `JSQ1` reader - 1st conversion in injected sequence"]
pub type JSQ1_R = crate::FieldReader;
#[doc = "Field `JSQ1` writer - 1st conversion in injected sequence"]
pub type... |
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// 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>,... |
use elements::HmfGen;
use bignum::BigNumber;
use flint::fmpz::{Fmpz, FmpzFactor};
use flint::fmpq::Fmpq;
use flint::ulong_extras;
use flint::traits::*;
use gmp::mpz::Mpz;
fn norm_realquad(u: i64, v: i64, m: u64) -> i64 {
if is_1mod4!(m) {
(u * u - (m as i64) * v * v) >> 2
} else {
u * u - m as... |
const NUM_GPR: usize = 32;
const NUM_FPR: usize = 32;
pub enum LlBitStatus {
LOAD,
STORE // No idea
}
pub struct Cpu {
reg_gpr: [u64; NUM_GPR], // r0 hardwired to zero, r31 is the link register used by JAL and JALR
reg_fpr: [f64; NUM_FPR],
reg_pc: u64,
reg_hi: u64,
reg_lo: u64,
reg_l... |
use super::atom::common::Common;
use super::atom::heading::{self, Heading};
use super::atom::slider::{self, Slider};
use crate::libs::color::{pallet, Pallet};
use isaribi::{
style,
styled::{Style, Styled},
};
use kagura::prelude::*;
use nusa::prelude::*;
pub struct Children {
pub title: Option<String>,
... |
// {% include 'doc.template' %}
use crate::core::expression::*;
/// The result of the application of a computation on an expression.
pub type ApplicationResult = Result<Option<Expression>, String>;
/// Represents a `symrs` computation.
///
/// Computations apply themselves to expressions.
pub trait Computation {
... |
//! The Unix Domain Socket stream speaking blackhole.
use std::{io, path::PathBuf};
use futures::StreamExt;
use metrics::{register_counter, Counter};
use once_cell::sync;
use serde::Deserialize;
use tokio::net;
use tokio_util::io::ReaderStream;
use tracing::info;
use crate::signals::Shutdown;
static BYTES_RECEIVED:... |
use serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::*;
#[derive(Debug, Serialize, Deserialize)]
pub struct FlickrResult {
pub photos: Photos,
pub stat: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Photos {
pub page: i16,
pub pages: i16,
pub perpage: i16,
pub total:... |
//! module hmac implements the Keyed-Hash Message Authentication Code (HMAC) as defined in U.S.
//! Federal Information Processing Standards Publication 198. An HMAC is a cryptographic hash that
//! uses a key to sign a message. The receiver verifies the hash by recomputing it using the same
//! key.
use std::io::{sel... |
use nix::unistd::ForkResult;
use serde::{Deserialize, Serialize};
use structopt::StructOpt;
use tokio::runtime::Runtime;
pub mod server;
use persist_core::error::Error;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, StructOpt)]
#[structopt(about, author)]
pub enum Opts {
/// Start the daemon
Start... |
#[doc = "Register `APBSMENR1` reader"]
pub type R = crate::R<APBSMENR1_SPEC>;
#[doc = "Register `APBSMENR1` writer"]
pub type W = crate::W<APBSMENR1_SPEC>;
#[doc = "Field `TIM2SMEN` reader - TIM2 timer clock enable during Sleep mode"]
pub type TIM2SMEN_R = crate::BitReader;
#[doc = "Field `TIM2SMEN` writer - TIM2 timer... |
extern crate badlog;
extern crate chrono;
#[macro_use]
extern crate clap;
extern crate git2;
#[macro_use]
extern crate log;
extern crate pulldown_cmark;
extern crate rayon;
extern crate slug;
#[macro_use]
extern crate tenjin;
extern crate toml;
mod build;
mod error;
mod init;
mod theme;
mod util;
fn main() {
bad... |
/*
* 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
*/
/// SyntheticsApiTestResultShortResult : Result of the last API test run.
#[derive(Clone, Debug, Part... |
fn sort_vec_usize() {
let mut data: Vec<usize> = vec![1, 5, 2, 8, 3];
println!("Origital data is given by data={:?}", data);
data.sort();
println!("By sorting, the order of the elements in the data is changed and the result is given by sorted data={:?}", data)
}
fn sort_vec_f32() {
let mut data: Ve... |
use std::io::Result;
use excel_writer::{ColIndex, Context, Excel, MergeCell, RowIndex};
fn main() -> Result<()> {
let mut excel = Excel::default();
let mut context = Context::default();
let sheet = excel.workbook().add_sheet(Some("hello"));
{
let row = sheet.add_row();
row.add_str_c... |
#![allow(non_snake_case)]
#[macro_use]
extern crate criterion;
use criterion::Criterion;
extern crate bulletproofs;
extern crate curve25519_dalek;
extern crate merlin;
extern crate rand;
use core::iter;
use bulletproofs::LinearProof;
use bulletproofs::{BulletproofGens, PedersenGens};
use curve25519_dalek::ristretto... |
pub mod cache;
mod queue;
use crate::debug::fps::Counter;
use crate::engine::cache::SceneCache;
use crate::engine::queue::QueueFamilyIndices;
use crate::frame::frame::Pass;
use crate::frame::geometry::TriangleDrawSystem;
use crate::frame::system::FrameSystem;
use crate::scene::camera::ViewAndProject;
use crate::scene:... |
//! Utility accessors for components
//! that are commonly used (read-only)
//! together. Writes to these components
//! must still be done individually
mod isalive;
pub use self::isalive::IsAlive;
|
use anyhow::Result;
use maud::{html, Markup};
use rustimate_service::{RequestContext, Router};
pub(crate) fn navbar(ctx: &RequestContext, router: &dyn Router) -> Result<Markup> {
Ok(html! {
header {
div data-uk-sticky="sel-target: .uk-navbar-container; cls-active: data-uk-navbar-sticky" {
nav#navba... |
use super::error::{ErrorKind, Result};
use super::utils;
use super::ModuleResolver;
use std::fs;
use std::path::{self, PathBuf};
pub struct FileResolver;
macro_rules! to_string {
($id: ident) => {{
$id.to_str().unwrap_or("").to_owned()
}};
}
macro_rules! resolve_err {
($id: ident) => {
ret... |
/// Modified Implementation of DCPU16
/// https://gist.github.com/metaphox/3888117
///
use std::io::{Read, Write};
use std::mem;
use std::slice;
///
/// VCPU State Storage
///
pub struct VCPU16 {
registers: [u16; 12],
memory: [u16; 65536],
state: State,
}
///
/// VCPU Register Index
///
enum Register {
... |
use super::{Asset, Processor};
use crate::bundler::Emitter;
use log::error;
use serde::{Deserialize, Serialize};
use std::fs;
#[derive(Serialize, Deserialize, Debug)]
pub struct Config {
dependent_assets: Vec<String>,
}
/// Simply copy files
#[derive(Default)]
pub struct ConfigProcessor;
impl Processor for Confi... |
extern crate aoc2017;
use aoc2017::days::day03;
fn main() {
let input = aoc2017::read_trim("input/day03.txt").unwrap().parse::<usize>().unwrap();
let distance = day03::part1::distance(input);
println!("Day 02 part 1 steps: {}", distance);
let distance = day03::part2::search(input);
println!("Day... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ClientTokenResponse {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub token: Option<String>,... |
use maat_graphics::cgmath::{Vector2, Vector3};
use maat_graphics::DrawCall;
use maat_graphics::math;
use crate::rand::Rng;
use crate::maat_graphics::cgmath::InnerSpace;
use rand::prelude::ThreadRng;
use rand::thread_rng;
const MIN_SPEED: f32 = 50.0;
const MAX_SPEED: f32 = 450.0;
const ALIGNMENT_WEIGHT: f32 = 1.0;
... |
use crate::vol::Vox;
use serde_derive::{Deserialize, Serialize};
use std::ops::Deref;
use vek::*;
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[repr(u8)]
pub enum BlockKind {
Air,
Normal,
Dense,
Water,
LargeCactus,
BarrelCactus,
RoundCactus,
ShortCactus,
... |
use clap::{App, Arg};
use ebnf_tools;
use ebnf_tools::Generate;
use std::fs;
fn main() {
let matches = App::new("generate")
.arg(
Arg::with_name("file")
.value_name("file")
.takes_value(true)
.required(true),
)
.get_matches();
... |
pub mod ref_with_flag;
|
use std::fs::File;
use std::io::{Read, Write};
use std::path;
use std::collections::{HashMap, HashSet};
use std::fmt;
use roxmltree::{Document, Node, NodeType};
#[derive(Debug)]
pub struct DataDictionary {
// field_set: HashSet<String>,
fields_by_tag: HashMap<u32, FieldEntry>,
tag_name_map: HashMap<String... |
#[cfg(test)]
#[macro_use]
extern crate lazy_static;
pub use decode::decode_utf8;
pub use encode::encode_utf8;
pub use encode::EncodeUtf8Error;
pub use encode::EncodeUtf8ErrorKind;
mod decode;
mod encode;
#[cfg(test)]
mod tests;
|
use std::io::{Read, BufReader};
use types::{RedisResult, Value, ErrorKind, make_extension_error};
/// The internal redis response parser.
pub struct Parser<T> {
reader: T,
}
/// The parser can be used to parse redis responses into values. Generally
/// you normally do not use this directly as it's already done... |
use crate::{
grammar::{error_block, expressions, name, name_ref, separated_list, types},
parser::Parser,
syntax::{SyntaxKind::*, TokenSet},
};
pub fn item(p: &mut Parser) {
let m = p.start();
let kind = match p.current() {
IMPORT_KW => {
import(p);
Some(IMPORT_ITEM)
... |
#[doc = "Register `BSEC_OTP_DISTURBED2` reader"]
pub type R = crate::R<BSEC_OTP_DISTURBED2_SPEC>;
#[doc = "Field `DIS` reader - DIS"]
pub type DIS_R = crate::FieldReader<u32>;
impl R {
#[doc = "Bits 0:31 - DIS"]
#[inline(always)]
pub fn dis(&self) -> DIS_R {
DIS_R::new(self.bits)
}
}
#[doc = "BS... |
use super::errors::{Error, Result};
use chrono::{DateTime, Utc};
use serde::{Serialize, Deserialize};
use tokio_postgres::{Client, Statement, types::Type, Row};
use jsonwebtoken::{
encode, EncodingKey, Header,
decode, DecodingKey, Validation,
};
use crate::api::cursor::{Result as CursorResult, Cursor, PrimaryCu... |
use std;
use csv;
#[derive(Debug, Deserialize)]
pub struct Record {
pub read_a: String,
pub length_a: u64,
pub begin_a: u64,
pub end_a: u64,
pub strand: char,
pub read_b: String,
pub length_b: u64,
pub begin_b: u64,
pub end_b: u64,
pub nb_match_base: u64,
pub nb_base: u64,
... |
use crate::{
actor::{Actor, ActorContainer},
bot::{Bot, BotKind},
control_scheme::ControlScheme,
effects,
item::{Item, ItemContainer, ItemKind},
jump_pad::{JumpPad, JumpPadContainer},
leader_board::LeaderBoard,
message::Message,
player::Player,
projectile::{Projectile, Projectile... |
use crate::math::Vec3;
// pub struct Scene{
// pub shapes: Vec<Box<dyn Hitable>>;
// }
#[derive(Debug)]
// not sure if copy/clone is good idea here, used it to allow point along to clone itself
// copy means rust will implicitly copy on certain types (that go on stack not heap)
// clone means you can EXPLICITLY cop... |
use {
std::{
fs,
io::{BufRead, BufReader, BufWriter, Write},
mem,
path::{Path, PathBuf},
process::{Child, Command, Stdio},
},
uuid::Uuid,
winapi_local::{
shared::ntdef::TRUE,
um::{
fileapi::{FindFirstFileW, FindNextFileW},
h... |
// The prime factors of 13195 are 5, 7, 13 and 29.
//
// What is the largest prime factor of the number 600851475143 ?
extern crate project_euler;
fn main() {
let mut n = 600851475143;
for p in project_euler::primes::primes() {
while n % p == 0 {
println!("{}", p);
n /= p;
}
if n == 1 {
... |
//! Event handlers for in-game events
mod onkilledcleanup;
mod register;
pub mod on_join;
pub mod on_player_killed;
pub mod on_spectate_event;
pub mod timer;
pub use self::register::register;
pub use self::onkilledcleanup::PlayerKilledCleanup;
|
use std::fs;
use std::path::{Path, PathBuf};
pub fn read_repo_from_file() -> Option<String> {
let current_path: &Path = Path::new(".");
let repo_root: PathBuf = match giro::git_root(¤t_path).unwrap() {
Some(root) => root,
None => return None,
};
let config_file: PathBuf = repo_roo... |
use serde::{Deserialize, Serialize};
use smart_default::SmartDefault;
#[derive(Copy, Clone, Debug, Deserialize, PartialEq, Serialize, SmartDefault)]
#[serde(tag = "type", rename_all = "kebab-case")]
pub enum RasterFilter {
#[default]
BlackmanHarris,
Dirac,
}
impl RasterFilter {
pub fn importance_sampl... |
pub extern crate image;
use image::image::{
GenericImageView,
GenericImage,
DynamicImage,
ImageError,
Pixel
};
use std::path::PathBuf;
use failure::{err_msg, Error};
const MAX_COLOR_INTENSITY_U8: u8 = 255;
const MAX_COLOR_INTENSITY_USIZE: usize = 255;
type ColorIntensityBuckets = [usize; MAX_COLOR_INTENSITY... |
fn main() {
tonic_build::configure()
.build_server(false)
.compile(
&["../proto/helloworld.proto", "../proto/echo.proto"],
&["../proto"],
)
.unwrap();
}
|
use super::BaseIntExt;
pub struct SizeIter<T> where T: BaseIntExt {
size: (T, T),
pos: (T, T),
}
impl<T> SizeIter<T> where T: BaseIntExt {
pub fn new(w: T, h: T) -> Self {
Self {
size: (w, h),
pos: (T::zero(), T::zero()),
}
}
}
impl<T> Iterator for SizeIter<T> ... |
use crate::conn::ConnEvent;
use log::{Log, Metadata, Record};
use std::fs::{File, OpenOptions};
use std::io::Write;
use std::sync::Mutex;
use futures::channel::mpsc::UnboundedSender;
use futures::sink::SinkExt;
pub struct Logger {
file_output: Mutex<File>,
sender: UnboundedSender<ConnEvent>,
}
impl Logger {
... |
#[doc = "Reader of register RCC_MC_APB5ENSETR"]
pub type R = crate::R<u32, super::RCC_MC_APB5ENSETR>;
#[doc = "Writer for register RCC_MC_APB5ENSETR"]
pub type W = crate::W<u32, super::RCC_MC_APB5ENSETR>;
#[doc = "Register RCC_MC_APB5ENSETR `reset()`'s with value 0"]
impl crate::ResetValue for super::RCC_MC_APB5ENSETR ... |
use std::net::Ipv4Addr;
const BROADCAST: u32 = 0xffffffff;
fn usage() -> ! {
println!("usage: cidr ip.ad.dr.ess/mask");
std::process::exit(0);
}
fn into_ip(ip: u32) -> Ipv4Addr {
let octets = ip.to_be_bytes();
Ipv4Addr::new(octets[0], octets[1], octets[2], octets[3])
}
fn main() {
let args: Vec<... |
// Copyright 2019. The Tari Project
// SPDX-License-Identifier: BSD-3-Clause
//! # The Hashing API
//!
//! ## A brief justification for this API
//!
//! The use of hash functions in cryptographic protocols typically assumes and requires that
//! these functions be randomly and independently sampled from an idealized s... |
use std::fs;
fn main() {
let input = fs::read_to_string("src/01/input.txt").expect("error reading input");
let sum: f32 = input.lines().map(|v| fuel(v.parse().unwrap())).sum();
println!("Answer for part one: {}", sum); // 3317970
let mut result_part2: f32 = 0.0;
for s in input.lines() {
l... |
extern crate storylet;
use storylet::load::load_story;
use storylet::runner::StoryRunner;
#[test]
fn test_basic_deserialise() {
let story = match load_story("tests/test_story.json") {
Ok(story) => story,
Err(reason) => panic!(reason),
};
assert_eq!(story.len(), 2);
assert_eq!(story[0... |
use http::StatusCode;
use thiserror::Error;
/// [`Result`](std::result::Result) type that is returned from
/// functions with error as [`TypesenseError`].
pub type Result<T> = std::result::Result<T, TypesenseError>;
/// Represents an error that can occur while using the library.
#[non_exhaustive]
#[derive(Error, Debu... |
/*
* 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
*/
/// ProcessQueryDefinition : The process query to use in the widget.
#[derive(Clone, Debug, PartialEq... |
use std::error::Error;
#[async_std::main]
async fn main() -> Result<(), Box<dyn Error>> {
env_logger::try_init()?;
let client =
listen_moe::auth::login("[Username/EMail address]".into(), "[Password]".into(), None)
.await?;
for artist in listen_moe::artists::get_all(&client).await? {
... |
extern crate base64;
#[macro_use]
extern crate clap;
extern crate iso8601;
extern crate preferences;
extern crate reqwest;
extern crate serde_json;
extern crate xmlrpc;
use std::str::FromStr;
use base64::encode;
use clap::{Arg, App};
use preferences::{AppInfo, Preferences, PreferencesMap};
use reqwest::Client;
use ... |
pub mod align;
pub mod attr;
pub mod btn;
pub mod card;
pub mod chat_message;
pub mod collapse;
pub mod common;
pub mod dropdown;
pub mod empty;
pub mod fa;
pub mod file_catcher;
pub mod frame;
pub mod header;
pub mod heading;
pub mod icon;
pub mod loading_circle;
pub mod marker;
pub mod select;
pub mod slider;
pub mod... |
use std::path::Path;
use sec_scraper::cli::*;
use sec_scraper::read_rss::read_rss;
use sec_scraper::timing::get_rss;
use sec_scraper::write_entries::write_table;
use std::collections::HashSet;
const SEC_RSS_URL: &str = "https://www.sec.gov/cgi-bin/browse-edgar?action=getcurrent&CIK=&type=&company=&dateb=&owner=includ... |
// 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 crate::utils::are_equal;
use winterfell::{
math::{fields::f128::BaseElement, FieldElement},
Air, AirContext, Assertion, Evalua... |
//! How to assign some aliases to subcommands
//!
//! Running this example with --help prints this message:
//! -----------------------------------------------------
//! structopt 0.3.25
//!
//! USAGE:
//! subcommand_aliases <SUBCOMMAND>
//!
//! FLAGS:
//! -h, --help Prints help information
//! -V, --... |
/*
* Slack Web API
*
* One way to interact with the Slack platform is its HTTP RPC-based Web API, a collection of methods requiring OAuth 2.0-based user, bot, or workspace tokens blessed with related OAuth scopes.
*
* The version of the OpenAPI document: 1.7.0
*
* Generated by: https://openapi-generator.tech
*... |
#[cfg(test)]
mod parser_test;
#[macro_use]
mod macros;
pub mod ast;
use std::mem::MaybeUninit;
use crate::error::{self, VestiErr, VestiParseErrKind};
use crate::lexer::token::Token;
use crate::lexer::token::TokenType;
use crate::lexer::Lexer;
use crate::location::Span;
use ast::*;
// TODO: Make a keyword that can u... |
//! This mod including all regex
use lazy_static::*;
use regex::Regex;
/// pick the <code></code> in text
fn code_tag(text: &str) -> String {
lazy_static! {
static ref CODE_TAG: Regex = Regex::new(r"<code>(?P<data>.*?)</code>").unwrap();
}
String::from(CODE_TAG.replace_all(text, "`$data`"))
}
///... |
use bevy::prelude::*;
pub struct PhysicsPlugin;
impl Plugin for PhysicsPlugin {
fn build(&self, app: &mut AppBuilder) {
app.add_system(movement_system.system())
.add_system(gravity_system.system());
}
}
pub struct Physics {
pub velocity: Vec3,
}
pub struct Gravity(f32);
fn movement_system(time: Res<Time>, ... |
pub use methods::Method;
pub use query::{QueryString, Value as QueryStringValue};
pub use requests::ParseError;
pub use requests::Request;
pub use response::Response;
pub use status_code::StatusCode;
pub mod methods;
pub mod query;
pub mod requests;
pub mod response;
pub mod status_code;
|
//! Graph extraction program.
use std::convert::From;
use std::path::PathBuf;
use crate::graph::{load_graph, save_gml};
use crate::prelude::*;
/// Extract a subgraph.
#[derive(Args, Debug)]
#[command(name = "extract-graph")]
pub struct ExtractGraph {
#[arg(long = "graph-file")]
graph_file: Option<PathBuf>,
... |
#[cfg(test)]
mod tests {
use crate::aes_ecb::decrypt_ecb_byte_at_a_time;
use crate::aes_ecb::detect_aes_ecb;
use crate::util::encrypt_with_prefix_and_suffix;
use crate::util::find_blocksize;
use crate::util::generate_random_bytes;
use crate::util::EncryptionType;
use std::iter;
use std::... |
extern crate rustc_serialize;
extern crate regex;
use std::fs::File;
use rustc_serialize::base64::{FromBase64, ToBase64, MIME};
use rustc_serialize::hex::{ToHex};
use regex::Regex;
use std::io::Read;
use std::string::String;
use std::io::Write;
use std::path::Path;
fn main() {
let img_base64: &str = "data:imag... |
use bytes::{Buf, BufMut, BytesMut};
//use tokio::io::read_exact;
use super::event::*;
use crate::utils::make_io_error;
use ring::aead::*;
use tokio::prelude::*;
pub const METHOD_AES128_GCM: &str = "aes128gcm";
pub const METHOD_CHACHA20_POLY1305: &str = "chacha20poly1305";
pub const METHOD_NONE: &str = "none";
struct ... |
use miette::Result;
use crate::*;
pub(crate) mod completion;
pub(crate) mod edit;
#[derive(Debug, Clone)]
pub(crate) struct OpenAiConfig {
pub api_key: String,
}
impl OpenAiConfig {
#[instrument]
pub fn from_env() -> Result<Self> {
let open_ai_api_key = std::env::var("OPEN_AI_API_KEY")
... |
use crate::models::{ComicId, ComicIdInvalidity, Token};
use crate::util::{ensure_is_authorized, ensure_is_valid};
use actix_web::{error, web, HttpResponse, Result};
use actix_web_grants::permissions::AuthDetails;
use database::models::{Comic as DatabaseComic, LogEntry};
use database::DbPool;
use parse_display::Display;... |
use std::any::Any;
use std::collections::HashMap;
use std::error::Error;
use std::fs;
use std::io;
use std::io::{BufRead, ErrorKind, stderr, Write};
use std::path::Path;
fn main() {
let share = pirate_share(345, 23);
println!("pirate_share {}", share);
let mut map: HashMap<String, char> = HashMap::new();
... |
//! Tests auto-converted from "sass-spec/spec/core_functions/meta"
#[allow(unused)]
use super::rsass;
// From "sass-spec/spec/core_functions/meta/call.hrx"
mod call {
#[allow(unused)]
use super::rsass;
mod args {
#[allow(unused)]
use super::rsass;
#[test]
#[ignore] // wrong ... |
use std::collections::HashMap;
use std::error::Error;
use std::path::Path;
use log::debug;
use crate::csv::inference::{ColumnInference, ColumnInferences};
use crate::parser::collector::Collector;
use crate::parser::Parser;
use crate::qsv::{csv_data_from_mime_type, Options};
///Executes a query, possibly returning Ro... |
/*
* 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
*/
/// SyntheticsGlobalVariableValue : Value of the global variable.
#[derive(Clone, Debug, PartialEq, S... |
use day01::{part_1, part_2};
fn main() {
let result1 = part_1();
let result2 = part_2();
println!("The result of part 1 is {}", result1);
println!("The result of part 2 is {}", result2);
}
|
use std::collections::HashMap;
use std::str::Chars;
#[derive(Debug, PartialEq, Clone)]
pub enum Token {
Operator(Operator),
ReservedWord(ReservedWord),
Number(i64),
Bracket(BracketSide),
Identifier(String),
LineBreak,
Comma,
}
impl Token {
pub fn add() -> Token {
Token::Operato... |
use rand::Rng;
use crate::grid::Grid;
use crate::render::Renderer;
/// DumbAI has no strategy for winning it will just randomly move pieces around
/// the board.
pub struct DumbAI {
grid: Grid,
move_counter: u32,
}
impl DumbAI {
pub fn new(grid: Grid) -> Self {
Self {
grid,
... |
mod food;
mod game_state;
mod snake;
pub mod utils;
use std::io::{Error, Write};
use std::sync::mpsc::{self, Receiver, Sender};
use std::thread;
use std::time::Duration;
use food::Food;
use game_state::GameState;
use snake::Snake;
use utils::*;
const TICK_RATE: u64 = 100;
const INITIAL_SNAKE_LENGTH: u16 = 3;
pub en... |
pub(crate) mod nn_sql_value;
pub(crate) mod sql_compare_result;
pub(crate) mod sql_value_hash_key;
use std::{fmt::Display, hash::Hash};
use crate::error::ApllodbResult;
use crate::ApllodbError;
use serde::{Deserialize, Serialize};
use self::{nn_sql_value::NnSqlValue, sql_compare_result::SqlCompareResult};
/// SQL-t... |
/// After original iterator ends, yields first element once again.
#[derive(Clone, Debug)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
pub struct CircularState<I> {
iter: I,
orig: I,
consumed: bool,
}
impl<I> Iterator for CircularState<I> where I: Clone + Iterator {
type I... |
#[doc = "Register `FMC_BCHISR` reader"]
pub type R = crate::R<FMC_BCHISR_SPEC>;
#[doc = "Field `DUEF` reader - DUEF"]
pub type DUEF_R = crate::BitReader;
#[doc = "Field `DERF` reader - DERF"]
pub type DERF_R = crate::BitReader;
#[doc = "Field `DEFF` reader - DEFF"]
pub type DEFF_R = crate::BitReader;
#[doc = "Field `DS... |
/* query.rs */
use std::fmt::Debug;
use osm_xml as osm;
use crate::map;
use crate::map::TaggableElement;
#[derive(Debug, Clone, PartialEq)]
pub enum FilterQuery {
// Non-lazy filter already O(1)
// ById(i64),
ByTag(String, Vec<String>),
HasTag(String),
// Node only:
// Way only:
IsPolygon... |
use number_as::NumberAs;
macro_rules! number_as_batch_test {
($from:expr) => {
let _a: u8 = $from.number_as();
let _a: u16 = $from.number_as();
let _a: u32 = $from.number_as();
let _a: u64 = $from.number_as();
let _a: u128 = $from.number_as();
let _a: usize = $from.n... |
pub mod x86_64;
pub use self::x86_64::interrupts;
pub use self::x86_64::cpuio;
pub use self::x86_64::acpi;
pub use self::x86_64::mm;
|
use ff::PrimeField;
use bellman::{Circuit, ConstraintSystem, SynthesisError};
use rand::rngs::OsRng;
use ff::Field;
use bls12_381::{Bls12, Scalar};
use bellman::groth16::{
create_random_proof, generate_random_parameters, prepare_verifying_key, verify_proof,
Proof,
};
use std::time::{Duration,Instant};
use pairi... |
// This file is parsed by build.rs
// Each included module will be compiled from the matching .proto definition.
include!(concat!(env!("OUT_DIR"), "/mod.rs"));
|
// Copyright 2018-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
// Substrate 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) a... |
use std::cmp;
use parser::{
Cfi, CfiDirective, FileHash, Function, FunctionDetails, InlinedFunction, LocalVariable,
Parameter, ParameterType, Range, Type, TypeOffset, Unit,
};
use crate::code::{Call, Code};
use crate::print::{
self, DiffList, DiffState, Print, PrintHeader, PrintState, SortList, ValuePrint... |
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
anyhow::Error,
argh::FromArgs,
carnelian::{
make_app_assistant, render::*, AnimationMode, App, AppAssistant, Color, FrameBufferPt... |
//! A simple Microsoft cabinet compressor.
//!
//! Only supports writing a single file to a single folder.
//! Cabinet format structures derived from the [Microsoft Cabinet File Format]
//! documentation.
//!
//! [Microsoft Cabinet File Format]: https://msdn.microsoft.com/en-us/library/bb417343.aspx#cabinet_format
#![... |
use std::io;
use std::collections::HashMap;
struct Point {
x: usize,
y: usize,
}
fn check_neighbors(point: Point, mut visited: &mut Vec<Point>, colors: &Vec<Vec<char>>, mut adjacent_colors: &mut HashMap<char, i8>) {
let x = point.x;
let y = point.y;
let x_dim = colors[y].len();
let y_dim = colors[x].len()... |
use z80::Z80;
/*
** RES b, r|(hl)
** Condition Bits: ____
** Clocks:
** (hl): 3
** r: 2
*/
pub fn res(z80: &mut Z80, op: u8) {
let mut val = match op & 0x7 {
0x6 => z80.mmu.rb(z80.r.get_hl()),
0x7 => z80.r.a,
0x0 => z80.r.b,
0x1 => z80.r.c,
0x2 => z80.r.d,... |
pub type NoResult<E> = Result<(), E>;
|
#![allow(dead_code)]
/* RCC Memory Map */
pub const RCC: u32 = 0x40021000;
pub const RCC_APB2ENR: u32 = RCC + 0x18;
pub const RCC_APB1ENR: u32 = RCC + 0x1C;
/* GPIO Memory Map */
pub const GPIOA: u32 = 0x40010800;
pub const GPIOA_CRL: u32 = GPIOA + 0x00;
pub const GPIOA_CRH: u32 = GPIOA + 0x04;
/* USART2 Memory Map ... |
#[macro_use] extern crate lazy_static;
extern crate regex;
// mod d01;
// mod d02;
// mod d03;
// mod d04;
mod d05;
fn main() {
dbg!(d05::part1());
// dbg!(d05::part2());
}
|
use crate::instruction::Register::*;
use crate::instruction::{Instruction, TrapVector};
use crate::state::{Condition, State};
use std::io::{self, Read, Write};
pub fn execute(mut state: State, instruction: Instruction) -> State {
state.pc = state.pc.wrapping_add(1);
match instruction {
// BR - Conditi... |
fn main() {
let mut v = vec![10, 20, 30, 40, 50];
println!("{:?}", v);
// make the element at index 3 be 35.
v.insert(3, 35);
println!("{:?}", v);
assert_eq!(v, [10, 20, 30, 35, 40, 50]);
// remove the element at index 1.
v.remove(1);
println!("{:?}", v);
assert_eq!(v, ... |
extern crate antidote;
use metadata::Metadata;
pub use metadata::Transaction;
use wal::MemoryWal;
use blocks::Blocks;
use disk_wal::{DiskWalWriter,DiskWalReader};
use block_file::BlockFile;
use ::std::path::{Path,PathBuf};
use ::std::collections::VecDeque;
use ::std::sync::Arc;
use metadata::RwLock;
use self::antido... |
/*
* 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
*/
/// SyntheticsGlobalVariableParserType : Type of parser for a Synthetics global variable from a syntheti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.