text stringlengths 3.09k 13.9k |
|---|
#[macro_use]
extern crate clap;
use clap::{load_yaml, App, AppSettings::ColoredHelp, AppSettings::SubcommandRequired, ArgMatches};
use colored::Colorize;
use generator::{Generator, GeneratorBuilder};
use once_cell::sync::Lazy;
use parser::parse;
use std::fs::{create_dir, remove_dir, File};
use std::path::Path;
use std... |
extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
use std::collections::HashMap;
#[wasm_bindgen]
#[derive(Clone, Debug)]
pub struct VariableMesh {
px: Vec<f64>,
py: Vec<f64>,
pdx: Vec<f64>,
pdy: Vec<f64>,
field_values: HashMap<String, Vec<f64>>,
}
#[derive(Clone, Debug, Copy)]
pub struct V... |
use itertools::Itertools;
use std::cmp::{Ord, Ordering};
use std::collections::hash_map::{Entry, HashMap};
use std::fmt::Debug;
use std::hash::Hash;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct LayoutRect {
pub width: usize,
pub height: usize,
}
pub struct AutoLayout<K, V> {
layout_cell: LayoutRect,
... |
extern crate jni_sys;
#[macro_use]
extern crate log;
extern crate env_logger;
mod jvmti_sys;
mod manip;
mod util;
pub mod bytecode;
pub mod native;
use jni_sys::{JavaVM, jint, jclass, jobject, JNIEnv, JNI_OK};
use jvmti_sys::{jvmtiEnv, JVMTI_VERSION, jvmtiEventCallbacks, jvmtiCapabilities, jvmtiEventMode, jvmtiEvent,... |
use std::{collections::HashMap, net::ToSocketAddrs};
use async_trait::async_trait;
use serde::de::DeserializeOwned;
use crate::{ApiRequest, DateTime, Result, errors::Error, exchange::*};
use chrono::prelude::Utc;
use sha2::{Digest, Sha256, Sha512};
use data_encoding::{BASE64};
use hmac::*;
use crate::rfc1123_date_form... |
//! # Getting Started
//! ```
//! use siyo::clock::*;
//!
//! // Print current Local time and UTC time.
//! let clock = Clock::new();
//! println!("Local: {}", clock);
//! println!("UTC: {:?}", clock);
//!
//! // Print 'Hello, world #!' every 1/3 seconds
//! /* let mut a = 0;
//! loop {
//! let now = Clock::new()... |
use crate::util::{Error, Result, Serializable};
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use ring::digest;
use std::fmt;
use std::io;
use std::io::{Cursor, Read, Write};
use std::str;
/// Header that begins all messages
#[derive(Default, PartialEq, Eq, Hash, Clone)]
pub struct MessageHeader {
//... |
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
use ::value::Value;
use once_cell::sync::Lazy;
use regex::Regex;
use vrl::prelude::*;
fn ip_subnet(value: Value, mask: Value) -> Resolved {
let value: IpAddr = value
.try_bytes_utf8_lossy()?
.parse()
.map_err(|err| format!("unable to parse IP add... |
//! Fe semantic analysis.
//!
//! This library is used to analyze the semantics of a given Fe AST. It detects
//! any semantic errors within a given AST and produces a `Context` instance
//! that can be used to query contextual information attributed to AST nodes.
pub mod errors;
pub mod namespace;
mod traversal;
use... |
//! This module provides the [`print()`] function, which takes an instance of
//! [`Screen`], and writes the required text (including ANSI escape codes) to
//! display it.
mod grid;
mod strings;
pub mod styles;
use crate::config::{self, ColorsWhen};
use std::env;
use std::io::{self, Write};
use std::num::NonZeroUsize... |
use std::collections::HashSet;
fn main() {
const INPUT: &str = include_str!("../inputs/8.txt");
// const INPUT: &str = "
// be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe
// edbfga begcd cbg gc gcadebf fbgde acbgfd abcde gfcbed gfec | fcgedb cgb dgebacf gc
... |
use ic_interfaces::transport::{AsyncTransportEventHandler, Transport};
use ic_logger::{info, ReplicaLogger};
use ic_protobuf::registry::node::v1::NodeRecord;
use ic_types::transport::{
FlowId, FlowTag, TransportClientType, TransportErrorCode, TransportPayload,
};
use ic_types::{NodeId, RegistryVersion};
use std::c... |
use std::collections::{HashMap, HashSet};
use std::path::Path;
use std::path::PathBuf;
use std::time::Instant;
use indicatif::{HumanDuration, ProgressBar, ProgressStyle};
use log::{debug, info};
use super::{config, env, MercurialRepo, RepositorySavedState, TargetRepository};
use crate::error::ErrorKind;
use crate::gi... |
use hyper::{
header::InvalidHeaderValue, http::Error as HttpError, Error as HyperError, StatusCode,
};
use serde::Deserialize;
use serde_json::Error as SerdeError;
use std::{error::Error as StdError, fmt};
use url::ParseError;
/// The API response was of the form `{ "error": ... }`
#[derive(Debug, Deserialize)]
pu... |
use super::utility::*;
use super::*;
use std::ptr;
use std::sync::Arc;
unsafe impl Send for Device {}
unsafe impl Sync for Device {}
pub struct Device {
pub(crate) api: Arc<Api>,
pub(crate) handle: k4a_device_t,
}
#[derive(Copy, Clone, Default)]
pub struct ColorControlCapabilities {
supports_auto: bool,
... |
use std::collections::HashMap;
use crate::operations::{normalize_operation, OpKind};
use crate::semantics::NzEnv;
use crate::semantics::{Binder, Closure, Hir, HirKind, Nir, NirKind, TextLit};
use crate::syntax::{ExprKind, InterpolatedTextContents};
pub fn apply_any<'cx>(f: &Nir<'cx>, a: Nir<'cx>) -> NirKind<'cx> {
... |
use chrono::prelude::*;
use nom::{
branch::alt,
bytes::complete::tag,
character::complete::{multispace0, newline, space0},
combinator::{map, opt, verify},
multi::many0,
sequence::{delimited, preceded, separated_pair, tuple},
IResult,
};
use crate::parsers::*;
const LOGS_SECTION_NAME: &str ... |
use std::io::Read;
use std::io::Write;
use std::net::TcpListener;
use std::net::TcpStream;
use std::sync::Arc;
use std::sync::mpsc;
use std::sync::mpsc::Receiver;
use std::sync::mpsc::Sender;
use std::sync::Mutex;
use std::thread;
use std::time::Instant;
use crate::app::Color;
use crate::network::Network;
use crate::r... |
use std::io::Write;
use crossterm::{
cursor, handle_command, queue,
style::{Color, Print, ResetColor, SetBackgroundColor, SetForegroundColor},
terminal::{self, Clear, ClearType},
Result,
};
pub const SELECTED_BG_COLOR: Color = Color::Rgb {
r: 80,
g: 80,
b: 80,
};
pub const ENTRY_COLOR: Col... |
#![windows_subsystem = "windows"]
use crate::server::{post_request_to_server, PostRequestType, ResponsePayload, ServerState};
use anyhow::Result;
use iced::{
alignment, button, clipboard, executor, window, Alignment, Application, Button, Color, Column,
Command, Element, Length, Row, Settings, Text,
};
use std:... |
use std::collections::HashMap;
use super::utils::map::{CardinalDirection, Point2D, Quadrant2D};
#[derive(Copy, Clone, Hash, PartialEq, Eq)]
enum TrackSegment {
Vertical,
Horizontal,
Intersection,
Continue,
}
#[aoc_generator(day19)]
fn generate_input(input: &str) -> (HashMap<Point2D, TrackSegment>, Ha... |
// 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 in the LICENSE-APACHE file or at:
// https://www.apache.org/licenses/LICENSE-2.0
//! Window widgets
use crate::dir::Directional;
use crate:... |
use crate::st::{StaticParams, StaticWheelDef, StaticHandle};
use core::task::{Context, Poll};
use core::mem::MaybeUninit;
use core::future::Future;
use core::pin::Pin;
#[macro_export]
macro_rules! static_config {
(@impl_clr $e:expr) => {()};
(@impl_cnt ) => { 0 };
(@impl_cnt $($e:expr),+) => {
[$(... |
use libc::{c_char, c_int};
use crate::expat_external_h::XML_Char;
use crate::lib::xmltok::{
XmlUtf16Encode,
XmlEncoding,
XmlEncodingImpl,
XML_TOK,
};
use crate::lib::xmltok_impl::XmlTokImpl;
use crate::xmltok_impl_h::ByteType;
use crate::lib::xmlparse::{ExpatBufRef, XML_ENCODE_MAX};
#[cfg(target_endian... |
use std::sync::Arc;
use tokio::io::{Error as IoError, ErrorKind, Result as IoResult};
use tokio_rustls::{
rustls::{
AllowAnyAnonymousOrAuthenticatedClient, AllowAnyAuthenticatedClient, NoClientAuth,
RootCertStore, ServerConfig,
},
server::TlsStream,
};
use crate::listener::{Acceptor, Liste... |
#[macro_use]
extern crate failure;
extern crate hyper;
extern crate hyper_tls;
#[macro_use]
extern crate serde_derive;
extern crate clap;
extern crate futures;
extern crate serde;
extern crate serde_json;
extern crate toml;
use clap::{App, Arg};
use data::{Config, MRRequest, ProjectResponse};
use failure::Error;
use f... |
use core::cmp::Ordering;
use alloc::vec::Vec;
use necsim_core::cogs::{MathsCore, RngCore};
use necsim_core_bond::{ClosedUnitF64, NonNegativeF64};
#[allow(clippy::module_name_repetitions)]
#[allow(non_snake_case)]
#[derive(Clone, Debug, TypeLayout)]
#[repr(C)]
pub struct AliasMethodSamplerAtom<E: Copy + PartialEq> {
... |
use std::marker::PhantomData;
use xilinx_dma::AxiDmaAsync;
use xilinx_dma::DmaBuffer;
use crate::anyhow::Result;
use crate::runtime::buffer::zynq::BufferEmpty;
use crate::runtime::buffer::zynq::BufferFull;
use crate::runtime::buffer::zynq::ReaderH2D;
use crate::runtime::buffer::zynq::WriterD2H;
use crate::runtime::As... |
//! Contains types to define keyboard related events.
//!
//! The naming and conventions follow the UI Events specification
//! but this crate should be useful for anyone implementing keyboard
//! input in a cross-platform way.
use std::fmt;
pub use code::Code;
pub use key::Key;
pub use location::Location;
pub use mo... |
extern crate bear_lib_terminal;
extern crate common;
#[cfg(debug_assertions)]
extern crate libloading;
#[cfg(not(debug_assertions))]
extern crate state_manipulation;
#[cfg(debug_assertions)]
use libloading::Library;
use bear_lib_terminal::terminal::{self, config, Event, KeyCode, state};
use bear_lib_terminal::Color... |
use std::{
path::PathBuf,
sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
time::Duration,
};
use anyhow::Context;
use ffmpeg_next::{decoder::Video, format::Pixel, frame, media::Type, software::scaling};
use slog_scope::{info, warn};
use crate::{
message_socket::{MessageClient, Mess... |
// - STD
use std::io::Cursor;
use std::io::Read;
use std::collections::HashMap;
// - internal
use crate::{
Result,
HeaderCoding,
ValueEncoder,
ValueDecoder,
ZffError,
ZffErrorKind,
};
use crate::{
HEADER_IDENTIFIER_DESCRIPTION_HEADER,
ENCODING_KEY_CASE_NUMBER,
ENCODING_KEY_EVIDENCE_NUMBER,
ENCODING_KEY_EXAMI... |
// 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 crate::{
math::*, Bounded, BoundingBox, DefaultPrimitive, DefaultSkinnable, DefaultTransformable,
GeometryHitResult, Intersectable, Ray,
};
#[derive(Debug, Clone)]
pub struct ParabolaXY {
extremum_point: Point3,
focus_point: Point3,
pr: FloatType,
}
impl Intersectable for ParabolaXY {
type... |
use super::galois::{EXP8, GF8};
use super::BlockInfo;
use crate::util::qr::QRError;
use std::ops::{Div, Mul, Sub};
pub fn correct(block: Vec<u8>, block_info: &BlockInfo) -> Result<Vec<u8>, QRError> {
correct_with_error_count(block, block_info).map(|r| r.0)
}
pub fn correct_with_error_count(
mut block: Vec<u... |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
//! Protocol-agnostic types for smithy-rs.
#![warn(
missing_docs,
rustdoc::missing_crate_level_docs,
missing_debug_implementations,
rust_2018_idioms,
unreachable_pub
)]
use std::co... |
use std::io::Write;
use byteorder::{LittleEndian, WriteBytesExt};
use std::io::Error;
pub use ::parser::plugin::Plugin;
pub use ::parser::records::MUSC;
fn write_ident(writer: &mut Write, ident: &str) {
writer.write(ident.as_bytes()).unwrap();
}
fn write_zstring(writer: &mut Write, xxxx: bool, zstri... |
use iced::{Align, button, Button, Element, Length, Row, scrollable, Scrollable, Text, text_input, TextInput};
use crate::central_ui;
use crate::puzzle_backend;
use std::rc::Rc;
use std::cell::RefCell;
pub struct CluesBrowser {
pub backend: Rc<RefCell<puzzle_backend::Puzzle>>,
pub a_clues: Vec<ClueEntry>,
... |
use crate::key;
use crate::value::*;
use chain_crypto::{Ed25519Extended, PublicKey};
use imhamt::{Hamt, InsertError, UpdateError};
use std::collections::hash_map::DefaultHasher;
pub type AccountAlg = Ed25519Extended;
/// Possible errors during an account operation
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Ledge... |
use crate::{
c_api::{self, nctree_create, NCRESULT_ERR},
error, error_ref_mut,
widgets::{NcTree, NcTreeItem, NcTreeOptions},
NcError, NcInput, NcPlane, NcResult,
};
/// # `NcTree` constructors & destructors
impl NcTree {
/// Creates an [NcTree] with the specified options.
///
/// *C style f... |
// Copyright 2019 Parity Technologies (UK) Ltd.
// This file is part of substrate-subxt.
//
// subxt 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) an... |
use std::time::Duration;
use crossbeam_channel::Receiver;
use tracing::{error, info, trace, warn};
use crate::{
chain::handle::{ChainHandle, ChainHandlePair},
link::{Link, LinkParameters, RelaySummary},
object::Packet,
telemetry,
telemetry::Telemetry,
util::retry::{retry_with_index, RetryResul... |
//! # General-Purpose file loader
//!
//! This is the original entry point to the FDB loading API. A [`SchemaLoader`] wraps
//! an implementation of [`BufRead`] and loads the data from the file into an
//! instance of [`Schema`].
//!
//! This uses the methods defined in the `reader` module and produces the data
//! str... |
use crate::command::{Command, ExecutionContext};
use crate::utils::paths;
use certificate::{KeyCertPair, NewCertificateConfig};
use std::{
fs::{File, OpenOptions},
io::prelude::*,
path::Path,
};
use tedge_config::*;
use tedge_users;
use super::error::CertError;
/// Create a self-signed device certificate
... |
//! `AstIdMap` allows to create stable IDs for "large" syntax nodes like items
//! and macro calls.
//!
//! Specifically, it enumerates all items in a file and uses position of a an
//! item as an ID. That way, id's don't change unless the set of items itself
//! changes.
use std::{
any::type_name,
fmt,
ha... |
use crate::Result;
/// Send notifications
pub(crate) fn notify(title: &str, msg: &str) -> Result<()> {
std::process::Command::new("notify-send")
.args(&["-t", "10000", title, msg])
.spawn()?;
Ok(())
}
/// Interactively select one of the given items within the TUI
#[allow(unused)]
pub(crate) fn... |
use failure::Error;
use serde::{Deserialize, Serialize};
use serde_bencode::de;
use serde_bytes::ByteBuf;
use serde_urlencoded;
use sha1::Sha1;
use rand::Rng;
use crate::torrent::Torrent;
use reqwest;
use percent_encoding::percent_encode_byte;
use itertools::Itertools;
#[derive(Serialize, Debug, PartialEq)]
pub... |
use geom::{CornerRadii, Distance, Polygon, Pt2D};
use crate::{
Button, Choice, Color, ControlState, CornerRounding, EdgeInsets, EventCtx, GeomBatch, GfxCtx,
Menu, Outcome, ScreenDims, ScreenPt, ScreenRectangle, WidgetImpl, WidgetOutput,
};
pub struct Dropdown<T: Clone> {
current_idx: usize,
btn: Butto... |
//! Mocks a sysenter and sysexit pair, as well as handling necessary interrupts.
use log::*;
use riscv::register::*;
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
pub struct VMMContextPriv {
pub vsstatus: usize,
pub vsie: usize,
pub vstvec: usize,
pub vsscratch: usize,
pub vsepc: usize,
pu... |
//! Runtime statistics.
use error::P25Error;
/// Tracks stats for an error correction code.
#[derive(Copy, Clone)]
pub struct CodeStats {
/// Number of symbols per word.
///
/// TODO: make this a const-generic or similar.
pub size: usize,
/// Total number of received words.
pub words: usize,
... |
// Copyright 2021 The Fuchsia 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 bitflags::bitflags;
use crate::config::AudioGatewayFeatureSupport;
bitflags! {
/// Bitmap defined in HFP v1.8, Section 4.35.1 for use with the "+... |
// Copyright 2012 Google Inc. All Rights Reserved.
// Copyright 2017 The Ninja-rs Project Developers. All Rights Reserved.
//
// 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:/... |
// Copyright 2020 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
use crate::util::prepend_stmts;
use ast::*;
use scoped_tls::scoped_thread_local;
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
};
use swc_common::{
errors::{ColorConfig, Handler},
FileName, FilePathMapping, Fold, FoldWith, Mark, SourceMap, Span, DUMMY_SP,
};
use swc_ecma_parser::{Parser, Session... |
use std::fmt;
use std::rc::Rc;
use gimli::{AttributeValue, DebuggingInformationEntry, DwAt, DwTag, Dwarf, Reader, ReaderOffset, Unit, UnitOffset};
// My own convenience wrapper around gimli::DebuggingInformationEntry, which has two problems:
// 1. It has complicated lifetimes because it borrows from Unit and Abbrevi... |
use crate::prelude::*;
mod cnode;
mod endpoint;
mod interrupt;
mod monitor;
mod nullcap;
mod ram;
mod reply;
mod tcb;
mod traits;
mod untyped;
mod vtable;
use core::cell::Cell;
use core::marker::PhantomData;
use core::num::NonZeroUsize;
use core::ptr::NonNull;
pub use cnode::*;
pub use endpoint::*;
pub use interrupt:... |
// 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... |
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
use std::ptr;
use std::mem;
use winapi::shared::{ntdef, minwindef, ntstatus};
use heim_common::prelude::*;
use heim_common::sys::windows as ntdll;
use super::get_system_info;
#[repr(C)]
pub struct SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
... |
// Copyright 2021 Developers of the Rand 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 distributed
/... |
use super::elfcode::{Opcode, Registers};
use crate::input::Input;
use std::collections::HashSet;
struct Sample {
registers_before: Registers,
instruction: [u16; 4],
registers_after: Registers,
}
struct ProblemInput {
pub samples: Vec<Sample>,
pub program: Vec<Vec<u16>>,
}
impl ProblemInput {
... |
use crate::{
app::StatusOr,
audio::AudioPlayer,
control::{
ControlEvent,
Controller,
ControllerId,
},
dimensions::{
Attack,
time::DeltaTime
},
enemies::{
DamageTextWriter,
Enemy,
EnemyId,
EnemySystemConfig,
Enemy... |
use super::*;
use std::marker::PhantomData;
use winit::event_loop::EventLoopWindowTarget;
/// Represents an OpenGL [`Context`].
///
/// A [`Context`] is normally associated with a single Window, however
/// [`Context`]s can be *shared* between multiple windows or be headless.
///
/// If a [`Context`] is backed by a w... |
use crate::clock::GenericClockController;
use crate::gpio::v1;
use crate::gpio::v2::*;
use crate::hal::adc::{Channel, OneShot};
use crate::target_device::{adc, ADC, PM};
pub struct Adc<ADC> {
adc: ADC,
}
impl Adc<ADC> {
pub fn adc(adc: ADC, pm: &mut PM, clocks: &mut GenericClockController) -> Self {
p... |
mod history;
mod state;
use futures::StreamExt;
use history::History;
use libp2p::{
core::upgrade,
floodsub::{Floodsub, FloodsubEvent, Topic},
identity::{self},
mdns::{Mdns, MdnsConfig, MdnsEvent},
mplex,
noise::{Keypair, NoiseConfig, X25519Spec},
swarm::NetworkBehaviourEventProcess,
tc... |
use crate::methods::SelfKind;
use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::ty::is_copy;
use rustc_lint::LateContext;
use rustc_middle::ty::TyS;
use rustc_span::source_map::Span;
use std::fmt;
use super::WRONG_PUB_SELF_CONVENTION;
use super::WRONG_SELF_CONVENTION;
#[rustfmt::skip]
const CONVENT... |
use either;
use flate2;
use tar;
use zip;
use crate::file::error::*;
use either::Either;
use std::fs;
use std::io;
use std::path;
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ArchiveFormat {
Tar(Option<Compression>),
Plain(Option<Compression>),
Zip,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Comp... |
use std::io;
use image::{png::PngEncoder, ColorType, ImageBuffer, ImageError, Rgb, RgbImage};
use hsl::HSL;
use nibbler::Nibbler;
mod hsl;
mod nibbler;
pub struct Identicon<'a> {
source: &'a [u8],
size: u32,
mode: Mode,
background: Rgb<u8>,
}
impl<'a> Identicon<'a> {
pub fn new(source: &[u8]) -... |
use anyhow::{anyhow, Error, Result};
use serde::{Deserialize, Serialize};
use std::ops;
/// Simple wrapper type to hold decimals value as fixed-point, as I refuse to perform financial
/// calculations on floating-point numbers.
///
/// There was nothing said about how big amount can be, so I chose 64-bits as fairly sa... |
// Declare modules for our other files.
//
// Note: if you're looking at this code having just finished Chapter 2 of
// the book, you won't have learned about modules yet.
//
// Don't fret - they're a simple feature of the Rust language which allows us
// to break our code up so it's not all in one enormous file.
//
//... |
use std::error::Error;
use std::str::FromStr;
use kuchiki::traits::TendrilSink;
use kuchiki::NodeRef;
use regex::Regex;
use crate::currency::conversion::CurrencyConversion;
use crate::database::items::Item;
use crate::http::get_client;
use crate::modules::NotFoundError;
mod base;
mod info;
#[derive(Clone)]
pub(crat... |
extern crate vulkano;
extern crate vulkano_win;
extern crate winit;
use std::sync::Arc;
use winit::{EventsLoop, WindowBuilder, dpi::LogicalSize, Event, WindowEvent};
use vulkano::instance::{
Instance,
InstanceExtensions,
ApplicationInfo,
Version,
layers_list,
PhysicalDevice,
};
use vulkano::i... |
use num_traits::{
self,
Bounded,
One,
Zero,
cast::{
NumCast,
AsPrimitive,
},
};
use crate::traits::{
YololOps,
ArgBounds,
};
mod ops;
mod conversions;
mod serde_impl;
/// The single canonical definition of how many decimals places exist in a `YololN... |
/*
* Copyright (c) 2016-2018 Boucher, Antoni <<EMAIL>>
*
* 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, mod... |
use super::super::curve::*;
use super::super::basis::*;
use super::super::super::geo::*;
use super::super::super::line::*;
use smallvec::*;
use roots::{find_roots_cubic, find_roots_quadratic, Roots};
///
/// Solves the roots for a set of cubic coefficients
///
#[inline]
fn solve_roots(p: (f64, f64, f64, f64)) -> Root... |
use crate::{
input, state,
view::{self, bold},
};
use std::convert::TryFrom;
use tui::{
layout,
text::{self, Span, Spans, Text},
widgets::TableState,
};
use std::cell::RefCell;
use std::rc::Weak;
pub(crate) trait TableList {
type Row;
type Sort: SortBy + TryFrom<usize>;
const HEADER: &... |
use crate::globals::PREFLOP_HAND_FEATURES;
use crate::hand::{Board, HoleCards};
use crate::nut_result::{make_nut_result, NutResult};
use crate::simulate::simulate;
use crate::simulate::SimulationResult;
/// The input of a simulation
#[derive(Debug)]
pub struct Features {
pub frac_better_hands: f32,
pub frac_ti... |
use std::cmp;
use goblin::elf;
use uuid::Uuid;
use symbolic_common::types::DebugId;
const UUID_SIZE: usize = 16;
const PAGE_SIZE: usize = 4096;
/// A section inside an ELF binary.
pub struct ElfSection<'elf, 'data> {
pub header: &'elf elf::SectionHeader,
pub data: &'data [u8],
}
/// Locates and reads a sec... |
// Copyright Materialize, Inc. and contributors. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by ... |
use std::mem::{size_of, MaybeUninit};
use std::os::unix::io::RawFd;
use std::{fmt, io, ptr};
use log::error;
use mio::unix::SourceFd;
use mio::{event, Interest, Registry, Token};
use crate::{Signal, SignalSet};
use super::{from_raw_signal, raw_signal};
/// Signaler backed by `signalfd(2)`.
///
/// # Implementation ... |
use crate::attribute_parser::AttributeParser;
use crate::encoding::Encoding;
use crate::handler::Handler;
use crate::value_parser::ParseError;
use crate::value_parser::ParseResult;
use crate::value_parser::ParseState;
pub struct DataSetParser<T: Encoding> {
parser: AttributeParser<T>,
total_bytes_consumed: usi... |
use super::BodyTable;
use super::HeaderNameTable;
use super::HeaderValueTable;
use super::HeadersTableBuilder;
use super::RecordedResponse;
use super::ResponseTable;
use super::ResponseTableBuilder;
use bytes::Bytes;
use http::Method;
use http::Response;
use http::Uri;
use serde::de::Error;
use serde::de::SeqAccess;
us... |
use async_trait::async_trait;
use diesel::{
backend::UsesAnsiSavepointSyntax,
connection::{AnsiTransactionManager, SimpleConnection},
deserialize::QueryableByName,
query_builder::{AsQuery, QueryFragment, QueryId},
r2d2::{self, ManageConnection},
sql_types::HasSqlType,
ConnectionError, Connec... |
use jetsocat_proxy::socks5::Socks5Stream;
use std::collections::HashMap;
use std::{env, io};
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
use tokio::net::TcpStream;
macro_rules! test {
( $test:expr ) => {{
let expr_str = stringify!($test);
let parenthesis_idx = expr_str.find... |
// Copyright 2021 <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 i... |
use crate::error::{Result, anyhow, Unknown, InvalidLocation, InvalidColor};
use crate::SUPPORT_FORMAT;
use rodio::{Decoder, Source};
use std::fs::{self, File};
use std::panic::PanicInfo;
use std::time::SystemTime;
use std::path::{Path, PathBuf};
use std::io::{self, Stdout, BufReader};
use crossterm::style::Print;
use c... |
//! Advent of Code 2020 Day 16
//! https://adventofcode.com/2020/day/16
//!
//! Challenge part 1
//!
//! Sum all invalid fields of "nearby" tickets. A field is invalid if its value is outside the
//! range of every field.
use std::collections::HashSet;
use std::fs;
use std::ops::RangeInclusive;
use std::str::Lines;
c... |
//! VCF record alternate bases allele and symbol.
pub mod symbol;
pub use self::symbol::Symbol;
use std::{convert::TryFrom, error, fmt, str::FromStr};
use crate::record::reference_bases::{base, Base};
/// A VCF alternate bases allele.
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Allele {
/// A list of bases... |
use chain_core::init::network::Network;
use chain_core::tx::data::input::{TxoPointer, TxoSize};
use chain_core::tx::data::output::TxOut;
use chain_core::tx::fee::{FeeAlgorithm, LinearFee};
use client_common::PublicKey;
use neon::prelude::*;
use crate::error::ClientErrorNeonExt;
use crate::function_types::*;
pub type ... |
use std::{env, fs, net::{TcpListener, TcpStream}, io::prelude::*, process::exit};
use exitcode;
use rusty_nail::png::generate_thumbnail;
use clap;
fn get_number_from_stream(socket: &mut TcpStream) -> Result<usize, String> {
let mut buf: [u8; 32] = [0u8; 32]; // no base-10 size should exceed 32 digits
let byt... |
//! Font variations table.
use super::parse_prelude::*;
/// Tag for the `fvar` table.
pub const FVAR: Tag = Tag::new(b"fvar");
/// Font variations table.
///
/// <https://docs.microsoft.com/en-us/typography/opentype/spec/fvar>
#[derive(Copy, Clone)]
pub struct Fvar<'a> {
data: Buffer<'a>,
axis_offset: u16,
... |
extern crate dirs;
use std::cmp::min;
use std::fs::File;
use std::fs::OpenOptions;
use std::io::Read;
use std::io::Write;
use std::path::PathBuf;
use openssh_keys::PublicKey;
use error::EnokeysError;
use scraper;
use ADMIN_DESTINATIONS_AUTHORIZED_KEYS;
use ADMIN_DESTINATIONS_STORAGE_PROVIDERS;
use ADMIN_DESTINATIONS_... |
// Copyright 2019 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
use std::path::{Path, PathBuf};
// use super::util::get_interactive_confirmation;
use nu_engine::env::current_dir;
use nu_engine::CallExt;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellErro... |
use na::{DefaultAllocator};
use na::allocator::Allocator;
use domain::{Hyperplane, NPoint};
/// A kd tree
pub struct KdTree<P : NPoint>(kd_tree::KdTreeImpl<P>) where DefaultAllocator: Allocator<f64, P::N> ;
impl<P : NPoint> KdTree<P> where DefaultAllocator: Allocator<f64, P::N> {
/// Get all the points from the k... |
use std::vec;
use rand::seq::SliceRandom;
#[derive(PartialEq, Clone)]
pub enum MazePixel {
Wall,
Space,
Target,
Player,
}
#[derive(PartialEq, Clone)]
pub enum Direction {
Up,
Down,
Left,
Right,
}
#[derive(Clone)]
pub struct Maze {
size: (u32, u32),
pixels: Vec<Vec<MazePixel>>,
pub player: (u32, u32),
pub... |
use std::cell::RefCell;
use std::rc::Rc;
use swingset::{
Config, Controller, Dispatch, InboundVatMessage, OutboundVatMessage, Setup, Syscall,
VatArgSlot, VatCapData, VatExportID, VatImportID, VatName, VatPromiseID,
VatResolveTarget, VatResolverID, VatSendTarget,
};
//#[derive(Debug)]
struct Vat1Dispatch {
... |
//! inversion engine serialization codec
use crate::inv_any::*;
use crate::inv_api_spec::*;
use crate::inv_error::*;
use crate::inv_uniq::*;
/// Serialization codec for InversionApi Events.
/// Both sides can emit these events, both sides can receive them.
#[derive(Debug, serde::Serialize, serde::Deserialize)]
#[serd... |
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[repr(C)]
/// Processor Status Longword
///
/// ```text
/// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1
/// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 7 6 5 4 3 2 1 0
/// +-+-+-+-+-+-+---+---+-+---------+-------------+-+-+-+-+-+-+-+-|
/// |C|T|V|M|F|I|CUR|PRV|M| | ... |
// Generates exhaustive test cases.
// This was thrown together quite quickly to ensure the parser was correct.
// It could definitely be improved.
// Note that this could be made multi-threaded for a big speed up.
// Though it'll ideally only need to be generated once.
use std::{ffi::c_void, fs::File, os::windows::i... |
use super::{Metrics, MetricsReport};
use std::collections::HashMap;
use ash::vk;
/// Build a human-friendly markdown report which is printed directly to the
/// console.
///
/// Reports Look similar to the following:-
///
/// ```markdown
/// # Device Allocator - Memory Report Totals
///
/// | Metric... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.