text stringlengths 3.09k 13.9k |
|---|
extern crate hamcrest;
extern crate tempdir;
extern crate npm_tools;
extern crate fs_utils;
#[macro_use]
extern crate quick_error;
mod utils;
use std::path::PathBuf;
use npm_tools::{deduplicate_into, Visitor, PackageInfo, InstructionOwned, Instruction, Error};
use hamcrest::*;
use tempdir::TempDir;
use std::fs::{File... |
//! Contains the rocket-compatible `ElmForm` trait.
#[cfg(feature = "jalava-derive")]
pub use jalava_derive::{ElmForm, ElmFormParts};
use rocket::fs::TempFile;
use crate::Elm;
/// Used to create multipart requests to a Rocket server.
pub trait ElmForm {
/// A function that creates a Http.Body from the correspond... |
use std::{borrow::Cow, num::NonZeroU64};
use bevy::{
core_pipeline::node::MAIN_PASS_DEPENDENCIES,
prelude::*,
render::{
render_asset::*,
render_graph::{self, RenderGraph},
render_resource::*,
renderer::{RenderContext, RenderDevice},
RenderApp, RenderStage,
},
};
... |
// Copyright 2021 Vector 35 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 w... |
use super::*;
use crate::BrainType;
use std::ops::Range;
/// The view part of MVC (Model-View-Controller), currently takes on jobs for the controller too.
///
/// TODO: Provide adequate error handling when the mouse leaves the window.
///
/// TODO 2: Move the "controller" parts over to another struct.
pub struct View ... |
//! Utilities for getting the virtual price of a pool.
use crate::{bn::U192, curve::StableSwap};
/// Utilities for calculating the virtual price of a Saber LP token.
///
/// This is especially useful for if you want to use a Saber LP token as collateral.
///
/// # Calculating liquidation value
///
/// To use a Saber ... |
//! schema_mod
use strum_macros::{Display, EnumString};
// AsRefStr, EnumString
//use unwrap::unwrap;
//use anyhow::anyhow;
//use std::borrow::Cow;
#[derive(Clone, Debug)]
pub struct Schema {
// first row is table_name and row_delimiter
pub table_name: String,
// first row is table_name and row_delimiter
... |
use palette::gradient;
use palette::{white_point, FromColor, Lch, Mix};
use std::vec;
#[cfg(not(feature = "linear_srgb"))]
pub type ColorType = palette::rgb::Srgba<f64>;
#[cfg(feature = "linear_srgb")]
pub type ColorType = palette::rgb::LinSrgba<f64>;
pub fn hex_to_color(
color_string: &str,
) -> Result<Lch<whit... |
use std::ffi::CStr;
use ash::{
extensions::ext::PhysicalDeviceDrm,
vk::{self, PhysicalDeviceDriverProperties, PhysicalDeviceProperties2},
};
use nix::sys::stat::makedev;
use smithay::backend::drm::DrmNode;
use super::{error::VkError, Version};
/// A physical device provided by a Vulkan instance.
#[derive(Deb... |
extern crate graph_match;
use std::collections::HashMap;
pub fn parse(string: &String) -> Result<graph_match::graph::Graph, String> {
let mut graph = graph_match::graph::Graph {
nodes: vec![],
edges: vec![],
};
for line in string.split("\n") {
let attributes = parse_line(line.to_str... |
/// Some Elementary functions
pub fn elementary_isqrt1(x: i64) -> i64 {
if x <= 1
{ return x; }
let mut s = 1;
let mut x1 = x - 1;
if x1 > 65535 {
s = s + 8;
x1 = x1 >> 16;
}
if x1 > 255 {
s = s + 4;
x1 = x1 >> 8;
}
if x1 > 15 {
s = s + 2;
... |
use core::task::Waker;
use core::{
pin::Pin,
task::{Context, Poll},
};
use alloc::collections::LinkedList;
use alloc::sync::Arc;
use futures_util::io::{AsyncRead, AsyncWrite};
use futures_util::stream::Stream;
use spin::Mutex;
use naive::ep_server::{EpNtfHandler, EpServer};
use naive::io;
use pi::uart::{IrqS... |
use crate::{
messages::{ConfigUpdate, TaskDef},
server::api::{jwt, jwt::JwtKeys},
worker::Worker,
};
use anyhow::Result;
use futures::TryStreamExt;
use highnoon::StatusCode;
use lapin::{
options::{
BasicAckOptions, BasicConsumeOptions, ExchangeDeclareOptions, QueueBindOptions,
QueueDecla... |
use crate::{
bindings,
errors::{WrenError, WrenResult},
handle::WrenHandle,
types::WrenType,
value::{FromWren, ToWren},
vm::WrenContext,
};
use std::{fmt, os::raw::c_int};
pub struct WrenList(WrenHandle);
impl WrenList {
/// Create a `WrenList` from a given `WrenHandle`.
///
/// # ... |
//! Module definining the item mod info type.
use std::cmp::{Eq, PartialEq};
use std::error::Error;
use std::fmt;
use std::str::FromStr;
use regex::{self, Regex, RegexBuilder};
use util::parse_number;
use super::ModValues;
use super::id::ModId;
/// Information about a single known item mod.
#[derive(Clone, Debug)]... |
use super::{
dead_list_key, errors::*, DatasetId, DeadListData, Generation, Object, ObjectPointer,
ObjectRef, TreeInner,
};
use crate::{
allocator::{Action, SegmentAllocator, SegmentId, SEGMENT_SIZE_BYTES},
atomic_option::AtomicOption,
cow_bytes::SlicedCowBytes,
data_management::{self, HandlerDm... |
use anyhow::{bail, Result};
use std::path::Path;
use tonic::transport::{Certificate, Channel, ClientTlsConfig, Endpoint};
#[cfg(not(any(target_os = "android", target_os = "ios", target_arch = "wasm32")))]
#[derive(Debug)]
pub struct GrpcServerConfig<'a> {
pub address: &'a str,
pub port: u16,
pub tls: bool,... |
// Copyright 2022 the dancelist 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or a... |
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
account_address::AccountAddress,
account_config::{AccountResource, BalanceResource},
account_state::AccountState,
ledger_info::LedgerInfo,
proof::AccountStateProof,
transaction::Version,
};
use anyho... |
//! This library primarily provides a binding and API for OpenCV 3.x.
//!
//! This is a work-in-progress and modules/functions are implemented as
//! needed. Attempts to use
//! [rust-bindgen](https://github.com/servo/rust-bindgen) or
//! [cpp_to_rust](https://github.com/rust-qt/cpp_to_rust) haven't been very
//! succe... |
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use mpstthree::binary::struct_trait::{end::End, recv::Recv, send::Send, session::Session};
use mpstthree::bundle_impl_with_enum_and_cancel;
use mpstthree::role::broadcast::RoleBroadcast;
use mpstthree::role::end::RoleEnd;
use rand::{thread_rng, R... |
use std::io::{Write, Read};
use std::collections::HashMap;
use std::str::FromStr;
use std::path::Path;
use std::fs::{self, File};
use clap::clap_app;
use serde::{Serialize, Deserialize};
use sha2::{Sha256, Digest};
use walkdir::WalkDir;
use chrono::{DateTime, Utc};
mod template;
mod view;
use view::View;
#[derive(S... |
use tantivy_fst::{FakeArr, Ulen};
use super::{fieldnorm_to_id, id_to_fieldnorm};
use crate::{HasLen, common::CompositeFile};
use crate::directory::FileSlice;
use crate::directory::OwnedBytes;
use crate::schema::Field;
use crate::space_usage::PerFieldSpaceUsage;
use crate::DocId;
use std::sync::Arc;
/// Reader for the... |
use winapi::{
shared::{
minwindef::{BOOL, DWORD, LPARAM, TRUE, WORD},
windef::{HDC, HMONITOR, HWND, LPRECT, POINT},
},
um::{wingdi, winnt::LONG, winuser},
};
use std::{
collections::{HashSet, VecDeque},
io, mem, ptr,
};
use super::{util, EventLoop};
use crate::{
dpi::{PhysicalP... |
/*
Copyright (c) 2016-2017, <NAME> <<EMAIL>>
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 of conditions and the ... |
use prefix_query::{self, PrefixExpression, PrefixOperation};
use query::{self, BinaryExpression, CompareExpression, CompareOp, ConstantExpression, EvaluateExpression};
use radix::RadixTrie;
use regex::Regex;
use shared::{self, NahFSError};
use std::collections::{BTreeMap, HashMap};
use std::collections::hash_map::Iter... |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
use crate::types::{Intern, RawInternKey};
use core::cmp::Ordering;
use fnv::FnvHashMap;
use lazy_static::lazy_static;
use parking_l... |
use serde::Serialize;
use std::cmp;
use std::collections::HashMap;
use std::fmt;
use std::time::Instant;
// TODO: move up one directory, these are stats for the context
/// Latency statistics for each action (in nanoseconds)
#[derive(Serialize, Debug, Clone, Copy)]
pub struct OperationLatencies {
/// divide this ... |
//! Tracks the location of an entry in a slab.
//!
//! # Index packing
//!
//! A slab index consists of multiple indices packed into a single `usize` value
//! that correspond to different parts of the slab.
//!
//! The least significant `MAX_PAGES + INITIAL_PAGE_SIZE.trailing_zeros() + 1`
//! bits store the address wi... |
//! Module containing async building blocks used by this lightweight libtock-rs
//! prototype.
use core::cell::{Cell, UnsafeCell};
/// A trait implemented by clients of asynchronous components. Has a callback
/// that receives a value of type T.
pub trait Client<T> {
fn callback(&self, response: T);
}
/// A ligh... |
use serde::{Deserialize, Serialize};
use specs::{prelude::*, Component};
use std::fmt::Debug;
// scripting
#[cfg(feature = "python")]
use pyo3::{prelude::*, types::PyAny, PyRawObject};
pub mod player_anim;
pub use player_anim::PlayerAnimationController;
#[cfg(feature = "python")]
#[pyclass]
#[derive(PartialEq, Eq, Ha... |
use crate::evaluate::expr::run_expression_block;
use crate::evaluate::internal::run_internal_command;
use crate::evaluation_context::EvaluationContext;
use nu_errors::ShellError;
use nu_parser::ParserScope;
use nu_protocol::hir::{
Block, Call, ClassifiedCommand, Expression, ExternalRedirection, Pipeline, SpannedExp... |
//! # PNGlitch Core
//!
//! This crate provides the image glitching functionality for all the
//! PNGlitch projects.
pub mod effects;
use effects::Glitch;
extern crate png;
extern crate rand;
use rand::distributions::{Distribution, Uniform};
use rand::Rng;
/// Glitch options
///
/// For each effect, determines how ... |
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2020-2022 Intel Corporation.
*/
use clap::{App, Arg};
use crossbeam_channel::{bounded, select, tick, Receiver};
use etherparse::Ethernet2Header;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::thread;
use std::time::Duration;
use c... |
use std::cell::RefCell;
use std::collections::HashMap;
use lru::LruCache;
use usvg::fontdb;
use usvg::Options;
use geom::Bounds;
use crate::text::Font;
use crate::{text, EventCtx, GeomBatch, GfxCtx, Prerender};
// TODO We don't need refcell maybe? Can we take &mut Assets?
pub struct Assets {
pub default_line_he... |
use std::collections::HashMap;
use std::net::{IpAddr, Ipv4Addr};
use anyhow::{anyhow, Result};
use byteorder::{BigEndian, ByteOrder};
use log::*;
use trust_dns_proto::op::{
header::MessageType, op_code::OpCode, response_code::ResponseCode, Message,
};
use trust_dns_proto::rr::{
dns_class::DNSClass, record_data... |
//Base: bevy_config_cam/examples/simple.rs
//Added code to access meshes from the structure, but there's an error with struct MyAssetPack(Handle<Gltf>);
/*
c:\Rust\bevy_config_cam>cargo run --example simple
Compiling bevy_config_cam v0.1.3 (C:\Rust\bevy_config_cam)
Finished dev [unoptimized + debuginfo] targ... |
use std::sync::Arc;
use std::time::Instant;
use parking_lot::{RwLock, RwLockWriteGuard};
use rand::Rng;
use super::neighbour::Neighbour;
use crate::utils::*;
pub struct NeighboursCache {
state: RwLock<NeighboursCacheState>,
}
impl NeighboursCache {
pub fn new(initial_peers: &[AdnlNodeIdShort], max_len: usiz... |
#![cfg_attr(feature = "clippy", feature(plugin))]
#![cfg_attr(feature = "clippy", plugin(clippy))]
#![feature(optin_builtin_traits)]
#![feature(link_args)]
pub mod backends;
pub mod errors;
pub use errors::HWTracerError;
use std::fmt::Debug;
use std::fmt::{self, Display, Formatter};
#[cfg(test)]
use std::fs::File;
us... |
//! Contraction Hierarchy query server.
//!
//! Actually not much more than a bidirectional dijkstra with a different stopping criterion.
//! And more complicated path unpacking.
//! This works because the augmented graph was split into an upward and an downward part.
//! This implicitly makes sure, that both searches ... |
use std::time::{SystemTime, UNIX_EPOCH};
use std::borrow::Cow;
use url::{Url};
use serde::{Serialize, Deserialize};
use sentry::protocol::{Event, Exception, Stacktrace};
use sentry::utils;
use regex::{Regex};
use super::prelude::*;
use super::sentry_backtrace::*;
#[derive(Serialize, Deserialize, Debug)]
pub struct C... |
//! Language files management.
//!
//! This module contains structs that hold handles to language files
//! and language metadata.
//!
use std::{
collections::{HashMap, HashSet},
fs::{File, OpenOptions},
path::{Path, PathBuf},
};
use log::{debug, warn};
use structopt::lazy_static::lazy_static;
lazy_static... |
use crate::{
block::Block,
droplet::{DropType, Droplet, RxDroplet},
encoder::get_sample_from_rng_by_seed,
xor::xor_bytes,
};
use rand::distributions::Uniform;
/// Decoder for Luby Transform codes.
///
/// # Example
///
/// ```
/// use fountaincode::{
/// decoder::{CatchResult, Decoder},
/// enc... |
use crate::io::Buf;
use std::str::{self, FromStr};
use crate::postgres::database::Postgres;
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub(crate) enum Severity {
Panic,
Fatal,
Error,
Warning,
Notice,
Debug,
Info,
Log,
}
impl Severity {
pub(crate) fn is_error(self) -> bool {
... |
use ark_ec::PairingEngine;
use ark_ff::{One, Zero};
use ark_poly::{EvaluationDomain, GeneralEvaluationDomain};
use ark_std::{cfg_iter, cfg_iter_mut};
use core::ops::AddAssign;
use zkp_r1cs::{ConstraintSystem, Index, SynthesisError};
#[cfg(feature = "parallel")]
use rayon::prelude::*;
use crate::Vec;
use super::{gene... |
#![allow(missing_docs)]
use crate::code_memory::CodeMemory;
use crate::instantiate::SetupError;
use cranelift_codegen::ir::InstBuilder;
use cranelift_codegen::isa::TargetIsa;
use wasmtime_environ::{CompileError, CompiledFunction, Relocation, RelocationTarget};
use wasmtime_runtime::{InstantiationError, VMFunctionBody,... |
use std::process::Command;
use std::borrow::Borrow;
use crate::tables::{WmiProcessor,WmiProcessorIface};
use crate::utils;
pub struct Reader {}
impl WmiProcessorIface for Reader {
fn get_wmi_processor_info(&self) -> Option<String> {
let output = Command::new("wmic")
.args(&["cpu", "g... |
//! Build script for Rust modules in Tor.
//!
//! We need to use this because some of our Rust tests need to use some
//! of our C modules, which need to link some external libraries.
//!
//! This script works by looking at a "config.rust" file generated by our
//! configure script, and then building a set of options f... |
use crate::{
api::{Header, Request},
imp::{
core::*,
prelude::*,
route::{ContinueArgs, FulfillArgs, Route as Impl}
}
};
/// Whenever a network route is set up with [`method: Page.route`] or [`method: BrowserContext.route`], the `Route` object
/// allows to handle the route.
pub stru... |
use ed25519_dalek::Keypair as Ed25519Keypair;
use eui48::MacAddress;
use rand::{rngs::OsRng, Rng};
use serde::{Deserialize, Serialize};
use std::net::IpAddr;
use crate::{accessory::AccessoryCategory, BonjourFeatureFlag, BonjourStatusFlag, Pin};
/// The `Config` struct is used to store configuration options for the Ho... |
use crate::types::chat::member::ChatMember;
#[test]
fn test_deserialize_chat_member_admin() {
let admin = r#"{
"status": "administrator",
"user": {
"id": 1,
"is_bot": false,
"first_name": "firstname",
"last_name": "lastname",
"username": "... |
// Copyright 2014-2016 <NAME>.
// Licensed under the MIT license (http://opensource.org/licenses/MIT)
// This file may not be copied, modified, or distributed
// except according to those terms.
//! Backward oracle matching algorithm.
//! Best-case complexity: O(n / m) with pattern of length m and text of length n.
//... |
// Copyright (c) 2017 <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. All files in the project carrying such notice may not be copied,
// modified, ... |
//! Parser for "fact files", a compact way to represent facts.
//!
//! ```notrust
//! Program := Statement,
//! Statement := Ident: String { Fact* goto Ident* }
//! Fact := Ident ( Symbol, )
//! Ident := [a-zA-Z_][a-zA-Z_0-9]* /* regular expression */
//! Symbol := Ident | 'Ident
//! String :=... |
use assert_cmd::Command;
use std::ffi::OsStr;
use std::str;
/**
* This file contains tests that test a substring of the output using '.contains'
*
* These tests should be the same cross platform
*/
fn build_command<T: AsRef<OsStr>>(command_args: Vec<T>) -> String {
let mut a = &mut Command::cargo_bin("dust").... |
use super::*;
#[derive(Clone, PartialEq)]
#[repr(C)]
pub enum FileType {
FD_NONE,
FD_PIPE,
FD_INODE,
}
pub use FileType::*;
#[derive(Clone)]
#[repr(C)]
pub struct File {
pub type_: FileType,
pub ref_: i32, // reference count
pub readable: u8,
pub writable: u8,
pub pipe: *mut Pipe,
... |
// <NAME> (c) Summer 2019
//
// Mini_Games - Blackjack
/*
References:
1. https://github.com/chrisccerami/rust-blackjack/src
2. https://github.com/seifriedc/blackjack-rust/tree/master/src
-Combined the objected-oriented elements of one with the user I/O of the other.
*/
mod bj;
use std::io;
use std::io::Write;
use std... |
use hedera_derive::IdPartialEq;
use serde::{Deserialize, Serialize};
use std::cmp::Ordering;
use std::convert::{TryFrom, TryInto};
use crate::client::Client;
use crate::entity_id::*;
use crate::entity_id::{validate, ValidateChecksum};
use crate::error::HederaError;
use crate::id::{id_from_string, IdChecksum};
use crat... |
use std::fmt;
use nom::IResult;
use nom::Err as NomErr;
use nom::error::ErrorKind;
use nom::number::complete::{be_u16, be_u32};
/// The OpenType font starts with the Offset Table. If the font file contains only one font, the
/// Offset Table will begin at byte 0 of the file. If the font file is an OpenType Font Collec... |
use super::*;
use ::futures::prelude::*;
use ::hyper::client::conn as http_conn;
use ::hyper::header::HeaderValue;
use ::hyper::client::conn::Parts as HttpConnParts;
use ::hyper::client::conn::SendRequest as HttpConnApi;
use ::hyper::Body as HttpBody;
use ::hyper::Method as HttpMethod;
use ::hyper::Request as HttpRe... |
use std::ffi::CStr;
use crate::extn::core::integer::Integer;
use crate::extn::prelude::*;
mod ffi;
const NUMERIC_CSTR: &CStr = cstr::cstr!("Numeric");
pub fn init(interp: &mut Artichoke) -> InitializeResult<()> {
if interp.is_class_defined::<Numeric>() {
return Ok(());
}
let spec = class::Spec::... |
use super::term_info_store::{TermInfoStore, TermInfoStoreWriter};
use super::{TermStreamer, TermStreamerBuilder};
use crate::common::BinarySerializable;
use crate::common::CountingWriter;
use crate::directory::ReadOnlySource;
use crate::postings::TermInfo;
use crate::termdict::TermOrdinal;
use once_cell::sync::Lazy;
us... |
//! Provides chord support for two keys pressed at once.
//! E.g. Left + Right arrow at the same time => paste.
use crate::layout::Event;
use bitvec::prelude::*;
use heapless::Vec;
type KeyPosition = (u8, u8);
/// KeyA + KeyB = KeyC
/// (For custom actions KeyC could be a virtual key off to the side and then mapped t... |
use crate::exit::Exit;
use crate::tilde::Tilde;
use crate::VERBOSE;
use std::env;
use std::fs;
use std::io::{self, Read, Write};
use std::path::PathBuf;
use std::process::{self, Stdio};
use colored::Colorize;
use failure::Fail;
use serde_derive::{Deserialize, Serialize};
#[serde(deny_unknown_fields)]
#[derive(Serial... |
//! N-dimensional convolution layers.
use super::Path;
use crate::Tensor;
use std::borrow::Borrow;
/// Generic convolution config.
#[allow(clippy::upper_case_acronyms)]
#[derive(Debug, Clone, Copy)]
pub struct ConvConfigND<ND> {
pub stride: ND,
pub padding: ND,
pub dilation: ND,
pub groups: i64,
pu... |
use libportaudio_sys as ffi;
use std::convert::{TryFrom, TryInto as _};
use crate::backend::Backend;
use crate::error::{Error, Result};
use crate::portaudio::device;
use crate::portaudio::error::PaErrorAsResult as _;
use crate::portaudio::{global_lock, LockGuard, RawPtr};
pub type HostHandle = std::sync::Arc<HostImpl... |
//! list subcomAmand - List leetcode problems
//!
//! ```sh
//! leetcode-list
//! List problems
//!
//! USAGE:
//! leetcode list [FLAGS] [OPTIONS] [keyword]
//!
//! FLAGS:
//! -h, --help Prints help information
//! -s, --stat Show statistics of listed problems
//! -V, --version Prints ver... |
use sodalite;
use protobuf;
use protobuf::Message;
use ekiden_common::error::{Error, Result};
use ekiden_common::random;
use ekiden_enclave_common;
use ekiden_rpc_common::api;
use ekiden_rpc_common::secure_channel::{create_box, open_box, MonotonicNonceGenerator,
NonceGenerator,... |
// <NAME>
extern crate toml;
extern crate chrono;
extern crate lru;
extern crate lettre;
extern crate lettre_email;
use std::string::String;
use std::path::Path;
use std::{env, fs, thread};
use std::io::{BufReader, SeekFrom, prelude::*};
use std::sync::{Arc, Mutex};
use inotify::{Inotify, EventMask, WatchMask};
use ... |
use std::{mem, ptr};
use crate::{
ibase::{self, IBase},
status::Status,
xsqlda::XSqlDa,
};
use rsfbclient_core::{Charset, FbError, SqlType, MAX_TEXT_LENGTH};
use ParamBufferData::*;
/// Stores the data needed to send the parameters
pub struct Params {
/// Input xsqlda
pub(crate) xsqlda: Option<XS... |
use crate::{
environment::Environment,
errors::CompileError,
expr::{Expr, Function, Value},
statements::Statement,
token::{Token, TokenType},
};
use std::{cell::RefCell, rc::Rc, time::SystemTime};
pub struct Interpreter {
/// A pointer to the outermost global environment
environment: Rc<Re... |
// Ensure we're `no_std` when compiling for Wasm.
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::unused_unit)]
#![allow(clippy::useless_attribute)]
use chainbridge as bridge;
use frame_support::{pallet_prelude::*, transactional};
use frame_system::pallet_prelude::*;
use orml_traits::MultiCurrencyExtended... |
// Copyright 2022 The Engula 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 to... |
// 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 in writ... |
//! Digital Signatures
//!
//! DSA ensures a message originated from a known sender, and was not modified.
//! DSA uses asymetrical keys and an algorithm to output a signature of the message
//! using the private key that can be validated with the public key but not be generated
//! without the private key.
use ffi;
u... |
use ::quote::{quote, ToTokens};
use ::std::ops::Not;
use ::syn::{
parse::{Parse, ParseStream},
punctuated::Punctuated,
*,
};
use proc_macro2::TokenStream;
pub fn format_args_f_impl(input: IfmtInput) -> Result<TokenStream> {
let IfmtInput {
mut format_literal,
mut positional_args,
... |
use crate::{
config::ConfigManager,
danmaku::Danmaku,
ffmpeg::FfmpegControl,
ipcmanager::IPCManager,
mpv::MpvControl,
streamer::Streamer,
streamfinder::StreamFinder,
};
use async_channel::Receiver;
use log::info;
use std::{
ops::Deref,
sync::Arc,
};
use tokio::sync::RwLock;
pub enum... |
//! Find all descendant paths containing *.lproj from the root directory.
//!
//! If the root directory structure is like:
//!
//! ```text
//! /root/
//! Foo.app/
//! Base.lproj/...
//! English.lproj/...
//! Bar/
//! a.bundle/
//! en_US.lproj/...
//! fr_FR.lproj/.... |
use std::{net::IpAddr, time::Duration};
use ipnet::IpNet;
use serde::{Deserialize, Serialize};
use crate::Unified;
#[derive(Debug, Serialize, Deserialize)]
pub(super) struct RemoteNetwork {
#[serde(rename = "_id", skip_serializing)]
pub id: String,
pub name: String,
#[serde(default = "crate::util::is_true")]... |
//! Solution to [AoC 2018 Day 6](https://adventofcode.com/2018/day/6)
use itertools::Itertools;
use nom::{character::complete::multispace0, combinator::iterator, sequence::delimited};
use std::collections::{HashMap, HashSet};
use std::iter::{Extend, IntoIterator, Iterator};
use utils::nom_parsers;
#[derive(Copy, Clon... |
#![allow(clippy::unreadable_literal)]
use anyhow::{anyhow, Context, Error};
use chrono_tz::Tz;
use ini::Ini;
use serenity::model::prelude::*;
use std::collections::HashMap;
use std::error::Error as StdError;
use std::path::{Path, PathBuf};
use std::str::FromStr;
use url::Url;
#[derive(Debug)]
pub struct Config {
... |
use crate::physics::{ColliderHandleComponent, RapierConfiguration};
use macroquad::prelude::*;
use rapier::dynamics::RigidBodySet;
use rapier::geometry::{Collider, ColliderSet, ShapeType};
use rapier::pipeline::PhysicsPipeline;
use shipyard::{Get, IntoIter, IntoWithId, UniqueView, View};
use std::collections::HashMap;
... |
use super::glyph::Glyph;
use metal::*;
use swash::scale::{image::Image, ScaleContext};
#[derive(Copy, Clone, PartialEq, Eq)]
pub enum Format {
A8,
Rgba8,
}
pub trait GlyphRasterizer {
fn new(device: &DeviceRef, queue: &CommandQueueRef) -> Self;
fn begin(&mut self, format: Format, width: u32, height: u... |
// Copyright 2021 Anchor Protocol. Modified by Lido
//
// 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 applicabl... |
//! Contains types associated with user-configurable variables
use std::borrow::Cow;
use std::fmt;
use std::mem::replace;
use std::time::Duration;
/// Default `keyseq_timeout`, in milliseconds
const KEYSEQ_TIMEOUT_MS: u64 = 500;
/// Iterator over `Reader` variable values
#[derive(Clone)]
pub struct VariableIter<'a> ... |
use std::collections::HashMap;
use http::header::HeaderValue;
use ruma_client_api::unversioned::get_supported_versions::{
Endpoint as GetSupportedVersionsEndpoint, Response as GetSupportedVersionsResponse,
};
use ruma_client_api::Endpoint;
use ruma_events::room::member::MemberEvent;
use ruma_events::room::message:... |
/*!
* Provides a builder experience for creating `IRI` instances. The [`IriBuilder`](builder/struct.IriBuilder.html)
* type provides a simple API to create new `IRI` instances in a fluent style.
*
* # Example
*
* ```rust
* use rdftk_iri::{builder::IriBuilder, IRI, error::Result as IriResult, Scheme};
* use std::convert... |
use std::{
borrow::BorrowMut,
cell::{Cell, RefCell},
time::Duration,
};
use super::{
objects::{AxisBox, Fixed, Kinetic, Object},
Tick, Vec2,
};
pub struct Simulation {
pub world_bounds: Vec2,
pub gravity: Vec2,
pub kinetic: Vec<RefCell<Kinetic>>,
pub fixed: Vec<Fixed>,
}
impl Simulation {
pub fn new<B: Int... |
use std::cmp::Ordering;
use std::fmt;
use strum::IntoEnumIterator;
#[derive(Clone, Copy, Debug, EnumIter, Eq, PartialEq)]
pub enum Suit {
Clubs,
Spades,
Hearts,
Diamonds,
}
#[derive(Clone, Copy, Debug, EnumIter, Eq, PartialEq, Ord, PartialOrd)]
pub enum Rank {
Two,
Three,
Four,
Five,
... |
use crate::{
complete_output, get_compiler,
util::{CtxtExt, MapErr},
};
use anyhow::{bail, Error};
use napi::{CallContext, Env, JsBoolean, JsObject, JsString, Task};
use std::sync::Arc;
use swc::config::{BuiltConfig, Options};
use swc::{Compiler, TransformOutput};
use swc_common::{comments::Comment, BytePos, FileNa... |
use roxmltree::Node;
use crate::parser::constants::attribute;
use crate::parser::node_parser::parse_node;
use crate::parser::types::{
Alias, EnumCase, EnumSource, RsEntity, Struct, StructField, StructFieldSource, TypeModifier,
};
use crate::parser::utils::get_documentation;
use crate::parser::xsd_elements::{max_oc... |
#![feature(str_split_once)]
mod brain;
mod config;
use futures::StreamExt;
use rand::Rng;
use reqwest::{redirect::Policy, Url};
use std::{thread, time, time::SystemTime};
use telegram_bot::*;
use brain::{Brain, UserName};
use config::Config;
lazy_static::lazy_static! {
static ref CONFIG: Config = Config::new();... |
mod default;
use std::default::Default;
use std::path::PathBuf;
use serde::{Deserialize, Serialize};
use crate::opts::Opts;
use default::DEFAULT_CONFIG_SETTINGS;
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(transparent)]
pub struct PluginSettings(pub toml::value::Table);
impl Default for Plu... |
use num_traits::FromPrimitive;
pub(crate) mod db;
pub(crate) mod table;
pub(crate) mod pe;
pub(crate) mod columns;
pub(crate) trait BitView {
fn get_bit(self, bit: usize) -> bool;
fn get_enum<T: FromPrimitive>(self, mask: Self) -> T;
}
impl BitView for u16 {
fn get_bit(self, bit: usize) -> bool {
... |
#![feature(proc_macro_hygiene)]
#[macro_use]
extern crate hdk;
extern crate hdk_proc_macros;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
#[macro_use]
extern crate holochain_json_derive;
use hdk::{
entry_definition::ValidatingEntryType,
error::ZomeApiResult,
};
use hdk... |
use parity_codec::{Decode, Encode};
use rstd::vec::Vec;
use support::{decl_event, decl_module, decl_storage, dispatch::Result, ensure, StorageMap};
use system::ensure_signed;
const ERR_DID_ALREADY_CLAIMED: &str = "This DID has already been claimed.";
const ERR_UN_ALREADY_CLAIMED: &str = "This unique name has already b... |
use cosmwasm_std::{
to_binary, Api, BankMsg, Coin, CosmosMsg, Env, Extern, HandleResponse, HandleResult, HumanAddr,
InitResponse, InitResult, Querier, QueryResult, StdError, StdResult, Storage, Uint128,
};
use cosmwasm_storage::{ReadonlySingleton, Singleton};
use rand::{RngCore, SeedableRng};
use rand_chacha::C... |
use super::{CastProvider, Provider, ProviderFactory, TransactionProvider};
use crate::{BoxFuture, Error, Result};
use async_cell_lock::AsyncOnceCell;
use once_cell::sync::OnceCell;
use std::{
any::TypeId,
marker::PhantomData,
sync::atomic::{AtomicU64, Ordering::Relaxed},
};
use tokio::sync::{Mutex, MutexGua... |
use itertools::Itertools;
use rand::prelude::*;
use rand_chacha::ChaCha8Rng;
use crate::{
indexed_vec::{CellIdx, IdxType},
solve::{Grid, MultipleSolnSolver, RandomSolver, Solution},
Shape, Symmetry,
};
/// A generator for random sudoku puzzles.
#[derive(Debug, Clone)]
pub struct PuzzleGen<'shp, 'symm, F: ... |
use crate::materials::Material;
use crate::math::*;
use crate::world::TransportMode;
#[derive(Clone, Debug)]
pub struct SharpLight {
// pub color: Box<dyn SpectralPowerDistribution>,
pub color: CDF,
pub sharpness: f32,
pub sidedness: Sidedness,
}
impl SharpLight {
pub fn new(color: CDF, sharpness:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.