text stringlengths 3.09k 13.9k |
|---|
use evaluation_metrics::semantic_modeling::alignment::*;
use evaluation_metrics::semantic_modeling::find_best_map::*;
use evaluation_metrics::semantic_modeling::internal_structure::*;
use evaluation_metrics::semantic_modeling::dependent_groups::*;
use algorithm::data_structure::graph::Graph;
use algorithm::combination:... |
use clap::Clap;
use gre::*;
use noise::*;
use std::f64::consts::PI;
use svg::node::element::path::Data;
use svg::node::element::*;
fn art(opts: Opts) -> Vec<Group> {
let width = 210f64;
let height = 297f64;
let perlin = Perlin::new();
let total = 16.;
let fp = opts.frame / total;
let f1x = 8.... |
use clap::load_yaml;
use crossterm::event::{self, KeyCode, KeyModifiers};
mod chess;
use chess::components::PieceType;
use chess::moves::{MoveError, MoveResult};
mod app;
mod ui;
use app::{App, AppState, GameResult};
enum UserAction {
TryPlayPositions(String, String),
TryPlaySAN(String),
SaveGame(String)... |
use chrono::{DateTime, Utc};
use console::{style, Term};
use geo::prelude::*;
use geo::simplifyvw::SimplifyVWPreserve;
use geo::{Coordinate, LineString};
use geojson::GeoJson;
use gpx::{read, Gpx, Track};
use piet_common::kurbo::{Line, Rect};
use piet_common::{Color, Device, RenderContext};
use serde_json::json;
use st... |
use crate::{bot::InnerBot, errors, types::chat};
use hyper::{
body::{Body, HttpBody},
header::HeaderValue,
http::uri::PathAndQuery,
Method, Request, Uri,
};
use serde::{de::DeserializeOwned, Deserialize};
use std::{
error::Error,
fmt::{self, Debug, Formatter, Write},
str::from_utf8,
};
use t... |
use crate::builders::CrateBuilder;
use crate::util::{ChaosProxy, FreshSchema};
use anyhow::Error;
use cargo_registry::models::{NewUser, User};
use diesel::prelude::*;
use reqwest::blocking::{Client, Response};
use std::collections::HashMap;
use std::io::{BufRead, BufReader, Read};
use std::process::{Child, Command, Std... |
//! Aid to Navigation Report (type 21)
use super::navigation::*;
use super::parsers::*;
use super::types::*;
use super::AisMessageType;
use crate::errors::Result;
use nom::bits::{bits, complete::take as take_bits};
use nom::combinator::map;
use nom::IResult;
#[derive(Debug, PartialEq)]
pub enum NavaidType {
Refere... |
//! Task scheduling facilities.
use core::input::InputScope;
use std::cmp::{max, Ordering};
use std::collections::BinaryHeap;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering::SeqCst;
use std::sync::{Arc, Condvar, Mutex};
use std::thread;
use std::time::{Duration, Instant};
/// A handle to cancel a... |
//! Locations of the code relevant to compute latency.
use ir;
use itertools::Itertools;
use model::Level;
use search_space::{Domain, Order, SearchSpace};
use std::cmp::Ordering;
use utils::*;
/// A poi t of the code that is relevant to compute latency.
#[derive(PartialEq, Eq, Hash, Debug, Clone, Copy)]
pub enum CodeP... |
//! A collection of signal filters. To filter a bunch of samples, first create the
//! filter and samples. Following that, run `convolve(filter, input)`.
//!
//! See: `examples/filters.rs`
//!
//! Common filter arguments:
//!
//! * `cutoff`: as a fraction of sample rate, can be obtained from
//! `cutoff_fro... |
use image::GenericImageView;
use common::resources;
pub struct TextureObjectBuilder {
name: Option<String>,
target: gl::types::GLenum,
wrapping: gl::types::GLenum,
mipmaps: bool,
filter_min: gl::types::GLenum,
filter_mag: gl::types::GLenum,
anisotropy: bool,
internal_format: gl::types::GLenum,
}
impl... |
//! kdirect kdhash type
use crate::*;
// multihash-like prefixes
//kDAk 6160 <Buffer 90 30 24> <-- using this for KdHash
//kDEk 6288 <Buffer 90 31 24>
//kDIk 6416 <Buffer 90 32 24>
//kDMk 6544 <Buffer 90 33 24>
//kDQk 6672 <Buffer 90 34 24>
//kDUk 6800 <Buffer 90 35 24>
//kDYk 6928 <Buffer 90 36 24>
//kDck 7056 <Buff... |
use std::{collections::HashSet, fmt, rc::Rc};
use dml::{datamodel::Datamodel, field::RelationField, model::Model, traits::WithName};
use crate::{
ast::Span,
diagnostics::{DatamodelError, Diagnostics},
transform::ast_to_dml::validate::RELATION_ATTRIBUTE_NAME,
};
/// A linked list structure for visited rel... |
use ndarray::prelude::*;
use tsuga::prelude::*;
use mnist::*;
use ndarray_stats::QuantileExt;
use rand::prelude::*;
use show_image::{make_window_full, Event, WindowOptions};
const MNIST_TYPE: &str = "fashion"; // pick "standard" or "fashion"
fn main() -> Result<(), Box<dyn std::error::Error>> {
let labels = matc... |
//! Module for Buffers created using [libgbm](gbm).
//!
//! The re-exported [`GbmDevice`](gbm::Device) implements the [`Allocator`](super::Allocator) trait
//! and [`GbmBuffer`](gbm::BufferObject) satisfies the [`Buffer`](super::Buffer) trait while also allowing
//! conversions to and from [dmabufs](super::dmabuf).
us... |
//! https://adventofcode.com/2019/day/13
use cursive::event::{Event, EventResult, Key};
use cursive::traits::*;
use cursive::{theme, Cursive, Printer};
use advent_of_code_2019::{Intcode, Result};
fn main() {
let input = include_str!("../../input/2019/day13.txt").trim();
let mut code = Intcode::parse(input);
... |
/// Day 4: https://adventofcode.com/2021/day/4
/// Copyright 2021 by <NAME>
#[path = "common.rs"] mod common;
use std::collections::HashMap;
// Local definitions:
const BOARD_SIZE: usize = 5; // Size of Bingo board = N x N
type Callout = u8; // Callout number = 0-99
type Row = Vec<Callout>; // ... |
pub mod routes;
pub mod action;
pub mod automata;
pub mod ai;
pub mod messages;
pub mod condition;
pub mod channel;
pub mod topic;
pub mod book;
pub mod link;
pub mod user;
pub mod group;
pub mod post;
pub mod task;
pub mod item;
pub mod field;
pub mod record;
use chrono::NaiveDateTime;
pub use user::{User,
sessio... |
#![deny(missing_docs)]
//! A simple labyrinth solver
//! To dive into the intricacies of Rust
//use std::thread;
//use std::sync::{Arc, Mutex};
const LSIZE: usize = 10; /// Lenght of the Labyrinth
const WALL: char = '#'; /// Identification of the WALLS
const HALL: char = 'O'; /// Identification of the HALLS
const ... |
use bytes::Bytes;
use bytes::BytesMut;
use error;
use futures::Async;
use futures::Poll;
use solicit::frame::headers::HeadersFlag;
use solicit::frame::push_promise::PushPromiseFlag;
use solicit::frame::unpack_header_from_slice;
use solicit::frame::HeadersFrame;
use solicit::frame::HttpFrame;
use solicit::frame::PushPr... |
use std::fmt::Debug;
/**
* rust-kad
* Kademlia Node Table Implementation
*
* https://github.com/ryankurte/rust-kad
* Copyright 2018 <NAME>
*/
use std::ops::Range;
use std::time::Instant;
use crate::common::{DatabaseId, Entry};
use super::kbucket::KBucket;
use super::nodetable::{BucketInfo, NodeTable};
/// KNod... |
use std::{collections::VecDeque, convert::TryFrom, path::PathBuf, sync::Arc};
use super::BackupMode;
mod file_state;
pub use file_state::*;
mod metadata_file;
pub use metadata_file::*;
#[derive(Debug, Clone)]
pub enum Event {
Added {
start: usize,
files: Vec<Arc<MetadataFile>>,
},
Change... |
// Advent of Code 2020
// Day 3
use std::collections::HashMap;
use std::fs;
#[cfg(test)]
mod test_examples {
use super::*;
// The example from part 1 of the puzzle.
#[test]
fn test_example_part1() {
let grid = "
..##.......
#...#...#..
.#....#..#.
..#.#...#.#
... |
// File: day_8.rs
// Author: <NAME>
// Date: December 2020
/*
Copyright 2020 <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... |
extern crate getopts;
extern crate rand;
use getopts::Options;
use std::collections::HashMap;
use std::env;
use std::net::UdpSocket;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::channel;
use std::thread;
use std::time::Duration;
const TIMEOUT: u64 = 3 * 60 * 100; //3 minutes... |
use super::lex::*;
use super::{AngleMode, VarMap, VariableValue};
use std::borrow::Cow;
#[derive(Debug)]
pub enum Expression {
Binary {
op: Operator,
left: Box<Expression>,
right: Box<Expression>,
},
CallExpresion {
arg: Box<Expression>,
func: String,
},
Numb... |
use std::sync::{
mpsc::{self, Receiver, Sender},
Arc, Mutex,
};
use std::thread;
use amethyst::{
config::Config,
core::{SystemDesc, Transform},
ecs::prelude::{Join, Read, ReadExpect, ReadStorage, System, SystemData, Write, WriteStorage},
prelude::*,
ui::{UiFinder, UiText},
utils::applic... |
extern crate tokenizers as tk;
use crate::utils::Container;
use neon::prelude::*;
/// Model
pub struct Model {
pub model: Container<dyn tk::tokenizer::Model + Sync>,
}
declare_types! {
pub class JsModel for Model {
init(_) {
// This should not be called from JS
Ok(Model {
... |
use anyhow::anyhow;
use reqwest::Client;
use serde::{Serialize, Deserialize};
use serde_json::{json, from_str, map::Map, Value};
use std::str::FromStr;
use std::collections::HashMap;
use super::client::get;
use super::utils::get_timestamp;
use super::constant::{
CURRENT_FORM_URL,
FORM_RENDER_DATA_URL,
MY_FOR... |
// calculations inspired by
// https://github.com/AcademySoftwareFoundation/openexr/blob/master/OpenEXR/IlmImf/ImfTiledMisc.cpp
//! Simple math utilities.
use std::convert::TryFrom;
use crate::error::{i32_to_usize};
use crate::error::Result;
/// Simple two-dimensional vector of any numerical type.
/// Supports only... |
use crate::format::problem::*;
use crate::format::solution::*;
use crate::format_time;
use crate::helpers::*;
fn create_problem_with_depots(depots: Option<Vec<VehicleCargoPlace>>) -> Problem {
Problem {
plan: Plan {
jobs: vec![create_delivery_job("job1", vec![3., 0.]), create_delivery_job("job2... |
use gjson::Value as gjValue;
use nu_plugin::{EvaluatedCall, LabeledError};
use nu_protocol::{Span, Spanned, Value};
pub fn execute_json_query(
_name: &str,
call: &EvaluatedCall,
input: &Value,
query: Option<Spanned<String>>,
) -> Result<Value, LabeledError> {
let input_string = match &input.as_stri... |
// Copyright © 2016 <NAME>
// This program is licensed under the "MIT License".
// Please see the file LICENSE in this distribution
// for license terms.
//! Directions management for Advent of Code solutions.
//!
//! To use this, make a new `GridBox` to set clipping bounds,
//! then call the `neighbors()` method of t... |
use orz::lempziv::*;
use orz::matchfinder::*;
use std;
pub struct Statistics {
pub source_size: u64,
pub target_size: u64,
}
pub fn encode(
source: &mut std::io::Read,
target: &mut std::io::Write,
cfg: &LZCfg,
) -> std::io::Result<Statistics> {
let time_start = std::time::SystemTime::now();
... |
use crate::error::object_err;
use napi::{
CallContext, JsBuffer, JsFunction, JsNumber, JsObject, JsString, JsUndefined, JsUnknown, Result,
};
use object::{self, Object, ObjectSymbol, SectionIndex, SymbolKind};
#[derive(Serialize, Deserialize)]
struct SectionInfo {
index: usize,
address: u64,
size: u64,
align... |
use std::collections::HashMap;
struct ReactionItem {
amount: i64,
item: String,
}
impl ReactionItem {
fn create_from(s: &str) -> ReactionItem {
let (amount, item) = s.split_once(' ').unwrap();
ReactionItem {
amount: amount.parse().unwrap(),
item: item.to_string(),
... |
use std::collections::HashMap;
use aoc::*;
#[derive(Clone, Debug)]
pub struct PassportProcessing(Vec<HashMap<String, String>>);
impl Fro for PassportProcessing {
fn fro(input: &str) -> Self {
input
.trim()
.split("\n\n")
.map(|line| {
line.split_whitesp... |
use ptr::GcBox;
use std::cell::Cell;
use std::collections::HashMap;
use std::ptr::NonNull;
use trace::{Trace, Tracer};
use UntypedGcBox;
use {AsTyped, AsUntyped};
/// Type-erased allocation info
#[derive(Debug, PartialEq)]
pub(crate) struct AllocInfo {
pub ptr: NonNull<UntypedGcBox>,
// unsafe is because it mu... |
use approx::assert_relative_eq;
use futures::{Future, Sink, Stream};
use std::{collections::HashMap, thread, time::Duration};
use tokio::codec::{FramedWrite, LinesCodec};
use tokio_uds::UnixStream;
use vector::test_util::{
block_on, next_addr, random_lines, receive, send_lines, shutdown_on_idle, wait_for_tcp,
};
us... |
// Copyright 2017 <NAME> aka. Luxko
//
// 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 accordi... |
#![cfg_attr(
not(test),
warn(
clippy::disallowed_method,
clippy::disallowed_type,
clippy::indexing_slicing,
clippy::todo,
clippy::unwrap_used,
clippy::panic
)
)]
#![warn(clippy::unseparated_literal_suffix)]
#![cfg_attr(not(feature = "std"), no_std)]
pub mod impls;
pub mod xcmp;
use composable_traits::or... |
pub mod primitives {
use std::fmt::Display;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct FPCoordinate {
pub lat: i32,
pub lon: i32,
}
impl FPCoordinate {
pub fn new(lat: i32, lon: i32) -> Self {
Self { lat, lon }
}
pub fn min() -> Sel... |
// Copyright 2021 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot 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) any late... |
use crate::manager::ControlContext;
use crate::manager::ManagerService;
use crate::scenario::network::single_run;
use crate::scenario::network::{endless_mode, interactive_mode, setup_network};
use crate::setup::generate::read_config;
use crate::setup::start::quick::parse_mode_from_str;
use crate::setup::start::quick::M... |
use std::collections::HashSet;
use std::fmt::Display;
use std::time::Instant;
use aoc_2021::get_input;
type Segments = Vec<char>;
fn parse_values(input: &[String]) -> Vec<(Vec<Segments>, Vec<Segments>)> {
let mut values = Vec::with_capacity(input.len());
for i in input {
let (patterns, digits) = i.s... |
use crate::Result;
use std::collections::HashMap;
use std::io::{BufRead, BufReader};
use std::path::PathBuf;
use std::process::{Command, Stdio};
use std::time::Duration;
use wait_timeout::ChildExt;
/// Executes the given command/args, returning all captured stdout and stderr lines and
/// the exit code of the process.... |
//! Constant and network/IO independent part of network-transport-tcp
use cardano::util::hex;
use std::fmt;
const PROTOCOL_VERSION: u32 = 0x00000000;
/// Light weight connection ID contains a valid NTT light weight connection
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct LightweightConnect... |
use crate::config::{multisend_address, transaction_fee};
use crate::models::{ExecutePayload, PreparePayload, PrepareResult, SafeTransaction};
use crate::providers::accounts::safe::SafeAccount;
use crate::providers::accounts::vault::{VaultAccount, VaultPayload, VaultConfigPayload, VaultConfigFee};
use crate::providers::... |
use std::mem;
use std::time;
use std::thread;
use std::sync::{Arc, Mutex, Condvar};
use std::future::Future;
use std::pin::Pin;
use std::task::{Poll, Context, Waker, RawWaker, RawWakerVTable};
type PollFn = dyn FnMut(&mut Context) -> Poll<()>;
struct WrappedFuture {
poll_fn: Box<PollFn>,
}
impl WrappedFuture {
... |
use serde::{Serialize, Deserialize};
use std::fs::File;
use std::io::{Read, Write};
use std::path::PathBuf;
use std::collections::HashMap;
use toml::Value;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum ArtifactType {
#[serde(rename = "lib")]
Lib,
#[serde(rename = "staticlib")]
St... |
use std::{cmp::Ordering, sync::Arc};
use graph::blockchain::{Block, BlockHash, MappingTrigger, TriggerData};
use graph::cheap_clone::CheapClone;
use graph::prelude::BlockNumber;
use graph::runtime::{asc_new, gas::GasCounter, AscHeap, AscPtr, DeterministicHostError};
use crate::codec;
use crate::data_source::EventOrig... |
use js_sys::WebAssembly;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use std::rc::Rc;
use web_sys::{WebGlProgram, WebGlRenderingContext, WebGlShader, WebGlUniformLocation};
use specs::{Read, ReadStorage, System};
pub struct RenderSystem {
context: Rc<WebGlRenderingContext>,
image_location: WebGlUni... |
use std::{env, error::Error};
type DynError = Box<dyn Error>;
pub mod helpers {
use std::path::{Path, PathBuf};
use crate::path;
use helix_core::syntax::Configuration as LangConfig;
use helix_term::health::TsFeature;
/// Get the list of languages that support a particular tree-sitter
/// bas... |
use crate::definitions::Image;
use crate::drawing::line::draw_line_segment_mut;
use crate::drawing::Canvas;
use crate::rect::Rect;
use image::{GenericImage, ImageBuffer};
use std::f32;
/// Draws the outline of a rectangle on a new copy of an image.
///
/// Draws as much of the boundary of the rectangle as lies inside ... |
pub mod opcode;
mod script;
pub use crate::script::*;
#[cxx::bridge]
mod ffi {
struct DecodedCashAddr {
pub kind: CashAddrType,
pub hash: Vec<u8>,
}
enum CashAddrType {
PUBKEY_TYPE = 0,
SCRIPT_TYPE = 1,
}
unsafe extern "C++" {
include!("abcd/abcdbridge.h")... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
get_available_port_from, get_random_available_port, BaseConfig, ConfigModule, StarcoinOpt,
};
use anyhow::Result;
use clap::Parser;
use serde::{Deserialize, Serialize};
use starcoin_metrics::{get_metric_from_registr... |
use crate::p2p::packet::Packet;
use crate::p2p::{node::Node, shared::Shared};
use futures::executor::block_on;
use std::net::SocketAddr;
use std::sync::Arc;
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::{mpsc, Mutex};
pub type Tx = mpsc::Sender<(Packet, Option<SocketAddr>)>;
pub type Rx = mpsc::Receiver<(... |
// Copyright 2020 Netwarps Ltd.
//
// 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, modify, merge, publish, dis... |
use crate::hlreg::HostLocalSystemService;
use crate::messagebus::{NatsMessage, NatsSubscriber};
use crate::ControlEvent;
use actix::prelude::*;
use std::collections::HashMap;
use wascap::prelude::KeyPair;
#[derive(Default)]
pub struct ControlInterface {
client: Option<nats::asynk::Connection>,
ns_prefix: Strin... |
//! A portable system for parsing and verifying enclave identity proofs.
use std::io::{Cursor, Read, Seek, SeekFrom};
use std::ops::Deref;
use std::str::FromStr;
use base64;
use byteorder::{LittleEndian, ReadBytesExt};
use serde_json;
use ekiden_common::error::{Error, Result};
use ekiden_common::hex_encoded_struct;
... |
/*
* Copyright 2020 Cargill Incorporated
*
* 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 a... |
// Wallet settings that can be configured for long-term use
use {
serde_derive::{Deserialize, Serialize},
std::{collections::HashMap, io, path::Path},
url::Url,
};
lazy_static! {
/// The default path to the CLI configuration file.
///
/// This is a [lazy_static] of `Option<String>`, the value o... |
#[macro_use]
extern crate serde;
mod test_utils;
use flexi_logger::LoggerHandle;
use hdbconnect::{Connection, HdbResult, TypeId};
use log::{debug, info};
use serde_bytes::{ByteBuf, Bytes};
#[test] // cargo test --test test_046_spatial
fn test_046_spatial() -> HdbResult<()> {
let mut loghandle = test_utils::init_... |
// Adapted and modified from https://github.com/hibariya/pty-rs
//
// The MIT License (MIT)
//
// Copyright (c) 2015 <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 restr... |
// Take a look at the license at the top of the repository in the LICENSE file.
use crate::prelude::*;
use crate::{Display, Key, KeymapKey, ModifierType};
use glib::translate::*;
use glib::IsA;
use std::{mem, ptr};
#[derive(Debug, PartialEq, Eq, Ord, PartialOrd)]
pub enum Backend {
Wayland,
X11,
Win32,
... |
use std::convert::TryFrom;
use std::ffi::c_void;
use std::sync::Arc;
use crate::Context;
use wasmer::{
Export, Exportable, Function, FunctionType, RuntimeError, Store, Type as WasmerType, Val,
};
use svm_ffi::{svm_byte_array, svm_env_t, svm_func_callback_t};
use svm_types::{Type, WasmType, WasmValue};
static WA... |
#![warn(clippy::all)]
mod attrs;
use self::attrs::get_helper_attr;
use proc_macro::TokenStream;
use proc_macro2::Ident;
use proc_macro2::TokenStream as TokenStream2;
use quote::quote;
use std::path::PathBuf;
use syn::parse_macro_input;
use syn::spanned::Spanned;
use syn::Attribute;
use syn::Data;
use syn::DataStruct;... |
use crate::controllers::frontend_prelude::*;
use crate::github;
use conduit_cookie::RequestSession;
use failure::Fail;
use oauth2::{prelude::*, AuthorizationCode, TokenResponse};
use crate::middleware::current_user::TrustedUserId;
use crate::models::{NewUser, User};
use crate::schema::users;
use crate::util::errors::... |
use actix_web::{HttpRequest, HttpResponse, Result};
use actix_web::middleware::{Middleware, Started, Finished};
use actix_web::http::header::{HeaderValue, AUTHORIZATION};
use jwt::{decode, Validation};
use app::{AppState,Claims};
use errors::ApiError;
pub trait ClaimsValidator {
fn get_claims(&self) -> Option<Cla... |
use rusty_v8 as v8;
use std::convert::TryFrom;
// This is created in build.rs and is all the required js code added into
// a byte array
include!(concat!(env!("OUT_DIR"), "/js_startup_code.rs"));
// TODO: Handle errors properly
pub struct FortunaIsolate {
isolate: v8::OwnedIsolate,
global_context: v8::Global... |
use crate::num::PrimIntExt;
pub use nom::{
branch::alt,
bytes::complete::{tag, take, take_while1},
character::complete::{alpha1, anychar, char, one_of},
combinator::{map, map_opt, map_res, not, opt},
multi::{fold_many0, fold_many1, fold_many_m_n, many0, many1, separated_list1},
sequence::{pair, ... |
use std::cmp::Ordering;
use std::mem;
use std::option::Option::Some;
pub struct Ref(usize);
struct Node<K, V> {
key: K,
value: Option<V>,
rank: usize,
second_parent: Option<usize>,
first_child: Option<usize>,
next_sibling: Option<usize>,
}
impl<K, V> Node<K, V> {
fn new(key: K, value: V) ... |
extern crate cgmath;
#[macro_use]
extern crate clap;
extern crate collision;
extern crate futures;
extern crate grpcio;
extern crate point_viewer;
extern crate point_viewer_grpc;
extern crate protobuf;
use cgmath::Point3;
use collision::Aabb3;
use futures::{stream, Future, Sink};
use futures::sync::oneshot;
use grpcio... |
use crate::common::HasLen;
use crate::docset::DocSet;
use crate::positions::PositionReader;
use crate::postings::compression::COMPRESSION_BLOCK_SIZE;
use crate::postings::serializer::PostingsSerializer;
use crate::postings::BlockSearcher;
use crate::postings::Postings;
use crate::schema::IndexRecordOption;
use crat... |
// The following definitions are correct for aarch64 and x86_64,
// but may be wrong for mips64
pub type c_long = i64;
pub type c_ulong = u64;
pub type mode_t = u32;
pub type off64_t = i64;
pub type socklen_t = u32;
s! {
pub struct sigset_t {
__val: [::c_ulong; 1],
}
pub struct sigaction {
... |
// Copyright 2022 <NAME>.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writ... |
use crate::{DataTypeOffset, DataTypePartition, IngestError};
use serde_json::Value;
use std::collections::HashMap;
/// Provides a single interface into the multiple [`ValueBuffer`] instances used to buffer data for each assigned partition.
#[derive(Debug, Default)]
pub(crate) struct ValueBuffers {
buffers: HashMap... |
use anyhow::Result;
use chrono::{Duration, Local};
use std::fs::OpenOptions;
use structopt::StructOpt;
use tokio::sync::mpsc;
use tokio::time::sleep;
mod center;
mod db;
mod district;
mod network;
mod notification;
mod state;
use center::CentersResponse;
use network::{get_centers, get_districts, get_states, prepare_c... |
use crate::modifier::StatModifier;
use core::mem::MaybeUninit;
// by default (single-threaded) implementation is most optimized by using std::rc
// if one needs Stat to live in a multithreaded environment, enabling sync feature uses std::sync instead
#[cfg(not(feature = "sync"))]
type ReferenceCounted<T> = std::rc::Rc... |
// 2015-edition macros.
#[macro_use]
extern crate clap;
use std::fs;
use std::io::Read;
use std::io::Write;
use structopt::StructOpt;
mod checks;
mod config;
mod git;
mod report;
#[derive(Debug, StructOpt)]
#[structopt(
setting = structopt::clap::AppSettings::UnifiedHelpMessage,
setting = structopt::clap::A... |
use std::io::ErrorKind;
use std::net::{IpAddr, Ipv4Addr, SocketAddr, TcpListener, TcpStream};
use std::sync::{Arc, Mutex};
use std::thread;
use std::time::{Duration, SystemTime};
use crossbeam_channel::{Receiver, Sender};
use mpb::MPB;
use rayon::ThreadPool;
use uuid::Uuid;
use util::*;
use crate::cluster::peer::{Pe... |
use proc_macro2::{Ident, Span, TokenStream};
use quote::quote;
use quote::ToTokens;
use syn::DeriveInput;
pub(crate) fn impl_crud(input: crate::proc_macro::TokenStream, db_type: Vec<Vec<TokenStream>>) -> crate::proc_macro::TokenStream {
let driver_token = gen_driver_token(input.to_string());
let ast: DeriveInp... |
use boot_node::config::BootNodeConfigSerialization;
use crate::exec::{CommandLineTestExec, CompletedTest};
use clap::ArgMatches;
use clap_utils::get_eth2_network_config;
use lighthouse_network::discovery::ENR_FILENAME;
use lighthouse_network::Enr;
use std::fs::File;
use std::io::Write;
use std::net::{Ipv4Addr, UdpSock... |
use crate::nats_client::{NatsClient, NatsClientOptions};
use futures::{
Future,
sync::mpsc,
};
use crate::nuid::NUID;
use parking_lot::RwLock;
use std::{
collections::HashMap,
sync::{
Arc,
atomic::AtomicBool,
},
};
mod client;
mod subscription;
// DefaultConnectWait is the default t... |
//! Create cryptographic signatures for files and verify them.
//!
//! This is based on [signify], the OpenBSD tool to sign and verify signatures on files.
//! It is based on the [Ed25519 public-key signature system][ed25519] by Bernstein et al.
//!
//! `libsignify` can verify and create signatures that are interoperab... |
//! Module with traits for parsing a formatted string into a number.
//!
//! # Examples
//! ```
//! use num_format::Locale;
//! use num_format::parsing::ParseFormatted;
//!
//! fn main() {
//! let s = "1,000,000";
//! let n = s.parse_formatted::<_, u32>(&Locale::en).unwrap();
//! assert_eq!(n, 1_000_000);
/... |
use std::time::{Duration, Instant};
use std::{fs, process};
use similar::{ChangeTag, TextDiff};
use unidok_repr::config::Config;
const RED: &str = "\u{001b}[0;31m";
const YELLOW: &str = "\u{001b}[0;33m";
const GREEN: &str = "\u{001b}[0;32m";
const CYAN: &str = "\u{001b}[0;36m";
const BOLD: &str = "\u{001b}[1m";
const... |
#![feature(decl_macro)]
#![feature(never_type)]
#![feature(try_blocks)]
use std::fs::{read_to_string, OpenOptions};
use std::io::Write;
use std::net::{IpAddr, SocketAddr};
use std::path::Path;
use std::process::exit;
use std::str::FromStr;
use std::sync::Arc;
use std::time::Duration;
use axum::http::HeaderValue;
use ... |
use crate::*;
use db::DatabaseCidr;
use dialoguer::{theme::ColorfulTheme, Input};
use indoc::printdoc;
use rusqlite::{params, Connection};
use shared::{
prompts::{self, hostname_validator},
CidrContents, PeerContents, PERSISTENT_KEEPALIVE_INTERVAL_SECS,
};
use wgctrl::KeyPair;
fn create_database<P: AsRef<Path>... |
const BEACON_CIPHERS_PACKET: [u8; 140] = [
0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x0c, 0x41, 0x82, 0xb2, 0x55,
0x00, 0x0c, 0x41, 0x82, 0xb2, 0x55, 0x50, 0xf8, 0x89, 0xf1, 0xd4, 0x1b, 0x01, 0x00, 0x00, 0x00,
0x64, 0x00, 0x11, 0x04, 0x00, 0x07, 0x43, 0x6f, 0x68, 0x65, 0x72, 0x65, 0x72, 0... |
//! Device implementation
use crate::{Calibration, DynamicSetting, Error, IntegrationTime, Measurement, Mode, Veml6075};
use embedded_hal::blocking::i2c::{Write, WriteRead};
struct Register;
impl Register {
const CONFIG: u8 = 0x00;
const UVA: u8 = 0x07;
const UVB: u8 = 0x09;
const UVCOMP1: u8 = 0x0A;
... |
use crate::hyper_rectangle::HyperRectangle;
use crate::point::{get_range, Point};
use crate::quickselect::median;
use rand::Rng;
#[derive(PartialEq, Debug)]
pub struct Tree<const M: usize> {
/// Hyper-rectangle boundaries
pub h: HyperRectangle<M>,
/// Number of points in contained leaf nodes
pub numbe... |
use std::fs;
use std::collections::HashMap;
use std::cmp;
mod intcode;
enum Direction {
North,
East,
South,
West
}
impl Into<i64> for &Direction {
fn into (self) -> i64 {
match self {
Direction::North => 1,
Direction::East => 4,
Direction::South => 2,
... |
#![allow(non_camel_case_types)]
use gclk::*;
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum ClockSource {
XOSC = 0x00,
GCLKIN = 0x01,
GCLKGEN1 = 0x02,
OSCULP32K = 0x03,
OSC32K = 0x04,
XOSC32K = 0x05,
OSC8M = 0x06,
DFLL48M = 0x07,
FDPLL96M = 0x08,
}
#[derive(Debug, PartialEq... |
//! Main `Core` abstraction.
//! Exposes an append-only, single-writer, secure log structure.
use anyhow::{Result, ensure, bail};
use std::error::Error;
use std::fmt::Debug;
use futures_lite::future::zip;
use crate::store_data::StoreData;
use crate::store_blocks::StoreBlocks;
use crate::store_state::StoreState;
use c... |
use aoc_runner_derive::{aoc, aoc_generator};
use std::{cmp::max, num::ParseIntError};
type Mana = usize;
type GameResult = Result<GameState, Outcome>;
pub enum Spell {
MagicMissile,
Drain,
Shield,
Poison,
Recharge,
}
const SPELLS: [Spell; 5] = [
Spell::MagicMissile,
Spell::Drain,
Spel... |
use amethyst::assets::ProgressCounter;
use asset_loading::YamlFormat;
use asset_model::{config::AssetType, loaded::AssetId};
use loading_model::loaded::LoadStage;
use loading_spi::{AssetLoadingResources, DefinitionLoadingResources};
use log::debug;
use object_type::ObjectType;
#[cfg(target_arch = "wasm32")]
use wasm_su... |
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
use std::path::PathBuf;
use clap::{
crate_authors, crate_description, crate_name, crate_version, App, AppSettings, Arg, ArgMatches,
SubCommand,
};
#[derive(Debug, Clone)]
pub enum ProgramMode {
Receiving(ReceivingModeData),
Sending(SendingModeData),
}
#[derive(Debug, C... |
use vcell::VolatileCell;
use crate::esm;
use crate::esm_ch::EsmError;
#[repr(C)]
pub struct Efc {
instruction: VolatileCell<u32>, // 0x0 INSTRUCTION AN DUMPWORD REG.
address: VolatileCell<u32>, // 0x4 ADDRESS REG.
data_upper: VolatileCell<u32>, // 0x8 DATA UPPER REG.
data_lower: ... |
use crate::impl_prelude::*;
use crate::rc_string::RcString;
use crate::utils;
use crate::utils::json::{self, Value};
use std::borrow::Cow;
use std::str::FromStr;
#[derive(Debug)]
struct GeneratorState<'json> {
file_data: &'json json::Value,
description: Vec<RcString>,
words: Vec<Cow<'json, str>>,
current_enti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.