max_stars_repo_path stringlengths 4 207 | max_stars_repo_name stringlengths 5 110 | max_stars_count int64 0 368k | id stringlengths 1 7 | content stringlengths 6 1.05M |
|---|---|---|---|---|
src/interactive/widgets/main.rs | tranzystorek-io/dua-cli | 1,333 | 0 | <reponame>tranzystorek-io/dua-cli
use crate::interactive::{
widgets::{
Entries, EntriesProps, Footer, FooterProps, Header, HelpPane, HelpPaneProps, MarkPane,
MarkPaneProps, COLOR_MARKED,
},
AppState, DisplayOptions, FocussedPane,
};
use dua::traverse::Traversal;
use std::borrow::Borrow;
use ... |
crates/rand/src/distributions/range.rs | CryZe/libtww | 15 | 1 | // Copyright 2013 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 ... |
somm_proto/src/prost/allocation.v1.rs | faddat/sommelier | 1 | 2 | /// AllocationPrecommit defines an array of hashed data to be used for the precommit phase
/// of allocation
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AllocationPrecommit {
/// bytes hash = 1 [(gogoproto.casttype) = "github.com/tendermint/tendermint/libs/bytes.HexBytes"];
#[prost(bytes = "vec",... |
crossbeam-channel/src/err.rs | javawolfpack/crossbeam | 0 | 3 | use std::error;
use std::fmt;
/// An error returned from the [`send`] method.
///
/// The message could not be sent because the channel is disconnected.
///
/// The error contains the message so it can be recovered.
///
/// [`send`]: super::Sender::send
#[derive(PartialEq, Eq, Clone, Copy)]
pub struct SendError<T>(pub... |
tests/common/test_gui.rs | ArekPiekarz/rusty-tax-break | 0 | 4 | <reponame>ArekPiekarz/rusty-tax-break
use crate::common::event_processing::processEvents;
use gtk::glib;
use gtk::prelude::Cast as _;
use gtk::prelude::GtkWindowExt as _;
pub struct TestGui
{
window: gtk::ApplicationWindow
}
impl TestGui
{
pub fn new(window: gtk::ApplicationWindow) -> Self
{
Sel... |
mqttbytes/src/v5/unsuback.rs | IniterWorker/rumqtt | 342 | 5 | use super::*;
use bytes::{Buf, BufMut, Bytes, BytesMut};
//// Return code in connack
#[derive(Debug, Clone, Copy, PartialEq)]
#[repr(u8)]
pub enum UnsubAckReason {
Success = 0x00,
NoSubscriptionExisted = 0x11,
UnspecifiedError = 0x80,
ImplementationSpecificError = 0x83,
NotAuthorized = 0x87,
To... |
src/tools/compiletest/src/header.rs | rep-nop/rust | 1 | 6 | use std::collections::HashSet;
use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use std::path::{Path, PathBuf};
use tracing::*;
use crate::common::{CompareMode, Config, Debugger, FailMode, Mode, PassMode};
use crate::util;
use crate::{extract_cdb_version, extract_gdb_version};
#[cfg(... |
crates/rustc_codegen_spirv/src/codegen_cx/mod.rs | spacegaier/rust-gpu | 0 | 7 | mod constant;
mod declare;
mod entry;
mod type_;
use crate::builder::{ExtInst, InstructionTable};
use crate::builder_spirv::{BuilderCursor, BuilderSpirv, SpirvValue, SpirvValueKind};
use crate::decorations::{
CustomDecoration, SerializedSpan, UnrollLoopsDecoration, ZombieDecoration,
};
use crate::spirv_type::{Spir... |
lang/src/accounts/boxed.rs | kklas/anchor | 2 | 8 | //! Box<T> type to save stack space.
//!
//! Sometimes accounts are too large for the stack,
//! leading to stack violations.
//!
//! Boxing the account can help.
//!
//! # Example
//! ```ignore
//! #[derive(Accounts)]
//! pub struct Example {
//! pub my_acc: Box<Account<'info, MyData>>
//! }
//! ```
use crate::{A... |
gtk/src/auto/pad_controller.rs | abdulrehman-git/gtk-rs | 0 | 9 | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use gdk;
use gio;
use glib::object::Cast;
use glib::object::IsA;
use glib::object::ObjectType as ObjectType_;
use glib::translate::*;
use glib::StaticType;
use glib::ToValue;
use gli... |
clap_derive/tests/non_literal_attributes.rs | adamrk/clap | 1 | 10 | // Copyright 2018 <NAME> (@TeXitoi) <<EMAIL>>,
// <NAME> (@kbknapp) <<EMAIL>>, and
// <NAME> (@hoverbear) <<EMAIL>>
//
// 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
//... |
artichoke-backend/src/convert/hash.rs | sandstrom/artichoke | 0 | 11 | <gh_stars>0
use std::collections::HashMap;
use std::convert::TryFrom;
use crate::convert::{BoxUnboxVmValue, UnboxRubyError};
use crate::core::{ConvertMut, TryConvertMut, Value as _};
use crate::error::Error;
use crate::extn::core::array::Array;
use crate::sys;
use crate::types::{Ruby, Rust};
use crate::value::Value;
u... |
libafl/src/bolts/shmem.rs | tokatoka/LibAFL | 0 | 12 | //! A generic sharememory region to be used by any functions (queues or feedbacks
// too.)
#[cfg(all(unix, feature = "std"))]
use crate::bolts::os::pipes::Pipe;
use crate::Error;
use alloc::{rc::Rc, string::ToString};
use core::{
cell::RefCell,
fmt::{self, Debug, Display},
mem::ManuallyDrop,
};
use serde::... |
ckb-bin/src/subcommand/miner.rs | alexwanng/ckb-blockchain | 0 | 13 | use ckb_app_config::{ExitCode, MinerArgs, MinerConfig};
use ckb_miner::{Client, Miner};
use crossbeam_channel::unbounded;
use std::thread;
pub fn miner(args: MinerArgs) -> Result<(), ExitCode> {
let (new_work_tx, new_work_rx) = unbounded();
let MinerConfig { client, workers } = args.config;
let mut client... |
src/scalar_mul/vartime_double_base.rs | DebugSteven/curve25519-dalek | 1 | 14 | <gh_stars>1-10
// -*- mode: rust; -*-
//
// This file is part of curve25519-dalek.
// Copyright (c) 2016-2018 <NAME>, <NAME>
// See LICENSE for licensing information.
//
// Authors:
// - <NAME> <<EMAIL>>
// - <NAME> <<EMAIL>>
#![allow(non_snake_case)]
use constants;
use traits::Identity;
use scalar::Scalar;
use edward... |
fil-proofs-tooling/src/bin/benchy/prodbench.rs | qy3u/rust-fil-proofs | 3 | 15 | use std::fs::remove_file;
use std::str::FromStr;
use bellperson::{util_cs::bench_cs::BenchCS, Circuit};
use blstrs::Scalar as Fr;
use fil_proofs_tooling::{
measure,
shared::{create_replicas, PROVER_ID, RANDOMNESS, TICKET_BYTES},
Metadata,
};
use filecoin_hashers::sha256::Sha256Hasher;
use filecoin_proofs::... |
src/block.rs | ithos-org/ithos | 31 | 16 | // This file is generated. Do not edit
// @generated
// https://github.com/Manishearth/rust-clippy/issues/702
#![allow(unknown_lints)]
#![allow(clippy)]
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(box_pointers)]
#![allow(dead_code)]
#![allow(missing_docs)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#... |
core/fuzz/fuzz_targets/transaction_read.rs | GistOnionWei/libercoin | 2 | 17 | <reponame>GistOnionWei/libercoin<filename>core/fuzz/fuzz_targets/transaction_read.rs
#![no_main]
extern crate libercoin_core;
#[macro_use]
extern crate libfuzzer_sys;
use libercoin_core::core::Transaction;
use libercoin_core::ser;
fuzz_target!(|data: &[u8]| {
let mut d = data.clone();
let _t: Result<Transaction, se... |
p2p/src/msg.rs | lizhongxuan/grin | 5,264 | 18 | <gh_stars>1000+
// Copyright 2021 The Grin Developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... |
allegro-sys/src/system.rs | t-mw/RustAllegro | 91 | 19 | <gh_stars>10-100
// Copyright (c) 2014 by SiegeLord
//
// All rights reserved. Distributed under ZLib. For full terms see the file LICENSE.
use libc::*;
use config::*;
use path::*;
use allegro_util::c_bool;
opaque!(ALLEGRO_SYSTEM);
extern "C"
{
pub fn al_install_system(version: c_int, atexit_ptr: Option<extern "C"... |
src/librustc_middle/query/mod.rs | albins/rust | 1 | 20 | use crate::dep_graph::SerializedDepNodeIndex;
use crate::mir::interpret::{GlobalId, LitToConstInput};
use crate::traits;
use crate::traits::query::{
CanonicalPredicateGoal, CanonicalProjectionGoal, CanonicalTyGoal,
CanonicalTypeOpAscribeUserTypeGoal, CanonicalTypeOpEqGoal, CanonicalTypeOpNormalizeGoal,
Cano... |
client/lib/error.rs | dimension-labs/dimension-node | 0 | 21 | <reponame>dimension-labs/dimension-node
use std::{num::ParseIntError, path::PathBuf};
use humantime::{DurationError, TimestampError};
use jsonrpc_lite::JsonRpc;
use thiserror::Error;
use dimension_node::{crypto::Error as CryptoError, types::ExcessiveSizeDeployError};
use dimension_types::{
bytesrepr::Error as ToB... |
src/cargo/core/resolver/conflict_cache.rs | quark-zju/cargo | 1 | 22 | <filename>src/cargo/core/resolver/conflict_cache.rs<gh_stars>1-10
use std::collections::{BTreeMap, HashMap, HashSet};
use log::trace;
use super::types::ConflictMap;
use crate::core::resolver::Context;
use crate::core::{Dependency, PackageId};
/// This is a trie for storing a large number of sets designed to
/// effi... |
src/libstd/net/mod.rs | davesque/rust | 7 | 23 | <filename>src/libstd/net/mod.rs
//! Networking primitives for TCP/UDP communication.
//!
//! This module provides networking functionality for the Transmission Control and User
//! Datagram Protocols, as well as types for IP and socket addresses.
//!
//! # Organization
//!
//! * [`TcpListener`] and [`TcpStream`] provid... |
tests/macros.rs | EFanZh/approx | 122 | 24 | // Copyright 2015 <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 writi... |
bee-message/src/unlock/mod.rs | charlesthompson3/bee | 0 | 25 | <filename>bee-message/src/unlock/mod.rs
// Copyright 2020-2021 <NAME>
// SPDX-License-Identifier: Apache-2.0
mod reference;
pub use reference::ReferenceUnlock;
use crate::{constants::UNLOCK_BLOCK_COUNT_RANGE, signature::SignatureUnlock, Error};
use bee_common::packable::{Packable, Read, Write};
use core::ops::Dere... |
vendor/k8s-openapi/src/v1_8/apiextensions_apiserver/pkg/apis/apiextensions/v1beta1/custom_resource_definition_spec.rs | celtra/k8s-aws-nlb-proxy-protocol-operator | 9 | 26 | <gh_stars>1-10
// Generated from definition io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionSpec
/// CustomResourceDefinitionSpec describes how a user wants their resource to appear
#[derive(Clone, Debug, Default, PartialEq)]
pub struct CustomResourceDefinitionSpec {
/// Group... |
tests/wrapper_macro/unary_ret.rs | CORE-Blockchain/wasm3-rs | 81 | 27 | wasm3::make_func_wrapper!(unary_wrap: unary(foo: u64) -> u64);
fn unary(foo: u64) -> u64 {
foo
}
fn main() {}
|
services/mgmt/recoveryservices/src/package_preview_2021_11/models.rs | archoversight/azure-sdk-for-rust | 0 | 28 | <reponame>archoversight/azure-sdk-for-rust
#![doc = "generated by AutoRust"]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct CertificateRequest {
#[serde(default, skip_serializing_if = "Opti... |
meme-bevy/src/ui.rs | h33p/meme-cli | 0 | 29 | <reponame>h33p/meme-cli<filename>meme-bevy/src/ui.rs
use arboard::Clipboard;
use bevy::{
prelude::*,
render2::{
render_resource::{Extent3d, TextureDimension, TextureFormat},
texture::Image,
},
sprite2::{PipelinedSpriteBundle, Sprite},
};
use memeinator::{Config, MemeConfig, MemeText};
us... |
src/worker/iced/src/lib.rs | fengjixuchui/mishegos | 0 | 30 | <reponame>fengjixuchui/mishegos
mod mishegos;
use iced_x86::*;
use mishegos::{
decode_result, decode_status_S_FAILURE, decode_status_S_PARTIAL, decode_status_S_SUCCESS,
};
// This is pretty ugly and assumes sizeof(char) == 1
#[no_mangle]
pub static mut worker_name: *const std::os::raw::c_char =
WORKER_NAME.as... |
implementations/rust/ockam/ockam_transport_tcp/src/receiver.rs | thomcc/ockam | 0 | 31 | use crate::{
atomic::{self, ArcBool},
TcpError,
};
use async_trait::async_trait;
use ockam_core::{Address, LocalMessage, Result, TransportMessage, Worker};
use ockam_node::Context;
use tokio::{io::AsyncReadExt, net::tcp::OwnedReadHalf};
/// A TCP receiving message worker
///
/// Create this worker type by call... |
src/librustc_target/spec/wasm32_wasi.rs | Timmmm/rust | 2 | 32 | //! The `wasm32-wasi` target is a new and still (as of April 2019) an
//! experimental target. The definition in this file is likely to be tweaked
//! over time and shouldn't be relied on too much.
//!
//! The `wasi` target is a proposal to define a standardized set of syscalls
//! that WebAssembly files can interopera... |
src/format/format/flag.rs | goniz/rust-ffmpeg | 423 | 33 | use ffi::*;
use libc::c_int;
bitflags! {
pub struct Flags: c_int {
const NO_FILE = AVFMT_NOFILE;
const NEED_NUMBER = AVFMT_NEEDNUMBER;
const SHOW_IDS = AVFMT_SHOW_IDS;
#[cfg(not(feature = "ffmpeg_4_0"))]
const RAW_PICTURE = AVFMT_RAWPICTURE;
const GLOB... |
guppy/src/unit_tests/invalid_tests.rs | rexhoffman/cargo-guppy | 0 | 34 | use crate::{graph::PackageGraph, Error};
use assert_matches::assert_matches;
#[test]
fn optional_dev_dep() {
assert_invalid(
include_str!("../../fixtures/invalid/optional_dev_dep.json"),
"dependency 'lazy_static' marked optional",
);
}
fn assert_invalid(json: &str, search_str: &str) {
let ... |
src/signal/valued_signal/mod.rs | cyber-meow/ReactiveRs | 0 | 35 | <filename>src/signal/valued_signal/mod.rs
//! A reactive signal with value.
mod emit;
mod await;
mod try_emit;
pub use self::emit::{EmitValue, CanEmit};
pub use self::await::{AwaitValue, GetValue};
pub use self::try_emit::{TryEmitValue, CanTryEmit};
use std::marker::PhantomData;
use signal::Signal;
/// A reactive s... |
canon_collision_lib/src/package.rs | rukai/game | 1 | 36 | use std::collections::HashSet;
use std::fs;
use std::fs::File;
use std::path::{Path, PathBuf};
use treeflection::{KeyedContextVec, Node, NodeRunner, NodeToken};
use crate::entity_def::{ActionFrame, CollisionBox, CollisionBoxRole, EntityDef, EntityDefType};
use crate::files;
use crate::stage::Stage;
/// Stores persi... |
components/resource_metering/src/reporter/mod.rs | oh-my-tidb/tikv | 1 | 37 | <gh_stars>1-10
// Copyright 2021 TiKV Project Authors. Licensed under Apache-2.0.
pub mod data_sink;
pub mod single_target;
use crate::collector::{CollectorHandle, CollectorImpl, CollectorRegHandle};
use crate::{Config, DataSink, RawRecords, Records};
use std::fmt::{self, Display, Formatter};
use std::sync::Arc;
us... |
src/tex_the_program/section_0137.rs | crlf0710/tex-rs | 18 | 38 | //! @ A |vlist_node| is like an |hlist_node| in all respects except that it
//! contains a vertical list.
//
// @d vlist_node=1 {|type| of vlist nodes}
/// `type` of vlist nodes
pub(crate) const vlist_node: quarterword = 1;
use crate::section_0113::quarterword;
|
src/blocks/plain_text.rs | juliotpaez/doclog | 0 | 39 | use std::borrow::Cow;
/// A block that prints a plain text.
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct PlainTextBlock<'a> {
message: Cow<'a, str>,
}
impl<'a> PlainTextBlock<'a> {
// CONSTRUCTORS -----------------------------------------------------------
pub fn new(message: Cow<'a, str>) -> PlainT... |
sdk/connect/src/client.rs | floric/aws-sdk-rust | 0 | 40 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[derive(Debug)]
pub(crate) struct Handle<
C = aws_smithy_client::erase::DynConnector,
M = aws_hyper::AwsMiddleware,
R = aws_smithy_client::retry::Standard,
> {
client: aws_smithy_client::Client<C, M, R>,
conf: crate::C... |
server/src/dispatch/sysinfo.rs | Phantomical/mighty-server | 0 | 41 | <filename>server/src/dispatch/sysinfo.rs
use specs::World;
use std::any::Any;
pub trait SystemDeps {
fn dependencies() -> Vec<&'static str>;
}
pub trait SystemInfo {
type Dependencies: SystemDeps;
fn name() -> &'static str;
fn new() -> Self;
fn new_args(_args: Box<Any>) -> Self
where
Self: Sized,
{
Self::... |
crate/src/page/highlighters.rs | philip-peterson/yew_styles | 0 | 42 | <filename>crate/src/page/highlighters.rs
pub fn button_code() -> String {
"<Button
onclick_signal=link.callback(move |_| Msg::Clicked(\"Hello world\"))
class_name=\"hello-world\"
button_palette=Pallete::Standard
button_style=Style::Light
size=Size::Medium
>{\"Greeting\"}</Button>"
.to_st... |
libs/sql-schema-describer/tests/describer_tests.rs | Sytten/prisma-engines | 0 | 43 | <gh_stars>0
use crate::{common::*, test_api::*};
use barrel::types;
use native_types::{MsSqlType, MsSqlTypeParameter, MySqlType, NativeType, PostgresType};
use pretty_assertions::assert_eq;
use prisma_value::PrismaValue;
use quaint::prelude::{Queryable, SqlFamily};
use serde_json::Value;
use sql_schema_describer::*;
us... |
src/app.rs | rtuin/lsd | 7,619 | 44 | use clap::{App, Arg};
pub fn build() -> App<'static, 'static> {
App::new("lsd")
.version(crate_version!())
.about(crate_description!())
.arg(Arg::with_name("FILE").multiple(true).default_value("."))
.arg(
Arg::with_name("all")
.short("a")
... |
build.rs | SABERBOY/openlimits | 0 | 45 | <reponame>SABERBOY/openlimits<filename>build.rs<gh_stars>0
fn main() {
#[cfg(feature = "bindings")]
{
use ligen::prelude::*;
use ligen_csharp::CSharpGenerator;
match Project::current() {
Ok(project) => {
let csharp_generator = CSharpGenerator::default();
... |
scenarios/ms-nonweb-plat/wasm-frontend/src/main.rs | leonwanghui/ms-backend-wasm | 55 | 46 | <gh_stars>10-100
#[macro_use]
extern crate serde_derive;
pub mod types;
use types::*;
mod utils;
use anyhow::Result;
use getopts::Options;
use serde_json;
use serde_json::Value;
use std::env;
use std::fs::File;
use std::io::BufReader;
use std::io::Read;
use wasmtime::*;
use wasmtime_wasi::{Wasi, WasiCtx};
fn print_u... |
src/truncated_type.rs | jhwgh1968/warc | 22 | 47 | #![allow(missing_docs)]
#[derive(Clone, Debug, PartialEq)]
pub enum TruncatedType {
Length,
Time,
Disconnect,
Unspecified,
Unknown(String),
}
impl ToString for TruncatedType {
fn to_string(&self) -> String {
let stringified = match *self {
TruncatedType::Length => "length",
... |
x86test/src/hypervisor/mod.rs | dancrossnyc/rust-x86 | 281 | 48 | <filename>x86test/src/hypervisor/mod.rs
//! Silly little hypervisor based on KVM
use std::fs::File;
use std::io;
use std::io::{BufRead, BufReader, Write};
use kvm::{Capability, IoDirection, Segment, System, Vcpu, VirtualMachine};
use mmap::{MapOption, MemoryMap};
use crate::X86TestFn;
use x86::bits64::paging::*;
use ... |
third_party/rust_crates/vendor/cxxbridge-cmd/src/gen/find.rs | liexusong/fuchsia | 14 | 49 | <gh_stars>10-100
use crate::gen::{Error, Input, Result};
use crate::syntax::namespace::Namespace;
use quote::quote;
use syn::{Attribute, File, Item};
pub(super) fn find_bridge_mod(syntax: File) -> Result<Input> {
match scan(syntax.items)? {
Some(input) => Ok(input),
None => Err(Error::NoBridgeMod),... |
comms/src/rate_limit.rs | DenisKolodin/tari | 0 | 50 | // Copyright 2020, 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... |
oasis-macros/src/lib.rs | rebekahkim/oasis-rs | 0 | 51 | #![feature(proc_macro_diagnostic, type_ascription)]
#![recursion_limit = "128"]
extern crate proc_macro;
use quote::{format_ident, quote};
use syn::{parse_macro_input, spanned::Spanned as _};
// per rustc: "functions tagged with `#[proc_macro]` must currently reside in the root of the crate"
include!("utils.rs");
in... |
parquet/src/file/writer.rs | kingeasternsun/arrow-rs | 0 | 52 | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
tedge/src/system_services/managers/bsd.rs | z8674558/thin-edge.io | 1 | 53 | use crate::system_services::*;
use std::process::ExitStatus;
use tedge_users::{UserManager, ROOT_USER};
/// Service manager that uses `service(8)` as found on FreeBSD to control system services.
///
#[derive(Debug)]
pub struct BsdServiceManager {
user_manager: UserManager,
}
impl BsdServiceManager {
pub fn ne... |
qp-v0.1.2/benches/bench_main.rs | Astro36/rust-pool-benchmark | 1 | 54 | <reponame>Astro36/rust-pool-benchmark
use qp::async_trait;
use qp::pool::Pool;
use qp::resource::Factory;
use std::convert::Infallible;
use std::fs::File;
use std::io::Write;
use std::time::Instant;
pub struct IntFactory;
#[async_trait]
impl Factory for IntFactory {
type Output = i32;
type Error = Infallible;... |
third_party/rust_crates/vendor/rand_chacha-0.1.1/src/chacha.rs | allansrc/fuchsia | 210 | 55 | <reponame>allansrc/fuchsia
// Copyright 2018 Developers of the Rand project.
// Copyright 2014 The Rust Project Developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, ... |
src/throttle.rs | mrzenioszeniou/truffles | 3 | 56 | <reponame>mrzenioszeniou/truffles
use std::thread;
use std::time::{Duration, Instant};
pub struct Throttler {
last: Option<Instant>,
interval: Duration,
}
impl Throttler {
pub fn new(interval: Option<Duration>) -> Self {
Self {
last: None,
interval: interval.unwrap_or(Duration::from_secs(1)),
... |
src/registers.rs | idheepan/max31856-rs | 0 | 57 | /// Registers that can be written to and read from. Uses different addresses
pub struct ReadWriteRegister {
pub read_address: u8,
pub write_address: u8,
pub factory_default: u8,
}
/// Registers that can only be read from
pub struct ReadOnlyRegister {
pub read_address: u8,
}
pub struct Registers {}
im... |
crates/ra_parser/src/lib.rs | matthewjasper/rust-analyzer | 1 | 58 | //! The Rust parser.
//!
//! The parser doesn't know about concrete representation of tokens and syntax
//! trees. Abstract `TokenSource` and `TreeSink` traits are used instead. As a
//! consequence, this crates does not contain a lexer.
//!
//! The `Parser` struct from the `parser` module is a cursor into the sequence... |
main/src/calendar/connect/gcal.rs | lovelace-edu/lovelace | 5 | 59 | <reponame>lovelace-edu/lovelace
//! Google calendar authentication.
use malvolio::prelude::*;
use rocket::tokio::sync::RwLock;
use rocket::{response::Redirect, State};
use std::collections::HashMap;
use diesel::prelude::*;
use crate::{
auth::AuthCookie,
catch_database_error,
db::Database,
models::cal... |
src/imp/libc/net/types.rs | ratmice/rsix | 45 | 60 | use bitflags::bitflags;
use libc::c_int;
/// A type for holding raw integer socket types.
#[doc(hidden)]
pub type RawSocketType = u32;
/// `SOCK_*` constants for [`socket`].
///
/// [`socket`]: crate::net::socket
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
#[repr(transparent)]
pub struct SocketType(pub(crate) ... |
ecmascript/minifier/src/compress/pure/unsafes.rs | vjpr/swc | 1 | 61 | use super::Pure;
use swc_atoms::js_word;
use swc_ecma_ast::*;
use swc_ecma_utils::ExprExt;
impl Pure<'_> {
/// Drop arguments of `Symbol()` call.
pub(super) fn drop_arguemtns_of_symbol_call(&mut self, e: &mut CallExpr) {
if !self.options.unsafe_symbols {
return;
}
match &e.... |
external/sqrid/src/sqrid/base.rs | lpenz/codingame-the-last-crusade | 2 | 62 | // Copyright (C) 2021 <NAME> <<EMAIL>>
// This file is subject to the terms and conditions defined in
// file 'LICENSE', which is part of this source code package.
#![warn(missing_debug_implementations)]
#![warn(missing_docs)]
//! Zero-dependency module that holds Sqrid
//!
//! [`Sqrid`] is a base "factory" type that... |
slides/advanced/lesson11/frontier/vendor/substrate/frame/support/src/dispatch.rs | DaviRain-Su/substrate-course | 15 | 63 | <reponame>DaviRain-Su/substrate-course
// This file is part of Substrate.
// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may ob... |
src/bin/day4.rs | tdaines/advent-of-code-21 | 0 | 64 | <reponame>tdaines/advent-of-code-21
use std::{fs::File, io::Read, ops::Index, str::Lines};
#[derive(Copy, Clone)]
struct BingoNumber {
value: u32,
marked: bool,
}
impl BingoNumber {
fn new(value: u32) -> Self {
Self {
value,
marked: false,
}
}
}
struct BingoBoa... |
primitives/src/traits.rs | maybeTomorrow/crust | 332 | 65 | // Copyright (C) 2019-2021 Crust Network Technologies Ltd.
// This file is part of Crust.
use frame_support::traits::{LockableCurrency, WithdrawReasons};
use crate::{SworkerAnchor, MerkleRoot, BlockNumber, EraIndex};
use sp_std::collections::btree_set::BTreeSet;
use sp_runtime::{DispatchError, Perbill};
/// A currenc... |
src/tooltip/mod.rs | micro-rust/marcel | 0 | 66 | //! Tooltip theme.
mod serial;
mod style;
pub use self::serial::Tooltip as Serial;
pub use self::style::Theme;
|
language/tools/vm-genesis/src/genesis_context.rs | bmaurer/libra | 0 | 67 | // Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
#![forbid(unsafe_code)]
use anyhow::Result;
use bytecode_verifier::VerifiedModule;
use libra_state_view::StateView;
use libra_types::{
access_path::AccessPath,
account_address::AccountAddress,
account_config,
contract_... |
src/error.rs | ivankovnatsky/rbw | 0 | 68 | <gh_stars>0
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("email address not set")]
ConfigMissingEmail,
#[error("failed to create block mode decryptor")]
CreateBlockMode {
source: block_modes::InvalidKeyIvLength,
},
#[error("failed to create block mode decryptor")]
Cr... |
src/imp/linux_raw/io_uring/syscalls.rs | sunfishcode/rustix-testing | 331 | 69 | //! linux_raw syscalls supporting `rustix::io_uring`.
//!
//! # Safety
//!
//! See the `rustix::imp::syscalls` module documentation for details.
#![allow(unsafe_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
use super::super::conv::{by_mut, c_uint, pass_usize, ret, ret_c_uint, ret_owned_fd};
use crate::fd::Borro... |
query/src/catalogs/backends/impls/embedded_backend.rs | yufan022/datafuse | 0 | 70 | // 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 i... |
templates/fel4_test.rs | PolySync/cargo-fel4 | 53 | 71 | <gh_stars>10-100
use proptest::prelude::*;
use proptest::test_runner::{TestCaseError, TestError, TestRunner};
use alloc::string::String;
use core::fmt;
#[cfg(feature = "KernelPrinting")]
use sel4_sys::DebugOutHandle;
use sel4_sys::*;
#[cfg(feature = "KernelPrinting")]
macro_rules! debug_print {
($($arg:tt)*) => (... |
cargo-pgx/src/manifest.rs | davecramer/pgx | 1 | 72 | use cargo_metadata::Metadata;
use cargo_toml::Manifest;
use eyre::eyre;
pub(crate) fn manifest(metadata: &Metadata) -> eyre::Result<Manifest> {
let root = metadata
.root_package()
.ok_or(eyre!("`pgx` requires a root package."))?;
let manifest = Manifest::from_path(&root.manifest_path)?;
Ok(... |
dlc/src/lib.rs | benthecarman/rust-dlc | 0 | 73 | //! # Rust DLC Library
//! Library for creating, signing and verifying transactions for the
//! Discreet Log Contract protocol.
//!
// Coding conventions
#![deny(non_upper_case_globals)]
#![deny(non_camel_case_types)]
#![deny(non_snake_case)]
#![deny(unused_mut)]
#![deny(dead_code)]
#![deny(unused_imports)]
#![deny(mi... |
crates/ide-completion/src/tests/item.rs | danielhuang/rust-analyzer | 0 | 74 | <reponame>danielhuang/rust-analyzer
//! Completion tests for item specifics overall.
//!
//! Except for use items which are tested in [super::use_tree] and mod declarations with are tested
//! in [crate::completions::mod_].
use expect_test::{expect, Expect};
use crate::tests::{completion_list, BASE_ITEMS_FIXTURE};
fn... |
src/shape/sphere.rs | DaseinPhaos/arendur | 1 | 75 | <gh_stars>1-10
// Copyright 2017 <NAME> aka. Luxko
//
// 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
//... |
colang/src/program/expressions/new.rs | kodek16/colang | 3 | 76 | <filename>colang/src/program/expressions/new.rs<gh_stars>1-10
use crate::program::expressions::ExpressionKind;
use crate::program::visitors::LocalCodeNode;
use crate::program::{Expression, Statement, Type, TypeRegistry, ValueCategory};
use crate::source::SourceOrigin;
use std::cell::RefCell;
use std::rc::Rc;
/// An ex... |
examples/blinky-clocks/src/main.rs | wcpannell/kea-hal | 0 | 77 | #![no_main]
#![no_std]
use kea_hal as hal;
use cortex_m_rt::entry;
use embedded_hal::digital::v2::{InputPin, OutputPin, ToggleableOutputPin};
use hal::{clocks, pac, port, prelude::*};
use panic_halt as _;
#[entry]
fn main() -> ! {
//println!("Hello, world!");
let _cp = cortex_m::Peripherals::take().unwrap();... |
examples/simple.rs | nooberfsh/iterable | 13 | 78 | use iterable::*;
fn main() {
let int_vec = vec![1, 2, 3];
let string_vec = int_vec.map(|x| format!("{}", x)); // map
let filtered_vec = string_vec.filter(|x| &**x > "1"); // filter
filtered_vec.foreach(|x| println!("{}", x));
}
|
src/shell/windows_command/mod.rs | fallwith/frum | 417 | 79 | use crate::shell::Shell;
use std::path::Path;
#[derive(Debug)]
pub struct WindowsCommand;
impl Shell for WindowsCommand {
fn path(&self, path: &Path) -> String {
let current_path = std::env::var_os("path").expect("Can't read PATH env var");
let mut split_paths: Vec<_> = std::env::split_paths(&curr... |
library/core/src/iter/adapters/zip.rs | ohno418/rust | 1 | 80 | <reponame>ohno418/rust<gh_stars>1-10
use crate::cmp;
use crate::fmt::{self, Debug};
use crate::iter::{DoubleEndedIterator, ExactSizeIterator, FusedIterator, Iterator};
use crate::iter::{InPlaceIterable, SourceIter, TrustedLen};
/// An iterator that iterates two other iterators simultaneously.
///
/// This `struct` is ... |
crates/rslint_core/src/groups/errors/getter_return.rs | zaida04/RSLint | 0 | 81 | <reponame>zaida04/RSLint<filename>crates/rslint_core/src/groups/errors/getter_return.rs
use crate::rule_prelude::*;
use ast::*;
use SyntaxKind::*;
declare_lint! {
/**
Disallow getter properties which do not always return a value.
Getters are special properties introduced in ES5 which call a function when ... |
components/raft_log_engine/src/engine.rs | xiongjiwei/tikv | 7,968 | 82 | // Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
use std::fs;
use std::path::Path;
use engine_traits::{
CacheStats, RaftEngine, RaftEngineReadOnly, RaftLogBatch as RaftLogBatchTrait, Result,
};
use kvproto::raft_serverpb::RaftLocalState;
use raft::eraftpb::Entry;
use raft_engine::{
Command, ... |
exercises/variables/variables4.rs | Tiankui/rustlings | 0 | 83 | <reponame>Tiankui/rustlings<gh_stars>0
// variables4.rs
// Make me compile! Scroll down for hints :)
fn main() {
let x: i32 = 32;
println!("Number {}", x);
}
// Oops! In this exercise, we have a variable binding that we've created on
// line 5, and we're trying to use it on line 6, but we haven't given it a
/... |
modules/fdb/examples/fdb-pk-debug.rs | enteryournamehere/assembly_rs | 2 | 84 | use assembly_fdb::mem::{Database, Table};
use color_eyre::eyre::{eyre, WrapErr};
use mapr::Mmap;
use std::{fs::File, path::PathBuf};
use structopt::StructOpt;
#[derive(StructOpt)]
/// Shows all rows for a single key in a table
struct Options {
/// The FDB file
file: PathBuf,
/// The table to use
table:... |
tests/compile-fail/panic/panic_abort4.rs | christianpoveda/miri | 1 | 85 | <gh_stars>1-10
// ignore-test: Abort panics are not yet supported
//error-pattern: the evaluated program panicked
// compile-flags: -C panic=abort
fn main() {
core::panic!("{}-panicking from libcore", 42);
}
|
src/mock.rs | DoraFactory/Dora-Rewards | 0 | 86 | // Copyright 2019-2021 PureStake Inc.
// This file is part of Moonbeam.
// Moonbeam is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.... |
runng/src/asyncio/simple.rs | jeikabu/runng | 24 | 87 | <filename>runng/src/asyncio/simple.rs
//! Simple queue of asynchronous I/O work.
use super::*;
use log::debug;
use std::{collections::VecDeque, marker::PhantomPinned, pin::Pin, sync::Mutex};
/// Nng asynchronous I/O handle and queue of work items.
pub struct SimpleAioWorkQueue {
worker: Pin<Box<AioQueue>>,
}
imp... |
utils/ssz_new_types/src/impls/mod.rs | faustuzas/framework | 0 | 88 | <filename>utils/ssz_new_types/src/impls/mod.rs
use super::*;
use ssz;
use typenum::Unsigned;
/// This module will implement custom ssz serialization/deserialization
/// for ssz_types
mod bitfield;
mod fixed_vector;
mod variable_list;
|
shipcat_definitions/src/structs/rds.rs | brmurphy/shipcat | 0 | 89 | use super::Result;
use super::Metadata;
/// Supported RDS engines
///
/// Subset of the official [AWS RDS database engines](https://aws.amazon.com/rds/).
#[derive(Deserialize, Serialize, Clone)]
#[serde(rename_all = "lowercase")]
pub enum RdsEngine {
Postgres,
Mysql
}
/// RDS Instance types
///
/// Subset of ... |
examples/easy_array_string.rs | clucompany/cluStrConcat | 0 | 90 | <reponame>clucompany/cluStrConcat<filename>examples/easy_array_string.rs
fn main() {
let data: &[&str] = &["123", "456", "789", "000"];
let string = cluStrConcat::array_to_string(data);
println!("{:?}, capacity: {}", string, string.capacity());
println!("old {:?}", data);
println!("{:?}", string.as_bytes());... |
src/wordgame.rs | LFalch/ordabottur | 0 | 91 | <reponame>LFalch/ordabottur<filename>src/wordgame.rs
use std::collections::HashMap;
use rand::prelude::*;
use rand::distributions::WeightedIndex;
use serenity::model::channel::Message;
use serenity::model::id::UserId;
use serenity::prelude::TypeMapKey;
/// Based on distributions on Wikipedia, please replace with oth... |
artichoke-backend/src/fs/memory.rs | silathdiir/artichoke | 0 | 92 | use std::borrow::Cow;
use std::collections::hash_map::Entry as HashEntry;
use std::collections::HashMap;
use std::fmt;
use std::io;
use std::path::{Path, PathBuf};
use crate::fs::{absolutize_relative_to, ExtensionHook, Filesystem, RUBY_LOAD_PATH};
#[derive(Clone, Copy)]
pub struct Extension {
hook: ExtensionHook,... |
src/widgets/listelement.rs | synasius/fuzzle | 8 | 93 | use druid::kurbo::{Point, Rect, Size};
use druid::piet::{
CairoTextLayout, Color, FontBuilder, InterpolationMode, PietText, RenderContext, Text,
TextLayout, TextLayoutBuilder, UnitPoint,
};
use druid::{
BoxConstraints, Env, Event, EventCtx, LayoutCtx, LifeCycle, LifeCycleCtx, PaintCtx, UpdateCtx,
Widget... |
src/utils.rs | psibi/ouch | 0 | 94 | use std::{
cmp, env,
ffi::OsStr,
fs,
path::{Path, PathBuf},
};
use crate::{extension::CompressionFormat, file::File, oof, OVERWRITE_CONFIRMATION};
#[macro_export]
#[cfg(debug_assertions)]
macro_rules! debug {
($x:expr) => {
dbg!($x)
};
}
#[macro_export]
#[cfg(not(debug_assertions))]
m... |
pasture-core/src/math/bitmanip.rs | jneus/pasture | 11 | 95 | /// Inserts two zero-bits before any two bits of `val`
pub fn expand_bits_by_3(mut val: u64) -> u64 {
val &= 0x1FFFFF; //Truncate to 21 bits
val = (val | (val << 32)) & 0x00FF00000000FFFF;
val = (val | (val << 16)) & 0x00FF0000FF0000FF;
val = (val | (val << 8)) & 0xF00F00F00F00F00F;
val = (val | (va... |
binary_tree_kata/src/day_13.rs | alex-dukhno/rust-tdd-katas | 0 | 96 | <gh_stars>0
use std::cmp::Ordering;
use std::iter::FromIterator;
use core::mem;
type Link<K, V> = Option<Box<Node<K, V>>>;
struct Node<K: Ord, V> {
key: K,
value: V,
left: Link<K, V>,
right: Link<K, V>,
}
impl<K: Ord, V> Node<K, V> {
fn new(key: K, value: V) -> Link<K, V> {
Some(Box::new(... |
ol/miner/src/bin/miner/main.rs | MSRG/libra | 0 | 97 | <reponame>MSRG/libra
//! Main entry point for MinerApp
#![deny(warnings, missing_docs, trivial_casts, unused_qualifications)]
#![forbid(unsafe_code)]
use miner::application::APPLICATION;
/// Boot MinerApp
fn main() {
abscissa_core::boot(&APPLICATION);
}
|
src/media_service/windows.rs | NovusTheory/xosms | 1 | 98 | use ::windows::core::HSTRING;
use ::windows::Foundation::{EventRegistrationToken, TypedEventHandler, Uri};
use ::windows::Media::Playback::MediaPlayer;
use ::windows::Media::{
MediaPlaybackStatus, MediaPlaybackType, SystemMediaTransportControls,
SystemMediaTransportControlsButton, SystemMediaTransportContr... |
src/types.rs | tdroxler/LanguageClient-neovim | 0 | 99 | use super::*;
use crate::rpcclient::RpcClient;
use crate::sign::Sign;
use crate::viewport::Viewport;
use crate::vim::Vim;
use std::collections::BTreeMap;
use std::sync::mpsc;
pub type Fallible<T> = failure::Fallible<T>;
#[derive(Debug, Fail)]
pub enum LCError {
#[fail(
display = "No language server comman... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.