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
c168d5c8a2eac9e58752c2cb6d4ddedd08bc2ec6
7,549
//! # The Rust Core Library //! //! The Rust Core Library is the dependency-free[^free] foundation of [The //! Rust Standard Library](../std/index.html). It is the portable glue //! between the language and its libraries, defining the intrinsic and //! primitive building blocks of all Rust code. It links to no //! upst...
30.686992
92
0.718638
1daf7f0456ca2de8990d542b9662590b566b2a47
12,403
use bevy_ecs::ResMut; use std::marker::PhantomData; #[derive(Debug)] struct EventInstance<T> { pub event_count: usize, pub event: T, } #[derive(Debug)] enum State { A, B, } /// An event collection that represents the events that occurred within the last two [Events::update] calls. Events can be cheap...
32.899204
156
0.574538
7a9b40323f4610974ce0913147f41caa7facb8dc
366
// SPDX-License-Identifier: MIT use rtnetlink::new_connection; #[tokio::main] async fn main() -> Result<(), String> { let (connection, handle, _) = new_connection().unwrap(); tokio::spawn(connection); handle .link() .add() .bridge("my-bridge-1".into()) .execute() .a...
21.529412
60
0.54918
5d4bf8e46d5369f86c42ff7db0ecf1a3c6b15261
193,266
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::Justification; use crate::TextDirection; use crate::WrapMode; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHan...
35.684269
104
0.534419
28842791be4f80195a968c06b15ff51bc1b721c0
17,272
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ account_config::LBR_NAME, account_state_blob::AccountStateBlob, block_info::BlockInfo, ledger_info::LedgerInfo, proof::{ definition::MAX_ACCUMULATOR_PROOF_DEPTH, AccountStateProof, EventAccumula...
37.304536
100
0.63629
f49a8f83550e95e5cf061c3e06ede1d3416451c6
92,377
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. /// Operation shape for `AddFacetToObject`. /// /// This is usually constructed for you using the the fluent builder returned by /// [`add_facet_to_object`](crate::client::Client::add_facet_to_object). /// /// See [`crate::client::fluent_b...
42.142792
144
0.689771
f83d22e5c397b74668a99d4de38afde71d59d35b
1,840
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ use aws_config::meta::region::RegionProviderChain; use qldb::model::PermissionsMode; use qldb::{Client, Error, Region, PKG_VERSION}; use structopt::StructOpt; #[derive(Debug, StructOpt)] struct Opt { ...
27.462687
84
0.623913
2fc4532de41c32ca5f07617368fb478f59e9eb30
25,643
//! Oracles. //! //! Oracles take a test case and determine whether we have a bug. For example, //! one of the simplest oracles is to take a Wasm binary as our input test case, //! validate and instantiate it, and (implicitly) check that no assertions //! failed or segfaults happened. A more complicated oracle might co...
36.015449
100
0.565768
0e883d6adfcbd701acc4936494cc829cc582139b
7,652
use std::ffi::CStr; use crate::extn::core::numeric::{self, Coercion, Outcome}; use crate::extn::prelude::*; const FLOAT_CSTR: &CStr = cstr::cstr!("Float"); pub fn init(interp: &mut Artichoke) -> InitializeResult<()> { if interp.is_class_defined::<Float>() { return Ok(()); } let spec = class::Spec...
32.561702
97
0.614219
e927c05e0c9db9453d1af4ee44a279ae6d65b823
59,471
// 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...
38.567445
135
0.579257
11798f7d6c54b5b289e3eec205e2d9d0f6e3476b
6,832
//! Contains the `VehicleType` enum and its associated traits. It specifies the //! mode of transportation for transit directions. use crate::directions::error::Error; use serde::{Deserialize, Serialize}; /// Indicates the [vehicle /// type](https://developers.google.com/maps/documentation/directions/intro#VehicleTyp...
41.658537
92
0.602752
67b0f788cf2b0b22945b158ab9576e56cd6f2173
2,318
/// /// Interface for adding grafana annotations about deploys /// use reqwest; use chrono::Utc; use std::env; use serde_json::json; use super::{Result, ErrorKind, ResultExt}; /// At what time the annotation should be made #[derive(Debug)] pub enum TimeSpec { Now, Time(u64), } /// The type of annotation even...
25.195652
71
0.610009
89156717f4cd0b4147f0011be06b81fa1c653693
64
aima.test.core.unit.probability.bayes.approx.ParticleFilterTest
32
63
0.875
1aae08f3cca1dd4787584ca2f9f60f40dfad66d4
25,727
use std::env; use support::{project, execs, basic_bin_manifest}; use support::{RUNNING, COMPILING, DOCTEST}; use hamcrest::{assert_that, existing_file}; use cargo::util::process; fn setup() { } fn disabled() -> bool { // First, disable if ./configure requested so match env::var("CFG_DISABLE_CROSS_TESTS") { ...
29.537313
91
0.449644
f811eb7f2951d6d0be3eb7fe0745fce578b35456
709
// test1.rs // This is a test for the following sections: // - Variables // - Functions // Mary is buying apples. One apple usually costs 2 Rustbucks, but if you buy // more than 40 at once, each apple only costs 1! Write a function that calculates // the price of an order of apples given the order amount. No hints th...
23.633333
82
0.660085
fc6481450c9e85ce6f53ea8b600425569ca5621b
20,139
//! Here we handle incoming connections and communication on the RPC socket. //! Actual JSONRPC2 commands are handled in the `api` mod. use crate::jsonrpc::api::{JsonRpcMetaData, RpcApi, RpcImpl}; use crate::DaemonControl; use std::{ collections::{HashMap, VecDeque}, io::{self, Write}, path::PathBuf, ...
38.214421
166
0.497294
16e07cb5f47b720c75a9893e0955cb491f7cf262
2,250
use std::ffi::OsStr; use std::fs; use std::io::Write; use std::path::PathBuf; use structopt::StructOpt; #[derive(Debug, StructOpt)] #[structopt( name = "gpak2c", about = "GPAK output converter from *.hex or *.csv into *.c files" )] struct InputArgs { #[structopt(short = "i", long = "input")] input_path...
29.220779
79
0.563556
29aba7c121873bbd6c57aa3d24d2758942040ba3
19,332
use crate::utils::{constants, snippet_opt, span_lint, span_lint_and_help, span_lint_and_sugg, span_lint_and_then}; use rustc_ast::ast::{ BindingMode, Expr, ExprKind, GenericParamKind, Generics, Lit, LitFloatType, LitIntType, LitKind, Mutability, NodeId, Pat, PatKind, UnOp, }; use rustc_ast::visit::FnKind; use r...
33.915789
114
0.450652
1656176bea027afd0bac2cc243546783b48a97b3
1,141
#![recursion_limit = "256"] #![cfg_attr(feature = "diagnostics", feature(proc_macro_diagnostic))] #[macro_use] extern crate quote; #[macro_use] extern crate syn; extern crate fnv; extern crate ident_case; #[cfg(feature = "diagnostics")] extern crate proc_macro; extern crate proc_macro2; #[cfg(feature = "suggestions")]...
22.82
69
0.778265
fb25814aaa79b77ac32d6a0e923dc755c30ef38e
1,820
use std::fs::File; use std::io::Read; use std::io::Result; pub fn solve() -> Result<()> { let mut file = File::open("input/09.txt")?; let mut input = String::new(); file.read_to_string(&mut input)?; let (first, second) = solve_both(&input); println!("day 9 first: {}", first); println!("day 9 s...
26.376812
73
0.397802
fc44b3ae288edc898329947f85221a5ef8333ab9
37,521
//! This module implements the JavaScript Value. //! //! Javascript values, utility methods and conversion between Javascript values and Rust values. #[cfg(test)] mod tests; use crate::{ builtins::{ number::{f64_to_int32, f64_to_uint32}, Number, }, gc::{Finalize, Trace}, object::{JsObj...
32.34569
151
0.542976
8fc2026f7c72f92fd6fd2741e935c242ae88ce62
3,882
#[derive(Clone, PartialEq, ::prost::Message)] pub struct C2s { ///UserInfoField集合,不设置默认返回全部信息 #[prost(int32, optional, tag="2")] pub flag: ::core::option::Option<i32>, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct S2c { ///用户昵称 #[prost(string, optional, tag="1")] pub nick_name: ::co...
34.660714
89
0.628027
4895cd64af35aaede434bab97a19596c3786cd91
3,272
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; use ::test::run_test; #[test] fn vminsd_1() { run_test(&Instruction { mnemonic: Mnemonic::VMINSD, operand1: Some(Direct(XM...
66.77551
438
0.705685
f46983118d72a7598e9ef1779971ced267abc6f3
2,303
// This file is part of HydraDX. // Copyright (C) 2020-2021 Intergalactic, Limited (GIB). // 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 // // ...
34.893939
157
0.756839
1a3d7821159c3fc5874697724a42866f31e72deb
1,141
// 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 ...
29.25641
68
0.680982
89461853bdfa300013e7f1aa7bb6934a6f8b3f95
19,523
use crate::{ behavior::{commit_block, verify_block}, block_proposal::BlockProposal, network::raft::{ message::{NewBlockRequest, NewBlockResponse}, rpc::get_block_proposal, }, snapshot::Snapshot, }; use async_raft::{ raft::{Entry, EntryPayload, MembershipConfig}, storage::{Cur...
34.553982
97
0.536598
e9630c0a449ced84330459805d9c6798ab1da7e2
882
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2019-2022 Second State INC mod cpp_header; use anyhow::{anyhow, Result}; pub use cpp_header::to_cpp_header; use std::path::Path; use witx::{load, WitxError}; pub fn generate<P: AsRef<Path>>(inputs: &[P]) -> Result<String> { // TODO: drop the anyho...
25.941176
65
0.536281
08767a0b2324df3455c7832a4304b2ad36ff9652
1,121
use cloud_pubsub::Client; use serde_derive::Deserialize; use std::sync::Arc; use serde_json::json; use std::collections::HashMap; #[derive(Deserialize)] struct Config { topic: String, google_application_credentials: String, } #[tokio::main] async fn main() { let parsed_env = envy::from_env::<Config>(); ...
28.025
81
0.602141
67d79067d0e3cf076d238368f90e197a6b113178
372
// Consider copying this into a general module, or to implement it for Vec<Vec<T>> pub fn transpose_vec<T: Copy>(vec: Vec<Vec<T>>) -> Vec<Vec<T>> { let length = vec[0].len(); // Scan the 2d vec columns one by one, emit a row for every column scanned vertically (0..length) .map(|index| vec.iter().ma...
37.2
89
0.629032
5bcc1ad24afa29346ed21bbc754749d7ce522b3e
115,139
// Copyright 2016 TiKV Project Authors. Licensed under Apache-2.0. use crate::storage::kv::{Modify, ScanMode, Snapshot, Statistics, WriteData}; use crate::storage::mvcc::{metrics::*, reader::MvccReader, ErrorInner, Result}; use crate::storage::types::TxnStatus; use engine_traits::{CF_DEFAULT, CF_LOCK, CF_WRITE}; use k...
36.436392
103
0.53451
1a79230b399c40af1633de020da14f0e862eceb8
5,462
use crate::phases::OpaqueRenderPhase; use crate::shaders; use fnv::FnvHashMap; use glam::Vec3; use rafx::api::RafxResult; use rafx::assets::{ AssetManager, BufferAsset, DefaultAssetTypeHandler, DefaultAssetTypeLoadHandler, ImageAsset, MaterialInstanceAsset, }; use rafx::distill::loader::handle::Handle; use rafx...
31.94152
99
0.601611
8ff35d8ddf10fc8e68421eb7429c298af0a2b408
357
// run-pass #![feature(generators)] fn main() { static || { loop { // Test that `opt` is not live across the yield, even when borrowed in a loop // See https://github.com/rust-lang/rust/issues/52792 let opt = { yield; true }; ...
19.833333
89
0.434174
4bbf25cbe553a32fda745690f12d2d5809198818
7,389
use luminance::context::GraphicsContext; use luminance::framebuffer::{DepthSlot, Framebuffer}; use luminance::pipeline::PipelineState; use luminance::pixel::{Depth32F, Pixel}; use luminance::texture::{Dim2, Texture}; use luminance_glfw::{ Action, CursorMode, GlfwSurface, Key, Surface as _, WindowDim, WindowEvent, Win...
25.926316
155
0.608472
01e988c1822ca6b2e989c6ac75e417094b21c256
14,606
//! Utility functions for working with Cap'n Proto Raft messages. #![allow(dead_code)] use std::net::SocketAddr; use std::rc::Rc; use std::collections::HashMap; use capnp::message::{Builder, HeapAllocator}; use {ClientId, Term, LogIndex, ServerId, LogId, TransactionId}; use messages_capnp::{client_request, client_re...
35.026379
99
0.589895
bb223b782938c4e6d232cb467f3795e8c0a8921d
4,146
use std::ffi::CString; use std::ops::Deref; use super::{Ass, Bitmap, Flags, Text, Type}; use crate::ffi::*; use libc::c_int; pub enum RectMut<'a> { None(*mut AVSubtitleRect), Bitmap(BitmapMut<'a>), Text(TextMut<'a>), Ass(AssMut<'a>), } impl<'a> RectMut<'a> { pub unsafe fn wrap(ptr: *mut AVSubtitl...
23.033333
66
0.51206
9be1374f85d99af66d4c126e0e9034b2f3793525
883
#![feature(const_raw_ptr_to_usize_cast, const_compare_raw_pointers, const_raw_ptr_deref)] fn main() {} // unconst and bad, will thus error in miri const X: bool = unsafe { &1 as *const i32 == &2 as *const i32 }; //~ ERROR any use of this // unconst and bad, will thus error in miri const X2: bool = unsafe { 42 as *con...
49.055556
91
0.672707
21def2b705c2414d70b4546e3ad4c7837da09abb
184
#[cfg(target_os = "macos")] mod macos; #[cfg(target_os = "macos")] pub use macos::Sudo; #[cfg(target_os = "windows")] mod windows; #[cfg(target_os="windows")] pub use windows::Sudo;
16.727273
29
0.663043
bfb6786fdd2449a22a7983619e8924b74b43bf0c
3,580
#pragma version(1) #pragma rs java_package_name(layers) rs_allocation In_Blob; rs_allocation Kernel_Blob; rs_allocation Bias_Blob; rs_allocation Out_Alloc; int c_i; int h_i; int w_i; int n_k; int c_k; int h_k; int w_k; int h_o; int w_o; int pad_x; int pad_y; int stride_x; int stride_y; int group; void root(float4* ou...
33.457944
121
0.554469
c1d3a1fff312c37328686466e33eb147d062d0e8
2,451
use std::convert::TryInto; use crate::{ board::{CastleRight, Chess}, Color::*, {Piece, PieceType::*} }; use anyhow::{bail, Result}; pub fn parse(fen: &str) -> Result<Chess> { let mut chess = Chess { board: [None; 64], white_castle: CastleRight::new(), black_castle: CastleRight:...
31.831169
68
0.478172
fe5cc31e6df453f96ef45d01ebf38a722aac45e6
1,101
#![allow(warnings)] // NOT RECOMMENDED // #[derive(Debug)] // enum Color { // Red, // Green, // Blue, // } #[derive(Debug)] enum Color { Red=0xff0000, Green=0x00ff00, Blue=0x0000ff, } enum Message { Quit, Move { x: i32, y: i32 }, Write(String), ChangeColor(Color), } type Msg =...
23.425532
73
0.526794
deaaf52879545b035521fd18f4d282a329dc2fb2
1,242
use std::collections::VecDeque; // 55. Jump Game, Medium // https://leetcode.com/problems/jump-game/ impl Solution { pub fn can_jump(mut nums: Vec<i32>) -> bool { let n = nums.len() - 1; let mut pos: VecDeque<usize> = VecDeque::new(); pos.push_back(0); while !pos.is_empty() && pos....
23
72
0.504831
e63dd1a8a87d376b3f8ee5f0c3b0c37e77014a45
3,892
//! A crate for using the Kamar api to fetch notices //! //! # Sample usage //! ```rust //! use kni_rs::Portal; //! //! #[tokio::main] //! async fn main() { //! let portal = Portal::new("https://demo.school.kiwi/api/api.php"); //! let notices = portal.get_notices_today().await.unwrap(); //! println!("{:?}",...
33.551724
107
0.584018
89a8934db5d2a7d4eb701811befcad7e2a820acc
465
//! test deriving on various struct types use keypath::Keyable; #[derive(Keyable)] struct PlainStruct; #[derive(Keyable)] struct EmptyTupleStruct(); #[derive(Keyable)] struct SingleTupleStruct(bool); #[derive(Keyable)] struct MultiTupleStruct(bool, i64, String); #[derive(Keyable)] struct EmptyFieldStruct {} #[de...
15
43
0.707527
219af4d9791017e017175c2def048f38f2b5162e
1,658
pub struct IconSdCard { props: crate::Props, } impl yew::Component for IconSdCard { type Properties = crate::Props; type Message = (); fn create(props: Self::Properties, _: yew::prelude::ComponentLink<Self>) -> Self { Self { props } } fn update(&mut self, _: Self::Message) -> yew::pre...
36.043478
471
0.57117
6414ce24255564faa13830e3e6a3192e38c80731
2,071
use crate::lookup_value; use serde::{Deserialize, Serialize}; use std::borrow::Cow; use std::fmt; /// A vaccination entry. /// /// It provides all the necessary detail regarding a vaccination record. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] pub struct Vaccination { /// Targeted Disease or agent ...
32.359375
94
0.63351
90b2da11e0424dab5464aa26ed8473ad5028079d
11,894
use std::borrow::Cow; use std::collections::HashMap; use std::io; use std::io::prelude::*; use crate::lang::surface::{ Constant, ItemData, Module, Pattern, PatternData, StructType, Term, TermData, }; use crate::pass::surface_to_pretty::Prec; pub struct Context { items: HashMap<String, ItemMeta>, locals: V...
32.408719
114
0.445855
4ad729f1bc60a114b34bcb591d9a33d321582223
680
// 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 ...
25.185185
68
0.673529
560ea09b057f50ad7ae9887e16ff2119218a8de2
85
mod example; mod v0; pub use example::ExampleResolver; pub use v0::V0PriceResolver;
14.166667
33
0.776471
bf4c9de7416208b0780e0337e896e80667f1084a
198
mod backend; mod types; pub use self::backend::Backend; pub use self::types::{ AddressBook, AddressBookBackend, Contact, DEFAULT_GRINBOX_PORT, DEFAULT_MWCMQS_PORT, DEFAULT_MWCMQS_DOMAIN, };
24.75
69
0.772727
f740259649aa0317893564986a7ac9c1d41d9cd4
719
use serde_derive::{Deserialize, Serialize}; use config::Config; #[derive(Debug, Serialize, Deserialize)] #[serde(default)] pub struct Settings { pub db_host: String, } impl Default for Settings { fn default() -> Self { Self { db_host: String::from("default"), } } } #[test] fn...
21.787879
82
0.64395
4a027ebf5f26137b1e8081258502c4923fd90599
4,348
use combine::{ Parser, Stream, error::ParseError, parser, token, look_ahead, optional, choice }; use crate::parser::*; use crate::glyph_class::*; use super::value_record::*; use super::glyph_class::*; use super::lookup::*; use super::util::*; #[derive(Debug)] pub struct GlyphPatter...
28.233766
94
0.466421
69941d088b8ce00c9986615b75240807e7167380
43,957
// Copyright 2020-2021, The Tremor Team // // 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...
36.328099
115
0.525445
b99ff56129cbd8cbda1eb03920506a88c9cb59f8
8,560
// 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 according to those terms. use crate::lexer::preproc...
45.775401
105
0.536565
edab160e68f9cff7638b5bed706b334d2094d1b3
5,518
use amethyst::winit::VirtualKeyCode; use derivative::Derivative; use serde::{Deserialize, Serialize}; /// Keyboard layout variants. #[derive(Clone, Copy, Debug, Derivative, Deserialize, Hash, PartialEq, Eq, Serialize)] #[derivative(Default)] #[serde(deny_unknown_fields, rename_all = "snake_case")] pub enum KeyboardLay...
39.697842
96
0.455781
bba45c4eb40a60df9c2e1f7c48bd652edb460213
21,150
//#![allow(unused_imports)] // Last edit: 00:30 - 21/11/2021 use teloxide::{prelude::*, types::{ChatPermissions, Me}, utils::command::BotCommand}; //use teloxide::utils::command::ParseError; use std::env; use std::error::Error; use std::str; use std::str::FromStr; use std::process::Command; use chrono::{DateTime, Dura...
37.170475
190
0.440804
38327e4e38a2740013683f2c2022d2199bf0c90c
26,865
// * This file is part of the uutils coreutils package. // * // * (c) Dorota Kapturkiewicz <dokaptur@gmail.com> // * // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. // spell-checker:ignore (ToDOs) corasick memchr Roff trunc oset i...
34.486521
135
0.569514
e403451ee67e1cf249358b8b1efc734325454665
5,948
#[doc = r" Value read from the register"] pub struct R { bits: u16, } #[doc = r" Value to write to the register"] pub struct W { bits: u16, } impl super::UCB0IE { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w mu...
24.887029
59
0.505548
116ca6ce18881dfc1346110e1e58f180b0777b78
33,944
// This file is part of Substrate. // Copyright (C) 2018-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...
39.700585
117
0.711083
9c865a1b0d59817f13d996decb5bfa8b2fa92e1c
19,234
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::loaded_data::{struct_def::StructDef, types::Type}; use std::{ cell::{Ref, RefCell}, ops::Add, rc::Rc, }; use types::{ access_path::AccessPath, account_address::{AccountAddress, ADDRESS_LENGTH}, byte_a...
30.100156
99
0.549704
290d1c032a5b2fa2bc0c2324059b458a74554339
11,104
// Copyright (c) The XPeer Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::proof::{ definition::bitmap::{AccumulatorBitmap, SparseMerkleBitmap}, AccountStateProof, AccumulatorProof, EventProof, SignedTransactionProof, SparseMerkleProof, }; use crypto::{ hash::{TestOnlyHash, ACCUMULATOR_...
33.546828
110
0.668498
482ee9366c74b980112dc319b17ed01b9ad27739
20,728
// This file is generated by rust-protobuf 2.20.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...
34.261157
136
0.592532
e6aa745d54e9d8c8d625a164437c67e84730c792
4,381
// 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 ...
44.252525
92
0.614928
0e35500027ccd9baa06a0f4154fc5a8dae225912
37,307
//! Conversion of rust-analyzer specific types to lsp_types equivalents. use std::{ path::{self, Path}, sync::atomic::{AtomicU32, Ordering}, }; use ide::{ Assist, AssistKind, CallInfo, CompletionItem, CompletionItemKind, Documentation, FileId, FileRange, FileSystemEdit, Fold, FoldKind, Highlight, HlMod...
38.620083
130
0.61664
8a67e0eb66e09a139d1f0839e6f760d265f5006f
7,004
//! Entity is an abstraction over Profiles and Vaults, easing the use of these primitives in //! authentication and authorization APIs. #![deny(unsafe_code)] #![warn( // prevented by big_array // missing_docs, trivial_casts, trivial_numeric_casts, unused_import_braces, unused_qualifications )] ...
28.356275
98
0.636922
286f73aed8d829281f7b5a3e37f6b0576a59fa75
5,690
use super::task::Task; use rand::{Rng, thread_rng, distributions::Alphanumeric}; use rocket::local::asynchronous::Client; use rocket::http::{Status, ContentType}; // We use a lock to synchronize between tests so DB operations don't collide. // For now. In the future, we'll have a nice way to run each test in a DB //...
33.869048
92
0.574517
d75295a75ff28a3eb691fad3c387fe00cd0a86ca
4,510
use crate::*; use ic_crypto_internal_hmac::{Hmac, Sha512}; use ic_types::PrincipalId; #[derive(Debug, Clone)] pub enum DerivationIndex { U32(u32), Generalized(Vec<u8>), } impl DerivationIndex { /// Return the BIP32 "next" derivation path /// /// This is only used very rarely. The +1 behavior for u...
33.656716
98
0.595344
d74b3ceabc98ff9799f1431c2794acf97754fce5
1,486
extern crate wasmparser; use std::env; use std::fs::File; use std::io; use std::io::prelude::*; use std::str; use wasmparser::Parser; use wasmparser::ParserState; use wasmparser::WasmDecoder; fn main() { let args = env::args().collect::<Vec<_>>(); if args.len() != 2 { println!("Usage: {} in.wasm", arg...
26.070175
87
0.438762
cc84bbb25c75cfb07e947332b0bb348a9788b1f5
354
use crate::args::{Identifier, LoggingArgs, StreamFilter}; use crate::args::output::OutputArgs; #[derive(clap::Clap)] pub struct CheckArgs { #[clap(flatten)] pub identifier: Identifier, #[clap(flatten)] pub stream_filter: StreamFilter, #[clap(flatten)] pub logging: LoggingArgs, #[clap(flatte...
23.6
57
0.677966
5bba78c44d9ead7bb48dab4773e5e7e5421cf94a
1,232
use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct DestinationTableProperties { /// [Optional] The description for the destination table. This will only be used if the destination table is newly created. If the table already exists and a valu...
77
286
0.755682
2fa1c312bc7579ea3ba9d78b23ee04a7166c45e1
6,841
//! Access secure credentials at runtime with multiple backends. //! //! For more information, see [the //! homepage](https://github.com/emk/credentials). //! //! ``` //! use credentials; //! use std::env; //! //! env::set_var("PASSWORD", "secret"); //! assert_eq!("secret", credentials::var("PASSWORD").unwrap()); //! `...
30.954751
75
0.630463
72c0379d47642464a03150455370ed85a26d1fca
35,801
#![allow(clippy::type_complexity)] #![allow(clippy::cognitive_complexity)] use super::methods::{ErrorMessage, RPCErrorResponse, RequestId, ResponseTermination}; use super::protocol::{RPCError, RPCProtocol, RPCRequest}; use super::RPCEvent; use crate::rpc::protocol::{InboundFramed, OutboundFramed}; use core::marker::Ph...
46.075933
141
0.50236
233bf51ec06bef4f56550b5a7b581355a9b85976
6,561
//! Completes lifetimes and labels. //! //! These completions work a bit differently in that they are only shown when what the user types //! has a `'` preceding it, as our fake syntax tree is invalid otherwise (due to us not inserting //! a lifetime but an ident for obvious reasons). //! Due to this all the tests for ...
20.439252
99
0.445511
e28fc67718f75db04f9385804e7ce6fa79bcc2b0
7,686
mod ffg_updates; mod no_votes; mod votes; use crate::proto_array_fork_choice::{Block, ExecutionStatus, ProtoArrayForkChoice}; use serde_derive::{Deserialize, Serialize}; use types::{AttestationShufflingId, Checkpoint, Epoch, EthSpec, Hash256, MainnetEthSpec, Slot}; pub use ffg_updates::*; pub use no_votes::*; pub use...
35.915888
96
0.476711
fbeaf94b20c0ea8397c8435a6ad321ddf0890d6e
7,185
use crate::{expr::*, types::*}; pub trait OrderedStatement { #[doc(hidden)] // Implementation for the trait. fn add_order_by(&mut self, order: OrderExpr) -> &mut Self; /// Order by column. /// /// # Examples /// /// Order by ASC and DESC /// ``` /// use sea_query::{*, tests_cfg...
29.446721
141
0.470424
4aabbe7efbef456866710ed954d93109d96d219d
95,310
use crate::pp::Breaks::{Consistent, Inconsistent}; use crate::pp::{self, Breaks}; use rustc_ast::ast::{self, BlockCheckMode, PatKind, RangeEnd, RangeSyntax}; use rustc_ast::ast::{Attribute, GenericArg, MacArgs}; use rustc_ast::ast::{GenericBound, SelfKind, TraitBoundModifier}; use rustc_ast::attr; use rustc_ast::ptr::...
35.23475
100
0.488039
231f2ae36b049835947932d3390833c05d20b96c
6,069
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT use crate::{ helpers::{ framework::{infer_from_package_json as infer_framework, Framework}, resolve_tauri_path, template, Logger, }, VersionMetadata, }; use std::{ ...
28.227907
145
0.625803
ab6b6b0d7a39ec592c2f7b8508fd459e354f1460
805
use ethers_core::types::{Address, Chain}; use std::env::VarError; #[derive(Debug, thiserror::Error)] pub enum EtherscanError { #[error("chain {0} not supported")] ChainNotSupported(Chain), #[error("contract execution call failed: {0}")] ExecutionFailed(String), #[error("balance failed")] Balanc...
29.814815
54
0.664596
1c667ebcf37ce6133eb73c1acaa3f906b4db8ffd
2,113
use crate::Data; use std::{error::Error, io::Cursor}; use miniserde::json; use tiny_http::{Header, Method, Response, Server, StatusCode}; const INDEX_HTML: &str = include_str!(env!("INDEX_HTML")); const INDEX_JS: &str = include_str!(env!("INDEX_JS")); fn cors_headers() -> Vec<Header> { use std::str::FromStr; ...
32.015152
100
0.553715
16a8010177b4c4c1463fec73ce6449b87b7b1fb4
1,101
//! Player playing random actions #![allow(dead_code)] extern crate rand; use self::rand::{Rng, ThreadRng}; use super::Player; use super::super::field::Field; pub struct PlayerRandom { initialized: bool, pid: i32, //player ID rng: Box<ThreadRng>, } impl PlayerRandom { pub fn new() -> Box<PlayerRandom> { Box...
15.728571
90
0.632153
c18695bf7cdc9cec32931420a45b8eeb0cacc903
751
use futures::StreamExt; use tracing::Level; use tracing_subscriber::FmtSubscriber; #[tokio::main] async fn main() -> Result<(), failure::Error> { // Setup logging to the console let subscriber = FmtSubscriber::builder() .with_max_level(Level::TRACE) .finish(); tracing::subscriber::set_globa...
25.033333
71
0.591212
e633e438b77e2120e2da8482d6977fc0f289fe78
3,680
use yew::prelude::*; use yew::{html, Component, ComponentLink, Html, ShouldRender}; use gba_emulator::gba::GBA; use gba_emulator::cpu::cpu::{InstructionSet, OperatingMode}; use std::rc::Rc; use std::cell::RefCell; pub struct Status { props: StatusProp, link: ComponentLink<Self> } #[derive(Properties, Clone)] ...
45.432099
183
0.582609
4b93904c349bb8150876dcd21263a60b2afbdfa5
15,252
#[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::EP1R { #[doc = r" Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, ...
26.161235
65
0.507015
ff274442214730c27610b0e4a23b7b0063a40fad
6,969
use core::{mem, slice}; use crate::data::*; use crate::error::*; use crate::flag::*; use crate::number::*; pub trait SchemeMut { fn handle(&mut self, packet: &mut Packet) { let res = match packet.a { SYS_OPEN => self.open(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packe...
36.486911
144
0.562348
e92566891277e8bdee9545a2ca4dd6f2ffab278a
185
mod config; mod context; mod generator; pub mod utils; pub use generator::generate_from_path; pub use config::Config; pub use context::Context; use crate::renderer::render_to_files;
15.416667
38
0.778378
48695ce40c8616f30157e15e4e13ec239723fdb8
957
// 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 Box; use Buildable; use Container; use FontChooser; use Orientable; use Widget; use ffi; use glib::object::Downcast; use glib::translate::*; use glib_ffi; use...
23.341463
160
0.684431
18197e604ddc61fea5a7b2f28651dc25f29221cc
3,184
#[doc = "Register `se_aes_0_key_6` reader"] pub struct R(crate::R<SE_AES_0_KEY_6_SPEC>); impl core::ops::Deref for R { type Target = crate::R<SE_AES_0_KEY_6_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<SE_AES_0_KEY_6_SPEC>> for R { #[inline(alway...
30.615385
410
0.627513
9c081eff888da5e88ba56ded5e3cc3c0f2ec5343
322
#![no_main] use libfuzzer_sys::fuzz_target; use wasm_smith::Module; use wasmtime::Strategy; use wasmtime_fuzzing::oracles; fuzz_target!(|module: Module| { let mut module = module; module.ensure_termination(1000); let wasm_bytes = module.to_bytes(); oracles::instantiate(&wasm_bytes, Strategy::Auto); })...
23
54
0.726708
d5b618663dc631cd50daa98c2f9503edcef2b923
48,379
use crate::io::{Interest, PollEvented, ReadBuf, Ready}; use crate::net::unix::SocketAddr; use std::convert::TryFrom; use std::fmt; use std::io; use std::net::Shutdown; use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; use std::os::unix::net; use std::path::Path; use std::task::{Context, Poll}; cfg_io_uti...
33.997892
102
0.505033
db32a35fc7894ca61ca318ac4e89a81acaa771c9
844
use bevy::prelude::*; use bevy_mod_picking::{PickingCamera, PickingPlugin}; use board::BoardPlugin; use camera::CameraPlugin; use pieces::PiecesPlugin; use ui::UIPlugin; mod board; mod camera; mod pieces; mod ui; fn main() { App::build() // Set antialiasing to use 4 samples .insert_resource(Msaa {...
25.575758
65
0.617299
4a93f93533a6611c19c4564c07a6fc87c69cae58
8,305
//! A simple example demonstrating how one might implement a custom //! subscriber. //! //! This subscriber implements a tree-structured logger similar to //! the "compact" formatter in [`slog-term`]. The demo mimicks the //! example output in the screenshot in the [`slog` README]. //! //! Note that this logger isn't r...
28.248299
88
0.510777
0e4872d7c2f00a97ea6472f254954929ca6cd005
171
use crate::serde::serializable_enum; serializable_enum! { pub enum LiquidType: u8 { None = 0, Water = 1, Lava = 2, Honey = 3, } }
15.545455
36
0.51462
28579b42d82a58377ab7ddaf942abc1078e810be
355
extern crate noise; use noise::{utils::*, Blend, Fbm, Perlin, RidgedMulti}; fn main() { let perlin = Perlin::default(); let ridged = RidgedMulti::<Perlin>::default(); let fbm = Fbm::<Perlin>::default(); let blend = Blend::new(perlin, ridged, fbm); PlaneMapBuilder::new(blend) .build() ...
23.666667
55
0.611268
f4ecc47f8fed1885514dd8880c64cd09177b243b
1,040
use crate::ShardManagerContainer; use log::{error, info}; use serenity::client::Context; use serenity::framework::standard::macros::command; use serenity::framework::standard::CommandResult; use serenity::model::prelude::Message; #[command] #[owners_only] #[description = "Gracefully shutdowns the bot."] pub fn shutd...
28.888889
94
0.639423
bbe05bbdac186952e94f27919e5f468fd2fb757c
54,034
#![allow(non_snake_case)] extern crate ndarray; extern crate defmac; extern crate itertools; use ndarray::{Slice, SliceInfo, SliceOrIndex}; use ndarray::prelude::*; use ndarray::{ rcarr2, arr3, multislice, }; use ndarray::indices; use defmac::defmac; use itertools::{enumerate, zip}; macro_rules! assert_p...
28.529039
107
0.482752
22e6e9010757a0a7a018d15001f85e481e4de32a
289
use crate::ecs::*; use shrinkwraprs::Shrinkwrap; #[derive(Shrinkwrap, Debug, Copy, Clone, Eq, PartialEq)] #[shrinkwrap(mutable)] pub struct Parent(pub Entity); #[derive(Shrinkwrap, Debug, Copy, Clone, Eq, PartialEq)] #[shrinkwrap(mutable)] pub struct PreviousParent(pub Option<Entity>);
26.272727
56
0.740484
d60059ffac452add8f7480af51cf9c6daecd429c
2,123
mod agents; mod post; mod text_input; use agents::posts::{PostId, PostStore, Request}; use post::Post; use text_input::TextInput; use weblog::console_log; use yew::prelude::*; use yew_agent::utils::store::{Bridgeable, ReadOnly, StoreWrapper}; use yew_agent::Bridge; pub enum Msg { CreatePost(String), PostStore...
26.873418
94
0.523787
9b5f311cf29808d5911518886bd097ea308ab769
795
use core::num::Wrapping; pub(crate) const RNG: XorShiftRng = XorShiftRng { x: Wrapping(0x0787_3B4A), y: Wrapping(0xFAAB_8FFE), z: Wrapping(0x1745_980F), w: Wrapping(0xB0AD_B4F3), }; pub(crate) struct XorShiftRng { x: Wrapping<u32>, y: Wrapping<u32>, z: Wrapping<u32>, w: Wrapping<u32>, ...
22.714286
66
0.533333
23af470c5e99bac21eab2bef7991e14c719de873
107,394
#![doc = "generated by AutoRust 0.1.0"] #![allow(non_camel_case_types)] #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DatabaseAccountsListResult { #[serde(default, skip_serializing_if = "Vec::is_empty")] pub value: Vec<Databa...
45.123529
113
0.727955
4ab2ca3f68a68cee0caa0e4cebda77118f39c39e
1,133
use crate::client_settings::ClientSettings; impl ClientSettings { /// Passes a user configured reqwest client for the Google Maps client to /// use. This allows the you to have more control over the how the Google /// Maps client connects to the Google Maps server. /// /// [Mause](https://github.c...
30.621622
78
0.597529
1dcf1cb11ffcc17e14670fa1064c1d7b85a34fb8
32
pub mod basics; pub mod grid2d;
16
16
0.75