text stringlengths 8 4.13M |
|---|
use criterion::{criterion_group, criterion_main, Criterion};
//use printer_geo::{geo::*, stl::*};
//use rayon::prelude::*;
// TODO: update benchmarks
pub fn criterion_benchmark(_c: &mut Criterion) {
/*
let stl = load_stl("3DBenchy.stl");
let triangles = to_triangles3d(&stl);
let tri_vk = to_tri_vk(&tri... |
use std::io::{self, Write, BufRead, BufReader};
use std::net::{TcpListener, TcpStream, ToSocketAddrs};
use std::sync::Arc;
use std::thread;
#[allow(unused_imports)]
use super::{Tracker, Request, Response};
pub struct ThreadedListener {
listener: TcpListener,
tracker: Arc<Tracker>,
}
impl ThreadedListener {
... |
use azure_core::prelude::*;
use azure_storage::blob::prelude::*;
use azure_storage::core::prelude::*;
use futures::stream::StreamExt;
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
// First we retrieve the account name and master key from environment variables.
... |
use glium::Display;
use glium::texture::{PixelValue, RawImage2d, SrgbTexture2d, ToClientFormat};
use image;
use index_pool::IndexPool;
use std::borrow::Cow;
use std::collections::HashMap;
use std::path::PathBuf;
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct TextureId(usize);
#[derive... |
use cgmath::{Point3, Vector3, Matrix4, SquareMatrix, Transform, Matrix};
use rayon::prelude::*;
use crate::chr0::Chr0;
use crate::fighter::Fighter;
use crate::mdl0::bones::Bone;
use crate::sakurai::{SectionScript, ExternalSubroutine};
use crate::sakurai::fighter_data::misc_section::{HurtBox, BoneRefs};
use crate::saku... |
extern crate rustty;
use rustty::{
Terminal,
Event,
};
use rustty::ui::core::{
Painter,
Widget,
ButtonResult,
HorizontalAlign,
VerticalAlign
};
use rustty::ui::{
StdButton,
Dialog,
Label,
};
fn create_maindlg() -> Dialog {
let mut maindlg = Dialog::new(60, 10);
maindl... |
use crate::config::cache::delete_version;
use crate::lib::environment::Environment;
use crate::lib::error::DfxResult;
use clap::Clap;
/// Deletes a specific versioned cache of dfx.
#[derive(Clap)]
#[clap(name("delete"))]
pub struct CacheDeleteOpts {
#[clap(long)]
version: Option<String>,
}
pub fn exec(env: &... |
mod command_manager;
use command_manager::CommandManager;
mod commands;
use serenity::prelude::*;
use std::env;
#[tokio::main]
async fn main() {
let token = env::var("DISCORD_TOKEN").expect("Environment Variable for DISCORD_TOKEN NOT Set");
let mut command_manager = CommandManager::new();
// regis... |
//! Seat global utilities
//!
//! This module provides you with utilities for handling the seat globals
//! and the associated input Wayland objects.
//!
//! ## How to use it
//!
//! ### Initialization
//!
//! ```
//! # extern crate wayland_server;
//! # #[macro_use] extern crate smithay;
//! use smithay::wayland::seat... |
#[doc = "Register `BOOT_CURR` reader"]
pub type R = crate::R<BOOT_CURR_SPEC>;
#[doc = "Field `BOOT_ADD0` reader - Boot address 0"]
pub type BOOT_ADD0_R = crate::FieldReader<u16>;
#[doc = "Field `BOOT_ADD1` reader - Boot address 1"]
pub type BOOT_ADD1_R = crate::FieldReader<u16>;
impl R {
#[doc = "Bits 0:15 - Boot a... |
use std::path::PathBuf;
use std::fs;
use clap::{App, Arg};
use archiver::config;
use archiver::ctx::Ctx;
use archiver::mountable;
use archiver::cli;
fn cli_opts<'a, 'b>() -> App<'a, 'b> {
cli::base_opts()
.about("Smoke test the mounting infrastructure")
.arg(Arg::with_name("LABEL")
.... |
//! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_185"
#[allow(unused)]
use super::rsass;
// From "sass-spec/spec/libsass-closed-issues/issue_185/hoisting.hrx"
#[test]
#[ignore] // wrong result
fn hoisting() {
assert_eq!(
rsass(
"@media only screen {\
\n .fo... |
use vecmath::*;
pub fn encoder_sub(a: i16, b: i16) -> i16 {
const RANGE : i16 = 4096;
let c = a.wrapping_sub(b) % RANGE;
if c < -RANGE/2 {
c + RANGE
} else if c > RANGE/2 {
c - RANGE
} else {
c
}
}
pub fn vec2_encoder_sub(a: Vector2<i16>, b: Vector2<i16>) -> Vector2<i16... |
extern crate clang;
extern crate clang_sys;
extern crate futures;
#[macro_use]
extern crate log;
extern crate log4rs;
extern crate lsp_rs;
extern crate ls_service;
extern crate tokio_core;
extern crate tokio_stdio;
#[cfg( windows )]
extern crate kernel32;
#[cfg( windows )]
extern crate winapi;
mod parent_process;
mod... |
use surf::http::Method;
use crate::framework::endpoint::Endpoint;
use super::Tunnel;
/// Delete a tunnel
/// https://api.cloudflare.com/#argo-tunnel-delete-argo-tunnel
#[derive(Debug)]
pub struct DeleteTunnel<'a> {
pub account_identifier: &'a str,
pub tunnel_id: &'a str,
}
impl<'a> Endpoint<Tunnel> for Dele... |
use std::collections::HashMap;
pub fn brackets_are_balanced(string: &str) -> bool {
let mut stack = vec![];
let brackets: HashMap<char, char> = [('(', ')'), ('{', '}'), ('[', ']')]
.iter()
.cloned()
.collect();
for c in string.chars() {
if !brackets.contains_key(&c) && !bra... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - FLASH access control register"]
pub acr: ACR,
#[doc = "0x04 - FLASH non-secure key register"]
pub nskeyr: NSKEYR,
#[doc = "0x08 - FLASH secure key register"]
pub seckeyr: SECKEYR,
#[doc = "0x0c - FLASH option ke... |
use log::info;
fn main() {
env_logger::init();
info!("start");
println!("Hello, world!");
info!("finish");
}
|
#[macro_use]
extern crate nom;
use std::str;
use nom::{digit, space};
use std::fs::File;
use std::io::Read;
use std::collections::HashSet;
named!(
program<i32>,
map_res!(map_res!(digit, str::from_utf8), str::parse)
);
named!(
peers<HashSet<i32>>,
map!(
separated_nonempty_list_complete!(tag!(",... |
use proc_macro2::{Span, TokenStream};
use quote::quote;
use std::borrow::Cow;
use syn::visit;
use syn::{Fields, Lifetime};
use synstructure::{BindingInfo, Structure};
pub(crate) fn derive(mut s: Structure) -> TokenStream {
let tape_lt = s
.ast()
.generics
.lifetimes()
.find(|def| de... |
use std::num::ParseIntError;
fn main() {
// test1: test_shortest
}
/// Option<T>
/// Option<T>类型属于枚举体, 包括两个可边的变体 Some(T None 作为可选值,
/// Option<T>可以被使用在多种场景中。比如可边的结构体、可选的函数参数 可选的结构体
/// 字段、可空的指针、占位(如在 HashMap 中解决 remove 问题)等。
fn get_shortest(name: Vec<&str>) -> Option<&str> {
if name.len() > 0{
let mu... |
// Copyright 2018 Fredrik Portström <https://portstrom.com>
// This is free software distributed under the terms specified in
// the file LICENSE at the top-level directory of this distribution.
pub fn parse_examples<'a>(
context: &mut ::Context<'a>,
template_node: &::Node,
parameters: &[::Parameter],
... |
use serenity::model::gateway::Ready;
use serenity::model::id::ChannelId;
use serenity::prelude::*;
use std::thread;
use player::PlayerManager;
use server::Server;
use voice::Receiver;
use voice::VoiceManager;
pub struct Handler;
impl EventHandler for Handler {
fn ready(&self, ctx: Context, ready: Ready) {
... |
#[doc = "Reader of register ELSR0"]
pub type R = crate::R<u32, super::ELSR0>;
#[doc = "Reader of field `ELSR0`"]
pub type ELSR0_R = crate::R<u32, u32>;
impl R {
#[doc = "Bits 0:31 - end of interrupt status"]
#[inline(always)]
pub fn elsr0(&self) -> ELSR0_R {
ELSR0_R::new((self.bits & 0xffff_ffff) as... |
/// ##arp.rs
/// Functions for parsing and generating ARP protocol messages
///
use crate::util::{ipv4_to_str, mac_to_str};
use log::{error};
use num_derive::{FromPrimitive, ToPrimitive};
use num_traits::{FromPrimitive, ToPrimitive};
// ref: http://www.networksorcery.com/enp/protocol/arp.htm
#[derive(Copy, Clone, Par... |
extern crate mongodb;
use bson::{bson, doc};
use mongodb::{options::ClientOptions, Client};
use std::{
fs::File,
io::{stdin, stdout, BufReader, Write},
};
#[tokio::main]
pub async fn scraping(url: &str, dist: &str) -> Result<reqwest::StatusCode, Box<dyn std::error::Error>> {
let response = reqwest::get(url... |
#[doc = "Reader of register FM_CTL"]
pub type R = crate::R<u32, super::FM_CTL>;
#[doc = "Writer for register FM_CTL"]
pub type W = crate::W<u32, super::FM_CTL>;
#[doc = "Register FM_CTL `reset()`'s with value 0"]
impl crate::ResetValue for super::FM_CTL {
type Type = u32;
#[inline(always)]
fn reset_value() ... |
pub mod accounting;
pub mod accounting_grpc;
|
#![allow(proc_macro_derive_resolution_fallback)]
use diesel;
use diesel::prelude::*;
use schema::urls;
use urls::entity::Url;
pub fn all(connection: &PgConnection) -> QueryResult<Vec<Url>> {
urls::table.load::<Url>(&*connection)
}
pub fn get(id: i32, connection: &PgConnection) -> QueryResult<Url> {
urls::tab... |
use std::collections::HashMap;
use std::collections::HashSet;
use std::iter::FromIterator;
use super::file_loader;
pub fn run(part: i32) {
let input = file_loader::load_file("3.input");
//println!("File content: {:?}\n", input);
let result = with_input(&input, part as u32);
println!("Answer = {}", re... |
/*
* Copyright 2017-2018 Ben Ashford
*
* 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>, at your
* option. This file may not be copied, modified, or distributed
* except accor... |
use std::fs::File;
use std::io::Read;
use std::path::Path;
use std::str::FromStr;
use libosu::{
beatmap::Beatmap,
data::Mode,
events::{BackgroundEvent, BreakEvent, Event},
hitsounds::SampleSet,
math::Point,
timing::Millis,
};
fn load_beatmap(path: impl AsRef<Path>) -> Beatmap {
let mut fil... |
use crate::components;
use crate::indices::EntityTime;
use serde::Serialize;
/// TableIds may be used as indices of tables
pub trait TableId:
'static + Ord + PartialOrd + Eq + PartialEq + Copy + Default + Send + std::fmt::Debug + Serialize
{
}
impl<T> TableId for T where
T: 'static
+ Ord
+ Par... |
use core::fmt::Display;
use std::fmt;
#[allow(unused_must_use)]
#[derive(Debug, PartialEq)]
pub enum Error {
NotEnoughPinsLeft,
GameComplete,
}
#[derive(Debug, PartialEq, Clone)]
pub struct Frame {
roll_0: u16,
roll_1: u16,
strike: bool,
in_progress: bool,
is_frame_complete: bool,
sco... |
use serenity::prelude::*;
use serenity::model::gateway::Ready;
use serenity::model::id::ChannelId;
pub struct Handler;
impl EventHandler for Handler
{
fn ready(&self, ctx: Context, _data_about_bot: Ready)
{
println!("Ready trigger fired!");
let channel_id: ChannelId = {
... |
use actix_web::HttpResponse;
use aes::Aes256;
// use block_cipher::{BlockCipher, NewBlockCipher};
use block_modes::block_padding::NoPadding;
use block_modes::{BlockMode, Cbc};
use byteorder::{BigEndian, ByteOrder};
// use openssl::symm::{Cipher, Crypter, Mode};
use ring::rand::SecureRandom;
use std::collections::HashM... |
use crate::bgp::BgpSessionType::{EBgp, IBgpClient, IBgpPeer};
use crate::bgp::{BgpEvent, BgpRoute};
use crate::event::{Event, EventQueue};
use crate::router::*;
use crate::{AsId, Prefix};
use crate::{IgpNetwork, NetworkDevice};
use maplit::{hashmap, hashset};
#[test]
fn test_bgp_single() {
let mut r = Router::new(... |
use super::{Read, Result, Write};
use crate::{alloc::Allocator, containers::Array};
impl Read for &[u8]
{
#[inline]
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
{
let count = buf.len().min(self.len());
let (to_copy, remaining) = self.split_at(count);
buf[..count].copy_from_s... |
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use] extern crate rocket;
mod libs;
use rocket_cors;
use rocket::http::Method;
use rocket_cors::{AllowedHeaders, AllowedOrigins, Error};
// use async_std::task::block_on;
use futures::executor::block_on;
use libs::{database_client::{DatabaseClient, DatabaseBase},... |
// use canrun::{both, pair, var, Can, Equals, Goal, State};
// extern crate env_logger;
// #[test]
// fn does_not_overflow() {
// let _ = env_logger::init();
// let x = var();
// let infinite_xs: Goal<usize> = x.equals(pair(x.can(), Can::Nil));
// // An overflow is not triggered if infinite_xs is the se... |
#![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 Creator {
#[serde(flatten)]
pub tracked_resource: TrackedResource,
pub properties: CreatorProperties,
}... |
use crate::prelude::*;
use num::Integer;
pub fn pt1(input: Vec<Disc>) -> Result<u64> {
let mut lcm = 1;
let mut start_time = 0;
for (idx, disc) in input.into_iter().enumerate() {
let current = (idx as u64 + 1 + disc.current + start_time) % disc.size;
let remainder = (disc.size - current) % ... |
/// IssueTemplate represents an issue template for a repository
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct IssueTemplate {
pub about: Option<String>,
pub content: Option<String>,
pub file_name: Option<String>,
pub labels: Option<Vec<String>>,
pub name: Option<String>,
p... |
extern crate aufindlib;
extern crate clap;
extern crate dirs;
extern crate rustyline;
use clap::{Arg, App, SubCommand};
use rustyline::Editor;
use std::path::Path;
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
const HISTORY_FILE: &'static str = ".aufind_history";
const ARG_CASE_SENSITIVE: &'static str = "... |
use serde::ser::Serialize;
use serde::de::DeserializeOwned;
use serde_json::value::Value;
use serde_json;
use super::types::{PunterId, SiteId};
use super::map::{River, Map};
use std::collections::BTreeMap;
#[derive(PartialEq, Debug)]
pub enum Req {
Handshake { name: String, },
Ready { punter: PunterId, future... |
//! This example demonstrates how to roll your own event loop,
//! if for some reason you want to do that instead of using the `EventHandler`
//! trait to do that for you.
//!
//! This is exactly how `ggez::event::run()` works, it really is not
//! doing anything magical. But, if you want a bit more power over
//! the... |
/// Tarit for converting generated i32 to target test type.
pub trait FromI32
{
fn from_i32( value: &i32 ) -> Self;
}
/// We use floats
impl FromI32 for f32
{
fn from_i32( value: &i32 ) -> f32
{
return value.clone() as f32;
}
}
/// We use floats
impl FromI32 for i32
{
fn from_i32( value: ... |
use std::env;
use std::collections::HashMap;
fn fibm(mem: &mut HashMap<i32, i32>, n: i32) -> i32 {
if n < 2 {
n
} else {
{
let opt = mem.get(&n);
if opt.is_some() {
return *opt.unwrap()
}
}
let res: i32 = (fibm(mem, n - 1) + fibm(mem, n - 2)) % 100000007;
mem.insert(n, res);
res
}
}
fn ma... |
use std::collections::HashMap;
use std::collections::HashSet;
fn recover_secret(triplets: Vec<[char; 3]>) -> String {
type Graph = HashMap<char, HashSet<char>>;
let mut graph = triplets
.iter()
.fold(HashMap::new(), |mut acc: Graph, trip| {
trip.iter().fold(None, |prev, &x| {
let cur = acc.e... |
use std::sync::atomic::{AtomicUsize, Ordering};
use std::mem::size_of;
use std::fmt;
use super::Counter;
const PADDING_LEN: usize = 64 - 2 * size_of::<AtomicUsize>();
pub struct AtomicCounter {
counter: AtomicUsize,
last: AtomicUsize,
/// To prevent false sharing
_padding: [u8; PADDING_LEN],
}
cons... |
use std;
use std::fmt;
use std::cell::RefCell;
use std::rc::Rc;
use hashbrown::HashMap;
use crate::ast::*;
use crate::object;
use crate::object::{Object, Environment, Function, Builtin, Array, MonkeyHash};
use crate::token::Token;
use crate::parser;
pub type EvalResult = Result<Rc<Object>, EvalError>;
#[derive(Debug)... |
#[doc = "Register `SYSCFG_ITLINE9` reader"]
pub type R = crate::R<SYSCFG_ITLINE9_SPEC>;
#[doc = "Field `DMA1_CH1` reader - DMA1 channel 1interrupt request pending"]
pub type DMA1_CH1_R = crate::BitReader;
impl R {
#[doc = "Bit 0 - DMA1 channel 1interrupt request pending"]
#[inline(always)]
pub fn dma1_ch1(&... |
//! Partial unmarshall and traversal. (requires `partial` feature)
//!
//!
//! ## Appliactions
//! Parital reading **is** for:
//! - Reading large tycho encoded files.
//!
//! Parital reading **is not** for:
//! - Reading from streams/sockets.
//!
//! Tycho Parital reading is designed for reading from large files where... |
use crate::{
grammar::{name_ref, patterns, separated_list, types, ParseError},
parser::{CompletedMarker, Parser},
syntax::{SyntaxKind::*, TokenSet},
};
pub const EXPR_FIRST: TokenSet = token_set![IF_KW, L_BRACKET, L_ANGLE, MATCH_KW, L_PAREN, IDENT];
pub fn expression(p: &mut Parser) -> Option<CompletedMar... |
use euclid::Point2D;
use euclid::Vector2D;
pub mod debug;
pub mod nurbs;
#[derive(Clone, Copy, Debug)]
pub struct ModelSpace;
#[derive(Clone, Copy, Debug)]
pub struct CanvasSpace;
#[derive(Clone, Copy, Debug)]
pub struct ScreenSpace;
#[derive(Clone, Copy, Debug)]
pub struct PixelSpace;
#[derive(Clone, Debug)]
pub... |
mod handlers;
use std::{
collections::{HashSet, HashMap},
};
use threadpool::ThreadPool;
use crossbeam_channel::{Sender, Receiver};
use languageserver_types::Url;
use libanalysis::{World, WorldState, FileId};
use serde_json::to_value;
use {
req, dispatch,
Task, Result, PathMap,
io::{Io, RawMsg, RawRe... |
use crate::{
backend::SchemaBuilder, foreign_key::*, index::*, prepare::*, types::*, ColumnDef,
SchemaStatementBuilder,
};
/// Create a table
///
/// # Examples
///
/// ```
/// use sea_query::{*, tests_cfg::*};
///
/// let table = Table::create()
/// .table(Char::Table)
/// .if_not_exists()
/// .co... |
use std::cmp;
use std::collections::{BinaryHeap, HashMap};
use std::mem;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::thread;
use std::time::{Duration, Instant};
use may_queue::mpsc::Queue;
use may_queue::mpsc_list_v1::Entry;
use may_queue::mpsc_list_v1::Queue as TimeoutQueue;
use parki... |
/*
* YNAB API Endpoints
*
* Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
*
* The ve... |
use crate::aoc_utils::read_input;
pub fn run(input_filename: &str) {
let input = read_input(input_filename);
let mapped: Vec<Vec<char>> = input.lines().map(|l| l.chars().collect()).collect();
part1(&mapped);
part2(&mapped);
}
const TREE: char = '#';
fn count_trees_on_slope(mapped: &Vec<Vec<char>>, ... |
use std::collections::HashMap;
use std::env;
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() < 2 {
println!("Provide a space-separated list of integers.");
return;
}
let mut list: Vec<i32> = args[1..]
.iter()
.map(|x| x.trim().parse().expect("I... |
pub use auth::Auth;
mod auth;
|
// This file is part of rdma-core. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/rdma-core/master/COPYRIGHT. No part of rdma-core, including this file, may be copied, modified, propagated, or distributed ... |
use std::fs;
use regex::Regex;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Bag {
color_code: String,
count: usize,
}
impl Bag {
pub fn new(color_code: String, count: usize) -> Bag {
Bag{ color_code, count }
}
pub fn parse(text: &str) -> Option<Bag> {
// Split out bag info (... |
use colored::*;
use std::env;
use std::process::Command;
use anyhow::{Context, Result};
use clap::ArgMatches;
use crate::cli::cfg::get_cfg;
use crate::cli::error::CliError;
use crate::cli::settings::get_settings;
use crate::cli::terminal::message::success;
use super::sync::{sync_workflow, SyncSettings};
pub fn env_... |
use anyhow::Context;
use rusqlite::Transaction;
pub(crate) fn migrate(transaction: &Transaction<'_>) -> anyhow::Result<()> {
// We need to check if this db needs fixing at all
let update_is_not_required = {
let mut stmt = transaction
.prepare("SELECT sql FROM sqlite_schema where tbl_name = ... |
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
pub struct BenchGroup {
pub group_name: String,
pub ids: Vec<BenchID>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct BenchID {
pub id: String,
pub entries: Vec<BenchEntry>,
}
#[derive(Debug, Serialize, Deserialize)]
p... |
#![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 Object {}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DatabaseInstanceCollection {
#[... |
use bevy::prelude::*;
mod actors;
fn main() {
App::build()
.add_plugins(DefaultPlugins)
.add_startup_system(setup.system())
.add_startup_system(actors::background::setup_background.system())
.add_startup_system(actors::player::setup_player.system())
.add_startup_system(acto... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Coprocessor access control register"]
pub cpacr: CPACR,
}
#[doc = "CPACR (rw) register accessor: Coprocessor access control register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`cpacr::R`]. You can [`rese... |
/*
* 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
*/
/// MetricSearchResponse : Object containing the list of metrics matching the search query.
#[derive(... |
use alloc::vec::Vec;
use util::Hash;
use crate::consts::STABLE;
macro_rules! init_state {
($self:expr, $block:expr, $( $i:expr ), +) => {
$(
$self.state[$i + 32] = $block[$i] ^ $self.state[$i];
)*
};
}
macro_rules! round {
($self:expr, $t:expr, $($i:expr), +) => {
$(
... |
use std::f64;
use std::collections::HashMap;
use ast::{Ast, ConstKind, FuncKind, OpKind};
use ast::AstVal::*;
use ast::FuncKind::*;
use ast::OpKind::*;
use ast::ConstKind::*;
use lexer::lex_equation;
use parser::parse_tokens;
use errors::{CalcrResult, CalcrError};
pub struct Interpreter {
vars: HashMap<String, f64... |
fn main(){
//signed int i8, i16, i32, i64, i128, for negatives to positives intervals
//unsigned switch i to u, only positive
let x128: u128 = 0xFAFBFCFD_FEF1F2F3_F4F5F6F7_F8F9FAFB;
let x64 : i64 = 123456;
//32 bit and 64 bit floating point numbers
let x = 2.0; //f64 is the default
let y : f... |
use async_trait::async_trait;
use hyper::{Body, Request, Response};
use web3::{transports, Web3};
mod hyper_helpers;
mod input_checker;
mod router;
#[async_trait]
pub trait RouterTrait {
async fn route(&self, req: Request<Body>) -> Result<Response<Body>, hyper::Error>;
}
#[derive(Clone)]
pub struct Router {
... |
#[doc = "Register `CR` reader"]
pub type R = crate::R<CR_SPEC>;
#[doc = "Register `CR` writer"]
pub type W = crate::W<CR_SPEC>;
#[doc = "Field `JCEN` reader - JPEG Core Enable"]
pub type JCEN_R = crate::BitReader;
#[doc = "Field `JCEN` writer - JPEG Core Enable"]
pub type JCEN_W<'a, REG, const O: u8> = crate::BitWriter... |
use std::cell::RefCell;
use std::fs::File;
use std::io::{BufReader, BufWriter};
use std::rc::Rc;
use crate::cartridge::{Cartridge, MirrorMode};
use crate::ppu::{self, PpuInterface};
use crate::savable::Savable;
/// First address of the ROM memory space
const ROM_START: u16 = 0x0000;
/// Last address of the ROM memory... |
extern crate portmidi;
extern crate rosc;
use types::*;
use dsp::{FilterType, Waveform};
macro_rules! feq {
($lhs:expr, $rhs:expr) => {
($lhs - $rhs).abs() < 1.0E-7
};
}
#[derive(Debug, Clone)]
pub enum ControlEvent {
Unsupported,
NoteOn {
key: u8,
velocity: Float,
},
... |
type Tree = ();
type Forest = Vec<Vec<Option<Tree>>>;
fn input_line_to_row(input: Vec<&str>) -> Vec<Option<Tree>> {
input
.iter()
.filter(|i| *i == &"." || *i == &"#")
.map(|i| match i.as_ref() {
"#" => Some(()),
_ => None,
})
.collect()
}
fn input_... |
use nu::{
serve_plugin, CallInfo, Plugin, Primitive, ReturnSuccess, ReturnValue, ShellError, Signature,
Tagged, TaggedItem, Value,
};
struct Sum {
total: Option<Tagged<Value>>,
}
impl Sum {
fn new() -> Sum {
Sum { total: None }
}
fn sum(&mut self, value: Tagged<Value>) -> Result<(), Sh... |
use crate::error::{from_protobuf_error, NiaServerError, NiaServerResult};
use crate::protocol::Serializable;
use protobuf::Message;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ActionKeyRelease {
key_code: i32,
}
impl ActionKeyRelease {
pub fn new(key_code: i32) -> ActionKeyRelease {
ActionKeyRel... |
#[macro_use]
extern crate may;
fn partition<T: PartialOrd + Send>(v: &mut [T]) -> usize {
let pivot = v.len() - 1;
let mut i = 0;
for j in 0..pivot {
if v[j] <= v[pivot] {
v.swap(i, j);
i += 1;
}
}
v.swap(i, pivot);
i
}
pub fn quick_sort<T: PartialOrd + ... |
#[cfg(debug_assertions)]
use crate::base::db::colored;
use crate::base::db::red;
#[cfg(debug_assertions)]
use diesel::query_builder::QueryBuilder;
use diesel::{connection::TransactionManager, prelude::*};
fn _connection_pool(
mut db_url: String,
) -> r2d2::Pool<r2d2_diesel::ConnectionManager<RealmConnection>> {
... |
use rand::{thread_rng, Rng};
use rand::distributions::{Alphanumeric};
pub fn encode(key: &str, s: &str) -> Option<String> {
let mut res: Option<String> = None;
let mut output: String = String::new();
let key_char: Vec<char> = key.chars().collect();
let lowercase_numeric_check = key.chars().filter(|ch|... |
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[exception]
#[entry] //~ ERROR this attribute is not allowed on an exception handler
fn SVCall() -> ! {
loop {}
}
|
struct test {
var: i8
}
fn main() {
let test = test {
var: 1
};
println!("Hello world: {}", test);
} |
pub const HBAR: f32 = 1.0;
pub const M: f32 = 1.0;
pub const DX: f32 = 0.1;
pub const DT: f32 = 0.001;
pub const WIDTH: usize = 500;
pub const HEIGHT: usize = 500;
pub const NUM_FRAMES: usize = 500;
pub const SLIT_HEIGHT: isize = -1;
pub const SLIT_1_START: isize = 100;
pub const SLIT_1_END: isize = 100;
pub const... |
use std::error;
use std::fs::File;
use std::io::{self, BufRead};
use std::path::Path;
use std::vec::Vec;
fn get_lines(filename: &str) -> Result<std::io::Lines<io::BufReader<std::fs::File>>> {
let path = Path::new(&filename);
let file = File::open(path)?;
Ok(io::BufReader::new(file).lines())
}
#[derive(Deb... |
use crate::models::{
Address, CollectionMethod, Order, Payment, PaymentStripe, PostDeliveryOption, Postage, User,
};
use juniper::ID;
#[juniper::object(description = "Contact Details of the person making the purchase")]
impl User {
/// Contact name
fn name(&self) -> &str { &self.name }
/// Contact email
fn email... |
use swf_tree as ast;
use nom::IResult;
use nom::{le_i16 as parse_le_i16, le_u8 as parse_u8, le_u16 as parse_le_u16, le_u32 as parse_le_u32};
use parsers::basic_data_types::{
parse_rect,
parse_be_f16,
parse_s_rgb8,
parse_straight_s_rgba8,
parse_i32_bits,
parse_u32_bits,
};
use parsers::shapes::parse_glyph;
u... |
$NetBSD: patch-src_bootstrap_compile.rs,v 1.12 2023/05/03 22:39:09 he Exp $
On Darwin, do not use @rpath for internal libraries.
--- src/bootstrap/compile.rs.orig 2022-12-12 16:02:12.000000000 +0000
+++ src/bootstrap/compile.rs
@@ -488,7 +488,7 @@ fn copy_sanitizers(
|| target == "x86_64-apple-ios"
... |
// SPDX-License-Identifier: MIT
extern crate clap;
use crate::{files, runner};
use clap::{
crate_authors, crate_description, crate_name, crate_version, App, AppSettings, Arg, SubCommand,
};
const SUBCMD_RUN: &str = "run";
const SUBCMD_RUN_PART: &str = "PART";
const SUBCMD_RUN_INPUT: &str = "INPUT";
const SUBCMD_W... |
/// CreatePullRequestOption options when creating a pull request
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct CreatePullRequestOption {
pub assignee: Option<String>,
pub assignees: Option<Vec<String>>,
pub base: Option<String>,
pub body: Option<String>,
pub due_date: Option<S... |
use super::{DataClass, DataIdDefinition};
use ::std::marker::PhantomData;
pub type DataIdSimpleType = (i8, i8);
pub(crate) static DATAID_DEFINITION : DataIdDefinition<DataIdSimpleType,DataIdType> =
DataIdDefinition {
data_id: 48,
class: DataClass::RemoteBoilerParameters,
read: true,
... |
use core::ops::AddAssign;
use super::vec2::*;
use super::vec3::*;
use std::ops::{Add, Div, Mul, Sub, Neg};
#[derive(Clone, Copy, Debug)]
pub struct Vec4 {
pub value: [f64; 4],
}
impl std::fmt::Display for Vec4 {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(fmt, "{},{},{},{... |
// 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.
//! An implementation of a 62-bit STARK-friendly prime field with modulus 2^62 - 111 * 2^39 + 1.
//!
//! All operations in this field are ... |
#[macro_use]
extern crate criterion;
use criterion::{AxisScale, BenchmarkId, Criterion, PlotConfiguration};
use rand::prelude::*;
use std::ops::Range;
fn kitchen_sink(kvs: &[(Range<i32>, bool)]) {
use segmap::SegmentMap;
let mut range_map: SegmentMap<i32, bool> = SegmentMap::new();
// Remove every second... |
/*!
* Sylphrena AI core program - https://github.com/ShardAi
* Version - 1.0.0.0
*
* Copyright (c) 2017 Eirik Skjeggestad Dale
*/
extern crate daemonize;
mod core;
use std::{thread, time, env};
use std::fs::File;
use daemonize::Daemonize;
use core::syl_core::Sylcore;
fn main() {
println!("---=== Sylphrena-... |
// Copyright (C) 2020 Stephane Raux. Distributed under the MIT license.
use std::{
io,
time::Duration,
};
use winapi::{
shared::ntdef::LARGE_INTEGER,
um::profileapi::{QueryPerformanceCounter, QueryPerformanceFrequency},
};
#[derive(Debug)]
pub struct Clock {
freq: u64,
last_elapsed: Duration,
... |
pub mod lexer;
pub mod token;
pub use self::token::Token;
pub use self::lexer::Lexer;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.