hexsha stringlengths 40 40 | size int64 4 1.05M | content stringlengths 4 1.05M | avg_line_length float64 1.33 100 | max_line_length int64 1 1k | alphanum_fraction float64 0.25 1 |
|---|---|---|---|---|---|
01b037f32b441daf3fa6d0039d68216b6e1cc3d7 | 7,438 | mod test_utils;
/// Instead of guarding every individual thing with `#[cfg(feature = "http")]`, use a module.
#[cfg(feature = "http")]
mod http_happy {
use crate::test_utils::{read_to_end, test_data};
use mockito::mock;
use std::fs::File;
use std::str::FromStr;
use tough::{DefaultTransport, HttpTra... | 37.376884 | 111 | 0.581608 |
ddc7f55d58343f172901d0ba5cdb57b50db1ff72 | 22,133 | use itertools::Itertools;
use syntect::highlighting::Style as SyntectStyle;
use unicode_segmentation::UnicodeSegmentation;
use crate::ansi;
use crate::cli;
use crate::config::Config;
use crate::delta::State;
use crate::features::line_numbers;
use crate::features::OptionValueFunction;
use crate::minusplus::*;
use crate... | 36.826955 | 99 | 0.614693 |
fc1987de4e6a63c04785c3c267e35879d25b4364 | 2,873 | use proc_fs::stats::*;
use proc_fs::kernel::*;
use proc_fs::net::*;
use proc_fs::ToPid;
use iron::{Iron, IronResult, Request, Response};
use router::Router;
use std::sync::{Arc, Mutex, Condvar};
use serde_json;
use marid::{MaridError, Runner, Signal, Receiver};
use util::handle_signals_condvar;
pub struct RouterRun... | 31.922222 | 86 | 0.62339 |
0998da14d4226f31aeaf7fa2021ac92b0208654e | 39,508 | // Copyright (c) 2020 Chef Software Inc. and/or applicable contributors
//
// 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 r... | 44.044593 | 118 | 0.555255 |
7564338857b6813305201265e45185d80b4e6c97 | 18,348 | //! Lorem ipsum generator.
//!
//! This crate generates pseudo-Latin [lorem ipsum placeholder
//! text][wiki]. The traditional lorem ipsum text start like this:
//!
//! > Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
//! > eiusmod tempor incididunt ut labore et dolore magna aliqua.
//!
//! This text i... | 31.471698 | 100 | 0.58099 |
f774396209b20cb2ecbfd2f2f3c61708bbe178ed | 1,185 | use instruction_def::*;
use test::run_test;
use Operand::*;
use Reg::*;
use RegScale::*;
use RegType::*;
use {BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
#[test]
fn kxnorw_1() {
run_test(
&Instruction {
mnemonic: Mnemonic::KXNORW,
opera... | 23.7 | 95 | 0.500422 |
fcfa4881f8caba947ad822e47b0f0aa044ef1452 | 2,508 | // 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 crate::Display;
use crate::Screen;
use glib::object::IsA;
use glib::object::ObjectType as ObjectType_;
use glib::translate::*;
use glib::StaticType;
use std::fmt;
glib::wrapper!... | 30.216867 | 99 | 0.59689 |
334020b07798696e31c90d0ff47656cc43952133 | 1,768 | use crate::{
core::{Core, ObjectRef, OnAdded, Property},
shapes::path::Path,
};
#[derive(Debug)]
pub struct ParametricPath {
path: Path,
width: Property<f32>,
height: Property<f32>,
origin_x: Property<f32>,
origin_y: Property<f32>,
}
impl ObjectRef<'_, ParametricPath> {
pub fn width(&s... | 20.55814 | 48 | 0.539027 |
fc28e4cf165eff4d1d43463cf8c2ec4cd231e4e7 | 15,824 | //! Provides access to a remote `MultiFile` repository over SFTP as if it were a local Multi-File
//! Repository
use super::{BackendError, Result, SegmentDescriptor};
use crate::repository::backend::common::sync_backend::{BackendHandle, SyncBackend, SyncManifest};
use crate::repository::{Chunk, ChunkSettings, Encrypted... | 33.525424 | 112 | 0.564143 |
ab7747149c25ba24a6ab6328c1316e45094c60cf | 1,174 | use std::collections::HashMap;
use std::iter::FromIterator;
use std::fs::File;
use std::io::{BufReader, BufRead};
pub fn day15() {
let file = File::open("day15_input.txt").expect("file not found!");
let mut start_sequence = String::new();
BufReader::new(file).read_line(&mut start_sequence).unwrap();
let ... | 32.611111 | 104 | 0.568995 |
abe2512cdbae22f2a606212827ba8c1e7ed4ab77 | 47,246 | //! Contains the `TransitCurrency` enum and its associated traits. It is used to
//! specify a currency. Included for use with the transit fares returned by
//! Google Maps Directions API.
use crate::directions::error::Error;
use serde::{Deserialize, Serialize};
/// A comprehensive list of currencies. At the moment t... | 49.732632 | 121 | 0.60947 |
56c4418bf5e55004a4bb26adab0dd244b9aedf53 | 11,926 | use cmp::{Cmp, MemtableKeyCmp};
use key_types::{build_memtable_key, parse_internal_key, parse_memtable_key, ValueType};
use key_types::{LookupKey, UserKey};
use skipmap::{SkipMap, SkipMapIter};
use types::{current_key_val, LdbIterator, SequenceNumber};
use std::rc::Rc;
use integer_encoding::FixedInt;
/// Provides In... | 30.192405 | 99 | 0.514422 |
5de4ca36e230d37383dbdbfcc986e12773e163f1 | 9,506 | //! Type-safe hunks
use core::{
fmt,
marker::PhantomData,
mem,
ops::Deref,
ptr::{slice_from_raw_parts, slice_from_raw_parts_mut},
};
use crate::{
kernel::{self, cfg::CfgBuilder, Kernel, Port, StartupHook},
utils::{Init, ZeroInit},
};
/// The priority of the [startup hooks] used to initiali... | 30.964169 | 95 | 0.594677 |
28579fd4f3a89116720537687389116047213fd8 | 435 | pub use self::simple::Simple;
pub mod simple;
use Error;
use std::prelude::v1::*;
use std::io::prelude::*;
pub trait Transport
{
fn process_data(&mut self,
read: &mut Read) -> Result<(), Error>;
fn receive_raw_packet(&mut self) -> Result<Option<Vec<u8>>, Error>;
fn send_raw_packet(&... | 20.714286 | 71 | 0.544828 |
39340a6a4243eafa674f5a60064e81202cd0eda5 | 13,302 | #![allow(unused_imports, non_camel_case_types)]
use crate::models::r4::Annotation::Annotation;
use crate::models::r4::CodeableConcept::CodeableConcept;
use crate::models::r4::Element::Element;
use crate::models::r4::Extension::Extension;
use serde_json::json;
use serde_json::value::Value;
use std::borrow::Cow;
/// Ri... | 34.372093 | 100 | 0.576755 |
fe4e2758982ff81b2e56f16bba1114dffb129500 | 3,324 | use docchi_json5::jval::JVal;
use super::names::Names;
use super::json_name::{json_name, NameType, SystemNames};
use super::json_item_to_rust::json_item_to_rust;
use crate::error::CoreResult;
use crate::imp::json_to_rust::tmp::tmp_obj::TmpObj;
use crate::imp::json_to_rust::get_old::get_old;
use crate::imp::json_to_rus... | 42.075949 | 136 | 0.405235 |
3a7ede6f4a6dc63b3550d2b5504c06c6e5501055 | 3,614 | /*
Copyright 2016 Martin Buck
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublice... | 26 | 80 | 0.634754 |
39df456732c325ab8d84729fd60d70270d92687f | 2,986 | //! # Service framework
//!
//! This module contains the building blocks for async services.
//!
//! It consists of the following modules:
//!
//! ## `initializer`
//!
//! This module contains the [ServiceInitializer] trait. Service modules should implement this trait and pass
//! that implementation to the [StackBuild... | 36.414634 | 117 | 0.6929 |
0a02b5b65beaa9b2e8ef89f0734ff00bf9addcf6 | 4,745 | use std::env;
use actix_web::HttpServer;
use main_error::MainError;
use meilisearch_http::{create_app, Data, Opt};
use structopt::StructOpt;
#[cfg(all(not(debug_assertions), feature = "analytics"))]
use meilisearch_http::analytics;
#[cfg(target_os = "linux")]
#[global_allocator]
static ALLOC: tikv_jemallocator::Jema... | 35.94697 | 237 | 0.609484 |
ac5fa66852d0f686ba477762dcf5f249610e1598 | 3,500 | use crate::convert::FruityTryFrom;
use crate::introspect::IntrospectError;
use crate::serialize::serialized::Serialized;
use std::any::Any;
use std::iter::Enumerate;
use std::vec::IntoIter as VecIntoIter;
/// Cast an any introspect object
///
/// # Arguments
/// * `any` - The introspect object as an any reference
///
... | 30.701754 | 111 | 0.544286 |
de859788cbbd80eefef7892a6c39cbde24d2ed40 | 1,408 | //! Utilities for story content.
use crate::story::types::LineBuffer;
/// Read all text from lines in a buffer into a single string and return it.
///
/// # Examples
/// ```
/// # use inkling::{copy_lines_into_string, read_story_from_string};
/// let content = "\
/// Gamle gode Väinämöinen
/// rustade sig nu att resa... | 24.275862 | 76 | 0.56392 |
38253cb7653e2a6a4f418573427dd485ffd7ae8a | 6,912 | // Copyright 2018-2019 Parity Technologies (UK) Ltd.
//
// 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 applicab... | 27.759036 | 89 | 0.542101 |
4b15323e1edacec2a047af734e6e13d55ec60e72 | 13,106 | // Copyright (c) 2019 Rafael Alcaraz Mercado. All rights reserved.
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// All files in the project carrying such noti... | 41.213836 | 132 | 0.648405 |
ac2bc3270ebecccf48824f6c4eb72da3caca32ce | 531 | use mimalloc_rust::*;
use std::env;
use std::fs::read_to_string;
use std::time::Instant;
use tokenizer::Tokenizer;
#[global_allocator]
static GLOBAL_MIMALLOC: GlobalMiMalloc = GlobalMiMalloc;
fn main() {
let file = env::args().nth(1).unwrap();
let css: &str = &read_to_string(format!("assets/{}", file)).unwrap();
... | 25.285714 | 71 | 0.6742 |
fcf1559ae3c5c14d7b4e96401b284e7e12bea13b | 10,122 | #![allow(clippy::too_many_arguments)]
mod napi1 {
use super::super::types::*;
use std::os::raw::{c_char, c_void};
generate!(
extern "C" {
fn get_undefined(env: Env, result: *mut Value) -> Status;
fn get_null(env: Env, result: *mut Value) -> Status;
fn get_glob... | 31.830189 | 99 | 0.51719 |
211f63416b0a2ea1020876dd757c1c413a6dc70d | 10,588 | use crate::glottis::Glottis;
use crate::math::{interpolate, sqr};
use crate::noise::{self, NoiseSource};
use crate::transient::Transient;
use crate::turbulence::TurbulencePoint;
pub struct Tract {
pub glottis: Glottis,
sample_rate: u32,
frication_noise_source: Box<dyn FnMut() -> f64 + Send + 'static>,
... | 34.154839 | 98 | 0.55714 |
7aae2231577e21586c1c26799792b67ff330023e | 108 | use anyhow::Result;
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<()> {
Ok(())
}
| 15.428571 | 41 | 0.583333 |
d5c8bada1451f78bdc0d673c15bf9d6000b591ba | 5,194 | //! The compiler code necessary to implement the `#[derive]` extensions.
use syntax::ast::{self, ItemKind, MetaItem};
use syntax::ptr::P;
use syntax::symbol::{sym, Symbol};
use syntax_expand::base::{Annotatable, ExtCtxt, MultiItemModifier};
use syntax_pos::Span;
macro path_local($x:ident) {
generic::ty::Path::new... | 30.374269 | 91 | 0.592607 |
33d3c696eed5ee98d4c9bf014674e9bf942a3b18 | 41 | pub use archive::Archiver;
mod archive;
| 10.25 | 26 | 0.756098 |
bb35caa8442075c05f9e207461815ecff09d2db5 | 2,046 | //! Mocks for the gradually-update module.
#![cfg(test)]
use frame_support::{impl_outer_event, impl_outer_origin, parameter_types};
use frame_system as system;
use sp_core::H256;
use sp_runtime::{testing::Header, traits::IdentityLookup, Perbill};
use super::*;
impl_outer_origin! {
pub enum Origin for Runtime {}
}
... | 22.733333 | 86 | 0.731672 |
fe748e01037fd7b48d5eec348197e5888a0cf1b9 | 35,105 | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{test_utils, test_utils::make_timeout_cert, Error, SafetyRules, TSafetyRules};
use consensus_types::{
block::block_test_utils::random_payload,
common::Round,
quorum_cert::QuorumCert,
timeout::Timeout,
time... | 36.529657 | 99 | 0.647572 |
1451988dea3566854cf72618e2ce0b252662664b | 1,766 | use solana_program::{
account_info::AccountInfo, entrypoint::ProgramResult, msg, program_error::ProgramError,
pubkey::Pubkey,
};
use crate::state::PoolHeader;
pub fn check_pool_key(program_id: &Pubkey, key: &Pubkey, pool_seed: &[u8; 32]) -> ProgramResult {
let expected_key = Pubkey::create_program_address... | 24.873239 | 97 | 0.582106 |
33217f50b25191b87c24e71af3d2c2aafca343c8 | 4,191 | // 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 ... | 53.730769 | 87 | 0.43999 |
ff8e325a93d01328b5cf5a5c93d3d2432d97776a | 11,349 | use super::*;
use crate::{access::AccessControl, dictionary::*, error::Error};
use core_foundation::base::TCFType;
use std::ptr;
/// Public key pairs (i.e. public and private key) stored in the keychain.
#[derive(Debug)]
pub struct KeyPair {
/// Public key
pub public_key: Key,
/// Private key
pub priv... | 37.088235 | 130 | 0.646048 |
efdd4fd38f5205547d2230cce25c53fd8de015b6 | 153 | use day_22::*;
fn main() {
let data = read_data("./data");
println!("Part 1: {}", part_1(&data));
println!("Part 2: {}", part_2(&data));
}
| 17 | 42 | 0.51634 |
9b3b04bc054ebd51bcde48fa7db4ea131e055320 | 3,295 | #[doc = "Register `irrx_data_word1` reader"]
pub struct R(crate::R<IRRX_DATA_WORD1_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<IRRX_DATA_WORD1_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::convert::From<crate::R<IRRX_DATA_WORD1_SPEC>> for R {... | 32.95 | 412 | 0.641578 |
ac4a24e86bfc9f637ae1841b2ee53a0ac563b45a | 30,810 | //! Instruction types
use crate::check_program_account;
use serde_derive::{Deserialize, Serialize};
use mundis_sdk::instruction::{AccountMeta, Instruction, InstructionError};
use mundis_sdk::pubkey::Pubkey;
/// Minimum number of multisignature signers (min N)
pub const MIN_SIGNERS: usize = 1;
/// Maximum number of mu... | 34.006623 | 90 | 0.640149 |
e5cbbdb74a7a7402267df9a554d4a1f677d1122a | 6,624 | // Copyright (c) The XPeer Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
chained_bft::QuorumCert,
counters,
state_replication::{StateComputeResult, StateComputer},
state_synchronizer::{StateSynchronizer, SyncStatus},
};
use crypto::HashValue;
use execution_proto::proto::{
ex... | 37.636364 | 98 | 0.566878 |
ebad822171943275e570f8ec7a6b455bbe76a41c | 29,355 | //! Tests for `#[graphql_union]` macro.
use juniper::{
execute, graphql_object, graphql_union, graphql_value, DefaultScalarValue, EmptyMutation,
EmptySubscription, GraphQLObject, GraphQLType, RootNode, ScalarValue, Variables,
};
#[derive(GraphQLObject)]
struct Human {
id: String,
home_planet: String,
... | 25.111206 | 99 | 0.457333 |
f435bffbf27078f68a85c7ebc876d4b4fed163bd | 169 | // variables4.rs
// Make me compile! Execute the command `rustlings hint variables4` if you want a hint :)
fn main() {
let x:u8;
println!("Number {}", x=10);
}
| 21.125 | 89 | 0.633136 |
e503b82c9a21b07d4492d1c15d8196cec99add95 | 5,026 | use rlua::{Integer, Lua, Result, String, Table, ToLua, Value};
fn valid_float(verify: Result<Value>, expected: f64) {
let verify_unwrap = verify.unwrap();
assert_eq!(verify_unwrap.type_name(), "number");
match verify_unwrap {
Value::Number(value) => assert_eq!(value, expected),
_ => panic!(... | 29.739645 | 71 | 0.580382 |
3ae312d128cf4068f2305f03007c07308f7ab8d0 | 7,116 | use couchbase_lite::{
fallible_streaming_iterator::FallibleStreamingIterator, use_web_sockets, Database,
DatabaseConfig, Document, ReplicatorState,
};
use log::{error, trace};
use serde::{Deserialize, Serialize};
use std::{collections::HashSet, env, path::Path, sync::mpsc};
use tokio::prelude::*;
#[derive(Seri... | 32.199095 | 99 | 0.496768 |
7a13744f1537558cc17755884b4bdfc456d48b29 | 364 | //! A base library for iterfacing with streams of vectors and matrices.
//!
//! This library extends the abstraction layer provided by [`ark_std::iterable::Iterable`]
//! with streams that repeat the same element over and over, and that iterate in reversed order.
pub mod dummy;
pub(crate) mod slice;
pub use ark_std::... | 33.090909 | 96 | 0.755495 |
082e9b65fb213cf84bc50c7cc0271838bacae1d9 | 1,593 | // Copyright 2018-2022 Cargill Incorporated
//
// 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... | 32.510204 | 93 | 0.695543 |
9c6ffd49c21d9d9f17a1028a8e816a8625a27983 | 2,835 | use crate::core::error::ContractError;
use crate::core::state::PayableScopeAttribute;
use crate::testutil::test_utilities::{
mock_default_scope_attribute, mock_scope_attribute, MockOwnedDeps,
};
use crate::util::provenance_util::{ProvenanceUtil, ProvenanceUtilImpl, WriteAttributeMessages};
use cosmwasm_std::{Cosmos... | 34.573171 | 110 | 0.675485 |
d5721c24003a7083a80a9c2e3fb4b0f0b23c12b2 | 207 | #![feature(async_await)]
use heim_common::prelude::*;
use heim_host as host;
#[runtime::main]
async fn main() -> Result<()> {
let platform = host::platform().await?;
dbg!(platform);
Ok(())
}
| 14.785714 | 43 | 0.608696 |
6285822570f12fe3d3353bac478210697ae887c8 | 1,619 | // Copyright 2016 TiKV Project Authors. Licensed under Apache-2.0.
mod check_leader;
mod cleanup;
mod cleanup_sst;
mod compact;
mod consistency_check;
mod metrics;
mod pd;
mod query_stats;
mod raftlog_fetch;
mod raftlog_gc;
mod read;
mod refresh_config;
mod region;
mod split_check;
mod split_config;
mod split_controll... | 38.547619 | 98 | 0.792464 |
e95a978faad218a1bba254d03f33f4d91c528a64 | 1,802 | use bumpalo::Bump;
use rhizome::Node;
use tap::Pipe;
asteracea::component! {
Bound(
priv _early: usize,
)() []
}
asteracea::component! {
Never
#[allow(unreachable_code)]
(
priv _early: usize,
)()
new with { unreachable!(); }
[]
}
asteracea::component! {
Binder()(
late: usize = 1,
) -> Sync
[
b... | 18.770833 | 81 | 0.628746 |
fe1b4a4428e0273779a7092d9e65269669982972 | 8,780 | use crate::mutators::either::Either;
use crate::traits::{CompatibleWithSensor, CorpusDelta, Pool, Sensor, TestCase};
use owo_colors::OwoColorize;
use std::fmt::Display;
use std::path::PathBuf;
const NBR_ARTIFACTS_PER_ERROR_AND_CPLX: usize = 8;
pub(crate) static mut TEST_FAILURE: Option<TestFailure> = None;
#[derive(... | 32.279412 | 124 | 0.50672 |
e61058c2749083b616ae5676375bef2e2f9aff25 | 7,088 | use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::source::{snippet, snippet_with_macro_callsite};
use clippy_utils::ty::is_type_diagnostic_item;
use clippy_utils::{differing_macro_contexts, in_macro, match_def_path, match_qpath, paths};
use if_chain::if_chain;
use rustc_errors::Applicability;
use rus... | 37.109948 | 109 | 0.537387 |
29622b4da80db6c738e4487af4b3fdd8c3749525 | 30,708 | // Copyright (C) 2021 Scott Lamb <slamb@slamb.org>
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Proof-of-concept `.mp4` writer.
//!
//! This writes media data (`mdat`) to a stream, buffering parameters for a
//! `moov` atom at the end. This avoids the need to buffer the media data
//! (`mdat`) first or reserved a... | 38.821745 | 141 | 0.491761 |
ab46778a172aaa6c5692f3ce349f2e942c247f81 | 14,476 | use crate::{
api::inject_endpoints, db::DatabasePeer, with_admin_session, AdminSession, Context, ServerError,
};
use shared::PeerContents;
use warp::{
http::{response::Response, StatusCode},
Filter,
};
use wgctrl::DeviceConfigBuilder;
pub mod routes {
use crate::form_body;
use super::*;
pub f... | 32.603604 | 100 | 0.562725 |
892215c3af692c641022b519aa061af47e3074e0 | 44,113 | use std::fmt::{Debug, Formatter};
use std::iter::FusedIterator;
use std::{fmt, iter, marker::PhantomData, ops::Range};
use crate::{
cursor::{self},
Direction, GreenNode, NodeOrToken, SyntaxKind, SyntaxText, TextRange, TextSize, TokenAtOffset,
WalkEvent,
};
pub trait Language: Sized + Clone + Copy + fmt::Debug + Eq... | 26.914582 | 137 | 0.630698 |
6afbfb4110908ee3d080d5e06cc975e1682cf89e | 2,700 | use criterion::{black_box, criterion_group, criterion_main, Criterion};
use rdst::utils::bench_utils::{bench_common, bench_medley};
use rdst::utils::test_utils::NumericTest;
use rdst::RadixSort;
use voracious_radix_sort::{RadixKey as VorKey, RadixSort as Vor, Radixable};
fn full_sort_common<T>(c: &mut Criterion, shift... | 26.732673 | 78 | 0.557037 |
75d4fe417a7679e0192f3a9441cf5783a2061c04 | 10,435 | //! Synchronous HTTP interactions
use std::collections::hash_map::DefaultHasher;
use std::collections::HashMap;
use std::fmt::{Display, Formatter};
use std::hash::{Hash, Hasher};
use std::sync::{Arc, Mutex};
use anyhow::anyhow;
use log::warn;
use serde_json::{json, Map, Value};
use crate::bodies::OptionalBody;
use c... | 27.60582 | 122 | 0.644082 |
698cf105ae53c12d6b1a5d4dabec5175f1dc6c63 | 2,655 | // Copyright 2012-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-MI... | 33.607595 | 85 | 0.550282 |
eb107bff0d37ee4c54c285b5834761c083667dae | 1,490 | use crate::{
errors::{verify, ParrotError},
strings::{FAIL_MINUTES_PARSING, FAIL_SECONDS_PARSING, SEEKED},
utils::create_response,
};
use serenity::{
client::Context, model::application::interaction::application_command::ApplicationCommandInteraction,
};
use std::time::Duration;
pub async fn seek(
... | 30.408163 | 105 | 0.656376 |
38d95dba78e01fa81d7587923563137c8b50b700 | 2,005 | /*
Copyright (c) 2017 The swc Project Developers
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, ... | 32.33871 | 90 | 0.708728 |
5d879de5cb6e0437a8c9ca2ee261f6bd3b7bed52 | 5,924 | use futures::prelude::*;
use hyper::client;
use hyper::header;
use hyper::{self, Body, Chunk, Method, Request, StatusCode, Uri};
use percent_encoding::{utf8_percent_encode, QUERY_ENCODE_SET};
use serde::de::DeserializeOwned;
use serde_json;
use std::marker::PhantomData;
use std::str::FromStr;
use std::time::Duration;
... | 28.897561 | 99 | 0.507427 |
29870ca8dfd8fceac0412dce9cc0efbba6b81d43 | 17,206 | use crate::log::Stopwatch;
use rand::Rng;
use std::sync::Arc;
use futures::Future;
use crate::pairing::{
Engine,
CurveProjective,
CurveAffine
};
use crate::pairing::ff::{
PrimeField,
Field
};
use super::{
ParameterSource,
Proof
};
use crate::{
SynthesisError,
Circuit,
Cons... | 31.001802 | 120 | 0.590143 |
8fea00b164b1c40e9386794db1290498ccf3e4e7 | 89,829 | // 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 ... | 35.463482 | 79 | 0.482595 |
18342524cbf401dd1ba9d61d574f1f8c607ce51a | 581 | use async_std::io::Write;
use crate::broker::{BrokerMessage, ChBrokerSend};
use anyhow::Result;
use async_trait::async_trait;
use kuska_ssb::{api::ApiCaller, rpc::RecvMsg};
#[derive(Debug)]
pub enum RpcInput {
None,
Timer,
Network(i32, RecvMsg),
Message(BrokerMessage),
}
#[async_trait]
pub trait RpcH... | 20.034483 | 49 | 0.628227 |
d68f8563a2d8d243f8571616a6febd92254713f6 | 1,705 | use gw_common::{state::State, H256};
use gw_traits::CodeStore;
use gw_types::{bytes::Bytes, offchain::RunResult};
pub struct RunResultState<'a>(pub &'a mut RunResult);
impl<'a> State for RunResultState<'a> {
fn get_raw(&self, key: &H256) -> Result<H256, gw_common::error::Error> {
self.0
.read_... | 34.795918 | 93 | 0.614076 |
0106512754fe748a031087ba2489b8998518b5ca | 66,439 | //! Searches, processes and uploads debug information files (DIFs). See
//! `DifUpload` for more information.
use std::collections::{BTreeMap, BTreeSet};
use std::convert::TryInto;
use std::ffi::{OsStr, OsString};
use std::fmt::{self, Display};
use std::fs::{self, File};
use std::io::{BufReader, BufWriter, Read, Seek,... | 33.811196 | 100 | 0.590015 |
f5016b31bec9963da37462f73cc8b5eb8b083da9 | 572 | // interface-types
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn integers(_a1: u8, _a2: i8, _a3: u16, _a4: i16, _a5: u32, _a6: i32, _a7: f32, _a8: f64) {}
#[wasm_bindgen]
pub fn ret_i8() -> i8 {
0
}
#[wasm_bindgen]
pub fn ret_u8() -> u8 {
1
}
#[wasm_bindgen]
pub fn ret_i16() -> i16 {
2
}
#[wasm... | 12.170213 | 96 | 0.575175 |
23a6de909da537bf9e51d6b1bde5f59edc024919 | 1,676 | /* automatically generated by rust-bindgen */
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![cfg(target_os = "macos")]
#[macro_use]
extern crate objc;
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
#[derive(Clone, Copy)]
pub struct... | 26.1875 | 82 | 0.643198 |
2653be2f77c870440bd073bf172a728ca7b40551 | 1,904 | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{account_address::AccountAddress, value::MoveValue};
use alloc::vec::Vec;
use core::fmt;
use serde::{Deserialize, Serialize};
#[derive(Clone, Hash, Eq, PartialEq, Serialize, Deserialize)]
pub enum TransactionArgument {
U... | 37.333333 | 93 | 0.573004 |
9ca2017272694a7011a5c6b0bf2a9671fc80f2b4 | 278,139 | /// Emit binary machine code for `inst` for the x86 ISA.
#[allow(unused_variables, unreachable_code)]
pub fn emit_inst<CS: CodeSink + ?Sized>(
func: &Function,
inst: Inst,
divert: &mut RegDiversions,
sink: &mut CS,
isa: &dyn TargetIsa,
) {
let encoding = func.encodings[inst];
let bits = enco... | 37.359167 | 108 | 0.427581 |
fc013501ee52668c5c9d85f47748e9d8b4a4004e | 8,241 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn serialize_operation_cancel_rotate_secret(
input: &crate::input::CancelRotateSecretInput,
) -> Result<smithy_http::body::SdkBody, serde_json::error::Error> {
let mut out = String::new();
let mut object = smithy_json::seri... | 43.146597 | 95 | 0.730494 |
e5c636d64ae5c7a5e6b54f2756cdf4b7dd25f38b | 4,510 | s! {
pub struct termios2 {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
pub c_cflag: ::tcflag_t,
pub c_lflag: ::tcflag_t,
pub c_line: ::cc_t,
pub c_cc: [::cc_t; 19],
pub c_ispeed: ::speed_t,
pub c_ospeed: ::speed_t,
}
}
// include/uapi/asm-ge... | 37.89916 | 66 | 0.692018 |
7606282c544cea3b77e2c5f9f47774b0903b23c4 | 2,426 | // WARNING: This file was autogenerated by jni-bindgen. Any changes to this file may be lost!!!
#[cfg(any(feature = "all", feature = "android-app-AliasActivity"))]
__jni_bindgen! {
/// public class [AliasActivity](https://developer.android.com/reference/android/app/AliasActivity.html)
///
/// Required f... | 65.567568 | 258 | 0.632317 |
64703f4dc355e562cdf531341cd801848645ea29 | 6,527 | use crate::BASE_DIR_FLAG;
use account_utils::{random_password, strip_off_newlines};
use clap::{App, Arg, ArgMatches};
use eth2_wallet::{
bip39::{Language, Mnemonic, MnemonicType},
PlainText,
};
use eth2_wallet_manager::{WalletManager, WalletType};
use std::ffi::OsStr;
use std::fs::{self, File};
use std::io::pre... | 39.557576 | 102 | 0.587713 |
decb7b8af9f3ad2d88116db43a2fbc3972c1701c | 858 | // Copyright 2012 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 ... | 35.75 | 70 | 0.687646 |
23c19f7e2c7b7857e6366553e231b5057787d491 | 5,484 | use headers_serializer::ToMaps;
use crate::types::Metas;
#[derive(Clone, Debug, Default, PartialEq, ToMaps)]
// #[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
pub struct PutObjectOptions {
/// <p>The web page caching behavior that is specified when the object is downloaded.</p>
#[label("opts... | 87.047619 | 334 | 0.719548 |
fe1443dbc5f6a1a3043cea4f7d53ea200e17c42d | 903 | #[doc = "DEVDMANXTDSC register accessor: an alias for `Reg<DEVDMANXTDSC_SPEC>`"]
pub type DEVDMANXTDSC = crate::Reg<devdmanxtdsc::DEVDMANXTDSC_SPEC>;
#[doc = "Device DMA Channel Next Descriptor Address Register"]
pub mod devdmanxtdsc;
#[doc = "DEVDMAADDRESS register accessor: an alias for `Reg<DEVDMAADDRESS_SPEC>`"]
pu... | 53.117647 | 82 | 0.776301 |
ebb354454524df14e493f1b9538b622088f81246 | 17,287 | #![allow(non_camel_case_types, non_upper_case_globals)]
const_ordinary! { DROPEFFECT: u32: "shell";
/// [`DROPEFFECT`](https://docs.microsoft.com/en-us/windows/win32/com/dropeffect-constants)
/// constants (`u32`).
=>
=>
NONE 0
COPY 1
MOVE 2
LINK 4
SCROLL 0x8000_0000
}
const_ordinary! { FO: u32... | 30.222028 | 138 | 0.731012 |
4a678f5de34334b48da276024f913639b83cd63e | 6,254 | use std::ffi::OsString;
use std::io::Read;
use std::os::unix::ffi::OsStringExt;
use std::os::unix::process::{CommandExt, ExitStatusExt};
use std::process::{Child, Command, ExitStatus, Output};
use crate::base::error;
use crate::base::{Error, Result};
use log::warn;
pub trait CommandTraceExt {
fn traceme(&mut sel... | 30.807882 | 91 | 0.504477 |
e28a759807de188de1c51b0f70216a5ce54a5ddd | 2,729 | // This file was generated by gir (https://github.com/gtk-rs/gir @ 8b9d0bb)
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
// DO NOT EDIT
use Actionable;
use Bin;
use Buildable;
use Button;
use Container;
use Orientable;
use ScaleButton;
use Widget;
use ffi;
use glib;
use glib::StaticType;
use glib:... | 30.662921 | 165 | 0.66801 |
48c6d87885a51eaa8692ceb19b0f6c24b2847f44 | 28,975 | use std::cmp;
use std::fmt;
use std::io::{self, IoSlice};
use std::marker::Unpin;
use std::mem::MaybeUninit;
use bytes::{Buf, BufMut, Bytes, BytesMut};
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use super::{Http1Transaction, ParseContext, ParsedMessage};
use crate::common::buf::BufList;
use crate::common::{task... | 31.460369 | 100 | 0.531734 |
b9a40cf7db2540b64e3086998c559b0a44a1af4a | 9,596 | use crate::render::svg::*;
use crate::shape::axis::{Axis, AxisPosition};
use crate::view::View;
use crate::{BandScale, Error, LinearScale};
use std::path::Path;
use svg::Node;
const DEFAULT_MARGIN_TOP: i32 = 90;
const DEFAULT_MARGIN_BOTTOM: i32 = 50;
const DEFAULT_MARGIN_LEFT: i32 = 60;
const DEFAULT_MARGIN_RIGHT: i32... | 29.078788 | 84 | 0.542309 |
f80d14ad4ad695f63023a7daa7f70802e697a32a | 48,578 | //! # Tokens Module
//!
//! ## Overview
//!
//! The tokens module provides fungible multi-currency functionality that
//! implements `MultiCurrency` trait.
//!
//! The tokens module provides functions for:
//!
//! - Querying and setting the balance of a given account.
//! - Getting and managing total issuance.
//! - Ba... | 32.956581 | 117 | 0.69375 |
b9a1a376737bc2c780dc761c2569767e5ce9b2b8 | 10,009 | /*
* Copyright 2018 Intel Corporation
*
* 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... | 30.422492 | 89 | 0.563193 |
de5a9e3ee04d150b8a83f5f74ce729e5d5c0c899 | 4,178 | pub mod sbt;
pub mod storage;
pub mod nodegraph;
pub mod linear;
pub mod search;
use std::path::Path;
use std::rc::Rc;
use serde_derive::Deserialize;
use derive_builder::Builder;
use failure::Error;
use lazy_init::Lazy;
use crate::index::storage::{ReadData, Storage};
use crate::Signature;
pub trait Index {
... | 25.790123 | 87 | 0.554572 |
cc497c89b99a6e22bf50e699a139358a45dc1e0f | 936 | use std::path::{Path, PathBuf};
#[macro_export]
macro_rules! out_ {
($path:expr) => {
&[env!("CARGO_MANIFEST_DIR"), "/../target/", $path].concat()
};
}
#[macro_export]
macro_rules! in_ {
($path:expr) => {
&[env!("CARGO_MANIFEST_DIR"), "/../resources/", $path].concat()
};
}
/// TODO{is... | 27.529412 | 96 | 0.655983 |
26314ba9992d6ee48e3f3dd0fdc19c85a087d305 | 747 | //! Error types
use num_derive::FromPrimitive;
use paychains_program::{decode_error::DecodeError, program_error::ProgramError};
use thiserror::Error;
/// Errors that may be returned by the program.
#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum RecordError {
/// Incorrect authority provided... | 26.678571 | 80 | 0.692102 |
79fcb6af74099982cab8d38d11b84cc628a4b75e | 17,610 | // 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 crate::Align;
use crate::BaselinePosition;
use crate::Box;
use crate::Buildable;
use crate::Container;
use crate::FontChooser;
#[cfg(any(feature = "v3_24", feature = "dox"))]
#[c... | 32.193784 | 180 | 0.597729 |
64b97756e8dce6453fb833b8e821a7d3c33ed3ec | 1,997 | #![no_main]
#![no_std]
use rp_hal::target_device as rp2040;
extern crate rp2040_panic_usb_boot;
use cortex_m_rt::entry;
extern crate rp_pico;
#[entry]
fn main() -> ! {
let pin = 25;
// gpio_init
let p = rp2040::Peripherals::take().unwrap();
p.RESETS.reset.modify(|r, w| {
unsafe { w.bits(r.... | 28.942029 | 105 | 0.604407 |
719cc976a4292fcd96ac6ff9e0e5c3664cc05213 | 696 | use super::expression::Expression;
use crate::types;
use std::sync::Arc;
#[derive(Clone, Debug, PartialEq)]
pub struct UnionAddress {
type_: types::Union,
pointer: Arc<Expression>, // pointer to union
member_index: usize,
}
impl UnionAddress {
pub fn new(type_: types::Union, pointer: impl Into<Express... | 21.090909 | 98 | 0.583333 |
72c59e3f982c2c256ab8af88178896685de1eb24 | 16,976 | use crate::{
buffer::Buffer,
layout::{Constraint, Rect},
style::{Color, Style},
symbols,
text::{Span, Spans},
widgets::{
canvas::{Canvas, Line, Points},
Block, Borders, Widget,
},
};
use std::{borrow::Cow, cmp::max};
use unicode_width::UnicodeWidthStr;
/// An X or Y axis for... | 32.030189 | 140 | 0.502533 |
890654bffa30ea8e7013b6bb561f3903a984cb3c | 1,332 | // crypto_stream_xchacha20.h
pub const crypto_stream_xchacha20_KEYBYTES: usize = 32;
pub const crypto_stream_xchacha20_NONCEBYTES: usize = 24;
extern {
pub fn crypto_stream_xchacha20(
c: *mut u8,
clen: c_ulonglong,
n: *const [u8; crypto_stream_xchacha20_NONCEBYTES],
k: *const [u8; ... | 33.3 | 71 | 0.688438 |
48eb4ac9fa06bfd25fd470ffab9d1f7fd03f5bca | 7,595 | // Copyright 2014 Tyler Neely
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writ... | 28.234201 | 200 | 0.675839 |
4b51fa7ba9ebc9ef325bbdb4bca4487dfeaf3321 | 20,322 | //! The implementation for CSI node service
use grpcio::{RpcContext, UnarySink};
use log::{debug, error, info, warn};
use nix::sys::stat::{self, SFlag};
use protobuf::RepeatedField;
use std::sync::Arc;
use super::csi::{
NodeExpandVolumeRequest, NodeExpandVolumeResponse, NodeGetCapabilitiesRequest,
NodeGetCapa... | 36.882033 | 96 | 0.512597 |
1c66089fad6e63764abb5e48d71b3195bb2259d4 | 78,125 | //! Utilities for formatting and printing strings.
#![stable(feature = "rust1", since = "1.0.0")]
use crate::cell::{Cell, Ref, RefCell, RefMut, SyncUnsafeCell, UnsafeCell};
use crate::char::EscapeDebugExtArgs;
use crate::marker::PhantomData;
use crate::mem;
use crate::num::fmt as numfmt;
use crate::ops::Deref;
use cr... | 32.044709 | 100 | 0.533184 |
e8fec0953d9f608b2c602c8fe3a7bf5d0bc56754 | 4,435 | use mockito::mock;
use http_client::HttpClient;
use http_types::{Body, Request, Response, Url};
use cfg_if::cfg_if;
cfg_if! {
if #[cfg(feature = "curl_client")] {
use http_client::isahc::IsahcClient as DefaultClient;
} else if #[cfg(feature = "wasm_client")] {
use http_client::wasm::WasmClien... | 34.115385 | 116 | 0.651635 |
48d91c70b711434d5722806ef57e1c15b9d9240d | 2,975 | use clap::{Arg, App};
fn main() {
let matches = App::new("A toolkit used to diagnosis services")
.version("1.0")
.author("allen <94291@sangfor.com>")
.about("Let's together make IT simple more simple")
.arg(Arg::new("service")
.about("Sets the service to use")
... | 35.843373 | 84 | 0.518655 |
0981668d8170fab6a80266b6d8598569c3296420 | 11,871 | // Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
//! This crate provides a macro that can be used to generate code to
//! implement `OnlineConfig` trait
use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
use proc_macro2::{Span, TokenStream};
use quote::quote;
use syn:... | 33.439437 | 130 | 0.526493 |
11dfdbffca677273ec95017d1462b40598000c16 | 33,048 | //! CAN interface
//!
//! The `Can` interface can be used with the following CAN instances:
//!
//! # CAN1
//!
//! - TX = PA12 | PB9
//! - RX = PA11 | PB8
//! - Interrupt = CAN1
use core::marker::PhantomData;
use core::ptr;
use crate::afio::MAPR;
use crate::gpio::{
gpioa::{PA11, PA12},
gpiob::{PB8, PB9},
A... | 35.612069 | 116 | 0.541334 |
71c3f212bca281f0d9567582e95293a165308022 | 6,415 | use std::cell::RefCell;
use std::ffi::{CStr, CString, OsStr, OsString};
use std::io::{Error as IoError, ErrorKind, Result as IoResult};
use std::os::raw::c_void;
use std::os::unix::ffi::{OsStrExt, OsStringExt};
use std::os::unix::io::RawFd;
use std::ptr;
use std::rc::Rc;
use wayland_sys::server::*;
use calloop::gener... | 32.729592 | 104 | 0.542634 |
f924a380996f738410c47b9adc39467ddf81aecd | 2,984 | // Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{account::Account, executor::FakeExecutor, gas_costs};
use compiled_stdlib::transaction_scripts::StdlibScript;
use libra_crypto::{ed25519::Ed25519PrivateKey, PrivateKey, Uniform};
use libra_types::{
account_config::{self... | 33.155556 | 99 | 0.637064 |
11ef2c3e1823438be508fc944fba1c22b424f3ac | 7,453 | // Copyright 2021 Parallel Finance Developer.
// This file is part of Parallel Finance.
// 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
// Unl... | 34.99061 | 101 | 0.580572 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.