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
e85275d356c204a9a56ec800198abce68dadc84e
14,307
// Generated from definition io.k8s.api.authorization.v1.SelfSubjectAccessReview /// SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a spec.namespace means "in all namespaces". Self is a special case, because users should always be able to check whether they can perfo...
52.988889
355
0.557
f7ade7cb5bd90bbc348c87bc306da684e0de2251
2,498
use crate::pack; use std::{io, path::PathBuf, sync::Arc}; use tempfile::NamedTempFile; /// Configuration for [write_stream_to_directory][pack::Bundle::write_stream_to_directory()] or /// [write_to_directory_eagerly][pack::Bundle::write_to_directory_eagerly()] #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone...
35.183099
110
0.674139
1ed2e439a658877f23888424ff4621cd00303a1b
6,561
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use invalid_mutations::bounds::{ ApplyCodeUnitBoundsContext, ApplyOutOfBoundsContext, CodeUnitBoundsMutation, OutOfBoundsMutation, }; use libra_types::{account_address::AccountAddress, byte_array::ByteArray, vm_error::StatusCod...
30.235023
129
0.658741
56db546a3f3c7712e15e528aa17344fc50707492
80
trait visitor { u8 myInt; fn myfunc(&self) -> u8 { return self.myInt; } }
10
25
0.6
2919de28d016216fdaecd30e24da78f9b5209617
1,001
trait Max<T> { fn max(&self) -> T; } struct ThreeTuple<T> { first: T, second: T, third: T, } impl<T: PartialOrd + Copy> Max<T> for ThreeTuple<T> { fn max(&self) -> T { if self.first >= self.second && self.first >= self.third { self.first } else if self.second >= self.fi...
19.25
74
0.495504
21b72f812f095116d2f98fbac7691623711b8a2c
953
extern crate chttp; extern crate env_logger; extern crate rouille; use std::env; use std::time::Duration; use std::thread; /// Issue #3 #[test] fn request_errors_if_read_timeout_is_reached() { setup(); // Spawn a slow server. thread::spawn(|| { rouille::start_server("localhost:18080", |_| { ...
23.243902
70
0.612802
fb5b0e9e1e485ecd1c0da2f13cfc841f0d94f437
2,412
use super::auto_release::*; use cubeb_backend::ffi; use std::os::raw::{c_long, c_uint, c_void}; use std::ptr; #[derive(Debug)] pub struct Resampler(AutoRelease<ffi::cubeb_resampler>); impl Resampler { #[allow(clippy::too_many_arguments)] pub fn new( stream: *mut ffi::cubeb_stream, mut input_pa...
27.724138
86
0.536899
f46bc5dab5d0acdccf3699d5e0a4cb736288d1d5
3,068
extern crate termion; extern crate tui; use std::io; use termion::event; use termion::input::TermRead; use tui::Terminal; use tui::backend::MouseBackend; use tui::widgets::{Block, Borders, Row, Table, Widget}; use tui::layout::{Direction, Group, Rect, Size}; use tui::style::{Color, Modifier, Style}; struct App<'a> ...
27.890909
93
0.470339
f7952349efe7d0479999277f502f91f6aaa07e39
2,541
pub mod api_variable_config; use std::collections::HashMap; use crate::config::api_config::api_variable_config::ApiVariableConfig; use crate::config::fetch_value::FetchValue; #[derive(Debug, Clone)] pub struct ApiConfig { pub api_name: String, pub method: String, pub content_type: String, pub enable: ...
30.987805
89
0.532468
261285782557769a6cedef15022d57ac1659ac07
3,054
use std::path::Path; use std::fs; use std::io::Read; use crate::{Magna, SystemCall}; use crate::Instruction; use magnum_common::*; #[test] /// For lack of a better test name fn i_know_what_le_means() { let num = 0x100u16; let bytes = num.to_le_bytes(); assert_eq!(bytes, [0, 1]); } #[test] fn one_plus_one() { let ...
28.277778
95
0.676162
d55d1873841d44b205d034be2ccdc8045ff37b3c
3,810
// Copyright 2018 Amagicom AB. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to...
39.6875
100
0.691076
ed2f7e25dae6ce13b58da32e7a7f0fa23ef24f6d
506
// 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 ...
36.142857
68
0.727273
e42429b59db5acbc7bb52eb1476d089d6a4355a9
4,916
#[cfg(feature = "postgres")] extern crate url; use support::{database, project}; #[test] fn reset_drops_the_database() { let p = project("reset_drops_the_database") .folder("migrations") .build(); let db = database(&p.database_url()).create(); db.execute("CREATE TABLE posts ( id INTEGER )"...
28.416185
83
0.607404
091a8635aa084722bc0b64b907dc1bb18e19e5de
41,058
use crate::ast_types::{GenericsArgs, ImplHeader, Pat, TraitBounds, Ty, TypeParameter}; use crate::codecleaner; use crate::codeiter::StmtIndicesIter; use crate::matchers::ImportInfo; use crate::project_model::ProjectModelProvider; use rls_span; use std::cell::RefCell; use std::cmp::Ordering; use std::collections::HashMa...
29.057325
101
0.557699
0af71817b3633ac87a47c35a1ad0e599abddfd10
347
#[doc = "Reader of register GPIO_IN"] pub type R = crate::R<u32, super::GPIO_IN>; #[doc = "Reader of field `GPIO_IN_DATA`"] pub type GPIO_IN_DATA_R = crate::R<u32, u32>; impl R { #[doc = "Bits 0:25"] #[inline(always)] pub fn gpio_in_data(&self) -> GPIO_IN_DATA_R { GPIO_IN_DATA_R::new((self.bits & 0x...
28.916667
61
0.631124
e97ae70d6ce05b011de7cc7dd006e3e455da7e6d
25,823
// //! Copyright 2020 Alibaba Group Holding Limited. //! //! 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 appl...
32.646018
106
0.548736
1a94c8bc6ad19d97893891434faeec3df72e06d1
9,496
//! Common types for room directory endpoints. use std::fmt; use js_int::UInt; use ruma_identifiers::{MxcUri, RoomAliasId, RoomId}; use ruma_serde::Outgoing; use serde::{ de::{Error, MapAccess, Visitor}, ser::SerializeStruct, Deserialize, Deserializer, Serialize, Serializer, }; use serde_json::Value as Js...
31.759197
106
0.616891
284bfb6ccdb68d45fa8d410e56334bf8ebb3bdbe
5,215
// Copyright 2019-2022 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT mod error; mod util; use cid::Cid; pub use error::*; use futures::{AsyncRead, AsyncWrite, Stream, StreamExt}; use fvm_shared::blockstore::Blockstore; use fvm_shared::encoding::{from_slice, to_vec}; use serde::{Deserialize, Serialize}...
28.497268
99
0.580441
6726ac04550fe5e0a5a69466aad4a62ac5228f88
11,494
// Copyright 2019-2020 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...
33.706745
85
0.615974
222d8a168a54440048231d2fb49087f146bd9f71
2,344
// This file is part of olympus-xmp. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/raphaelcohn/olympus-xmp/master/COPYRIGHT. No part of olympus-xmp, including this file, may be copied, modified, propagated, or dist...
36.061538
390
0.788396
fcc91e297f54c2024e4467c3dc370df44cccc4c7
1,341
mod util; use std::io; use std::path::PathBuf; use std::sync::Arc; use tokio_rustls::rustls; use tracerbench_recorded_response_set::RecordedResponseSets; use util::*; /// Server config pub struct Config { /// Value for chrome switch ignore-certificate-errors-spki-list /// BASE64(SHA256(cert.subjectPublicKeyInfo))...
23.12069
65
0.679344
08716253385d23d08298470e11bfd91183783269
4,672
use crate::randomness::{get_rng_with_seed, RandomNumberGenerator}; use crate::sparse::PyBinaryVector; use crate::pauli::PyPauliOperator; use bincode::{deserialize, serialize}; use ldpc::noise_model::{DepolarizingNoise, BinarySymmetricChannel, NoiseModel, Probability}; use pyo3::exceptions::PyValueError; use pyo3::prelu...
31.146667
95
0.604666
db188ebcfb6fababed5b4b82c10850bdfd805c0a
384
#[cfg(debug_assertions)] macro_rules! cast { ($v: expr, $t: ident) => {{ $t::try_from($v).unwrap_or_else(|_| ASSERT!(false, "Error casting {} to {}", $v, stringify!($t))) }}; } #[cfg(not(debug_assertions))] macro_rules! cast { ($v: expr, $t: ident) => {{ $v as $t }}; } pub use super::super::logging; pub use c...
18.285714
99
0.583333
3a685916f3937bac8f10bc2b7cdb09237abd029f
436
mod confidence; pub(crate) mod detect; mod detector; mod filter_list; mod info; mod method; mod options; mod query; mod text; pub use confidence::calculate_confidence; pub use detect::{detect, detect_lang, detect_with_options}; pub use detector::Detector; pub use filter_list::FilterList; pub use info::Info; pub use me...
21.8
59
0.772936
6210f027f47c4ac7371208ef026fde72643fb5b3
603
use std::error::Error; use std::process::exit; use std::{env, fs}; use crate::models::SnailfishMathProblem; mod models; fn main() -> Result<(), Box<dyn Error>> { let args: Vec<String> = env::args().collect(); if args.len() != 2 { eprintln!("Invalid arguments count"); exit(1); } let fi...
25.125
88
0.615257
1c740556fef19e7bc4f9689bd7cdc1fce347bd12
537
use handlebars::Handlebars; use serde_json::json; #[test] fn test_whitespaces_elision() { let hbs = Handlebars::new(); assert_eq!( "bar", hbs.render_template(" {{~ foo ~}} ", &json!({"foo": "bar"})) .unwrap() ); assert_eq!( "<bar/>", hbs.render_template(" ...
21.48
75
0.439479
79641894628f247101ebd4815b5f0c02f1c567b9
1,725
struct Sheep { naked: bool, name: &'static str, } trait Animal { // Static method signature; `Self` refers to the implementor type fn new(name: &'static str) -> Self; // Instance method signatures; these will return a string. fn name(&self) -> &'static str; fn noise(&self) -> &'static str...
22.115385
75
0.532754
bf3becd6bceb5d23d4dd2241bc71e8c0f4ca41a1
3,439
/* * 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 agr...
30.981982
94
0.587962
e51e2c4d9ce5e5acbff2437c02d9e37d26bc2a2e
1,939
// 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...
28.940299
73
0.593605
01e840a3fa1b9fd46a11b12d9cfbd243fd073607
6,179
use std::str::FromStr; use crate::domain::*; use crate::util::*; #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[serde(tag = "type")] pub enum ConverterReturned { /// This will break process for ever. LogicalError { msg: String }, /// This can quick finish the process, and retry later. En...
29.564593
177
0.601715
fbc30340addfb732abcb254895a726cc3b613547
175
mod common; use common::*; fn invariant_fail_covariant<'a>() { let _in: In<Lifetime<'a>> = In( Invariant::<Lifetime<'static>>::default(), ); } fn main() {}
14.583333
50
0.571429
67a7f59ef7ae00bb0c264f2ba822050e4c15474e
1,505
use crate::{ ParseRule, Parser, properties::PropertyParser, functions::FunctionParser, modules::ModuleParser, }; use lexer::tokens::{ TokenType, }; use notices::{ DiagnosticSourceBuilder, DiagnosticLevel }; pub struct StatementParser; impl ParseRule for StatementParser{ fn parse(...
31.354167
102
0.515615
144f5cd131018721a42c7b7dac53aef61aba5dad
2,158
// Stuff for the /games API call. #[derive(Deserialize, Debug)] struct APIGames { data: Vec<APIGamesData> } #[derive(Deserialize, Debug)] struct APIGamesData { id: String, names: APIGamesNames, categories: Option<APICategories> } #[derive(Deserialize, Debug)] struct APIGamesNames { international: String } #[de...
18.603448
61
0.757646
fb2f532b124c4ef90e979bb0a8f12db9e0a59191
1,950
use crate::test_utils::TestRandom; use crate::*; use serde_derive::{Deserialize, Serialize}; use ssz_derive::{Decode, Encode}; use test_random_derive::TestRandom; use tree_hash::TreeHash; use tree_hash_derive::TreeHash; /// A header of a `BeaconBlock`. /// /// Spec v0.11.1 #[derive(Debug, PartialEq, Clone, Serialize,...
27.857143
99
0.637949
89906409b93b60fa345c4871b902f20b6d11bdf1
315
use rand; use rand::Rng; fn generate_single_program() -> String { let corpus = ['<', '>', '+', '-', '[', ']', '.']; let mut rng = rand::thread_rng(); let mut program = String::new(); for _i in 0..rng.gen_range(10, 100) { program.push(*rng.choose(&corpus).unwrap()); } program }
24.230769
53
0.526984
18519dab6e506cee9bb750df4891276462bd138b
3,927
use ckb_jsonrpc_types::{AlertMessage, ChainInfo, PeerState}; use ckb_network_alert::notifier::Notifier as AlertNotifier; use ckb_shared::shared::Shared; use ckb_sync::Synchronizer; use ckb_traits::BlockMedianTimeContext; use ckb_util::Mutex; use jsonrpc_core::Result; use jsonrpc_derive::rpc; use std::sync::Arc; /// RP...
26.533784
91
0.496053
8798352016cd7962707561be607457973a6e65d1
21,778
// 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 ...
36.056291
81
0.584764
e8073d985df35f9e5af214c206103aa37081b4cb
949
use uart_16550::SerialPort; use spin::Mutex; use lazy_static::lazy_static; lazy_static! { pub static ref SERIAL1: Mutex<SerialPort> = { let mut serial_port = unsafe { SerialPort::new(0x3F8) }; serial_port.init(); Mutex::new(serial_port) }; } #[doc(hidden)] pub fn _print(args: ::core::f...
27.114286
73
0.617492
5bdd02edd1524c861028457a435cb15cc4d15c74
6,236
use num::{NumAssignOps, NumOps, Zero}; use std::any::Any; use std::f64; use std::fmt::Debug; use std::ops::Neg; use crate::scalar::{ComplexField, Field, SubsetOf, SupersetOf}; use crate::simd::{SimdRealField, SimdValue}; /// Lane-wise generalisation of `ComplexField` for SIMD complex fields. /// /// Each lane of an S...
22.759124
80
0.551956
fecbfd99f98665fe40f17094fca4e8811e5c1c9e
1,362
//! # 205. 同构字符串 //! https://leetcode-cn.com/problems/isomorphic-strings/ //! 给定两个字符串 s 和 t,判断它们是否是同构的。 //! 如果 s 中的字符可以被替换得到 t ,那么这两个字符串是同构的。 //! 所有出现的字符都必须用另一个字符替换,同时保留字符的顺序。两个字符不能映射到同一个字符上,但字符可以映射自己本身。 //! # 解题思路 //! y=f(x) && x=f-1(y) pub struct Solution; impl Solution { pub fn is_isomorphic(s: String, t: Stri...
27.795918
80
0.446402
f79f73516989f1597f4a55b425bd33009daddd66
7,266
// 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...
33.638889
99
0.606799
e6d01302e3955b04e73afcfbac6b7b38b6259633
5,171
//! Test cases for `crate::threading` use quickcheck_macros::quickcheck; use std::{ sync::{ atomic::{AtomicBool, AtomicU32, Ordering}, Arc, }, thread::{sleep, yield_now}, time::{Duration, Instant}, }; use super::threading; #[test] fn unpark_external_thread() { let parent_thread = t...
26.792746
77
0.584606
ac8c0c283ef844c91ae9bf4a1670ef7e8f32bab0
546
#![feature(const_generics)] #![feature(const_evaluatable_checked)] #![feature(const_fn)] trait MiniTypeId { const TYPE_ID: u64; } impl<T> MiniTypeId for T { const TYPE_ID: u64 = 0; } enum Lift<const V: bool> {} trait IsFalse {} impl IsFalse for Lift<false> {} const fn is_same_type<T: MiniTypeId, U: MiniTyp...
18.827586
63
0.648352
16f852040b91cc793d46227b040c30be00ed1e7e
974
use proc_macro2::*; use syn; use util::*; pub fn derive(mut item: syn::DeriveInput) -> Result<TokenStream, Diagnostic> { let type_params = item .generics .type_params() .map(|param| param.ident.clone()) .collect::<Vec<_>>(); for type_param in type_params { let where_cla...
27.828571
85
0.603696
6707090e8a52a9907ec93970ac4f318282beecc7
4,723
use crate::prelude::*; use crate::headers::from_headers::*; use azure_core::headers::{ content_type_from_headers, etag_from_headers, session_token_from_headers, }; use azure_core::{collect_pinned_stream, Context, Response as HttpResponse}; use chrono::{DateTime, Utc}; #[derive(Debug, Clone)] pub struct GetCollect...
36.898438
99
0.66589
1cdab36d941dee0ad37fadefeb10e88e08c132ed
895
// Copyright 2016 lazy-static.rs Developers // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except accor...
24.861111
77
0.62905
39709f3c438280608680e9756110dd60737255fc
23,614
// "asi_vulkan" - Aldaron's System Interface - Vulkan // // Copyright Jeron A. Lau 2018. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) #[macro_use] extern crate dl_api; extern crate awi; extern crate euler; ...
25.723312
86
0.709537
72e5741cc113b76611e94dc8e6eea31fcc122cad
1,260
use crate::serde::SceneDeserializer; use anyhow::Result; use bevy_asset::{AssetLoader, LoadContext, LoadedAsset}; use bevy_ecs::world::{FromWorld, World}; use bevy_reflect::TypeRegistryArc; use bevy_utils::BoxedFuture; use serde::de::DeserializeSeed; #[derive(Debug)] pub struct SceneLoader { type_registry: TypeReg...
28.636364
78
0.612698
5d2256100ff67c9f9afdd386b78bae78338d8835
52,142
use crate::{LateContext, LateLintPass, LintContext}; use rustc_ast as ast; use rustc_attr as attr; use rustc_data_structures::fx::FxHashSet; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::{is_range_literal, ExprKind, Node}; use rustc_middle::ty::layout::{IntegerExt, SizeSkeleton}; use rustc_middl...
37.458333
119
0.474416
1a285b379813c09a69d6462932a6ff4141fad363
19,809
#[doc = "Reader of register C1"] pub type R = crate::R<u8, super::C1>; #[doc = "Writer for register C1"] pub type W = crate::W<u8, super::C1>; #[doc = "Register C1 `reset()`'s with value 0"] impl crate::ResetValue for super::C1 { type Type = u8; #[inline(always)] fn reset_value() -> Self::Type { 0 ...
27.474341
137
0.523752
edfc5d3738eb3d43845b88b0c4aaf36923e0cbb1
4,590
extern crate backtrace; pub extern crate bigdecimal; extern crate diesel; pub extern crate ethabi; extern crate futures; extern crate graphql_parser; extern crate hex; #[macro_use] extern crate lazy_static; extern crate num_bigint; extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_yaml; pub...
39.230769
99
0.749673
e9b03920c9b6cea37ba9886abbe4ac13e8fce1bf
8,561
pub mod params; use std::hash::Hash; use std::{collections::HashMap, convert::TryFrom, fmt::Display}; use serde::{Deserialize, Deserializer, Serialize}; use self::params::{BoolParam, FloatParam, StringParam}; #[derive(Deserialize, Debug, Clone)] #[serde(untagged)] pub enum SerializedStringParam { Param(StringPa...
25.942424
94
0.528093
b97b2b33a7409b55c34fa552cefe143843057914
576
/* automatically generated by rust-bindgen 0.55.1 */ // Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Generated by src/lib/network/ethernet/scripts/bindgen.sh pub const ETH_FIFO_RX_OK: u32 = 1; pub c...
27.428571
73
0.715278
ef78f2c6dc3947109d100c5be7c1ef0db46d6627
135,708
use { crate::{ block_error::BlockError, blockstore::Blockstore, blockstore_db::BlockstoreError, blockstore_meta::SlotMeta, leader_schedule_cache::LeaderScheduleCache, }, chrono_humanize::{Accuracy, HumanTime, Tense}, crossbeam_channel::Sender, itertools::Itertools, log::*, ra...
35.488494
167
0.558206
f56983c14b1bc88e560746d0b7c483bea01f1a67
975
// 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 ...
27.083333
83
0.708718
6980a9f392343693feaca9275a3485073167e468
25,604
use super::*; use crate::{ constants::{aggregations::*, output_fields::*}, schema::{IntoArc, ObjectTypeStrongRef, OutputType, OutputTypeRef, ScalarType}, CoreError, DatabaseEnumType, EnumType, OutputFieldRef, QueryResult, RecordAggregations, RecordSelection, }; use bigdecimal::ToPrimitive; use connector::{A...
41.97377
152
0.570809
e9258d581956ed327028be21918cd2f5bf87bd29
5,186
// Copyright (c) 2018-2021 Brendan Molloy <brendan@bbqsrc.net>, // Ilya Solovyiov <ilya.solovyiov@gmail.com>, // Kai Ren <tyranron@gmail.com> // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the M...
28.338798
80
0.539337
0e144fb332ee0847cf2130ab8407223dff33cfe6
5,245
use super::bitmask::BitMask; use super::EMPTY; use core::{mem, ptr}; // Use the native word size as the group size. Using a 64-bit group size on // a 32-bit architecture will just end up being more expensive because // shifts and multiplies will need to be emulated. #[cfg(any( target_pointer_width = "64", targ...
36.93662
79
0.629933
873fedf49db606a50f103b5d837629281abdb517
6,582
#![allow(clippy::type_repetition_in_bounds)] #[cfg(feature = "client")] use amethyst::{ assets::Handle, ecs::ReadExpect, renderer::{Material, Mesh, SpriteRender}, }; use amethyst::{ core::Transform, ecs::{prelude::World, Entities, Entity, WriteStorage}, shred::{ResourceId, SystemData}, util...
30.054795
74
0.544515
e4de2a110d083ac9fb7cf1ffc31ffee6d5e8f8b8
2,590
#[doc = "Reader of register MATCHREL15"] pub type R = crate::R<u32, super::MATCHREL15>; #[doc = "Writer for register MATCHREL15"] pub type W = crate::W<u32, super::MATCHREL15>; #[doc = "Register MATCHREL15 `reset()`'s with value 0"] impl crate::ResetValue for super::MATCHREL15 { type Type = u32; #[inline(always...
39.846154
213
0.627027
16da6e4c4839af083a0dc86c0a38ebc660aedb7e
1,537
// An imaginary magical school has a new report card generation system written in Rust! // Currently the system only supports creating report cards where the student's grade // is represented numerically (e.g. 1.0 -> 5.5). // However, the school also issues alphabetical grades (A+ -> F-) and needs // to be able to prin...
30.74
87
0.620039
64d85645b27d24366d4c570ba2ab9a5e0c026f79
7,966
use crate::parser::expression::*; use crate::parser::util::*; use crate::tokenizer::*; #[derive(Debug)] pub enum StatementNode<'a> { Null, Expression(Expression<'a>), If { condition: Box<Expression<'a>>, statement: Box<StatementNode<'a>>, }, Switch { condition: Box<Expressio...
29.179487
98
0.630429
eb83d940838b9b57094f0d500076897dbfb09ac8
512
extern crate console_error_panic_hook; use js_sys::Int32Array; use rayon::prelude::*; use std::panic; use wasm_bindgen::prelude::*; pub use wasm_bindgen_rayon::init_thread_pool; #[wasm_bindgen(start)] pub fn start() -> Result<(), JsValue> { panic::set_hook(Box::new(console_error_panic_hook::hook)); Ok(()) } #...
25.6
62
0.712891
edbbf60530e460e2e6b8605f95d55be9c61d7821
16,577
use std::{clone::Clone, fmt, str}; use reqwest::StatusCode; use serde::{Deserialize, Serialize}; use serde_repr::{Deserialize_repr, Serialize_repr}; use url::Url; pub type AssetId = u64; pub const DEFAULT_PLACE_NAME: &str = "Untitled Game"; #[derive(Deserialize, Debug)] pub struct RobloxApiErrorResponse { // Th...
26.312698
101
0.668999
7a941221ab433a8c8789523bdb856fac2367e703
16,240
use std::io::{Error, ErrorKind}; use std::iter::FromIterator; use std::path::{Path, PathBuf}; use std::sync::Arc; use local_encoding::{Encoder, Encoding}; use crate::cmd; use crate::compiler::{ Arg, CommandInfo, CompilationArgs, CompilationTask, InputKind, OutputKind, Scope, }; use std::fs; enum ParamValue<T> { ...
39.706601
100
0.440948
628676c7051193e864cee8ea6e93066104319539
3,706
pub use tdd_kata::mst_kata::day_1::{EdgeWeightedGraph, WeightedEdge, LazyMst}; pub use std::cmp::Ordering; pub use expectest::prelude::{be_equal_to, be_some, be_ok, be_err}; describe! edge_weighted_graph { describe! weighted_edge { before_each { let edge = WeightedEdge::new(1, 2, 1); ...
31.40678
78
0.550459
fcbc41806ea3f692e65c2d6f1b9e1784465c03d4
14,338
use std::error; use std::fmt; use std::io; use std::result; /// A convenient type alias for `Result<T, snap::Error>`. pub type Result<T> = result::Result<T, Error>; /// `IntoInnerError` occurs when consuming a `Writer` fails. /// /// Consuming the `Writer` causes a flush to happen. If the flush fails, then /// this e...
39.174863
79
0.547566
90dd7ec90e6051ec18d3b12816de33a808396f88
4,030
use macaw::{Mat2, UVec4, Vec2, Vec4}; #[repr(C)] #[derive(Copy, Clone)] #[cfg_attr(not(target_arch = "spirv"), derive(Debug))] pub struct MeshDescriptor { pub vertex_core_offset: u32, // position, normal packed in one pub vertex_uv_offset: u32, pub vertex_mat_offset: u32, pub vertex_aux_offset: u32, ...
25.66879
98
0.57866
642c7cdc7e93d161ba98d009433bb6aa17ff172a
803
/* Copyright 2020 Takashi Ogura 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 writing...
27.689655
74
0.744707
76def79f93414af7fa63d63b1f5d4cad3c76aaac
1,182
// Copyright © 2021 VMware, Inc. All Rights Reserved. // SPDX-License-Identifier: BSD-2-Clause //! PVRDMA device for VMs //! //! # Additional Documentation //! - https://github.com/qemu/qemu/blob/master/docs/pvrdma.txt //! - https://blog.linuxplumbersconf.org/2017/ocw/system/presentations/4730/original/lpc-2017-pvrdma...
23.64
133
0.70643
08a602dc1077d8933ccd3c5a23b203f50a72a7c1
22,264
/* * 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. */ mod scope; use super::get_applied_fragment_name; use crate::{ match_::SplitOperationMetadata, no_inline::{is_raw_response_...
41.614953
141
0.585879
ed26b7e6e4bf6118eddf12a6932b84bae0bc204b
11,604
// Copyright 2021 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::thread; use std::time::Duration; use crate::common::{parse_file_to_u64, se...
30.536842
96
0.654516
5d96d57f635573650465095a4e66572969919371
26,007
use std::borrow::Cow; use std::collections::HashMap; use std::iter::FromIterator; use std::ops::Range; use failure::Error; use crate::psd_channel::PsdChannelCompression; use crate::psd_channel::PsdChannelKind; use crate::sections::image_data_section::ChannelBytes; use crate::sections::layer_and_mask_information_secti...
57.793333
610
0.428077
de3d72033a039361ede631525f19023018b0aee4
10,432
// DO NOT EDIT ! // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! //! This documentation was generated from *Cloud Build* crate version *1.0.14+20200704*, where *20200704* is the exact revision of the *cloudbuild:v1* schema built by the [mako](http://www.makotemplates.org/) cod...
47.418182
672
0.68587
1aa9b0951dd6d68473479c5a39ded0a05ae5414a
4,887
// DO NOT EDIT -- generated code use byteorder::{ ByteOrder, ReadBytesExt }; use serde::Serialize; #[allow(unused_imports)] use crate::bits::BitReader; #[allow(unused_imports)] use crate::fields::{ Field, FieldContent, FieldDefinition, }; #[derive(Debug, Default, Serialize)] pub struct BloodPre...
31.529032
106
0.512789
1867a7996cb8d2bef5148f923f5bdc8089c0d618
23,930
//! RISCV Support #![allow(clippy::inconsistent_digit_grouping)] use crate::core::Architecture; use crate::CoreInterface; use anyhow::{anyhow, Result}; use communication_interface::{ AbstractCommandErrorKind, AccessRegisterCommand, DebugRegister, RiscvCommunicationInterface, RiscvError, }; use crate::core::{...
30.252845
130
0.590221
26a9955555719c426d93e60fd19cac9f588d9251
9,080
//! A module for implementing some helpful functions for `monotree`. use crate::*; use num::{NumCast, PrimInt}; use rand::Rng; use std::cmp; use std::ops::Range; #[macro_export] /// std::cmp::max() extension for use with multiple arguments. macro_rules! max { ($x:expr) => ($x); ($x:expr, $($e:expr),+) => (cmp:...
29.480519
96
0.528965
62fd5a28f6fb08dfcff9fe880ab9cd23d04f7156
3,655
extern crate core; use hound; use libmp3lame_sys::*; use num_rational::Rational64; use std::ffi::CString; use std::fs::File; use std::i16; use std::io::prelude::*; use std::io::{self}; use std::os::raw::c_char; use std::ptr::NonNull; use std::time::SystemTime; use std::time::UNIX_EPOCH; pub const SAMPLE_RATE: u32 = 4...
29.24
97
0.55513
e2b984959060c2b270e9536b509fbcaaa67e512b
16,847
// 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...
30.686703
96
0.539384
f5796fffbb7d702f91abdce088e45cef9d4714a8
2,287
use crate::{ datatypes::DataType, types::{NativeType, NaturalDataType}, error::ArrowError, }; use super::Scalar; /// The implementation of [`Scalar`] for primitive, semantically equivalent to [`Option<T>`] /// with [`DataType`]. #[derive(Debug, Clone)] pub struct PrimitiveScalar<T: NativeType> { // No...
25.696629
92
0.56056
50128330fbc03d2a5159a30d1ad336f1368836eb
12,728
#![cfg(feature = "serde")] extern crate serde; use self::serde::de::{ Deserialize, DeserializeSeed, Deserializer, EnumAccess, Error, Unexpected, VariantAccess, Visitor, }; use self::serde::ser::{Serialize, Serializer}; use {Level, LevelFilter, LOG_LEVEL_NAMES}; use std::fmt; use std::str::{self, FromStr}; /...
31.740648
98
0.530798
ed4e56df59a6590d24dd7cb1674a36e2ab0058ee
376
use std::path; fn main() { let wally_dir_path = path::PathBuf::from("./bld/lib"); let wally_dir_str = wally_dir_path.as_path().to_str().expect("Please build wally first (in ./bld)"); println!("cargo:rustc-link-search=native={}", wally_dir_str); println!("cargo:rustc-link-lib=dylib=wallycore"); ...
34.181818
88
0.667553
18dc9e196d435d285d45a4e2e2053abc40845039
4,271
use cmd; use channel; use msg::RawMessage; use util; use server::{Server}; use con::Peer; /// Handles the quit/part event pub fn do_quit_leave(channel: &mut channel::Channel, client: Peer, command: cmd::Command, reason: Option<Vec<u8>>) { let nick = channel.member_with_id(client.id()).map(|v|...
35.008197
98
0.504332
f4454963d45a8769bdea6bb4e28e171e051ea6e4
635
extern crate bio; use std::str; use bio::dna::Dna; /// Code Challenge: Solve the String Composition Problem. /// Input: An integer k and a string Text. /// Output: Compositionk(Text) (the k-mers can be provided in any order). fn main() { let mut s_dna = String::new(); let mut s_k = String::new(); bio::i...
23.518519
73
0.607874
f5530c027d9288f78f3d4a6b3b382fc0bd115317
972
use std::future::Future; use std::sync::RwLock; use once_cell::sync::Lazy; use tokio::runtime::Runtime; use tokio::task::JoinHandle; use tracing::trace; pub static RUNTIME: Lazy<RwLock<Option<Runtime>>> = Lazy::new(|| { trace!("build tokio runtime"); RwLock::new(Some( tokio::runtime::Builder::new() ...
22.604651
66
0.580247
91b0e011bd1e5cc3f46811f6a6b91d0abac9cbd9
1,223
pub use wasmtime_rust_macro::wasmtime; // modules used by the macro #[doc(hidden)] pub mod __rt { pub use anyhow; pub use wasmtime; pub use wasmtime_wasi; use std::convert::{TryFrom, TryInto}; pub trait FromVecValue: Sized { fn from(list: Vec<wasmtime::Val>) -> anyhow::Result<Self>; }...
27.177778
85
0.408831
2f18a914b823880476e0d3a14857b02fa54db3fa
4,096
#![allow(non_snake_case, non_upper_case_globals)] #![allow(non_camel_case_types)] //! Advanced-timers //! //! Used by: stm32f302, stm32f303 #[cfg(not(feature = "nosync"))] pub use crate::stm32f3::peripherals::tim8::Instance; pub use crate::stm32f3::peripherals::tim8::{ CCMR3_Output, ARR, BDTR, CCER, CCMR1, CCMR2, ...
32
99
0.608398
223d932258b3e58722c5dc1eae42b6d60c0f4198
334
fn main() { print_the_pattern(10); } fn print_the_pattern(n: i32) { let mut s = String::new(); for i in (1..n + 1).rev() { for j in (1..n + 1).rev() { for _ in 0..i { s.push_str(j.to_string().as_str()); } } s.push_str("\n"); } print...
16.7
51
0.41018
28fdb9947c9b5c66b4c54f0f2b6a14ef62bce308
4,565
use criterion::*; use cryptography_core::cdd_claim::{compute_cdd_id, CddClaimData}; use cryptography_core::curve25519_dalek::scalar::Scalar; use private_identity_audit::{ uuid_to_scalar, verifier::gen_random_uuids, CommittedSetGenerator, PrivateUids, ProofGenerator, ProofVerifier, Prover, Verifier, VerifierSetG...
33.566176
99
0.618839
3357f252647915896baf296192a0ea5c3ff14580
930
pub const PAGESIZE: usize = 4096; pub const PAGESHIFT: usize = 12; pub const KERNELBASE: usize = 0x40000000; pub const MEMSIZE: usize = 1 << 30; // 1GB pub const PHYEND: usize = KERNELBASE + MEMSIZE; pub const UARTBASE: usize = 0x09000000; pub const UARTSIZE: usize = 0x00001000; pub const GICDBASE: us...
25.833333
53
0.653763
6a3c34a5197c371266414b46f1dae02cebef30df
1,441
//! Joined locking //! use crate::{Lock, LockToken}; pub fn lock2<'token, A, B>(_: &'token mut LockToken, a: A, b: B) -> (A::Output, B::Output) where A: Lock<'token> + 'token, B: Lock<'token> + 'token, { unsafe { let lock_a = a.lock_info(); let lock_b = b.lock_info(); let mut lock...
20.295775
90
0.501041
87cb749d8af5fbb5aa04b5056a09b1c8fbc14da8
2,138
use glob::glob; use std::{env, path::PathBuf}; const VERSION: &str = env!("CARGO_PKG_VERSION"); fn main() { // Forcibly disable backtraces. env::remove_var("RUST_LIB_BACKTRACE"); env::remove_var("RUST_BACKTRACE"); let mut app = clap::App::new("trash"); app = app.version(VERSION); app = app.ab...
33.40625
91
0.418148
d7d962c07d6ded530ebc93efdbffab04b27338b0
1,384
// Copyright 2013-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...
20.057971
69
0.641618
0e0b0b518d587efc815ddadf375e76588cc3a349
3,103
// 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 ...
25.227642
76
0.536255
18499dfd31f57595bf942c3f0e8ddaec32121602
49,973
#[doc = r" Value read from the register"] pub struct R { bits: u32, } #[doc = r" Value to write to the register"] pub struct W { bits: u32, } impl super::F24R2 { #[doc = r" Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R,...
25.587814
59
0.491706
1cad982f92eb04611108edbfd805bfec01b90816
1,272
// Copyright (c) 2017, Dennis Hamester <dennis.hamester@startmail.com> // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. // // THE SOFTWARE IS PROVI...
63.6
156
0.802673
f5ee7e63b55a4d57730f2c73752661c637dbfd4d
4,479
// Copyright 2021 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { crate::flags::build_flag_combinations, fidl::endpoints::create_proxy, fidl_fuchsia_io as io, fidl_fuchsia_io_test as io_test, fidl_fuchsia_sy...
40.718182
107
0.694351
0a60618ac358d1064b188ce3c5171a976a957238
308
use diesel::pg::PgConnection; use diesel::prelude::*; use crate::CONFIG; pub fn establish_connection() -> PgConnection { let config = CONFIG.clone(); PgConnection::establish(&config.server.database_url).expect(&format!( "Error connecting to {}", config.server.database_url )) }
23.692308
73
0.675325
1a2cd901c3e71e86a8df076638ec0dc1468b9662
9,967
use serde::{Deserialize, Serialize}; use tracing::{error, trace}; use ibc::{ ics02_client::client_state::{ClientState, IdentifiedAnyClientState}, ics03_connection::connection::{ ConnectionEnd, IdentifiedConnectionEnd, State as ConnectionState, }, ics04_channel::channel::{ChannelEnd, IdentifiedC...
33.786441
98
0.641818
21789d552ab4cdd28dd1454f71b3e0461e45ae6e
404
pub fn build_proverb(list: &[&str]) -> String { let mut result = String::new(); for i in 0..list.len() { if i == (list.len() - 1) { result = format!("{}\nAnd all for the want of a {}.\n", result, list[0]); } else { result = format!("{}\nFor want of a {} the {} was lost."...
28.857143
100
0.482673