text stringlengths 8 4.13M |
|---|
extern crate wasm_bindgen;
pub mod factor;
pub mod macros;
pub mod prime;
pub mod util;
|
use eosio::*;
use lazy_static::lazy_static;
pub const ACTIVE_PERMISSION: PermissionName = PermissionName::new(n!("active"));
pub const TOKEN_ACCOUNT: AccountName = AccountName::new(n!("eosio.token"));
pub const RAM_ACCOUNT: AccountName = AccountName::new(n!("eosio.ram"));
pub const RAMFEE_ACCOUNT: AccountName = Accoun... |
use std::fmt::{Display, Formatter};
use std::fmt;
use std::iter::Product;
use std::ops::{Add, Div, Mul, Sub};
use crate::structs::dim::Dim::Size;
#[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
pub enum Dim {
Any,
Size(usize),
}
impl Display for Dim {
fn fmt(&self, f: &mut Formatter<'_>) -> ... |
#![allow(clippy::comparison_chain)]
#![allow(clippy::collapsible_if)]
use std::cmp::Reverse;
use std::cmp::{max, min};
use std::collections::{BTreeSet, HashMap, HashSet};
use std::fmt::Debug;
use itertools::Itertools;
use whiteread::parse_line;
const ten97: usize = 1000_000_007;
/// 2の逆元 mod ten97.割りたいときに使う
const in... |
pub struct RenderEngine {}
|
use std::marker::PhantomData;
use std::{path::Path, sync::Arc};
use legion::world;
use nalgebra::Point3;
use nalgebra_glm::proj;
use smallvec::SmallVec;
use sourcerenderer_core::{Matrix4, Vec3, Vec4};
use sourcerenderer_core::graphics::{
BindingFrequency, BufferInfo, BufferUsage, CommandBuffer, MemoryUsage, Pipeli... |
use actix_web::{FromRequest, HttpRequest, Error, http::header};
use std::sync::Arc;
use crate::error::TokenError;
use actix_web::dev::Payload;
pub struct Token {
inner: String
}
impl Token {
/// Deconstruct to an inner value
pub fn into_inner(self) -> String {
self.inner
}
}
impl AsRef<String... |
//! A cross-platform asynchronous [Runtime](https://github.com/rustasync/runtime). See the [Runtime
//! documentation](https://docs.rs/runtime) for more details.
#![deny(unsafe_code)]
#![warn(
missing_debug_implementations,
missing_docs,
nonstandard_style,
rust_2018_idioms
)]
#[cfg(target_arch = "wasm... |
//! Configuration file migration.
use std::fs;
use std::path::Path;
use toml::map::Entry;
use toml::{Table, Value};
use crate::cli::MigrateOptions;
use crate::config;
/// Handle migration.
pub fn migrate(options: MigrateOptions) {
// Find configuration file path.
let config_path = options
.config_fi... |
// Copyright (c) 2016 <daggerbot@gmail.com>
// This software is available under the terms of the zlib license.
// See README.md for more information.
use std::path::{Path, PathBuf};
use std::vec;
use os;
/// Application shared information which gets passed around during game initialization.
pub struct AppContext {
... |
pub mod anonymous;
pub mod export;
use std::sync::Arc;
use num_bigint::BigInt;
use proptest::prop_oneof;
use proptest::strategy::{BoxedStrategy, Strategy};
use liblumen_alloc::erts::term::prelude::*;
use liblumen_alloc::erts::Process;
use crate::test::strategy;
pub fn module() -> BoxedStrategy<Term> {
super::... |
use core::mem;
use crate::pointer::{
Marked::{self, Null, Value},
MarkedNonNullable,
};
use crate::MarkedPointer;
/********** impl inherent *************************************************************************/
impl<T: MarkedNonNullable> Marked<T> {
/// Returns `true` if the marked value contains a [... |
use crate::column::ColumnIndex;
use crate::error::Error;
use crate::ext::ustr::UStr;
use crate::mssql::protocol::row::Row as ProtocolRow;
use crate::mssql::{Mssql, MssqlColumn, MssqlValueRef};
use crate::row::Row;
use crate::HashMap;
use std::sync::Arc;
pub struct MssqlRow {
pub(crate) row: ProtocolRow,
pub(cr... |
//! A composable abstraction for processing write requests.
mod r#trait;
pub use r#trait::*;
pub(crate) mod instrumentation;
pub(crate) mod tracing;
#[cfg(test)]
pub(crate) mod mock_sink;
|
use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::process;
fn main() {
let args: Vec<String> = env::args().collect();
let config = Config::new(&args).unwrap_or_else(|err| {
println!("Problem parsing arguments: {}", err);
process::exit(1);
});
println!("Searching for {... |
mod common;
mod lexer;
mod parser;
use self::parser::parse;
use super::build::Link;
use super::error::JustTextError;
use super::meta::Metadatum;
use crate::assets::NOTE_TEMPLATE;
use chrono::{DateTime, Utc};
use handlebars::Handlebars;
use serde_json::json;
use std::error::Error;
use std::fs;
use std::path::Path;
pub... |
use super::*;
#[test]
fn write_empty_buffer_returns_zero() {
let rb = SpscRb::new(1);
let (_, producer) = (rb.consumer(), rb.producer());
let a: [u8; 0] = [];
match producer.write(&a) {
Ok(v) => assert_eq!(v, 0),
e => panic!("Error occured on get: {:?}", e),
}
}
#[test]
fn write_bl... |
use reqwest::Error;
pub trait Model<T> {
/// Finds a resource by its ID
///
/// # Example
/// ```
/// use jplaceholder::Model;
/// use jplaceholder::Post;
///
/// match Post::find(2) {
/// Some(post) => println!("Title of the article {}: {}", post.id, post.title),
/// None... |
// Tim Henderson <tim.tadh@gmail.com>
// Copyright 2014
// All rights reserved.
// For licensing information see the top level directory.
use std::iter::Iterator;
#[deriving(Show)]
#[deriving(PartialEq)]
pub enum TokenType {
TERM,
NONTERM,
SEMI,
VBAR,
ARROW,
EMPTY
}
#[deriving(Show)]
pub enum... |
#![feature(plugin, custom_derive)]
#![plugin(rocket_codegen)]
extern crate rocket;
extern crate rand;
use rand::Rng;
const BASE62: &'static [u8] = b"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
#[derive(FromForm)]
struct IDSpec {
size: usize
}
#[get("/")]
fn index() -> &'static str {
"
... |
extern crate libc;
extern crate num;
use std::ffi::CString;
use num::FromPrimitive;
use std::mem;
use std::ptr;
use constants::{SSHAuthResult,SSHAuthMethod,SSHOption,SSHRequest};
use native::libssh;
use native::server;
use ssh_key::SSHKey;
use util;
pub struct SSHSession {
_session: *mut libssh::ssh_session_str... |
use super::schema::blocks;
use diesel::{PgConnection, Connection, RunQueryDsl};
#[derive(Insertable)]
#[table_name = "blocks"]
pub struct NewBlock {
pub number: i64,
} |
use core::cmp::Ordering;
use guvm_rs::Value;
use super::util::*;
use super::CoreFailure;
use crate::{V, ValueBaseOrdered, ValueBase};
fun!(total_compare(v, w) {
Ok(match v.cmp(w) {
Ordering::Less => V::string("<"),
Ordering::Equal => V::string("="),
Ordering::Greater => V::string(">"),
... |
use clap::{crate_description, crate_name, crate_version, App, Arg, SubCommand};
use morgan::blockBufferPool::Blocktree;
use morgan::blockBufferPoolProcessor::process_blocktree;
use morgan_interface::genesis_block::GenesisBlock;
use std::io::{stdout, Write};
use std::process::exit;
fn main() {
morgan_logger::setup(... |
extern crate mray;
extern crate sdl2;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::pixels::Color;
use mray::algebra::Point2f;
use mray::canvas::Canvas;
fn find_sdl_gl_driver() -> Option<u32> {
for (index, item) in sdl2::render::drivers().enumerate() {
if item.name == "opengl" {
... |
// This file is part of Webb.
// Copyright (C) 2021 Webb Technologies Inc.
// 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://www.apache.o... |
use super::prelude::*;
use core::fmt;
/// handler method to be called on a state change
type StateChangeHander = dyn FnMut() -> Result<(), BangBangError> + Sync + Send;
/// simple on/off bang-bang controller
///
/// # Simple Example
/// ```
/// use bangbang::prelude::*;
///
/// fn example() -> Result<(), BangBangErro... |
use crate::error::ClientError;
use crypto_exports::bellman::{pairing::ff::PrimeField, PrimeFieldRepr};
use crypto_exports::franklin_crypto::alt_babyjubjub::fs::FsRepr;
use models::node::{priv_key_from_fs, Fs, PrivateKey};
use sha2::{Digest, Sha256};
// Public re-exports.
pub use models::node::{
closest_packable_fe... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor 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 ... |
use std::time::Duration;
use crate::{
Resource,
RotatorError,
RotatorEvent,
RotatorResult,
};
use crate::value::{get_secret_value, put_secret_value};
pub fn create_secret(e: RotatorEvent, r: Box<dyn Resource>) -> RotatorResult<()> {
let timeout = Duration::from_secs(2);
let current = get_secre... |
pub mod event;
pub mod core;
|
use std::fmt;
use std::str::FromStr;
use clap::ArgMatches;
use crate::config::options::{invalid_value, required_option_missing};
use crate::config::options::{OptionInfo, ParseOption};
/// The type of project we're building
#[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash, Debug)]
pub enum ProjectType {
... |
use std::io::Read;
fn read<T: std::str::FromStr>() -> T {
let token: String = std::io::stdin()
.bytes()
.map(|c| c.ok().unwrap() as char)
.skip_while(|c| c.is_whitespace())
.take_while(|c| !c.is_whitespace())
.collect();
token.parse().ok().unwrap()
}
fn main() {
let... |
mod human_agent;
pub use human_agent::HumanAgent;
mod random_agent;
pub use random_agent::RandomAgent;
mod training_agent;
pub use training_agent::TrainingAgent;
#[derive(PartialEq, Eq)]
enum Turn {
Player1,
Player2,
}
use Turn::*;
enum MoveResult {
None,
Lost,
Won,
}
#[allow(unused)]
#[derive... |
use serde::Deserialize;
use crate::{
options::{ClientOptions, ResolverConfig},
test::run_spec_test,
};
#[derive(Debug, Deserialize)]
struct TestFile {
uri: String,
seeds: Vec<String>,
hosts: Vec<String>,
options: Option<ResolvedOptions>,
parsed_options: Option<ParsedOptions>,
error: Op... |
//! Provides ready to use `NamedNode`s for basic RDF vocabularies
pub mod rdf {
//! [RDF 1.1](https://www.w3.org/TR/rdf11-concepts/) vocabulary
use crate::model::named_node::NamedNode;
use lazy_static::lazy_static;
lazy_static! {
/// The class of containers of alternatives.
pub static ... |
extern crate std;
use std::cmp::Ord;
use std::cmp::Ordering;
use std::collections::BinaryHeap;
use std::collections::HashMap;
#[derive(PartialEq, Eq)]
struct FNode<N: Eq>(i32, N);
impl<N: Eq> Ord for FNode<N> {
fn cmp(&self, other: &Self) -> Ordering {
self.0.cmp(&other.0).reverse()
}
}
impl<N: Eq> ... |
use super::tree::*;
use super::lexem::*;
use std::fmt::Debug;
use super::num::Float;
use std::str::FromStr;
use parser::faces::Function;
use std::collections::HashMap;
use parser::faces::FnFunction;
#[derive(Debug)]
pub struct BuilderErr(
String,
Option<Builder>,
);
type BuildResult = Result<Builder, BuilderE... |
// auto generated, do not modify.
// created: Wed Jan 20 00:44:03 2016
// src-file: /QtQml/qqmlprivate.h
// dst-file: /src/qml/qqmlprivate.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block begin =>
/... |
mod helper;
use self::helper::Checker;
use ert::prelude::*;
use futures::prelude::*;
#[tokio::test]
async fn global() {
Router::new(100).set_as_global();
let c = Checker::new();
let c1 = c.clone();
let futs: Vec<_> = (0u64..100)
.map(move |i| {
let c1 = c1.clone();
as... |
use crate::{serial_log, CONFIG};
use serde::Deserialize;
use serde_json_core;
#[derive(Deserialize, Debug)]
pub struct KernelConfig {
pub banner: bool,
}
pub fn get_config<'a>() {
match serde_json_core::from_str::<'a, KernelConfig>(CONFIG) {
Ok(_) => serial_log("hi"),
Err(e) => serial_log("Kerne... |
// extern crate csv;
extern crate csv;
extern crate subprocess;
use std::error::Error;
use std::fs::File;
use std::process;
use subprocess::{Exec, Redirection};
type Record = (String);
fn main() {
let mut conn = Vec::new();
// test function
if let Err(err) = csv(&mut conn) {
println!("{}", err);... |
/* Copyright 2016 Joshua Gentry
*
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
* http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
* <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
* option. This file may not be copied, modified, or distributed
* except according t... |
extern crate nalgebra;
extern crate num;
mod basis;
mod braket;
mod context;
mod op;
mod state;
mod system;
pub use braket::Braket;
pub use op::Op;
pub use state::State;
pub use system::System;
|
use yew::prelude::*;
use yewdux::prelude::*;
use yewtil::NeqAssign;
// use yew::services::ConsoleService;
use crate::store::reducer::{
AppDispatch,
Action,
Counter
};
pub struct ReducerGlobal {
dispatch: AppDispatch,
}
impl Component for ReducerGlobal {
type Message = ();
type Properties = Ap... |
use crate::color::Color;
use crate::intersectable::plane::Plane;
use crate::intersectable::sphere::Sphere;
use crate::light::Light;
use crate::light::LightType;
use crate::material::Material;
use crate::vector::Vec3;
use super::Scene;
impl Scene {
/// Example of a Scene you can find under the ``examples`` folder
... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
#[repr(transparent)]
pub struct AuthenticationProtocol(pub i32);
impl AuthenticationProtocol {
pub const Basic: Self = Self(0i32);
pub const Digest: Sel... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]... |
extern crate computer_repair;
use computer_repair::*;
fn main() {
let data = data::data();
let upper_bound = std::cmp::min(data.len(), 100);
for noun in 0..upper_bound {
for verb in 0..upper_bound {
let mut local = data.clone();
local[1] = noun;
local[2] = verb;
if interpret(&mut local) == 19690720... |
use core::marker::PhantomData;
use {Sink, Poll, StartSend};
/// A sink combinator to change the error type of a sink.
///
/// This is created by the `Sink::from_err` method.
#[derive(Clone, Debug)]
#[must_use = "futures do nothing unless polled"]
pub struct SinkFromErr<S, E> {
sink: S,
f: PhantomData<E>
}
pu... |
extern crate clang_sys; // NOTE: This should match the version used by clang ideally
pub extern crate clang;
use clang::*;
use std::collections::HashMap;
use std::error::Error;
const DERIVE: &'static str = "DERIVE";
/// Try to get the value at the cursor as an attribute(annotate). Returns the
/// name of the value ... |
use crate::app::Args;
use anyhow::Result;
use clap::Parser;
use maple_core::process::shell_command;
use maple_core::process::{CacheableCommand, ShellCommand};
use std::path::PathBuf;
use std::process::Command;
/// Execute the shell command
#[derive(Parser, Debug, Clone)]
pub struct Exec {
/// Specify the system co... |
use proconio::input;
#[allow(unused_macros)]
macro_rules! dbg {
($($arg:tt)*) => {{
#[cfg(debug_assertions)]
std::dbg!($($arg)*);
}};
}
fn main() {
input! {
d: usize,
l: usize,
n: usize,
c: [usize; d],
};
const M: usize = 100_000;
let mut pos =... |
use bot_commands::{BOTUTILS_GROUP, CMD_HELP, GENERAL_GROUP};
use bot_config::BotConfig;
use bot_db::{dyn_prefix, PgPoolKey, DATABASE_ENABLED};
use bot_events::{BotEventHandler, BotRawEventHandler};
use bot_utils::ShardManagerWrapper;
use serenity::client::bridge::gateway::GatewayIntents;
use serenity::client::{parse_to... |
use tuber_math::matrix::Matrix4f;
use tuber_math::quaternion::Quaternion;
use tuber_math::vector::Vector3;
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Transform {
pub translation: Vector3<f32>,
pub angle: Vector3<f32>,
pub rotation_center: Vector3<f32>,
pub scale: Vector3<f32>,
}
impl Default ... |
//! A collection of serialization and deserialization functions
//! that use the `serde` crate for the serializable and deserializable
//! implementation.
use std::io::{self, Write, Read};
use std::{error, fmt, result};
use std::str::Utf8Error;
use {CountSize, SizeLimit};
use byteorder::ByteOrder;
use std::error::Erro... |
// Copyright 2017 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 ... |
pub mod config {
use std::env::{var, VarError};
#[derive(Debug)]
pub struct DbCfg {
pub host: String,
pub user: String,
pub pw: String,
pub port: String,
pub name: String,
}
#[derive(Debug)]
pub struct ApiCfg {
pub port: String,
pub i... |
use error::BannerError;
use flag::{Flag, FlagPath};
use store::ThreadedStore;
use user::User;
pub type FlagStore = ThreadedStore<FlagPath, Flag, Error = BannerError>;
pub type PathStore = ThreadedStore<String, FlagPath, Error = BannerError>;
pub type UserStore = ThreadedStore<String, User, Error = BannerError>;
pub s... |
mod tunmgr;
pub use tunmgr::*;
mod tunnel;
pub use tunnel::*;
mod theader;
pub use theader::*;
mod tunbuilder;
pub use tunbuilder::*;
mod reqserv;
pub use reqserv::*;
mod reqq;
pub use reqq::*;
mod tunstub;
pub use tunstub::*;
mod request;
pub use request::*;
|
#![feature(exit_status)]
extern crate lines;
extern crate lisp;
use std::env;
use std::io::{StdoutLock, Write, self};
use lines::Lines;
use lisp::diagnostics;
use lisp::syntax::ast::Expr;
use lisp::syntax::codemap::Source;
use lisp::syntax::pp;
use lisp::syntax::{Error, parse};
use lisp::util::interner::Interner;
f... |
extern crate clap;
extern crate toml;
extern crate rustc_serialize;
mod config;
use std::io::prelude::*;
use std::fs::File;
use std::process;
use std::process::Command;
use toml::{Parser, Value};
use clap::{Arg, App, SubCommand};
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
const APP_NAME: &'static str = ... |
use chrono::{NaiveDate, NaiveDateTime};
use polars::prelude::{DataFrame, NamedFrom};
use polars::series::Series;
use ukis_clickhouse_arrow_grpc::{ArrowInterface, Client, QueryInfo};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// install global collector configured based on RUST_LOG env var.
tracing... |
// TODO: support for other types (e.g. integers)
use super::secure_zero_memory;
#[cfg(feature = "std")]
use std::prelude::v1::*;
/// Trait for securely erasing types from memory
pub trait Zeroize {
/// Zero out this object from memory (using Rust or OS intrinsics which
/// ensure the zeroization operation is... |
use futures::{prelude::*, FutureExt};
use test_helpers_end_to_end::{
maybe_skip_integration, GrpcRequestBuilder, MiniCluster, Step, StepTest, StepTestState,
TestConfig, UdpCapture,
};
use trace_exporters::DEFAULT_JAEGER_TRACE_CONTEXT_HEADER_NAME;
#[tokio::test]
pub async fn test_tracing_sql() {
let databas... |
use cli::command::dumb_jump::DumbJump;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use filter::{MatchedItem, Query, SourceItem};
use maple_core::find_largest_cache_digest;
use maple_core::tools::ctags::{ProjectCtagsCommand, ProjectTag};
use matcher::{Matcher, MatcherBuilder};
use rayon::prel... |
extern crate ed25519_dalek;
extern crate miniz_oxide;
extern crate rand;
extern crate serde_json;
extern crate sha3;
extern crate simple_logger;
#[macro_use]
extern crate lazy_static;
pub mod block;
mod blockchain;
pub mod config;
pub mod p2p;
use ed25519_dalek::Keypair;
use rand::rngs::OsRng;
fn main() {
simple_l... |
use rough::na::Vector2;
pub struct ControlSettings {
pub mouse: MouseSettings,
}
impl Default for ControlSettings {
fn default() -> Self {
ControlSettings {
mouse: Default::default(),
}
}
}
pub struct MouseSettings {
pub invert_y: bool,
pub sensitivity: Vector2<f32>,
}... |
use proconio::{input, marker::Bytes};
fn calc(s: &[u8], t: &[u8]) -> usize {
let n = s.len().min(t.len());
for i in 0..n {
if s[i] != t[i] {
return i;
}
}
n
}
fn main() {
input! {
n: usize,
s: [Bytes; n],
};
let mut ord = Vec::new();
for i i... |
// RGB standard library
// Written in 2020 by
// Dr. Maxim Orlovsky <orlovsky@pandoracore.com>
//
// 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 software is distributed without
// any warr... |
use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
use smart_default::SmartDefault;
use crate::AudioGroupId;
#[derive(Debug, Serialize, Deserialize, Default, PartialEq, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Sound {
/// The type of compression for the file.
... |
use super::Object;
use std::cell::RefCell;
use std::collections::HashMap;
use std::io::{Result, Write};
use std::rc::Rc;
pub trait PDFData: std::fmt::Debug {
fn write(&self, o: &mut dyn Write) -> Result<()>;
fn dependent_objects(&self) -> Vec<Rc<dyn Object>> {
vec![]
}
}
impl PDFData for usize {
... |
#[cfg(all(not(target_arch = "wasm32"), test))]
mod test;
use anyhow::*;
use liblumen_alloc::erts::exception::{self, *};
use liblumen_alloc::erts::process::trace::Trace;
use liblumen_alloc::erts::term::prelude::Term;
#[native_implemented::function(erlang:throw/1)]
pub fn result(reason: Term) -> exception::Result<Term... |
// Copyright 2014 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 ... |
#![allow(unreachable_code)]
use std::{collections::HashMap, convert::Infallible};
use async_graphql::{
dataloader::{DataLoader, Loader},
*,
};
#[tokio::test]
pub async fn test_nested_key() {
#[derive(InputObject)]
struct MyInputA {
a: i32,
b: i32,
c: MyInputB,
}
#[der... |
use super::*;
use proptest::prop_oneof;
use proptest::strategy::Strategy;
#[test]
fn without_list_or_bitstring_returns_false() {
run!(
|arc_process| {
strategy::term(arc_process.clone())
.prop_filter("Right cannot be a list or bitstring", |right| {
!(right.i... |
use input_i_scanner::InputIScanner;
fn main() {
let stdin = std::io::stdin();
let mut _i_i = InputIScanner::from(stdin.lock());
macro_rules! scan {
(($($t: ty),+)) => {
($(scan!($t)),+)
};
($t: ty) => {
_i_i.scan::<$t>() as $t
};
(($($t: ty),... |
use crate::cursor::Cursor;
use crate::ecc::{PrivateKey, N};
use crate::helpers::{hash_160, hmac_512};
use crate::seed_phrase::SeedPhrase;
use bigint::{U256, U512};
use byteorder::{BigEndian, WriteBytesExt};
use core::convert::TryInto;
use genio::Read;
//use sha2::Digest;
use hashbrown::HashMap;
//use hex::decode;
use h... |
/* origin: FreeBSD /usr/src/lib/msun/src/s_log1pf.c */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is free... |
use super::*;
use crate::test::with_big_int;
#[test]
fn with_small_integer_divisor_with_underflow_returns_small_integer() {
with_big_int(|process, dividend| {
let divisor: Term = process.integer(2);
assert!(divisor.is_smallint());
let result = result(process, dividend, divisor);
... |
#[link(wasm_import_module = "xyz")]
extern "C" {
fn poll_word(addr: i64, len: i32) -> i32;
}
#[no_mangle]
pub unsafe extern "C" fn do_work() {
let mut buf = [0u8; 1024];
let buf_ptr = buf.as_mut_ptr() as i64;
eprintln!("Buffer base address: {}", buf_ptr);
let len = poll_word(buf_ptr, buf.len() as i... |
{{#with Choice~}}
{{>choice.getter use_old=../use_old}}
{{~else~}}
{{Code}}
{{~/with~}}
|
use super::{SimpleSyntaxType, SyntaxType};
use crate::ast::stat_expr_types::DataType;
pub fn explicity_type_cast<'a>(
cur_type: &SyntaxType<'a>,
dest_type: &DataType<'a>,
) -> (bool, SyntaxType<'a>) {
let cur_type = cur_type.get_v_for_vf();
let (mut is_cast_err, mut result) = implicity_type_cast(cur_ty... |
#[doc = r"Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::ADDR1H {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &... |
use std::io::BufRead;
#[derive(Debug)]
struct Policy {
min: usize,
max: usize,
letter: char,
}
#[derive(Debug)]
struct PasswordLine {
policy: Policy,
password: String,
}
fn main() {
let file = std::fs::File::open("input").unwrap();
let lines = std::io::BufReader::new(file)
.lines(... |
//! The unsafe `close` for raw file descriptors.
//!
//! # Safety
//!
//! Operating on raw file descriptors is unsafe.
#![allow(unsafe_code)]
use crate::backend;
use backend::fd::RawFd;
/// `close(raw_fd)`—Closes a `RawFd` directly.
///
/// Most users won't need to use this, as `OwnedFd` automatically closes its
/// ... |
#[allow(unused_macros)]
macro_rules! parse_line {
[$( $x:tt : $t:ty ),+] => {
//declare variables
$( let $x: $t; )+
{
use std::str::FromStr;
// read
let mut buf = String::new();
std::io::stdin().read_line(&mut buf).unwrap();
#[allow... |
#[doc = "Reader of register TZSC_SECCFGR2"]
pub type R = crate::R<u32, super::TZSC_SECCFGR2>;
#[doc = "Writer for register TZSC_SECCFGR2"]
pub type W = crate::W<u32, super::TZSC_SECCFGR2>;
#[doc = "Register TZSC_SECCFGR2 `reset()`'s with value 0"]
impl crate::ResetValue for super::TZSC_SECCFGR2 {
type Type = u32;
... |
use std::error::Error;
use std::path::PathBuf;
extern crate log;
use bio::io::fasta;
use structopt::StructOpt;
use rnc_core::json_sequence::{each_sequence, Sequence};
use rnc_core::urs_taxid::UrsTaxid;
pub mod container;
use crate::container::UrsTaxidContainer;
/// This is a command to process a list of active u... |
// Copyright 2022 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
#[macro_use] extern crate lazy_static;
extern crate regex;
use regex::Regex;
use std::collections::HashMap;
fn main() {
println!("Hello, world!");
}
#[derive(Debug, PartialEq)]
enum Message {
WakesUp,
FallsAsleep,
BeginsShift(u32)
}
enum GuardState {
OffShift,
Asleep,
Awake
}
fn get_time... |
/* origin: FreeBSD /usr/src/lib/msun/src/s_cbrtf.c */
/*
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
* Debugged and optimized by Bruce D. Evans.
*/
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Deve... |
use futures::stream::{TryStream, TryStreamExt};
use std::error::Error as StdError;
use warp::http::header::{HeaderValue, CONTENT_TYPE, TRAILER};
use warp::http::Response;
use warp::hyper::body::Bytes;
use warp::hyper::Body;
use warp::Reply;
pub struct StreamResponse<S>(pub S);
impl<S> Reply for StreamResponse<S>
wher... |
use std::io::prelude::*;
use std::fs::File;
use std::io::BufReader;
use std::collections::HashSet;
fn swap(v: &mut Vec<u8>, i:usize, j:usize){
let swap = v[i];
v[i]=v[j];
v[j] =swap;
}
///idx is the hold index
///iterate and swap until no longer able to
fn permute(input: &mut String, hold: u32, results: &mut Has... |
::windows_sys::core::link ! ( "websocket.dll""system" #[doc = "*Required features: `\"Win32_Networking_WebSocket\"`*"] fn WebSocketAbortHandle ( hwebsocket : WEB_SOCKET_HANDLE ) -> ( ) );
::windows_sys::core::link ! ( "websocket.dll""system" #[doc = "*Required features: `\"Win32_Networking_WebSocket\"`*"] fn WebSocketB... |
//! Delays
use core::convert::Infallible;
use embedded_hal::blocking::delay::{DelayMs, DelayUs};
/// Use RISCV machine-mode cycle counter (`mcycle`) as a delay provider.
///
/// This can be used for high resolution delays for device initialization,
/// bit-banging protocols, etc
#[derive(Copy, Clone)]
pub struct Mcyc... |
#![deny(warnings)]
extern crate futures;
extern crate loom;
#[path = "../src/oneshot.rs"]
#[allow(warnings)]
mod oneshot;
use futures::{Async, Future};
use loom::futures::block_on;
use loom::thread;
#[test]
fn smoke() {
loom::fuzz(|| {
let (tx, rx) = oneshot::channel();
thread::spawn(move || {
... |
//! Module providing the TermLogger Implementation
use log::{
set_boxed_logger, set_max_level, Level, LevelFilter, Log, Metadata, Record, SetLoggerError,
};
use std::io::{Error, Write};
use std::sync::Mutex;
use termcolor::{BufferedStandardStream, ColorChoice};
#[cfg(not(feature = "ansi_term"))]
use termcolor::{Co... |
// Issue #53
fn main() {
alt "test" { "not-test" { fail; } "test" { } _ { fail; } }
tag t { tag1(str); tag2; }
alt tag1("test") {
tag2. { fail; }
tag1("not-test") { fail; }
tag1("test") { }
_ { fail; }
}
} |
// Copyright 2022 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.