text stringlengths 8 4.13M |
|---|
impl<'a> DataframeOps<'a, InnerType, OuterType> for DataFrame<InnerType, OuterType> {
/// Create a new dataframe. The only required argument is data to populate the dataframe. The data's elements can be any of `InnerType`.
/// By default, the columns and index of the dataframe are `["1", "2", "3"..."N"]`, w... |
//! Simple echo websocket server.
//! Open `http://localhost:8080/ws/index.html` in browser
//! or [python console client](https://github.com/actix/examples/blob/master/websocket/websocket-client.py)
//! could be used for testing.
#[macro_use]
extern crate lazy_static;
use awc::http::StatusCode;
use std::io;
use std::... |
// cargo run -- -f minx.cfg
mod config;
//use async_std::task::{sleep, spawn};
use self::config::*;
mod services;
use self::services::*;
fn help () {
println!("Usage: minx [-f json_file]");
println!("Example:");
println!(" minx -f config.cfg # load config.cfg and running");
println!("")... |
#[macro_use]
extern crate serde_derive;
extern crate docopt;
extern crate futures;
extern crate hyper;
extern crate hyper_tls;
extern crate tokio_core;
use docopt::Docopt;
mod methods;
const USAGE: &'static str = "
Exodus.
Usage:
exodus <url>
exodus (-h | --help)
exodus (-v | --version)
Options:
-h --help ... |
// Copyright 2018 The Exonum Team
//
// 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 i... |
use std::collections::HashSet;
use super::*;
use value::{Identifier, Obj, Value};
#[derive(Clone, Debug)]
pub struct Match {
pub conditions: Vec<Condition>,
pub actions: Vec<Action>,
pub acting_role: Option<String>,
msg_filters: HashSet<MessageFilter>,
}
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
p... |
use clap::Clap;
use cli::Opts;
use solana_client::client_error::ClientError;
fn main() -> Result<(),ClientError> {
let opts = Opts::parse();
cli::start(opts)
}
|
use ark_crypto_primitives::commitment::pedersen::Randomness;
use ark_ed_on_bls12_381::*;
use ark_ff::UniformRand;
use pedersen_example::*;
fn main() {
let mut rng = ark_std::test_rng();
let param = pedersen_setup(&[0u8; 32]);
// input is a 256 bytes of vector
let input = [
"This is the input blob we want to comm... |
extern crate smoke;
mod async;
mod io; |
#![allow(unused_variables,dead_code)]
use std::sync::Arc;
use std::collections::HashSet;
use std::collections::hash_set;
use std::collections::HashMap;
use common::{LifeAlgorithm,Bounds};
#[derive(PartialEq, Eq, Hash, Clone)]
enum LifeData {
Leaf(bool),
Split(Arc<LifeNode>, Arc<LifeNode>, Arc<LifeNode>, Arc<... |
// Lumol, an extensible molecular simulation engine
// Copyright (C) 2015-2016 Lumol's contributors — BSD license
use special::Error;
use std::f64::consts::PI;
use sys::System;
use types::{Matrix3, Vector3D, Zero};
use consts::ELCC;
use energy::{PairRestriction, RestrictionInfo};
use super::{GlobalPotential, Coulomb... |
//! Parse a ukhasnet packet and turn the measurements into something suitable
//! for InfluxDB
//!
//! This code is heavily based on Adam Greig's
//! https://github.com/adamgreig/ukhasnet-influxdb
use anyhow::{Result, bail};
use std::collections::HashMap;
use ukhasnet_parser::{Packet, DataField};
use std::time::{UNIX_... |
#[doc = "Register `DMA_USEBURSTSET` reader"]
pub struct R(crate::R<DMA_USEBURSTSET_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<DMA_USEBURSTSET_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<DMA_USEBURSTSET_SPEC>> for R {
#[inline(a... |
#!/usr/bin/env scriptisto
// scriptisto-begin
// script_src: src/main.rs
// build_cmd: cargo build --release && strip ./target/release/script
// target_bin: ./target/release/script
// files:
// - path: Cargo.toml
// content: |
// package = { name = "script", version = "0.1.0", edition = "2018"}
// [depende... |
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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.a... |
//extern crate prodbg_api;
use std::os::raw::{c_int, c_void};
pub struct Bgfx {
pub temp: i32,
}
impl Bgfx {
pub fn new() -> Bgfx {
unsafe { bgfx_create(); }
Bgfx {
temp: 0
}
}
pub fn create_window(window: *const c_void, width: c_int, height: c_int) {
unsa... |
use core;
#[derive(Clone,Copy)]
pub enum Clock {
PortC,
}
#[repr(C,packed)]
pub struct Sim {
sopt1:u32,
sopt1cfg:u32,
pad1:[u32;1023],
sopt2:u32,
pad2:u32,
sopt4:u32,
sopt5:u32,
pad3:u32,
sopt7:u32,
pad4:u32,
pad5:u32,
sdid:u32,
scgc1:u32,
scgc2:u32,
scgc3:u32,
scgc4:u32,
scgc5:u... |
// materials/lambertian.rs - Lambertian material.
// Written by quadfault
// 10/24/18
use crate::math::{ Ray, Vector };
use crate::models::HitResult;
use super::{ Material, ScatterResult, random_in_unit_sphere };
pub struct Lambertian {
albedo: Vector,
}
impl Lambertian {
pub fn new(albedo: Vector) -> Self ... |
use chrono::{DateTime, Utc};
use md5::{Digest, Md5};
use reqwest::blocking as reqwest;
use serde::de::DeserializeOwned;
use serde_json::Value;
use super::Store;
use crate::types;
const BASE_URL: &str = "http://api.smitegame.com/smiteapi.svc";
const INVALID_SESSION: &str = "Invalid session id.";
pub struct Smite<S> {... |
use crate::utils::cstr_to_string;
use bitflags::bitflags;
use spatialos_sdk_sys::worker::*;
use std::ffi::{CStr, CString};
pub(crate) type ReleaseCallbackHandle = Box<dyn FnOnce()>;
bitflags! {
pub struct LogCategory: u32 {
const Receive = 0x01;
const Send = 0x02;
const ... |
use ark_bls12_381::Bls12_381;
use ark_ec::PairingEngine;
use ark_poly_commit::kzg10::UniversalParams;
use ark_serialize::CanonicalSerialize;
use kzg_setup_powersoftau::{read_g1, read_g2, KZG_SETUP_FILE};
use powersoftau::{
Accumulator, CheckForCorrectness, HashReader, UseCompression, CONTRIBUTION_BYTE_SIZE,
};
use ... |
use crate::utils;
use crate::utils::Part;
use std::collections::HashMap;
pub fn solve(part: Part) -> i32 {
let mut input = String::new();
utils::read_input_to_string(&mut input, 3).unwrap();
let mut lines = input.lines();
let wire_one: Vec<&str> = lines.next().unwrap().split(",").collect();
let ... |
use failure::{Backtrace, Fail};
use regex::Regex;
use std::result::Result as StdResult;
pub type Result<SuccessT> = StdResult<SuccessT, Error>;
#[derive(Debug, Fail)]
pub enum Error {
#[fail(
display = "Invalid query parameter `{}`, doesn't match `{:?}`.",
name,
regex
)]
BadQueryPa... |
#![feature(platform_intrinsics, repr_simd)]
extern "platform-intrinsic" {
pub(crate) fn simd_shr<T>(x: T, y: T) -> T;
}
#[repr(simd)]
#[allow(non_camel_case_types)]
struct i32x2(i32, i32);
fn main() {
unsafe {
let x = i32x2(1, 1);
let y = i32x2(20, 40);
simd_shr(x, y); //~ERROR: overf... |
extern crate rand;
use board::*;
use rand::Rng;
impl Board {
pub fn rand_vals(&self) -> Vec<Option<SquareType>> {
let num_vals = self.side_length;
let mut retval = vec![];
let vals_range = self.min_value..self.max_value + 1;
let mut vals = vec![];
for i in vals_range {
... |
#![feature(collections,slice_patterns)]
#[macro_use]
extern crate nom;
use nom::{IResult,Needed,Producer,FileProducer,ProducerState,FlatMapOpt,Functor,not_line_ending};
use nom::IResult::*;
use std::str;
use std::fmt::Debug;
#[test]
fn map_test_x() {
let res = Done((), &b"abcd"[..]).map(|data| { str::from_utf8(da... |
//! This module contains the zk-SNARK "gadgets" that are meant to be used with circuits on the
//! MNT6-753 curve. This means that they can manipulate elliptic curve points on the MNT4-753 curve.
pub use y_to_bit::*;
mod y_to_bit;
|
// Copyright 2020 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 ... |
extern crate r2d2;
extern crate r2d2_sqlite;
extern crate rusqlite;
extern crate tempdir;
use std::sync::mpsc;
use std::thread;
use r2d2::ManageConnection;
use tempdir::TempDir;
use r2d2_sqlite::SqliteConnectionManager;
use rusqlite::Connection;
#[test]
fn test_basic() {
let manager = SqliteConnectionManager::f... |
use crate::{parse::NomParse, util::Point};
use std::io;
use nom::{branch, character::complete as character, combinator as comb, multi, IResult};
struct RatioGenerator {
last_set: Vec<(bool, Point<usize>)>,
current_set: Vec<(bool, Point<usize>)>,
max_x: usize,
max_y: usize,
has_next: bool,
}
impl... |
// Show how two loops may be nested within each other, with
// the number of iterations performed by the inner loop being
// controlled by the outer loop.
//
// Print this pattern:
// *
// **
// ***
// ****
// *****
use std::iter::range_inclusive;
fn loops_for() -> String {
let mut stars = String::new();
for i in ra... |
use super::{IndexId, Partition, RocksSecondaryIndex, TableId};
use crate::metastore::IdRow;
use crate::rocks_table_impl;
use crate::table::Row;
use crate::{base_rocks_secondary_index, CubeError};
use byteorder::{BigEndian, WriteBytesExt};
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use serde::{... |
use std::collections::HashMap;
// Split up a given string slice into all possible substrings of length n.
// Adapted from http://stackoverflow.com/a/30890221
fn offset_slices(s: &str, n: usize) -> Vec<&str> {
if s.len() < n {
return vec![s];
}
(0..s.len() - n + 1).map(|i| &s[i..i + n]).collect()
}
... |
#![feature(custom_test_frameworks)]
#![feature(test)]
#![test_runner(docker_tests_runner)]
#![feature(drain_filter)]
#![feature(non_ascii_idents)]
#[cfg(test)] use docker_tests::docker_tests_runner;
#[cfg(test)] #[macro_use] extern crate common;
#[cfg(test)] #[macro_use] extern crate fomat_macros;
#[cfg(test)] #[macro... |
use std::convert::From;
pub type RegisterOp = u8;
pub type RegisterPairOp = u8;
#[derive(Debug, PartialEq, Eq, Hash)]
pub enum Register {
A,
B,
C,
D,
E,
H,
L,
M,
}
impl From<RegisterOp> for Register {
fn from(op: RegisterOp) -> Self {
match op {
0b000 => Regist... |
use super::*;
use std::convert::TryInto;
macro_rules! json_format_single_line {
($x:expr) => {
serde_json::to_string(&$x).expect("Error formatting as JSON")
};
}
macro_rules! json_format_pretty {
($x:expr) => {
serde_json::to_string_pretty(&$x).expect("Error formatting as JSON")
};
}
p... |
use crate::{types::OscMessage, AfterCallAction, OscResponder, ScClientResult};
use log::info;
pub struct QuitResponder;
impl OscResponder for QuitResponder {
fn callback(&self, _message: &OscMessage) -> ScClientResult<()> {
Ok(info!("Quit..."))
}
fn get_address(&self) -> String {
String::f... |
// Copyright 2020 The Jujutsu 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
//@revisions: stack tree
//@[tree]compile-flags: -Zmiri-tree-borrows
use std::future::*;
use std::marker::PhantomPinned;
use std::pin::*;
use std::ptr;
use std::task::*;
struct Delay {
delay: usize,
}
impl Delay {
fn new(delay: usize) -> Self {
Delay { delay }
}
}
impl Future for Delay {
typ... |
use std::os::unix::io::RawFd;
use inotify_sys as ffi;
use libc::{
c_void,
size_t,
};
pub fn read_into_buffer(fd: RawFd, buffer: &mut [u8]) -> isize {
unsafe {
ffi::read(
fd,
buffer.as_mut_ptr() as *mut c_void,
buffer.len() as size_t
)
}
}
|
#[derive(Debug, Copy, Clone)]
pub struct Coords {
pub x: f64,
pub y: f64,
}
|
use std::collections::HashMap;
use std::fs;
use std::io;
use std::io::BufRead;
pub fn run() {
let mut fixed = 0;
let mut mem = HashMap::new();
let mut floats = Vec::new();
let mut z = 0;
for line in io::BufReader::new(fs::File::open("input.txt").unwrap())
.lines()
.filter_map(Result... |
extern crate rand;
extern crate ordered_float;
extern crate num_iter;
extern crate structopt;
#[macro_use]
extern crate structopt_derive;
extern crate nalgebra as na;
extern crate softcomputingforsoftpeople as sc;
#[macro_use]
extern crate lazy_static;
extern crate alga;
extern crate num_traits;
use structopt::StructO... |
// variable scope
fn test1() {
{
let s = "hello";
assert_eq!(s, "hello");
}
// assert_eq!(s, "hello"); // not allowed as variable is out of scope
}
// string type
fn test2() {
let s1 = String::from("hey");
// only pointer is copied not the actual data
// both point to the same ... |
use chrono::{Local, Utc};
use log::{Level, LevelFilter, Log, Metadata, Record, SetLoggerError};
use std::{
env,
fs::OpenOptions,
io::{prelude::*, BufWriter},
path::{Path, PathBuf},
};
use termcolor::Color;
use crate::{
color,
configurer::{ConfigurationDirectory, DefaultConfiguration},
patte... |
#![allow(dead_code)]
#![allow(unused)]
#[allow(unused_imports, dead_code)]
use tracing::{info, error, debug, trace, warn};
use bytes::Bytes;
use wasmer_wasi::vfs::FileSystem;
use std::io::Read;
use std::path::Path;
use std::path::PathBuf;
use super::EvalContext;
use crate::fs::*;
use crate::stdio::*;
use crate::err::*... |
use std::collections::HashMap;
use std::convert::{TryFrom, TryInto};
use std::io;
use std::io::Read;
use crate::day05::Machine;
#[must_use]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Direction {
Up,
Right,
Down,
Left,
}
impl Direction {
fn turn_cw(&mut self) {
match self {
... |
#[derive(Debug)]
pub struct Texture {
pub internal_format: gl::types::GLenum,
pub format: gl::types::GLenum,
pub data_type: gl::types::GLenum,
pub dimensions: (u32, u32),
pub texture_type: TextureType,
pub textureID: gl::types::GLuint,
pub is_loaded: bool,
}
impl Texture {
pub fn creat... |
#![allow(unused_imports)]
use tracing::{info, warn, debug, error, trace, instrument, span, Level};
use error_chain::bail;
use ate::prelude::*;
use std::sync::Arc;
use url::Url;
use std::io::stdout;
use std::io::Write;
use crate::prelude::*;
use crate::helper::*;
use crate::error::*;
use crate::request::*;
use crate::o... |
//! Cyclic redundancy check
//!
//! Polynomial division over GF(2) == bitwise add/sub discarding the carry == XOR
//! See <https://en.wikipedia.org/wiki/Mathematics_of_cyclic_redundancy_checks>.
#![allow(dead_code)]
// TODO: this will be moved to `std::collections` in Rust 1.2, probably.
use bit_vec::BitVec;
pub fn c... |
use hitable::{
Hitable,
HitRecord,
HitableList,
};
use ray::Ray3;
use aabb::AABB;
use material::Material;
use triangle::Triangle;
use quad::Quad;
use cgmath::{
Point3,
Vector3,
Quaternion,
Rotation,
One,
};
use std::time::Instant;
pub struct Pyramid {
hitable_list: HitableList,
}
... |
use std::io;
use std::process::{Command, ExitStatus};
use std::fs::File;
use std::io::{BufWriter, Write};
use byteorder::WriteBytesExt;
pub fn cmd(cmd: &str, args: Vec<&str>) -> Result<ExitStatus, io::Error> {
Command::new(cmd)
.args(&args)
.spawn()
.unwrap()
.wait()
}
pub fn disab... |
use crate::common::*;
#[macro_use]
mod cmd;
mod arguments;
mod bin;
mod bin_subcommand;
mod changelog;
mod command_ext;
mod common;
mod config;
mod entry;
mod error;
mod example;
mod faq;
mod faq_entry;
mod introduction;
mod kind;
mod metadata;
mod options;
mod package;
mod project;
mod readme;
mod reference;
mod ref... |
#![feature(conservative_impl_trait, plugin)]
#![plugin(maud_macros)]
extern crate maud;
use std::fmt;
#[test]
fn html_utf8() {
let mut buf = vec![];
html_utf8!(buf, p "hello").unwrap();
assert_eq!(buf, b"<p>hello</p>");
}
#[test]
fn issue_13() {
let owned = String::from("yay");
let mut s = Strin... |
// Copyright 2021, The Android Open Source Project
//
// 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... |
pub struct Solution {}
impl Solution {
pub fn wiggle_sort(nums: &mut Vec<i32>) {
let len = nums.len();
let median = Self::_find_nth(nums, len / 2);
let (mut big_slot, mut small_slot) = (1, (len - 1) / 2 * 2);
let mut idx = 0;
while idx < len {
match nums[idx].cm... |
fn main() {
// forward git repo hashes we build at
println!(
"cargo:rustc-env=COMMIT_DESCRIBE={}",
ckb_build_info::get_commit_describe().unwrap_or_default()
);
println!(
"cargo:rustc-env=COMMIT_DATE={}",
ckb_build_info::get_commit_date().unwrap_or_default()
);
}
|
// $ cargo run --bin ex3
fn main() {
let ans = (100 + 1) * 100 / 2;
println!("{}", ans);
}
|
use std::env;
fn main() {
let embree_lib = env::var("EMBREE_LIB_DIR").unwrap();
println!("cargo:rustc-link-search=native={}", embree_lib);
println!("cargo:rerun-if-changed=build.rs");
}
|
extern crate mio;
use mio::*;
pub struct WebSocketServer;
/// Handler interface only REQUIRES two values to be defined
impl Handler for WebSocketServer {
type Timeout = usize;
type Message = ();
}
|
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct ProvidersSummaryProviderInstance {
#[serde(rename = "active_server")]
pub active_server: Option<String>,
#[serde(rename = "client_site")]
pub client_site: Option<String>,
#[serde(rename = "connection... |
pub fn get_switch_update(shift_state: bool, addr: u16, value: u8) -> Vec<u8> {
let addr_high = (addr >> 8) as u8;
let addr_low = addr as u8;
vec![if shift_state {129} else {1}, addr_high, addr_low, value]
}
pub fn get_start_chaser(shift_state: bool, addr: u16, value: u8) -> Vec<u8> {
let addr_high = (a... |
// Copyright 2019-2020 Twitter, Inc.
// Licensed under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
use std::collections::HashMap;
use std::io::BufRead;
use std::path::Path;
use tokio::fs::File;
use tokio::io::{AsyncBufReadExt, BufReader};
pub mod bpf;
pub const VERSION: &str = env!... |
#[cfg(feature = "server")]
use std::{pin::Pin, time::Duration};
use bytes::BytesMut;
use http::{HeaderMap, Method};
use httparse::ParserConfig;
use crate::body::DecodedLength;
#[cfg(feature = "server")]
use crate::common::time::Time;
use crate::proto::{BodyLength, MessageHead};
#[cfg(feature = "server")]
use crate::r... |
pub mod numbers;
pub mod validation;
pub fn input_read_line() -> std::io::Result<String> {
let mut input = String::new();
std::io::stdin().read_line(&mut input)?;
Ok(input.trim().to_string())
}
|
use crate::models::Model;
use crate::routers::job_wrapper;
use warp::{Filter, Rejection, Reply};
pub fn new(model: Model) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
let job_model = model.job_model();
job_wrapper(job_model)
}
|
use std::sync::Weak;
use sigq::Queue as NotifyQueue;
use crate::err::Error;
use crate::rctx::InnerReplyContext;
use crate::server::ServerQueueNode;
/// Representation of a clonable client object.
///
/// Each instantiation of a `Client` object is itself an isolated client with
/// regards to the server context. By ... |
extern crate serial;
use std::slice;
use std::mem;
const VN_SYNC: u8 = 0xFA;
const VN_OUTPUT_GROUP: u8 = 0x39;
const VN_HEADER_SIZE: u8 = 10;
const VN_PAYLOAD_SIZE: u8 = 144;
const VN_CRC_SIZE: u8 = 2;
const VN_GROUP_FIELD_1: u16 = 0x01E9;
const VN_GROUP_FIELD_2: u16 = 0x061A;
const VN_GROUP_FIELD_3: u16 = 0x0140;
co... |
pub struct Point {
pub coord: Vec<f64>,
pub line: i32,
}
pub type Group = Vec<Point>;
// Implementa a função de display para um Point.
impl std::fmt::Display for Point {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", self.line)
}
}
// Retorna uma string que ... |
use ruscii::app::{App, State};
use ruscii::terminal::{Window};
use ruscii::drawing::{Pencil};
use ruscii::keyboard::{KeyEvent, Key};
use ruscii::spatial::{Vec2};
fn main() {
let mut key_events = Vec::new();
let mut app = App::new();
app.run(|app_state: &mut State, window: &mut Window| {
for key_ev... |
use std::{
cmp::min,
future::Future,
io::{self, ErrorKind},
pin::Pin,
sync::{Arc, Mutex, RwLock},
task::{Context, Poll, Waker},
};
use aead::{generic_array::GenericArray, AeadInPlace, NewAead};
use byteorder::{ByteOrder, LittleEndian};
use bytes::{Buf, BytesMut};
use chacha20poly1305::{ChaCha20... |
use std::time::{Duration, Instant};
use anyhow::{Context, Result};
use aws_sdk_route53::types::ChangeInfo;
use structopt::StructOpt;
#[derive(StructOpt, Debug)]
pub struct WaitForChangeParams {
/// Change ID
#[structopt(name = "change-id", long)]
pub change_id: String,
/// Do not wait for completion
... |
#![feature(negative_impls)]
pub mod collections;
pub mod expert;
pub mod singlethread;
|
use crate::chess_structs::{Board, Color};
use crate::evaluator;
use std::cmp;
const INITIAL_DEPTH: i32 = 5;
static mut NODES_VISITED: i64 = 0;
struct Evaluation<'a> {
board: &'a Board,
eval: i32
}
impl<'a> Evaluation<'a> {
fn is_bested_by(&self, other: &Evaluation, who_played: Color) -> bool {
m... |
use point::Point;
use vector::Vector3;
use rendering::{Intersectable, Ray};
use std::ops::Mul;
extern crate rayon;
use rayon::prelude::*;
#[derive(Deserialize, Debug, Clone)]
pub struct Color {
pub red: f32,
pub green: f32,
pub blue: f32,
}
impl Color {
pub fn clamp(&self) -> Color {
Color {
... |
// Copyright 2020 WHTCORPS INC. Licensed under Apache-2.0.
use engine_lmdb::raw::DBStatisticsTickerType;
use edb::{MiscExt, Causet_DAGGER};
use test_violetabftstore::*;
use violetabftstore::interlock::::config::*;
fn flush<T: Simulator>(cluster: &mut Cluster<T>) {
for engines in cluster.engines.values() {
... |
use std::net::Ipv4Addr;
/// Store all of the pertinent ids for an IPv4 address range.
pub struct Ipv4All {
lower_bound: Ipv4Addr,
upper_bound: Ipv4Addr,
region_id: u32,
as_number: u32,
country_id: u32,
continent_id: u32,
}
impl Ipv4All {
/// Construct a new Ipv4All instance.
///
/... |
use super::*;
use crate::mock::{new_test_ext, Event as TestEvent, Kitties, Origin, System, Test};
use crate::Error;
use frame_support::dispatch::DispatchResult;
use frame_support::{assert_noop, assert_ok};
/// Assert the given `event` exists.
///
/// Used as `assert_event!(Event::KittyCreated(1, 1))`,
macro_rules! ass... |
use crate::{
handle::Handle,
handlegraph::IntoSequences,
packed::*,
packedgraph::{index::OneBasedIndex, paths::StepPtr, PackedGraph},
pathhandlegraph::{
GraphPaths, GraphPathsSteps, IntoNodeOccurrences, IntoPathIds, PathId,
},
};
use crate::packedgraph::graph::NARROW_PAGE_WIDTH;
use fn... |
use std::time::SystemTime;
use util::HttpDate;
/// `If-Unmodified-Since` header, defined in
/// [RFC7232](http://tools.ietf.org/html/rfc7232#section-3.4)
///
/// The `If-Unmodified-Since` header field makes the request method
/// conditional on the selected representation's last modification date
/// being earlier tha... |
use cc::Build;
use std::env;
fn main() {
let mut config = Build::new();
config
.include("ext/")
.file("ext/aesb.c")
.file("ext/c_blake256.c")
.file("ext/c_groestl.c")
.file("ext/c_jh.c")
.file("ext/c_keccak.c")
.file("ext/c_skein.c")
.file("ext/cr... |
use fnv::{FnvHashMap, FnvHashSet};
use rayon::prelude::*;
use crate::{
handle::{Direction, Edge, Handle, NodeId},
handlegraph::IntoNeighbors,
mutablehandlegraph::*,
packed::traits::*,
pathhandlegraph::PathId,
};
pub(super) use super::{
edges::EdgeLists,
index::{NodeRecordId, OneBasedIndex... |
use ::arrayfire::*;
#[allow(unused_variables)]
#[test]
fn check_reorder_api() {
let dims = Dim4::new(&[4, 5, 2, 3]);
let a = randu::<f32>(dims);
let transposed = reorder_v2(&a, 1, 0, None);
let swap_0_2 = reorder_v2(&a, 2, 1, Some(vec![0]));
let swap_1_2 = reorder_v2(&a, 0, 2, Some(vec![1]));
... |
use criterion::BenchmarkId;
use criterion::Criterion;
use criterion::{criterion_group, criterion_main};
use sqlx::sqlite::{Sqlite, SqliteConnection};
use sqlx::{Connection, Executor};
use sqlx_test::new;
// Here we have an async function to benchmark
async fn do_describe_trivial(db: &std::cell::RefCell<SqliteConnecti... |
use std::fs;
use anyhow::{ Result };
use printnanny::cpuinfo::{ CpuInfo };
#[test]
fn test_rpi_cpuinfo() -> Result<()> {
let data = fs::read_to_string("tests/fixtures/rpi_cpuinfo.txt")?;
let cpuinfo = CpuInfo::from_string(&data);
println!("Parsed cpuinfo {:#?}", cpuinfo);
assert!(cpuinfo.processors.... |
use crate::{r#type::Type, Export, PrimType, TemplateMeta, Var};
use proc_macro2::TokenStream;
use quote::quote;
use serde_json::{json, Value};
pub fn meta(meta: &TemplateMeta) -> Value {
let api = api(meta);
let schema = schema(meta);
json!({"api": api, "schema": schema})
}
pub fn to_tokens(json: &Value... |
use super::value::RcValue;
#[derive(Clone, Debug)]
pub enum Instruction {
// PushInt(i64),
// PushString(String),
// PushBool(bool),
// PushExtern(RcValue),
// PushRelative(usize),
PushConst(usize),
PushIndex(usize),
Pop,
AddI,
SubI,
MulI,
LtI,
LeI,
Eq,
// As... |
#[macro_use]
extern crate lazy_static;
pub mod shogi;
pub mod csa;
pub mod usi;
pub mod engine;
|
VISUAL_A1515015037_210199.tampilan$1
VISUAL_A1515015037_210199.tampilan
|
// Copyright 2020 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 std::path::{Path, PathBuf};
use crate::domain::{Bundle, BundlePath};
pub trait Resource {
fn bundle_to(self, bundle: &mut Bundle);
}
impl Resource for &Path {
fn bundle_to(self, bundle: &mut Bundle) {
bundle.add_file_from(BundlePath::projection(&self), self);
}
}
impl Resource for PathBuf {
... |
extern crate image;
use image::{GenericImageView, RgbImage};
use crate::filters::grayscale;
pub struct GrHistogram {
img: RgbImage,
result: Vec::<i32>
}
impl GrHistogram {
pub fn new(img: RgbImage) -> GrHistogram {
let mut v = Vec::new();
for i in 0..254 {
v.push(0);
... |
//! Send a mouse movement or click event to the system.
pub use platform::{move_mouse, press_mouse, release_mouse, move_click};
#[derive(Copy, Clone, PartialEq, Eq)]
pub enum Button {
Left,
Right,
Middle,
}
#[cfg(target_os = "macos")]
mod platform {
}
#[cfg(target_os = "windows")]
mod platform {
extern crate w... |
#![feature(async_closure)]
#![feature(atomic_from_mut)]
#[macro_use]
extern crate diesel;
#[macro_use]
extern crate log;
#[macro_use]
extern crate anyhow;
#[macro_use]
extern crate lazy_static;
use crate::bot::Poppy;
use crate::database::DatabaseManager;
use crate::exchanges::mandala::Mandala;
use crate::utils::conf... |
//! Shared datatypes for azul-* crates
extern crate azul_css;
extern crate gleam;
#[cfg(feature = "css_parser")]
extern crate azul_css_parser;
/// Useful macros for implementing Azul APIs without duplicating code
#[macro_use]
pub mod macros;
/// Functions to manage adding fonts + images, garbage collection
pub mod ap... |
use crate::{
mesh_data::MeshData,
texture::{ImmutableTexture, Texture, TargetTexture},
transform::Transform,
};
use std::{ops::Range, sync::Arc};
use vulkano::{
descriptor::{descriptor_set::PersistentDescriptorSet, DescriptorSet, PipelineLayoutAbstract},
image::ImageViewAccess,
sampler::Sampler,
VulkanObject,
};... |
use chrono::{DateTime, TimeZone, Utc};
use serde::{self, Deserialize, Deserializer, Serializer};
pub fn serialize<S>(date: &DateTime<Utc>, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
serializer.serialize_i64(date.timestamp())
}
pub fn deserialize<'de, D>(deserializer: D) -> Result<DateTim... |
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use std::sync::Arc;
use crossbeam_queue::ArrayQueue;
use protocol::traits::MixedTxHashes;
use protocol::types::{Hash, SignedTransaction};
use protocol::ProtocolResult;
use crate::map::Map;
use crate::MemPoolError;
/// Wrap `SignedTransaction` with two mark... |
#[test]
fn test_create_dir() {
assert_wasi_output!(
"../../wasitests/create_dir.wasm",
"create_dir",
vec![".".to_string(),],
vec![],
vec![],
"../../wasitests/create_dir.out"
);
}
|
//Anything related to getting apps and it's properties goes here.
use super::{App, AppFeature, AppSetup, AppWebhook, AppWebhookDelivery, WebhookEvent, SNI, SSL};
use crate::framework::endpoint::{HerokuEndpoint, Method};
/// App Info
///
/// Get info for existing app.
///
/// [See Heroku documentation for more informa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.