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
610d1d8af3b5e8fbe834540b9509b87c61142ca2
2,096
//! Tidy check to ensure that there are no binaries checked into the source tree //! by accident. //! //! In the past we've accidentally checked in test binaries and such which add a //! huge amount of bloat to the Git history, so it's good to just ensure we //! don't do that again. use std::path::Path; // All files ...
36.77193
83
0.561069
fb95220ae315ead20877758240da798eaf171681
285,327
#![doc = "generated by AutoRust"] #![allow(unused_mut)] #![allow(unused_variables)] #![allow(unused_imports)] use super::models; #[derive(Clone)] pub struct Client { endpoint: String, credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>, scopes: Vec<String>, pipeline: azure_core::Pipeline, ...
51.097242
319
0.521945
f8723ad6a551a66cb7bec0d4982d546b604d5887
51,172
// DO NOT EDIT ! // This file was generated automatically from 'src/mako/cli/main.rs.mako' // DO NOT EDIT ! #![allow(unused_variables, unused_imports, dead_code, unused_mut)] #[macro_use] extern crate clap; extern crate yup_oauth2 as oauth2; extern crate yup_hyper_mock as mock; extern crate hyper_rustls; extern crate ...
49.06232
526
0.438365
914439fdb727d5712817594018ee2af98806f5d2
1,678
use toml; use serde_derive::{Deserialize, Serialize}; use std::collections::BTreeMap; #[derive(Debug, Default, Clone, Deserialize, Serialize)] pub struct Manifest { pub package: Metadata, pub badges: Option<BTreeMap<String, Badge>>, #[serde(rename = "build-dependencies")] #[serde(serialize_with = "tom...
29.964286
57
0.6764
c16e264acdd896871945b19ee2065a383a26d972
1,875
use super::core::{ integration_step::builders::{self, Collector}, Integrator, }; pub struct Euler; impl Integrator for Euler { fn label(&self) -> String { "Midpoint (explicit, Euler)".to_string() } fn description(&self) -> String { "v₁ = v + a ½dt\n\ s₁ = s + v₁ ½dt\n\ ...
26.785714
89
0.5168
db719a598b5669aa6c03278f6115a17b0565717c
2,919
#![feature(alloc_system)] extern crate reqwest; extern crate kuchiki; extern crate html5ever; extern crate semver; extern crate linuxver; use semver::Version; use std::thread; use kuchiki::traits::*; use std::string::String; fn get_request(s: &str) -> String { let res = reqwest::get(s).unwrap().text(); let ...
33.551724
153
0.656389
d72169c5b1bd848ed0df1f8eebbf7c523f58c293
196,807
// Generated file, to regenerate run // ./gen-array-impls.sh > src/array/generated_impl.rs // from the repo root use super::Array; impl<T: Default> Array for [T; 0] { type Item = T; const CAPACITY: usize = 0; #[inline(always)] #[must_use] fn as_slice(&self) -> &[T] { &*self } #...
20.46449
75
0.38867
5d7c31d779eb050de09a2c7a307e3a8d7053b5e9
5,254
use bevy::prelude::*; /// This example illustrates how to use States to control transitioning from a Menu state to an InGame state. fn main() { App::build() .add_plugins(DefaultPlugins) .init_resource::<ButtonMaterials>() .add_resource(State::new(AppState::Menu)) .add_stage_after(st...
30.905882
109
0.568329
1e4d2241b86997a6fe5676109001b554c5c6a46d
11,686
use super::*; use enumflags2::{bitflags, BitFlags}; use std::{ collections::{vec_deque::Drain, HashMap, VecDeque}, str::FromStr, }; #[derive(Debug)] pub enum InputEvent { Key { down: bool, keycode: mq::KeyCode, keymods: mq::KeyMods, repeat: bool, }, Mouse { d...
31.928962
96
0.487763
69819064975a9d526b95c0761bca947a50e81521
138,879
#![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...
51.995133
341
0.530253
9bc8886e9660a50ee5fbfb32b963a9b6c7a7e810
51
net.sf.jasperreports.web.servlets.ReportPageStatus
25.5
50
0.882353
d917c94cdcab12c96619e3363f184d57d531ca65
4,593
//! API types. pub use allowed_update::*; pub use animation::*; pub use audio::*; pub use callback_game::*; pub use callback_query::*; pub use chat::*; pub use chat_action::*; pub use chat_id::*; pub use chat_member::*; pub use chat_or_inline_message::*; pub use chat_permissions::*; pub use chat_photo::*; pub use chos...
24.827027
48
0.803614
67d1714ccf407746bbe62b663a3926d168bc8b1b
758
#[allow(dead_code)] mod portfolio; mod backend; mod state; mod paths; mod error; pub type Result<T> = std::result::Result<T, error::Error>; fn main() { use backend::{ world_trading_data::WorldTradingData, aggregator::Aggregator, cache::Cache, }; let state = state::State::get().unwrap(); println!("state: {...
25.266667
77
0.671504
28ccb0e5336d5818af73dbfe96da25a9a6db98d6
799
use near_sdk::collections::UnorderedSet; use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; #[derive(BorshDeserialize, BorshSerialize)] pub struct Person{ name: String, classes: UnorderedSet<u128> } impl Person{ /* Getters */ pub fn name(&self) -> &String { &self.name } pub fn new(nam...
26.633333
65
0.614518
08c791fa0cace6d0c7205d890c69625589d4f240
47,056
//! AVM2 objects. use crate::avm2::activation::Activation; use crate::avm2::array::ArrayStorage; use crate::avm2::bytearray::ByteArrayStorage; use crate::avm2::class::Class; use crate::avm2::domain::Domain; use crate::avm2::events::{DispatchList, Event}; use crate::avm2::function::Executable; use crate::avm2::names::{...
33.950938
103
0.572701
756e6200aeaaeb3dc2b3fc895aded3360ae347ea
10,108
// // // //! ATA IO code, handling device multiplexing and IO operations use ::prelude::*; //use ::memory::helpers::{DMABuffer}; //use ::async; use ::metadevs::storage; //use ::device_manager::IOBinding; use x86_64::instructions::port; pub const SECTOR_SIZE: usize = 128; //const MAX_DMA_SECTORS: usize = 0x2_0000 / SEC...
32.397436
126
0.595568
67eaa716fe10ac205342ec897c297c79f1955ca2
553
#![feature(test)] extern crate test; use digest::bench_update; use ripemd::{Ripemd160, Ripemd256, Ripemd320}; use test::Bencher; bench_update!( Ripemd160::default(); ripemd160_10 10; ripemd160_100 100; ripemd160_1000 1000; ripemd160_10000 10000; ); bench_update!( Ripemd256::default(); rip...
17.83871
46
0.696203
29edf8a9e4f5c9123ea90fd8572a4b19e0d52c75
15,958
// tools for automatically formatting spwn files use crate::ast::*; pub trait SpwnFmt { fn fmt(&self, ind: Indent) -> String; } type Indent = u16; fn tabs(mut num: Indent) -> String { let mut out = String::new(); while num > 4 { out += "\t"; num -= 4; } for _ in 0..num { ...
26.775168
95
0.423236
26f045882b53754ad0ab8861664970db12683466
5,627
// Copyright 2016 PingCAP, 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 i...
35.389937
87
0.643149
61200d8f2e10d731fc0b94a4eb391e866d83233b
6,000
use super::chan::{channel, Sender, Receiver}; use futures::executor::LocalPool; use futures::task::LocalSpawnExt; enum StepResult { Halt, StepIp(usize), } pub struct IntCode { pub memory: Vec<i64>, ip: usize, relative_base: i64, inputs: Receiver<i64>, outputs: Sender<i64>, } impl IntCode...
23.904382
92
0.403667
18f938dc1940731dbf4758dd7ee25623e1817469
16,051
use wagyu_model::no_std::*; use wagyu_model::{Amount, AmountError}; use core::fmt; use serde::Serialize; // Number of satoshis (base unit) per BTC const COIN: i64 = 1_0000_0000; // Maximum number of satoshis const MAX_COINS: i64 = 21_000_000 * COIN; /// Represents the amount of Bitcoin in satoshis #[derive(Debug, C...
32.230924
108
0.522647
e22b5558ebe99157ed58210e7591ef0b3a406b9f
83,512
// Take a look at the license at the top of the repository in the LICENSE file. //! Translation between GLib/GLib-based FFI types and their Rust counterparts. //! //! This module allows library bindings authors to decouple type translation //! logic and use unified idioms at FFI boundaries. It also implements //! tran...
32.194295
141
0.593651
2f3514d20945ab84f764956f33a0f5162901d214
6,417
//! Koleksi macro library internal macro_rules! implement_crypto_wrapper { ( $(#[$attr:meta])* struct $name:ident, $size:expr) => { implement_crypto_wrapper!( $(#[$attr])* struct $name, $crate::crypto::ds::$name, $name, $size ); }; ( $(#[$attr:meta])* struct $name:ident, $source:path, $source_name...
27.306383
104
0.433224
481963006241c94c914d4ee114b781dc06d17863
3,041
#![cfg(feature = "macros")] //! Test slf: PyRef/PyMutRef<Self>(especially, slf.into::<Py>) works use pyo3::prelude::*; use pyo3::types::{PyBytes, PyString}; use pyo3::PyCell; use std::collections::HashMap; mod common; /// Assumes it's a file reader or so. /// Inspired by https://github.com/jothan/cordoba, thanks. #[...
24.524194
94
0.515949
71e4db64385d1014e61abecf841be6b081794769
3,097
use anyhow::{anyhow, Result}; use code_writer::{write_bootstrap, write_code}; use parser::parse; use std::io::{BufWriter, Write}; use std::{env, ffi::OsStr}; use std::{fs::File, path::Path}; mod arithmetic_command; mod code_writer; mod command; mod parser; mod segment; fn main() -> Result<()> { let args: Vec<Stri...
32.946809
90
0.426219
69c63c7ee28f13bf5387e3840c7ca7203b866940
25,700
use std::{collections::HashMap, hash::Hash, marker::PhantomData, time::Duration}; use amethyst_assets::{AssetStorage, Handle}; use amethyst_core::ecs::{ CommandBuffer, Entity, EntityStore, IntoQuery, ParallelRunnable, SubWorld, System, SystemBuilder, TryRead, Write, }; use derivative::Derivative; use fnv::FnvH...
39.296636
143
0.507315
f5f5d4ed3804fe8c008f4d21e95d1baf09858813
582
// aux-build:overlapping_pub_trait_source.rs /* * This crate declares two public paths, `m::Tr` and `prelude::_`. Make sure we prefer the former. */ extern crate overlapping_pub_trait_source; fn main() { //~^ HELP the following trait is implemented but not in scope; perhaps add a `use` for it: //~| SUGGESTI...
36.375
98
0.706186
d79e35bf33ec91387ab6b79e3af123927028b181
147
use tower_lsp::lsp_types::*; pub fn symb(name: &str) -> CompletionItem { CompletionItem { label: name.to_string(), ..Default::default() } }
16.333333
43
0.659864
875d76a2d80d9e314682410236a2e68a3f8876d0
2,434
// Copyright (c) 2020 DarkWeb Design // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish...
32.891892
100
0.657354
1acc8fbaecf92c56f7e468a9333e8f9107000f8d
3,338
use std::path::PathBuf; use crate::prelude::*; use nu_engine::filesystem::path::canonicalize; use nu_engine::WholeStreamCommand; use nu_errors::ShellError; use nu_protocol::{CommandAction, ReturnSuccess, Signature, SyntaxShape, UntaggedValue}; use nu_source::Tagged; #[cfg(unix)] use std::os::unix::fs::PermissionsExt...
27.816667
97
0.49281
bbb8603b3ed1ebe863cf8749d3db0b2002a50795
811
extern crate httpmock; use isahc::get; use httpmock::Method::GET; use httpmock::MockServer; #[test] fn explicit_delete_mock_test() { // Arrange let server = MockServer::start(); let mut m = server.mock(|when, then| { when.method(GET).path("/health"); then.status(205); }); // Act...
21.342105
80
0.593095
f48c058b196b4a0d40c93178d8fd664b82b26b95
108
pub mod audio; pub mod locale; pub mod log; pub mod navigator; pub mod render; pub mod storage; pub mod ui;
13.5
18
0.740741
294b89acc2cb5f94e77b3b8cf5e9398f22f76204
1,073
extern crate clap; extern crate fibers; extern crate fibers_inotify; extern crate futures; #[macro_use] extern crate trackable; use clap::{App, Arg}; use fibers::{Executor, InPlaceExecutor, Spawn}; use fibers_inotify::{Error, InotifyService, WatchMask}; use futures::{Future, Stream}; fn main() { let matches = App...
32.515152
97
0.67754
dd69ee36ea93f05d70d3c8414f181ef1ecccf711
1,352
use std::fs::File; use std::io::Read; use clap::Parser; #[derive(Parser)] pub struct Options { /// Path to a wgsl shader program (use '-' for stdin). #[clap(default_value = "-")] pub input: String, /// Path at which to write output (use '-' for stdout). #[clap(short, long, default_value = "-")] ...
25.037037
73
0.559172
f948c9eb2f68db6cc6e148b69a93a91d570ad4bf
48,229
// Copyright 2018 PingCAP, 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 i...
38.24663
105
0.528375
759f2cc86572bb113be37cf5d4f875a3fd045adf
41,166
//! Transforms `ast::Expr` into an equivalent `hir_def::expr::Expr` //! representation. use std::{mem, sync::Arc}; use either::Either; use hir_expand::{ ast_id_map::{AstIdMap, FileAstId}, hygiene::Hygiene, name::{name, AsName, Name}, ExpandError, HirFileId, InFile, }; use la_arena::Arena; use profile:...
42.308325
110
0.472356
e8f794038e41f049078d4ddc5777a627af5443ba
12,044
use std::fmt::Debug; use serde::{de::DeserializeOwned, Serialize}; use transmog::{Format, OwnedDeserializer}; use transmog_pot::Pot; use crate::{ document::{BorrowedDocument, CollectionDocument}, key::Key, schema::{ view::map::{Mappings, ViewMappedValue}, Collection, CollectionName, Name, ...
33.736695
128
0.616323
e2f0484b2dccd2e50c7e81c4319595ee9a91ab51
5,552
mod postgres; use nettu_scheduler_domain::{SyncedCalendarEvent, ID}; pub use postgres::PostgresEventSyncedRepo; #[async_trait::async_trait] pub trait IEventSyncedRepo: Send + Sync { async fn insert(&self, e: &SyncedCalendarEvent) -> anyhow::Result<()>; async fn find_by_event(&self, event_id: &ID) -> anyhow::R...
33.047619
102
0.530079
e463677f799e763d5f2ce51335d3d7227da7517e
2,472
use super::vec_ext::*; /// A Range type (i.e. something which has a minimum and a maximum). /// This is commonly used as `Range<TV>` and `Range<IV>` to represent a box, though can be used with /// other numeric types as well. /// /// Note that, unlike the rest of the library, we do not use the 2d and 3d feature flags ...
39.238095
100
0.633495
c1cfd436708de8058dfb9ab8262ae2c79bb996bf
2,446
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; use deno_core::FsModuleLoader; use deno_runtime::deno_broadcast_channel::InMemoryBroadcastChannel; use deno_runtime::deno_web::BlobStore; use deno_runtime::permissions::Permissions; use deno_runtime::worker::Main...
30.575
76
0.70646
8fdf24a62777595ab59a7c1fc51dad8305c04719
4,160
#![allow(non_snake_case, non_upper_case_globals)] #![allow(non_camel_case_types)] //! Nested Vectored Interrupt Controller //! //! Used by: stm32l100, stm32l151, stm32l162 #[cfg(not(feature = "nosync"))] pub use crate::stm32l1::peripherals::nvic::Instance; pub use crate::stm32l1::peripherals::nvic::{RegisterBlock, Res...
32.5
97
0.613462
28b97b2a58014cf5ee1f9cebf9196692c7191530
6,882
#[cfg(feature="safe")] use custos::{libs::cpu::CPU, Matrix, AsDev, range, VecRead}; #[cfg(feature="safe")] #[cfg(feature="opencl")] use custos::libs::opencl::CLDevice; #[cfg(feature="safe")] #[test] fn test_threading_cpu() { let device = CPU::new().select(); let th1_cl = std::thread::spawn(|| { let d...
31.140271
83
0.385062
4b0b97fecb8c6ebeb64f1d42bc30e2f22960a3b6
1,626
use std::error; use std::fmt; use std::io; use std::convert; /// Contains error options that can be encountered while performing the decoding /// operations. #[derive(Debug, PartialEq)] pub enum DecoderError { /// Indicates that the decoder received an invalid stream of bytes that can /// not be decoded. I...
31.269231
113
0.654982
2290e695a1b4f8de1a50fdb88bba5de56077d477
2,557
//! Types for the [`m.space.parent`] event. //! //! [`m.space.parent`]: https://spec.matrix.org/v1.2/client-server-api/#mspaceparent use ruma_events_macros::EventContent; use ruma_identifiers::ServerName; use serde::{Deserialize, Serialize}; /// The content of an `m.space.parent` event. /// /// Rooms can claim parent...
34.554054
99
0.662495
eb67b718dbd3d4fcf71f3221883c89d68b387898
23,016
//! Temporal quantification. //! //! Example: //! //! ``` //! use std::time::Duration; //! //! let five_seconds = Duration::new(5, 0); //! // both declarations are equivalent //! assert_eq!(Duration::new(5, 0), Duration::from_secs(5)); //! ``` #![stable(feature = "time", since = "1.3.0")] use error::Error; use fmt; u...
34.662651
98
0.595151
38bc20cc8ae50469246ca1ce80aef8f95d5d6838
2,918
use crate::vec2::Vec2; #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub struct Rect { start: Vec2, size: Vec2, } impl Rect { pub fn new( start: impl Into<Vec2>, size: impl Into<Vec2>, ) -> Self { Self { start: start.into(), size: size.into(), }...
19.716216
67
0.426662
ddfd4e55a85c3594be560e1bf9505c962e4bd18f
3,239
// Bitcoin Dev Kit // Written in 2020 by Alekos Filini <alekos.filini@gmail.com> // // Copyright (c) 2020-2021 Bitcoin Dev Kit Developers // // This file is 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://opens...
30.556604
91
0.58444
5bbd46c585896856c82092ad8131f04ffdc6599f
4,063
use errors::*; use goblin::elf::Elf; use goblin::mach::{self, Mach, MachO}; use goblin::Object; use patcher::BUILTIN_PREFIX; use std::fs::File; use std::io::Read; use std::path::Path; #[derive(Clone, Debug, Default)] pub struct ExtractedSymbol { pub name: String, } #[derive(Clone, Debug, Default)] pub struct Extr...
30.780303
97
0.524489
5b73af10b4d1d2ca903f885b39579e166d047637
1,512
use notify::DebouncedEvent; use std::path::PathBuf; use std::sync::mpsc::Receiver; use std::time::Duration; use failure::{format_err, Error}; use crate::terminal::message; use log::info; // Add cooldown for all types of events to watching logic pub fn wait_for_changes( rx: &Receiver<DebouncedEvent>, cooldown...
31.5
89
0.564815
167317f426b7160b853cf955bc41847b16ca9d30
27,091
// 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 ...
41.936533
100
0.579971
56bc5115f99dc8b0214432b0de9199714acef72f
4,787
use either::Either; use agda_mode::agda::{preprint_agda_result, ReplState}; use agda_mode::base::ComputeMode; use agda_mode::cmd::{Cmd, GoalInput}; use agda_mode::pos::InteractionId; use agda_mode::resp::GoalInfo; use crate::file_io::{Monad, Repl}; use crate::input::UserInput; use crate::interact::help; use agda_mode...
35.723881
91
0.535199
268fdb25fcb38c41a699597f160994ace0ef867d
16,395
use fawkes_crypto_derive::Signal; use crate::{ circuit::bitify::c_into_bits_le_strict, circuit::bool::CBool, circuit::mux::c_mux3, circuit::num::CNum, core::cs::ConstraintSystem, core::field::Field, core::signal::Signal, native::ecc::{EdwardsPoint, EdwardsPointEx, JubJubParams, Montgome...
33.665298
99
0.520586
9c50344d9768378d5af20a3bb3d27ef726eac51b
9,214
//! Groestlcoin serde utilities. //! //! This module is for special serde serializations. //! pub mod btreemap_byte_values { //! Module for serialization of BTreeMaps with hex byte values. #![allow(missing_docs)] // NOTE: This module can be exactly copied to use with HashMap. use crate::prelude::*; ...
32.10453
97
0.523551
cc9ec9e57626ecc03f49e81cdd0d04dfec7ffdd9
33,141
use std::borrow::{Borrow, Cow}; use std::convert::AsRef; use std::cmp::Ordering; use std::str::Utf8Error; use std::fmt; use ref_cast::RefCast; use stable_pattern::{Pattern, Searcher, ReverseSearcher, Split, SplitInternal}; use crate::uri::fmt::{percent_encode, DEFAULT_ENCODE_SET}; use crate::uncased::UncasedStr; ///...
30.686111
144
0.537703
3846c7e133a005a835794483b5f37a2c4b6077d4
503
use serde::{Deserialize, Serialize}; use crate::common::*; /// If announce request has answer = true, send this to peer with /// peer id == "to_peer_id" field /// Action field should be 'announce' #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct MiddlemanAnswerToPeer { pub action: Announc...
29.588235
65
0.705765
d75dfb72054b89fb5c6e0a3479abc1accc606f23
23,909
// Copyright 2018 Parity Technologies (UK) Ltd. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, mer...
37.950794
98
0.542515
5b6e7b9946df667e771b10edde99a219367aafae
21,756
extern crate base64; extern crate md5; use std::collections::HashMap; use std::io::Write; use super::bucket::Bucket; use super::command::Command; use chrono::{DateTime, Utc}; use hmac::{Mac, NewMac}; use reqwest::header::{self, HeaderMap, HeaderName, HeaderValue}; use reqwest::{Client, Response}; use sha2::{Digest, S...
34.921348
99
0.544448
0157b4c5369ac861ade8d7d322db57543ad4a84a
8,582
use bevy::{ core::FixedTimestep, diagnostic::{Diagnostics, FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, prelude::*, window::PresentMode, }; use rand::{thread_rng, Rng}; const BIRDS_PER_SECOND: u32 = 10000; const GRAVITY: f32 = -9.8 * 100.0; const MAX_VELOCITY: f32 = 750.; const BIRD_SCALE: f32 = ...
31.321168
92
0.516546
cc80b6308165fca5446bec3a863b609f8ae015e9
285
use config::Config; use git::Repository; use super::{Module, State}; pub(crate) trait ModuleProvider { fn new(config: &Config, repository: Repository) -> Self; fn get_mut_module(&mut self, _state: State) -> &mut dyn Module; fn get_module(&self, _state: State) -> &dyn Module; }
21.923077
64
0.701754
db0aeed1ea48f871bb85ea0533f42fa271c9213d
442
mod todotxt; fn main () { let mut tasks = ~[]; let t = ::todotxt::Task::create(~"some important task", 1); println(t.to_str()); tasks.push(t); let x = ::todotxt::Task::create(~"x some important task", 1); println(x.to_str()); tasks.push(x); println!...
20.090909
69
0.486425
71822a520a2f76af508bed9a653d71ba057522a4
1,177
use sqlx::{Pool, Postgres}; use crate::entities::Note; pub async fn insert_note(note: &Note, pool: &Pool<Postgres>) -> anyhow::Result<()> { sqlx::query!( r#" INSERT into notes (chat_id, note_id, note_content) VALUES ($1, $2, $3) ON CONFLICT (chat_id, note_id) DO UPDATE SET note_content = exclu...
21.796296
84
0.57774
4a3ac838958c5405538c3819edadf7e2daaa2fec
8,546
//! This module provides functions to parse PICA+ records. use crate::{Field, Occurrence, OccurrenceMatcher, Path, Subfield}; use nom::branch::alt; use nom::bytes::complete::{is_not, tag}; use nom::character::complete::{char, multispace0, one_of, satisfy}; use nom::combinator::{all_consuming, cut, map, opt, recognize...
28.774411
79
0.541423
9cf68cbd23e6da2f7200bf2c6c477e8f6bc252df
72,275
//! Source positions and related helper functions. //! //! Important concepts in this module include: //! //! - the *span*, represented by [`SpanData`] and related types; //! - source code as represented by a [`SourceMap`]; and //! - interned strings, represented by [`Symbol`]s, with some common symbols available stati...
34.949226
120
0.583106
7229e6ad07d7329a09967848275b9f91bf9565f5
2,078
#[derive(Debug)] pub struct PPURegisters { pub ppu_ctrl: u8, pub ppu_mask: u8, pub ppu_status: u8, pub oam_addr: u8, pub oam_data: u8, pub ppu_scroll: u8, pub ppu_addr: u8, pub ppu_data: u8, /// Contains the index of the last access, and if it was a write. pub(super) last_access...
26.641026
70
0.473532
08088ed86ab49e9e2e8b795d77e35391dc9b204b
8,089
use std::task::{Context, Poll}; use std::{convert::TryFrom, error::Error, future::Future, net, pin::Pin, time}; use bytes::Bytes; use derive_more::From; use futures_core::Stream; use serde::Serialize; use crate::http::body::{Body, BodyStream}; use crate::http::error::HttpError; use crate::http::header::{self, HeaderM...
29.630037
89
0.534924
29dc93bedf4e4218ffcc733d9b2e8be0f2007d50
2,254
use std::fmt::{Display, Formatter, Result, Debug}; use tui::{ layout::Corner, style::{Color, Modifier, Style}, text::Span, widgets::{Block, Borders, List, ListItem, ListState} }; #[derive(Clone, Debug)] pub enum Action { Copy, Edit, Delete } impl Display for Action { fn fmt(&self, f:...
24.769231
116
0.503106
0efe5a56436b5727aa16be01da4fcac05e65946c
6,885
//! Error Reporting for `impl` items that do not match the obligations from their `trait`. use crate::infer::error_reporting::nice_region_error::NiceRegionError; use crate::infer::lexical_region_resolve::RegionResolutionError; use crate::infer::{SubregionOrigin, Subtype, ValuePairs}; use crate::traits::ObligationCause...
38.25
149
0.530428
033e9f5203f7938655cf3270af0258ed754ad79b
3,200
use std::io; use std::sync::{ atomic::{AtomicBool, Ordering}, Arc, }; #[cfg(target_os = "windows")] mod windows; #[cfg(target_os = "windows")] pub use windows::{Event, Registrator, Selector, TcpStream}; #[cfg(target_os = "macos")] mod macos; #[cfg(target_os = "macos")] pub use macos::{Event, Registrator, Sele...
31.067961
111
0.634063
edd1e8bbe369abeafc592900b04eea370ee6a868
24,821
#![allow(unused_parens)] //! # Saliency API //! //! Many computer vision applications may benefit from understanding where humans focus given a scene. //! Other than cognitively understanding the way human perceive images and scenes, finding salient //! regions and objects in the images helps various tasks such as spe...
49.150495
247
0.753153
d59211cad2a5e37d0c19e9b713a7340486f80f12
287
use serde::{Deserialize, Serialize}; // tb_debate join tb_user #[derive(Deserialize, Serialize, Debug, Clone, Queryable)] pub struct Debate { pub id: i64, pub writer_id: i64, pub writer_name: String, pub subject: String, pub content: String, pub reg_utc: i64, }
22.076923
58
0.682927
2274fdf57aef53ae763c2a94335c344cd51d473d
806
use std::{cell::RefCell, sync::atomic}; #[cfg(feature = "hazard_ptr")] use nolock::hazard_ptr; #[cfg(feature = "hazard_ptr")] #[test] fn protect_boxed() { use std::sync::atomic::AtomicPtr; let initial_ptr = Box::into_raw(Box::new(RefCell::new(false))); let atom_ptr = AtomicPtr::new(initial_ptr); let...
21.783784
68
0.617866
de0e7d05332cc0edfc3cf452b12974dbe0a64d2d
33,624
// Copyright © 2019 Intel Corporation // // SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause // // Copyright © 2020, Microsoft Corporation // // Copyright 2018-2019 CrowdStrike, Inc. // // use kvm_ioctls::{NoDatamatch, VcpuFd, VmFd}; use std::os::unix::io::{AsRawFd, RawFd}; use std::result; use std::sync::Arc; #[cf...
35.245283
100
0.576374
ac644b87eb1bbdea821e46af5a510652e48c4438
2,877
//! Mocks for the rewards module. #![cfg(test)] use super::*; use frame_support::{construct_runtime, parameter_types, weights::constants::RocksDbWeight}; use sp_core::H256; use sp_runtime::{testing::Header, traits::IdentityLookup}; use sp_std::cell::RefCell; use std::collections::HashMap; use crate as rewards; pub ...
23.975
119
0.706986
ed67151755be983ad162b55d08390ade56602ce8
1,007
/* * 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. */ use common::PerfLogger; use lsp_types::{ notification::{Exit, Notification}, request::{Request, Shutdown}, }; use schema_do...
27.972222
67
0.718967
23a900f2c649e5a8acb35ab317f1c327ca876678
14,416
//! Schemes for instantiating a cluster of shards. use std::{ convert::TryFrom, error::Error, fmt::{Display, Formatter, Result as FmtResult}, iter::StepBy, ops::{Bound, RangeBounds, RangeInclusive}, }; /// Starting a cluster failed. #[derive(Debug)] pub struct ShardSchemeRangeError { kind: Sha...
28.490119
119
0.520117
ef145a82027f5d39d05614658c8f8c031e62c0b2
1,466
use glib::translate::*; #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct ButtonEvent(crate::Event); event_wrapper!(ButtonEvent, ClutterButtonEvent); event_subtype!( ButtonEvent, ffi::CLUTTER_BUTTON_PRESS // | ffi::GDK_DOUBLE_BUTTON_PRESS // | ffi::GDK_TRIPLE_BUTTON_PRES...
27.148148
62
0.480218
feecdd2c04e09fb8892b15b56013c775488f48ea
2,297
//! Elemental properties. use crate::internal::Float; /// Every element on the periodic table. #[derive(Clone, Copy, Debug, PartialEq, EnumString, Hash, Eq)] pub enum Element { /// Hydrogen H, /// Helium He, /// Boron B, /// Nitrogen N, /// Oxygen O, /// Fluorine F, ...
22.519608
86
0.451894
67e891f8c0b22c698e569d2add6c7ae37b461d7b
10,777
use std::cell::RefCell; use std::rc::Rc; use rand::Rng; use chunk::{print_error, Chunk, Value}; use vm::*; impl VM { /// Remove the top element from the stack. pub fn opcode_drop(&mut self, chunk: &Chunk, i: usize) -> i32 { if self.stack.len() == 0 { print_error(chunk, i, "drop requires on...
33.573209
103
0.46525
dee6907832ea1c974a8209571dfd186b8fa2e557
28,335
// This file is Copyright its original authors, visible in version control // history. // // This file is 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. // You may...
38.921703
272
0.729875
e29ecbb51c11ca01bc2d768cfc257402ec695ab8
6,075
#[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::DCOC_OFFSET_5 { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R,...
26.528384
64
0.533333
1dc4520344b7d085662630d8ecb724b18dd8af51
3,243
#![allow(clippy::module_inception)] #![allow(clippy::upper_case_acronyms)] #![allow(clippy::large_enum_variant)] #![allow(clippy::wrong_self_convention)] #![allow(clippy::should_implement_trait)] #![allow(clippy::blacklisted_name)] #![allow(clippy::vec_init_then_push)] #![allow(clippy::type_complexity)] #![allow(rustdo...
39.54878
251
0.756707
62e46b364a9f29a15ac2321580112f3228a20338
2,252
#[derive(Clone, Copy, PartialEq, Eq)] pub enum ScrollBehavior { Auto, Smooth, } impl Default for ScrollBehavior { fn default() -> Self { ScrollBehavior::Auto } } impl From<ScrollBehavior> for web_sys::ScrollBehavior { fn from(scroll_behaviour: ScrollBehavior) -> web_sys::ScrollBehavior { ...
31.277778
99
0.571492
effd4598b43a251c4e5670c83ed257d5062f2fab
1,025
#![crate_name = "uu_base64"] // This file is part of the uutils coreutils package. // // (c) Jordy Dickinson <jordy.dickinson@gmail.com> // (c) Jian Zeng <anonymousknight96@gmail.com> // // For the full copyright and license information, please view the LICENSE file // that was distributed with this source code. // #...
31.060606
94
0.731707
899c6304f8955b8f4a5de034c2a20c23c6bee4b4
3,862
use crate::*; use core::convert::TryFrom; #[derive(Debug)] pub struct EmbeddedPdv<'a> { pub identification: PdvIdentification<'a>, pub data_value_descriptor: Option<ObjectDescriptor<'a>>, pub data_value: &'a [u8], } #[derive(Debug, PartialEq)] pub enum PdvIdentification<'a> { Syntaxes { s_abst...
34.176991
101
0.515536
0357c0d8eca6c510ed712409acf38958137fe3a3
6,893
#[doc = "Reader of register IF"] pub type R = crate::R<u32, super::IF>; #[doc = "Reader of field `VMONAVDDFALL`"] pub type VMONAVDDFALL_R = crate::R<bool, bool>; #[doc = "Reader of field `VMONAVDDRISE`"] pub type VMONAVDDRISE_R = crate::R<bool, bool>; #[doc = "Reader of field `VMONALTAVDDFALL`"] pub type VMONALTAVDDFAL...
42.549383
99
0.618744
8a796dc8c9e9f4959d1e5ae5ee54d058957ec088
10,698
use crate::image::Image; pub use crate::prelude::*; use fltk_sys::menu::*; use std::{ ffi::{CStr, CString}, mem, os::raw, }; /// Creates a menu bar #[derive(WidgetExt, MenuExt, Debug)] pub struct MenuBar { _inner: *mut Fl_Menu_Bar, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Creates a m...
29.966387
95
0.543933
758250df1a4801e1aba90d730af531828137a356
486
#[macro_use] pub extern crate integra8; // regardless of the order the mod are defined in file // integra8 will run these components defined in other files // in lexicographical order mod b_test_mod; mod a_test_mod; // # Test main // Test main is required to setup the application entrypoint and bootstrap the test...
22.090909
93
0.753086
7a1e85bfd89797d7dfc48f0041317d226ebb86cf
2,219
use std::fmt::{self, Debug, Display, Formatter}; // https://dev.mysql.com/doc/dev/mysql-server/8.0.12/binary__log__types_8h.html // https://mariadb.com/kb/en/library/resultset/#field-types #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct TypeId(pub u8); macro_rules! type_id_consts { ($( pub const $...
29.986486
105
0.597566
2f6b2bb7abb1417885f548779f5f48b316958b6e
12,328
// Note these imports are only for testing, not required/linked for the library extern crate std; use std::collections::HashMap; use std::fs::File; use std::io::{BufRead, BufReader}; use std::vec::Vec; use std::{env, format, println}; use crate::*; pub const TV_LEN: usize = 1024; pub const ROUND_START: i64 = -97; pub...
31.773196
120
0.537638
e97db880120f39c5187f963b542de99645f83eb0
9,384
use crate::cli; use crate::command_prelude::*; use anyhow::{bail, format_err}; use cargo::core::dependency::DepKind; use cargo::ops::tree::{self, EdgeKind}; use cargo::ops::Packages; use cargo::util::CargoResult; use std::collections::HashSet; use std::str::FromStr; pub fn cli() -> App { subcommand("tree") ...
34.627306
95
0.523231
031ffb82c0d82c3b503c5f4bdb2f161daed91749
3,816
use farmanager_codegen::Langpack; use farmanager::basic; #[derive(Langpack, Copy, Clone)] #[langpack(name = "showcase")] #[language(code = "en", value = "English,English")] #[language(code = "ru", value = "Russian,Russian (Русский)")] pub enum Lng { #[msg(language = "en", value = "HelloRust: API Showcase...
34.071429
82
0.578092
1ac0a48713a2966257f10e90a98be68c4e844edb
48,543
// 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.150932
97
0.603568
ace748d107538b28e14639779cf08443807842ee
2,819
use super::Sharder; use data_types::{DatabaseName, DeletePredicate}; use mutable_batch::MutableBatch; use parking_lot::Mutex; use std::{collections::VecDeque, fmt::Debug, sync::Arc}; #[derive(Debug, Clone)] pub enum MockSharderPayload { MutableBatch(MutableBatch), DeletePredicate(DeletePredicate), } impl Mock...
24.513043
78
0.589571
79a94527a2f54de4a34ba43f0dd73c9c07e99c3c
3,157
mod view; mod token_receiver; mod internal; mod utils; mod owner; use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; use near_sdk::json_types::{U128, U64, WrappedTimestamp}; use near_sdk::{env, near_bindgen, AccountId, Balance, EpochHeight}; use std::collections::HashMap; #[global_allocator] static ALLOC:...
28.7
138
0.661387
febd770f8e0024ed0ad2a974825fbde55b7ff823
2,387
use anyhow::Result; use iota_crypto_preview::Kerl; use iota_signing_preview::IotaSeed; use crate::response::Input; use crate::Client; /// Builder to construct GetInputs API //#[derive(Debug)] pub struct GetInputsBuilder<'a> { seed: &'a IotaSeed<Kerl>, index: u64, security: u8, threshold: u64, } impl<...
25.666667
128
0.509845
3ad274167bcb6ba475d775b9a5956e4a7367a4c8
22,041
//! Pretty-printer based rewriting strategy. //! //! The basic idea here is to pretty-print the new AST, which gives text that is guaranteed to //! parse to the new AST (assuming the printer is correct), and then splice that text into the //! source in place of the old AST's text. //! //! It turns out that in many case...
35.607431
99
0.626469
e512badcad87de91a9ca7bdbdac5af0c486163de
12,368
use std::collections::{ BTreeMap, BTreeSet, HashMap, HashSet, btree_map, btree_set, hash_map, hash_set, }; use std::hash::Hash; use std::vec; use de; use bytes; /////////////////////////////////////////////////////////////////////////////// pub enum Error { SyntaxError, EndOfS...
26.540773
95
0.546491
9bc32014b58c0c3d096e9730896d708cf1249ba0
3,271
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 #![forbid(unsafe_code)] use anyhow::{ensure, format_err, Result}; use serde_json::Value; use std::collections::HashSet; use std::{ffi::OsStr, fmt, process::Stdio}; use tokio; #[derive(Clone)] pub struct Instance { peer_name: Stri...
25.755906
88
0.504433
18b9467cb1cacd37bf40ed3c54e82cb3cc2759af
15,978
use crate::entry::{Descriptor, Entry}; use crate::fdpool::FdPool; use crate::sys::entry_impl::OsHandle; use crate::virtfs::{VirtualDir, VirtualDirEntry}; use crate::wasi::{self, WasiError, WasiResult}; use std::borrow::Borrow; use std::collections::HashMap; use std::ffi::{self, CString, OsString}; use std::fs::File; us...
35.506667
109
0.561334
4aa738f961def082ae3ee3555fa889cc03174ae7
16,128
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. use std::io::{Error, ErrorKind, Read}; use std::path::Path; use std::{fs, io, process::Command}; use derive_new::new; use prost::Message; use prost_build::{protoc, protoc_include, Config, Method, Service, ServiceGenerator}; use prost_types::FileDescri...
29.922078
96
0.514633