text stringlengths 3.35k 22.8k |
|---|
//! Typechecking of the simply typed lambda calculus with parametric
//! polymorphism
pub mod patterns;
pub mod visit;
use crate::diagnostics::*;
use crate::terms::{Kind, Literal, Primitive, Term};
use crate::visit::{MutTermVisitor, MutTypeVisitor};
use std::collections::{HashMap, VecDeque};
use std::fmt;
use util::spa... |
use crate::types::{encoding::VirtualHint, EType, ETypeShape, VType, VTypeShape};
/// Older components provide only the virtual schema, this function defines the default
/// encoded shape of each of the virtual primitives allowing the [EType] to be always used
/// for parsing.
pub fn virtual_type_to_default_encoded_typ... |
use crate::resolve::is_escapable;
use crate::types::Type;
/// A sequence of chunks.
pub type Chunks = Vec<Chunk>;
/// Represents one part of a field value.
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum Chunk {
/// Normal values within quotes or single braces subject to
/// capitalization formatting.
Nor... |
#![cfg(any(target_os = "solaris", target_os = "illumos"))]
type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
// There is presently no static CStr constructor, so use these constants with
// the c() wrapper below:
const MODULE_CPU_INFO: &[u8] = b"cpu_info\0";
const STAT_CLOCK_MHZ: &[u8] = b"clock_M... |
use wasm_bindgen::prelude::*;
use std::collections::{HashMap, VecDeque};
use battlesnake_game_types::compact_representation::MoveEvaluatableGame;
use battlesnake_game_types::{
compact_representation::CellBoard4Snakes11x11,
types::*,
wire_representation::{BattleSnake, Board, Game, NestedGame, Position, Rul... |
//! Read Segments
//!
//! Type [`ReadSegment`] encapsulates all the information about a segment within
//! a [`crate::read_structure::ReadStructure`]. A segment can either have a definite length, in which case
//! length must be `Some(usize)`, or an indefinite length (can be any length, 1 or more)
//! in which case len... |
/* MIT License
Copyright (c) 2019 <NAME> - NightsWatch
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, p... |
use bo_tie::gap::assigned;
use bo_tie::hci;
use bo_tie::hci::{
events,
le::transmitter::{set_advertising_data, set_advertising_enable, set_advertising_parameters},
};
use std::sync::{
atomic::{AtomicU16, AtomicU8, Ordering},
Arc,
};
/// 0xFFFF is a reserved value as of the Bluetooth Spec. v5, so it isn... |
#![deny(unsafe_code)]
mod render;
mod utils;
use core::cell::RefCell;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
thread_local! {
static MODEL: RefCell<Model> = RefCell::new(Model::init().unwrap_throw());
static FRAME: js_sys::Function = {
let closure: Closure<dyn FnMut(f64)> =
... |
use config::net;
use network::{Peer, api::Api, api::BlockRef, Result};
use storage::{self, tag, Error, block_read};
use cardano::block::{BlockDate, EpochId, HeaderHash, BlockHeader};
use cardano::util::{hex};
use std::time::{SystemTime, Duration};
use std::mem;
fn duration_print(d: Duration) -> String {
format!("{... |
use crate::utils::{next_boundary, previous_boundary};
#[derive(Clone)]
pub struct Token {
pub kind: TokenKind,
pub lexeme: String, // TODO - &str pointer of source ?
pub line: i32,
}
impl Token {
pub fn new(kind: TokenKind, raw: &str, line: i32) -> Token {
let lexeme = raw.to_string();
Token { kind, l... |
use std::{fmt, sync::RwLock, time::Duration};
use tokio::{time::interval, try_join};
use tracing::{error, info, instrument};
use crate::{
client::{BlockHeader, BlockHeadersRangeRequest, Client, ClientError},
prometheus::{Metric, render_metrics},
};
#[derive(Clone, Debug)]
pub struct Exporter {
client: Cli... |
//! # Evm Accounts Module
//!
//! ## Overview
//!
//! Evm Accounts module provide a two way mapping between Substrate accounts and
//! EVM accounts so user only have deal with one account / private key.
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::unused_unit)]
use codec::Encode;
use frame_support::{
... |
// 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 ... |
//! Web of trust components components implemented with rustcrypto primitives for ecdsa (ed25519) and key
//! representation and content signing hash as RIPEMD 160 of rsa key or original content.
extern crate crypto;
extern crate time;
use bincode::rustc_serialize as bincode;
use bincode::SizeLimit;
use rustc_serial... |
use cosmwasm_bignumber::{Decimal256, Uint256};
use cosmwasm_std::{
log, to_binary, Api, CosmosMsg, Env, Extern, HandleResponse, HandleResult, HumanAddr, Querier,
StdError, StdResult, Storage, WasmMsg,
};
use crate::querier::{query_borrower_info, query_liquidation_amount};
use crate::state::{
read_all_colla... |
// Copyright 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 those... |
mod sql_schema_calculator_flavour;
pub(super) use sql_schema_calculator_flavour::SqlSchemaCalculatorFlavour;
use crate::{flavour::SqlFlavour, sql_renderer::IteratorJoin};
use datamodel::{
walkers::{walk_models, walk_relations, ModelWalker, ScalarFieldWalker, TypeWalker},
Datamodel, DefaultValue, FieldArity, I... |
// Based on https://github.com/rust-lang/libz-sys/blob/1.0.25/build.rs
use std::env;
use std::process::Command;
fn main() {
println!("cargo:rerun-if-env-changed=LIBWEBP_SYS_STATIC");
println!("cargo:rerun-if-changed=build.rs");
let host = env::var("HOST").unwrap();
let target = env::var("TARGET").unwr... |
//! A facade around the various collections and primitives needed to
//! support `std`, `no_std + alloc` or `no_std` targets.
//!
//! When importing from the standard library:
//!
//! 1. always prefer core::<mod> over std::<mod> where it's
//! available. (e.g. std::fmt::Result -> core::fmt::Result)
//! 2. use ... |
extern crate serde;
use crate::log;
use quick_xml;
use serde::Deserialize;
#[derive(Debug, Deserialize)]
struct SequenceItem {
#[serde(rename = "$value")]
content: Option<String>,
}
#[derive(Debug, Deserialize)]
struct Sequence {
#[serde(rename = "rdf_li")]
items: Vec<SequenceItem>
}
#[derive(Debug,... |
use regex::Regex;
use std::path::PathBuf;
use std::process::Command;
pub struct Git {
executable: String,
working_dir: PathBuf,
dry: bool,
}
#[derive(Debug, Clone)]
pub struct CommitDetails {
commit_sha: String,
subject: String,
branch_name: String,
}
impl CommitDetails {
pub fn from_str(... |
use crate::reduction::EvalErr;
use std::io::Cursor;
use std::io::Read;
use std::io::Write;
use std::io::{Error, ErrorKind};
use crate::allocator::{Allocator, SExp};
use crate::node::Node;
const MAX_SINGLE_BYTE: u8 = 0x7f;
const CONS_BOX_MARKER: u8 = 0xff;
fn bad_encoding() -> std::io::Error {
Error::new(ErrorKin... |
#[derive(Debug, Eq, PartialEq)]
pub struct Cups {
/// curr is the current cup's number.
curr: usize,
/// next maps a cup at an index to the next cup (value).
next: Vec<usize>,
}
impl Cups {
/// Converts the given number into a game of cups.
pub fn from(num: i32) -> Self {
Cups::new(Cups... |
use itertools::Itertools;
use std::cmp;
use std::fmt;
use std::str;
use thiserror::Error;
use crate::domain::catalog::{
brands::Brand, categories::Category, rolling_stocks::RollingStock,
scales::Scale,
};
use super::rolling_stocks::Epoch;
/// It represent a catalog item number.
#[derive(Debug, PartialEq, Eq,... |
use std::{
io::{BufRead, BufReader, Read},
path::PathBuf,
};
#[cfg(any(target_arch = "i386", target_arch = "x86_64"))]
use goblin::elf::header::EM_386;
#[cfg(target_arch = "aarch64")]
use goblin::elf::header::EM_AARCH64;
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
use goblin::elf::header::EM_ARM;... |
#![recursion_limit = "1024"]
#[macro_use]
extern crate pest_derive;
use pest::prec_climber::{Assoc, Operator, PrecClimber};
use serde_json::json;
//use pest::error::Error;
use pest::Parser;
#[derive(Parser)]
#[grammar = "expr.pest"]
struct ExprParser;
/// error occurred when parsing user input
#[derive(Debug)]
pub... |
extern crate rand;
use rand::Rng;
use std::ops::{Add, AddAssign};
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub struct Point(pub i64, pub i64);
impl Add<Point> for Point {
type Output = Point;
fn add(self, rhs: Point) -> Point {
Point(self.0 + rhs.0, self.1 + rhs.1)
}
}
impl AddAssign<Point> ... |
use std::{future::Future, pin::Pin, sync::Arc, time::Duration};
use serenity::{
builder::{CreateEmbed, CreateMessage},
client::Context,
collector::ReactionAction,
futures::StreamExt,
model::{
channel::{Message, Reaction, ReactionType},
guild::{Guild, PremiumTier},
id::{Chann... |
use self::item::Position;
use super::{
definition::{
Components, MediaType, OpenApi, Operation, Parameter, ParameterLocation, ParameterValue,
PathItem, RefOr, RequestBody,
},
transform::remove_parameter_nullable,
};
use core::fmt;
use item::BindingKind;
use linkme::distributed_slice;
use sc... |
use std::cell::{Cell, RefCell};
use std::sync::{Arc, Mutex};
use std::task::{Context, Poll, Waker};
use std::{cmp, fmt, io, mem, pin::Pin, time};
use bytes::BytesMut;
use crate::codec::{AsyncRead, AsyncWrite, ReadBuf};
use crate::rt::time::sleep;
use crate::util::poll_fn;
#[derive(Default)]
struct AtomicWaker(Arc<Mu... |
use color_eyre::eyre::{eyre, ContextCompat, Result, WrapErr};
use git2::{Branch, BranchType, DescribeFormatOptions, DescribeOptions, Repository};
use crate::issues::Issue;
use crate::prompt::select;
use crate::state::{Initial, IssueSelected, State};
use git2::build::CheckoutBuilder;
use std::str::FromStr;
/// Based o... |
//! rCore Router Driver
use alloc::collections::BTreeMap;
use alloc::string::String;
use alloc::sync::Arc;
use alloc::vec::Vec;
use bitflags::*;
use smoltcp::iface::*;
use smoltcp::phy::{self, DeviceCapabilities};
use smoltcp::time::Instant;
use smoltcp::wire::*;
use smoltcp::Result;
use crate::net::SOCKETS;
use cra... |
use std::collections::{hash_map::Entry, HashMap};
use std::io::SeekFrom;
use std::fs::{create_dir_all, remove_dir_all};
use std::path::{Path, PathBuf};
use std::sync::Arc;
use log::info;
use oxidized_json_checker::JsonChecker;
use super::index_actor::IndexActorHandle;
use thiserror::Error;
use tokio::fs::OpenOptions;
... |
// Copyright 2019 The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// dis... |
//! Async version of connection.
//!
//! You're probably going to need a companion crate - dbus-tokio - for this connection to make sense,
//! (although you can also just call read_write and process_all at regular intervals).
//!
//! When async/await is stable, expect more here.
use crate::{Error, Message};
use crate:... |
use inflector::Inflector;
use super::{
Error,
OneOrMany::{self, Many},
PartnerInfo, Structure,
};
use chrono::{DateTime, TimeZone, Utc};
use common::model::{opportunity::EntityType, Opportunity};
use common::ToFixedOffset;
use serde_json::Value;
#[derive(Debug)]
pub struct EventsQL<Tz: TimeZone>(pub Partn... |
use num_bigint::{BigInt, BigUint};
use num_traits::{One, Signed, Zero};
use core::{convert::TryFrom, mem};
use super::{Arithmetic, ArithmeticError, ModularArithmetic};
impl ModularArithmetic<BigUint> {
fn invert_big(&self, value: BigUint) -> Option<BigUint> {
let value = value % &self.modulus; // Reduce ... |
use crate::{AdditiveShare, InMessage, OutMessage};
use algebra::{
fixed_point::{FixedPoint, FixedPointParameters},
fp_64::Fp64Parameters,
FpParameters, PrimeField, UniformRandom,
};
use crypto_primitives::additive_share::Share;
use neural_network::{
layers::*,
tensors::{Input, Output},
Evaluate,... |
/**
* @File : matrix2.rs
* @Author : dtysky (<EMAIL>)
* @Link : http://dtysky.moe
* @Date : 2019/2/7 下午9:53:03
*/
use wasm_bindgen::prelude::*;
use super::common::*;
use super::vector2::*;
#[wasm_bindgen]
pub struct Matrix2(pub f32, pub f32, pub f32, pub f32);
#[wasm_bindgen]
impl Matrix2 {
#[wasm_bin... |
#![recursion_limit="256"]
#![cfg_attr(feature = "nightly", feature(proc_macro_diagnostic))]
extern crate proc_macro;
use darling::*;
use proc_macro::TokenStream;
use proc_macro2::{TokenStream as SynTokenStream, Literal};
use syn::*;
use syn::export::Span;
use syn::spanned::Spanned;
use quote::*;
#[cfg(feature = "nig... |
use crate::device::GraphicsDevice;
use crate::gui::{CubensisGuiApp, GuiHost};
use crate::mesh::{CubensisMeshRenderPass, Mesh};
use crate::presentation::presenter::CubensisPresenter;
use crate::presentation::PresentationPass;
use crate::resources::{CubensisMeshSpawner, CubensisResourceCollection};
use crate::window::Cub... |
//! The `packet` module defines data structures and methods to pull data from the network.
pub use solana_sdk::packet::{Meta, Packet, PacketFlags, PACKET_DATA_SIZE};
use {
crate::{cuda_runtime::PinnedVec, recycler::Recycler},
bincode::config::Options,
rayon::prelude::{IntoParallelIterator, IntoParallelRefIt... |
//! The standard type used for defining a `fsm::State::Transition`
//!
//! This is the go-to type for when you are implementing `State` for your type.
//!
//! # Examples
//!
//! ```
//! #![feature(never_type)]
//! #[macro_use] extern crate o3;
//!
//! use o3::fsm::State;
//! use o3::fsm::match_transition::Transition;
/... |
#[macro_use]
extern crate nom;
use nom::{be_u16, le_u8, le_u16, le_u32};
mod cp437;
#[derive(Debug, PartialEq)]
pub struct Header {
pub vendor: [char; 3],
pub product: u16,
pub serial: u32,
pub week: u8,
pub year: u8, // Starting at year 1990
pub version: u8,
pub revision: u8,
}
fn parse_vendor(v: u16) -> [c... |
//! Techniques for solving Sudoku.
//!
//! Each technique must perform at most one kind of action and should
//! try not to replicate the capability of another technique. Solving
//! a grid will apply techniques in some order, restarting the sequence
//! any time a technique acts. If the final technique in a sequence... |
//! Code to convert line protocol to [`MutableBatch`]
#![deny(rustdoc::broken_intra_doc_links, rustdoc::bare_urls, rust_2018_idioms)]
#![warn(
missing_copy_implementations,
missing_debug_implementations,
missing_docs,
clippy::explicit_iter_loop,
clippy::future_not_send,
clippy::use_self,
cl... |
#![no_main]
#![no_std]
use panic_halt as _;
use microbit::hal::nrf51::*;
use microbit::hal::nrf51::{interrupt, UART0};
use microbit::NVIC;
use cortex_m::interrupt::Mutex;
use core::cell::RefCell;
use core::fmt::Write;
use cortex_m_rt::entry;
static RTC: Mutex<RefCell<Option<RTC0>>> = Mutex::new(RefCell::new(None))... |
use crate::{
config::Config,
executor::{self},
script::Script,
scriptmap::ScriptMap,
ui::command_palette::CommandPaletteDialog,
ui::{preferences_dialog::PreferencesDialog, shortcuts_window::ShortcutsWindow},
util::SourceViewExt,
util::StringExt,
XDG_DIRS,
};
use eyre::{Context, Resul... |
/*
* Copyright 2021 l1npengtul <<EMAIL>> / The Nokhwa Contributors
*
* 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 requi... |
use crate::cairo_ffi::*;
use crate::convert::TryInto;
use crate::errors::{CairoError, LesterError};
use std::any::Any;
use std::fs;
use std::io::{self, Read, Write};
use std::mem;
use std::os::raw::*;
use std::panic;
use std::path;
use std::slice;
macro_rules! antialias {
($( $Variant: ident => $constant: expr, )+... |
use crate::geoq::{fgb::index, geojson::fvec};
use super::columns;
use super::hilbert::BBox;
use super::hilbert::BoundedFeature;
use flatbuffers::FlatBufferBuilder;
use flatgeobuf::{ColumnType, GeometryType, HeaderArgs, HeaderBuilder};
use serde_json::Value;
use std::collections::{HashMap, HashSet};
use std::convert::T... |
use regex::Regex;
use std::collections::HashMap;
use std::collections::HashSet;
use std::{cmp::Ordering, fs};
fn main() {
println!("Day 1: {}", solve_1());
println!("Day 2: {}", solve_2());
println!("Day 3: {}", solve_3());
println!("Day 4: {}", solve_4());
println!("Day 5: {}", solve_5());
pri... |
//! Language specific code like highlighting and extensions
use std::collections::HashMap;
use std::fs;
use std::path::{Path, PathBuf};
use color_eyre::Help;
use hex::FromHex;
use serde_yaml::Value;
use syntect::easy::HighlightLines;
use syntect::highlighting::{Color, FontStyle, Style, StyleModifier, ThemeSet};
use sy... |
#[macro_use]
extern crate serde_derive;
pub mod algorithm;
pub mod centrality;
pub mod graph_generation;
pub mod simulation;
use js_sys::{Array, Function, Object, Reflect};
use petgraph::graph::{edge_index, node_index};
use petgraph::prelude::*;
use rand::prelude::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen(js_n... |
use std::fs::File;
use std::sync::Arc;
use av::codec::Codec;
use av::format::{
Muxer,
OutputFormat,
};
use av::ffi::AVPixelFormat;
use av::ffi::AVSampleFormat;
use av::ffi::AVCodecID;
use av::ffi::AVRational;
use av::ffi;
use av::audio::constants::{
CHANNEL_LAYOUT_MONO,
CHANNEL_LAYOUT_STEREO,
};
use ... |
/// Sum type for all SOFH encoding types.
///
/// Each variant has a SingleAppVersion value or range of values, as specified by
/// the official guidelines. This type is marked with `#[non_exhaustive]` to
/// support new encoding types without breaking compatibility;
/// [`EncodingType::Unknown`] can represent all valu... |
#![allow(unused)]
//! Raw interface to `age`.
// use age::{cli_common::UiCallbacks, plugin, armor::ArmoredReader};
use age::{
armor::{ArmoredReader, ArmoredWriter, Format},
cli_common::{
file_io, read_identities, read_or_generate_passphrase, read_secret, Passphrase, UiCallbacks,
},
plugin, Iden... |
use super::split::Split;
use super::Size;
use crate::attr::Attr;
use crate::canvas::{BoundedCanvas, Canvas, Result};
use crate::cell::Cell;
use crate::draw::Draw;
///! A Win is like a div in HTML, it has its margin/padding, and border
pub struct Win<'a> {
margin_top: Size,
margin_right: Size,
margin_bottom... |
use druid::{
im::Vector,
kurbo::{Affine, CircleSegment, Line, Rect},
piet::{PietTextLayout, Text, TextLayoutBuilder},
theme::LABEL_COLOR,
ArcStr, BoxConstraints, Color, Data, Env, Event, EventCtx, Insets, KeyOrValue, LayoutCtx,
LifeCycle, LifeCycleCtx, PaintCtx, RenderContext, Size, TextLayout, ... |
// Copyright (c) 2017 <NAME>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distri... |
use std::sync::Arc;
use ash::vk::Handle;
use log::{debug, error, info};
use openxr::{
sys::{self as xr, pfn},
Result,
};
use crate::{
graphics::{opengl::frontend::OpenGLFrontend, vulkan},
wrappers::{
instance::{GraphicsEnableFlags, InstanceWrapper, SystemMeta},
session::{SessionGraphic... |
use crate::common::Solution;
use std::cmp::Reverse;
use std::collections::BinaryHeap;
use std::collections::HashMap;
type Point = (usize, usize);
#[derive(Clone, Debug, Eq, PartialEq)]
struct Player {
typ: u32,
cost: usize,
pos: Point,
moves: usize,
}
impl Player {
fn new(typ: u32, pos: Point) ->... |
use std::env;
use std::fs::File;
use bitflags::bitflags;
use orbclient::KeyEvent as OrbKeyEvent;
use xhcid_interface::{ConfigureEndpointsReq, DevDesc, PortReqRecipient, XhciClientHandle};
mod report_desc;
mod reqs;
mod usage_tables;
use report_desc::{LocalItemsState, MainCollectionFlags, MainItem, MainItemFlags, Glo... |
use core::default::Default;
use rand::CryptoRng;
use rand::Rng;
#[cfg(feature = "serde")]
use serde::de::Error as SerdeError;
#[cfg(feature = "serde")]
use serde::de::Visitor;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
#[cfg(feature = "serde")]
use serde::{Deserializer, Serializer};
pub use sha2:... |
use arrayfire as af;
use arrayfire::{Array, Window};
use flame as fl;
use gnuplot;
use itertools::Itertools;
use rayon::prelude::*;
use std::io::prelude::*;
use super::native::opencv;
#[allow(unused_macros)]
#[macro_export]
macro_rules! wait {
() => {
loop {
println!("Continue? y/n");
... |
#![no_std]
#![feature(asm)]
#![feature(start)]
#![feature(naked_functions)]
use core::panic::PanicInfo;
extern "C" {
fn _api_putchar(chr: u8);
fn _api_putstr0(string_ptr: usize);
fn _api_initmalloc();
fn _api_malloc(size: usize) -> usize;
fn _api_free(addr: usize, size: usize);
fn _api_openwin... |
//! Math
use std::str::FromStr;
use rand::Rng;
use num_bigint::{ToBigUint, BigUint, RandBigInt, BigInt, Sign};
use num::{Zero, One, Integer};
use crate::helpers::generics::*;
const DISCARTERS: [u8; 7] = [3, 5, 7, 11, 13, 17, 19];
// Generates a big number of lenght = u32 param.
pub fn gen_big_num(bit_len: &u32) -> B... |
// Copyright 2022 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Do nothing on unix as tube_transporter is windows only.
#![cfg(windows)]
//! This IPC crate is used by the broker process to send boot data across ... |
use crate::{
graphics::{self as gx, util::GlslMat3},
{graph::LayerView, math as m},
};
use std::borrow::Cow;
use zerocopy::{AsBytes, FromBytes};
type Color = [f32; 4];
/// A flat-colored convex polygon shape.
///
/// Concavity will not result in an error but will be rendered incorrectly.
#[derive(Clone, Copy,... |
//! # Ui
//!
//! Ui for tuifeed
/**
* MIT License
*
* tuifeed - Copyright (c) 2021 <NAME>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limi... |
use core::cmp::{Eq, PartialEq};
use subtle::Choice;
use subtle::ConditionallyNegatable;
use subtle::ConditionallySelectable;
use subtle::ConstantTimeEq;
use backend;
use constants;
#[cfg(feature = "fiat_u32_backend")]
pub use backend::serial::fiat_u32::field::*;
#[cfg(feature = "fiat_u64_backend")]
pub use backend::... |
use reqwest::{RequestBuilder, Error};
use num_enum::{TryFromPrimitive};
use crate::robocraft::{FactoryInfo, RoboShopItemsInfo};
use crate::robocraft::factory_json::ListPayload;
/// Factory list response ordering
#[derive(Eq, PartialEq, TryFromPrimitive)]
#[repr(u8)]
pub enum FactoryOrderType {
/// Suggested (defa... |
#![allow(non_snake_case)]
// Multisig Schnorr
// Copyright 2018 by Kzen Networks
// This file is part of Multisig Schnorr library
// (https://github.com/KZen-networks/multisig-schnorr)
// Multisig Schnorr is free software: you can redistribute
// it and/or modify it under the terms of the GNU General Public
// License ... |
//! The SymCache binary format.
//! # Structure of the format
//!
//! A SymCache contains the following primary kinds of data, written in the following order:
//!
//! 1. Files
//! 2. Functions
//! 3. Source Locations
//! 4. Address Ranges
//! 5. String Data
//!
//! The format uses `u32`s to represent line numbers, addr... |
// we use identifier names from the C headers for PE structures,
// which don't match the Rust style guide.
// example: `IMAGE_DOS_HEADER`
// don't show compiler warnings when encountering these names.
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
use anyhow::Result;
use b... |
#![feature(futures_api, async_await, await_macro)] // To use HLE threads
use ::pomelo_hle as hle;
use ::pomelo_kernel as kernel;
use ::pomelo_formats as formats;
use ::pomelo_guest as guest;
use ::pomelo_guest_dynarmic as guest_dynarmic;
use kernel::{KernelExt, Kernel};
#[macro_use]
extern crate pomelo_hle;
fn main... |
#[cfg(any(feature = "alloc", feature = "std", test))]
use alloc::{string::String, vec};
use crate::Encoding;
/// Encodes the input bytes using the standard base32 format
/// ```
/// assert_eq!(base32::encode("foobar"), "MZXW6YTBOI======");
/// ```
#[cfg(any(feature = "alloc", feature = "std", test))]
#[inline]
pub fn... |
//! a2lfile is a library that allows you to read, modify and write a2l files.
//!
//! It is fast, preserves the formatting of the input, and has support for files using standard version 1.71.
mod loader;
mod tokenizer;
mod parser;
mod a2ml;
mod ifdata;
mod writer;
mod specification;
mod namemap;
mod merge;
mod checker... |
//! # Day 14: Extended Polymerization
//!
//! The incredible pressures at this depth are starting to put a strain on your
//! submarine. The submarine has polymerization equipment that would produce
//! suitable materials to reinforce the submarine, and the nearby
//! volcanically-active caves should even have the nece... |
use std::env;
use std::io::{self, Read};
use std::path::PathBuf;
use std::sync::mpsc::channel;
use std::sync::Arc;
use std::thread;
use std::time::SystemTime;
extern crate serde;
extern crate serde_json;
#[macro_use]
extern crate serde_derive;
extern crate handlebars;
extern crate regex;
extern crate tiny_http;
exte... |
use ct::core::lexer::Lexer;
use ct::syntax::std::*;
pub struct Parser {
lexer: Lexer,
req_sc: bool,
}
impl Parser {
pub fn new(code: String) -> Parser {
Parser {
lexer: Lexer::new(code),
req_sc: true,
}
}
pub fn next(&mut self) -> CtToken {
let t = self.parse_primary();
if t.is_... |
use std::sync::atomic;
use crate::thread_data::storage::trie::{Entry, PtrTarget};
use super::CustomPtr;
#[derive(Debug)]
pub struct Level<T> {
level: usize,
previous: *const Self,
entries: Vec<CustomPtr<T>>,
key_size: usize,
}
impl<T> Level<T> {
/// Creates a new Trie-Level with the given Settin... |
extern crate hyper;
extern crate hyper_rustls;
extern crate yup_oauth2 as oauth2;
extern crate google_drive3 as drive3;
use self::hyper::client::Response;
use drive3::{Result, File};
use super::pipe_buffer::PipeBuffer;
use super::auth::HubType;
use std::process::exit;
use super::misc;
use std::borrow::BorrowMut;
us... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00..0x80 - "]
pub text_: [crate::Reg<text_::TEXT__SPEC>; 32],
_reserved_1_sha1: [u8; 0x04],
_reserved2: [u8; 0x04],
#[doc = "0x88 - "]
pub sha1_load: crate::Reg<sha1_load::SHA1_LOAD_SPEC>,
#[doc = "0x8c - "]
pub ... |
use simple_parse::*;
use std::io::{Read, Write};
#[derive(SpRead, SpWrite)]
#[sp(endian = "little")] // The BMP format explicitely needs little endian
pub struct BmpHeader {
#[sp(validate = "validate_magic_header")] // Call `validate_magic_header()` with the contents of `magic`
pub magic: u16,
pub size: u3... |
use db::PgDbMgr;
use std::cmp;
use std::collections::HashMap;
use std::fmt;
use std::iter::FromIterator;
static TAG: &str = "FCache";
#[derive(Debug)]
pub struct FSegment {
pub file_id: i64,
pub segment_no: i64,
pub data: Vec<u8>,
}
impl fmt::Display for FSegment {
fn fmt(&self, f: &mut fmt::Formatte... |
use std::fs::File;
use std::io;
use std::io::Read;
use std::env;
use xcb;
mod tga{
use std::io::Read;
#[derive(Debug)]
pub enum TGAType{
Original,
New,
}
pub struct TGA{
pub tga_type: TGAType,
pub id_length: u8,
pub cmap_type: ... |
use anyhow::{bail, Result};
use env_logger::{Builder, Target};
use futures::future::{join_all, select_all, FutureExt};
use log::{debug, error, info, trace, LevelFilter};
use std::env;
use std::process::Stdio;
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader, BufWriter, Lines};
use tokio::process::{Child, Child... |
use atty;
use once_cell::sync::Lazy;
use rand::{thread_rng, Rng};
use std::collections::HashMap;
use std::fmt;
use std::slice::Iter;
use std::str::FromStr;
use termion::color;
#[derive(Debug, Clone, Copy)]
#[repr(usize)]
pub enum ColorMode {
Plain = 0,
RedBlack = 1,
Unique = 2,
}
static mut SUIT_COLOR_MOD... |
use std::cell::RefCell;
use std::collections::HashMap;
use std::ffi::CStr;
use std::ptr;
use std::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
use lazy_static::lazy_static;
use crate::{check_status, check_status_or_throw, sys, JsError, Property, Result};
pub type ExportRegisterCallback = unsafe fn(sys::napi_env... |
use super::{Color, Rgb, EPSILON};
use std::fmt::Display;
use crate::color::format_color;
#[derive(Debug, Copy, Clone)]
pub struct Hsl {
pub data: [f32; 4]
}
impl Hsl {
pub fn new(h: f32, s: f32, l: f32) -> Hsl {
Hsl { data: [h, s, l, 1.0] }
}
pub fn new_with_alpha(h: f32, s: f32, l: f32, alph... |
//! ticket is a cli tool to create, delete, and manage tickets as part of
//! repository, rather than a separate service outside the history of the
//! code.
mod actions;
mod tui;
use actions::*;
use anyhow::{
bail,
format_err,
Result,
};
use colored::*;
use configamajig::*;
use log::*;
use rustyline::{
error:... |
use super::{
index::{EdgeSetIntersector, SegmentIntersector, SimpleEdgeSetIntersector},
CoordNode, CoordPos, Direction, Edge, Label, LineIntersector, PlanarGraph, TopologyPosition,
};
use crate::algorithm::dimensions::HasDimensions;
use crate::{Coordinate, GeoFloat, GeometryCow, Line, LineString, Point, Polygo... |
extern crate camera_capture;
extern crate piston_window;
extern crate image;
#[macro_use]
extern crate serde_derive;
extern crate bincode;
#[macro_use]
extern crate lazy_static;
extern crate stun;
//extern crate portaudio;
#[macro_use]
extern crate clap;
extern crate pnet;
use clap::{Arg, App, SubCommand};
use piston_... |
//! This module contains the node id and node info data structure.
//! NodeID is just a new type pattern for a integer number.
//! NCNodeInfo holds the node id and a time stamp for the heartbeat.
use std::collections::VecDeque;
use std::time::Instant;
use std::fmt::{self, Display, Formatter};
use rand::random;
use se... |
//! # suricata-rs
//!
//! Provide access to suricata via a library-like interface. Allows packets to be sent to suricata
//! and alerts received.
//!
//! ```rust,no_run
//! # use suricata_ipc::prelude::*;
//! # use futures::TryStreamExt;
//! # use std::path::PathBuf;
//!
//! struct Packet {
//! data: Vec<u8>,
//! ... |
// Copyright 2017 <NAME> and collaborators
// Licensed under the MIT License.
/*!
Retrieving blobs over HTTP(S).
This code is very directly derived from the `examples/hyper-client.rs` file
provided in the `tokio-tls` Git repository.
*/
use bytes::buf::{Buf, BufMut};
use futures::Poll;
use futures::future::{err, Fut... |
//! # Storage for `Keystore` files
use super::error::KeystoreError;
use super::{generate_filename, AccountInfo, KeyfileStorage};
use crate::core::Address;
use crate::keystore::KeyFile;
use crate::util;
use rocksdb::{IteratorMode, DB};
use serde_json;
use std::path::Path;
use std::str;
/// Database backed storage for ... |
mod category;
mod dice;
mod scoreboard;
mod table_printer;
use dice::{Dice, DiceSet};
use scoreboard::Scoreboard;
use anyhow::Result;
use crossterm::event::{self, Event, KeyCode, KeyModifiers};
use crossterm::{cursor, style, terminal};
use rand::Rng;
use std::io::{self, Write};
const MAX_ROLLS: usize = 3;
const MAX_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.