text stringlengths 3.09k 13.9k |
|---|
use serde::de::DeserializeOwned;
use serde::Serialize;
use std::any::Any;
extern crate serde;
// Squashable is for large size type. Small size type should be wrapped in a largger one
//
// Reason 1: I attach each squashable a order label to indicate the original order for the
// possibility of reordering. Non-arrange... |
#![cfg(feature = "alloc")]
extern crate nom;
use nom::{
branch::alt,
bytes::complete::{tag, take},
character::complete::{anychar, char, multispace0, none_of},
combinator::{map, map_opt, map_res, value, verify},
error::ParseError,
multi::{fold_many0, separated_list0},
number::complete::double,
sequence:... |
//! The virtual machine is the heart of how the language executes code.
use common::Index;
use compiler::{Constant, Op};
use diagnostic::Span;
mod call_stack;
mod exit;
mod instructions;
mod open_captures;
mod stack;
mod stack_trace;
use crate::{
classes::{Function, Keyword, Module, String},
memory::{Gc, GcA... |
use std::{collections::HashMap, env, io, io::prelude::*};
use rayon::prelude::*;
fn main() {
let args: Vec<String> = env::args().collect();
let part = args.get(1).cloned().unwrap_or(String::from("1"));
let reader = io::stdin();
let lines = reader.lock().lines();
let values = lines.map(|x| x.unwra... |
use algo::graph::undirected::{Bipartite, Cycle, DepthFirstSearch, Graph, NonRecursiveDFS, CC};
use algo::graph::util::{BreadthFirstPaths, DepthFirstPaths, Paths, SymbolGraph};
use algo::graph::IGraph;
use std::path::PathBuf;
const TINY_G: &'static str = include_str!("../res/graph/tinyG.txt");
const TINY_CG: &'static s... |
use crate::{
cfg::{self, CfgPrivate},
clear::Clear,
page,
tid::Tid,
Pack,
};
use std::prelude::v1::*;
use std::fmt;
// โโโโโโโโโโโโโโโ โโโโโโโโโโ
// โ page 1 โ โ โ
// โโโโโโโโโโโโโโโค โโโโโถโ nextโโโผโโ
// โ page 2 โ โ โโโโโโโโโโค โ
// โ โ โ โXXXXXXXXโ โ
//... |
use std::f64::consts::PI;
use std::fs::{self, File};
use std::io::{BufWriter, Write};
const DELTA: f64 = 0.2;
const NX: usize = 128;
const NY: usize = 128;
const X_MAX: f64 = DELTA * NX as f64;
const Y_MAX: f64 = DELTA * NY as f64;
const TOL: f64 = 1e-8;
fn calc_vb1(j: usize) -> f64 {
(PI * DELTA * j as f64 / Y_M... |
use crate::pong::Intervals;
use crate::{
audio::{play_bounce, Sounds},
Ball, Paddle, Side,
};
use crate::{ARENA_HEIGHT, ARENA_WIDTH, BALL_RADIUS, PADDLE_HEIGHT, PADDLE_WIDTH};
use amethyst::{
assets::AssetStorage,
audio::{output::Output, Source},
core::transform::Transform,
derive::SystemDesc,
... |
use actix_web::client::{Client, ClientResponse, SendRequestError};
use actix_web::{
dev::{Decompress, Payload, PayloadStream, RequestHead},
middleware, web, App, Error, HttpRequest, HttpResponse, HttpServer,
};
use serde_derive::Deserialize;
use serde_json::from_str;
use std::fs;
use url::Url;
use std::net::Tc... |
use std::borrow::{Borrow, BorrowMut};
use std::fmt::Debug;
use std::ops::Range;
use gfx_hal::{Backend, Device};
use gfx_hal::buffer::{CreationError as BufferCreationError, Usage as BufferUsage};
use gfx_hal::format::Format;
use gfx_hal::image::{CreationError as ImageCreationError, Kind, Level, Usage as ImageUsage,
... |
extern crate decklink_sdk;
use decklink_sdk::api_version;
use decklink_sdk::connectors::DecklinkVideoConnection;
use decklink_sdk::device::output::DecklinkVideoOutputFlags;
use decklink_sdk::device::DecklinkDisplayModeSupport;
use decklink_sdk::device::{get_devices, DecklinkDevice, DecklinkDeviceDisplayModes};
use dec... |
use std::hash::BuildHasherDefault;
use debris_common::{Ident, Span};
use indexmap::IndexMap;
use rustc_hash::{FxHashMap, FxHasher};
use crate::{
memory::MemoryCounter,
mir::{ContextId, MirValue, NamespaceArena, NamespaceIndex},
};
/// A value in the mir namespace
#[derive(Debug, Eq, PartialEq, Clone)]
pub en... |
#![deny(clippy::pedantic)]
#![deny(rust_2018_idioms)]
#![allow(clippy::missing_errors_doc)]
#![allow(clippy::module_name_repetitions)]
#![allow(clippy::doc_markdown)] // `sql_function` fails this check
macro_rules! derive_diesel_json {
($typ:ident$(<$lt:lifetime>)?) => {
impl<$($lt, )?B: diesel::backend::B... |
//! ## AuthActivity
//!
//! `auth_activity` is the module which implements the authentication activity
/**
* MIT License
*
* termscp - Copyright (c) 2021 <NAME>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"),... |
use age::secrecy::ExposeSecret;
use flate2::read::GzDecoder;
use flate2::write::GzEncoder;
use flate2::Compression;
use std::fs;
use std::fs::File;
// use std::io::BufReader;
// use std::io::{Error, ErrorKind};
use std::fs::OpenOptions;
use std::io::{Read, Write};
use std::iter;
use std::path::Path;
use tar::Archive;
u... |
pub mod debug_eval;
pub mod call;
// pub mod partial_eval;
// pub mod partial_call;
use std::process::exit;
use sexpr_ir::gast::Handle;
use sexpr_ir::syntax::sexpr::file_parse;
use crate::sexpr_to_ast::FromSexpr;
use crate::value::Value;
use crate::value::callable::{Callable, Closure};
use crate::value::result::CEr... |
// LNP Node: node running lightning network protocol and generalized lightning
// channels.
// Written in 2020 by
// Dr. <NAME> <<EMAIL>>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This ... |
use opus;
use scripting_engine::{LUA_CHANNL_OUT, LuaEvent};
use std::{thread, time};
use audio::AudioEvent;
use std::sync::{Mutex};
use nalgebra::{Point3, UnitQuaternion};
use std::sync::mpsc::{channel, Sender, Receiver};
use bincode::{deserialize, serialize};
lazy_static! {
pub static ref CONNECTON_ID: Mutex<u32>... |
// https://tools.ietf.org/html/rfc7539
// Chacha20 has 3 variants, TLS 1.2 uses Chacha20-ieft
use byteorder::{ByteOrder, LittleEndian};
pub struct ChaCha20 {
vals: [u32; 16],
}
impl ChaCha20 {
pub fn new(key: &[u8], nonce: &[u8]) -> ChaCha20 {
assert_eq!(key.len(), 32);
assert_eq!(nonce.len()... |
use std::sync::Arc;
use futures::prelude::*;
use futures::stream::Forward;
use futures::sync::mpsc::*;
use crate::network::address::net_address::NetAddress;
use crate::network::connection::close_type::CloseType;
use crate::network::message::Message;
use crate::network::peer_channel::PeerSink;
use crate::network::peer... |
#[cfg(feature = "tls")]
use std::{
fs,
path::{Path, PathBuf},
};
use reqwest::{self, Client, ClientBuilder, Response, StatusCode};
use thiserror::Error;
#[cfg(feature = "tls")]
use reqwest::Certificate;
use crate::api::ApiClient;
use xaynet_core::{
common::RoundParameters,
crypto::ByteObject,
mas... |
use std::convert::TryFrom;
use std::path::{Path, PathBuf};
use tracing_appender::rolling::{RollingFileAppender, Rotation};
use cargo_msrv::config::{self, Config, ModeIntent, TracingOptions, TracingTargetOption};
use cargo_msrv::errors::{CargoMSRVError, TResult};
use cargo_msrv::exit_code::ExitCode;
use cargo_msrv::re... |
use std::fs::File;
use std::io::Write;
use std::time::{Duration, Instant};
use anyhow::Result;
use clap::ArgMatches;
use colored::Colorize;
use log::{debug, info};
use rustfst::prelude::*;
fn duration_to_seconds(duration: &Duration) -> f64 {
duration.as_secs() as f64 + duration.subsec_nanos() as f64 * 1.0e-9
}
... |
use std::path::PathBuf;
use std::sync::Arc;
use std::time::Instant;
use pegasus::api::{Count, Iteration, Map, Sink};
use pegasus::{Configuration, JobConf, ServerConf};
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(name = "khop", about = "Search khop neighbors on parallel dataflow")]
struct Config ... |
//! Provides implementations for converting to and from Zend binary strings,
//! commonly returned from functions such as [`pack`] and [`unpack`].
//!
//! [`pack`]: https://www.php.net/manual/en/function.pack.php
//! [`unpack`]: https://www.php.net/manual/en/function.unpack.php
use crate::ffi::{ext_php_rs_zend_string_... |
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use anyhow::Result;
use async_trait::async_trait;
use serde_json::json;
use sqlx::pool::PoolConnection;
use sqlx::postgres::Postgres;
use svc_agent::error::Error as AgentError;
use svc_agent::{
mqtt::{Address, IntoPublishableMessage},
AgentId,
};
use ... |
use rand::{OsRng, Rng};
use std::mem::transmute;
use std::u64;
use std::string::String;
use crypto::hmac::Hmac;
use crypto::sha1::Sha1;
use crypto::mac::Mac;
use time::Timespec;
use data_encoding::base32;
use data_encoding::base64;
use data_encoding::decode::Error;
#[derive(Debug, Clone)]
pub struct AuthKey {
pub... |
// Copyright 2022. 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
// di... |
use crate::file::{FdFlags, FileCaps, FileType, Filestat, OFlags, WasiFile};
use crate::{Error, ErrorExt, SystemTimeSpec};
use bitflags::bitflags;
use std::any::Any;
use std::cell::Ref;
use std::ops::Deref;
use std::path::PathBuf;
#[wiggle::async_trait]
pub trait WasiDir: Send + Sync {
fn as_any(&self) -> &dyn Any;... |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
use crate::tasks::{
config::{CommonConfig, SyncedDir},
heartbeat::*,
utils,
};
use anyhow::{Error, Result};
use futures::stream::StreamExt;
use onefuzz::{expand::Expand, fs::set_executable, input_tester::Tester, sha256};
use serde::... |
//! Serializable messages representing DHT sensor data.
use std::collections::{HashMap, HashSet};
use std::io::{Error, ErrorKind};
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use super::Result;
/// Serde JSON from the DHT sensor over serial.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub ... |
use std::collections::HashMap;
use std::vec::Vec;
use std::ptr::null_mut;
use std::option::Option::{Some, None};
use std::hash::{Hash, Hasher, SipHasher};
use std::fmt::Debug;
pub trait CacheValue : Clone + Debug {
type KeyType : Hash;
fn is_pinned(&self) -> bool;
}
type NodePtr<ValueType> = *... |
use anyhow::{Context as AContext, Result};
use schema::KeyValuePair;
use time::{Format, OffsetDateTime};
use crate::schema;
use crate::interface::{Event, EventKind};
use cassandra_cpp::Session;
use futures::stream::StreamExt;
use log::info;
use prost::Message;
use rdkafka::{
config::ClientConfig,
consumer::{str... |
// The basic structure of this was started from
// https://github.com/RustAudio/ogg/blob/master/examples/dump-all.rs
extern crate opus_decode;
use byteorder::{LittleEndian, ReadBytesExt};
use ogg::PacketReader;
use std::env;
use std::fs::File;
use std::io::Cursor;
#[cfg_attr(tarpaulin, skip)]
fn main() {
let fi... |
//! Contains utility methods of various puzzle solving methods.
//!
//! Includes A* search and iterative deepening A* (IDA*).
use crate::cube::*;
use crate::pruning::PruningTables;
use std::collections::HashMap;
use std::collections::HashSet;
use priority_queue::PriorityQueue;
/**
* A generic solver trait.
*/
pub ... |
// The MIT License (MIT)
//
// Copyright (c) 2016 <NAME>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, mo... |
//! Reviews module.
use std::collections::HashMap;
use github_scbot_conf::Config;
use github_scbot_database::models::{
HistoryWebhookModel, IDatabaseAdapter, PullRequestModel, RepositoryModel, ReviewModel,
};
use github_scbot_ghapi::{adapter::IAPIAdapter, reviews::ReviewApi};
use github_scbot_redis::{IRedisAdapte... |
//! Tests the serialization of the various datatypes, i.e. the files read.rs
//! and write.rs
use read::*;
use write::*;
use std::io::Cursor;
use std::i32;
/// Given a value, the same correctly encoded, and a reader and write function
/// for that type of value, test that the reader and writer create values that
/// ... |
use std::fmt;
use std::ops::Range;
use yansi::Color::{Blue, Green, Red};
use crate::stats::Stats;
#[derive(Debug)]
struct Bucket {
range: Range<f64>,
count: usize,
}
impl Bucket {
fn new(range: Range<f64>) -> Bucket {
Bucket { range, count: 0 }
}
fn inc(&mut self) {
self.count +... |
use gband::JoypadState;
use gloo::timers::callback::Interval;
use yew::prelude::*;
pub enum EmulatorMessage {
Tick,
KeyUp(web_sys::KeyboardEvent),
KeyDown(web_sys::KeyboardEvent),
}
#[derive(PartialEq, Properties)]
pub struct EmulatorProps {
pub rom: Vec<u8>,
}
pub struct Emulator {
emu: gband::E... |
//! WelcomeScreen View.
//!
//! It is opened when the IDE launches without any project or entry point selected. It
//! displays a list of available projects, template cards and "new project" button.
// === Standard Linter Configuration ===
#![deny(non_ascii_idents)]
#![warn(unsafe_code)]
// === Non-Standard Linter Con... |
use std::{
env,
time::{Duration, Instant},
};
use anyhow::{Context, Result};
use futures::{
channel::mpsc::UnboundedSender,
future::{self, select, try_join_all, Either},
FutureExt, SinkExt, StreamExt,
};
use pg_queue::{
connection::NotificationStream,
logs::{Cursor, Entry},
};
use rand::{
... |
//! # Day 4: Secure Container
//!
//! You arrive at the Venus fuel depot only to discover it's protected by a
//! password. The Elves had written the password on a sticky note, but someone
//! threw it out.
//!
//! However, they do remember a few key facts about the password:
//!
//! * It is a six-digit number.
//! * T... |
use crate::components::image::Image;
use crate::data::geojson::*;
use crate::data::onecall::{OneCall, WeatherDaily};
use crate::data::geodata;
use yew::format::Json;
use yew::prelude::*;
use yew::services::storage::Area;
use yew::services::{StorageService, console::ConsoleService};
use yew::services::fetch::FetchTask;
... |
use bytes::{Buf, BufMut};
use std::cmp::min;
/// Encodes an integer value into LEB128 variable length format, and writes it to the buffer.
/// The buffer must have enough remaining space (maximum 10 bytes).
#[inline]
pub fn encode_varint<B>(mut value: u64, buf: &mut B)
where
B: BufMut,
{
// Safety notes:
/... |
// Copyright 2017-2021 <NAME> <<EMAIL>>
//
// 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... |
use crate::ty::get as get_ty;
use crate::util::error::ErrorKind;
use crate::util::id::Id;
use crate::util::ty::{Ty, TyData};
use crate::util::types::{Cx, Env, FnCx, ItemData, Vars};
use crate::util::{no_struct, no_unsized, no_void, unify, unify_impl};
use hir::{BinOp, Expr, ExprId, Name, UnOp};
pub(crate) fn get(
cx... |
use ast2str::{utils::AstToStrExt, AstToStr};
use pretty_assertions::assert_eq;
pub type Ptr<'a, T> = Box<Expr<'a, T>>;
#[derive(Debug)]
pub enum Op {
Add,
Mul,
}
pub trait Numeric:
std::fmt::Debug + Clone + Copy + PartialEq + std::ops::Add + std::ops::Mul
{
}
impl Numeric for f64 {}
#[derive(Debug, AstT... |
//! This is a simple calculator that avoids the full complexity of the FE games
//! (lifesteal, abilities, held items, personal weapons, etc.) to focus on the
//! stats as they appear in all FE games, providing basic survival
//! probabilities.
use crate::fegame::FEGame;
use serde::{Deserialize, Serialize};
/// The... |
#[macro_use]
extern crate log;
extern crate byteorder;
extern crate dns_parser;
extern crate futures;
extern crate get_if_addrs;
extern crate libc;
extern crate multimap;
extern crate net2;
extern crate nix;
extern crate rand;
use dns_parser::Name;
use std::io;
use std::sync::Arc;
use std::time::Duration;
use tokio... |
use crate::traits::AllValues;
use inner_common::*;
use std::cmp::{max, min};
use std::fmt;
use rand::distributions::{Distribution, Standard};
use rand::Rng;
#[derive(Clone, Copy, Debug)]
pub enum Spread {
LTR((u8, u8), u8),
TTB((u8, u8), u8),
}
impl Default for Spread {
fn default() -> S... |
use std::path::PathBuf;
use clap::{Subcommand, Args};
use semver::Version;
mod edit;
use crate::data::{
mod_json::{ModJson, PreProcessingData},
package::{PackageConfig, SharedPackageConfig},
};
#[derive(Args, Debug, Clone)]
pub struct Qmod {
#[clap(subcommand)]
pub op: QmodOperation,
}
/// Some pr... |
use parking_lot::{Mutex, MutexGuard};
use std::sync::Arc;
#[allow(clippy::all)]
mod biome;
#[allow(clippy::all)]
mod block;
#[allow(clippy::all)]
mod entity;
#[allow(clippy::all)]
mod inventory;
#[allow(clippy::all)]
mod item;
#[allow(clippy::all)]
mod particle;
#[allow(clippy::all)]
mod simplified_block;
pub use bio... |
// Copyright (c) 2020 <NAME> <<EMAIL>>
//! Very simple helper functions for environment variables and environment variable-driven
//! `env_logger` configuration.
#![deny(dead_code)]
#![deny(missing_docs)]
#![deny(unreachable_patterns)]
#![deny(unused_extern_crates)]
#![deny(unused_imports)]
#![deny(unused_qualificati... |
use std::collections::{HashMap, HashSet};
struct CaveNetwork(HashMap<String, Node>);
impl CaveNetwork {
fn new() -> Self {
CaveNetwork(HashMap::new())
}
fn add_node_pair(&mut self, node_a: &str, node_b: &str) {
self.0
.entry(node_a.to_string())
.or_insert_with(|| N... |
//! Inner-mutability on shared variables through spinlocks
#![no_std]
#![feature(const_fn, track_caller)]
use core::ops::{Deref, DerefMut};
use core::cell::UnsafeCell;
use core::marker::PhantomData;
use core::sync::atomic::{AtomicU32, Ordering, spin_loop_hint};
/// Trait that allows access to OS-level constructs def... |
use codec::{Decode, Encode, MaxEncodedLen};
pub use composable_traits::currency::RangeId;
use frame_support::{traits::Get, BoundedVec};
use scale_info::TypeInfo;
use sp_runtime::{
traits::{CheckedAdd, Saturating},
ArithmeticError, DispatchError,
};
pub struct MaxRanges;
impl Get<u32> for MaxRanges {
fn get() -> u32... |
//! The kernel heap allocator
//! Design from: https://os.phil-opp.com/allocator-designs/
use super::VirtualAddress;
use crate::util::{ Locked, align_up };
use alloc::alloc::{ Layout, GlobalAlloc };
/// Represents a node inside the free list inside the allocator
/// The allocator is a linked list allocator so we have... |
use std::{
collections::BTreeMap,
error::Error,
fmt, io,
path::{Path, PathBuf},
};
use tar;
/// Provides access to files in a tarball stored behind a Read impl.
#[derive(Debug)]
pub struct Tardex<R> {
dex: BTreeMap<PathBuf, Entry<R>>,
}
impl<R> Tardex<R>
where
R: io::Read + io::Seek + Clone,
{... |
use crate::item::{UpdatePolicy, Item};
use crate::session::{Session, State, Protocol, LONGEST_KEY_SIZE};
use muduo_rust::Result;
use tracing::{error, info};
use tokio::sync::{broadcast, mpsc};
use std::sync::atomic::{AtomicU64, Ordering};
use std::time::SystemTime;
use tokio::time::{self, Duration};
use std::sync::{Ar... |
use std::cell::Cell;
use std::fmt::{self, Debug};
use super::ElementType;
/// Vector-based union-find representing a set of disjoint sets.
///
/// If configured with Cargo feature `"serde"`, impls for `Serialize`
/// and `Deserialize` will be defined.
#[derive(Clone)]
#[cfg_attr(feature = "serde", derive(Serialize, D... |
extern crate bit_vec;
extern crate rand;
// todo use fnv 1a instead of sip hasher.
extern crate siphasher;
use std::cmp;
use std::f64;
use std::hash::{Hash, Hasher};
use std::marker::PhantomData;
use rand::prelude::*;
use bit_vec::BitVec;
use siphasher::sip::SipHasher13;
// use fnv_1a::fnv_1a;
pub struct Bloom<T: ... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Control Register"]
pub ctrl: crate::Reg<ctrl::CTRL_SPEC>,
#[doc = "0x04 - Command Register"]
pub cmd: crate::Reg<cmd::CMD_SPEC>,
#[doc = "0x08 - Status Register"]
pub status: crate::Reg<status::STATUS_SPEC>,
#[d... |
use std::cmp::Ordering;
use rand::Rng;
use crate::vec3::Vec3;
use crate::ray::Ray;
use crate::hitable::{HitRecord, Hitable};
#[derive(Clone, Debug)]
pub struct AABB {
min: Vec3,
max: Vec3,
}
impl AABB {
pub fn new(min: Vec3, max: Vec3) -> Self {
Self { min, max }
}
pub fn min(&self) -> &V... |
#![allow(dead_code)]
pub fn formatted_print() {
println!("***Formatted Print***");
basics();
debug();
display();
testcase_list();
formatting();
println!("");
}
fn basics() {
println!("{} days", 31);
// positional arguments
println!("{0}, this is {1}. {1}, this is {0}", "Alice... |
use crate::hittable::*;
use crate::materials::*;
use crate::ray::*;
use crate::vec3::*;
#[derive(Debug)]
pub struct Sphere {
pub center: Loc,
pub radius: f64,
pub material: Box<dyn Material>,
}
impl Sphere {
pub fn new(center: Loc, radius: f64, material: Box<dyn Material>) -> Sphere {
Sphere {... |
use crate::states::play_state::tetromino::{Piece, PieceType};
use crate::states::Assets;
use ggez::graphics::{Color, DrawMode, Point2, Rect};
use ggez::{graphics, Context, GameResult};
const WIDTH: f32 = 150.0;
const UIBLOCK_HEIGHT: f32 = 130.0;
const UITEXT_HEIGHT: f32 = 40.0;
const UI_BG_COLOUR: Color = Color {
... |
use super::commands::Command;
use super::context::DebuggingContext;
use super::io_utils::Input;
use crate::environment::{InterpreterState, StateView};
use crate::errors::{InterpreterError, InterpreterResult};
use crate::interpreter::{ComponentInterpreter, Interpreter};
use crate::utils::AsRaw;
use calyx::ir::{self, RRC... |
//! The library implementation Zabbix sender protocol
//! more details:
//! [Zabbix Documentation - 4 Trapper items](https://www.zabbix.com/documentation/3.0/manual/appendix/items/trapper).
//! [Docs/protocols/zabbix sender/2.0](https://www.zabbix.org/wiki/Docs/protocols/zabbix_sender/2.0).
//!
use byteorder;
use rege... |
use std::collections::HashMap;
use crate::entities::attributes::attribute_container::AttributeContainer;
use crate::entities::attributes::attribute_factory::get_attribute_container;
use crate::entities::constants::constant_container::ConstantContainer;
use crate::entities::constants::constant_factory::get_constant_con... |
use crate::env::{Env, Eval};
use crate::error::ParseError;
use crate::expr::Expr;
use crate::utils::{self, kwords};
use crate::val::Val;
#[derive(Debug, PartialEq, Clone)]
pub struct Call {
pub(crate) func: Expr,
pub(crate) args: Vec<Expr>,
}
impl Call {
pub(crate) fn new(s: &str) -> Result<(&str, Self), ... |
use crate::Ty;
use drop_bomb::DropBomb;
use ena::snapshot_vec::{SnapshotVec, SnapshotVecDelegate};
use ena::unify::{InPlace, InPlaceUnificationTable, NoError, UnifyKey, UnifyValue};
use std::borrow::Cow;
use std::fmt;
/// The ID of a type variable.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct TypeVarI... |
use std::time::SystemTime;
use std::process::{Command,Stdio};
use std::io::{Error, ErrorKind, Result};
use chrono::{DateTime,Utc};
use serde::{Serialize, Deserialize};
use serde_json::Value;
use std::fmt::{Display,Formatter};
use std::collections::HashMap;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Tas... |
//
//! Copyright 2020 Alibaba Group Holding Limited.
//!
//! 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 ... |
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::collections::HashMap;
// ------------------ Phase ------------------
enum Phase {
FieldsInput,
MyTicket,
NearbyTickets
}
// ------------------ Rule ------------------
struct Rule {
lower_limit : u32,
upper_limit : u32,
}
impl Rule {
... |
use crate::memory::{dma_registers::*, GbaMem, memory_bus::MemoryBus};
use crate::interrupts::interrupts::Interrupts;
use std::cell::RefCell;
use std::rc::Rc;
use std::fmt;
pub struct DMAChannel {
pub source_address: DMASourceAddress,
pub destination_address: DMADestinationAddress,
pub word_count: ... |
// Copyright Rivtower Technologies LLC.
//
// 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 ... |
#![no_std]
#![no_main]
extern crate panic_semihosting;
use cortex_m::asm::delay;
use cortex_m_rt::entry;
use lsm303dlhc::Lsm303dlhc;
use stm32f3xx_hal::{prelude::*, stm32, i2c::I2c, usb::{Peripheral as UsbPeripheral, UsbBus}};
mod led;
mod report;
use led::*;
const SENSITIVITY: i16 = 128;
#[entry]
fn main() -> ! {... |
use std::collections::HashMap;
use std::fmt;
use std::iter::Iterator;
use std::ops::{AddAssign, Index};
use crate::compress::Compress;
use crate::error::DecodeError;
struct Bits {
bits: Vec<(usize, usize)>,
}
impl fmt::Binary for Bits {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.... |
use num_complex::Complex;
use rayon::{iter::ParallelExtend, prelude::*};
use zi::{
self, backend, layout, terminal::SquarePixelGrid, App, BindingMatch, BindingTransition, Colour,
Component, ComponentLink, Key, Layout, Rect, Result, ShouldRender, Size, Style,
};
type Position = euclid::default::Point2D<f64>;
#... |
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use derive_more::{From, Into};
use js_sys::Uint8Array;
use wasm_bindgen::prelude::*;
mod digest;
/// Returns the digest of the given `data` using the given hash `algorithm`.
///
/// `length` will usually be left `undefined` to use the default ... |
/*
Reference
[1] Minimizing Symmetric Submodular Functions, Satoru Iwata
http://www.iasi.cnr.it/~ventura/Cargese13/Lectures%20slides/Iwata4.pdf
Description
G: ้่ฒ ้ใฟไปใ็กๅใฐใฉใ
n: |V(G)|
m: |E(G)|
G ใฎ extreme vertex set ใๅ
จใฆๅๆใใใ
ๆ้่จ็ฎ้: O(n(m + n log(n)))
f(S) ใใซใใ (S, V(G) \ S) ใฎ้ใฟใจใใใ
โT \subsetneq S. f(T) >... |
pub mod bridge {
//! Bridges two incompatible bellman APIs
//! based on phase2-bn254 code
use bellman_ce::pairing::ff::{Field, PrimeField, PrimeFieldRepr};
use std::fmt::Write;
use std::marker::PhantomData;
// based on https://github.com/matter-labs/ff/blob/c54018e79bd4ee59cd6e9720364e3682b341... |
use std::collections::BTreeMap;
use std::rc::Rc;
use std::cell::RefCell;
use yaml::{self, Int, Float, Bool, String, Yaml};
use scanner::Marker;
use settings::YamlSettings;
#[derive(Debug)]
pub enum YamlNodeKind {
Sequence,
Mapping,
KeyValuePair,
Scalar,
}
pub trait YamlBuilder: Clone {
type NodeH... |
use std::iter::FusedIterator;
use crate::DftPre;
/// Produces all paths using
/// [Depth-First Traversal] (in Pre-Order).
///
/// [Depth-First Traversal]: https://en.wikipedia.org/wiki/Tree_traversal
///
/// # Cycles
///
/// `DftPaths` does not handle cycles. If any
/// cycles are present, then `DftPaths` will
/// re... |
use rayon::prelude::*;
use crate::{Agent, World};
/// Keeps track of all [`Agent`]s, its states and the global state.
///
/// It's responsible to update the `Agent`s states based on their defined behavior.
///
/// Please see the [crate documentation][crate] for examples.
pub struct Simulation<A: Agent> {
agents: ... |
use std::fmt;
use std::ops::{Deref, DerefMut};
use crate::platform::traits::*;
use crate::platform::Device;
use crate::units::{ElectricPotential, Energy, Power, Ratio, ThermodynamicTemperature, Time};
use crate::{State, Technology};
/// Battery instant information representation.
///
/// Consequent calls of the same ... |
use spidev::Spidev;
use spidev::SpidevOptions;
use spidev::SpidevTransfer;
use spidev::SPI_MODE_0;
use std::fmt::Debug;
use std::fmt::Formatter;
use std::io::Write;
use std::sync::Arc;
use std::sync::Mutex;
type Result<T = ()> = std::result::Result<T, Box<std::error::Error>>;
// Mcp23s17 register addresses -- Source:... |
use simple_matrix::Matrix;
use std::{
cmp::Ordering,
collections::{HashSet, HashMap}
};
use uuid::Uuid;
#[derive(Debug, Eq, PartialEq)]
struct Cart {
id: Uuid,
x: i32,
y: i32,
x_velocity: i32,
y_velocity: i32,
turn_state: i32,
}
impl Cart {
fn new(x: usize, y: usize, x_velocity: ... |
use chrono::prelude::*;
use diesel;
use diesel::prelude::*;
use log::Level::Info;
use models::*;
use schema::domain_events;
use serde_json;
use std::cmp::Ordering;
use utils::errors::*;
use uuid::Uuid;
#[derive(Clone, Debug, PartialEq, Identifiable, Queryable, Serialize, Deserialize)]
pub struct DomainEvent {
pub ... |
use crate::{
types::{AcrDriver, ScanFrequency, Source},
Error, HttpRequest, Response, Tenable,
};
use http::{header::HeaderValue, status::StatusCode, Method, Request};
use serde::{Deserialize, Serialize};
use std::{borrow::Cow, fmt};
/// Request Object for the `assets` function
#[derive(Clone, Debug)]
pub stru... |
// Echidna - Data
use {
crate::*,
tokio::{
net,
task,
io::AsyncReadExt,
sync::Mutex,
time,
},
codec::Codec,
std::{
sync::Arc,
net::SocketAddr,
time::Duration,
},
shared_memory::{
Shmem,
ShmemConf,
},
};
pub... |
// Copyright 2018-2019 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
// Substrate is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) a... |
use na::Vector2;
use num_derive::FromPrimitive;
use std::cmp::Ordering;
use std::collections::{BinaryHeap, HashMap, HashSet};
use strum::{EnumCount, IntoEnumIterator};
#[derive(Debug, Clone, Copy, EnumCount, FromPrimitive)]
pub enum RegionType {
Rocky = 0,
Wet = 1,
Narrow = 2,
}
#[derive(Debug, Clone, Cop... |
// Copyright (c) 2021 ruarango developers
//
// 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. All files in the project carrying such notice may not be copied,
... |
// 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.
//
// In an ideal world there would be a stable well documented set of crates containing a specific
// version of the Rust compiler along w... |
// Copyright 2019 The Chromium OS 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 std::fs::File;
use std::io::{self, BufRead, BufReader, Write};
use std::thread::spawn;
use sys_util::{set_rt_prio_limit, set_rt_round_robin};
type R... |
use ureq;
use serde_json;
use simple_error::{SimpleError};
use serde_json::{Value};
use chrono::{DateTime, Utc, TimeZone};
use chrono_humanize::HumanTime;
use chrono::prelude::*;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Check {
pub id: Option<String>,
pub short_id: Option<String>,
pub nam... |
mod coords;
use coords::{Polar, XY};
use nannou::prelude::*;
use nannou::state::mouse::ButtonPosition;
#[derive(Default)]
struct MouseInput {
p1_angle_prev: f32,
p2_angle_prev: f32,
is_original_angle: bool,
closer_to_p1: bool,
pressed: bool,
frames_pressed: f32,
}
struct Model {
p1: Pol... |
use crate::device::GraphicsDevice;
use crate::resources::CubensisResourceCollection;
use hyphae::configuration::library::Library;
use hyphae::events::CubensisEvent;
use std::rc::Rc;
pub struct RepaintSignal(std::sync::Mutex<winit::event_loop::EventLoopProxy<CubensisEvent>>);
impl epi::RepaintSignal for RepaintSignal ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.