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
ef6db47ade0c272eb5c5d1e5e6d32c7146a4cd84
8,713
// SPDX-License-Identifier: MIT // Copyright (C) 2018-present iced project and contributors //! iced-x86 JavaScript bindings #![allow(unknown_lints)] #![warn(absolute_paths_not_starting_with_crate)] #![warn(anonymous_parameters)] #![warn(elided_lifetimes_in_paths)] #![warn(explicit_outlives_requirements)] #![warn(inv...
33.902724
126
0.693447
28b0fc496fe85e3e897e6906178cd7a17c8b51bc
5,901
use crate::error::RPCError; use ckb_dao::DaoCalculator; use ckb_fee_estimator::MAX_CONFIRM_BLOCKS; use ckb_jsonrpc_types::{ Capacity, DryRunResult, EstimateResult, OutPoint, Script, Transaction, Uint64, }; use ckb_logger::error; use ckb_shared::{shared::Shared, Snapshot}; use ckb_store::ChainStore; use ckb_types::{...
36.202454
99
0.606338
e2c816bb84df6c0dbbb6f224b30da9efb90d35cd
50,636
// 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...
40.411812
98
0.599771
67bf8791692142c6d14e5f9c4c2e8ed4a70f6c0b
5,318
#![deny(missing_docs)] //! Holochain utilities for websocket serving and connecting. //! //! To establish an outgoing connection, use [`connect`] //! which will return a tuple //! ([`WebsocketSender`], [`WebsocketReceiver`]) //! //! To open a listening socket, use [`WebsocketListener::bind`] //! which will give you a ...
31.844311
97
0.604551
01312181a96bbec4f9fb5425949919794a2ea309
487
use crate::beam::{Beam, BeamIntersect}; pub struct BeamIter { beam: Beam, } impl Beam { const fn iter(self) -> BeamIter { BeamIter { beam: self } } } impl Iterator for BeamIter { type Item = BeamIntersect; fn next(&mut self) -> Option<Self::Item> { self.beam.next_intersect() ...
16.793103
46
0.601643
16b95cfc61f09791850a4ad6ba274de440d99d3c
26
pub mod vm; pub mod stack;
13
14
0.730769
262de24b609817f8ef68f282340c2fae6be83755
15,249
#![deny(missing_docs)] //! A search API for piston_meta extern crate piston_meta; use std::sync::Arc; use piston_meta::{ MetaData, ParseError, Range }; /// Used to search through meta data. pub struct Search<'a> { /// The previous range of search. /// Used in errors if there is no meta data left. pub ra...
33.15
87
0.43793
e6c88341bd610093e212f9087ae5a075b741a4ed
17,715
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ //! Garbage-collected Storage structures for AST nodes. use crate::{Node, Path, SourceManager, Visitor}; use juno_support::atom_...
30.91623
100
0.556026
ebb9ef4116f27fcca12f0471147be32ed1369e6f
165
pub mod image; mod process; pub mod resolution; pub mod server; pub use process::start_lol; pub use process::Process; mod lol_config; pub use lol_config::LolConfig;
18.333333
30
0.781818
03d993096663b8a6b5bcf6e4e819cb5aaaf6d281
1,438
// Copyright (c) The cargo-guppy Contributors // SPDX-License-Identifier: MIT OR Apache-2.0 //! Print out crates in a workspace in topological order. //! //! The into_iter_ids and into_iter_metadatas iterators return packages in topological order. Note //! that into_iter_links returns links in "link order" -- see its ...
43.575758
99
0.710709
c1506bf4724e5471b88dfd6e6980a5f9af8c6260
926
/* * YNAB API Endpoints * * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com * * The ve...
28.9375
279
0.700864
2f24e8a5487666c22f06024e311612888bf2e4c7
4,057
use core::marker::PhantomData; use spin::{Mutex, MutexGuard}; pub mod x86_io { /// Read a single byte from the port. pub unsafe fn inb(port: u16) -> u8 { let result: u8; asm!("inb %dx, %al" : "={al}"(result) : "{dx}"(port) :: "volatile"); result } /// Write a single ...
28.370629
96
0.539068
0e551ac964795c0f909496db4ddeaa73f462c490
11,014
extern crate hamcrest; extern crate cargo; use std::collections::HashMap; use hamcrest::{assert_that, equal_to, contains}; use cargo::core::source::{SourceId, GitReference}; use cargo::core::dependency::Kind::{self, Development}; use cargo::core::{Dependency, PackageId, Summary, Registry}; use cargo::util::{CargoRes...
29.370667
76
0.498184
d9e83550b8eaeebfc2bc2ff62a4d3c823f9f9416
28,990
//#![crate_name = "doc"] use plexrbac::persistence::models::*; use plexrbac::common::Constants; use chrono::{NaiveDateTime, Utc}; use std::collections::HashMap; ////////////////////////////////////////////////////////////////////////////////////////////// /// /// This module defines common domain model /// //////////...
36.836086
208
0.613901
01f137e377515759c8c390f6c85c4a3ba3093d72
41,826
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. #[allow(missing_docs)] // documentation missing in model #[non_exhaustive] pub struct StartStreamTranscriptionOutput { /// <p>An identifier for the streaming transcription.</p> pub request_id: std::option::Option<std::string::Strin...
47.31448
243
0.620786
f8b11c8918c234c1bcebde943e013a6be8d84349
8,354
#[macro_use] extern crate lazy_static; mod cfglib; mod services; mod utils; use parking_lot::RwLock; use cfglib::*; use utils::PatternsCache; use actix_web::{ HttpServer, App }; use simple_logger::SimpleLogger; use clap::{ArgMatches, Arg}; fn arg_matches<'a>() -> ArgMatches<'a> { let about = format!("F...
36.480349
143
0.559492
4a355b6904f4aab1fed3542ab30fb584f1900f7c
16,084
//! Utilities for handling characters in the Unicode "Halfwidth and Fullwidth Forms" block. use std::mem::transmute; /// Checks if `ch` is in the Unicode "Halfwidth and Fullwidth Forms" block. /// /// # Example /// ```rust /// assert_eq!(unicode_hfwidth::is_nonstandard_width('カ'), false); /// assert_eq!(unicode_hfwid...
44.430939
91
0.565096
16de20f65929f6a733fb68e39d54261b1ae3a7be
6,631
// Generated from definition io.k8s.api.core.v1.StorageOSVolumeSource /// Represents a StorageOS persistent volume resource. #[derive(Clone, Debug, Default, PartialEq)] pub struct StorageOSVolumeSource { /// Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xf...
47.028369
438
0.565526
bb9a4eccc28425e022b7674e15f5f1d29d245830
5,021
use std::marker::PhantomData; use std::rc::Rc; use super::result::PgResult; use super::row::PgRow; use super::PgConnection; /// The type returned by various [`Connection`] methods. /// Acts as an iterator over `T`. #[allow(missing_debug_implementations)] pub struct Cursor<'a> { current_row: usize, db_result: ...
28.207865
94
0.571201
bb8c5f175b8c0cb9304c455217a36b495c4ff148
47,991
//! # The MIR Visitor //! //! ## Overview //! //! There are two visitors, one for immutable and one for mutable references, //! but both are generated by the following macro. The code is written according //! to the following conventions: //! //! - introduce a `visit_foo` and a `super_foo` method for every MIR type //!...
38.088095
99
0.435915
5bbbbbe1e090314ea83b94a0fcc95897ed10475e
1,676
use std::path::Path; use anyhow::Result; use parser::{ parse::{Encoding, StandardEncoder, UnsignedLEB128Encoder}, types::metadata::shared::BufferSpec, }; use crate::parse_rows; pub fn load_component_data_with_serde<T>( part_files: &[String], buffer_spec: &BufferSpec, path: &Path, ) -> Result<Vec...
23.942857
93
0.551909
8f874c5a4cc5a8d0ecd2326fa1211d3f427b5326
4,196
use super::*; macro_rules! yield_from { ($x: expr) => { for e in $x { yield e } }; } pub fn smart_insert<S: Stack<N>>(mut stack: S) -> impl Iterator<Item = Instruction> { use self::Instruction::*; IterGen(move || { let mut side_stack = S::default(); while stack.len() > 0 { le...
36.172414
101
0.465682
1606dc413fb56527d0d947acb192f896e9a73747
7,155
//! Serde Integration for InfluxDB. Provides deserialization of query returns. //! //! When querying multiple series in the same query (e.g. with a regex query), it might be desirable to flat map //! the resulting series into a single `Vec` like so. The example assumes, that there are weather readings in multiple //! s...
36.136364
118
0.519776
e45dec890d079840e1430a19cb8c4aa971cc9beb
2,863
// Copyright 2021 Vector 35 Inc. // // 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 w...
28.63
82
0.495983
ab38cd4a550d2c8f9ddc84a2f5ddab1fe529a63f
3,166
#![cfg_attr( not(any(feature = "vulkan", feature = "metal",)), allow(dead_code, unused_extern_crates, unused_imports) )] use std::sync::{Arc, RwLock}; use env_logger; #[cfg(not(any(feature = "vulkan", feature = "metal",)))] use gfx_backend_empty as back; #[cfg(feature = "metal")] use gfx_backend_metal as back...
35.573034
97
0.583386
ebc688ec55ca726015053f1a58e470c77c08de46
3,242
//! Pack card definitions use super::*; use crate::math::SafeMath; use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::{ msg, program_error::ProgramError, program_pack::{IsInitialized, Pack, Sealed}, pubkey::Pubkey, }; /// Pack card #[repr(C)] #[derive(Debug, Clone, PartialEq, BorshSeri...
27.243697
90
0.645589
56f5144db571caac40dfd56ff3dd085d1e7bebc1
5,598
use actix_web::HttpMessage; use diesel; use diesel::prelude::*; use serde_json; use abac::prelude::*; use abac::schema::*; use iam::models::{Account, Namespace}; use shared::db::{create_account, create_namespace, AccountKind, NamespaceKind}; use shared::{self, IAM_NAMESPACE_ID}; #[must_use] fn before_each(conn: &PgC...
30.928177
96
0.483387
b9442b9cf443c803bcea00a67e27c6bb780ce7fa
7,135
#![no_std] #![no_main] use core::ops::Range; use serde::{Deserialize, Serialize}; use icecap_start_generic::declare_generic_main; use icecap_core::config::*; use icecap_core::prelude::*; use icecap_core::ring_buffer::{BufferedRingBuffer, RingBuffer}; use virtio_drivers::VirtIOConsole; use virtio_drivers::VirtIOHead...
32.285068
136
0.604205
1d780c77a47fe66e41845b649aedc1437930478b
4,716
// Copyright 2016 Mozilla Foundation // // 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...
27.905325
111
0.592875
2628a99a53a34366dd35af511a691da123e0e5f0
6,497
use std::collections::HashMap; use std::fs::File; use std::io::Read; use std::path::Path; use crate::{SendgridError, SendgridResult}; macro_rules! add_field { // Create a setter that appends. ( $(#[$outer:meta])* $method:ident << $field:ident: $ty:ty ) => { $(#[$outer])* pub...
29.940092
100
0.567801
569afe653394e29b4308be6169b3e918036c3449
3,702
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use super::{balance_ap, encode_mint_transaction, encode_transfer_transaction, seqnum_ap, MockVM}; use config::config::VMConfig; use failure::Result; use state_view::StateView; use types::{ access_path::AccessPath, account_addre...
25.888112
97
0.529984
14d9a06ef625ef6dec2c12922b56b4d07e315e5b
5,528
use instruction_def::*; use test::run_test; use Operand::*; use Reg::*; use RegScale::*; use RegType::*; use {BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; #[test] fn vmovlpd_1() { run_test( &Instruction { mnemonic: Mnemonic::VMOVLPD, ope...
25.013575
95
0.445188
fcdf0712f04f87a3f0be0c282d8093f6ddb3a882
3,367
use super::{operate, PathSubcommandArguments}; use crate::prelude::*; use nu_engine::WholeStreamCommand; use nu_errors::ShellError; use nu_protocol::{ColumnPath, Signature, SyntaxShape, UntaggedValue, Value}; use nu_source::Tagged; use std::path::Path; pub struct PathBasename; struct PathBasenameArguments { rest:...
29.79646
91
0.550936
08f2c4f697273af0fbaa3ff5d182cd059b61e782
2,602
use crate::relayer::block_proposal_process::{BlockProposalProcess, Status}; use crate::relayer::tests::helper::{build_chain, new_transaction}; use ckb_network::PeerIndex; use ckb_types::packed::{self, ProposalShortId}; use ckb_types::prelude::*; #[test] fn test_no_unknown() { let (relayer, always_success_out_point...
32.123457
87
0.667179
9165beed564563590d4f4d95a5a7ec14f9d58c1b
4,179
use std::cmp::Ordering; use hibitset::BitSet; use amethyst_core::{ nalgebra::{Point3, Vector3}, specs::prelude::{Entities, Entity, Join, Read, ReadStorage, System, Write}, GlobalTransform, }; use crate::{ cam::{ActiveCamera, Camera}, hidden::{Hidden, HiddenPropagate}, transparent::Transparent...
33.432
111
0.611151
2f8aae3e3f392662e02816d3fece28749c1d1dc9
1,785
#[derive(Debug)] pub struct BootRecord { version: u8, system_identifier: String, boot_identifier: String, system_use: Vec<u8>, } impl BootRecord { pub fn parse<'a>(bytes: &[u8]) -> ::error::Result<Self> { match parser::boot_record(bytes) { Ok((_, record)) => Ok(record), ...
31.875
77
0.446499
6747917515a2c6ac30c9446072fdba5960af5db0
749
use crate::framework::types::Vec2I; pub trait RendererTrait { fn load_textures(&mut self, base_path: &str, filenames: &[&str]); fn load_sprite_sheet(&mut self, filename: &str); fn clear(&mut self); fn set_texture_color_mod(&mut self, tex_name: &str, r: u8, g: u8, b: u8); fn set_sprite_texture_color...
46.8125
87
0.634179
2f9a0bf9e357c293035eeaf061b5fd0d81a47e16
2,218
// Copyright 2021 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to ...
24.373626
75
0.581154
bfa3894d89fa190f3be5599cdacd031f1552d82b
3,124
use std::pin::Pin; use std::task::{Context, Poll}; use actix_web::{dev::ServiceRequest, dev::ServiceResponse, Error}; use actix_utils::future::{ok, Ready}; use std::future::Future; use actix_web::web::Query; use serde::Deserialize; use actix_web::dev::{Transform, Service}; #[derive(Debug, Deserialize)] struct Auth { ...
32.884211
129
0.533291
cc2b2410b34b4b4755fc7c03a387a5e999b85da5
9,793
// -*- mode: rust; -*- // // This file is part of curve25519-dalek. // Copyright (c) 2018 Henry de Valence // See LICENSE for licensing information. // // Authors: // - Henry de Valence <hdevalence@hdevalence.ca> #![allow(non_snake_case)] use traits::Identity; use std::ops::{Add, Neg, Sub}; use subtle::Choice; use ...
30.990506
91
0.563259
d6ce46c3b9f845223d846b9a06caf4981ff9aaa2
192
// Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors // SPDX-License-Identifier: MIT pub mod potential_peers_get; mod peer_requests_state; pub use peer_requests_state::*;
24
71
0.802083
ed27a4d0b2a2fdc8438637582446c106a186709d
779
// 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 ...
33.869565
74
0.691913
28837070356702e2d589116682ebe6dac0e54a64
2,195
#[doc = "Reader of register SEL51"] pub type R = crate::R<u16, super::SEL51>; #[doc = "Writer for register SEL51"] pub type W = crate::W<u16, super::SEL51>; #[doc = "Register SEL51 `reset()`'s with value 0"] impl crate::ResetValue for super::SEL51 { type Type = u16; #[inline(always)] fn reset_value() -> Sel...
33.769231
142
0.600911
e468de7501ee94032c473245d86b83f699931894
212,236
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. #[non_exhaustive] #[derive(std::fmt::Debug)] pub struct AssociateFleetError { pub kind: AssociateFleetErrorKind, pub(crate) meta: smithy_types::Error, } #[non_exhaustive] #[derive(std::fmt::Debug)] pub enum AssociateFleetErrorKind ...
37.358916
161
0.650069
67cf8fabf4825f563c611c707a72b101aabb7f0d
5,279
// Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). #![deny(warnings)] // Enable all clippy lints except for many of the pedantic ones. It's a shame this needs to be copied and pasted across crates, but there doesn't appear to be a way to...
33.411392
214
0.686494
62ab2d753916664a7a9fb26c1060d8a80044097c
4,225
use iced::{button, slider, canvas::{Cache, Cursor, Fill, Geometry, Program}, Color, Element, Point, Rectangle, Size}; use crate::application::{Chip8EmulatorSettings, Message}; mod main_menu; mod emulation_screen; pub struct Gui { pub current_page: PageModel, pub screen: Screen, } pub st...
37.061404
403
0.564734
0307de8fbc507d9122eaeea42dd8832dbf435b8e
845
use std::f64::consts::PI; use std::fs::File; use std::io::{BufRead, BufReader, Lines}; use std::path::Path; // Returns an Iterator to the Reader of the lines of the file. pub fn read_lines<P>(filename: P) -> Lines<BufReader<File>> where P: AsRef<Path>, { let file = File::open(filename).unwrap(); BufReader:...
20.119048
62
0.52426
d9051733da24dace89662b70f3fd479bdfbfc1a8
1,614
// Do not remove inline: will result in relocation failure #[inline(always)] pub(crate) unsafe fn rel_ptr<T>(offset: u64) -> *const T { (image_base() + offset) as *const T } // Do not remove inline: will result in relocation failure #[inline(always)] pub(crate) unsafe fn rel_ptr_mut<T>(offset: u64) -> *mut T { ...
32.28
97
0.648699
edc8af93d792f3d93d6ee03d2c9f1e17e17fa094
4,490
use math::{Point2, Point3, Point4}; use noise_fns::NoiseFn; /// Noise function that uses multiple source functions to displace each coordinate /// of the input value before returning the output value from the `source` function. pub struct Displace<'a, Source: 'a, XDisplace: 'a, YDisplace: 'a, ZDisplace: 'a, UDisplace:...
39.385965
97
0.645212
18bd05abc41e79efe794ea824fabbf5770022e23
9,403
mod types; use crate::types::{Area, Direction, PenStatus, Position}; use derive_more::From; use eventmill::dispatch::{Core, CoreError}; use eventmill::event::DomainEventView; use eventmill::inmemory_store::InMemoryStore; use eventmill::{ Aggregate, AggregateType, DispatchCommand, DomainCommand, EventType, Generati...
28.667683
99
0.597469
23d56ce7d3b56e73c413f7e8557991c52affac55
37,501
use fnv::FnvHashMap; use std::f64::consts; use std::ops::Deref; use std::rc::Rc; use std::str::FromStr; type ContextHashMap<K, V> = FnvHashMap<K, V>; use extra_math::factorial; use shunting_yard::to_rpn; use std; use std::fmt; use tokenizer::{tokenize, Token}; use Error; /// Representation of a parsed expression. //...
31.14701
118
0.479427
fb29aca76b5fd50d1bc360e553db7eec3175bd54
27,282
use std::cell::RefCell; use std::pin::Pin; use std::task::{Context, Poll}; use std::{collections::HashMap, iter, rc::Rc}; use actix::prelude::*; use actix_service::{Service, Transform}; use actix_session::{Session, SessionStatus}; use actix_web::cookie::{Cookie, CookieJar, Key, SameSite}; use actix_web::dev::{ServiceR...
38.050209
89
0.473829
50b0ede09c22f05c124413f11b80c623441c8405
446
// Check that when making a ref mut binding with type `&mut T`, the // type `T` must match precisely the type `U` of the value being // matched, and in particular cannot be some supertype of `U`. Issue // #23116. This test focuses on a `match`. #![allow(dead_code)] struct S<'b>(&'b i32); impl<'b> S<'b> { fn bar<'a...
29.733333
68
0.609865
7a86379786ff57a49791e4e780a8a15bc6a074af
1,940
use log::*; use std::io::Write; use crate::cli; use env_logger::fmt::{Color, Style, StyledValue}; // Change style based on the message log level fn colored_level<'a>(style: &'a mut Style, level: Level) -> StyledValue<'a, &'static str> { match level { Level::Trace => style.set_color(Color::Magenta).value("...
32.333333
95
0.53299
e62eadaa4387dd962418d043c4ecbae4a58d3e73
40,289
// Copyright 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-MIT or ...
30.614742
99
0.619946
7a28c93ecfcaa13fa2d107731fe2155211a08c54
4,906
#![no_main] extern crate libc; extern crate rand; use libfuzzer_sys::fuzz_target; use libfuzzer_sys::fuzz_mutate; use std::process::Command; use std::ffi::CString; use std::fs::{File, remove_file}; use std::fs::OpenOptions; use std::io::prelude::*; use rand::RngCore; use evmfuzz::execute_proto; use protobuf::Messa...
32.926174
113
0.584794
b9fb5f4a3114ac6a64d3f14303efcb81fcbfcdfe
2,254
use std::{collections::BTreeMap, str::FromStr}; use serde::{Deserialize, Serialize}; use chain_core::init::{ address::RedeemAddress, coin::Coin, config::{JailingParameters, RewardsParameters, SlashRatio, SlashingParameters}, }; use chain_core::state::account::{ConfidentialInit, ValidatorName, ValidatorSec...
34.151515
92
0.639752
01aedbc61dbe6043ebc88ef55c13dca615f10937
15,126
use crate::{ pass::Pass, util::{alias_ident_for, is_literal, prepend, undefined, ExprFactory, StmtLike}, }; use ast::*; use serde::Deserialize; use std::mem; use swc_atoms::js_word; use swc_common::{util::move_map::MoveMap, Fold, FoldWith, Span, Spanned, DUMMY_SP}; #[cfg(test)] mod tests; pub fn spread(c: Con...
35.674528
98
0.327582
ed92bdf36d7673c61669af0114c2115b1f389e5f
3,906
use anyhow::Result; use delay_timer::prelude::*; #[allow(deprecated)] use delay_timer::utils::convenience::functions::unblock_process_task_fn; use hyper::{Client, Uri}; use std::time::Duration; use tokio::time::sleep; use tracing::Level; use tracing_subscriber::FmtSubscriber; // You can replace the 66 line with the co...
34.566372
174
0.673067
6af27f6ca26933702ab37bdc6f4d657e440b2aa6
7,506
use crate::util::error::DynResult; use log::{debug, error}; use std::future::Future; use std::io; use tokio::io::Interest; use tokio::net::windows::named_pipe::{ ClientOptions, NamedPipeClient, NamedPipeServer, ServerOptions, }; use tokio::sync::mpsc::{self, Receiver, Sender}; use tokio::time::{self, Duration}; use...
39.09375
100
0.343059
abcd5c66f2e57bfe259de15c380125e3af421504
9,724
// automatically generated by the FlatBuffers compiler, do not modify #![allow(dead_code)] #![allow(unused_imports)] extern crate flatbuffers; pub mod namespace_a { #![allow(dead_code)] #![allow(unused_imports)] use std::mem; use std::cmp::Ordering; extern crate flatbuffers; use self::flatbuffers::Endi...
32.851351
132
0.665261
096ee0b00e43ed89ffdb8df76bda0bc42a20b38d
3,198
#![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GamepadEventInit)] #[derive(Debug, Clone, PartialEq, Eq)] #[doc = "The `GamepadEventInit` dictionary."] #[doc = ""] #[doc = "*This API require...
34.76087
110
0.55566
11c67d421c27a42dc668ff670213efdde53611fb
902
use super::*; use proptest::strategy::Strategy; #[test] fn without_empty_list_returns_true() { with_process_arc(|arc_process| { TestRunner::new(Config::with_source_file(file!())) .run( &( Just(Term::NIL), strategy::term(arc_process.clone(...
25.771429
86
0.464523
383eab758a03bae3565c787454621ca666a35b53
2,236
use bracket_color::prelude::{RGB, RGBA}; use byteorder::{ReadBytesExt, WriteBytesExt}; use std::io; /// Structure representing the components of one color #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct XpColor { /// Red component 0..255 pub r: u8, /// Green component 0..255 pub g: u8, /// ...
23.787234
97
0.521467
ed07903c5de277ce2188a8751fd3ee34fe854c80
24,328
/// Project: Audio filters in Rust /// Date: 2021.12.05 /// Author of the port: João Nuno Carvalho /// /// Description: Audio or DSP filters, allow you to attenuate or accentuate some frequencies /// or range of frequencies in a signal. The signal can be of any kind, but in /// here, we wil...
36.148588
123
0.562644
0a4141e698b44b66be923180755f01913d6e8904
12,462
mod never_type; mod coercion; mod regression; mod simple; mod patterns; mod traits; mod method_resolution; mod macros; mod display_source_code; use std::{env, sync::Arc}; use base_db::{fixture::WithFixture, FileRange, SourceDatabase, SourceDatabaseExt}; use expect_test::Expect; use hir_def::{ body::{Body, BodySou...
33.5
100
0.531456
8936c966c4087f39b71bcda1ec358505fc68c325
367
//! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_1305.hrx" #[test] fn test() { assert_eq!( crate::rsass( ".foo {\ \n content: call(\'unquote\', \'foo\', ()...);\ \n}\ \n" ) .unwrap(), ".foo {\ \n co...
19.315789
83
0.392371
906eecc1f995c5d566d380a27f7a5f2f0d40e721
724
//! Validate #![allow(missing_docs)] #![no_main] use libfuzzer_sys::fuzz_target; use oapth::{Commands, Migration, MigrationGroup}; use tokio::runtime::Runtime; #[derive(Debug, arbitrary::Arbitrary)] struct Data { m_name: String, m_sql_down: String, m_sql_up: String, m_version: i32, mg_name: String, mg_ve...
20.685714
64
0.633978
f59e41b07de53416f1482ea748d4582b956de7c3
2,920
use cosmwasm_std::{CanonicalAddr, StdResult, Storage, Uint128}; use cosmwasm_storage::{Bucket, ReadonlyBucket}; use pylon_utils::common::OrderBy; use pylon_utils::range::{calc_range_end_addr, calc_range_start_addr}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use crate::constants::{DEFAULT_QUERY_LIM...
35.180723
100
0.622945
08146c0b065feb90fec88f37983bfb03d3da973b
1,283
extern crate tokio_timer; extern crate futures; extern crate futures_cpupool; use tokio_timer::Timer; use futures::Future; use std::time::Duration; use futures_cpupool::CpuPool; const BIG_PRIME: u64 = 15485867; // checks whether a number is prime, slowly fn is_prime(num: u64) -> bool { for i in 2..num { ...
23.327273
71
0.600935
79ddedd4187560fbfe8e4c2e44da0e170545f552
638
#![feature(trait_upcasting)] #![allow(incomplete_features)] trait Foo: Bar<i32> + Bar<u32> {} trait Bar<T> { fn bar(&self) -> Option<T> { None } } fn test_specific(x: &dyn Foo) { let _ = x as &dyn Bar<i32>; // OK let _ = x as &dyn Bar<u32>; // OK } fn test_unknown_version(x: &dyn Foo) { l...
22.785714
93
0.523511
ac91c40834603786f19ff345c3fc172ccbc3ddff
5,331
#![deny(warnings)] use ucx_sys::ucs_status_ptr_t; use ucx_sys::ucs_status_t; use ucx_sys::UCS_PTR_IS_ERR; use ucx_sys::UCS_PTR_RAW_STATUS; #[macro_use] extern crate log; #[cfg(test)] macro_rules! spawn_thread { ($future:expr) => { std::thread::spawn(move || { let rt = tokio::runtime::Builder:...
33.111801
87
0.631401
16cf459b8ff87dcb86d61c49a29d191af64ccc9f
328
pub(crate) mod apu; pub mod cart; pub mod console; pub mod controller; pub(crate) mod cpu; pub(crate) mod memory; pub mod ports; pub(crate) mod ppu; pub use cart::{Cart, CartReadingError}; pub use console::Console; pub use controller::ButtonState; pub use ports::{AudioDevice, PixelBuffer, VideoDevice, NES_HEIGHT, NES_...
23.428571
78
0.759146
8775281aeeaee64e5021dc5977484a514a1beda6
6,972
// WARNING: This file was autogenerated by jni-bindgen. Any changes to this file may be lost!!! #[cfg(any(feature = "all", feature = "android-location-GpsSatellite"))] __jni_bindgen! { /// public final class [GpsSatellite](https://developer.android.com/reference/android/location/GpsSatellite.html) /// /...
69.72
237
0.626076
7520b2618a06f698c543b9bd4355b446080cc72f
37,755
use pest::iterators::Pairs; use pest::Parser; use std::collections::HashMap; use std::fs; use std::str::FromStr; use strum_macros::EnumString; #[derive(Parser)] #[grammar = "asm.pest"] pub struct AssemblyParser; pub fn parse(file_name: String) -> Vec<Instruction> { let unparsed_file = fs::read_to_string(file_name...
35.08829
99
0.474083
1c5183d788f4e60d65723a706fefdd3322b418c1
415
use super::*; use assert2::assert; type Range<const START: u32, const END: u32> = RiU32<START, END>; #[test] fn range_is_expected_len() { // Given const MIN_CPU_HZ: u32 = 350_000_000; const MAX_CPU_HZ: u32 = 1_400_000_000; type Sut = Range<MIN_CPU_HZ, MAX_CPU_HZ>; let expected = Some(1_050_000_0...
18.863636
65
0.638554
48f29d7cc5ac84875761693e53d408ea6fac56ef
175,354
#![doc = "generated by AutoRust 0.1.0"] #![allow(unused_mut)] #![allow(unused_variables)] #![allow(unused_imports)] use super::{models, API_VERSION}; #[derive(Clone)] pub struct Client { endpoint: String, credential: std::sync::Arc<dyn azure_core::TokenCredential>, scopes: Vec<String>, pipeline: azure_c...
50.490642
325
0.513458
6a019895feb7a0804926848ce532edd51b110fd4
3,812
pub use hookmap_core::{Button, ButtonAction, ButtonEvent}; use crate::macros::{ButtonArg, ExpandButtonArg}; use hookmap_core::ButtonOperation; #[derive(Debug, Clone)] pub struct ConstantAny<const N: usize>([Button; N]); /// Shift key that does not distinguish between right and left. pub const SHIFT: ConstantAny<2> =...
24.753247
86
0.619098
e5bbeed16f5548e675d17da260d20eeebb3dac42
6,967
macro_rules! read_csr { ($csr_number:expr, $asm_fn: ident) => { /// Reads the CSR #[inline] unsafe fn _read() -> usize { match () { #[cfg(all(riscv, feature = "inline-asm"))] () => { let r: usize; llvm_asm!("...
25.520147
97
0.382661
dee9a51d438349cf30c211c4369062cd5ead2a15
645
use system::ia_32e::instructions::page_table::flush_all; use system::interrupt; use crate::process::scheduler::switch; #[derive(Clone, Copy, Debug)] #[repr(u8)] pub enum IpiKind { WakeUp = 0x40, Tlb = 0x41, Switch = 0x42, Pit = 0x43, } impl From<IpiKind> for usize { fn from(kind: IpiKind) -> Self...
16.538462
56
0.570543
fed8bc95b6b86eeb0b9e80d657fc6a6cad282883
921
#![feature(unboxed_closures)] // Tests that we can't assign to or mutably borrow upvars from `Fn` // closures (issue #17780) fn set(x: &mut usize) { *x = 5; } fn to_fn<A,F:Fn<A>>(f: F) -> F { f } fn to_fn_mut<A,F:FnMut<A>>(f: F) -> F { f } fn main() { // By-ref captures { let mut x = 0; let ...
25.583333
100
0.5038
03ca85faafff6b6af56c96eb14d1154c375d89c9
56,102
// Copyright 2016 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 ...
42.501515
100
0.458932
67ef18950af00647132baa51a718e2011ef7dd74
1,735
//! **city2ba** is a set of tools for generating synthetic bundle adjustment datasets. //! //! Bundle Adjustment is a nonlinear global optimization used to reduce noise in structure from //! motion (SfM) and simultaneous localization and mapping applications (SLAM). See //! [https://en.wikipedia.org/wiki/Bundle_adjustm...
44.487179
102
0.746398
09d6972bdf24379cfcca72d2d9dc6c5b5b096bcb
396
use super::common::receive_from_stream; use crate::reply::Event; use crate::Fallible; use std::convert::TryFrom; use std::os::unix::net::UnixStream; pub struct EventIterator(pub(crate) UnixStream); impl Iterator for EventIterator { type Item = Fallible<Event>; fn next(&mut self) -> Option<Self::Item> { ...
24.75
72
0.707071
562c010a5f33157c9b7fce7514855139f67ab8ef
2,490
//! The [`Array`](crate::array::Array) struct. use graphics::color; use graphics::types::Color; use crate::state::{ArrayAccess, SharedState}; /// A convenient wrapper around [`SharedState`] for /// [algorithms](crate::algorithms) that handles concurrency and all that stuff. /// **All methods in this struct lock the ...
27.666667
80
0.630522
29405693a445f7dc9af1cf456fae5676d0f46fd3
9,679
use std::f32::consts::{PI, TAU}; use crate::{constants::*, geometry::Rectangle, util::*}; use macroquad::{prelude::*, audio::{Sound, play_sound_once, stop_sound}}; #[derive(Debug, Clone)] pub struct Player { pub center: Vec2, pub size: Vec2, pub speed: f32, pub ground_height: f32, pub velocity: Ve...
29.690184
98
0.523298
bfe33c6b5661a19e07f1159f5427fdc2b5c46c17
1,496
/* automatically generated by rust-bindgen */ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] pub mod foo { pub type Type = ::std::os::raw::c_uint; pub const THIS: Type = 0; pub const SHOULD_BE: Type = 1; pub const A_CONSTANT: Type = 2; } pub use self::foo::Type as...
22.328358
82
0.54746
cc3e650979a255414f94d5ddcd9780eb49ad1a21
14,588
use object::{Object, ObjectSection, ObjectSymbol}; use std::collections::{HashMap, HashSet}; use std::convert::TryInto; use std::num::TryFromIntError; use wasmer_compiler::{ CompileError, CompiledFunctionFrameInfo, CustomSection, CustomSectionProtection, CustomSections, FunctionAddressMap, FunctionBody, Instr...
42.16185
100
0.572251
e613b3e0dd59e9058440050b5dc02e4fca1afcde
7,380
use super::state_machine::machine::NFA; /// A matcher is some strategy for matching a given regex to a given input string. Different /// matchers perform well in different situations, and which matcher to use can be decided based on /// the regex. pub trait Matcher { /// Given an input line, return the byte index ...
32.368421
99
0.56477
f7250091d26e5641e1e95dc2c803b262331520bc
426
use crate::value::Value; use bytes::Bytes; use enum_dispatch::enum_dispatch; /// `AgateIterator` defines the interface of all iterators, /// including `TableIterator`, `MergeIterator` and `ConcatIterator`. #[enum_dispatch] pub trait AgateIterator { fn next(&mut self); fn rewind(&mut self); fn seek(&mut sel...
26.625
68
0.664319
67f520b2a616520a6da5210d5b55a2de9c9a82b8
6,535
use crate::id::OfType; use crate::Id; use std::any::Any; /// Application state when system should run #[derive(Eq, PartialEq, Debug, Hash, Clone, Copy)] pub enum Rule { /// System runs ar any state Always, /// System runs at specific state StateOn(Id<State>), /// System does not run at specific sta...
26.893004
80
0.548585
4a6ad75942485d331a69234f2a8bc32fc4cfb6c4
2,735
use crate::common::*; #[derive(Debug, Eq, PartialEq)] pub struct User { pub id: u64, pub discord_id: UserId, pub prompt_message: Option<PromptMessage>, pub welcomed: bool, pub bio: Option<String>, } impl User { pub fn update(&self, response: &Response) -> Update { let ...
24.419643
78
0.531993
c1177b5358c3e24fc6a42593ea000862cffacee3
5,320
extern crate find_longest_substring; #[cfg(test)] mod tests { use find_longest_substring::*; use std::cmp::Ordering; use std::error::Error; use std::fs; use std::fs::File; use std::fs::OpenOptions; use std::io::Write; use std::io::{BufRead, BufReader, Read}; use std::path::{Display,...
36.944444
109
0.53703
717b2b3750f8c6ee1fa57271fe81578f717f4cba
5,716
//! Possible errors in the library. use std::fmt; #[cfg(feature = "wbindgen")] use wasm_bindgen::JsValue; use strum_macros::IntoStaticStr; use block_modes::{BlockModeError, InvalidKeyIvLength}; use hmac::crypto_mac::InvalidKeyLength; use hmac::crypto_mac::MacError; /// This crate's error type. #[derive(Debug, Into...
32.850575
100
0.602344
5dd0a0ef2c049b61e27493280c94aa41896cf490
421
// tests1.rs // Tests are important to ensure that your code does what you think it should do. // Tests can be run on this file with the following command: // rustlings run tests1 // This test has a problem with it -- make the test compile! Make the test // pass! Make the test fail! Execute `rustlings hint tests1` for...
26.3125
81
0.691211
89e69e88b8ee69556f57aba3467dbb8d6eeb2999
11,977
use std::convert::TryFrom; use std::ops::Range; use crate::coord::ranged1d::{ AsRangedCoord, DefaultFormatting, DiscreteRanged, KeyPointHint, NoDefaultFormatting, Ranged, ReversibleRanged, ValueFormatter, }; macro_rules! impl_discrete_trait { ($name:ident) => { impl DiscreteRanged for $name { ...
31.353403
100
0.536946
5def07e00633eccc93fc4be4fad4d8f492272870
12,634
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use anyhow::{format_err, Result}; use itertools::Itertools; use libra_crypto::{hash::SPARSE_MERKLE_PLACEHOLDER_HASH, HashValue}; use libra_types::{ access_path::AccessPath, account_address::AccountAddress, account_state::Ac...
32.06599
100
0.645322
62481e0f9cfff1bfbcfa320daca323e0cde11ce1
166
pub mod define; pub mod errors; pub mod flv2hls; pub mod m3u8; pub mod flv_data_receiver; pub mod rtmp_event_processor; mod test_flv2hls; pub mod ts; pub mod server;
16.6
29
0.789157
fc5acd935113e4035737b8503731b79c696084e6
6,950
use super::def::{IntervalSet, ParseIntervalSetError}; use fp::Float; use interval::Interval; use std::cmp::Ordering; use std::fmt; use std::fmt::{Display, Formatter, Write}; use std::str::FromStr; impl<BOUND: Float> IntervalSet<BOUND> { /// Constructs an interval set of one interval from given bounds. /// ...
32.938389
99
0.558993
39485532bf4544306c0fff9d7bc973fcc5e33c9b
32,267
use crate::{execution::evm::opcode::*, models::*}; pub(crate) const COLD_SLOAD_COST: u16 = 2100; pub(crate) const COLD_ACCOUNT_ACCESS_COST: u16 = 2600; pub(crate) const WARM_STORAGE_READ_COST: u16 = 100; /// Additional cold account access cost. /// /// The warm access cost is unconditionally applied for every account...
54.139262
100
0.642793