text stringlengths 8 4.13M |
|---|
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
use arma_rs::{quote, simple_array};
#[test]
fn test_macros() {
assert_eq!(r#"["my_data"]"#, quote!(simple_array!("my_data")));
assert_eq!(
r#"["my_player","[""items"",""in"",""quotes""]"]"#,
quote!(simple_array!("my_player", "[\"items\",\"in\",\"quotes\"]"))
);
assert_eq!(r#"["my_data",... |
use crate::{batch::KafkaBatch, KafkaMessage};
use rskafka_proto::{
apis::fetch::{FetchResponsePartition, FetchResponseTopic, FetchResponseV4},
Record, RecordBatch,
};
use rskafka_wire_format::WireFormatBorrowParse;
use std::borrow::Cow;
#[derive(Debug)]
pub struct FetchResponse {
pub topics: Vec<FetchRespo... |
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.
use super::expr::{CallExp... |
use crate::compiling::v1::assemble::prelude::*;
/// Compile a binary expression.
impl Assemble for ast::ExprBinary {
fn assemble(&self, c: &mut Compiler<'_>, needs: Needs) -> CompileResult<Asm> {
let span = self.span();
log::trace!("ExprBinary => {:?}", c.source.source(span));
log::trace!(
... |
use crate::{errors::Error, models::*};
use anyhow::format_err;
use futures::{
future::{ok, BoxFuture},
stream::FuturesUnordered,
Sink, Stream,
};
use serde_json::Value;
use std::{
collections::HashMap,
future::pending,
net::SocketAddr,
pin::Pin,
sync::{Arc, Mutex},
task::{Context, Po... |
pub fn log_error(error: &str){
println!("ERROR: {}", error)
}
pub fn divide_away_from_0(numerator: i64, denominator: i64)->i64{
let ret=numerator/denominator;
if ret<0 {ret+1} else {ret}
}
pub fn divide_float_away_from_0(numerator: f64, denominator: f64)->i64{
let ret=numerator/denominator;
(if ret<0.0 {ret.floo... |
use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;
pub fn create_file_parts(path: &str) -> std::io::Result<()> {
let mut buffer = File::open(path)?;
} |
extern crate raft;
use std::sync::Arc;
use std::time::{Duration, Instant};
use async_trait::async_trait;
use futures::future::try_join_all;
use itertools::Itertools;
use rand::Rng;
use tokio::sync::Barrier;
use tokio::sync::{Mutex, RwLock};
use tokio::task::spawn;
use tokio::time::delay_for;
use tracing::{debug, info... |
use std::cell::RefCell;
use std::f64::consts::PI;
use std::rc::Rc;
use rand::{Rng, thread_rng};
use rand::rngs::OsRng;
use wasm_bindgen::prelude::*;
use wasm_bindgen::UnwrapThrowExt;
use web_sys;
use web_sys::CanvasRenderingContext2d;
use polycons::config::WorldConfig;
use crate::polycons::{Line, Node, World};
mod ... |
use std::collections::{HashMap, HashSet, VecDeque};
use std::net::SocketAddr;
use std::time::Duration;
use slab::Slab;
use mio::net::TcpListener;
pub use mio::Token;
use mio::*;
use mio_extras::channel;
use ws::connection::{ConnEvent, Connection};
use declarative_dataflow::server::Request;
use declarative_dataflow:... |
//! # Handlebars
//! Handlebars is a modern and extensible templating solution originally created in the JavaScript world. It's used by many popular frameworks like [Ember.js](http://emberjs.com) and Chaplin. It's also ported to some other platforms such as [Java](https://github.com/jknack/handlebars.java).
//!
//! And... |
use serde_json;
use std::fmt::Debug;
use crate::errors::{DeserializationError, ServerError};
use crate::line_reader::LineReader;
use crate::requests::Request;
use std::io::{Error as StdIoError, ErrorKind as StdIoErrorKind};
#[derive(Debug, Clone)]
enum ServerState {
/// Expecting a header
Header,
/// Expec... |
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
use pathfinding::domains::BitGrid;
pub struct Problem {
pub from: (i32, i32),
pub to: (i32, i32),
}
pub fn load_scenario(scen: &Path) -> Result<(BitGrid, Vec<Problem>), MovingAiParseError> {
let map = parse_map(&scen.with_extensio... |
use std::cmp::{max, min};
use std::collections::{HashMap, HashSet};
use itertools::Itertools;
use whiteread::parse_line;
// dp
// https://atcoder.jp/contests/joi2012yo/tasks/joi2012yo_d
fn main() {
let (n, k): (usize, usize) = parse_line().unwrap();
let mut already: HashMap<usize, usize> = HashMap::new();
... |
mod assets;
mod lib;
fn main() {
if let Err(e) = lib::run() {
eprintln!("{}", e);
}
}
|
extern crate rustc_serialize;
extern crate hyper;
extern crate xml;
use std::collections::HashMap;
#[derive(RustcEncodable, Default, Debug, Clone)]
struct StopArea {
id: i32,
name: String,
x: i32,
y: i32,
}
fn ask_stop_area(x: i32, y: i32, m: &mut HashMap<i32, StopArea>) {
let uri = format!("http... |
use crate::{
convert::ToPyObject, AsObject, PyObject, PyObjectRef, PyResult, TryFromObject, VirtualMachine,
};
use std::borrow::Borrow;
pub enum Either<A, B> {
A(A),
B(B),
}
impl<A: Borrow<PyObject>, B: Borrow<PyObject>> Borrow<PyObject> for Either<A, B> {
#[inline(always)]
fn borrow(&self) -> &Py... |
use regex::Regex;
use serenity::framework::standard::{macros::command, CommandResult};
use serenity::model::prelude::*;
use serenity::prelude::*;
#[command]
async fn protonge(ctx: &Context, msg: &Message) -> CommandResult {
static APP_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"... |
#[doc = r"Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::_1_INTEN {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R,... |
use proconio::{input, marker::Chars};
fn main() {
input! {
t: usize,
};
for _ in 0..t {
input! {
s: Chars,
t: Chars,
};
solve(s, t);
}
}
fn solve(s: Vec<char>, t: Vec<char>) {
if t == vec!['a'] {
println!("1");
return;
}
... |
use super::rpc::{Message, RPCMessage, RequestVoteRequest, RPCCS};
use super::timer::NodeTimer;
use crossbeam_channel::{select, unbounded};
use std::net::{SocketAddr, ToSocketAddrs};
use std::sync::Arc;
use std::thread;
use std::time::{Duration, Instant};
#[cfg(test)]
#[test]
fn rpc_send_rec() {
let socket_addr = A... |
use std::collections::btree_map::{
Iter as BTreeMapIter, Keys as BTreeMapKeysIter, Values as BTreeMapValuesIter,
};
use std::collections::BTreeMap;
use std::fmt;
use std::path::{Path, PathBuf};
use std::str::FromStr;
use clap::ArgMatches;
use thiserror::Error;
use firefly_util::diagnostics::FileName;
use firefly_... |
// 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 {
crate::elf_parse as elf,
crate::util,
failure::Fail,
fuchsia_zircon::{self as zx, AsHandleRef},
std::ffi::{CStr, CString},
};
//... |
use ev3dev_lang_rust::{motors::MotorPort, sensors::SensorPort, Port};
extern crate ev3dev_lang_rust;
#[test]
fn test_input_port_mapping() {
assert_eq!(SensorPort::In1.address(), "serial0-0:S1".to_string());
assert_eq!(SensorPort::In2.address(), "serial0-0:S2".to_string());
assert_eq!(SensorPort::In3.addre... |
/// Define and operate on a type represented as a bitfield
///
/// Creates typesafe bitfield type `MyFlags` with help of `bitflags!` macro and implements
/// elementary `clrear` operation as well as `Display` traint for it. Subsequently, shows basic
/// bitwise operations and formatting.
///
///
use std::fmt;
bitflag... |
pub use clap_conf::*;
pub mod clockin;
pub use crate::clockin::{ClockAction, Clockin, InData, LineClockAction};
pub mod s_time;
pub use crate::s_time::STime;
pub mod gob;
//mod pesto;
//pub use pesto::{Pestable, Rule};
pub mod err;
pub use err::{LineErr, TokErr};
|
mod texture;
pub use texture::Texture;
mod solid_color;
pub use solid_color::SolidColor;
|
use std;
import std::task;
fn start(c: chan[chan[str]]) {
let p: port[str];
let a;
let b;
p = port();
c <| chan(p);
p |> a;
log_err a;
p |> b;
log_err b;
}
fn main() {
let p: port[chan[str]];
let child;
p = port();
child = spawn start(chan(p));
let c;
p |... |
//! A metric instrumentation wrapper over [`ObjectStore`] implementations.
#![deny(rustdoc::broken_intra_doc_links, rustdoc::bare_urls, rust_2018_idioms)]
#![allow(clippy::clone_on_ref_ptr)]
#![warn(
missing_copy_implementations,
missing_debug_implementations,
clippy::explicit_iter_loop,
// See https:/... |
// Copyright 2019. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
use core_foundation_sys::base::*;
extern {
pub fn CFHTTPMessageGetTypeID() -> CFTypeID;
}
|
use hidapi::{HidApi, HidDevice, HidError};
use snafu::{Snafu, ResultExt, ErrorCompat};
use lazy_static::lazy_static;
const VENDOR_ID: u16 = 0x04d9;
const PRODUCT_ID: u16 = 0xa052;
const MAGIC_WORD: &str = "Htemp99e";
const CODE_END: u8 = 0x0D;
const CODE_CO2: u8 = 0x50;
const CODE_TEMPERATURE: u8 = 0x42;
#[derive(De... |
use actix_web::middleware::errhandlers::ErrorHandlerResponse;
use actix_web::{dev, HttpResponse, Result};
use std::error::Error;
use validator::ValidationErrors;
#[macro_export]
macro_rules! validate_errors {
($var:expr) => {
match handler::to_errors($var.validate()) {
Some(res) => {
... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[cfg(feature = "Web_Http_Diagnostics")]
pub mod Diagnostics;
#[cfg(feature = "Web_Http_Filters")]
pub mod Filters;
#[cfg(feature = "Web_Http_Headers")]
pub mod Headers;
#[link(name = "windows")]
extern "s... |
//! **Pool** for rbatis_core database connections.
use std::{
fmt,
sync::Arc,
time::{Duration, Instant},
};
use crate::connection::Connect;
use crate::database::Database;
use crate::transaction::Transaction;
use self::inner::SharedPool;
use self::options::Options;
mod connection;
mod executor;
mod inner... |
extern crate spinner;
#[macro_use]
extern crate lazy_static;
extern crate strum;
#[macro_use]
extern crate strum_macros;
mod spinner_data;
mod spinners_data;
mod spinner_names;
use std::time::Duration;
pub use spinner_names::SpinnerNames as Spinners;
pub use spinners_data::SPINNERS as RawSpinners;
pub struct Spinn... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct CompositeTransform3D(pub ::windows::core::IIns... |
#[derive(Debug)]
struct Age(i32);
fn main() {
let age = Age(35);
println!("{:?}", age);
} |
use std::ops::{Add, AddAssign, Mul, Neg, Sub};
use alga::general::ClosedNeg;
use nalgebra::{Point2, Scalar, Vector2};
use num_traits::{FromPrimitive, NumCast, ToPrimitive, Zero};
use num_traits::cast;
use rand::distributions::uniform::SampleUniform;
use rand::Rng;
use wasm_bindgen::prelude::wasm_bindgen;
#[wasm_bindg... |
#[macro_use]
extern crate failure;
extern crate byteorder;
extern crate encoding_rs;
extern crate lazy_static;
extern crate rusqlite;
extern crate serde;
pub mod files;
pub mod io;
pub mod sqlite;
pub mod utils;
|
use std::path::{Path, PathBuf};
use std::rc::Rc;
use polodb_bson::Document;
use crate::context::DbContext;
use crate::{DbResult, Config, SerializeType, TransactionType, Database};
fn mk_old_db_path(db_path: &Path) -> PathBuf {
let mut buf = db_path.to_path_buf();
let filename = buf.file_name().unwrap().to_str(... |
// Copyright 2022 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
use crate::constants::*;
use crate::sprite::Sprite;
use vector2d::Vector2D;
use sdl2::pixels::Color;
use sdl2::rect::{Point, Rect};
use sdl2::render::{Canvas, Texture};
use sdl2::video::Window;
const SIZE: i32 = 15;
const TARGET_ORIGIN_X: i32 = SCREEN_WIDTH as i32 / 2;
const TARGET_ORIGIN_Y: i32 = 50;
pub struct T... |
use env_logger;
use log::LevelFilter;
pub fn logger_init(log_level: u64) {
let log_level = match log_level {
0 => LevelFilter::Off,
1 => LevelFilter::Error,
2 => LevelFilter::Warn,
3 => LevelFilter::Info,
4 => LevelFilter::Debug,
5 | _ => LevelFilter::Trace,
};
... |
// 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 {
failure::Error,
fidl_fuchsia_net::{
IpAddress::{Ipv4, Ipv6},
Ipv4Address, Ipv6Address,
},
fidl_fuchsia_net_stack::{In... |
pub const VARIANT_FLAT: usize = 0;
pub const VARIANT_CONTAINED: usize = 1;
pub const VARIANT_OUTLINED: usize = 2; |
//! A control flow graph represented as mappings of extended basic blocks to their predecessors
//! and successors.
//!
//! Successors are represented as extended basic blocks while predecessors are represented by basic
//! blocks. Basic blocks are denoted by tuples of EBB and branch/jump instructions. Each
//! predece... |
use vertex;
pub trait Updateable {
fn update_offset(&mut self, x: f32, y: f32);
}
struct Color {
red: u8,
green: u8,
blue: u8,
}
impl Color {
fn get_color_floats(&self) -> (f32, f32, f32) {
let red = f32::from(self.red) / 255.0;
let green = f32::from(self.green) / 255.0;
l... |
use std::slice;
pub const RED: Color = Color { r: 1.0, b: 0.0, g: 0.0, a: 1.0 };
pub const WHITE: Color = Color { r: 1.0, b: 1.0, g: 1.0, a: 1.0 };
pub const BLUE: Color = Color { r: 0.0, b: 1.0, g: 0.0, a: 1.0 };
/// A struct representing a color.
///
/// Colors have a red, green, blue, and alpha component. If al... |
use crate::protocol::parts::multiline_option_part::MultilineOptionPart;
use crate::protocol::parts::option_part::OptionId;
pub type Topology = MultilineOptionPart<TopologyAttrId>;
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub enum TopologyAttrId {
HostName, // 1 // host name
HostPortNumber, // ... |
use clap::{App, Arg};
fn main() {
let m = App::new("clap-test")
.arg(Arg::with_name("STRING").multiple(true))
.arg(
Arg::with_name("n")
.short("n")
.help("do not output the trailing newline"),
)
.get_matches();
let out = match m.value... |
use std;
import std::task;
#[test]
#[ignore]
fn test_sleep() { task::sleep(1000000u); }
#[test]
fn test_unsupervise() {
fn f() { task::unsupervise(); fail; }
spawn f();
}
#[test]
fn test_join() {
fn winner() { }
let wintask = spawn winner();
assert (task::join(wintask) == task::tr_success);
... |
use gtk::prelude::*;
pub struct LabeledBar {
pub container: gtk::Box,
pub label: gtk::Label,
pub bar: gtk::LevelBar,
}
impl LabeledBar {
pub fn new(label_text: &str) -> Self {
let container = gtk::BoxBuilder::new()
.expand(true)
.spacing(2)
.orientation(gtk:... |
use std::fs::File;
use std::io::{BufRead, BufReader};
fn load_data() -> Vec<i32>{
let mut vec = Vec::new();
let f = File::open("../input.txt").unwrap();
let f = BufReader::new(f);
for line in f.lines() {
let line = line.expect("Unable to read line");
vec.push(line.parse::<i32>().unwra... |
//! Implementation for lustre node `Plant` (see [Plant](struct.Plant.html)).
//!
//! Code generated by the [Kind 2 model checker][kind 2].
//!
//! [kind 2]: http://kind2-mc.github.io/kind2/ (The Kind 2 model checker)
// Deactiving lint warnings the transformation does not respect.
#![allow(
non_upper_case_globals, n... |
use input_i_scanner::InputIScanner;
use join::Join;
fn main() {
let stdin = std::io::stdin();
let mut _i_i = InputIScanner::from(stdin.lock());
macro_rules! scan {
(($($t: ty),+)) => {
($(scan!($t)),+)
};
($t: ty) => {
_i_i.scan::<$t>() as $t
};
... |
// Copyright 2022 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
use crate::algebra::{AssociativeMagma, UnitalMagma};
/// A monoid.
///
/// This trait is an alias of [`AssociativeMagma`] + [`UnitalMagma`].
///
/// [`AssociativeMagma`]: ./trait.AssociativeMagma.html
/// [`UnitalMagma`]: ./trait.UnitalMagma.html
pub trait Monoid: AssociativeMagma + UnitalMagma {}
impl<T: Associative... |
//! FileSystem service.
//!
//! This module contains basic methods to manipulate the contents of the 3DS's filesystem.
//! Only the SD card is currently supported. You should prefer using `std::fs`.
// TODO: Refactor service to accomodate for various changes (such as SMDH support). Properly document the public API.
#![... |
use serde::{Deserialize, Serialize};
pub fn init_log() {
use simplelog::*;
// Use Debug log level for debug compilations
let log_level = if cfg!(debug_assertions) {
log::LevelFilter::Debug
} else {
log::LevelFilter::Info
};
let conf = ConfigBuilder::new()
.add_filter_i... |
extern crate serde;
#[macro_use]
extern crate failure;
// pub mod errors;
pub mod set_1_basics;
// pub use errors::Error;
// pub type Result<T> = std::result::Result<T, Error>;
|
use super::DocBase;
use comrak::markdown_to_html;
use comrak::ComrakOptions;
lazy_static! {
static ref MD_OPTIONS: ComrakOptions = ComrakOptions {
hardbreaks: true,
smart: true,
github_pre_lang: true,
width: std::usize::MAX,
default_info_string: Some("pine".into()),
... |
// Copyright 2017 the authors. See the 'Copyright and license' section of the
// README.md file at the top-level directory of this repository.
//
// Licensed under the Apache License, Version 2.0 (the LICENSE-APACHE file) or
// the MIT license (the LICENSE-MIT file) at your option. This file may not be
// copied, modif... |
// 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.
#[cfg(test)]
use {
crate::create_fidl_service, crate::registry::device_storage::testing::*,
crate::registry::device_storage::DeviceStorageFactory,
... |
#![recursion_limit = "128"]
pub mod components;
pub mod core;
pub mod storage;
#[macro_use]
extern crate yew;
|
use std::fs::File;
use std::io::{BufRead,BufReader};
use std::vec::Vec;
fn main() {
let input = File::open("input").expect("input does not exist");
let count = count_impossible_triangles(input);
println!("{:?}", count);
}
fn count_impossible_triangles(input: File) -> u64 {
let mut lined_input = BufRea... |
use std::env;
const DEFAULT_SIZE: u8 = 8;
const DEFAULT_THREADS: u8 = 1;
pub struct ConfigOptions {
help: bool,
num_queens: u8,
num_threads: u8,
}
impl ConfigOptions {
pub fn new() -> ConfigOptions {
ConfigOptions{help: false, num_queens: DEFAULT_SIZE, num_threads: DEFAULT_THREADS}
}
... |
/*
I CANT FIX THIS FUCKING CENTRAL PROCESSING BITCH
8 BITS OF FUCK
WHY IM I DOING THIS ANYWAY?
*/
use keypad::Keypad;
use display::{Display, FONT_SET};
use rand::ComplementaryMultiplyWithCarryGen;
pub struct Cpu {
//Index register
pub i: u16,
//Program counter
pub pc: u16,
//Memory - 4KB
pub... |
use std::fmt::{Debug,Formatter,Result};
use std::ops::Deref;
use super::num::Float;
type RawFn<T> = &'static Fn(Vec<T>) -> Option<T>;
pub trait Function<T: Sized> : Debug {
fn name(&self) -> &str;
fn args_count(&self) -> usize;
fn call(&self, args: Vec<T>) -> Option<T>;
}
pub struct FnFunction<T: 'static... |
use ring::digest;
use ring::hmac;
use std::io::Write;
fn concat_sign(key: &hmac::SigningKey, a: &[u8], b: &[u8]) -> digest::Digest {
let mut ctx = hmac::SigningContext::with_key(key);
ctx.update(a);
ctx.update(b);
ctx.sign()
}
fn p(out: &mut [u8],
hashalg: &'static digest::Algorithm,
secret: &[u8],... |
/*
* @lc app=leetcode id=703 lang=rust
*
* [703] Kth Largest Element in a Stream
*/
// @lc code=start
use std::collections::BinaryHeap;
use std::cmp::Reverse;
struct KthLargest {
k: usize,
heap: BinaryHeap<Reverse<i32>>
}
/**
* `&self` means the method takes an immutable reference.
* If you need a mut... |
//! This module provides the ability to simulate a mutli table independent chip tournament.
//! It does this via simulation. Different heros and villans go to all in show downs. Then
//! the resulting placements are computed as each player busts.
//!
//! This method does not require a recursive dive N! so it makes simu... |
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
//! Internal utility functions, types, and data structures.
/// Partition a mutable slice in-place so that it contains all elements for
/// which `predicate(e)` is `true`, followed by all elements for which
/// `predicate(e)` is `false`. Returns sub-slices to all predicated and
/// non-predicated elements, respectivel... |
use clap::{App, Arg};
pub struct ThorCliArgs {
pub root_hostname: String,
}
impl ThorCliArgs {
pub fn new() -> ThorCliArgs {
let app_clap: App = App::new("Thor client")
.version("0.1.0")
.author("Genin Christophe <genin.christophe@gmail.com>")
.about("An thor client... |
use std::collections::BinaryHeap;
use std::cmp::Reverse;
use crate::exchange::{Order, Trade, OrderStatus};
// The market for a security
#[derive(Debug)]
pub struct Market {
pub buy_orders: BinaryHeap<Order>,
pub sell_orders: BinaryHeap<Reverse<Order>>
}
impl Market {
pub fn new(buy: BinaryHeap<Order>, sel... |
grass::grass_query! {
let a = open("data/a.bed");
let b = open("data/b.bed");
intersect(a, b) | cat(
Overlap + S("|")
+ Original(0) + Fraction(0) +S("|")
+ Original(1) + Fraction(1)
)
}
|
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub type AllJoynAboutData = *mut ::core::ffi::c_void;
pub type AllJoynAboutDataView = *mut ::core::ffi::c_void;
pub type AllJoynAcceptSessionJoinerEventArgs = *... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor 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 ... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub type MiracastReceiver = *mut ::core::ffi::c_void;
pub type MiracastReceiverApplySettingsResult = *mut ::core::ffi::c_void;
#[repr(transparent)]
pub struct M... |
use std::collections::VecDeque;
#[derive(Debug)]
pub struct Queue<T: Clone> {
queue: VecDeque<T>,
}
impl<T: Clone> Queue<T> {
pub fn new(size: usize) -> Queue<T>{
Queue{queue: VecDeque::<T>::with_capacity(size)}
}
pub fn add(&mut self, element: T) {
self.queue.push_back(element);
... |
/* origin: FreeBSD /usr/src/lib/msun/src/s_expm1.c */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freel... |
extern crate afs_util;
use std::fs::File;
use std::io::{self, BufReader, BufWriter};
use std::env;
use afs_util::AfsReader;
fn main() {
let mut args = env::args().skip(1);
let filename = args.next().unwrap();
let file = BufReader::new(File::open(filename).unwrap());
let mut afs = AfsReader::new(file... |
use base64;
use flate2::bufread::GzDecoder;
use flate2::bufread::ZlibDecoder;
use std::io::Read;
use serde::export::TryFrom;
use serde::Deserialize;
use crate::color::Color;
use crate::layer::*;
use crate::object::Object;
use crate::property::Property;
#[derive(Deserialize)]
pub struct LayerReader {
#[serde(defa... |
use super::*;
// A WinRT method parameter used to accept either a reference or value. `Param` is used by the
// generated bindings and should not generally be used directly.
#[doc(hidden)]
pub enum Param<'a, T: Abi> {
Borrowed(&'a T),
Owned(T),
Boxed(T),
None,
}
impl<'a, T: Abi> Param<'a, T> {
///... |
use std::iter::once;
use std::mem;
use std::ops::Deref;
use crate::ast::choice::{ChoiceDef, CounterDef};
use crate::ast::constrain::Constraint;
use crate::ast::context::CheckerContext;
use crate::ast::error::{Hint, TypeError};
use crate::ast::trigger::TriggerDef;
use crate::ast::{
ir, print, Check, ChoiceInstance,... |
use criterion::{
criterion_group,
criterion_main,
Criterion,
};
use sqs_executor::{
cache::NopCache,
event_decoder::PayloadDecoder,
event_handler::{
CompletedEvents,
EventHandler,
},
};
use sysmon_generator_lib::{
generator::SysmonGenerator,
metrics::SysmonGeneratorMe... |
fn main() {
let _tup: (i32, f64, u8) = (500, 6.4, 1);
}
|
mod player;
pub mod animation;
pub use self::player::Player;
pub use self::player::PlayerState;
pub use self::player::Direction; |
use crate::PluginId;
use std::{
fmt::{self, Display},
str::FromStr,
};
use arrayvec::ArrayVec;
use abi_stable::{
std_types::{cow::BorrowingRCowStr, RCowStr, RString, RVec},
StableAbi,
};
use core_extensions::{SelfOps, StringExt};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
/// A... |
use crate::errors::{MelodyErrors, MelodyErrorsKind};
use crate::song::{Playlist, Song};
use crate::utils::fmt_duration;
use rand::{seq::SliceRandom, thread_rng};
use std::fmt;
use std::fs::File;
use std::io::{BufReader, Write};
use tabwriter::TabWriter;
/// Music Player Status
/// Showing the status of the Music playe... |
//! Extra types that represent SQL data values but with extra from/to implementations for `OdbcType` so they can be bound to query parameter
use std::fmt;
// Allow for custom type implementation
pub use odbc::{ffi, OdbcType};
#[cfg(feature = "chrono")]
mod sql_timestamp {
use super::*;
use chrono::naive::{Na... |
use crate::error::{GameError, GameResult};
use crate::math::Size;
use crate::engine::Engine;
use std::path::Path;
#[derive(Clone)]
pub struct Image {
size: Size<u32>,
pixels: Vec<u8>,
}
impl Image {
pub fn new(size: impl Into<Size<u32>>, pixels: Vec<u8>) -> GameResult<Self> {
let size = size.into... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[cfg(feature = "Devices_WiFiDirect_Services")]
pub mod Services;
#[link(name = "windows")]
extern "system" {}
pub type WiFiDirectAdvertisement = *mut ::core::ffi::c_void;
#[repr(transparent)]
pub struct W... |
/*
* Author: Dave Eddy <dave@daveeddy.com>
* Date: January 25, 2022
* License: MIT
*/
//! Argument parsing logic (via `clap`) for vsv.
use std::path;
use clap::{Parser, Subcommand};
#[derive(Debug, Parser)]
#[clap(author, version, about, verbatim_doc_comment, long_about = None)]
#[clap(before_help = r" __ ___... |
use std::io;
use std::rand::sample;
use std::rand::task_rng;
fn main() {
//Input
let mut iInput: (int,int);
loop {
match get_initial_input() {
Some(t) => {
iInput = t;
break;
},
None => {
println!("Invalid input")... |
use parking_lot::{Condvar, Mutex, MutexGuard};
use rayon::{ThreadPool, ThreadPoolBuilder};
use std::{
path::PathBuf,
sync::{atomic::AtomicBool, Arc},
};
use steamworks::{ClientManager, ItemState, PublishedFileId, QueryResults, UGC};
use crate::{
gma::{ExtractDestination, ExtractGMAMut},
transaction,
transaction... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor 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 ... |
#[macro_export]
macro_rules! string_vec {
[ $( $cell:expr ),* $(,)? ] => {
vec![
$( String::from($cell) ),*
]
};
[ $cell:expr ; $count:expr ] => {
vec![String::from($cell);$count]
};
}
#[cfg(test)]
mod tests {
#[test]
fn empty() {
let v1: Vec<String> ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.