text stringlengths 8 4.13M |
|---|
use std::env;
use std::fs;
fn main(){
let args : Vec<String> = env::args().collect();
if args.len() < 2 {
return;
}
let mut a = fs::read_to_string(&args[1]).unwrap()
.strip_suffix('\n').unwrap().to_string()
.chars().collect::<Vec<char>>();
// Part 1
let disksize = 272;
... |
use std;
use aurora;
pub struct Decoder {
source: aurora::channel::Source<aurora::Binary>,
metadata_source: aurora::channel::Source<::metadata::Metadata>,
sink: aurora::channel::Sink<aurora::Audio>
}
impl Decoder {
pub fn new(source: aurora::channel::Source<aurora::Binary>, metadata_source: aurora::channel::... |
#[doc = "Register `COMP2_CSR` reader"]
pub type R = crate::R<COMP2_CSR_SPEC>;
#[doc = "Register `COMP2_CSR` writer"]
pub type W = crate::W<COMP2_CSR_SPEC>;
#[doc = "Field `COMP2_EN` reader - Comparator 2 enable bit"]
pub type COMP2_EN_R = crate::BitReader;
#[doc = "Field `COMP2_EN` writer - Comparator 2 enable bit"]
pu... |
use std::convert::TryFrom;
use std::str::FromStr;
use neon::prelude::*;
use uuid::Uuid;
use access::{VaultConfig, WrappedVault, args_get_str};
use emerald_vault::{
Address,
convert::json::keyfile::EthereumJsonV3File,
PrivateKey,
ToHex,
storage::error::VaultError
};
use json::{StatusResult};
#[der... |
pub const SVC_AUDIENCE: &'static str = "dev.svc.example.org";
pub const USR_AUDIENCE: &'static str = "dev.usr.example.com";
pub const TOKEN_ISSUER: &'static str = "iam.svc.example.com";
pub const PUBKEY_PATH: &str = "data/keys/svc.public_key.p8.der.sample";
pub mod prelude {
#[allow(unused_imports)]
pub use su... |
use scroll::ctx::TryFromCtx;
use crate::common::*;
use crate::tpi::constants::*;
#[inline]
fn parse_optional_id_index(buf: &mut ParseBuffer<'_>) -> Result<Option<IdIndex>> {
Ok(match buf.parse()? {
IdIndex(0) => None,
index => Some(index),
})
}
#[inline]
fn parse_string<'t>(leaf: u16, buf: &m... |
/*
* 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
*/
/// GraphSnapshot : Object representing a graph snapshot.
#[derive(Clone, Debug, PartialEq, Serialize... |
extern crate http;
extern crate http_util;
use http::*;
use http_util::headers::TransferEncoding;
#[test]
fn empty_map() {
let map = HeaderMap::new();
let v = TransferEncoding::get(&map);
assert!(v.is_empty());
assert!(!v.is_chunked());
}
#[test]
fn chunked() {
let mut map = HeaderMap::new();
... |
use bare_io::{self, Read, Write};
use core::cmp::min;
use seek_forward::{SeekForward, Tell};
/// Wraps around a stream to limit the length of the underlying stream.
///
/// This implementation differs from `bare_io::Take` in that it also allows writes,
/// and seeking forward is allowed if the underlying stream suppor... |
use serde::Deserialize;
use super::{run_crud_v1_test, Outcome, TestFile};
use crate::{
bson::{Bson, Document},
options::{Collation, CountOptions},
test::util::TestClient,
};
#[derive(Debug, Deserialize)]
struct Arguments {
pub filter: Option<Document>,
pub skip: Option<u64>,
pub limit: Option<... |
extern crate clap;
use clap::{App, Arg};
use std::error::Error;
use std::io::prelude::*;
use std::processus::{Command, Stdio};
fn main() {
let matchWith = App::new("My Own Pipe")
.version("1.0")
.author("Chaofu HUANG <chaofu.huang@outlook.fr>")
.about("Pipe to executable")
.arg(
... |
pub mod message;
pub mod runtime_data;
pub mod sniffer;
pub mod status;
|
use super::{Error, Module, SassFunction};
use crate::css::Value;
use crate::value::{Number, Quotes, Unit};
use lazy_static::lazy_static;
use std::cmp::max;
use std::sync::Mutex;
pub fn create_module() -> Module {
let mut f = Module::new();
def!(f, quote(string), |s| {
let v = match s.get("string")? {
... |
tha#![allow(unused_imports)]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(dead_code)]
extern crate dwarf_term;
extern crate rand;
use dwarf_term::*;
use rand::{Rng, ThreadRng};
use std::collections::hash_map::*;
use std::collections::HashMap;
use std::ops::Add;
pub const TILE_GRID_WIDTH: usize = 66;
pu... |
use std::ops::Range;
use std::convert::TryInto;
use std::fmt;
use std::cmp::{PartialOrd, Ord, Ordering};
use std::hash::{Hash, Hasher};
use pct_str::PctStr;
use crate::parsing::ParsedIriRef;
use crate::{Error, Iri, IriBuf, AsIriRef, Scheme, Authority, AuthorityMut, Path, PathMut, PathBuf, Query, Fragment};
use super::I... |
//! Top-level lib.rs for `cretonne_module`.
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces, unstable_features)]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
#![cfg_attr(feature = "cargo-clippy",
allow(new_without_default... |
extern crate nix;
use nix::sched::CloneFlags;
use std::env;
use std::process::Command;
fn print_usage() {
println!("usage: progname run <command>");
println!(" Example: progname run ls");
}
fn main() {
let args: Vec<String> = env::args().collect();
match args[1].as_ref() {
"run" => run(&a... |
use libc::{c_int, c_ulonglong, size_t};
#[link(name = "sodium")]
extern "C" {
fn sodium_init() -> c_int;
fn crypto_hash_sha256(d: *mut u8, m: *const u8, len: c_ulonglong) -> c_int;
fn crypto_sign_ed25519_verify_detached(sig: *const u8,
m: *const u8,
... |
static CRC16_TAB: &'static [u16; 256] = &[0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6,
0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad,
0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5,
... |
use proc_macro2::TokenStream;
use quote::ToTokens;
use syn::{
braced, parenthesized,
parse::{Parse, ParseStream},
punctuated::Punctuated,
token::{Brace, Paren},
Attribute, Expr, Generics, Ident, Meta, NestedMeta, Path, Token, Type, Visibility,
};
#[cfg(feature = "prost")]
use syn::Lit;
struct Wrap... |
extern crate cities_heightfield_from_gsi;
extern crate getopts;
use std::{ env, process };
use getopts::Options;
fn main()
{
println!( "<< Cities Heightfield from GSI / CUI; version {} >>\n", env!("CARGO_PKG_VERSION") );
let mut arguments = parse_args();
if arguments.interactive
{ arguments = interactive... |
// https://projecteuler.net/problem=18
/*
By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.
3
7 4
2 4 6
8 5 9 3
That is, 3 + 7 + 4 + 9 = 23.
Find the maximum total from top to bottom of the triangle below:
... |
#[doc = "Register `RAMPVALR` reader"]
pub type R = crate::R<RAMPVALR_SPEC>;
#[doc = "Field `TS1_RAMP_COEFF` reader - Engineering value of the ramp coefficient for the temperature sensor 1. This value is expressed in Hz/�C."]
pub type TS1_RAMP_COEFF_R = crate::FieldReader<u16>;
impl R {
#[doc = "Bits 0:15 - Engineer... |
fn main() {
// 跟 "halo bob".to_string() 应该是一样的
let mut bb = String::from("halo bob");
bb.push_str(" god");
println!("{:?}", bb);
}
|
/*
Firebase REST API
*/
extern crate curl;
extern crate serde;
extern crate serde_json;
extern crate url;
use curl::easy::{Easy2, Handler, List, WriteError};
use serde::de::DeserializeOwned;
use std::collections::HashMap;
use std::sync::Arc;
use std::thread::JoinHandle;
use url::Url;
use serde::Serialize;
use std::fm... |
use crate::config::Config;
use crate::error::{ViuError, ViuResult};
use crate::utils::terminal_size;
use crossterm::cursor::{MoveRight, MoveTo, MoveToPreviousLine};
use crossterm::execute;
use image::{DynamicImage, GenericImageView};
use std::io::Write;
mod block;
pub use block::BlockPrinter;
mod kitty;
pub use kitty... |
use std::collections::HashSet;
use std::io::Cursor;
use svm_codec::{ReadExt, WriteExt};
use svm_codec::template;
use svm_types::{Account, SectionKind, Template, TemplateAddr};
use crate::env::{self, traits};
use env::ExtAccount;
use traits::{AccountDeserializer, AccountSerializer};
use traits::{TemplateDeserialize... |
//! A Framed flavor of BBQueue, useful for variable length packets
//!
//! This module allows for a `Framed` mode of operation,
//! where a size header is included in each grant, allowing for
//! "chunks" of data to be passed through a BBQueue, rather than
//! just a stream of bytes. This is convenient when receiving
/... |
pub mod ffi;
pub mod status;
pub use self::status::{Status, HttpStatus};
use std::result;
use std::mem;
use std::ptr;
use std::ffi::{CStr, CString};
use std::convert::From;
use std::default::Default;
use libc::c_long;
macro_rules! getter {
( $field:ident, $restype:ident ) => {
pub fn $field(&mut self) -> ... |
use anyhow::{ensure, Result};
use std::io::{Error, ErrorKind::InvalidInput};
fn count_ones(n: u8) -> u8 {
let mut n = n;
let mut count = 0;
for _ in 0..7 {
n >>= 1;
if n & 1 == 1 {
count += 1;
}
}
count
}
fn parity(n: u8) -> bool {
count_ones(n) % 2 == 1
}
... |
// Copyright 2018-2019 Mozilla
//
// 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 writing, sof... |
pub(crate) mod comparison_function;
pub(crate) mod logical_function;
use serde::{Deserialize, Serialize};
use self::{comparison_function::ComparisonFunction, logical_function::LogicalFunction};
/// Boolean expression.
#[derive(Clone, PartialEq, Hash, Debug, Serialize, Deserialize)]
pub enum BooleanExpression {
/... |
extern crate actix_web;
#[macro_use]
extern crate prometheus;
#[macro_use]
extern crate lazy_static;
extern crate futures;
use actix_web::{
dev::{Service, ServiceRequest, ServiceResponse, Transform},
Error, Responder,
};
use futures::future::{ok, FutureResult};
use futures::{Future, Poll};
use prometheus::{
... |
use a19_concurrent::buffer::atomic_buffer::AtomicByteBuffer;
use a19_concurrent::buffer::mmap_buffer::MemoryMappedInt;
use a19_concurrent::buffer::DirectByteBuffer;
use a19_concurrent::buffer::next_pos;
use std::cell::UnsafeCell;
use std::fs::OpenOptions;
use std::path::Path;
use std::sync::atomic::{fence, Ordering};
u... |
use crate::{repr::ReprUsize, set::Set};
use core::slice::{Iter, IterMut};
use std::vec::IntoIter;
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
pub struct SparseSet<T> {
dense: Vec<T>,
sparse: Box<[usize]>,
}
impl<A> SparseSet<A>
where
A: ReprUsize + Eq + Copy,
{
pub fn new(size: usize) -> Sel... |
use std::iter::FromIterator;
use super::value::Value;
use super::term::Term;
use combine::{Parser, ParserExt, State, ParseResult, ParseError, between, sep_by, letter, spaces, char, digit, many1, parser};
use combine::primitives::{Stream};
fn token_left_paren<I: Stream<Item=char>>(input: State<I>) -> ParseResult<(), ... |
#![no_std]
#![feature(llvm_asm, lang_items)]
#![feature(global_asm, start)]
mod core_reqs;
mod syscalls;
mod cursor;
mod memory;
mod wstr;
//use core::ffi::{c_void};
use core::ptr::{null_mut};
use syscalls::*;
use cursor::Cursor;
use memory::RegionWalker;
use wstr::ascii_to_wstr;
#[lang = "eh_personality"] extern fn... |
use ferris_base;
mod utils;
#[test]
fn open_destroys_shut() {
let start = vec![
"..🔑........",
"..🔑🚪......",
"Ke==Op......",
"Ke==U Do==Cl",
];
let inputs = vec![ferris_base::core::direction::Direction::RIGHT];
let end = vec![
"....🔑......",
".......... |
pub mod parser;
use chrono::DateTime;
use chrono::offset::FixedOffset;
#[derive(Clone, Debug, PartialEq)]
pub struct Record {
pub date: DateTime<FixedOffset>,
pub name: String,
pub extent: u32,
pub ear_length: u8,
pub data_length: u32,
pub seq_number: u16,
pub version: Option<u8>,
pub ... |
pub fn transfertoken() {
loop {
println!("transfer token");
let mut counter = 0;
if counter >= 3 {
break;
}
}
}
|
/// PRBranchInfo information about a branch
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct PrBranchInfo {
pub label: Option<String>,
#[serde(rename = "ref")]
pub ref_: Option<String>,
pub repo: Option<Box<crate::repository::Repository>>,
pub repo_id: Option<i64>,
pub sha: O... |
use std::collections::HashMap;
use std::fs::File;
use std::io::{BufRead, BufReader, Result};
fn main() -> Result<()> {
let path = "numbers.txt";
let input = File::open(path)?;
let buffered = BufReader::new(input);
let mut vector: Vec<String> = vec![];
for line in buffered.lines() {
match l... |
#[cfg(test)]
mod tests {
#[test]
fn test_foo() {
assert_eq!(2 + 2, 4);
}
#[test]
fn test_foo_bar() {
assert_eq!(1 + 1, 2);
}
}
|
#[doc = "Reader of register GICD_CTLR"]
pub type R = crate::R<u32, super::GICD_CTLR>;
#[doc = "Writer for register GICD_CTLR"]
pub type W = crate::W<u32, super::GICD_CTLR>;
#[doc = "Register GICD_CTLR `reset()`'s with value 0"]
impl crate::ResetValue for super::GICD_CTLR {
type Type = u32;
#[inline(always)]
... |
//! [](http://i.imgur.com/RUEw8EW.png)
//!
//! bspline
//! ===
//! A library for computing B-spline interpolating curves on generic control points. bspline can
//! be used to evaluate B-splines of varying orders on any type that can be linearly interpolated,
//! ranging from float... |
use core::num::NonZeroU32;
use necsim_core::{
cogs::{Backup, Habitat},
landscape::Location,
};
use crate::decomposition::Decomposition;
#[allow(clippy::module_name_repetitions)]
#[derive(Debug)]
pub struct MonolithicDecomposition(());
impl Default for MonolithicDecomposition {
fn default() -> Self {
... |
extern crate tokio;
extern crate env_logger;
use tokio::io;
use tokio::net::{TcpStream, TcpListener};
use tokio::prelude::*;
macro_rules! t {
($e:expr) => (match $e {
Ok(e) => e,
Err(e) => panic!("{} failed with {:?}", stringify!($e), e),
})
}
fn create_client_server_future() -> Box<Future<It... |
//! Interrupts
extern crate alloc;
#[no_mangle]
pub static INTERRUPTS: [unsafe extern "C" fn(); 97] = [handle_interrupt; 97];
pub static mut INTS : [bool; 97] = [false; 97];
static mut ISRS: [Option<unsafe fn(u8)>; 97] = [None; 97];
unsafe extern "C" fn handle_interrupt () {
let iabr_addr = 0xE000E300 as *const [... |
#[doc = "Register `FTSR1` reader"]
pub type R = crate::R<FTSR1_SPEC>;
#[doc = "Register `FTSR1` writer"]
pub type W = crate::W<FTSR1_SPEC>;
#[doc = "Field `TR0` reader - Falling trigger event configuration of line 0"]
pub type TR0_R = crate::BitReader<TR0_A>;
#[doc = "Falling trigger event configuration of line 0\n\nVa... |
use std::env;
use std::process::Command;
use clap::ArgMatches;
use regex::{Captures, Regex};
use skim::SkimOutput;
use crate::pdf;
/// The different options to do after selecting an item
pub enum Action {
PrintResult,
RunCommand(String),
}
impl Action {
/// Creates an `Action` from clap's matches
pu... |
mod color;
mod history_keeper;
mod kind;
pub use color::{ColorMode, Palette};
use history_keeper::HistoryKeeper;
pub use kind::{Kind, KindSet};
use crate::direction::Direction;
use crate::position::InScreenBounds;
use crate::position::Position;
use rng::Rng;
pub struct Pipe {
dir: HistoryKeeper<Direction>,
p... |
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
use std::cell::RefCell;
use std::collections::HashMap;
use std::io::Read;
use std::io::Write;
use std::path::Path;
use std::path::PathBuf;
use std::process::Command;
use std::process::Stdio;
use std::rc::Rc;
use backtrace::Backtrace;
use os_pi... |
#[doc = "Reader of register INTERP1_PEEK_LANE1"]
pub type R = crate::R<u32, super::INTERP1_PEEK_LANE1>;
impl R {}
|
#[cfg(not(feature = "std"))]
use alloc::{boxed::Box, vec::Vec};
use core::fmt;
/// An owned version of font [`Face`](struct.Face.html).
pub struct OwnedFace(Box<SelfRefVecFace>);
impl OwnedFace {
/// Creates an `OwnedFace` from owned data.
///
/// You can set index for font collections. For simple ttf fon... |
use super::*;
use elias_fano_rust::EliasFano;
use indicatif::ProgressIterator;
use bitvec::prelude::*;
use std::cmp::Ordering;
use rayon::prelude::ParallelSliceMut;
use std::collections::BTreeMap;
use log::info;
type ParsedStringEdgesType = Result<
(
EliasFano,
EliasFano,
Vocabulary<NodeT>,... |
#[allow(unused_imports)]
use super::util::prelude::*;
use super::super::resource::BlockTexture;
use super::util::{Pack, PackDepth};
use super::BlockMut;
use super::BlockRef;
use crate::libs::color::Pallet;
use crate::libs::random_id::U128Id;
use std::collections::HashSet;
#[derive(Clone, Copy)]
pub enum Shape {
C... |
#[doc = "Register `IM` reader"]
pub type R = crate::R<IM_SPEC>;
#[doc = "Register `IM` writer"]
pub type W = crate::W<IM_SPEC>;
#[doc = "Field `OVRUDRIE` reader - Overrun/underrun interrupt enable"]
pub type OVRUDRIE_R = crate::BitReader<OVRUDRIE_A>;
#[doc = "Overrun/underrun interrupt enable\n\nValue on reset: 0"]
#[d... |
extern crate little;
use std::collections::HashMap;
use std::io::{ Read, Write };
use std::fmt;
use little::*;
use little::interpreter::Interpreter;
/// Simple value implementation.
/// You can provide your own value implementation for interpreter,
/// it is generic.
#[derive(Debug, Clone, Eq, PartialEq, PartialOrd)... |
// ===============================================================================
// Authors: AFRL/RQQA
// Organization: Air Force Research Laboratory, Aerospace Systems Directorate, Power and Control Division
//
// Copyright (c) 2017 Government of the United State of America, as represented by
// the Secretary of th... |
extern crate ipdb;
use ipdb::{Ipdb, Language, Fields};
use std::fs::File;
fn create_reader() -> File {
File::open("./tests/fixtures/test.ipdb").unwrap()
}
#[test]
fn test_new() {
let mut file = create_reader();
Ipdb::new(&mut file);
}
#[test]
fn test_find() {
let mut file = create_reader();
let ... |
use app_id::AppId;
use key_handle::KeyHandle;
use private_key::PrivateKey;
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct ApplicationKey {
pub application: AppId,
pub handle: KeyHandle,
key: PrivateKey,
}
impl ApplicationKey {
pub fn new(application: AppId, handle: KeyHandle, key: PrivateK... |
use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
use std::future::Future;
use std::sync::Arc;
use itertools::Itertools;
use log::error;
use tokio::sync::Mutex;
use tokio::time::Duration;
use discorsd::{async_trait, BotState};
use discorsd::commands::*;
use discorsd::errors::{AvalonError, BotError};
use... |
use crate::heartbeat::Timestamp;
// House
pub const IP_LIST: [&str; 4] = [
"192.168.86.70:9000",
"192.168.86.70:9001",
"192.168.86.70:9002",
"192.168.86.68:9000",
// when youre not lazy, get a setup of the machines working
];
// Apartment
// pub const IP_LIST: [&str; 4] = [
// "192.168.0.124:9... |
//! A metallic, reflective material.
use crate::{
hittable::HitRecord,
material::{Scatter, ScatterType},
ray::Ray,
vec3::Vec3,
};
use rand::Rng;
/// A basic, metallic, reflective material. Attenuation can be changed by
/// modifying the albedo property.
#[derive(Copy, Clone, Debug)]
pub struct Metal {... |
#[allow(clippy:all)]
// generated via `build.rs`, one test per directory in tests/data
include!(concat!(env!("OUT_DIR"), "/validator_data_tests.rs"));
include!(concat!(env!("OUT_DIR"), "/validator_errors_tests.rs"));
include!(concat!(env!("OUT_DIR"), "/generator_invalid_tests.rs"));
include!(concat!(env!("OUT_DIR"), "/... |
pub mod school_member{
pub mod student{
pub fn get_marks(){
println!("Marks");
}
}
}
|
use lc_render::{BandScale, BarsValues, Chart, Color, LinearScale, VerticalBarView};
fn main() {
// Configure document size.
let width = 800;
let height = 600;
// Configure document margins.
let margin_top = 90;
let margin_bottom = 50;
let margin_left = 60;
let margin_right = 40;
/... |
#[doc = "Reader of register IC_DMA_TDLR"]
pub type R = crate::R<u32, super::IC_DMA_TDLR>;
#[doc = "Writer for register IC_DMA_TDLR"]
pub type W = crate::W<u32, super::IC_DMA_TDLR>;
#[doc = "Register IC_DMA_TDLR `reset()`'s with value 0"]
impl crate::ResetValue for super::IC_DMA_TDLR {
type Type = u32;
#[inline(... |
use std::time::Duration;
use unsub_ref::UnsubRef;
use std::sync::Arc;
use std::sync::Once;
use std::sync::ONCE_INIT;
//todo: facade
pub trait Scheduler
{
fn schedule(&self, act: impl Send+'static+FnOnce()->UnsubRef<'static>) -> UnsubRef<'static>;
fn schedule_after(&self, due: Duration, act: impl Send+'static+... |
// vi: sw=4 ts=4
extern crate docopt;
extern crate rustc_serialize;
use std::process;
use std::process::exit;
use docopt::Docopt;
mod cli;
use cli::Args;
mod domain;
use domain::Cidr;
fn main() {
let args: Args = Docopt::new(cli::USAGE)
.and_then(|d| d.decode())
.unwrap_or_else(|e| e.exit());
... |
use super::navi_table_name::NaviTableName;
use apllodb_immutable_schema_engine_domain::vtable::VTable;
use serde::{Deserialize, Serialize};
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default, Serialize, Deserialize)]
pub(super) struct CreateTableSqlForNavi(String);
impl CreateTableSqlForNavi {
p... |
#![cfg_attr(not(test), no_std)]
#![cfg_attr(not(test), no_main)]
use core::panic::PanicInfo;
use mtos::*;
#[cfg(not(test))]
#[no_mangle]
pub extern "C" fn _start() -> ! {
mtos::interrupts::init();
x86_64::instructions::interrupts::int3();
serial_println!("ok");
unsafe {
exit_qemu();
}
... |
use chrono::{DateTime, Utc, Local};
use elastic::client::SyncClient;
use elastic::prelude::*;
use serde::{Serialize, Deserialize};
use rust_cqrses_bankaccount::dao::{BankAccountRM, BankAccountRMDao};
pub struct ElasticBankAccountRMDao {
client: SyncClient,
}
impl ElasticBankAccountRMDao {
pub fn new(client... |
use cgmath::{Deg, Matrix4, Point3, Vector3, Matrix3, Matrix, SquareMatrix};
pub struct Camera {
fov_y: Deg<f32>,
aspect_ratio: f32,
near: f32,
far: f32,
position: Point3<f32>,
target: Point3<f32>,
}
impl Camera {
pub fn new(
fov_y: Deg<f32>,
aspect_ratio: f32,
near:... |
use std::net::Ipv6Addr;
use bitcoinrs_bytes::decode::{Decodable, DecodeError, ReadBuffer};
use bitcoinrs_bytes::encode::{Encodable, WriteBuffer};
use bitcoinrs_bytes::endian::{i32_l, u64_l};
use super::common_types::{NetAddrForVersionMsg, Service, Services, Timestamp, VarStr};
use super::MsgPayload;
const DEFAULT_US... |
use serde::{Deserialize, Serialize};
use super::connection::Product;
#[derive(Serialize, Deserialize, Debug)]
pub struct Station {
latitude: f64,
longitude: f64,
id: String,
#[serde(rename = "divaId")]
diva_id: usize,
place: String,
name: String,
#[serde(rename = "hasLiveData")]
has... |
struct Solution();
impl Solution {
pub fn product_except_self(nums: Vec<i32>) -> Vec<i32> {
// let length = nums.len();
// let mut except_self_vec=vec![1;length];
// for i in 0..length{
// for j in 0..length{
// if i != j{
// except_self_vec[i]... |
//! A library for generating code to be used with `prost-simple-rpc`.
//!
//! Use the [`ServiceGenerator`](./struct.ServiceGenerator.html) with `prost-build` to generate
//! the code:
//!
//! ```
//! extern crate prost_build;
//! extern crate prost_simple_rpc_build;
//!
//! fn main() {
//! # ::std::env::set_var("OUT_DI... |
use crate::common::print_annot;
use crate::common::Annot;
use crate::common::Loc;
use std::error::Error as StdError;
use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum InterpreterErrorKind {
TapeBufferOverflow,
NegativePosition,
CannotDecodeCharacter,
CannotReadCharacter,
}
pub type I... |
#[doc = "Register `EECR3` reader"]
pub type R = crate::R<EECR3_SPEC>;
#[doc = "Register `EECR3` writer"]
pub type W = crate::W<EECR3_SPEC>;
#[doc = "Field `EE6F` reader - EE6F"]
pub type EE6F_R = crate::FieldReader;
#[doc = "Field `EE6F` writer - EE6F"]
pub type EE6F_W<'a, REG, const O: u8> = crate::FieldWriter<'a, REG... |
#![no_std]
#![no_main]
#![feature(asm)]
#![feature(abi_x86_interrupt)]
#![feature(custom_test_frameworks)]
#![test_runner(test_runner)]
#![reexport_test_harness_main = "test_main"]
use blanc_os::test_runner;
use coop::{executor::Executor, Task};
use memory::{allocator, phys::PhysFrameAllocator};
use core::panic::Pani... |
#[cfg(feature = "run_examples")]
extern crate rand;
#[cfg(feature = "run_examples")]
extern crate sodiumoxide;
#[cfg(feature = "run_examples")]
mod libsodium_compare {
extern crate rand;
extern crate sodiumoxide;
use crypto_api_chachapoly::ChachaPolyIetf;
use crypto_api::cipher::AeadCipher;
use rand::Rng;
us... |
extern crate libc;
use libc::c_uchar;
#[no_mangle]
/// External interface for the scoring algorithm
pub extern "C" fn ext_score(choice: *const c_uchar, choice_len: u32, query: *const c_uchar, query_len: u32) -> f64 {
let c = unsafe {
std::str::from_utf8(std::slice::from_raw_parts(choice, choice_len as usi... |
use core::cmp::min;
use core::convert::TryInto;
use embedded_time::{duration::*, Clock, Instant};
use heapless::ArrayLength;
use super::{Error, Result, RingBuffer, Socket, SocketHandle, SocketMeta};
pub use embedded_nal::{Ipv4Addr, SocketAddr, SocketAddrV4};
/// A UDP socket ring buffer.
pub type SocketBuffer<N> = R... |
#[doc = "Register `ITLINE23` reader"]
pub type R = crate::R<ITLINE23_SPEC>;
#[doc = "Field `I2C1` reader - I2C1"]
pub type I2C1_R = crate::BitReader;
impl R {
#[doc = "Bit 0 - I2C1"]
#[inline(always)]
pub fn i2c1(&self) -> I2C1_R {
I2C1_R::new((self.bits & 1) != 0)
}
}
#[doc = "interrupt line 23... |
use gfx;
use ::math::*;
/// Define simple vertex data.
gfx_defines!{
vertex VertexPos2D {
pos: [f32; 2] = "a_Pos",
color: [f32; 3] = "a_Color",
}
vertex VertexPos3D {
pos: [f32; 3] = "a_Pos",
color: [f32; 3] = "a_Color",
}
}
macro_rules! vertex_pos3d {
($pos: expr) ... |
/// The game "board" that has the pieces in it
mod board;
/// Some color constants
mod colors;
/// The gui that is drawn
mod gui;
use gui::BoardGui;
use iced::{Sandbox, Settings};
fn main() {
BoardGui::run(Settings::default());
}
|
use chrono::*;
use draw::Frame;
use rustbox::Color;
pub struct Thread {
title: String,
id: i64,
}
impl Thread {
pub fn new(title: String, id: i64) -> Thread {
Thread {title: title,
id: id}
}
}
pub struct Post<'a> {
text: String,
time: DateTime<UTC>,
thread: &'a Thr... |
use exonum::crypto::{Hash, PublicKey};
use currency::assets::Fees;
use currency::error::Error;
encoding_struct! {
/// Information about an asset in the network.
struct AssetInfo {
creator: &PublicKey,
origin: &Hash,
amount: u64,
fees: Fees,
data: &str,
}
}
... |
use crate::prelude::*;
mod box_triangle;
pub use self::box_triangle::{ BoxFilter, TriangleFilter };
pub trait Filter {
fn radius(&self) -> Vector2f;
fn radius_inv(&self) -> Vector2f;
fn evaluate(&self, p: Point2f) -> Float;
}
|
use crate::{AyMode, AymBackend, SoundChip, StereoSample, AY_REGISTER_COUNT};
const TONE_CHANNELS: usize = 3;
const DECIMATE_FACTOR: usize = 8;
const FIR_SIZE: usize = 192;
const DC_FILTER_SIZE: usize = 1024;
#[derive(Default)]
struct ToneChannel {
tone_period: u16,
tone_counter: u16,
tone: usize,
tone... |
// Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0.
use std::error::Error as StdError;
use std::io::Error as IoError;
use std::num::ParseIntError;
use std::path::PathBuf;
use std::result;
use grpcio::Error as GrpcError;
use tokio_sync::oneshot::error::RecvError;
use uuid::{parser::ParseError, BytesErro... |
use super::cart;
#[derive(Debug)]
pub enum Status {
Created(String),
Unpaid(String),
Paid(String),
}
#[derive(Debug)]
pub struct Billing {
pub name: String,
pub address: String,
pub shipping_cost: f32,
}
#[derive(Debug)]
pub struct Order<'c, 'a, 'b: 'a, 's: 'b, 'd> {
pub id: u32,
pub... |
use std::fs;
fn main(){
let data = fs::read_to_string("./text.txt").unwrap();
println!("{}", data);
}
|
mod dynamic;
mod derive;
mod iter;
fn main() {
dynamic::dynamic_box();
derive::deriveable();
iter::call_iter();
}
|
//
// Copyright 2019 The Project Oak Authors
//
// 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 o... |
use serde::Deserialize;
use std::fs;
#[derive(Debug, Deserialize)]
pub struct Config {
pub server: Server,
pub database: Database,
pub nodes: Vec<Node>,
}
#[derive(Debug, Deserialize)]
pub struct Server {
pub address: String,
pub auth_key: String,
}
#[derive(Debug, Deserialize)]
pub struct Databa... |
#[macro_use]
mod test;
mod common;
mod choose;
mod completions;
mod conditional;
mod delimiters;
mod dotenv;
mod edit;
mod error_messages;
mod evaluate;
mod examples;
mod export;
mod init;
mod interrupts;
mod invocation_directory;
mod misc;
mod positional_arguments;
mod quiet;
mod readme;
mod search;
mod shell;
mod s... |
use serde::{Serialize, Deserialize};
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct VoiceListEntity {
pub language_codes: Vec<String>,
pub name: String,
pub ssml_gender: String,
pub natural_sample_rate_hertz: u64,
}
#[derive(Deserialize, Debug)]
pub struct VoiceListRespons... |
use std::{error::Error, fs, path::PathBuf, process};
use clap::Parser;
use jsonschema::JSONSchema;
type BoxErrorResult<T> = Result<T, Box<dyn Error>>;
use std::fs::File;
use std::io::BufReader;
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
struct Cli {
/// A path to a JSON instance... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.