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
0ed6ef1fc48b7330ac4f899f5ab0dea1102ce625
1,550
use config::{Config, ConfigError, Environment, File}; use serde_derive::{Deserialize, Serialize}; #[derive(Deserialize, Serialize, Default, Debug, Clone)] pub struct OutpointConf { pub tx_hash: String, pub index: u32, } #[derive(Deserialize, Serialize, Default, Debug, Clone)] pub struct ScriptConf { pub c...
27.678571
87
0.667097
906eb2e8297fa789252aed4487144ba25c110966
7,367
use std; use std::iter; use std::rc::Rc; use std::cell::*; use pcre::{CompileOption, Match, Pcre}; use super::*; use term_color::*; #[derive(Debug,Clone)] pub struct DecorativeLine { /// Single mark, such as "*". mark: String, /// Colors. colors: Option<Colors>, /// Repeated marks to fill a give...
25.403448
94
0.51052
d7a1136310605d58a223ccd833af84166d8e6e18
427
use super::system_prelude::*; #[derive(Default)] pub struct UpdateRotate; impl<'a> System<'a> for UpdateRotate { type SystemData = (ReadStorage<'a, Rotate>, WriteStorage<'a, Transform>); fn run(&mut self, (rotate_store, mut transform_store): Self::SystemData) { for (rotate, transform) in (&rotate_sto...
26.6875
79
0.644028
90ac32ed029bd0bb94091bd3413945f6d409caa5
3,739
use crate::common::DataId; use crate::config::PathStyle; use crate::format::format_oas_template; const API_VERSION_PATH: &str = "/v1"; const API_CREATE_PATH: &str = "create"; const API_CREATE_AND_EXERCISE_PATH: &str = "create_and_exercise"; const API_EXERCISE_PATH: &str = "exercise"; const API_FETCH_PATH: &str = "fetc...
31.420168
112
0.584113
c1a13242871c3cc0a0d8a83a0d52ba0807ecfd4b
1,890
use std::collections::HashSet; use std::fmt::Debug; use std::hash::Hash; use std::iter::FromIterator; pub trait AccessPermission: Clone + Debug + Eq + Hash { fn allowed_class() -> &'static AccessVector<Self>; } #[derive(Clone, Debug)] pub struct AccessVector<T> where T: AccessPermission { av: HashSet<T>, ...
24.230769
114
0.593651
8a07f5f3aea3ea525d2a9fe4c1009cf76fc4109e
10,823
// Copyright (c) 2021 Quark Container Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law ...
33.404321
116
0.525363
28ce145d7e3ed3009a626bcdc6ab091b4efc9fd3
6,371
use std::fmt::Display; use std::fmt::Formatter; use std::ops::Add; use strum_macros::EnumString; pub trait Step<T: Copy> where Self: Copy + Clone, { fn step(&self, direction: T) -> Self; fn step_by(&self, direction: T, steps: Scalar) -> Self; } pub type Scalar = i32; #[derive(Debug, Copy, Clone, Ord, Par...
24.886719
79
0.502433
e8b08377558a9bb02d80bb9a79851de6e442a3b2
26,654
use crate::{ prelude::*, use_string_cache, utils::{get_iter_capacity, NoNull}, }; use ahash::AHashMap; use arrow::array::{ArrayDataBuilder, ArrayRef, LargeListBuilder}; use arrow::datatypes::ToByteSlice; pub use arrow::memory; use arrow::{ array::{Array, ArrayData, PrimitiveArray}, buffer::Buffer, }...
30.392246
100
0.567307
2268c9b3854779d94ec34bfbc2d4c0efe359e866
48,949
use crate::base::{DummyResult, ExpansionData, ExtCtxt, MacResult, TTMacroExpander}; use crate::base::{SyntaxExtension, SyntaxExtensionKind}; use crate::expand::{ensure_complete_parse, parse_ast_fragment, AstFragment, AstFragmentKind}; use crate::mbe; use crate::mbe::macro_check; use crate::mbe::macro_parser::parse_tt; ...
39.731331
100
0.511144
b98c89e36a7f450ebf079f5d14eb5f1ea3403a15
9,887
use { crate::{ API_BASE_URL, models::{ manifest::{ Manifest, GetDestinyManifestResponse, }, activity_mode::ActivityMode, response::GeneralAPIResponse, public_milestone::PublicMilestone, user::{ ...
39.706827
232
0.593507
876c596669c4b9e3761e2d8df80114b75fb657cd
1,660
pub struct IconSubtitlesOff { props: crate::Props, } impl yew::Component for IconSubtitlesOff { type Properties = crate::Props; type Message = (); fn create(props: Self::Properties, _: yew::prelude::ComponentLink<Self>) -> Self { Self { props } } fn update(&mut self, _: Self::Message)...
36.086957
461
0.58494
75ef6c6c4a6173a9c5f5852f41d6d6f1e1f8d0ef
535
use necsim_core_bond::ClosedUnitF64; use crate::{ cogs::{Habitat, MathsCore}, landscape::Location, }; #[allow(clippy::inline_always, clippy::inline_fn_without_body)] #[contract_trait] pub trait SpeciationProbability<M: MathsCore, H: Habitat<M>>: crate::cogs::Backup + core::fmt::Debug { #[must_use] ...
25.47619
79
0.685981
e50aaf86183f91acf24b49172eda1cce1de5acd9
3,582
//ordinal events example /// using app::handle_main can result in more ergonomic code, allowing any widget to handle the event, keeping ```main``` more organized. /// However, custom event values are hard coded. /// enum_ordanlize let us define our custom event values relative to the number of total enum values. Thus...
32.27027
138
0.579844
5066669a4304335e2d0a8320e6f2d60114d9675e
4,762
use { macroquad::{ camera::{set_camera, Camera as _, Camera3D}, color::{ Color, BLUE, DARKGRAY, GOLD, GREEN, LIME, MAGENTA, MAROON, ORANGE, PINK, RED, WHITE, YELLOW, }, input::{is_key_pressed, is_mouse_button_down, mouse_position, KeyCode, MouseButton}, ...
34.258993
98
0.562999
f8845f1e95d1922423f941fee6fb1cd5da637123
1,597
use crate::{database::DatabaseGuard, ConduitResult, Error, Ruma}; use ruma::api::client::{ error::ErrorKind, r0::filter::{create_filter, get_filter}, }; #[cfg(feature = "conduit_bin")] use rocket::{get, post}; /// # `GET /_matrix/client/r0/user/{userId}/filter/{filterId}` /// /// Loads a filter that was previ...
33.270833
95
0.673763
89179a412e12cfed40d5665116705b49bfb8538b
2,539
mod parse; mod eval; pub use parse::*; pub use eval::*; #[derive(Debug, Clone, PartialEq)] pub enum Operation { Add(Vec<Operation>), Mul(Vec<Operation>), Neg(Box<Operation>), Sqrt(Box<Operation>), Ln(Box<Operation>), Exp(Box<Operation>), Div(Box<(Operation, Operation)>), Literal(f32), ...
25.646465
100
0.523434
015fb8f2bf88e68196a0880254a578a44290c577
96,074
// DO NOT EDIT ! // This file was generated automatically from 'src/mako/cli/main.rs.mako' // DO NOT EDIT ! #![allow(unused_variables, unused_imports, dead_code, unused_mut)] extern crate tokio; #[macro_use] extern crate clap; extern crate yup_oauth2 as oauth2; use std::env; use std::io::{self, Write}; use clap::{Ap...
51.459025
639
0.449945
03b01b5790e82dda4521ea0ba7de0fc7bedadd8a
94
pub mod ignore; pub fn ignore(buf: &[u8]) -> ignore::Iter<'_> { ignore::Iter::new(buf) }
15.666667
47
0.585106
fe209d19fa4d0d0b2899942636e5f7b058fa7b5d
6,659
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use anyhow::Result; use consensus_types::common::Round; use libra_config::config::PersistableConfig; use serde::{Deserialize, Serialize}; use std::{cmp::Ordering, path::PathBuf}; #[cfg(test)] use tempfile::NamedTempFile; /// SafetyRul...
30.828704
98
0.646193
ac8ce0a6b11ffb3c6e657c4e19d18dd244f8ab3b
2,606
extern crate amqp; extern crate env_logger; use amqp::{Basic, Session, Channel, Table, protocol}; use std::default::Default; use std::thread; //table types: //use table::{FieldTable, Table, Bool, ShortShortInt, ShortShortUint, ShortInt, ShortUint, LongInt, LongUint, LongLongInt, LongLongUint, Float, Double, DecimalVa...
44.169492
201
0.665388
1c803e513243e7b8bd246e81d72d541043be2632
9,582
//! Interface for reading object files. use alloc::vec::Vec; use core::{cmp, fmt, result}; use crate::common::{ FileFlags, RelocationEncoding, RelocationKind, SectionFlags, SectionKind, SymbolFlags, SymbolKind, SymbolScope, }; use crate::pod::Bytes; mod util; pub use util::StringTable; mod any; pub use any:...
26.91573
97
0.615216
d770a1248658bac0bdc4de1ce1a9801ed22063df
21,885
use super::message::Message; use super::peer; use crate::network::server::Handle as ServerHandle; use crossbeam::channel; use log::{debug, warn}; use std::sync::{Arc, Mutex}; use crate::blockchain::{Blockchain, State}; use crate::block::{Block, Header, Content}; use crate::crypto::hash::{H256, Hashable, H160}; use std:...
54.305211
164
0.416221
679ac11299c40b97653a911dde2274ee6619b2c9
2,334
use crate::data::PgPoolContainer; use chrono::Utc; use serenity::{ client::Context, framework::standard::{macros::command, Args, CommandResult}, model::{channel::Message, id::UserId}, }; #[command("Profile")] #[description = "Show your own or someone else's profile."] #[example = ""] #[example = "@mention"...
29.175
91
0.441302
9ce6921a209025fa4fd60f0988aa29875e86bea0
13,156
//! Board file for Nucleo-F446RE development board //! //! - <https://www.st.com/en/evaluation-tools/nucleo-f446re.html> #![no_std] // Disable this attribute when documenting, as a workaround for // https://github.com/rust-lang/rust/issues/62184. #![cfg_attr(not(doc), no_main)] #![deny(missing_docs)] use capsules::vi...
36.043836
100
0.675509
1e3222abf7107bb1711adc4f71f45eb8a2a86d02
6,069
use messages::*; use messages::message_type::MessageTypes; use settings; use utils::httpclient; use error::prelude::*; #[derive(Clone, Deserialize, Serialize, Debug, PartialEq)] #[serde(rename_all = "camelCase")] pub struct UpdateConnection { #[serde(rename = "@type")] msg_type: MessageTypes, #[serde(renam...
34.482955
290
0.600923
720c6e302a983111c2b5f6113e4e77c320cfa7e9
897
//! Re-export version of a base64 encoding used throughout the library. pub(crate) mod base64 { pub use base64::DecodeError; fn div_and_round_up(dividend: usize, divisor: usize) -> usize { (dividend + (divisor - 1)) / divisor } pub fn encode_no_padding(data: &[u8]) -> Vec<u8> { let mu...
35.88
86
0.626533
03b2bc8de45c74fca3a25459902eccf23eb4843c
30,919
// Rust test file autogenerated with cargo build (build/spectests.rs). // Please do NOT modify it by hand, as it will be reseted on next build. // Test based on spectests/const_.wast #![allow( warnings, dead_code )] use wabt::wat2wasm; use super::_common::{spectest_importobject, NaNCheck}; use crate::webassemb...
30.135478
99
0.610401
03b578d4adeec235d60aa34654cfbdc1962c2845
95,116
use crate::diagnostics::{ImportSuggestion, LabelSuggestion, TypoSuggestion}; use crate::late::lifetimes::{ElisionFailureInfo, LifetimeContext}; use crate::late::{AliasPossibility, LateResolutionVisitor, RibKind}; use crate::path_names_to_string; use crate::{CrateLint, Module, ModuleKind, ModuleOrUniformRoot}; use crate...
43.832258
162
0.428056
679146c9cb351639b9eb859e275de5ad1124610c
200
use warp::Filter; #[tokio::main] async fn main() { let hello = warp::path!("hello" / String).map(|name| format!("Hello, {}!", name)); warp::serve(hello).run(([127, 0, 0, 1], 3030)).await; }
22.222222
86
0.57
5ba847d3515934e2167f3a684258e798f16bc64a
2,369
//! HIR (previously known as descriptors) provides a high-level object oriented //! access to Rust code. //! //! The principal difference between HIR and syntax trees is that HIR is bound //! to a particular crate instance. That is, it has cfg flags and features //! applied. So, the relation between syntax and HIR is m...
25.75
99
0.607851
d7524193c8aea7e274b17655d79792b1df066642
2,689
// Copyright 2017, Igor Shaula // Licensed under the MIT License <LICENSE or // http://opensource.org/licenses/MIT>. This file // may not be copied, modified, or distributed // except according to those terms. use super::enums::*; use super::RegKey; use std::error::Error; use std::fmt; use std::io; use winapi::shared::...
24.225225
92
0.62328
ab625e7bb5a1eaef7376190fd03a509575bd602c
34,895
// This file is generated by rust-protobuf 2.17.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![rustfmt::skip] #![allow(box_pointers)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_ca...
32.551306
134
0.577962
39898c8048cc60c5de41035dcd95c3f25f410ff8
6,701
// Generated by `scripts/generate.js` use utils::c_bindings::*; use utils::vk_traits::*; use utils::vk_ptr::*; use utils::vk_convert::*; use std::os::raw::c_char; use std::ops::Drop; use std::ptr; use std::mem; use std::cmp; use std::slice; use vulkan::*; use vulkan::vk::*; #[doc(hidden)] pub type RawVkImage = u64; ...
40.859756
196
0.65632
56701ca5e7d917115fc06c13458ceb92e022d4ec
880
use pulldown_dmark::{html, Parser}; fn main() { let markdown_input: &str = "Hello world, this is a ~~complicated~~ *very simple* example."; println!("Parsing the following markdown string:\n{}", markdown_input); // Set up options and parser. Strikethroughs are not part of the CommonMark standard // an...
38.26087
95
0.676136
ffbd6123cd99b571a5c3209827d650f1aae2eefb
1,308
#![feature(const_str_as_bytes)] #![feature(const_slice_len)] #![feature(const_str_len)] #![feature(const_raw_ptr_deref)] use tracelogging::*; fn main() { let handle = tracelogging_register!( "3970f9cf-2c0c-4f11-b1cc-e3a1e9958833", SimpleTraceLoggingProvider ); let activity1 = tracelogging_...
24.679245
72
0.582569
644edbacfcb18884b45c691e93222810b54e4f57
1,757
// errors2.rs // Say we're writing a game where you can buy items with tokens. All items cost // 5 tokens, and whenever you purchase items there is a processing fee of 1 // token. A player of the game will type in how many items they want to buy, // and the `total_cost` function will calculate the total number of token...
35.14
81
0.669892
ff7133f5d0c971efec75047d85e6e961eb1a5c19
121,035
// Copyright 2013-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-MI...
38.793269
100
0.507349
b9f153a6f71316c8eef16d03ca182ce84b028df7
5,940
/* Christopher Piraino * * * Ferrous Threads * */ //! A TaskRunner is used when a number of short-lived tasks need to be asynchronously //! done. Here we negate the cost of thread startup by using a fixed amount of threads //! to serve a potentially infinite series of tasks. //! //! # Warnings //! Currently the mp...
28.285714
96
0.566162
14bdbcd16940a829cb3a63418877b4ce31732dcb
72,640
use unicode_width::UnicodeWidthChar; use std::{ cmp::Ordering, collections::{BTreeSet, VecDeque}, fmt::{self, Debug, Formatter}, str, }; use zellij_utils::{vte, zellij_tile}; const TABSTOP_WIDTH: usize = 8; // TODO: is this always right? const SCROLL_BACK: usize = 10_000; use vte::{Params, Perform};...
39.759168
147
0.515474
617015bcfd93447c3197b5481d55883560977111
5,943
#[doc = "Register `PUBLISH_FIELDDETECTED` reader"] pub struct R(crate::R<PUBLISH_FIELDDETECTED_SPEC>); impl core::ops::Deref for R { type Target = crate::R<PUBLISH_FIELDDETECTED_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<PUBLISH_FIELDDETECTED_SPEC>...
30.321429
447
0.594144
f8314eba5ca367380035ec1191229e0619a92ad8
1,474
use cadence::{BufferedUdpMetricSink, QueuingMetricSink, StatsdClient, UdpMetricSink, DEFAULT_PORT}; use std::net::UdpSocket; mod utils; use utils::run_arc_threaded_test; const TARGET_HOST: (&str, u16) = ("127.0.0.1", DEFAULT_PORT); fn new_udp_client(prefix: &str) -> StatsdClient { let socket = UdpSocket::bind("0...
32.755556
99
0.734057
0e5fa0c0bfdcf6aa19496f2e8465de9ebd7bbbf2
10,930
extern crate tokenizers as tk; use crate::extraction::*; use neon::prelude::*; use serde::{ser::SerializeStruct, Serialize, Serializer}; use std::sync::Arc; use tk::normalizers::NormalizerWrapper; use tk::NormalizedString; #[derive(Clone, Debug, Deserialize)] #[serde(untagged)] pub enum JsNormalizerWrapper { Seq...
34.263323
100
0.611619
0939fe14d646bdf24c01bba06272daa6debc7515
4,548
#[cfg(test)] mod file_editor { use sdl2::pixels::*; use sdl2::rect::*; use std::sync::*; #[test] fn add_text() { use crate::tests::support; let config = support::build_config(); let canvas = support::build_canvas(); let font_context = sdl2::ttf::init().unwrap(); ...
34.717557
99
0.583333
09174828689ee29f35e40b3bcba6d2794cfc4d6f
15,204
use crate::unicorn::NodeRef; // // Public Interface // #[allow(dead_code)] #[derive(Debug, Eq, PartialEq)] pub enum Solution { Sat, Unsat, Timeout, } pub trait Solver { fn new() -> Self; fn name() -> &'static str; fn solve(&mut self, root: &NodeRef) -> Solution; fn is_always_true(&mut sel...
38.105263
85
0.467245
0331c5d4ba4013280c27dabe8e141126117b5685
70,986
// 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...
29.813524
99
0.515482
8f6029cdaaeb687558538d841f7bbd6588839849
1,887
use rand::distributions::{Distribution, Uniform}; use sdl2::event::Event; use sdl2::pixels::Color; use sdl2::rect::Rect; use sdl2::gfx::primitives::DrawRenderer; const ROWS: u128 = 100000; const COLS: u128 = 100000; fn main() -> Result<(), String> { let r = 50000.0; let dist = Uniform::from(0..100000 as u128 ...
31.983051
78
0.517753
ef1ae807453f2a6b1315ecb1e37c390cbeab7ec9
95,378
use self::EnumTagInfo::*; use self::MemberDescriptionFactory::*; use self::RecursiveTypeDescription::*; use super::namespace::mangled_name_of_instance; use super::type_names::compute_debuginfo_type_name; use super::utils::{ create_DIArray, debug_context, get_namespace_for_item, is_node_local_to_unit, DIB, }; use s...
36.953894
100
0.548816
8f626022059ff9bf50f2923d081125ef978947cd
3,967
// Generated from definition io.k8s.api.extensions.v1beta1.FSGroupStrategyOptions /// FSGroupStrategyOptions defines the strategy type and options used to create the strategy. #[derive(Clone, Debug, Default, PartialEq)] pub struct FSGroupStrategyOptions { /// Ranges are the allowed ranges of fs groups. If you wou...
39.277228
153
0.531132
fc3a00e53c103e0526890f42a508caf58e897255
1,270
pub struct LineText { line_width: Vec<usize> } impl LineText { pub fn new(text: String) -> LineText { LineText { line_width: LineText::calculate_line_width(text) } } ///internally used to calculate the line widths of the text fn calculate_line_width(input:String)->Vec<u...
25.918367
99
0.508661
8a7cc09230edddd8b96e7717ad235ad6b98f4b67
2,228
//! Array declaration node. use super::{join_nodes, Node}; use boa_gc::{Finalize, Trace}; use boa_interner::{Interner, ToInternedString}; #[cfg(feature = "deser")] use serde::{Deserialize, Serialize}; #[cfg(test)] mod tests; /// An array is an ordered collection of data (either primitive or object depending upon th...
26.52381
97
0.643627
16f7def8d0520e6af4bfbcfbafb6194b0f5c291a
411
use crate::physical_plan::state::ExecutionState; use crate::prelude::*; use polars_core::prelude::*; pub(crate) struct UdfExec { pub(crate) input: Box<dyn Executor>, pub(crate) function: Arc<dyn DataFrameUdf>, } impl Executor for UdfExec { fn execute(&mut self, state: &ExecutionState) -> Result<DataFrame>...
25.6875
72
0.676399
acbb6ad45e7b5e45be3e20231c92f7fc9bf486b7
6,024
#[macro_use] extern crate glium; extern crate arcball; extern crate cgmath; use glium::Surface; use glium::index::PrimitiveType; use glium::glutin::{self, ElementState, Event, VirtualKeyCode, MouseButton, MouseScrollDelta}; use cgmath::{Point3, Vector3, Vector2, Matrix4}; use arcball::ArcballCamera; #[derive(Copy, Cl...
37.416149
110
0.452855
fc5f7a4f66ae1b3e5d24c5a674d566c2faab43e2
434
//! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_100.hrx" #[allow(unused)] fn runner() -> crate::TestRunner { super::runner() } #[test] fn test() { assert_eq!( runner().ok("$endColor: red;\r\ \ntest {\r\ \n background-color: darken($endColor, 10%) \\...
21.7
82
0.504608
e25ae72973787872eeb072ccad6aee4e0270483d
11,338
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. /// Service config. /// /// /// Service configuration allows for customization of endpoints, region, credentials providers, /// and retry configuration. Generally, it is constructed automatically for you from a shared /// configuration loa...
36.692557
106
0.628947
7188321f782af51658b61a83e541370e2e954100
4,715
use assert_cmd::Command; use ffizer::tools::dir_diff_list; use predicates::prelude::*; use pretty_assertions::assert_eq; use std::error::Error; use std::fs; use std::path::{Path, PathBuf}; use tempfile::tempdir; use test_generator::test_resources; #[test_resources("tests/data/template_*")] fn run_test_samples(template...
29.654088
86
0.589608
f5da93f93fd932b0e7ed6134e1893c18b6d02d2a
2,907
use super::*; fn generate_fake_frames() -> Vec<BacktraceFrame> { vec![ BacktraceFrame { frame: RawFrame::Fake, symbols: vec![BacktraceSymbol { name: Some(b"std::backtrace::Backtrace::create".to_vec()), filename: Some(BytesOrWide::Bytes(b"rust/backtrac...
30.28125
92
0.494324
fc932a32b869e79f8c348f7bbb47baa9e6072591
10,173
use crate::command; use crate::maker_inc_connections; use crate::maker_inc_connections::RegisterRollover; use crate::maker_inc_connections::TakerMessage; use crate::model::cfd::Completed; use crate::model::cfd::Dlc; use crate::model::cfd::OrderId; use crate::model::cfd::Role; use crate::model::cfd::RolloverCompleted; u...
30.641566
100
0.564927
91deadf412775ad3e413af2f58e6acb407165198
905
use wasm_bindgen::prelude::*; // // A macro to provide `println!(..)`-style syntax for `console.log` logging. #[macro_use] macro_rules! log { ( $( $t:tt )* ) => { web_sys::console::log_1(&format!( $( $t )* ).into()); } } // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global // allocator....
23.815789
79
0.668508
7173d4e989ee3763826ffc3342edf7f51249afab
3,690
use crate::state::State; use async_trait::async_trait; use nu_engine::CommandArgs; use nu_errors::ShellError; use nu_protocol::{Signature, TaggedDictBuilder, UntaggedValue}; use nu_source::Tag; use nu_stream::OutputStream; use std::sync::{Arc, Mutex}; pub struct UseCmd { state: Arc<Mutex<State>>, } impl UseCmd { ...
30.495868
93
0.561789
7248e6b4e3106aed78f3c3a7237667afa88d5545
62
pub mod mtac_lora_h_868_eu868; pub mod mtac_lora_h_915_us915;
20.666667
30
0.870968
de89adc81cc5d07b36e743ff4008c7fa018c0699
20,474
// Copyright 2018 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 applicable law or agree...
31.021212
117
0.620201
bf43da16be0b1944faab6fb2fcbcb062ee4db125
9,221
//! All error types used throughout the library. use chrono::{DateTime, Utc}; use thiserror::Error; /// Errors that can occur while creating or using a `Celery` app. #[derive(Error, Debug)] pub enum CeleryError { /// Raised when `Celery::consume_from` is given an empty array of queues. #[error("at least one q...
33.050179
111
0.657955
1c0f4f85eca715976c37284476678a6f17880652
6,160
//! Access to the real-time state of the joysticks. //! //! `joystick` provides an interface to the state of the joysticks. //! //! Each joystick is identified by an index that is passed to the functions of this module. //! //! This module allows users to query the state of joysticks at any time and directly, //! witho...
32.592593
98
0.668019
90c31a06be52320efdfe190cf54ad5a036ab1085
2,171
use ignore; use errors::Error; use std::io::ErrorKind; use std::path::{Path, PathBuf}; use file_patcher::FilePatcher; use query::Query; use stats::Stats; pub struct DirectoryPatcher { path: PathBuf, dry_run: bool, stats: Stats, } impl DirectoryPatcher { pub fn new(path: PathBuf) -> DirectoryPatcher ...
25.845238
84
0.497927
1c268b49cd75b6f22bd6fd02efdc4512ceca6ba8
2,143
//! This module implements manually tracked test coverage, which useful for //! quickly finding a test responsible for testing a particular bit of code. //! //! See <https://matklad.github.io/2018/06/18/a-trick-for-test-maintenance.html> //! for details, but the TL;DR is that you write your test as //! //! ```rust,no_r...
26.134146
83
0.59776
1d3b8875a4c7143ec092812818d7b0d64137c925
161
use rtools::{Rglica, ToRglica}; use crate::{impl_view, view, View, ViewBase}; #[view] #[derive(Default, Debug)] pub struct ImageView {} impl_view!(ImageView);
17.888889
45
0.708075
61de4d0d82592a8e5e4af49592803c994c6bc93c
5,854
//! Displays several lines with both methods. use amethyst::{ controls::{FlyControlBundle, FlyControlTag}, core::{ nalgebra::{Point3, Vector3}, transform::{Transform, TransformBundle}, Time, }, ecs::{Read, System, Write}, input::InputBundle, prelude::*, renderer::*, ...
32.88764
94
0.529211
8ffd62c0dd66f15204be6f442848837a7c6a6f6b
13,437
// This file is part of the uutils coreutils package. // // (c) Anthony Deschamps <anthony.j.deschamps@gmail.com> // (c) Sylvestre Ledru <sylvestre@debian.org> // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. // spell-checker:ignore (chro...
31.616471
107
0.566868
2923ab9ab244f71f71e095c65ee1333cc0fee53d
11,528
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @generated SignedSource<<f02beeaca80acabc17b06041f998b548>> */ mod refetchable_fragment; use refetchable_fragment::transform_fi...
65.874286
246
0.807686
fcf0feb6e30d00652cfc4ca877bd6bd51fd51e7d
1,731
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
31.472727
88
0.611207
c1ad8226c27256282144c0c713518ba718f038ca
411
use crate::cmd::ProgResult; use crate::man::MANUALS; use std::io::{stdout, Write}; pub fn man(cmds: &[String]) -> ProgResult { let out = stdout(); let mut out = out.lock(); cmds.iter().skip(1).for_each(|cmd| { if !MANUALS.contains_key(cmd.as_str()) { out.write_all(MANUALS[cmd.as_str()]...
24.176471
59
0.554745
d52fac604ba32625db43d80f529fc0ab98d0bc6a
3,686
use crate::alloc::boxed::Box; use crate::base::RTTError::DeviceWriteFailed; use crate::base::{CVoid, RTBaseError, RTTError}; use crate::device::common::*; use core::mem; struct PIN { index: isize, mode: Mode, } struct IRQPin { pin: PIN, irq_func: Option<Box<Box<dyn FnMut()>>>, } #[derive(Debug, Parti...
21.183908
85
0.503527
2f2921498d1ae9e0301d836fb13872b1e6c7fdd8
1,882
use super::show::ShowEthKeyCmd; use crate::application::APP; use abscissa_core::{clap::Parser, Application, Command, Runnable}; use k256::{pkcs8::ToPrivateKey, SecretKey}; ///Import an Eth Key #[derive(Command, Debug, Default, Parser)] pub struct ImportEthKeyCmd { pub args: Vec<String>, #[clap(short, long)] ...
30.852459
96
0.589798
db872b1eb15933c0fb16a24560df33f38c594990
41,753
use std::fmt::{Display, Formatter}; use std::io::Error; use std::{ collections::{BTreeMap, BTreeSet}, fmt::Debug, }; use async_trait::async_trait; use dml::{DmlMeta, DmlOperation, DmlWrite}; use futures::stream::BoxStream; /// Generic boxed error type that is used in this crate. /// /// The dynamic boxing mak...
38.84
128
0.62841
f5ff8f3381ddf2ac87e968c54c91bcc2ff8e4ac2
17,734
use std::mem::take; use serde::{Deserialize, Serialize}; use swc_atoms::{js_word, JsWord}; use swc_common::{util::take::Take, Mark, Spanned, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_utils::{ contains_this_expr, prepend, private_ident, quote_ident, quote_str, ExprFactory, StmtLike, }; use swc_ecma_visit::{ ...
31.895683
100
0.424495
cce14f8268b7c3aaf1f6d500ebab4a2def813ee6
6,143
/* * MIT License * * Copyright (c) 2020 Reto Achermann * * 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, m...
29.392344
136
0.541104
ab26bddff0cbf8f9207c7523672a9ebeca8743a1
4,901
use criterion::black_box; const N: usize = 8; const ITER: usize = 8; fn bench_io_uring() { use io_uring::{opcode, IoUring}; let mut io_uring = IoUring::new(N as _).unwrap(); for _ in 0..ITER { let mut sq = io_uring.submission(); for i in 0..N { let nop_e = opcode::Nop::new()...
23.676329
96
0.507651
e599c3219ce844304376aacc8c6d0992cdfaee98
1,269
// Unless explicitly stated otherwise all files in this repository are licensed // under the MIT/Apache-2.0 License, at your convenience // // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020 // Datadog, Inc. #[cfg(test)] mod tests { use std::process::Command; #[t...
29.511628
99
0.527975
1df48d24501120ea030f4574747290647281f95e
219
pub fn add(x: i32, y: i32) -> i32 { // 一个模块总是可以访问其父级作用域(通过 super::) // 即便是是父级作用域的私有变量、私有函数等。 DEBUG 是私有的,但我们可以在 add 模块中使用它 if super::DEBUG { println!("[DEBUG]: add({}, {})", x, y); } x + y }
24.333333
58
0.52968
e572ff3eb823cccd0199b95c060ef2b4a2d0cba1
13,851
use std::marker::PhantomData; use std::os::raw::c_int; use error::Result; use ffi; use types::{Integer, LuaRef}; use util::{assert_stack, protect_lua, protect_lua_closure, StackGuard}; use value::{FromLua, Nil, ToLua, Value}; /// Handle to an internal Lua table. #[derive(Clone, Debug)] pub struct Table<'lua>(pub(crat...
31.408163
100
0.496787
90f5a8c4ecb9a15316b20e7ade1cc14f79de1428
103
// rustfmt-force_explicit_abi: true // Force explicit abi extern "C" { pub static lorem: c_int; }
14.714286
35
0.68932
2646b8482b8d811c759464eff8d7fc12b442a700
2,955
use std::env; use std::ffi::OsString; use structopt::StructOpt; use which::which_in; use volta_core::error::ErrorDetails; use volta_core::platform::System; use volta_core::run::DefaultBinary; use volta_core::session::{ActivityKind, Session}; use volta_fail::{ExitCode, Fallible, ResultExt}; use crate::command::Comman...
34.764706
98
0.579357
fcea83aac9b0172882a7349d0616c9245006428e
4,781
#![cfg(feature = "test-bpf")] mod utils; use audius_reward_manager::instruction; use borsh::BorshSerialize; use solana_program::program_option::COption; use solana_program::program_pack::IsInitialized; use solana_sdk::signature::Keypair; use utils::program_test; use solana_program::instruction::InstructionError; use ...
29.88125
94
0.592345
f72d578c55fe4e2b19d6a084b38c4942c8d03066
29,022
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ access_path::AccessPath, account_address::AccountAddress, account_config::AccountResource, account_state_blob::AccountStateBlob, block_metadata::BlockMetaData, byte_array::ByteArray, contract_ev...
32.535874
104
0.605954
e9f12c6dd72c1ac64acdec47cb66ff08e316e3a9
678
use crate::{BotResult, CommandData, Context}; use std::sync::Arc; #[command] #[short_desc("https://youtu.be/0jgrCKhxE1s?t=77")] #[bucket("songs")] #[no_typing()] async fn fireandflames(ctx: Arc<Context>, data: CommandData) -> BotResult<()> { let (lyrics, delay) = _fireandflames(); super::song_send(lyrics, de...
27.12
79
0.635693
4b3a45acf038286d82bc5a071ccb6c6886c4685b
1,046
mod opt; mod options; use crate::options::Options; use anyhow::{bail, Context, Result}; use std::env; use std::{fs, process::Command}; use structopt::StructOpt; fn main() -> Result<()> { let opts = Options::from_args(); let wizen = env::var("JAVY_WIZEN"); if wizen.eq(&Ok("1".into())) { let wasm: ...
24.325581
89
0.561185
bb569091c82895a1754d1a4318f1569351b93cac
6,373
use bitcoins::prelude::*; use crate::esplora::*; use crate::{provider::ProviderError, reqwest_utils}; #[derive(serde::Deserialize, Clone, Debug)] pub(crate) struct MerkleProof { pub block_height: usize, pub merkle: Vec<String>, pub pos: usize, } impl MerkleProof { pub(crate) async fn fetch_by_txid( ...
29.920188
94
0.600031
fca2298fc836233dccd75c87986a3b3904c2f112
372
use extras::Get; #[test] fn test_blank() { let extra = Get::default(); let raw: &[u8] = extra.as_ref(); assert_eq!(0, extra.flags()); assert_eq!([0; 4], raw); } #[test] fn test_flags() { let extra = Get::new(0xdeadbeef); let raw: &[u8] = extra.as_ref(); assert_eq!(0xdeadbeef, extra.flags()...
20.666667
46
0.577957
50ac47a67e3f213d7e979ecc717e243dd13f8a8d
11,771
//! Contains definitions of the settings schema that are used to generate the configuration directory //! and to format the output files. use misc::{SettingsPage, SettingRow, SettingType}; pub const PAGE_LIST: &'static [&'static SettingsPage] = &[ &POSTGRES_SETTINGS, &REDIS_SETTINGS, &MM_SETTINGS, &FX...
35.778116
162
0.5607
f9c10761ae24aa4550da1eafdfbb2e05ddbd4156
18,993
use crate::network::{IoEvent, Network}; use crate::user_config::UserConfig; use super::util::{Flag, Format, FormatType, JumpDirection, Type}; use anyhow::{anyhow, Result}; use rand::{thread_rng, Rng}; use rspotify::model::{context::CurrentlyPlaybackContext, PlayingItem}; pub struct CliApp<'a> { pub net: Network<'a...
28.603916
99
0.51956
1e0dcb3161b5b960c31656de505713d3f98aab25
24,605
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ chain_state::{ChainState, SystemExecutionContext, TransactionExecutionContext}, counters::*, data_cache::{BlockDataCache, RemoteCache}, move_vm::MoveVM, system_module_names::*, system_txn::block_met...
39.494382
162
0.567364
095accc55fd447dbcb5d9b03f9f53eec0f135597
2,496
use hoi4save::{Encoding, Hoi4Extractor, PdsDate}; use std::error::Error; mod utils; #[test] fn test_hoi4_text() -> Result<(), Box<dyn Error>> { let data = utils::request("1.10-normal-text.zip"); let (save, encoding) = Hoi4Extractor::builder().extract_save(&data)?; assert_eq!(encoding, Encoding::Plaintext)...
29.714286
75
0.613782
ed87eb5ef6a999078ae45df1e9f53351bbf0fbc0
16,758
//! # A simple, type-safe and opinionated graphics crate //! //! luminance is an effort to make graphics rendering simple and elegant. It is a _low-level_ //! and opinionated graphics API, highly typed (type-level computations, refined types, etc.) //! which aims to be simple and performant. Instead of providing users ...
47.338983
116
0.708617
c17a54f4f69bbb98717992d487c0d0c8a1e7afba
25,372
// Copyright 2012-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-MI...
36.877907
99
0.572442
1832fee4347172ab2d0c30f2efaf44f6efaa435c
482
// force-host #![feature(plugin_registrar)] #![feature(rustc_private)] extern crate rustc; extern crate rustc_plugin; extern crate rustc_driver; use rustc_plugin::Registry; #[plugin_registrar] pub fn plugin_registrar(reg: &mut Registry) { // This pass is built in to LLVM. // // Normally, we would name a...
22.952381
65
0.711618
876516720273ed2ca9fc75e4d9d9988abedd417b
3,802
// This file is part of Substrate. // Copyright (C) 2017-2021 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 obtain a copy of the License at // // ht...
33.946429
86
0.712783
2157ae109e109eef348146ce859a881651e0a52f
5,366
use std::convert::TryFrom; use cranelift_codegen::ir; use serde::{Deserialize, Serialize}; use std::fmt::{Display, Formatter}; #[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] pub enum ValueType { I32, I64, F32, F64, } impl Display for ValueType { fn fmt(&self, f: &mut Formatter) -...
30.316384
111
0.493291
76f09a7225f95f3b84795433eafc1225e15d6aca
12,787
// This file is auto-generated by rute_gen. DO NOT EDIT. use std::cell::Cell; use std::rc::Rc; #[allow(unused_imports)] use std::marker::PhantomData; #[allow(unused_imports)] use std::os::raw::c_void; #[allow(unused_imports)] use std::mem::transmute; #[allow(unused_imports)] use std::ffi::{CStr, CString}; use rute...
31.41769
274
0.594275
9c57516a3ba4737b71fec963ab2cae6ae296718f
1,682
use codespan::{ByteIndex, ByteSpan}; use ast::*; pub type Span = ByteSpan; macro_rules! impl_into_span { ($type:ident) => { impl IntoSpan for $type { fn into_span(&self) -> Span { self.span } } } } pub trait IntoSpan { fn into_span(&self) -> Span; } impl IntoSpan for (ByteIn...
20.512195
53
0.477408
092c276078e84599f0e32495a17a9c69aa8258f9
2,286
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use libra_metrics::{register_histogram, register_int_counter, Histogram, IntCounter}; use once_cell::sync::Lazy; pub static LIBRA_EXECUTOR_EXECUTE_AND_COMMIT_CHUNK_SECONDS: Lazy<Histogram> = Lazy::new(|| { register_histogram!( ...
32.657143
95
0.692038