text stringlengths 8 4.13M |
|---|
import std::ivec;
import std::option;
import std::map::hashmap;
import driver::session::session;
import codemap::span;
import std::map::new_str_hash;
import codemap;
type syntax_expander =
fn(&ext_ctxt, span, @ast::expr, option::t[str]) -> @ast::expr ;
type macro_def = {ident: str, ext: syntax_extension};
type mac... |
use crate::error::HandleError;
use crate::filter::{account_by_session, changed_visibility_by_query, with_db};
use model::Account;
use mysql::MySqlPool;
use repository::ChangeAccountVisibility;
use warp::filters::BoxedFilter;
use warp::path;
use warp::{Filter, Rejection, Reply};
pub fn route(db_pool: &MySqlPool) -> Box... |
use std::env::var;
use solana_client::rpc_client::RpcClient;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signer::{
keypair::{read_keypair_file, Keypair},
Signer,
};
#[derive(Debug)]
pub enum StateError {
SolanaMissingAPIUrl(String),
SolanaMissingKeypairPath(String),
SolanaKeypairLoadError(Stri... |
use day01;
fn main() {
let input: Vec<&str> = include_str!("../../input/2018/day1.txt").lines().collect();
println!("Part 1: {}", day01::part1(&input));
println!("Part 2: {}", day01::part2_functional(&input));
}
|
pub mod closed_range;
pub mod open_range;
// 自身しか関わらないもの
pub trait SelfRange {
fn new(lower: i8, upper: i8) -> Self;
fn to_string(&self) -> String;
fn contains(&self, number: i8) -> bool;
fn contains_all(&self, numbers: Vec<i8>) -> bool {
for number in numbers {
if !self.contains(number) {
re... |
use crate::error::{Error, ParserError, ParserErrorKind as PEK};
use crate::iter::MultiPeek;
use crate::lexer::{TokenIterator, Token, TokenKind as TK};
use crate::position::Position;
use std::collections::BTreeMap;
use std::rc::Rc;
use ExprKind as EK;
#[derive(Clone, Debug)]
pub struct FunctionBean {
pub params: V... |
use std::marker::PhantomData;
use actix_codec::{AsyncRead, AsyncWrite};
use actix_service::{NewService, Service};
use futures::{future::ok, future::FutureResult, Async, Future, Poll};
use openssl::ssl::{HandshakeError, SslConnector};
use tokio_openssl::{ConnectAsync, SslConnectorExt, SslStream};
use crate::resolver::... |
use P25::random_permute;
fn main() {
let li = vec!['a', 'b', 'c', 'd', 'e', 'f'];
println!("{:?}", random_permute(&li));
println!("{:?}", random_permute(&li));
println!("{:?}", random_permute(&li));
}
|
extern crate bmp;
extern crate rusterizer;
use bmp::{Image, Pixel};
use rusterizer::geometry::{Drawable, Line, Rect};
/*
A bare bones program drawing some lines and rectangles
to a BMP context which then renders into a BMP file
*/
fn main() {
let imgx : u32 = 300;
let imgy : u32 = 300;
let mu... |
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
use std::{
collections::HashMap,
io::{Write},
};
use rbx_xml::{EncodeError};
use rbx_dom_weak::{RbxValue, RbxTree, RbxInstanceProperties};
pub struct RunInRbxPlace {
tree: RbxTree,
}
impl RunInRbxPlace {
pub fn new(mut tree: RbxTree, port: u16) -> RunInRbxPlace {
enable_http(&mut tree);
... |
// This file is part of linux-epoll. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri... |
use super::*;
#[test]
fn with_lesser_small_integer_second_returns_second() {
min(|_, process| process.integer(-1), Second);
}
#[test]
fn with_same_small_integer_second_returns_first() {
min(|first, _| first, First);
}
#[test]
fn with_same_value_small_integer_second_returns_first() {
min(|_, process| proc... |
use std::fs::File;
use std::io::prelude::*;
use std::{thread, time};
fn main() {
let mut f1 = File::create("/sys/class/gpio/export").unwrap();
f1.write_all(b"0");
let mut f2 = File::create("/sys/class/gpio/gpio0/direction").unwrap();
f2.write_all(b"out");
let mut f3 = File::create("/sys/... |
// call all intro 1 functions
pub fn _intro_1_notes() {
_mutability();
_tuples();
_arrays();
_strings();
_ownership();
_structures();
_control_flow();
_enums_and_options();
_vectors_and_hashmaps();
_casting_and_lets_and_result();
}
// underscore suppresses the "unused" warning.
... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IRadialControllerConfigurationInterop(pub ::wi... |
use crate::metadata::Metadata;
use crate::spatial_ref::SpatialRef;
use crate::utils::{_last_null_pointer_err, _string};
use crate::vector::defn::Defn;
use crate::vector::{Feature, FieldValue, Geometry};
use crate::{dataset::Dataset, gdal_major_object::MajorObject};
use gdal_sys::{
self, GDALMajorObjectH, OGREnvelop... |
extern crate regex;
use std::io;
use std::fs;
use std::io::BufRead;
use std::path::Path;
use std::collections::HashSet;
fn main() {
let input = parse_input();
let val = "FBFBBFFRLR";
println!("{} => {}", val, line_to_seat_number(val));
let min = input.taken_seats.iter().min().unwrap();
let max = ... |
use super::{run_data_test, InfluxRpcTest};
use async_trait::async_trait;
use data_types::{MAX_NANO_TIME, MIN_NANO_TIME};
use futures::{prelude::*, FutureExt};
use std::sync::Arc;
use test_helpers_end_to_end::{DataGenerator, GrpcRequestBuilder, MiniCluster, StepTestState};
#[tokio::test]
async fn measurement_names() {
... |
use super::*;
impl Mask {
pub fn single_bits(self) -> MaskIter {
MaskIter(self)
}
pub fn single_bit_indices(self) -> IndexIter {
IndexIter(self)
}
}
#[derive(Eq, Copy, Clone, Debug, PartialEq)]
pub struct MaskIter(Mask);
impl Iterator for MaskIter {
type Item = Mask;
fn next(&... |
use std::collections::HashSet;
use divisors::Divisors;
use proconio::input;
fn main() {
input! {
n: usize,
m: usize,
a: [usize; m],
};
let set: HashSet<usize> = a.into_iter().collect();
let mut open = vec![false; n + 1];
let mut ans = n;
for i in (1..=n).rev() {
... |
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::source::snippet_with_context;
use clippy_utils::ty::implements_trait;
use if_chain::if_chain;
use rustc_errors::Applicability;
use rustc_hir::{Expr, ExprKind, Pat, PatKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty::Ty;
use ru... |
use async_channel::{Receiver, Sender};
use net::{packets::*, Runtime};
mod server_net;
use server_net::server;
mod database;
use database::*;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
use simple_logger::SimpleLogger;
#[derive(PartialEq, Eq, Hash)]
struct Country {
owner: UserId,
}
async f... |
use actix::prelude::*;
use failure::{err_msg, Fallible};
use std::collections::{HashMap, VecDeque};
use std::time::Duration;
use ycommon::runner_proto as proto;
use super::client_proto::*;
use super::runner_proxy::{self, MsgRunnerEvent, RunnerProxy};
use super::*;
use crate::{
app::{self, api},
db,
};
pub ty... |
use crate::{FunctionData, Instruction, Value, Location, Set};
enum Prop {
Value(Value),
Undef,
Nop,
None,
}
pub struct UndefinedPropagatePass;
impl super::Pass for UndefinedPropagatePass {
fn name(&self) -> &str {
"undefined propagation"
}
fn time(&self) -> crate::timing::TimedBl... |
// 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 ... |
use std::borrow::Cow;
use std::convert::TryFrom;
use byteorder::{ByteOrder, LittleEndian};
use time::{Date, OffsetDateTime, PrimitiveDateTime, Time, UtcOffset};
use crate::decode::Decode;
use crate::encode::Encode;
use crate::io::{Buf, BufMut};
use crate::mysql::protocol::TypeId;
use crate::mysql::type_info::MySqlTyp... |
use std::any::type_name;
use std::fmt::{Formatter, Display, Result};
fn reverse(pair: (i32, &'static str)) -> (&'static str, i32){
return (pair.1, pair.0);
}
fn reverse2(pair: (i32, &'static str)) -> (&'static str, i32){
let (the_int, the_string) = pair; //destruct the pair.
return (the_string, the_int);
}
fn ... |
use std::cmp;
use std::io::Read;
fn main() {
let mut buf = String::new();
// 標準入力から全部bufに読み込む
std::io::stdin().read_to_string(&mut buf).unwrap();
// 行ごとのiterが取れる
let mut iter = buf.split_whitespace();
let polititian_number: usize = iter.next().unwrap().parse().unwrap();
let relation_numbe... |
#[path = "spawn_monitor_1/with_function.rs"]
pub mod with_function;
// `without_function_errors_badarg` in unit tests
|
pub mod controller;
pub mod models;
pub mod routes;
pub mod service;
|
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub type CompositeTransform3D = *mut ::core::ffi::c_void;
#[repr(C)]
pub struct Matrix3D {
pub M11: f64,
pub M12: f64,
pub M13: f64,
pub M14: f6... |
// Copyright 2018 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 ... |
use image::ImageResult;
use std::env;
fn to_u32(v: String) -> Option<u32> {
v.parse().ok()
}
fn main() -> ImageResult<()> {
let mut args = env::args().skip(1);
let file = args.next().unwrap();
let w = args.next().and_then(to_u32).unwrap();
let h = args.next().and_then(to_u32).unwrap();
let de... |
use doc_comment::doctest;
doctest!("../../README.md");
|
// xfail-stage0
// -*- rust -*-
use std;
import std.rand;
fn main() {
let rand.rng r1 = rand.mk_rng();
log r1.next();
log r1.next();
{
auto r2 = rand.mk_rng();
log r1.next();
log r2.next();
log r1.next();
log r1.next();
log r2.next();
log r2.next();
log r1.next();
log r1.ne... |
use super::BufferInfo;
use super::TextureInfo;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CommonTextureUsage {
Sample,
StorageRead,
ResolveSrc,
BlitSrc,
DepthRead
}
pub struct TextureResourceInfo {
pub texture_info: TextureInfo,
pub common_usage: CommonTextureUsage
}
pub trait TextureResourc... |
use super::error::Error;
use super::events::{validate_message, validate_thread};
use super::http_multipart::extract_file;
use super::image;
use super::limits::{Limits, LIMITS};
use data::{Config, FullThread, NewMessage, NewThread, Threads};
use db::Db;
use rocket::fairing::AdHoc;
use rocket::http::ContentType;
use rock... |
// Copyright 2021 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 ... |
use std::io::{Read, Write};
use byteorder::{ReadBytesExt, WriteBytesExt};
pub mod field;
use record::field::FieldType;
use Error;
use std::convert::TryFrom;
#[derive(Copy, Clone)]
pub struct FieldFlags(u8);
impl FieldFlags {
pub fn new() -> Self {
Self { 0: 0 }
}
pub fn system_column(self) -> ... |
use std::{
collections::BTreeMap,
fmt::{self, Display, Formatter},
ops::{Deref, DerefMut},
};
use serde::{Deserialize, Deserializer, Serialize};
use crate::{ConstValue, Name};
/// Variables of a query.
#[derive(Debug, Clone, Default, Serialize, Eq, PartialEq)]
#[serde(transparent)]
pub struct Variables(B... |
//! Compute and represent local information on the different objects representing of the IR.
use crate::device::{Context, Device};
use crate::ir::{self, Statement};
use crate::model::{size, HwPressure};
use crate::search_space::{DimKind, Domain, Order, SearchSpace, ThreadMapping};
use fxhash::FxHashMap;
use itertools::... |
// Copyright 2019. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
use errors::*;
use regex;
use std;
use std::io::Read;
use tempfile;
pub struct Changeset {
pub title: String,
pub message: Option<String>,
pub branch: Option<String>,
pub pr: Option<String>,
}
impl Changeset {
const BRANCH_FIELD_LABEL: &'static str = "Branch name:";
const PR_FIELD_LABEL: &'sta... |
use chrono::{TimeZone, Utc};
use jenkins_api::{
build::{BuildStatus, CommonBuild},
client::{Path, TreeBuilder},
Jenkins, JenkinsBuilder,
};
use serde::Deserialize;
type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
#[derive(Clone)]
struct BuildInfo {
#[allow(dead_code)] // We curren... |
use crate::interface::{
BlockHeight, BlockTimestamp, ContractBalances, ContractFinancials, EarningsDistribution,
};
//required in order for near_bindgen macro to work outside of lib.rs
use crate::config::CONTRACT_MIN_OPERATIONAL_BALANCE;
use crate::near::log;
use crate::*;
use near_sdk::near_bindgen;
#[near_bindg... |
/*
A few simple abstractions for distributed communication over a network.
*/
use super::util::sleep_for_secs;
use std::io::{Read, Write};
use std::net::{Ipv4Addr, SocketAddrV4, TcpListener, TcpStream};
use std::str;
fn parse_host(host: &str) -> Ipv4Addr {
if host.to_lowercase() == "localhost" {
Ipv4... |
pub struct Solution;
impl Solution {
pub fn find_itinerary(tickets: Vec<Vec<String>>) -> Vec<String> {
use std::collections::HashMap;
let mut nexts = HashMap::new();
let mut count = 0;
let mut head = Vec::new();
let mut tail = Vec::new();
for mut ticket in tickets {
... |
// Copyright 2021 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 agre... |
use error::*;
use byteorder::{WriteBytesExt, LittleEndian, BigEndian};
use std::any::Any;
macro_rules! impl_serialize {
($type:path, $write:path) => {
impl Serialize for $type {
#[inline]
fn serialize_to(&self, buffer: &mut Vec<u8>) -> Result<()> {
$write(buffer, *se... |
mod thread_pool;
use std::net::{TcpListener, TcpStream};
use std::io::{Read, Write};
use std::time::Duration;
use std::sync::{Arc, RwLock};
fn main() {
let tcp_listener = TcpListener::bind("localhost:7878")
.unwrap_or_else(|err| {
eprintln!("Error occurred: {}", err);
std::process:... |
extern crate genetic_bf;
extern crate clap;
extern crate serde_yaml;
use std::fs::File;
use std::io::{Read, Error, ErrorKind, stdin, stdout};
use clap::{Arg, App};
use genetic_bf::{Config, VM, VMResult, generate_program};
fn main() {
let args = App::new("genetic-bf")
.version("0.1.0")
.author("B... |
use std::borrow::Cow;
use std::path::Path;
use hashlink::LinkedHashMap;
use url::{ParseError, Url};
use crate::{CreditCard, Login, Record, SecureNote, SoftwareLicence};
const SKIP_KEYS: &[&str] = &["^html", "^recaptcha", "commit", "op", "label", "action"];
const SKIP_VALUES: &[&str] = &["✓", "SEND", "Y"];
const LOGI... |
extern crate percent_encoding;
use percent_encoding::{percent_decode, percent_encode, DEFAULT_ENCODE_SET};
use std::slice;
/// Fill the provided output buffer with the quoted string.
///
/// # Parameters
///
/// * input_buf: Non-null pointer to UTF-8-encoded character sequence to be quoted. A terminating
/// ... |
use glam::{Quat, Vec3};
use crate::error::ReadValueError;
use std::convert::TryInto;
pub struct ReadBuffer {
buffer: Vec<u8>,
position: usize,
}
impl<'a> ReadBuffer {
pub fn new(buffer: Vec<u8>) -> Self {
Self {
buffer,
position: 0,
}
}
pub fn read_array<const COUNT: usize>(
&mut self,
type_name: ... |
use std::env;
use diesel::pg::PgConnection;
use diesel::r2d2::{ConnectionManager, Pool, PooledConnection};
use futures::future::{self, Future};
use serde_json;
use warp::{Filter, Reply, Rejection};
use crate::exception::{self, INTERNAL_SERVER_ERROR};
type PgPool = Pool<ConnectionManager<PgConnection>>;
pub type PgPo... |
#[tokio::test]
async fn multiple_consecutive_ephemeral_listening_addresses() {
let node = ipfs::Node::new("test_node").await;
let target = libp2p::build_multiaddr!(Ip4([127, 0, 0, 1]), Tcp(0u16));
let first = node.add_listening_address(target.clone()).await.unwrap();
assert_ne!(target, first);
le... |
use libc::{c_char, size_t};
pub const ERROR_MSG_SIZE_MAX: usize = 256;
pub const ERROR_MSG_SLEN_MAX: usize = ERROR_MSG_SIZE_MAX - 1;
#[link(name = "kernaux")]
extern "C" {
#[link_name = "kernaux_cmdline"]
// TODO: Rust's "bool" is not guaranteed to be compatible with C's one
pub fn cmdline(
cmdlin... |
#![feature(ip_constructors)]
extern crate clap;
extern crate reqwest;
extern crate rottenbrit;
extern crate url;
use std::io::Read;
use url::percent_encoding::{percent_encode as pe, DEFAULT_ENCODE_SET};
use rottenbrit::metainfo::{MetaInfo, get_info_hash};
fn percent_encode(input: &[u8]) -> String {
pe(input, ... |
mod args;
mod exec;
mod monitor;
use clap::{crate_authors, crate_version, App, AppSettings, Arg, ArgMatches, Result as ClapResult};
use inflector::Inflector;
use n3_builder::{ast, dirs, inflector, ExecRoot, GlobalVars, Result, Vars, QUERY_SPLIT_1};
use crate::args::Command;
pub const SWITCH_FN_1: &[(&str, FnExec)] ... |
use std::{future, sync::Arc};
use futures::{stream, StreamExt};
use observability_deps::tracing::debug;
use parking_lot::Mutex;
use tokio::time::Instant;
use crate::buffer_tree::partition::PartitionData;
use super::queue::PersistQueue;
/// [`PERSIST_ENQUEUE_CONCURRENCY`] defines the parallelism used when acquiring
... |
//! Macros for implementing common functionality and traits for the marked
//! pointer types with identical internal structure (Owned, Shared, Unlinked and
//! Unprotected)
macro_rules! impl_trait {
($self:ident) => {
type Pointer = Self;
type Item = T;
type MarkBits = N;
#[inline]... |
use winnow::prelude::*;
use winnow::Partial;
mod json;
mod parser;
mod parser_dispatch;
mod parser_partial;
fn json_bench(c: &mut criterion::Criterion) {
let data = [("small", SMALL), ("canada", CANADA)];
let mut group = c.benchmark_group("json");
for (name, sample) in data {
let len = sample.len(... |
use super::{Expr};
use derive_more::Display;
use std::ops;
#[derive(Display, Clone, Copy)]
pub enum Number {
Int(i32),
Float(f32),
}
impl Number {
pub const fn simplify(self) -> Expr {
Expr::Number(self)
}
}
impl PartialEq<i32> for Number {
fn eq(&self, other: &i32) -> bool {
use ... |
use super::{DiscordHandler, DiscordMsg};
use async_trait::async_trait;
/// Prints events at [`tracing::Level::DEBUG`] and errors at [`tracing::Level::WARN`]
pub struct Printer;
#[async_trait]
impl DiscordHandler for Printer {
async fn on_message(&self, msg: DiscordMsg) {
match msg {
DiscordMsg... |
mod reader;
pub use reader::{ClosedSegmentFileReader, Error as ReaderError, Result as ReaderResult};
mod writer;
pub use writer::{Error as WriterError, OpenSegmentFileWriter, Result as WriterResult};
|
use anyhow::{anyhow, Result};
use audio_device::wasapi;
use audio_generator::{self as gen, Generator as _};
fn run_output<T>(client: wasapi::Client, mut config: wasapi::ClientConfig) -> Result<()>
where
T: Copy + wasapi::Sample + audio_core::Translate<f32>,
[T]: rand::Fill,
{
config.sample_rate = 120000;
... |
use std::any::TypeId;
use ttmap::{TypeMap, ValueBox};
#[test]
fn check_type_map() {
let mut map = TypeMap::new();
assert!(map.is_empty());
assert_eq!(map.len(), 0);
assert!(map.insert("test").is_none());
assert_eq!(*map.insert("lolka").unwrap(), "test");
assert_eq!(*map.get::<&'static str>().... |
pub ( in oo_facade) mod complex_parts {
const TORQUE_MUL: u32 = 1000;
pub use std::cell::Cell;
#[derive(Debug, Clone, Copy)]
pub enum Throttle {
Fw,
N
}
#[derive(Debug)]
pub struct Engine {
rpm: Cell<u32>
}
impl Engine {
pub fn new() -> Engine {
... |
// Copyright 2021 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 ... |
// Copyright 2021 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 ... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {
#[cfg(feature = "Win32_Foundation")]
pub fn AbortSystemShutdownA(lpmachinename: super::super::Foundation::PSTR) -> super::super::Foundation::BOOL;
#[... |
use ::std::ptr;
use std::alloc::{alloc, dealloc, Layout};
use std::io::{Read, Result, Write};
use std::mem::{align_of, size_of};
// -----------------------------------------------------------------------------
// - BadRingBuffer struct -
// ---------------------------------------------------------------------------... |
use git2::{ObjectType, Oid, Repository};
use regex::Regex;
use std::collections::HashMap;
use std::str::from_utf8;
use termion::color::{self, Fg};
// Macros for logging
macro_rules! info {
() => { format!("{}[INFO]{}", Fg(color::Green), Fg(color::Reset)) };
}
macro_rules! critical {
() => { format!("{}[CR... |
pub mod obscurificator;
|
use std::str::FromStr;
use std::path::PathBuf;
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr};
use super::FromCommandLine;
impl FromCommandLine for PathBuf {
fn from_argument(s: &str) -> Result<Self, String> {
Ok(From::from(s))
}
}
impl FromCommandLine for f32 {
fn from_argument(s: &str) -> Resu... |
use bytes::Buf;
use futures::{Async, Future, Poll};
use h2::{Reason, SendStream};
use http::header::{
HeaderName, CONNECTION, PROXY_AUTHENTICATE, PROXY_AUTHORIZATION, TE, TRAILER,
TRANSFER_ENCODING, UPGRADE,
};
use http::HeaderMap;
use body::Payload;
mod client;
pub(crate) mod server;
pub(crate) use self::cl... |
mod get_proof;
mod get_transaction_status;
pub(crate) use get_proof::get_proof;
pub(crate) use get_transaction_status::get_transaction_status;
|
use crate::wallet::wallet::WalletType;
use crate::address::traits::address::AddressI;
use crate::address::traits::address::AddressCheckI;
use crate::address::types::sm2p256v1::AddressSM2P256V1;
pub struct AddressBuilder {
address : Box<dyn AddressI>,
}
impl AddressBuilder {
pub fn new(seed_type:... |
// `with_empty_list_options` in integration tests
// `with_link_and_monitor_in_options_list` in integration tests
// `with_link_in_options_list` in integration tests
// `with_monitor_in_options_list` in integration tests
use super::*;
#[test]
fn without_proper_list_options_errors_badarg() {
run!(
|arc_pro... |
extern crate tiny_http;
extern crate multipart;
use std::io::{self, Cursor, Write};
use multipart::server::{Multipart, Entries, SaveResult};
use multipart::mock::StdoutTee;
use tiny_http::{Response, StatusCode, Request};
fn main() {
// Starting a server on `localhost:80`
let server = tiny_http::Server... |
use byteorder::LittleEndian;
use crate::io::Buf;
use crate::mysql::protocol::Status;
// https://dev.mysql.com/doc/dev/mysql-server/8.0.12/page_protocol_basic_eof_packet.html
// https://mariadb.com/kb/en/eof_packet/
#[derive(Debug)]
pub struct EofPacket {
pub warnings: u16,
pub status: Status,
}
impl EofPacke... |
use std::fs;
use std::time::Instant;
use std::hash::Hash;
use std::collections::HashMap;
#[derive(Debug,Ord, PartialOrd, Eq, PartialEq,Clone,Hash)]
struct Contraint {
first_range: (u16, u16),
second_range: (u16, u16),
name:String,
}
fn parse_constraint(puzzle: Vec<String>) -> Vec<Contraint> {
let mut ... |
use gstreamer::glib;
use gstreamer::glib::translate::{from_glib, FromGlib, IntoGlib, ToGlibPtr, ToGlibPtrMut};
use gstreamer::glib::value::FromValue;
use gstreamer::glib::StaticType;
use std::ffi::{c_char, c_int};
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum AudioVisua... |
extern crate libc as c;
use std::net::{Ipv4Addr,SocketAddrV4};
use std;
pub fn into_c_sockaddr(addr: &SocketAddrV4) -> c::sockaddr_in {
let ip = addr.ip();
let octet = ip.octets();
let inaddr = c::in_addr{ s_addr: (((octet[0] as u32) << 24) |
((octet[1] as u32) << 16)... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[cfg(feature = "Devices_PointOfService_Provider")]
pub mod Provider;
#[link(name = "windows")]
extern "system" {}
pub type BarcodeScanner = *mut ::core::ffi::c_void;
pub type BarcodeScannerCapabilities = ... |
mod buf;
mod buf_mut;
pub(crate) use buf::MssqlBufExt;
pub(crate) use buf_mut::MssqlBufMutExt;
|
pub mod canvas;
pub mod ray_tracer;
pub mod material;
|
#![allow(dead_code)]
//use rmp;
//use rmp_serialize;
use std::collections::HashMap;
use std::cell::{RefCell, RefMut};
use std::rc::Rc;
use std::fmt;
use woot::{IncrementalStamper};
use document::{Node, NodeP};
use layout::Writer;
use environment::{LocalEnv, LayoutChain, prepare_graph};
use futures::Future;
use wheel::... |
// 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.
//! Defines `CobaltSender` to encapsulate encoding `CobaltEvent` and sending them to the Cobalt
//! FIDL service.
use {
crate::traits::AsEventCodes,
... |
#![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 SceneAlphaMode(pub i32);
impl SceneAlphaMode {
pub const Opaque: Self = Self(0i32);
pub const AlphaTest: Self = Self(1i3... |
use std::collections::HashSet;
fn first_frequency_reached_twice(input: String) -> i32 {
let changes = input.split("\n").map(|x| x.parse::<i32>().unwrap()).cycle();
let mut frequency_history = HashSet::new();
frequency_history.insert(0);
let mut freq: i32 = 0;
for change in changes {
freq +... |
//! Implementation for creating instances for deployed contracts.
use crate::errors::DeployError;
use crate::future::CompatCallFuture;
use futures::compat::Future01CompatExt;
use pin_project::pin_project;
use std::future::Future;
use std::marker::PhantomData;
use std::pin::Pin;
use std::task::{Context, Poll};
use web3... |
use std::fmt::{Display, Formatter, Result as FmtResult};
use std::path::{Path, PathBuf};
use std::str::FromStr;
use serde::de::{self, Deserialize, Deserializer};
use serde::ser::{Serialize, Serializer};
use super::{FilesystemId, OutputId};
use crate::hash::Hash;
use crate::name::Name;
#[derive(Clone, Debug, Eq, Hash... |
use crate::bing_maps::MapItem;
use std::{collections::HashMap, path::PathBuf};
use clap::Parser;
use tokio::{
fs::{create_dir, read_dir, File},
io::{AsyncReadExt, AsyncWriteExt},
};
#[derive(Clone, Parser)]
pub struct CleanArgs {
#[clap(value_parser)]
input_dir: String,
#[clap(value_parser)]
... |
// Copyright 2018 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 ... |
//! Gestionnaire des parties virtuelles de puissance 4
//!
//! # Fonctionnalités
//!
//! Fournit un ensemble d’outils afin de gérer une partie de puissance 4.
//!
//! Ce dernier fournit trois éléments conçu pour cela:
//! * L’objet [`Engine`] permettant de gérer une partie de puissance 4 ainsi que les interactions ent... |
use std::cmp::{min, Ordering};
use std::fmt;
use std::iter::empty;
use itertools::{EitherOrBoth, Itertools};
use crate::{BitPage, BitPageVec};
// @author shailendra.sharma
use crate::bit_page::BitPageWithPosition;
use crate::bit_page_vec::BitPageVecKind;
// use std::time::Instant;
pub type PageItem = (usize, u64);
... |
use std::io;
use std::fs;
use std::path::{Path, PathBuf};
use std::ffi::OsStr;
//Stores options to be used during tree building
#[derive(Debug, PartialEq)]
pub struct Options{
pub dir: PathBuf,
pub all : bool, //Traverse all nodes, including hidden nodes
pub count : bool, //Count the number of files and su... |
use std::backtrace::Backtrace;
///! This module exposes 32-bit architecture specific values and functions
///!
///! See the module doc in arch_64.rs for more information
use std::cmp;
use std::fmt;
use std::sync::Arc;
use crate::erts::exception::InternalResult;
use liblumen_core::sys::sysconf::MIN_ALIGN;
use liblumen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.