text stringlengths 3.09k 13.9k |
|---|
use crate::audio::{GenericAudioSpecs};
use super::{AudioSample, AudioBuffer};
use super::super::{Result,ErrorKind};
//mp3 decoding relies on puremp3 crate, its appears to have performance problems
//but its the only crate I've found that targets wasm
pub use puremp3;
use puremp3::Mp3Decoder;
pub struct Mp3File {
... |
/*!
Module for handling different architectures in memflow.
Each architecture implements the `Architecture` trait
and all function calls are dispatched into their own
architecture specific sub-modules.
Virtual address translations are done using `ScopedVirtualTranslate`
trait, which is linked to a particular architec... |
#![allow(dead_code)] // TODO: turn this off and clean up before releasing.
use crate::list::external_txn::RemoteId;
pub mod list;
mod common;
mod order;
mod rle;
mod unicount;
mod crdtspan;
mod rangeextra;
// TODO: Move this somewhere else.
pub fn root_id() -> RemoteId {
RemoteId {
agent: "ROOT".into(),... |
//! Settings related to bootcom serial port and device/protocol implementation.
//!
//! Use the [builder](https://doc.rust-lang.org/1.0.0/style/ownership/builders.html)
//! pattern to set the configurable values.
pub use serialport::{DataBits, FlowControl, Parity, StopBits};
// =======================================... |
//! We want to make sure that providing mutable traits doesn't accidentally
//! leak the internal implementation details of a shrinkwrapped type.
//!
//! To do that, we need to make sure that the inner field has the same
//! visibility as the shrinkwrapped struct itself. If it doesn't, we can
//! give the user an error... |
use crate::*;
use messaging::*;
use crate::cli::Configuration;
pub(crate) fn update_modifiers(state: &mut State, action: &KeyAction) {
// let ignore_list = &mut state.ignore_list;
// TODO find a way to do this with a single accessor function
let pairs: [(Key, fn(&KeyModifierState) -> bool, fn(&mut KeyModi... |
use crate::solver::Solver;
pub struct Day4;
const ROW_SIZE: usize = 5;
const BOARD_SIZE: usize = ROW_SIZE * ROW_SIZE;
pub type Board = [u8; BOARD_SIZE];
pub type Index = Vec<[Option<u8>; 100]>;
type Num = u16;
impl<'a> Solver<'a> for Day4 {
type Parsed = (Vec<u8>, Vec<Board>, Index);
type Output = Num;
... |
use anyhow::{anyhow, bail, Result};
use arti_client::{DataStream, IntoTorAddr, TorClient, TorClientConfig};
use hyper::client::connect::{Connected, Connection};
use hyper::http::uri::Scheme;
use hyper::http::Uri;
use hyper::service::Service;
use hyper::Body;
use pin_project::pin_project;
use std::convert::TryInto;
use ... |
use crate::{err::*, interface::Interface, mem::Mem, text::Text};
pub struct Output {
s1: bool,
s3: Vec<(u16, u16)>,
s4: bool,
}
impl Output {
pub fn write<I: Interface>(
&mut self,
mem: &mut Mem,
encode: &Text,
output: &mut I,
text: &str,
type_: u8,
... |
use std::collections::{BinaryHeap, HashSet};
use std::cmp::Ordering;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_first_half() {
let erosion = build_erosion_level((10, 10), 510, false);
print_cave(&erosion);
assert_eq!(calc_danger(&erosion), 114);
}
#[test]
f... |
use std;
use densevector::DenseVector;
use std::iter::Iterator;
pub struct DenseMatrix {
ns: std::vec::Vec<f64>,
rows: usize,
cols: usize,
}
#[derive(Debug)]
pub enum Error {
/// Provided vector is insufficient for constructing a matrix of the requested shape
InsufficientVector,
/// Input i... |
// This is not an actual example, don't use this for reference.
//
// Instead, this program is responsible for (re-)generating the bindings
// found in src/openzeppelin/contracts/generated directory. These are
// committed in-tree, because it allows the crate to be built without
// depending on any extra tooling like T... |
use std::fs::File;
use std::io::{BufReader, BufWriter};
use std::path::{Path, PathBuf};
use std::thread;
use std::time::Duration;
use anyhow::{Context, Result};
use finalfrontier::io::{thread_data_text, FileProgress, TrainInfo};
use finalfrontier::{
BucketIndexerType, CommonConfig, SentenceIterator, Sgd, SimpleVoc... |
use ethabi::Log;
use serde_json::Value as JsonValue;
use crate::bcossdk::bcosclientconfig::{BcosCryptoKind, ClientConfig};
use crate::bcossdk::bcossdk::BcosSDK;
use crate::bcossdk::commonhash::CommonHash;
use crate::bcossdk::contractabi::ContractABI;
use crate::bcossdk::contracthistory::ContractHistory;
use crate::bco... |
use async_socks5::{self, AddrKind, Auth};
use log::trace;
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
use std::sync::Arc;
use tokio::io::{self, BufStream};
use tokio::net::udp::{RecvHalf, SendHalf};
use tokio::net::{TcpStream, UdpSocket};
/// Represents the username and the password of the authentication conne... |
// Copyright 2018 The xi-editor 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 ag... |
use serde::{Serialize, Deserialize};
use super::{FullConf, EndpointConf};
// from https://github.com/zhboner/realm/blob/8ad8f0405e97cc470ba8b76c059c203b7381d2fb/src/lib.rs#L58-L63
// pub struct ConfigFile {
// pub listening_addresses: Vec<String>,
// pub listening_ports: Vec<String>,
// pub remote_address... |
use egg::{rewrite as rw, *};
use std::{borrow::Cow, str::FromStr};
use crate::{
searchutils::*,
veclang::{DiosRwrite, VecLang},
};
#[derive(Debug, PartialEq, Clone)]
pub struct BinOpSearcher {
pub left_var: String,
pub right_var: String,
pub full_pattern: Pattern<VecLang>,
pub vec_pattern: Pa... |
// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0
use crate::{
backup_types::epoch_ending::manifest::{EpochEndingBackup, EpochEndingChunk},
metadata::Metadata,
storage::{BackupHandleRef, BackupStorage, FileHandle, ShellSafeName},
utils::{
backup_service_client::BackupServiceClient, ... |
use std::{cmp::Ordering, fmt, hash, marker::PhantomData, num::NonZeroU32};
/// An unique index in the arena array that a handle points to.
///
/// This type is independent of `spv::Word`. `spv::Word` is used in data
/// representation. It holds a SPIR-V and refers to that instruction. In
/// structured representation,... |
use async_net::TcpStream;
use serde::Deserialize;
use smol::{io, prelude::*};
use crate::Error;
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TargetItem {
pub description: String,
pub devtools_frontend_url: String,
pub id: String,
pub title: String,
#[serde(rename = "... |
use crate::layout::coverage::Coverage;
use otspec::types::*;
use otspec::{
DeserializationError, Deserialize, Deserializer, ReaderContext, SerializationError, Serialize,
Serializer,
};
use otspec_macros::tables;
use std::collections::BTreeMap;
tables!(
LigatureSubstFormat1 {
[offset_base]
uint16 subs... |
mod ast;
mod enum_renderer;
mod field_renderer;
mod object_renderer;
mod schema_renderer;
mod type_renderer;
use super::{DmmfModelOperations, DmmfOperationMappings};
use enum_renderer::*;
use field_renderer::*;
use indexmap::map::Entry;
use object_renderer::*;
use query_core::schema::*;
use schema_renderer::*;
use st... |
//! Displays spheres with physically based materials.
use amethyst::{
assets::AssetLoaderSystemData,
core::{
ecs::{Builder, ReadExpect, Resources, SystemData},
Transform, TransformBundle,
},
renderer::{
camera::Camera,
light::{Light, PointLight},
mtl::{Material, M... |
use crate::bail;
use crate::clients::mime::content_type_equal;
use crate::clients::AsyncExchanger;
use crate::clients::ToUrls;
use crate::Message;
use crate::clients::stats::StatsBuilder;
use async_trait::async_trait;
use http::header::*;
use http::{Method, Request};
use hyper::client::connect::HttpInfo;
use hyper::{Bo... |
use super::{super::ContextConclusion, Request};
use crate::{command::CommandId, state::KeyType};
use alloc::borrow::Cow;
use arrayvec::ArrayVec;
use core::convert::{TryFrom, TryInto};
type Conclusion<'a> = ContextConclusion<(CommandId, Option<KeyType>)>;
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[repr(u8)]
... |
// Copyright 2021 The Kythe Authors. 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://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by appli... |
//! A nom-based protobuf file parser
//!
//! This crate can be seen as a rust transcription of the
//! [descriptor.proto](https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto) file
use protobuf::text_format::lexer::float;
use protobuf::text_format::lexer::Loc;
use protobuf::text_format::... |
use bitfield::bitfield;
use core::fmt::{Debug, Error as FmtError, Formatter};
use core::mem;
use core::ptr::null_mut;
type FmtResult = Result<(), FmtError>;
bitfield! {
struct PckSize(u32);
impl Debug;
pub byte_count, set_byte_count: 13, 0;
pub multi_packet_size, set_multi_packet_size: 27, 14;
pub... |
use crate::plugin::serde::{deserialize_header_name, deserialize_regex};
use crate::plugin::Handler;
use crate::plugins::telemetry::config::MetricsCommon;
use crate::plugins::telemetry::metrics::apollo::Sender;
use crate::{http_compat, ResponseBody};
use ::serde::Deserialize;
use bytes::Bytes;
use http::header::HeaderNa... |
mod copy_impl;
mod create_dir_unchecked;
mod dir_entry_inner;
#[cfg(not(target_os = "wasi"))]
mod dir_options_ext;
mod dir_utils;
#[cfg(not(any(target_os = "android", target_os = "linux")))]
mod file_path;
mod file_type_ext;
mod hard_link_unchecked;
mod is_file_read_write_impl;
mod is_root_dir;
mod is_same_file;
mod me... |
use clarity::{Address, Uint256};
use deep_space::address::Address as CosmosAddress;
use gravity_proto::gravity::query_client::QueryClient as GravityQueryClient;
use gravity_utils::types::{
Erc20DeployedEvent, LogicCallExecutedEvent, SendToCosmosEvent, TransactionBatchExecutedEvent,
ValsetUpdatedEvent,
};
use to... |
use chrono::{DateTime, Duration, Utc};
use itertools::Itertools;
use std::convert::{TryFrom, TryInto};
use std::{fmt, str, str::FromStr};
use crate::error::HederaError;
use crate::proto::{services, ToProto};
use crate::timestamp::HederaTimestamp;
use crate::AccountId;
#[derive(Debug, Clone, Hash, Eq)]
pub struct Tran... |
use std::{
collections::HashMap,
io::{Cursor, Read, Write},
net::{TcpListener, TcpStream},
sync::Arc,
};
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use bytes::{Buf, BufMut, Bytes, BytesMut};
use lazy_static::lazy_static;
use rustls::Session;
use zenith_utils::postgres_backend::{AuthType,... |
use crate::{Error, ErrorExt, SystemTimeSpec};
use bitflags::bitflags;
use std::any::Any;
#[wiggle::async_trait]
pub trait WasiFile: Send + Sync {
fn as_any(&self) -> &dyn Any;
async fn datasync(&self) -> Result<(), Error>; // write op
async fn sync(&self) -> Result<(), Error>; // file op
async fn get_f... |
// https://bfnightly.bracketproductions.com/rustbook/chapter_11.html
extern crate specs;
use super::{Map, SerializeMe, MAP_COUNT};
use crate::components::*;
use specs::error::NoError;
use specs::prelude::*;
use specs::saveload::{
DeserializeComponents, MarkedBuilder, SerializeComponents, SimpleMarker, SimpleMarkerA... |
use crate::Error;
use std::fs::{metadata, FileType};
use std::io::{BufRead, BufReader};
use std::{
cmp::Ordering,
fs::{DirEntry, File},
path::Path,
};
/// Recursively scan contents of two directories and find differences.
///
/// eg.:
/// ```rust,ignore
/// #[test]
/// fn should_directories_be_equal() {
//... |
mod test_utils;
/// Instead of guarding every individual thing with `#[cfg(feature = "http")]`, use a module.
#[cfg(feature = "http")]
mod http_happy {
use crate::test_utils::{read_to_end, test_data};
use httptest::{matchers::*, responders::*, Expectation, Server};
use std::fs::File;
use std::str::From... |
#[cfg(feature = "aiff_text_chunks")]
use super::tag::{AiffTextChunks, Comment};
use super::AiffFile;
use crate::error::{ErrorKind, FileDecodingError, LoftyError, Result};
use crate::file::FileType;
#[cfg(feature = "id3v2")]
use crate::id3::v2::tag::Id3v2Tag;
use crate::iff::chunk::Chunks;
use crate::properties::FilePro... |
// Copyright 2015 The Gfx-rs Developers.
//
// 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 ag... |
//! Shadowsocks SOCKS Local Server
use std::{io, net::SocketAddr, sync::Arc, time::Duration};
use futures::{future, FutureExt};
use log::{error, info};
use shadowsocks::{lookup_then, net::TcpListener as ShadowTcpListener};
use tokio::{
net::{TcpListener, TcpStream},
time,
};
use crate::{
config::{ClientC... |
//! Experimental AST that represents a tune as a hierachial tree structure. This may not be able to
//! represent the full syntax of ABC.
//! AST level:
//! - Sequential entities as a sequence, e.g. notes, chords etc
//! - Entities have decorations, e.g. accents
//! - Non-sequential entities e.g. ties
//! - Two sep... |
// This file is part of Substrate.
// Copyright (C) 2020 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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://... |
use chip_8;
use chip_8::{Emulator, FramebufferDisplay, Input};
use clap::{crate_authors, crate_version, App, Arg};
use minifb::{Key, KeyRepeat, Scale, Window, WindowOptions};
use std::fs::File;
use std::io::Read;
use std::path::Path;
use std::time::{Duration, Instant};
const MICROS_BETWEEN_CYCLES: u128 = 1_000_000 /... |
#![deny(
missing_docs,
missing_debug_implementations,
trivial_casts,
trivial_numeric_casts,
unconditional_recursion,
unused_import_braces,
unused_lifetimes,
unused_qualifications,
unused_extern_crates,
unused_parens,
while_true
)]
//! Handles key exchange using Noise for Ocka... |
use roxmltree::Namespace;
pub fn split_comment_line(s: &str, max_len: usize, indent: usize) -> String {
let indent_str = " ".repeat(indent);
let mut splitted = format!("{}//", indent_str);
let mut current_line_length = indent + 2;
for word in s.split_whitespace() {
let len = word.len();
... |
use bytes::BufMut;
use core::str;
use nom::IResult;
use socket2::Socket;
use std::collections::HashMap;
use std::convert::Infallible;
use std::error::Error;
use std::io;
use std::io::Write;
use std::net::{Ipv4Addr, SocketAddr, UdpSocket};
pub struct DiscoveryListener {
socket: UdpSocket,
}
pub struct DiscoverySen... |
use std::{
borrow::Cow,
net::{IpAddr, SocketAddr},
str::FromStr,
time::{SystemTime, UNIX_EPOCH},
};
use ckb_hash::blake2b_256;
use lazy_static::lazy_static;
use p2p::{
multiaddr::{Multiaddr, Protocol},
secio::PeerId,
utils::{is_reachable, socketaddr_to_multiaddr},
};
use secp256k1::{
ke... |
use std::char;
use std::fs::File;
use std::io::BufRead;
use std::io::BufReader;
use std::path::Path;
type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync + 'static>>;
pub trait Serialize {
fn to_base64(&self) -> String;
fn to_hex(&self) -> String;
}
impl Serialize for [u8] {
fn... |
//! Parse all supported unit types / options for these and do needed operations like matching services <-> sockets and adding implicit dependencies like
//! all sockets to socket.target
use crate::units::*;
use std::collections::HashMap;
use std::path::PathBuf;
pub type ParsedSection = HashMap<String, Vec<(u32, Strin... |
use crate::error::Error;
use anyhow::{anyhow, Result};
use serde::Serialize;
use tantivy::{
collector::TopDocs,
query::{BooleanQuery, Occur, Query, TermQuery},
schema::{Field, IndexRecordOption},
Index, SnippetGenerator, Term,
};
#[derive(Serialize)]
pub struct SearchResult {
pub score: f32,
pub book_id: S... |
//! TLS support structs
// Copyright (c) 2018 <NAME> (https://github.com/seanmonstar/warp/blob/master/src/tls.rs)
//
// 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, i... |
// BSD 3-Clause License
// Copyright (c) 2022, nxtlo
// All rights reserved.
// 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 o... |
use crate::{object::JsObject, JsValue};
use boa_gc::{custom_trace, Finalize, Trace};
use indexmap::{Equivalent, IndexMap};
use std::{
collections::hash_map::RandomState,
fmt::Debug,
hash::{BuildHasher, Hash, Hasher},
};
#[derive(PartialEq, Eq, Clone, Debug)]
enum MapKey {
Key(JsValue),
Empty(usize)... |
use crate::config;
use anyhow::{bail, Context as _};
use human_size::Size;
use snowchains_core::web::{
Atcoder, AtcoderSubmitCredentials, Codeforces, CodeforcesSubmitCredentials, CookieStorage,
PlatformKind, ProblemInContest, Submit, Yukicoder, YukicoderSubmitCredentials,
YukicoderSubmitTarget,
};
use std::... |
use failure::ResultExt;
use std::collections::VecDeque;
use std::str;
use std::str::FromStr;
use terminfo::errors::*;
use terminfo::lang::printf::PrintfArgs;
use terminfo::lang::Argument;
pub struct Parser<'a> {
slice: &'a [u8],
buffer: VecDeque<Op<'a>>,
}
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum Op<'a... |
use glob::glob;
use rayon::prelude::*;
use std::env;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::time::{SystemTime};
use tree_sitter::{Parser, Language, Node};
use std::io::Read;
extern "C" { fn tree_sitter_clojure() -> Language; }
struct AppCfg<'a> {
atomic_counter: &... |
//! Provides configuration of weights and their initialization.
use rand;
use rand::distributions::{IndependentSample, Range};
use co::{ITensorDesc, SharedTensor};
use util::native_backend;
use leaf_capnp::weight_config as capnp_config;
use capnp_util::*;
#[derive(Debug, Clone)]
/// Specifies training configuration fo... |
use anyhow::{bail, Context as _, Result};
use bytes::{Buf, BufMut, BytesMut};
use futures::prelude::*;
use std::time::Duration;
use tokio::{
io::{AsyncRead, AsyncWrite, BufWriter},
prelude::*,
time::timeout,
};
use tokio_serial::{Serial, SerialPortSettings};
use serialcat::{opt, prelude::*, util::GetChars}... |
use json::JsonValue;
use indicatif::{ProgressBar,ProgressStyle};
use console;
use std::time::{Duration, Instant};
use num;
mod concat_str;
use concat_str::concat_string_and_str;
mod inputs;
use inputs::get_and_read_inputs;
mod file;
use file::{write_file, read_file};
mod encryption;
use encryption::method_2::{
... |
// LNP Node: node running lightning network protocol and generalized lightning
// channels.
// Written in 2020 by
// Dr. <NAME> <<EMAIL>>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This ... |
use yew::{ComponentLink, Component, Html};
use yew::prelude::*;
use wasm_bindgen::__rt::std::collections::HashSet;
use std::hash::{Hash, Hasher};
pub(crate) struct LogicalExpression {
link: ComponentLink<Self>,
props: LogicalExpressionProperties,
}
pub enum LogicalExpressionMessage {
Ignore,
PlusCol,
... |
use std::borrow::Cow;
use std::fmt::{self, Write};
use std::error::Error;
use std::char;
use crate::tokenizer::is_keyword;
/// Error returned from `unquote_string` function
///
/// Opaque for now
#[derive(Debug)]
pub struct UnquoteError(String);
/// Converts the string into edgeql-compatible name (of a column or a p... |
#![allow(clippy::many_single_char_names)]
use std::f32;
use std::io::{self, stdout};
use std::time::Instant;
use rand::distributions::Standard;
use rand::rngs::SmallRng;
use rand::{Rng, SeedableRng};
use crate::cam::Camera;
use crate::hit::Hittable;
use crate::mat::{Material, Scatter};
use crate::ray::Ray;
use crate... |
use std::str::FromStr;
use crate::error::Result;
use serde::de::Unexpected;
use serde::{ser::SerializeSeq, Deserialize, Serialize};
use serde_json::Value;
use super::event::Event;
use super::SubscriptionId;
/// Close command parsed
#[derive(PartialEq, Debug, Clone)]
pub struct Close {
/// The subscription identi... |
use js_sys::{Error, Function, JsString, TypeError};
use pulldown_cmark::{CowStr, Event, Options, Parser, Tag};
use pulldown_cmark_to_cmark::fmt::cmark;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
#[allow(dead_code)]
fn example(markdown_input: &str) -> Vec<String> {
// Set up options and parser. Striket... |
/*
[parcel css] - A CSS parser, transformer, and minifier written in Rust.
https://github.com/parcel-bundler/parcel-css
MPL-2.0 License
! below code was copied from https://github.com/parcel-bundler/parcel-css/blob/510df4e2d825927115427b690d6706da395d2170/node/src/lib.rs, and removed node napi code
*/
use parc... |
use super::backend::{Backend, DrawRequest};
use super::Bitmap;
use crate::painters::rect::RectPainter;
use futures::task::SpawnExt;
use shared::color::Color;
use shared::primitive::*;
pub struct Painter<'a> {
rect_painter: RectPainter,
backend: Backend,
device: wgpu::Device,
queue: wgpu::Queue,
sta... |
// 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... |
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// 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 ... |
mod generate;
pub mod hex;
pub mod tile;
use crate::{
timed,
util::{
range::NumRange,
unit::{Meter, Meter3},
},
world::{
generate::WorldBuilder,
hex::{TileDirection, TilePointMap},
tile::Tile,
},
WorldConfig,
};
use anyhow::Context;
use log::info;
use ser... |
use super::{Arrayed, Dimensionality, ImageFormat};
use crate::{integer::Integer, scalar::Scalar, vector::Vector};
/// Marker trait for arguments that accept single scalar values or vectors
/// of scalars.
pub trait SampleType<const FORMAT: u32>: Scalar {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for i8 {}
imp... |
#[derive(Clone)]
pub struct VertexAttrib {
// TODO figure out a way to automatically calculate the gl_type and size of 3 components based
// on a type parameter
gl_type: gl::types::GLenum,
size: gl::types::GLint,
components: gl::types::GLint, // must be between 1 and 4
}
pub mod vertex_attribs {
... |
use chrono::Datelike;
use rayon::prelude::*;
use serde_derive::{Deserialize, Serialize};
use crate::config::Config;
use crate::error::{Result, TechouError};
use crate::front_matter::{parse_front_matter, FrontMatter};
use crate::markdown::*;
use crate::utils;
use std::path::Path;
#[derive(Serialize, Deserialize, Debu... |
// Copyright (C) 2020 - 2022, J2 Innovations
//! Tests the Haystack Filter with defs
#[cfg(test)]
use crate::defs::utils::parse_def;
use lazy_static::lazy_static;
use libhaystack::defs::namespace::Namespace;
use libhaystack::dict;
use libhaystack::filter::eval::{Eval, EvalContext};
use libhaystack::filter::pa... |
use itertools::Itertools;
use serde::de::DeserializeOwned;
use std::{
collections::HashMap,
fmt::{Debug, Display},
ops::Deref,
str::FromStr,
string::String,
};
use url::Url;
pub fn set_cookie(name: &str, value: &str, age: i32) -> Result<http::HeaderValue, failure::Error> {
http::HeaderValue::fr... |
//! Module containing methods which make working with the state
//! machine a bit easier.
use value_from_type_traits::IntoEnum;
use std::borrow::Borrow;
use std::fmt::Debug;
use error::*;
use function::{ServiceCompliance, StateContainer, TriggerState};
use marker;
use service::trigger::{TriggerService, TriggerWrappe... |
use std::fs::File;
use std::io::{self, BufWriter};
use std::path::Path;
use std::sync::Arc;
use std::time::Duration;
use futures::compat::Future01CompatExt;
use futures::future::{self, TryFutureExt};
use sentry::{configure_scope, Hub, SentryFutureExt};
use symbolic::common::{Arch, ByteView};
use symbolic::symcache::{s... |
/*
* Released under the terms of the Apache 2.0 license with LLVM
* exception. See `LICENSE` for details.
*/
//! Lightweight CFG analyses.
use crate::{domtree, postorder, Block, Function, Inst, OperandKind, ProgPoint, RegAllocError};
use smallvec::{smallvec, SmallVec};
#[derive(Clone, Debug)]
pub struct CFGInfo {... |
// Copyright 2018 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 crate::auth_provider_supplier::AuthProviderSupplier;
use anyhow::{Context as _, Error};
use fidl_fuchsia_auth::{
AuthProviderConfig, TokenManagerFa... |
// Copyright 2021 Databricks, Inc.
// 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 writi... |
//! # Cuneiform: In memory optimizations for Rust, revived from the slabs of Sumer.
//!
//! This crate provides proc macro attributes to improve in memory data access times.
//!
//! Cuneiform's main macro can take various arguments at attribute position:
//! * `hermetic = true|false` (default is `true` when `#[cuneifor... |
#![feature(proc_macro, wasm_custom_section, wasm_import_module)]
extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn tension_from_origami_value(o_value: f64) -> f64 {
(o_value - 30.0) * 3.62 + 194.0
}
#[wasm_bindgen]
pub fn friction_from_origami_value(o_value: f64) -> f64 {
(o_va... |
use anyhow::Error;
use arc_swap::ArcSwap;
use chrono::{DateTime, Datelike, Duration, NaiveDate, NaiveDateTime, NaiveTime, Utc};
use deadqueue::unlimited::Queue;
use futures::{try_join, StreamExt};
use im::HashMap;
use lazy_static::lazy_static;
use stack_string::StackString;
use std::{collections::VecDeque, sync::Arc};
... |
use crate::{
body::Body, config::Backend, error::Error, headers::filter_outgoing_headers,
wiggle_abi::types::PendingRequestHandle,
};
use futures::Future;
use http::uri;
use hyper::{client::HttpConnector, Client, Request, Response, Uri};
use hyper_rustls::{HttpsConnector, MaybeHttpsStream};
use std::pin::Pin;
u... |
use std::convert::TryInto;
use ring::digest;
use num_bigint::{BigInt, Sign as BigIntSign};
use libsecp256k1::{
sign, verify, Message, PublicKey as SecPublicKey, SecretKey as SecPrivateKey,
Signature as SecSignature,
};
use ripple_address_codec::encode_seed;
use crate::{
error::{DeriveKeyPairError, Inva... |
extern crate chrono;
extern crate nannou;
use nannou::color::*;
use nannou::draw::Draw;
use nannou::prelude::*;
mod util;
use util::args::ArgParser;
use util::blob::*;
use util::interp::*;
use util::{captured_frame_path, oversample, smooth};
type Line2 = Vec<Point2>;
fn main() {
nannou::app(model).run();
}
struc... |
//! # FFI bindings to N-API symbols
//!
//! These types are manually copied from bindings generated from `bindgen`. To
//! update, use the following approach:
//!
//! * Run `cargo test --manifest-path=crates/neon-runtime/Cargo.toml --features napi`
//! at least once to install `nodejs-sys`
//! * Open the generated bi... |
mod schema;
use crate::config::{Config, RoomConfigurationRef, UsernameAliases};
use crate::unbounded::DelayedSender;
use futures::channel::oneshot;
use futures::FutureExt;
use hmac::{Hmac, Mac, NewMac};
use log::info;
use schema::{InitialPayload, PullRequestEvent, PushEvent, PushEventContext};
use serde::Deserialize;
... |
use bigint::U256;
use std::cmp;
use asm::opcode::*;
use errors::{Error, Result};
#[derive(Debug, PartialEq)]
pub enum Instruction {
// Stop and Arithmetic Operations
STOP,
ADD,
MUL,
SUB,
DIV,
SDIV,
MOD,
SMOD,
ADDMOD,
MULMOD,
EXP,
SIGNEXTEND,
LT,
GT,
SLT,... |
// states: 0 = SteadyStrict, 1 = SteadyFlexible, 2 = Unsteady
pub(crate) const N_STATES: usize = 3;
pub(crate) const STATE_STEADYSTRICT: usize = 0;
pub(crate) const STATE_STEADYFLEX: usize = 1;
pub(crate) const STATE_UNSTEADY: usize = 2;
// observations: 0 = MaxValue, 1 = Other, 2 = Zero
pub(crate) const N_OBS: usize ... |
use std::fmt::{self, Display};
use console::style;
use dialoguer::theme::ColorfulTheme;
use lib::{Address, ParseDerivationPathError};
use lib::http_api::HttpApi;
use lib::utils::parse_float_amount;
use crate::common::operation_command::{OperationCommand, OperationOptions, OperationCommandState};
pub fn ask_for_key_pa... |
use std::io::prelude::*;
extern crate crypto;
//extern crate byteorder;
extern crate integer_encoding;
use integer_encoding::VarInt;
use self::crypto::digest::Digest;
use self::crypto::sha2;
//use byteorder::{BigEndian, WriteBytesExt};
// This is the file format
// 37 magic bytes are used to identify a multihash fil... |
mod entity;
mod sortdir;
use std::io;
use std::ops::Range;
use std::path::PathBuf;
use std::fs::{ Metadata, ReadDir };
use log::*;
use futures::future::TryFutureExt;
use bytes::Bytes;
use hyper::{ Request, Response, Method, Body, StatusCode };
use http::HeaderMap;
use headers::HeaderMapExt;
use if_chain::if_chain;
use... |
#![feature(plugin,proc_macro_hygiene)]
extern crate iron;
extern crate staticfile;
extern crate mount;
extern crate rustbreak;
extern crate maud;
extern crate multipart;
extern crate sha1;
extern crate chrono;
extern crate rand;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate serde_derive;
use std::... |
use super::*;
use counters::Counters;
use crossbeam_queue::ArrayQueue;
use packet::PacketPool;
use std::process::Command;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::thread;
use std::time;
const NUM_PKTS: usize = 10;
const NUM_PART: usize = 20;
const PART_SZ: usize = 3072;
const MAX_P... |
//! Environment Manipulation Utility
//!
//! A utility abstraction over Godwit environment variables.
use crate::errors::EnvError;
use dirs;
use std::fmt::Display;
use std::fs::File;
use std::io::{prelude::*, BufReader};
use std::iter::IntoIterator;
use std::path::{Path, PathBuf};
use std::process::Command;
#[derive(C... |
// Copyright 2021 The Matrix.org Foundation C.I.C.
//
// 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... |
use lark_collections::{Equivalent, FxIndexMap, U32Index};
use parking_lot::{RwLock, RwLockUpgradableReadGuard};
use std::hash::Hash;
/// Generate a "intern tables" struct that can intern one or more
/// types. Input looks like:
///
/// ```ignore
/// struct MyTables {
/// struct MyTablesData {
/// field1: m... |
use clap::StructOpt;
use std::{io::Read, time::Duration};
use zip_parser::find_local_file;
#[derive(clap::Parser)]
struct Args {
#[clap(subcommand)]
action: Action,
}
#[derive(clap::Subcommand)]
enum Action {
File,
Zip,
ZipParser,
}
enum Error {
DecompressError(flate2::DecompressError),
G... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.