text stringlengths 3.09k 13.9k |
|---|
use std::collections::BTreeMap;
use threshold_crypto::{
PublicKeySet, PublicKeyShare, SecretKeySet, SecretKeyShare, Signature, SignatureShare,
};
type UserId = usize;
type NodeId = usize;
type Msg = String;
// The database schema that validator nodes use to store messages they receive from users.
// Messages are... |
// The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org/
//
// Contributed by <NAME>
// Contributed by TeXitoi
// Inspired by Mr Ledrug's C version and thestinger's rust-gmp
#![allow(non_camel_case_types)]
use std::os::raw::{c_int, c_ulong, c_void};
use std::mem::uninitialized;
use std::cm... |
//! Audio transcoder.
//!
//! This module contains just a convenience struct combining
//! audio decoder/resampler/encoder into a single pipeline.
use std::collections::VecDeque;
use crate::Error;
use crate::{
codec::{
audio::{
AudioDecoder, AudioDecoderBuilder, AudioEncoder, AudioEncoderBuil... |
// Copyright 2020 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::{modern_backend::input_device::InputDevice, synthesizer},
anyhow::{format_err, Error},
fidl::endpoints,
fidl_fuchsia_input::Ke... |
mod hymn_media;
pub use hymn_media::*;
use crate::views::{DocumentView, Header};
use hymnal::{Hymn, HymnNumber, Hymnal, Hymnals};
use leptos2::*;
#[derive(Deserialize)]
pub struct HymnPageParams {
hymnal: Hymnals,
number: HymnNumber,
}
pub struct HymnPage {
hymnal: Hymnal,
hymn: Hymn,
}
impl Page fo... |
//! Send metrics to a graphite server.
use crate::attributes::{Attributes, Buffered, MetricId, OnFlush, Prefixed, WithAttributes};
use crate::input::InputKind;
use crate::input::{Input, InputMetric, InputScope};
use crate::metrics;
use crate::name::MetricName;
use crate::output::socket::RetrySocket;
use crate::{Cached... |
use super::{AuraKind, AuraUpdate, Error};
use async_std::{fs, io::prelude::*, path::Path};
use std::fmt::Write;
const ADDON_NAME: &str = "WeakAurasCompanion";
const TOC_NAME: &str = "WeakAurasCompanion.toc";
const TOC_CONTENTS: &str = r"## Interface: 11305
## Title: WeakAuras Companion
## Author: The WeakAuras Team
#... |
use std::fs;
use std::io::{Read, Write};
use std::path::PathBuf;
use directories::ProjectDirs;
const ORGANIZATION: &str = "jhspetersson";
const APPLICATION: &str = "fselect";
const CONFIG_FILE: &str = "config.toml";
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct Config {
pub no_color : Opt... |
//! Mocks for testing
pub mod clitools;
pub mod dist;
use std::fs::{self, File, OpenOptions};
use std::io::Write;
use std::path::Path;
use std::sync::Arc;
// Mock of the on-disk structure of rust-installer installers
#[derive(PartialEq, Eq, Hash, Clone)]
pub struct MockInstallerBuilder {
pub components: Vec<Mock... |
use std::collections::{HashMap, HashSet};
use std::fmt;
use std::hash::{Hash, Hasher};
use crate::ast::EntityFilter;
use super::*;
// =============================================================== Command
// A command to be executed by the world.
#[derive(Debug)]
pub enum Command {
SpawnEntity(Vec<Var>),
D... |
extern crate sv;
extern crate ring;
extern crate hex;
use sv::network::Network;
use sv::wallet;
use sv::wallet::Wordlist;
use sv::wallet::ExtendedKey;
use ring::digest::SHA512;
use ring::hmac;
pub use sv::wallet as sv_wallet;
pub use sv::network as sv_network;
/// Maximum private key value (exclusive)
const SECP256K... |
use std::collections::HashMap;
use itertools::Itertools;
use ndarray::prelude::*;
use ordered_float::NotNaN;
use rand::prelude::*;
use bio::stats::{LogProb, Prob};
use crate::io::codebook::{Codebook, FeatureID};
use crate::model::readout::feature_model::AbstractFeatureModel;
use crate::model::readout::{Counts, Expr... |
use std::{
collections::VecDeque,
sync::atomic::{AtomicU32, Ordering},
};
use crossbeam::atomic::AtomicCell;
use futures::channel::oneshot;
use crate::{
bdev::{nexus::nexus_bdev::Error as NexusError, Nexus},
core::{Bdev, Cores, Protocol, Share},
subsys::NvmfSubsystem,
};
/// TODO
#[derive(Copy, C... |
use crate::{
interfaces::{Log, Mempool},
time::Duration,
};
use serde::{de::Visitor, Deserialize, Deserializer, Serialize};
use std::{fmt, net::SocketAddr, path::PathBuf, str::FromStr};
const DEFAULT_PREFERRED_VIEW_MAX: usize = 20;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(deny_unk... |
use crate::frame_info::{GlobalFrameInfo, FRAME_INFO};
use crate::FrameInfo;
use backtrace::Backtrace;
use std::fmt;
use std::sync::Arc;
use wasmtime_environ::ir::TrapCode;
/// A struct representing an aborted instruction execution, with a message
/// indicating the cause.
#[derive(Clone)]
pub struct Trap {
inner: ... |
#![deny(clippy::all)]
#![deny(clippy::perf)]
#![deny(clippy::nursery)]
#![allow(clippy::use_self)]
#[cfg(test)]
mod test;
mod code_move;
mod collector;
mod entry_strategy;
mod parse;
mod transform;
mod utils;
mod words;
#[cfg(feature = "parallel")]
use rayon::prelude::*;
#[cfg(feature = "parallel")]
use anyhow::Con... |
//! An example drawing semi-transparent venn diagrams
//! using different blend modes.
//!
//! It also shows why you'd usually want to draw canvases
//! using the `Premultiplied` blend mode
//! (for more explanations on this see https://github.com/ggez/ggez/issues/694#issuecomment-853724926)
use ggez::event::{self, Ev... |
use std::io::prelude::*;
use std::io::BufReader;
use std::fs::File;
use num::{BigInt, FromPrimitive};
use num::bigint::Sign;
use rand::{Rng, weak_rng, XorShiftRng};
use rust_crypto::digest::Digest;
use rust_crypto::sha2::Sha256;
use rust_crypto::hmac::Hmac;
use rust_crypto::mac::{Mac, MacResult};
use math::ModExp;
f... |
use super::State;
use crate::error::Error;
use crate::{
Action, CallbackType, ConnectionAction, ConnectionCallbackType, EntryData, EntryValue, Result,
RpcCallback,
};
use futures_channel::mpsc::{channel, unbounded, Receiver, Sender, UnboundedSender};
use futures_util::StreamExt;
use multimap::MultiMap;
use nt_n... |
//
// Copyright (c) Dell Inc., or its subsidiaries. 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
//
cfg_if! {
... |
use super::opaque_transport::{self, OpaqueTransport};
use crate::Outbound;
use futures::future;
use linkerd_app_core::{
io,
proxy::http,
svc, tls,
transport::{self, ConnectTcp, Remote, ServerAddr},
transport_header::SessionProtocol,
Error,
};
use std::task::{Context, Poll};
use tracing::debug_sp... |
use std::collections::HashMap;
use std::os::raw::c_float;
use std::str::FromStr;
use xml::attribute::OwnedAttribute;
#[derive(thiserror::Error, Debug)]
#[allow(clippy::enum_variant_names)]
pub enum ParseError {
#[error("Expected int: {0}")]
ExpectedInt(#[from] std::num::ParseIntError),
#[error("Expected f... |
use crate::{
Error,
Expressions,
Infix,
parse_expression,
Parser,
Precedence,
tokens::{
Keywords,
Signs,
Token,
},
};
use super::{
Block,
Statement,
Statements,
};
#[derive(Debug, Clone, PartialEq)]
pub struct IfElseCondition {
with_else: Option<Token>,
token: Token,
condition:... |
// Copyright 2019 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 {
super::{FetchError, FetchErrorKind},
fuchsia_backoff::Backoff,
rand::Rng,
std::time::Duration,
};
const MAX_FETCH_FLAKE_RETRIES: u32... |
use super::*;
use app::constants::*;
use backend::obj;
use backend::obj::Identified;
use backend::obj::Transformable;
use backend::world;
use backend::world::agent;
use backend::world::agent::Personality;
use backend::world::agent::TypedAgent;
use backend::world::segment;
use backend::world::segment::Intent;
use cgmath... |
use line_info::*;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Token {
pub kind: TokenKind,
pub line_info: LineInfo,
}
impl Token {
fn new(kind: TokenKind, line_info: LineInfo) -> Token {
Token {kind: kind, line_info: line_info }
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum TokenK... |
// Copyright 2021, 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
// di... |
//! Sealed Account.
//
// Copyright (c) 2018 Stegos AG
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, mod... |
use crate::call_info::UnevaluatedCallInfo;
use crate::evaluation_context::EvaluationContext;
use crate::filesystem::filesystem_shell::{FilesystemShell, FilesystemShellMode};
use crate::shell::value_shell::ValueShell;
use crate::CommandArgs;
use log::{log_enabled, trace};
use nu_errors::ShellError;
use nu_protocol::hir:... |
// Copyright 2020 Google 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... |
use std::borrow::Cow;
use std::collections::VecDeque;
use super::*;
use crate::error::ChandlerError;
use crate::html;
use crate::util;
use html5ever::local_name;
use kuchiki::*;
pub struct FourchanThread {
pub root: NodeRef,
}
#[derive(Clone, Debug)]
pub struct FourchanReply {
pub id: u32,
pub node: Nod... |
use byteorder::{ReadBytesExt, WriteBytesExt, BE};
use std::io::{self, Read, Write};
use std::ops::Range;
pub const TABLE_MAX_DEPTH: u8 = 24;
pub struct Table {
depth: u8,
file_offsets: Vec<u64>,
}
fn index(mut depth: u8, key: &[u8]) -> usize {
assert!(depth <= TABLE_MAX_DEPTH);
let mut index = 0;
let mut key_po... |
//! See [ValueValidator](./struct.ValueValidator.html).
use crate::{
ast::{self, Expression, Span},
relations::ReferentialAction,
types::SortOrder,
};
use diagnostics::DatamodelError;
use std::error;
/// Wraps a value and provides convenience methods for
/// validating it.
#[derive(Debug)]
pub struct Valu... |
use std::time::Instant;
use crate::instruments::{
AcceptAllLabels, Instrument, InstrumentAdapter, LabelFilter, LabelPredicate, Update, Updates,
};
use crate::snapshot::Snapshot;
use crate::util;
use crate::{Descriptive, PutsSnapshot};
/// Tracks how many seconds elapsed since the last occurrence
pub struct LastOc... |
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
anyhow::Result,
errors::ffx_error,
glob::glob as _glob,
serde::{Deserialize, Serialize},
std::{
collections::HashSet,
... |
/*! # Conservation in a closed system.
Scenario: An element moves throughout an isolated system, an element such as
heat or electric charge. The element is conserved, meaning that the element can
not be spontaneously created or destroyed. Model such a system, and verify.
An artificial system is generated:
+ It is a r... |
//! Implements attribute macros for `lsp_msg` crate.
//!
//! These macros remove much of the repetition from the LSP definitions.
extern crate proc_macro;
use proc_macro::TokenStream;
use proc_macro2::{Span, TokenStream as TokenStream2};
use quote::quote;
use std::ops::Index;
use syn::{
parse_macro_input, Attribut... |
//! This example is part unit test and part demonstration.
//!
//! We show all of the registration macros, as well as all of the "emission" macros, the ones you
//! would actually call to update a metric.
//!
//! We demonstrate the various permutations of values that can be passed in the macro calls, all of
//! which a... |
use bevy::{
prelude::*,
render::{mesh::shape::Cube, options::WgpuOptions, render_resource::WgpuFeatures},
};
use bevy_inspector_egui::WorldInspectorPlugin;
use std::f32::consts::PI;
use bevy_hanabi::*;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut options = WgpuOptions::default()... |
use serde::de::{self, Deserializer, MapAccess, SeqAccess, Visitor};
use serde::{ser::SerializeStruct, Deserialize, Serialize, Serializer};
use serde::de::DeserializeSeed;
use std::fmt;
use std::cell::RefCell;
use std::rc::Rc;
use crate::b2_body::*;
use crate::b2_settings::*;
use crate::joints::b2_prismatic_joint::*... |
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License in the LICENSE-APACHE file or at:
// https://www.apache.org/licenses/LICENSE-2.0
//! Text widgets
use kas::draw::TextClass;
use kas::text::... |
// Copyright 2016 rust-punkt developers
//
// 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 acc... |
#![allow(unused_imports, unused_mut, unused_variables, dead_code, unreachable_code)]
extern crate linked_hash_set;
use octocrab::Page;
use tokio::task::JoinHandle;
use linked_hash_set::LinkedHashSet;
use std::error::Error;
use structopt::StructOpt;
use octocrab::Octocrab;
use octocrab::{models, params, repos::RepoHandl... |
/*
* @lc app=leetcode.cn id=271 lang=rust
*
* [271] 字符串的编码与解码
*/
// @lc code=start
use std::collections::HashMap;
use std::mem::swap;
use std::rc::Rc;
use std::cell::RefCell;
use std::iter::FromIterator;
#[derive(Debug, Clone)]
struct TrieNode {
id: usize,
content: Vec<char>,
children: HashMap<char, u... |
use crate::{id::Id, swc_common::FoldWith};
use fxhash::FxHashSet;
use swc_atoms::JsWord;
use swc_common::{Fold, Mark, SyntaxContext, VisitMut, VisitMutWith, VisitWith};
use swc_ecma_ast::*;
/// This *colors* type parameters. After this pass, two type parameter declared
/// in different function will be treated as not ... |
use super::super::{
serializable_to_json, try_response_from_json, NashProtocol, ResponseOrError, State,
};
use super::response;
use crate::errors::{ProtocolError, Result};
use crate::graphql::dh_fill_pool;
use crate::types::Blockchain;
#[cfg(feature = "secp256k1")]
use nash_mpc::curves::secp256_k1::{Secp256k1Point,... |
/*!
`big-brain` is a [Utility AI](https://en.wikipedia.org/wiki/Utility_system)
library for games, built for the [Bevy Game Engine](https://bevyengine.org/)
It lets you define complex, intricate AI behaviors for your entities based on
their perception of the world. Definitions are heavily data-driven, using
plain Rust... |
//! A test suite to check the reference JS and wasm output of the `wasm-bindgen`
//! library.
//!
//! This is intended as an end-to-end integration test where we can track
//! changes to the JS and wasm output.
//!
//! Tests are located in `reference/*.rs` files and are accompanied with sibling
//! `*.js` files and `*.... |
use embedded_graphics::drawable::Dimensions;
use embedded_graphics::fonts::Font8x16;
use embedded_graphics::icoord;
use embedded_graphics::image::ImageBmp;
use embedded_graphics::pixelcolor::{FromRawData, Rgb888};
use embedded_graphics::prelude::*;
use embedded_graphics::Drawing;
use graphics::ImageSize;
use rpi_led_ma... |
use crate::maybe_byte::MaybeByte;
/// State of the lexer
#[derive(Clone, Copy, PartialEq, Eq)]
#[repr(C)]
pub struct LexState {
pub(crate) value: i32,
}
impl LexState {
pub(crate) fn is(&self, value: i32) -> bool {
self.value == value
}
pub(crate) fn is_some(&self, states: i32) -> bool {
... |
#[allow(unused)]
use ppm_decode::PpmTime;
use usb_device::class_prelude::*;
use usb_device::Result;
const REPORT_DESCR: &[u8] = &[
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x04, // USAGE (Joystick)
0xA1, 0x01, // COLLECTION (Application)
//Axes SECTION
0x09, 0x01, // USAGE (Pointer)
... |
use std::collections::BTreeMap;
use crate::tree_parser::{Expression, Operator1, Operator2, Statement};
struct IdentifierInfo {
// name: String,
idx: usize, // TODO: more safety
}
enum Identifier {
Function(IdentifierInfo),
Variable(IdentifierInfo),
}
pub struct Variable {
// NOTE: ここに初期化情報は置かない
... |
use crate::{
memlayout::{TRAMPOLINE, TRAPFLAME, UART0_IRQ, VIRTIO0_IRQ},
plic,
proc::{Cpus, ProcState, Process, CPUS, PROCS},
riscv::{intr_get, intr_off, intr_on, r_sstatus, w_sip, w_sstatus, PGSIZE},
spinlock::Mutex,
trampoline::trampoline,
uart::UART,
virtio_disk::DISK,
};
use riscv::r... |
//!
//! Color Examples
//!
extern crate crossterm;
use self::crossterm::crossterm_style::{paint, Color};
/// print some red font | demonstration.
pub fn paint_foreground()
{
// Pass an string to the `paint()` method with you want to paint.
// This will give you an object back wits can be styled and ... |
use std::env;
use term::terminfo::TermInfo;
#[derive(PartialEq, Clone, Copy)]
pub enum Color {
Reset,
Red,
Green,
Gray,
Yellow,
Orange,
Blue,
Purple,
Cyan,
RedBG,
YellowBG,
OrangeBG,
NonText,
Invert,
}
impl Color {
pub fn has_bg_color(self) -> bool {
... |
//! Builders
use crate::prelude::*;
use reqwest::{header, Client};
use std::time::Duration;
/// Builder for the `Esi` struct.
///
/// # Example
///
/// ```rust
/// # use rfesi::prelude::EsiBuilder;
/// let mut esi = EsiBuilder::new()
/// .user_agent("some user agent")
/// .client_id("your_client_id")
/// ... |
use std::time::{SystemTime, UNIX_EPOCH};
use bitcoincash_addr::{cashaddr::EncodingError as AddrEncodingError, Address};
use cashweb::bitcoin_client::{BitcoinClient, BitcoinClientHTTP, NodeError};
use cashweb::{
bitcoin::{
transaction::{DecodeError as TransactionDecodeError, Transaction},
Decodable,... |
//! A generic `Text` implementation for chaining underlying chunks by using a
//! `Vec`.
use std::{slice, cmp::Ordering, hash::{Hash, Hasher}};
use crate::{Text, TextChunk, TextBase, TextConcat};
use crate::parser::AllocError;
use Repr::{Single, Multi};
/// A representation of texts that uses a `Vec` of chunks, th... |
use std::collections::hash_map::DefaultHasher;
use eframe::egui::{self, epaint::Galley, Color32, Pos2, Rect, Rgba, Stroke, TextStyle, Widget};
use num_format::{Locale, ToFormattedString};
use ps_core::eyre::Report;
use ps_core::model::{self, segmentations, Engine, Segment};
use super::super::platform::platform_colors... |
//! This file contains functions needed to deserialize the configuration
//! file. The configuration file contains the static public keys for communication
//! with wallet clients (to set-up noise_KK channels) and bitcoin DescriptorPublicKeys
//! for each manager (for signature verification of Spend Transactions).
use... |
mod de;
use itertools::Itertools;
pub use self::de::*;
use crate::utils::{Color, Rect};
#[derive(Debug, Clone, PartialEq)]
struct HorizontalAlign<T> {
left: T,
middle: T,
right: T,
}
#[derive(Debug, Clone, PartialEq)]
struct VerticalAlign<T> {
top: T,
middle: T,
bottom: T,
}
#[derive(Debug,... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Control"]
pub ctrla: CTRLA,
#[doc = "0x01 - Configuration"]
pub config: CONFIG,
#[doc = "0x02 - Early Warning Interrupt Control"]
pub ewctrl: EWCTRL,
_reserved3: [u8; 1usize],
#[doc = "0x04 - Interrupt Enabl... |
use super::{
BaseConvertInfo, BaseConversion, BaseIR, CompilationError, ConvertInfo, CoreConversion,
Directive, Element,
};
use crate::{
error::CompilationErrorKind as ErrorKind,
flags::PatchFlag,
ir::{ForNodeIR, ForParseResult, IRNode, JsExpr as Js},
parser::ElementType,
util::{find_dir_emp... |
use diesel;
use diesel::prelude::*;
use diesel::pg::PgConnection;
use conduit::{Request, Response};
use time::Timespec;
use conduit_router::RequestParams;
use serde_json as json;
use db::RequestTransaction;
use user::{RequestUser, AuthenticationSource};
use util::{RequestUtils, CargoResult, ChainError, bad_request, re... |
use bytes::BytesMut;
use std::{
convert::TryFrom,
ops::DerefMut,
os::unix::prelude::{AsRawFd, RawFd},
};
#[cfg(all(not(feature = "async_tokio"), feature = "async_std"))]
use async_io::Async;
#[cfg(feature = "async_tokio")]
use tokio::io::unix::AsyncFd;
use crate::maps::{
perf::{Events, PerfBufferErro... |
use crate::agents::envelope::Envelope;
use crate::agents::registry::RegistryAgent;
use crate::agents::uap::{UapAgent, UserAgentRequest};
use crate::app_data::AppData;
use crate::session_data::update_session;
use actix::prelude::*;
use actix_session::Session;
use actix_web::web;
use actix_web::Error;
use actix_web::Http... |
use crate::player::Player;
use crate::{Board, Bug, Loc, Rules};
use minimax::{Game, IterativeOptions, IterativeSearch, Move, Strategy};
use std::io::{self, BufRead, Write};
use std::time::Duration;
fn read_line(prompt: &str) -> String {
print!("{}", prompt);
io::stdout().flush().unwrap();
io::stdin().lock(... |
use rustyline::error::ReadlineError;
use rustyline::highlight::{Highlighter, MatchingBracketHighlighter};
use rustyline::hint::Hinter;
use rustyline::validate::Validator;
use rustyline::Context;
use rustyline::Result as RustylineResult;
use rustyline::{
completion::{Completer, FilenameCompleter, Pair},
validate... |
use cosmwasm_std::{
from_binary, log, to_binary, Api, Binary, Env, Extern, HandleResponse, HandleResult, HumanAddr,
InitResponse, InitResult, MigrateResponse, MigrateResult, Querier, StdError, StdResult,
Storage,
};
use crate::collateral::{
deposit_collateral, liquidate_collateral, lock_collateral, que... |
use crate::error::{RispError, RispResult, Result};
use std::{collections::HashMap, fmt};
// The recursive types hold their children in one of these bad boys
// TODO Should this be a VecDeque or a LinkedList instead?
type LvalChildren = Vec<Box<Lval>>;
pub type LBuiltin = fn(&mut Lval) -> RispResult;
// There are two ... |
//
// This file is subject to the terms and conditions defined in
// file 'LICENSE', which is part of this source code package.
//
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(feature = "std")]
pub use std::*;
#[cfg(feature = "std")]
pub use serde::*;
use codec::{Decode, Encode};
use frame_support::{
decl_modu... |
use crate::serialization::types::TypeCode;
use crate::types::stuple::STuple;
use crate::types::stype_companion::STypeCompanion;
use super::sfunc::SFunc;
use super::smethod::MethodId;
use super::smethod::SMethod;
use super::smethod::SMethodDesc;
use super::stype::SType;
use super::stype_param::STypeVar;
use lazy_static... |
#[macro_use]
extern crate log;
extern crate rustbox;
extern crate unicode_segmentation;
use self::rustbox::RustBox;
use self::rustbox::Color;
use unicode_segmentation::UnicodeSegmentation;
pub type GrimmBox = RustBox;
pub struct Corner {
x: usize,
y: usize,
glyph: char,
}
#[derive(Clone)]
pub struct Tex... |
use crate::error::Result;
use crate::sql::models::Submission;
use crate::sql::schema::{submission_count, submissions};
use diesel::connection::SimpleConnection;
use diesel::dsl::insert_into;
use diesel::pg::upsert::excluded;
use diesel::prelude::*;
use diesel::sql_query;
use diesel::sql_types::Text;
use diesel::PgConn... |
use std::cmp::max;
use std::collections::HashMap;
use crate::types::{AdventResult, Answer, Day, DayPart};
/// Treats a range as a wraparound, and wraps
/// to get the given number into the range.
fn wrap(n: usize, min: usize, max_inclusive: usize) -> usize {
min + ((n - min) % (max_inclusive + 1 - min))
}
#[test... |
// Copyright 2019 Zhizhesihai (Beijing) Technology Limited.
//
// 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 a... |
use crate::papers::{DocumentSpec, Workspace};
use crate::prelude::*;
use futures::{compat::*, StreamExt};
use slog::{debug, error};
use std::process::Command;
use tokio::{fs::File, io::AsyncWrite};
use tokio_process::CommandExt;
/// The name of the downloaded template inside our Tera instance.
const TEMPLATE_NAME: &st... |
use proc_macro2::{Span, TokenStream};
use quote::quote;
use syn::parse::discouraged::Speculative;
use syn::parse::{Parse, ParseBuffer, ParseStream};
use syn::punctuated::Punctuated;
use syn::token::Comma;
use syn::{parenthesized, Attribute, DeriveInput, Ident, Type};
pub(crate) struct WithNotionAttr {
notion_ident... |
#![forbid(unsafe_code)]
use async_trait::async_trait;
use enum_dispatch::enum_dispatch;
use std::fmt::{Display, Formatter};
use std::sync::Arc;
use thiserror::Error;
use tokio::sync::RwLock;
pub use anyhow::Result;
pub use chrono::{
DateTime, Datelike, Duration as NaiveDuration, Local, NaiveDate, NaiveDateTime, T... |
/*!
Internal parsing functions.
*/
use regex::Regex;
// ------------------------------------------------------------------------------------------------
// Public Functions
// ------------------------------------------------------------------------------------------------
lazy_static! {
static ref RE_SCHEME: Reg... |
use crate::{Gender, Role, now, GroupRole};
use crate::{Db, Id, models::routes::ModelRoutes};
use chrono::NaiveDate;
use super::Model;
use serde::{Serialize, Deserialize};
use sqlx::{
FromRow, Postgres, postgres::PgPool,
types::chrono::{NaiveDateTime, Utc}
};
#[derive(Debug, FromRow, Clone, Serialize, Deserial... |
use std::convert::From;
use std::vec::Vec;
#[derive(PartialEq, Copy, Clone)]
pub(crate) enum Direction {
North,
NorthWest,
West,
SouthWest,
South,
SouthEast,
East,
NorthEast,
}
impl Direction {
pub(crate) fn iter() -> impl Iterator<Item = Direction> {
[
Directio... |
//! Twitch channels.
//!
//! Channels serve as the home location for a user's content.
//! Channels have a stream, can run commercials, store videos, display information and status,
//! and have a customized page including banners and backgrounds.
pub use model::UrlString;
pub use model::DateString;
pub use model::Loc... |
use std::error::Error as StdError;
use std::fmt;
use futures::{Async, Future, IntoFuture, Poll};
use body::Payload;
use super::Service;
/// An asynchronous constructor of `Service`s.
pub trait MakeService<Ctx> {
/// The `Payload` body of the `http::Request`.
type ReqBody: Payload;
/// The `Payload` body... |
//! A "physical" file system implementation using the underlying OS file system
use crate::{FileSystem, VfsMetadata};
use crate::{SeekAndRead, VfsFileType};
use crate::{VfsError, VfsResult};
use std::fs::{File, OpenOptions};
use std::io::Write;
use std::path::PathBuf;
/// A physical filesystem implementation using th... |
use super::ktype::KType;
use std::fmt;
use uuid::Uuid;
use chrono::Utc;
use byteorder::{LittleEndian, WriteBytesExt};
#[derive(Debug)]
#[derive(PartialEq)]
pub enum KObj {
Atom(KType),
List(Vec<KObj>),
GenericList(Vec<KObj>),
Dict(Vec<KObj>, Vec<KObj>),
Table(Vec<KObj>, Vec<KObj>),
Error(Strin... |
//! A polyphonic voice array.
//!
//! The voice array maintains a set of identical voices, and is designed to
//! simplify building polyphonic instruments.
//!
//! Each voice may be in two states: playing or free. The array tracks the play
//! state and note of each voice, and uses them to select a voice to handle new
... |
use nom::{
combinator::rest,
number::complete::{be_u16, be_u24, be_u32, be_u8},
};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use crate::{archive::ArchiveRef, error::ReadError};
pub const SECTOR_HEADER_SIZE: usize = 8;
pub const SECTOR_EXPANDED_HEADER_SIZE: usize = 10;
pub const SECTOR_DAT... |
use std::collections::BTreeMap;
use std::sync::{RwLock, Arc};
use utils::counter::Counter;
use page_manager::{FsPageManager, UnfullPage, Page, Block, BlockManager, PageStore, PageId,
BlockId, PageCache};
const CACHESIZE: usize = 16;
#[derive(Debug)]
pub struct RamPageCache {
cache: RwLock<Vec<... |
extern crate image;
use std::collections::HashMap;
use rayon::prelude::*;
use image::imageops;
use image::DynamicImage;
use image::ImageBuffer;
use imageops::FilterType;
use crate::file_reader::{ImageDistributionJsonFileWithClasses, InputJsonFileType, Layer};
use crate::weighted_image_chooser::ImageMapping;
fn stor... |
use {Bsdf, Color};
use color;
use math;
use math::{Cross, Dot, Norm};
use math::{Real, Vector3f};
use rand;
use rand::Closed01;
use rand::distributions::{IndependentSample, Range};
use std::f32::consts::PI;
#[derive(Clone, Copy, Debug)]
pub struct Phong {
color: Color,
kd: f32,
ks: f32,
n: f32,
}
imp... |
//! Mixed-integer linear optimization problem.
use std::fs::File;
use std::io::{self, Write, BufWriter};
use ndarray::ArrayView1;
use crate::matrix::coo::CooMat;
use crate::problem::minlp::ProblemMinlp;
/// Mixed-integer linear optimization problem (Milp) of the form
/// ```ignore
/// minimize c^T*x
/// subject to... |
use table::{Table, TableId, TableIndex};
use value::{Value, ValueMethods, NumberLiteral};
use block::{Register};
use errors::{Error, ErrorType};
use ::hash_string;
use std::sync::Arc;
use std::cell::RefCell;
use hashbrown::{HashSet, HashMap};
use rust_core::fmt;
// ## Store
// Holds all of the values of the program i... |
use rand::thread_rng;
use rand::seq::SliceRandom;
use ai::negamax::{NegamaxTree, Evaluation};
use ai::mcts::{MonteCarloSearchable, MCTSOptions};
use crate::game_state::{GameState, Turn, GameStatus, Color};
use crate::hex::Hex;
use crate::piece::{Bug, Piece};
const PLAYER_A: Color = Color::Black; // positive eval value... |
use iced::{
button, Element, Row, Text, Column, Container, Length, Button,
};
use iced_custom_widget::{table, Table, TableData, TableError, TableResult};
use iced_custom_widget::{table_column, table_columns};
use serde::{Serialize, Deserialize};
use serde_json::Value;
use super::env_entry_page::{EnvEntryPage, EnvEnt... |
use std::cell::{RefCell, RefMut};
use raylib::{RaylibHandle, RaylibThread};
use raylib::prelude::{RaylibDraw, RaylibTextureMode, RenderTexture2D, Color as RaylibColor, Vector2, Rectangle};
use crate::graphics::painter::*;
use crate::owned_texture_mode::OwnedTextureMode;
mod painter;
struct RayLibGraphics {
/// ... |
//! Fungsi yang meng-handle push notifikasi menggunakan FCM.
//!
use chrono::prelude::*;
use diesel::prelude::*;
use diesel::sql_types;
use crate::{
result::Result,
sqlutil::lower,
types::{LocKind, NotifKind},
ID,
};
use fcm::{Client, MessageBuilder, NotificationBuilder, Priority};
use futures::{futu... |
use super::*;
use crate::mgfw::log;
struct Text {
// WARNING: Anything below this line is not in cache!
text: String,
}
struct TextRenderComponentManagerData {
width: u16,
num_chars: u16,
constructed: bool,
reconstruct_needed: bool,
}
pub struct TextRenderComponentManager {
cache_data: *m... |
extern crate bindgen;
fn osx_version() -> Result<String, std::io::Error> {
use std::process::Command;
let output = Command::new("defaults")
.arg("read")
.arg("loginwindow")
.arg("SystemVersionStampAsString")
.output()?
.stdout;
let version_str = std::str::from_utf8(... |
// Copyright 2022, 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
// di... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.