text stringlengths 3.09k 13.9k |
|---|
pub mod regressor;
pub use rayon::prelude::*;
pub use regressor::*;
use super::{BaseEllipticalProcessParams, EllipticalProcessParams};
use crate::nonparametric::{ey, kernel_matrix, EllipticalProcessError};
use crate::{opensrdk_linear_algebra::*, RandomVariable};
use crate::{DistributionError, EllipticalParams};
use e... |
use chrono::{TimeZone, Utc};
use chrono_humanize::Tense;
use humantime::format_duration;
use maud::{html, PreEscaped, DOCTYPE};
use redis::aio::MultiplexedConnection;
use redis::AsyncCommands;
use rocket::{uri, State};
use crate::aggregator::persistence::{retrieve_analytics, UPDATED_AT_KEY};
use crate::logging::clear_... |
use syn::parse::{Error, Result};
use syn::spanned::Spanned;
use syn::{Attribute, Ident, Lit, LitStr, Meta, MetaList, MetaNameValue, NestedMeta};
use proc_macro2::Span;
use crate::util::*;
use crate::OnlyIn;
use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ValueKind {
// #[<name>]
Name,
//... |
//! An example that uses CPUID to determine the system topology.
//!
//! Intel Topology is a pretty complicated subject (unfortunately):
//! https://software.intel.com/en-us/articles/intel-64-architecture-processor-topology-enumeration/
extern crate core_affinity;
extern crate raw_cpuid;
use raw_cpuid::{CpuId, Extende... |
//! Single Wire Output interface.
//!
//! This module provides interface for ITM (Instrumentation Trace Macrocell)
//! output through SWO (Single Wire Output) pin, and optionally the respective
//! implementation for `drone_core::log` facade (via `set_log!` macro).
#![cfg_attr(feature = "std", allow(unreachable_code, ... |
use crate::cli::cloud_json::{JSONCloudCreateUserRequest, JSONCloudUser, JSONCloudUserRoles};
use crate::cli::util::cluster_identifiers_from;
use crate::client::{CloudRequest, ManagementRequest};
use crate::state::State;
use async_trait::async_trait;
use log::debug;
use nu_engine::CommandArgs;
use nu_errors::ShellError;... |
//! Resources are lazily-loaded objects that may have a name attached to them.
//!
//! PokeAPI uses [`Resource`]s as hyperlinks between the objects it returns.
use std::fmt;
use std::str::FromStr;
use std::sync::Arc;
use serde::de::Deserializer;
use serde::ser::Serializer;
use serde::Deserialize;
use serde::Serialize... |
use lazy_static::lazy_static;
use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
use std::time::Instant;
use std::{env, fs, usize};
use tree_sitter::{Language, Parser};
use tree_sitter_cli::loader::Loader;
include!("../src/tests/helpers/dirs.rs");
lazy_static! {
static ref LANGUAGE_FILTER: Option<Str... |
// Copyright 2018-2021 Google 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 t... |
use crate::ast::*;
pub fn append(adapters: &[Adapter<'_>], wasm: &mut Vec<u8>) {
if adapters.len() == 0 {
return;
}
let mut types = Vec::new();
let mut imports = Vec::new();
let mut funcs = Vec::new();
let mut exports = Vec::new();
let mut implements = Vec::new();
for adapter in... |
use std::{
os::raw::{c_char, c_int},
pin::Pin,
task::{Context, Poll},
};
use bytes::{Buf, BufMut, Bytes};
use futures::{ready, stream::Stream};
use lz4_sys::LZ4_decompress_safe;
use crate::{
buflist::BufList,
error::{Error, Result},
};
const MAX_COMPRESSED_SIZE: u32 = 1024 * 1024 * 1024;
pub(cra... |
use std::cmp::Ordering::*;
use std::cmp::max;
use std::mem::replace;
// Avl 树定义
#[derive(Debug)]
enum AvlTree<T> {
Null,
Tree(Box<AvlNode<T>>),
}
// Avl 树节点定义
#[derive(Debug)]
struct AvlNode<T> {
val: T,
left: AvlTree<T>, // 左子树
right: AvlTree<T>, // 右子树
bfactor: i8, // 平衡因子
}
use AvlT... |
// Copyright 2020 - developers of the `grammers` project.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distr... |
use core::sync::atomic::{compiler_fence, fence, Ordering};
use embassy_net::PacketBuf;
use stm32_metapac::eth::vals::St;
use vcell::VolatileCell;
use crate::pac::ETH;
#[non_exhaustive]
#[derive(Debug, Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Error {
NoBufferAvailable,
// T... |
extern crate aho_corasick;
pub use self::aho_corasick::AcAutomaton;
use self::aho_corasick::{Automaton, StreamMatches};
use std::io::{Result as IoResult, Read};
use std::clone::Clone;
use std::cell::RefCell;
use std::rc::Rc;
mod grow;
use self::grow::Grow;
#[derive(Debug)]
struct GrowWrap<R>(Rc<RefCell<Grow<R>>>);... |
use super::global::GenImmix;
use crate::plan::generational::gc_work::GenNurseryProcessEdges;
use crate::plan::CopyContext;
use crate::plan::PlanConstraints;
use crate::policy::space::Space;
use crate::scheduler::gc_work::*;
use crate::scheduler::GCWorkerLocal;
use crate::util::alloc::Allocator;
use crate::util::alloc::... |
/*
Copyright 2021 Picovoice Inc.
You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
file accompanying this source.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an ... |
//
// Copyright (C) 2018 Kubos Corporation
//
// 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 agree... |
//! The linalg module provides some basic linear algebra functionality for
//! transforming 3D geometry
use std::f32;
use std::ops::{Add, Index, Mul};
// Re-export the linalg types from the internal modules
pub use self::animated_transform::AnimatedTransform;
pub use self::keyframe::Keyframe;
pub use self::matrix4::M... |
//
// Vidoxide - Image acquisition for amateur astronomy
// Copyright (c) 2020-2021 <NAME> <<EMAIL>>
//
// This project is licensed under the terms of the MIT license
// (see the LICENSE file for details).
//
//!
//! Recording output: SER video.
//!
use crate::output::OutputWriter;
use ga_image::ImageView;
use ga_ima... |
// Copyright 2020 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
use blocks::{tipset::tipset_json::TipsetJsonRef, Tipset};
use chrono::{DateTime, Duration, Utc};
use clock::ChainEpoch;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::fmt;
use std::sync::Arc;
/// Current state of ... |
//! Envelope encryption.
//!
//! # Example
//!
//! ```rust
//! use openssl::rsa::Rsa;
//! use openssl::envelope::Seal;
//! use openssl::pkey::PKey;
//! use openssl::symm::Cipher;
//!
//! let rsa = Rsa::generate(2048).unwrap();
//! let key = PKey::from_rsa(rsa).unwrap();
//!
//! let cipher = Cipher::aes_256_cbc();
//! l... |
#![feature(specialization, never_type, const_fn_fn_ptr_basics)]
#![feature(coerce_unsized)]
#![feature(seek_stream_len)]
#![allow(incomplete_features, unused_variables, dead_code, unused_imports, unused_macros, unused_mut)]
#![deny(unused_must_use)]
//! A crate that allows `Box<dyn Any>` to be serialized and deseriali... |
use std::collections::HashSet;
use keys::*;
use event::KeyEvent;
use keyboard::KeyboardInternal;
use libusb::{Result as UsbResult, Error as UsbError};
#[derive(Debug, Clone, PartialEq)]
pub struct Packet<'a> {
pub endpoint: u8,
pub buf: &'a [u8],
}
impl<'a> Packet<'a> {
pub fn new(endpoint_direction: u8, ... |
use rustc_middle::mir::Mutability;
use rustc_middle::ty;
use rustc_middle::ty::TyCtxt;
use rustc_span::def_id::DefId;
use std::mem::size_of;
use super::cost_language::{Cost, HasSize, Symbolic};
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub(crate) enum Type {
Bool,
Char,
Int(ty::IntTy),
Uint(ty::Uin... |
use std::{
collections::BTreeMap,
convert::TryInto as _,
env, fmt, fs,
path::{Path, PathBuf},
};
use chrono::{Datelike as _, TimeZone as _, Utc};
use glob::glob;
use regex::Regex;
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
struct Date {
year: u32,
month: u32,
}
impl Date {
fn months_sin... |
use std::borrow::Borrow;
use std::thread;
use std::thread::JoinHandle;
use crossbeam_channel::{bounded, Receiver, Sender};
use futures::future;
use hyper::rt::{Future, Stream};
use rdkafka::client::ClientContext;
use rdkafka::config::{ClientConfig, RDKafkaLogLevel};
use rdkafka::consumer::{Consumer, ConsumerContext, R... |
use std::process::{Child, ChildStdin, ChildStdout, Command, Stdio};
use super::*;
pub struct NonReactiveSeqEnforcer {
dict: LTLDict,
n_forall: usize,
ltl: LTLAst<usize>,
n: usize,
traces: Vec<Vec<Event<usize>>>,
enforcing: Option<(Vec<Event<usize>>, Vec<Event<usize>>)>,
solver: HyperLTLS... |
//! # A Cryptographic Coin
//!
//! The Coin produces a pseudorandom binary value that the correct nodes agree on, and that
//! cannot be known beforehand.
//!
//! Every Coin instance has a _nonce_ that determines the value, without giving it away: It
//! is not feasible to compute the output from the nonce alone, and t... |
use super::{
dev::{BlePeerDevice, BlePeerDeviceAddress},
BlePeerDeviceSharedState, SafeBle,
};
use anyhow::Result;
use std::sync::{
mpsc::{Receiver, Sender},
Arc,
};
enum BlePeerDeviceDiscoveryEvent {
Discovery(String, BlePeerDeviceAddress),
DiscoveryFinished,
}
pub struct BleScan {
ble: S... |
use super::int_code::Program;
use crate::input::Input;
use std::collections::{HashSet, VecDeque};
#[derive(PartialEq, Eq, Hash, Clone, Copy)]
enum Direction {
North,
East,
South,
West,
}
impl Direction {
const fn reverse(self) -> Self {
match self {
Self::North => Self::South,
... |
mod agent;
mod convert;
mod crawl_progress;
mod curiosity;
#[cfg(test)]
mod delegation_rules;
mod lookup;
mod rdf_graph;
mod store;
mod translate;
mod ttl;
mod types;
mod util;
extern crate alloc;
extern crate core;
pub use agent::Agent;
pub use curiosity::Curiosity;
pub use lookup::{Lookup, LookupError};
pub use rdf... |
use worker_sys::cf::Cf as FfiCf;
use worker_sys::cf::TlsClientAuth as FfiTlsClientAuth;
/// In addition to the methods on the `Request` struct, the `Cf` struct on an inbound Request contains information about the request provided by Cloudflare’s edge.
///
/// [Details](https://developers.cloudflare.com/workers/runtime... |
// Copyright 2014 <NAME>.
// Licensed under the MIT license (http://opensource.org/licenses/MIT)
// This file may not be copied, modified, or distributed
// except according to those terms.
//! The Burrows-Wheeler-Transform and related data structures.
//! The implementation is based on the lecture notes
//! "Algorith... |
extern crate rayon;
extern crate rand;
extern crate statrs;
extern crate petgraph;
extern crate vec_graph;
extern crate gurobi;
extern crate capngraph;
extern crate bit_set;
extern crate docopt;
#[macro_use]
extern crate slog;
extern crate slog_stream;
extern crate slog_term;
extern crate slog_json;
extern crate serde;... |
use crate::*;
use std::sync::atomic::{AtomicBool, Ordering};
pub fn find_combinations(
piece_set: PieceSet,
board: BitBoard,
abort: &AtomicBool,
height: usize,
mut combo_consumer: impl FnMut(&[Placement]),
) {
find_combos_st(
&mut vec![],
board,
BitBoard::filled(height),... |
#![allow(clippy::unit_arg)]
use core::{cmp, mem};
use bitflags::bitflags;
use itertools::*;
use zerocopy::{AsBytes, FromBytes};
use crate::{
fs::{FileSystem, FileSystemExt, Path},
addr::{pgroundup, PAddr, PGSIZE},
arch::interface::TrapFrameManager,
hal::hal,
page::Page,
param::MAXARG,
pro... |
//! Wrapper for the chat endpoint.
//!
//! See the documentation on the [ChatClient] struct for where to start.
//!
//! [ChatClient]: struct.ChatClient.html
/// Static models for JSON data
pub mod models;
use crate::internal::{connect as socket_connect, ClientSocketWrapper};
use atomic_counter::AtomicCounter;
use fai... |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
use std::any::Any;
use crate::optimizer;
use crate::regressor;
use crate::model_instance;
use crate::feature_buffer;
use std::io;
use core::arch::x86_64::*;
use std::error::Error;
use std::mem::{self, MaybeUninit};
use optimizer::OptimizerTrait;
use regressor::BlockTrait;
use crate::block_helpers;
use block_helpers... |
use wasm_bindgen::prelude::*;
use std::f64;
use wasm_bindgen::JsCast;
use web_sys::{self, console};
use std::cell::Cell;
use std::rc::Rc;
extern crate zqm_engine;
use zqm_engine::{
eval, init, render,
types::{
event::{self, Event, KeyEventInfo},
render::{Color, Dim, Elm, Elms, Fill, Pos, Rec... |
use nft_smt::common::{Byte32, BytesBuilder};
use nft_smt::molecule::prelude::*;
use nft_smt::registry::{
CompactNFTRegistryEntriesBuilder, KVPair, KVPairBuilder, KVPairVecBuilder,
};
use nft_smt::smt::{Blake2bHasher, H256, SMT};
fn generate_smt(origin_lock_hashes: Vec<[u8; 32]>, lock_hashes: Vec<[u8; 32]>) -> (Str... |
use std::ffi::c_void;
use std::fmt;
use std::ops;
use crate::config::VideoMeta;
use chrono::{DateTime, Utc};
use opencv::core::Mat_AUTO_STEP;
use opencv::prelude::{Mat, MatTrait};
use podo_core_driver::RuntimeError;
use serde::{
de::{self, MapAccess, SeqAccess, Visitor},
ser::SerializeStruct,
Deserialize,... |
//! space
//!
//! a 3D universe struct providing mesh grids in the Cartesian coordinates.
use super::utils;
use num_traits::float::Float;
use std::f64::consts::PI;
/// Space
///
/// provide functions which give ranges and grids
/// in real and reciprocal space.
pub struct Space<T>
where
T: Float,
{... |
use anyhow::Result;
use yaml_rust::yaml::Hash as YamlHash;
use yaml_rust::yaml::Yaml;
use super::super::cmd;
use super::super::config;
use super::super::errors::GardenError;
use super::super::model;
pub fn main(app: &mut model::ApplicationContext) -> Result<()> {
let mut output = String::new();
let mut paths:... |
use std::sync::Arc;
use atomic_refcell::AtomicRefCell;
use digest_auth::AuthContext;
use reqwest::{Client, Method, RequestBuilder};
use uuid::Uuid;
pub(crate) const MKCALENDAR: &[u8] = b"MKCALENDAR";
pub(crate) const REPORT: &[u8] = b"REPORT";
use crate::{
calendar::Calendar,
error::{CalDavError, CalDavResu... |
extern crate clap;
extern crate futures;
extern crate hyper;
extern crate hyper_tls;
extern crate serde;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_json;
extern crate tokio_core;
use std::str;
use std::error::Error;
use clap::{App, Arg};
use std::io;
use futures::{Future, Stream};
use hype... |
extern "C" {}
extern crate gb;
use std::ffi::CString;
use std::mem;
use std::os::raw::{c_char, c_void};
use std::ptr;
use std::slice;
use gb::{Emulator, Hardware, Interrupt, Key};
const KEYS: [Key; 8] = [
Key::A,
Key::B,
Key::Up,
Key::Down,
Key::Left,
Key::Right,
Key::Select,
Key::St... |
//! `Camera` type
//!
//! See TRTC chapter 7.
use crate::canvas::Canvas;
use crate::matrix::Matrix;
use crate::ray::Ray;
use crate::tuple::{Tuple, ORIGIN};
use crate::world::World;
/// Parameters to map the 3D world to a 2D canvas.
pub struct Camera {
/// Canvas width in pixels.
hsize: usize,
/// Canvas ... |
#[macro_use]
extern crate serde_derive;
use std::{io, error, fmt};
use std::io::Read;
use std::fs::File;
use futures::{Future, SinkExt};
use futures::channel::mpsc::Receiver;
use reqwest::{Client, Response};
use reqwest::multipart::{self, Form};
use serde::Deserialize;
use serde_json::Value;
use std::path::PathBuf;... |
// Author: <NAME>
//
// Copyright:
// 2018 Secure Systems Group, Aalto University https://ssg.aalto.fi/
//
// This code is released under the Apache 2.0 licence.
#[macro_use] extern crate clap;
extern crate chrono;
extern crate data_encoding;
extern crate failure;
#[macro_use] extern crate failure_derive;
extern cra... |
mod youtube_manager;
use clap::{App, Arg, SubCommand};
use env_logger;
use env_logger::Logger;
use google_youtube3::{Result, YouTube};
use hyper;
use hyper_rustls;
use log::debug;
use std::future::Future;
use std::pin::Pin;
use tokio;
use tokio::io::AsyncBufReadExt;
use webbrowser;
use youtube_manager::playlist::Playl... |
use std::fs::File;
use std::io::Write;
use crate::vecmath::vector2;
use crate::vecmath::vector2::Vector2;
use crate::{constants::*, neighbors, new_neighbor_map, NeighborMap};
#[derive(Debug)]
pub struct Particle {
pub position: Vector2,
pub velocity: Vector2,
pub force: Vector2,
pub rho: f64,
pub... |
use std::rc::Rc;
use wlroots::{wlroots_dehandle::wlroots_dehandle,
xdg_shell_v6_events::{MoveEvent, ResizeEvent},
CompositorHandle, Origin, SurfaceHandle, SurfaceHandler, XdgV6ShellHandler,
XdgV6ShellManagerHandler, XdgV6ShellSurfaceHandle};
#[derive(Debug, Default, Clone, Pa... |
use crate::arena::{Arena, ArenaItem};
use crate::formatter::HtmlFormatter;
use crate::parser::Haml;
use std::collections::HashMap;
#[derive(Debug)]
pub struct XHtmlFormatter {
self_closing_tags: HashMap<String, bool>,
}
impl HtmlFormatter for XHtmlFormatter {
fn generate(&self, arena: &Arena) -> String {
... |
//! The main Image API
use crate::parameters::*;
#[derive(Default, Debug, Clone, PartialEq)]
pub struct Image {
pub host: String,
pub prefixes: Vec<String>,
pub identifier: String,
pub region: Region,
pub size: Size,
pub rotation: Rotation,
pub quality: Quality,
pub format: Format
}
impl Image {
/... |
#![feature(test)]
use std::net::SocketAddr;
use std::ops::Div;
use spinners::{Spinner, Spinners};
use trust_dns_resolver::config::*;
use trust_dns_resolver::TokioAsyncResolver;
use crate::args_parser::Bust;
use crate::request::{make_http_request, make_https_request, Body, Stats};
mod args_parser;
mod bench;
mod cal... |
use crate::{ffi, layout::LayoutCell, options::Options};
use std::{
ffi::c_void,
os::raw::{c_char, c_int},
ptr,
};
pub(crate) use crate::ffi::{
window as Window, window_pane as WindowPane, winlink as Winlink, winlinks as Winlinks,
};
impl Winlinks {
pub(crate) fn prev_mut(&mut self, wl: &mut Winlin... |
use crate::riverdb::{Result, Error};
const LENGTHS: [u8; 32] = [
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 3, 3, 4, 0
];
const MASKS: [u8; 5] = [0x00, 0x7f, 0x1f, 0x0f, 0x07];
const MINS: [u32; 5] = [4194304, 0, 128, 2048, 65536];
const SHIFT: [u32; 5] = [0, 18, 12, 6... |
use std::{path::PathBuf, str::FromStr};
use clap::{Arg, ArgMatches, Command as Cmd};
fn db_uri() -> [Arg<'static>; 2] {
[
Arg::new("ssl_mode")
.short('s')
.long("sslmode")
.value_name("SSL_MODE")
.default_value("Require")
.possible_values(&[
... |
//! Given C = g^x * h^y * f^z
//!
//! The goal is to prove the following statements.
//! - a = C^r -> ZKP(a; C)
//! - b = h^{y*r} * f^{z*r} -> ZKP(b; h, f)
//! - a/b = g^{x*r} -> ZKP(a/b; g)
use crate::{
errors::Fallible, proofs::non_interactive_prove, CommittedUids, ProofGenerator, Prover,
ZKPFinalResponse, Z... |
//! # Windows Powershell script runner
//!
//! This crate is pretty basic. It uses `std::process::Command` to pipe commands
//! to PowerShell. In addition to that there is a convenient wrapper around `process::Output`
//! especially tailored towards the usecase of running Windows PowerShell commands.
//!
//! ## Example... |
use eui48::MacAddress;
#[derive(Debug)]
pub enum Tag {
Ssid(String),
SupportedRates(Vec<u8>),
Country {
code: [u8; 2],
},
VendorSpecific {
vendor: [u8; 3],
},
Unknown
}
impl Tag {
/// Parse a single management tag, removing itself from the start of the given buffer
p... |
use std::io;
use std::io::prelude::*;
use std::fmt;
#[derive(Copy,Debug,Eq)]
enum Tile {
Open,
Trees,
Lumberyard,
}
impl Clone for Tile {
fn clone(&self) -> Tile { *self }
}
impl PartialEq for Tile {
fn eq(&self, other: &Tile) -> bool {
match (&self, other) {
(Tile::Open, Tile::Open) => true,
(Tile::Tre... |
#![deny(warnings)]
use anyhow::Result;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::env;
use std::fs;
use uuid::Uuid;
use crate::notifier;
fn default_as_true() -> bool {
true
}
fn default_grpc_addr() -> String {
"0.0.0.0:9394".to_string()
}
fn default_http_addr() -> String {
... |
//
//
//
///
use std::ffi::{OsString,OsStr};
use listview::ListView;
use std::cell::RefCell;
use std::fs::Path;
use wtk::WindowTrait;
pub struct FileList<'a>
{
root: &'a ::syscalls::vfs::Dir,
on_open: Box<dyn Fn(&mut dyn WindowTrait, &Path, ::syscalls::vfs::Node) + 'a>,
on_chdir: Box<dyn Fn(&mut dyn WindowTrait, &P... |
//! # Symmetric Cryptography.
//!
//! This module provides an interface to encrypting data. <br>
//! Right now we use AES-256-GCM as an AEAD (Authenticated Encryption). <br>
//! We use the Ring library which uses some BoringSSL code and mostly AES-NI inline ASM instructions. <br>
//! Right now I have a fork of ring whi... |
use std::convert::{Into, TryFrom};
use std::time::Instant;
use zvariant::Type;
use zvariant::{Dict, Signature, Str, Value};
fn boxed_value<'a, V: Into<Value<'a>>>(v: V) -> Value<'a> {
Value::new(v.into())
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LoopStatus {
None,
Track,
Playlist,
}
im... |
use crate::display::ImageNormal;
use crate::intcode::intcode_io::{Input, Output};
use crate::intcode::IntCode;
use crate::util::parse_intcode;
use anyhow::{Error, Result};
use std::collections::HashMap;
use std::fmt;
pub fn part1(input: &str) -> Result<String> {
let intcode = parse_intcode(input)?;
let hull = ... |
#![warn(future_incompatible)]
#![warn(missing_copy_implementations)]
//#![warn(missing_docs)]
#![warn(nonstandard_style)]
#![warn(rust_2018_idioms)]
#![warn(trivial_casts, trivial_numeric_casts)]
#![warn(clippy::all, clippy::pedantic)]
#![allow(clippy::enum_glob_use)]
#![allow(clippy::match_bool)]
#![allow(clippy::mod... |
// Copyright (C) 2019 <NAME>
//
// 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 according to t... |
use std::fmt;
use std::ops::BitOr;
/// Option supplied when [registering] an [`Evented`] handle with [`OsQueue`].
///
/// For high level documentation on registering see [`OsQueue`].
///
/// [registering]: crate::os::OsQueue::register
/// [`OsQueue`]: crate::os::OsQueue
///
/// # Difference
///
/// An [`Evented`] regi... |
use std::cmp;
use std::collections::VecDeque;
use std::error::Error;
use std::fs;
use intcode::IntcodeProg;
use intcode::ProgramStatus as IPS;
fn main() -> Result<(), Box<dyn Error>> {
let prog: Vec<_> = fs::read_to_string("input.txt")?
.trim()
.split(',')
.map(|s| s.parse().unwrap())
... |
use std::error::Error;
use std::thread;
use std::thread::{JoinHandle, sleep};
use std::str::FromStr;
use std::sync::mpsc::Sender;
use std::time::{SystemTime, Duration};
use chrono::Utc;
use mcp3xxx::{AnalogIn, MCPDevice, SharedMCPDevice};
use rustpi_io::gpio::*;
use crate::event::Event;
use crate::event::moisture::{M... |
use crate::executor_manager::get_executor_manager;
use crate::highlighting::es_highlighting::pg_catalog::*;
use crate::zdbquery::ZDBQuery;
use pgx::*;
use serde::Serialize;
use serde_json::*;
mod pg_catalog {
use pgx::*;
use serde::*;
#[allow(non_camel_case_types)]
#[derive(PostgresEnum, Serialize, De... |
use crate::portfolio::position::{Direction, Position};
use crate::statistic::{de_duration_from_secs, se_duration_as_secs};
use crate::statistic::summary::data::DataSummary;
use crate::statistic::summary::{Initialiser, PositionSummariser, TableBuilder};
use chrono::{DateTime, Duration, Utc};
use prettytable::Row;
use se... |
mod point;
pub use point::Point;
use serde::{
Deserialize,
Serialize,
};
use std::collections::{
BTreeMap,
VecDeque,
};
#[derive(Debug)]
pub enum PolarisError {
ProcessedLimit,
}
pub type PolarisResult<T> = Result<T, PolarisError>;
pub struct Quadtree<T> {
quads: Option<[Box<Quadtree<T>>; 4... |
#![doc = include_str!("../../README.md")]
use std::{fs::File, io::BufReader, net::SocketAddr, sync::Arc};
use bytes::{BufMut, BytesMut};
use config::Auth;
use futures::StreamExt;
#[allow(unused_imports)]
use log::*;
use quinn::{ClientConfig, ServerConfig, TransportConfig};
use rustls::{AllowAnyAnonymousOrAuthenticate... |
extern crate libc;
#[macro_use]
extern crate log;
use std::{
fs::File,
io::{Error, ErrorKind, Read, Result},
os::unix::{
io::{AsRawFd, FromRawFd, RawFd},
process::CommandExt,
},
path::Path,
process::{Command, Stdio},
str,
};
fn getpty(columns: u32, lines: u32) -> (RawFd, St... |
#![allow(dead_code)]
extern crate syncpool;
use std::collections::HashMap;
use std::sync::mpsc;
use std::thread;
use std::time::{Duration, Instant};
use syncpool::prelude::*;
const TRIAL_RUNS: usize = 64;
const TEST_SIZE: usize = 128;
const BUF_CAP: usize = 1024;
const BUSY_PERIOD: u64 = 16;
const DENOMINATOR: usize... |
/*!
* This file contains the logic for sending GCode and other commands to GRBL.
* The GCodeTaskHandle acts as an interface to the sender
*
*
*/
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
use std::sync::{Arc, Mutex, mpsc::*};
use std::thread::JoinHandle;
use std::time::{Duration, Instant};
use c... |
use crate::cmd::command::{CliCommand, Commands};
use crate::cmd::firmware::Firmware;
use crate::cmd::show::Show;
use crate::http::getter::{GetterType, Getters};
use crate::model::firmware::{FirmwareAction, FirmwareOptions};
use crate::model::packet_search::PacketSearch;
use crate::util::print::print_list;
use clap::Par... |
use core::fmt;
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Op {
Comment(char),
Plus(u32),
Minus(u32),
Left(u32),
Right(u32),
Loop,
End,
Put,
Get,
Putnum,
Getnum,
Refer,
Deref,
Alloc,
Free
}
impl fmt::Display for Op {
... |
use crate::{
compiler::Context,
scanner::{Kind, Scanner, Token},
};
#[derive(Debug)]
pub struct Parser<'a> {
scanner: Scanner<'a>,
pub current: Token<'a>,
pub previous: Token<'a>,
pub had_error: bool,
pub panic_mode: bool,
}
impl<'a> Parser<'a> {
pub fn new(scanner: Scanner<'a>) -> Par... |
use cgmath::{vec2, vec3, Vector2, Vector3};
pub struct Cube {
pub center: Vector3<f32>,
pub x_extent: f32,
pub y_extent: f32,
pub z_extent: f32,
}
impl Cube {
#[rustfmt::skip]
pub fn corners(&self) -> Vec<Vector3<f32>> {
let axes = [
Vector3::unit_x() * self.x_extent,
... |
// background_load_in_progress used with condition variable
#![allow(clippy::mutex_atomic)]
use std::collections::VecDeque;
use std::collections::{HashMap, HashSet};
use std::sync::{Arc, Condvar, Mutex};
use std_semaphore::Semaphore;
use crate::disk_store::interface::DiskStore;
use crate::disk_store::interface::Parti... |
use anyhow::{Context as _, Result};
use poldercast::GossipSlice;
use serde::{Deserialize, Serialize};
use std::{
convert::TryFrom,
fmt::{self, Formatter},
net::SocketAddr,
str::FromStr,
time::Duration,
};
use structopt::StructOpt;
/// network configuration of the node
///
/// set the different valu... |
extern crate noisy_float;
use self::noisy_float::prelude::*;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Area {
pub x: R32,
pub y: R32,
pub width: R32,
pub height: R32,
pub left: R32,
pub right: R32,
pub top: R32,
pub bottom: R32,
}
pub struct Point(R32, R32);
impl Area {
... |
#[macro_use]
extern crate clap;
use clap::{App, Arg, ArgMatches, SubCommand};
use chrono::DateTime;
use ed25519_dalek::{Keypair, SecretKey};
use rand::rngs::OsRng;
use smolcert::{Certificate, Extension, Validity, KeyUsage};
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;
mod errors;
use crate::erro... |
//! Nodes of Pijama's AST.
//!
//! The purpose of the types in this module is to represent the syntax of Pijama as faithfully as
//! possible. Some types here are used through Pijama's different internal representations.
use std::{
collections::VecDeque,
fmt::{Debug, Display, Formatter, Result},
};
use crate::... |
use parse_error::ParseError;
use phase::Phase;
use std::cmp;
use std::collections::HashMap;
use std::fs::{self, OpenOptions};
use std::io::{self, BufRead, BufReader, BufWriter, Read, Write};
use std::ops::Range;
use std::path::Path;
use std::str::FromStr;
use tagged_range::{self, TaggedRange};
use combine::{self, Strea... |
// Copyright 2017-2018 Maskerad Developers
//
// 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 accord... |
use crate::structures::material::Material;
use crate::structures::camera::Camera;
use crate::structures::scene::Scene;
use crate::structures::vec3::Vec3;
use crate::objects::sphere::Sphere;
use crate::objects::plane::Plane;
use crate::objects::mandelbulb::Mandelbulb;
use crate::objects::triangle::Triangle;
// const RE... |
use derivative::Derivative;
use sway_types::{Ident, Spanned};
use crate::{
error::{err, ok},
semantic_analysis::{
ast_node::{type_check_interface_surface, type_check_trait_methods},
Mode, TypedCodeBlock,
},
style::is_upper_camel_case,
type_engine::{insert_type, look_up_type_id, Copy... |
use phf::phf_map;
use serde::Deserialize;
pub struct Line {
pub name: &'static str,
pub color: &'static str,
}
pub static LINES: phf::Map<&'static str, Line> = phf_map! {
"BL" => Line { name: "Blue", color: "#0079C4" },
"GR" => Line { name: "Green", color: "#10AE4E" },
"OR" => Line { name: "Orange... |
use core::ptr::NonNull;
use std::fmt::{Display, Formatter, Result as FmtResult};
use std::iter::{empty, Iterator};
#[macro_export]
macro_rules! new_node {
( $val:expr ) => {{
Box::leak(Box::new(Node::new($val))).into()
}};
}
#[macro_export]
macro_rules! set_next_of {
( $left:expr,$right:expr ) => {... |
//! ## Tiny RNG, a minimal random number generator
//! Warning: Not cryptographically secure.
#![cfg_attr(not(test), no_std)]
pub trait Rand {
fn from_seed(seed: u64) -> Self;
fn rand_u32(&mut self) -> u32;
#[inline]
fn rand_u8(&mut self) -> u8 {
self.rand_u32() as u8
}
#[inline]
... |
use crate::util::color::ColorChoice;
use std::{
fmt::{self, Display, Formatter},
io::{self, Write},
};
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) struct StyleSpec {
pub good_style: termcolor::ColorSpec,
pub warning_style: termcolor::ColorSpec,
pub error_style: termcolor::ColorSpec,
pub ... |
use clap::{App, Arg, ArgMatches, SubCommand};
use futures::{Future, Stream};
use futures::future::result;
use futures::stream::futures_ordered;
use reqwest::{Certificate, StatusCode};
use reqwest::header::CONNECTION;
use reqwest::async::{Client as ReqwestClient};
use serde_json;
use std::collections::HashMap;
use std::... |
use crossbeam_channel::unbounded;
use nix::sys::stat::{fchmodat, FchmodatFlags, Mode};
use nix::unistd::{fchownat, FchownatFlags, Gid};
use notify::event::EventKind::*;
use notify::event::ModifyKind::*;
use notify::{Error, ErrorKind, RecommendedWatcher, RecursiveMode, Result, Watcher};
use std::collections::HashSet;
us... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.