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
72a6b4a9e525d4f1240b96eacfd52c7edae91840
2,098
// Copyright (c) The Dijets Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::experimental; use thiserror::Error; #[derive(Debug, Error)] #[error(transparent)] pub struct DbError { #[from] inner: anyhow::Error, } #[derive(Debug, Error)] #[error(transparent)] pub struct StateSyncError { ...
24.114943
77
0.617255
621cf2b403dd7f6205a2fee395f0bcc8ccc02a03
10,189
use cgmath::*; use winit::window::Window; use crate::{texture::Texture, Options}; use super::{app_state::AppContext, game_state, gpu_state}; // --------------------------------------------------------------------------------------------------------------------- #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Lc...
35.501742
120
0.526352
de60303c894a4ce77a399bbbf3dcf53890f5bc75
10,034
//! Set of all the operations supported by the zkSync network. use super::ZkSyncTx; use crate::ZkSyncPriorityOp; use anyhow::format_err; use serde::{Deserialize, Serialize}; use zksync_crypto::params::CHUNK_BYTES; mod change_pubkey_op; mod close_op; mod deposit_op; mod forced_exit; mod full_exit_op; mod noop_op; mod ...
36.754579
104
0.603249
e81c3bbd304311d66b99ae7e5d082c065bbb7fb0
4,723
use std::env; use proc_macro2::Span; use syn::parse::{Parse, ParseStream}; use syn::punctuated::Punctuated; use syn::Token; use syn::{Expr, ExprLit, ExprPath, Lit}; use tokio::fs; use tokio_sqlx::describe::Describe; use tokio_sqlx::Connection; /// Macro input shared by `query!()` and `query_file!()` pub struct Query...
28.281437
98
0.539911
eb6544f446c0ace6d05addf3f4333ddad6da52b8
176
use actix_web::web; use validator::Validate; use crate::errors::JkError; pub fn validate(data: &web::Json<impl Validate>) -> Result<(), JkError> { Ok(data.validate()?) }
19.555556
73
0.676136
89443d0a802ecff3918ef1840a5f5b6e56a92d4e
3,763
use crate::{Board, OptSq, Piece, Sq, SqLike, SqStatus, Team, SIZE}; const PATTERN: [[isize; 2]; 4] = [[1, 1], [-1, 1], [-1, -1], [1, -1]]; pub fn get_translations<S: SqLike>(board: &Board, from: Sq, team: Team, piece: Piece) -> Vec<S> { let mut vec = Vec::new(); let team = match board.find(from, Some(&team),...
27.467153
97
0.433431
ddb83dedcc0f007bebfbf9f7aaa4d8c1b77b7dea
635
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
35.277778
69
0.732283
91643e07ed005c1c18a1a85f371afc39bebc4f84
1,342
// 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 ...
22.366667
68
0.553651
0836a5422d12f2f15112af390827b093d061bd5a
1,071
// Test dropping an AioCb that hasn't yet finished. // This must happen in its own process, because on OSX this test seems to hose // the AIO subsystem and causes subsequent tests to fail #[test] #[should_panic(expected = "Dropped an in-progress AioCb")] #[cfg(all(not(target_env = "musl"), not(target_env = "u...
35.7
78
0.500467
0e46042c98f813b5087b81c7498d0191708e79f4
1,682
pub const BYTES_FOR_LENGTH_ENCODING: usize = 1; pub const CURVE_TYPE_LENGTH: usize = 1; pub const BLS12: u8 = 0x01; pub const BN: u8 = 0x02; pub const MNT4: u8 = 0x03; pub const MNT6: u8 = 0x04; pub const TWIST_TYPE_LENGTH: usize = 1; pub const TWIST_TYPE_M: u8 = 0x01; pub const TWIST_TYPE_D: u8 = 0x02; pub const SI...
30.035714
83
0.756243
f5696380e9f2296eb1cdf54c4249bc6c528bdf66
43,230
#![doc = "generated by AutoRust 0.1.0"] #![allow(unused_mut)] #![allow(unused_variables)] #![allow(unused_imports)] use crate::models::*; use reqwest::StatusCode; use snafu::{ResultExt, Snafu}; pub mod storage_insights { use crate::models::*; use reqwest::StatusCode; use snafu::{ResultExt, Snafu}; pub a...
49.349315
135
0.620495
690c8127a72737d30e3d65b5a9c9d800a3de5293
5,094
//! HTTP Server //! //! A `Server` is created to listen on a port, parse HTTP requests, and hand //! them off to a `Service`. //! //! There are two levels of APIs provide for constructing HTTP servers: //! //! - The higher-level [`Server`](Server) type. //! - The lower-level [`conn`](conn) module. //! //! # Server //! ...
30.502994
88
0.568316
e66c7980671d22139818381af73b6e7481abc46a
532
use eyros::{DB,Coord}; use async_std::prelude::*; type P = (Coord<f32>,Coord<f32>); type V = u64; type E = Box<dyn std::error::Error+Sync+Send>; #[async_std::main] async fn main() -> Result<(),E> { let mut db: DB<_,_,P,V> = eyros::open_from_path2( &std::path::PathBuf::from("/tmp/eyros.db") ).await?; let bb...
23.130435
51
0.588346
9bb72d576ea592aaebf5347ee39d7463a2e373dc
1,689
use std::borrow::Cow; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum SeparatorKind { Hard, Soft, } #[derive(Debug, Clone, Copy, PartialEq)] pub enum TokenKind { Word, /// the token is a stop word, /// meaning that it can be ignored to optimize size and performance or be indexed as a Word ...
23.136986
95
0.589106
2655563260d012ea00aea50f58e23a48110d8db2
4,745
use sp_core::{Pair, Public, sr25519}; use filecoin_bridge_runtime::{ AccountId, AuraConfig, BalancesConfig, GenesisConfig, GrandpaConfig, SudoConfig, TssConfig, SystemConfig, WASM_BINARY, Signature }; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_finality_grandpa::AuthorityId as GrandpaId; use sp_runt...
29.110429
94
0.698841
dd2cbb2eb407cd4a951d6def06fe6758393bcac0
9,889
use crate::avm1::activation::Activation; use crate::avm1::error::Error; use crate::avm1::object::TObject; use crate::avm1::property_decl::{define_properties_on, Declaration}; use crate::avm1::Object; use crate::avm1::{ScriptObject, Value}; use crate::context_menu; use crate::display_object::TDisplayObject; use gc_arena...
35.317857
99
0.557589
1e92c06d950d4e81f3ee6f81b647823939aa9ed9
2,331
// Copyright 2017 th0rex // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those...
31.931507
97
0.600172
140c682fd33927101826e7f2089879e4ad8658fc
1,998
use std::fmt; /// An enum of all possible tokens allowed by the /// [WebIDL grammar](https://heycam.github.io/webidl/#idl-grammar) A token in this case is a /// terminal, either a static string or regular expression based token. Note that not all possible /// simplifications are made such as converting the `True` and ...
18.330275
98
0.624625
ac001523d3aeb6d32a668e73acdeaa8ce8cc185a
41
pub mod scheduler; pub use scheduler::*;
13.666667
21
0.731707
e9e30615211667557288c4f53fa5a2210f7877af
2,613
use crate::{ azure_context::AzureContext, query_objects::medicine_levels_in_pregnancy::report::{ get_reports, get_reports_graph_from_reports_vector, Report, Reports, }, }; use anyhow::anyhow; use async_graphql::{Context, FieldResult, Object}; #[derive(Debug, Eq, Ord, PartialEq, PartialOrd)] pub str...
29.693182
98
0.574053
1c69cd5c42c96b8a9caa6b04394320c18ee33656
349
use std::io; use std::process; use rustventure::Config; fn main() { let config = Config::parse(); let stdin = io::stdin(); let mut input = stdin.lock(); let mut stdout = io::stdout(); if let Err(err) = rustventure::run(config, &mut input, &mut stdout) { eprintln!("Error: {}", err); ...
19.388889
73
0.567335
03153bedc6c35e98bf0373d2e573d421375cb676
5,750
// Test for Macro, exact same as usecase-recursive use mpstthree::binary::struct_trait::{end::End, recv::Recv, send::Send, session::Session}; use mpstthree::functionmpst::close::close_mpst; use mpstthree::functionmpst::fork::fork_mpst; use mpstthree::meshedchannels::MeshedChannels; use mpstthree::role::broadcast::RoleB...
31.081081
99
0.633217
e600ccc4d414bbbd6143e283d6ea08c020dea4da
38,080
use syntect::highlighting::Style as SyntectStyle; use unicode_segmentation::UnicodeSegmentation; use crate::config::INLINE_SYMBOL_WIDTH_1; use crate::config::Config; use crate::delta::DiffType; use crate::delta::State; use crate::features::line_numbers::{self, SideBySideLineWidth}; use crate::features::side_by_side::...
34.091316
101
0.495089
ff8187d8716224e74a383349f7affd1a3cb0eca9
15,111
use crate::{ pos::Spanned, syntax_pos::{BytePos, Span, DUMMY_SP}, }; use rustc_hash::FxHashMap; use std::{ cell::{Ref, RefCell}, rc::Rc, sync::Arc, }; /// Stores comment. /// /// ## Implementation notes /// /// Methods uses `(&self)` instead of `(&mut self)` for some reasons. Firstly, /// this is s...
26.053448
85
0.554761
fc8f51a32282c12dcc09639b50fe42dd56cecad8
1,265
// Copyright (c) 2021 jmjoy // Helper is licensed under Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 // THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIE...
23
88
0.585771
dd015398eb2423220baee63bd76849caa4ba58c9
24,741
//! Implementation for writing delta checkpoints. use arrow::datatypes::Schema as ArrowSchema; use arrow::error::ArrowError; use arrow::json::reader::Decoder; use chrono::Datelike; use log::*; use parquet::arrow::ArrowWriter; use parquet::errors::ParquetError; use parquet::file::writer::InMemoryWriteableCursor; use se...
35.39485
169
0.565741
39127b9703b6b0fcc0695b5ff966663792b85577
192
// build-fail // compile-flags: -C debug-assertions #![deny(arithmetic_overflow, const_err)] fn main() { let _x = -1_i32 >> -1; //~^ ERROR: this arithmetic operation will overflow }
19.2
55
0.65625
87a7afcf1071c4004b23c5217625b756fec5ac28
2,291
use lightning_codegen::KernelSpecializationPolicy; use std::env; use std::path::PathBuf; use crate::prelude::*; #[derive(Debug)] pub struct Config { pub driver: DriverConfig, pub worker: WorkerConfig, } impl Config { pub fn new(driver: DriverConfig, worker: WorkerConfig) -> Self { Self { driver, ...
25.455556
88
0.552597
2925941b93089ad0fdb8d2433f4acea63575fe50
10,859
/* AUTO GENERATED FILE DO NOT EDIT codegen/elder_dragon_quicktype.py */ use serde::{Serialize, Deserialize}; extern crate serde_json; use self::serde_json::Error; pub fn serialize(json: &str) -> Result<AlistarJson,Error>{ serde_json::from_str(json) } use std::collections::HashMap; #[de...
23.453564
89
0.628143
874f883b8695f78b53ba771b547ca5632ae2a6c1
4,075
use clap::Parser; use serde_json::Value; use std::fs::{self, File}; use std::io::{ErrorKind, Write}; use substrate_api_client::extrinsic::log::info; #[derive(Debug, Parser)] #[clap(version = "1.0")] pub struct Config { /// URL address of the node RPC endpoint for the chain you are forking #[clap(long, default_...
30.639098
102
0.57227
d7514f31551917de81a872d85d73594888ab1b65
10,955
// Copyright lowRISC contributors. // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 use anyhow::{anyhow, bail, Result}; use directories::{BaseDirs, ProjectDirs}; use erased_serde::Serialize; use log::LevelFilter; use nix::sys::signal::{self, Signal}; us...
39.692029
100
0.638065
ef55eba4041a6c472a3ef1012e2d235c69687dc0
773
use oysterpack_smart_near::near_sdk::serde::{Deserialize, Serialize}; use std::fmt::{self, Display, Formatter}; use std::ops::Deref; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] #[serde(crate = "oysterpack_smart_near::near_sdk::serde")] pub struct TransferCallMessage(pub String); impl Deref for Transfer...
22.735294
69
0.648124
8ab59073536a336ce8b6eb1ceb201d123e1da660
417
use bytes::{Buf, BufMut}; pub(crate) fn peek_u8<B: Buf>(b: &B) -> Option<u8> { b.chunk().get(0).copied() } pub(crate) fn get_ssh_string<B: Buf>(mut b: B) -> Vec<u8> { let len = b.get_u32(); let mut s = vec![0u8; len as usize]; b.copy_to_slice(&mut s[..]); s } pub(crate) fn put_ssh_string<B: BufMu...
21.947368
61
0.561151
72e93aaf62defa226027a723af426ef87e98b27a
7,035
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
29.070248
86
0.59403
e572fe21e9ebafa1cb8e246a08c3e51d190934f1
1,173
// vim: tw=80 #[cfg(target_os = "freebsd")] fn main() { use std::env; use std::path::PathBuf; println!("cargo:rerun-if-env-changed=LLVM_CONFIG_PATH"); println!("cargo:rustc-link-lib=geom"); let bindings = bindgen::Builder::default() .header("/usr/include/libgeom.h") .header("/usr/i...
34.5
78
0.638534
2938ae706e4901d2e14c65011a57a8dcf6f7a71d
362
use ndarray::prelude::*; use ndarray::ShapeError; pub struct Flat<'a> { pixels: ArrayView2<'a, u8>, } impl<'a> Flat<'a> { pub fn new(pixels: &[u8]) -> Result<Flat, ShapeError> { Ok(Flat { pixels: ArrayView2::from_shape((64, 64), pixels)?, }) } pub fn view(&self) -> ArrayVi...
19.052632
62
0.535912
509310a296a63503f80a3bba16d0f65a63bf4a61
23,039
// Copyright (c) The Diem Core Contributors // Copyright (c) The Move Contributors // SPDX-License-Identifier: Apache-2.0 //! This module contains verification of usage of dependencies for modules and scripts. use move_binary_format::{ access::{ModuleAccess, ScriptAccess}, binary_views::BinaryIndexedView, ...
40.277972
130
0.603021
fc23f8608393cc89fb7cf4005a38a8763b372ec2
3,972
// Copyright (c) 2018 Chef Software Inc. and/or applicable contributors // // 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 r...
33.948718
97
0.530715
feef12e97ebab4f0b44993e2a03bd39ca91c41a1
4,896
use std::sync::{ atomic::{AtomicUsize, Ordering}, Arc, }; use robespierre_cache::{Cache, CacheConfig, CommitToCache, HasCache}; use robespierre_events::{Authentication, Connection, RawEventHandler}; use robespierre_http::{Http, HttpAuthentication}; use robespierre_models::{autumn::AutumnTag, channel::ReplyData...
34.237762
99
0.426675
b9b23e44bfaa91ee009b6329aff076be0e495049
519
use std::io; use std::io::Read; use regex::Regex; fn main() { let mut input = String::new(); io::stdin().read_to_string(&mut input).unwrap(); let re = Regex::new(r"(?m)^(\d+)x(\d+)x(\d+)$").unwrap(); println!("{}", re.captures_iter(&input).map(|x| { let (l, w, h): (u32, u32, u32) = (x[1].parse...
32.4375
111
0.504817
1d8ca5c34edf133a322de29d360d88cd64e5ad40
487
use std::{iter, str::from_utf8}; use strip_ansi_escapes::strip; pub fn ansi_len(s: &str) -> usize { from_utf8(&strip(s.as_bytes()).unwrap()) .unwrap() .chars() .count() } pub fn pad_to_size(s: &str, rows: usize, columns: usize) -> String { s.lines() .map(|l| [l, &str::repeat("...
24.35
72
0.533881
f55c3d6c765c9b061798276859961977b9fc1fc2
406
//TODO 5、调用不安全的函数或者方法 unsafe fn dangerous() { println!("do something dangerous"); } fn foo() { let mut num = 5; let r1 = &num as *const i32; let r2 = &mut num as *mut i32; unsafe { println!("*r1 = {}", *r1); println!("*r2 = {}", *r2); } } fn main() { unsafe { dange...
15.615385
39
0.482759
03a64edffc88bfcca9a3c9a8abb9f85985c4455e
3,959
pub mod vcx; pub mod connection; pub mod issuer_credential; pub mod utils; pub mod proof; pub mod credential_def; pub mod schema; pub mod credential; pub mod disclosed_proof; pub mod wallet; pub mod logger; pub mod return_types_u32; use std::fmt; /// This macro allows the VcxStateType to be /// serialized within serd...
27.880282
88
0.544077
39ab6cfb1b9c88a2e3ecb7a2d93cd29568e004e4
181
use catalysa_parser::tokenizer::Tokenizer; fn main() { let mut tokenizer = Tokenizer { code: "1 + 2;".to_string() }; println!("{:?}", tokenizer.tokenize()); }
18.1
43
0.58011
f7b9c3c9e4901bb44a4bf47a0be13ba47d63a932
8,444
//! Provides access to the symbolserver config use std::env; use std::fs; use std::path::{Path, PathBuf}; use std::borrow::Cow; use std::io::BufReader; use num_cpus; use serde_yaml; use url::Url; use rusoto::Region; use chrono::Duration; use log::LogLevelFilter; use super::{Result, ResultExt, ErrorKind}; use super::u...
31.390335
90
0.568451
878c60d74d22ad4dc6ef97cb82ac253b3946088f
3,716
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{block::Block, common::Payload}; use anyhow::ensure; use libra_crypto::hash::HashValue; use libra_types::validator_verifier::ValidatorVerifier; use serde::{Deserialize, Serialize}; use std::fmt; /// RPC to get a chain of bl...
29.728
94
0.547632
69092c1af55d46ada6a7e1310dad5fb02ea403b8
50,972
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
34.984214
126
0.536412
014ea07f8e7d28b3753a11f213acd15271e5fb37
4,004
use crate::trans::TRANS; use crate::CONFIG; use anyhow::Context; use futures::TryFutureExt; use once_cell::sync::Lazy; use regex::Regex; use reqwest::header::*; use reqwest::{Client, Response}; use std::borrow::Cow; use std::io::Write; use std::time::SystemTime; use tempfile::NamedTempFile; pub static HOST: Lazy<&'sta...
29.226277
182
0.56019
22acf1d1378fc0d662d5dbac45cf0e621c46c70d
10,074
#![allow(non_snake_case, non_upper_case_globals)] #![allow(non_camel_case_types)] //! Serial peripheral interface/Inter-IC sound //! //! Used by: stm32g431, stm32g441 #[cfg(not(feature = "nosync"))] pub use crate::stm32g4::peripherals::spi::Instance; pub use crate::stm32g4::peripherals::spi::{RegisterBlock, ResetValue...
32.496774
71
0.608497
330e1211af2b9e979f9af8400c1607d7fafcd229
243
// functions5.rs // Make me compile! Execute `rustlings hint functions5` for hints :) fn main() { let answer = square(3); println!("The answer is {}", answer); } fn square(num: i32) -> i32 { let result = num * num; result }
17.357143
68
0.604938
ef747638e33ec83459e4b9f9fe02d052e41c4812
50,465
// Format list-like macro invocations. These are invocations whose token trees // can be interpreted as expressions and separated by commas. // Note that these token trees do not actually have to be interpreted as // expressions by the compiler. An example of an invocation we would reformat is // foo!( x, y, z ). The t...
31.699121
100
0.528208
e976a70613a81f68ca57817f3f0b80713171703f
5,872
use cgmath::Vector3; use num::{FromPrimitive, ToPrimitive}; use std::{any::type_name, fmt, marker::PhantomData}; pub const NINTENDO_VENDOR_ID: u16 = 1406; pub const JOYCON_L_BT: u16 = 0x2006; pub const JOYCON_R_BT: u16 = 0x2007; pub const PRO_CONTROLLER: u16 = 0x2009; pub const JOYCON_CHARGING_GRIP: u16 = 0x200e; pu...
25.530435
100
0.565565
b92a8e494c388b02c63ce8bef0fed326a3fc836a
966
use std::fmt; pub struct Route<'r> { pub path: Vec<&'r str>, } #[derive(Debug, Clone)] pub struct MalformedRouteError(String); impl fmt::Display for MalformedRouteError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "This route is malformed: {}", self.0) } } impl std::error::...
24.15
68
0.593168
f73956ceee0d562e623dfea07d7979f8c3b92f6f
15,415
use std::fmt::{Debug, Display}; use std::io; use std::str::FromStr; use console::Term; use theme::{get_default_theme, TermThemeRenderer, Theme}; use validate::Validator; /// Renders a simple confirmation prompt. /// /// ## Example usage /// /// ```rust,no_run /// # fn test() -> Result<(), Box<std::error::Error>> { //...
30.048733
107
0.527473
e6e9625c17c7a30e8f30e2790d5871653e283343
142
mod ppm; mod ray; mod vec; pub use ppm::render; pub use ray::Ray; pub use vec::Vec3; pub const WIDTH: u32 = 400; pub const HEIGHT: u32 = 300;
15.777778
28
0.683099
48b5cacc5aaa81469f3fa8966a7bc6dfe4101f0b
70
pub mod client; pub mod clock; pub mod notifications; pub mod server;
14
22
0.771429
8fcd1f7c77b5bda0ff809634a729a627f4f87824
10,103
use crate::component::entry::TxEntry; use crate::pool::TxPool; use ckb_error::{Error, InternalErrorKind}; use ckb_snapshot::Snapshot; use ckb_types::{ core::{ cell::{ resolve_transaction, OverlayCellProvider, ResolvedTransaction, TransactionsProvider, }, Capacity, Cycle, Transact...
31.77044
98
0.560824
69a3947df2b5bf4b132aaed334fd8f9231800755
80,252
// 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 ...
28.888409
100
0.483801
8fd42ed498012ef2f137cfd15cff9df0126ba8fd
3,229
// Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0. #![cfg(not(tarpaulin_include))] //! ECIES function wrappers. #![cfg(feature = "wedpr_f_ecies_secp256k1")] extern crate jni; use wedpr_l_utils::traits::Ecies; use crate::get_result_jobject; #[cfg(feature = "wedpr_f_ecies_secp256k1")] use crat...
26.040323
90
0.630845
8975faec487657dafa81c3ff2530e6cceff56766
21,206
//! Dataflow analyses are built upon some interpretation of the //! bitvectors attached to each basic block, represented via a //! zero-sized structure. use rustc_index::bit_set::BitSet; use rustc_index::vec::Idx; use rustc_middle::mir::{self, Body, Location}; use rustc_middle::ty::{self, TyCtxt}; use rustc_target::ab...
32.725309
100
0.559842
dd6bd8f11f618071c15db5349c2e444297b9e58a
533
// option1.rs // Make me compile! Execute `rustlings hint option1` for hints // you can modify anything EXCEPT for this function's sig fn print_number(maybe_number: Option<u16>) { println!("printing: {}", maybe_number.is_some()) } fn main() { print_number(Some(13)); print_number(Some(99)); let mut n...
23.173913
62
0.596623
eb6f60ec7d72710a40909bbb74e48f445a7c313a
9,939
#[cfg(test)] mod prf_test; use std::convert::TryInto; use std::fmt; use hmac::{Hmac, Mac, NewMac}; use sha1::Sha1; use sha2::Digest; use sha2::Sha256; type HmacSha256 = Hmac<Sha256>; type HmacSha1 = Hmac<Sha1>; use crate::cipher_suite::CipherSuiteHash; use crate::content::ContentType; use crate::curve::named_curve:...
32.165049
95
0.648254
484586b941e9dbc9734e07899a7ff36812e8fa6d
4,951
#![allow(dead_code)] use crate::common::configuration::{Block0ConfigurationBuilder, NodeConfigBuilder}; use crate::common::file_utils; use chain_core::mempack; use chain_impl_mockchain::{block::Block, fee::LinearFee, fragment::Fragment}; use jormungandr_lib::{ interfaces::{Block0Configuration, NodeConfig, NodeSecr...
32.788079
93
0.551808
87cc1f40f44279a6cb6258065bf806a4756b1c2f
2,473
// Copyright 2020 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT use super::cli::Subcommand; use super::paramfetch::{get_params_default, SectorSizeOpt}; use fil_types::SectorSize; /// Converts a human readable string to a u64 size. fn ram_to_int(size: &str) -> Result<SectorSize, String> { // TODO t...
34.830986
96
0.577841
1d56f3410d0188700d656cc1550451baeed9f2e1
1,448
use std::net::IpAddr; use std::{io, time}; pub struct Pinger { addr: IpAddr, } impl Pinger { ///Creates new instance /// ///`addr` - Destination address for the ICMP packet. pub const fn new(addr: IpAddr) -> Self { Self { addr, } } #[inline] pub fn ping(&se...
24.542373
87
0.542818
e2957bcbe391aa579ff4f6357b5b1063474c6561
159
use serde::Serialize; #[derive(Serialize)] pub struct PDFMetadata { pub name: String, pub preview_filenames: Vec<String>, pub page_count: i32 }
14.454545
39
0.691824
ccb6ce1831257de57311926905b222514f84d238
2,293
use specs::*; use server::component::event::TimerEvent; use server::consts::timer::DELAYED_MESSAGE; use server::protocol::server::ServerMessage; use server::protocol::ServerMessageType; use server::types::FutureDispatcher; use server::utils::*; use server::*; use component::*; use config::*; use std::time::Duration; ...
27.297619
89
0.692543
e87b6af321f34ac3f96816bfce15b352dbc07d7c
17,001
#![allow(clippy::not_unsafe_ptr_arg_deref)] extern crate kaiju_core as core; extern crate kaiju_vm_core as vm_core; extern crate libc; #[macro_use] extern crate lazy_static; use core::error::*; use std::collections::HashMap; use std::ffi::CString; use std::mem::{size_of, transmute}; use std::ptr::{copy_nonoverlapping...
30.197158
100
0.520205
dd25df27b42d2a59dbecac80f2a766fe2c130a96
2,546
#[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::ADDR2L { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &...
25.46
66
0.534171
e27ab0fe11b2aa51c2ade6081779f0924e909abe
19,533
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use super::{ node::{LeafNode, LeafValue, SparseMerkleNode}, AccountStatus, ProofRead, SparseMerkleTree, }; use libra_crypto::{ hash::{CryptoHash, TestOnlyHash, SPARSE_MERKLE_PLACEHOLDER_HASH}, HashValue, }; use libra_ty...
36.716165
100
0.60257
7a0e11c4b2284c906bd926ec32451b0e34f670a5
1,895
use gdnative::export::StaticallyNamed; use gdnative::prelude::*; pub(crate) fn run_tests() -> bool { let mut status = true; status &= test_variant_call_args(); status } pub(crate) fn register(handle: InitHandle) { handle.add_class::<VariantCallArgs>(); } struct VariantCallArgs; impl NativeClass fo...
22.831325
83
0.587335
916180e36838f5fa29b09726d853e7831baac216
1,139
//! Crate that provides helpers and/or middlewares for Tide //! related to structured logging with slog. #![cfg_attr(docrs, feature(doc_cfg))] #![warn( nonstandard_style, rust_2018_idioms, future_incompatible, missing_debug_implementations )] mod per_request_logger; mod request_logger; #[cfg(feature =...
27.119048
98
0.687445
7afe8c0da93873f8d7c55a9bba5b2ce96b707922
1,602
use i2p::sam_options::{ I2CPOptions, I2CPRouterOptions, I2CPTunnelInboundOptions, I2CPTunnelOutboundOptions, SAMOptions, }; use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, Serialize, Deserialize)] pub struct Tunnel { pub in_length: u8, pub in_quantity: u8, pub in_backup_quantity: u...
34.826087
100
0.569288
d54694d7b3c8d04a0536c1f9e0970124e642da64
2,430
use piston_window::*; use quick_xml::de::from_reader; use serde::Deserialize; use std::fs::File; use std::io::BufReader; #[derive(Debug, Clone)] pub struct SpriteSheet { atlas: TextureAtlas, texture: G2dTexture, } #[allow(dead_code)] impl SpriteSheet { pub fn new( assets_folder: &str, spri...
28.588235
97
0.601235
fe1b2e051c479f190c375fe6747ddcb4d4380c24
668
// 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 ...
31.809524
68
0.684132
ace8b30000a2e9dbe950cbf708adb05533401b2f
640
//use hdk::prelude::*; mod current_games; mod game; mod game_move; mod signal; mod turn_based_game; mod mixin; /*#[hdk_extern] pub fn validate(op:Op) -> ExternResult<ValidateCallbackResult>{ match op{ Ok(ValidateCallbackResult::Valid) } }*/ pub use current_games::{get_my_current_games, remove_my_curren...
21.333333
110
0.746875
21742c70ca53f2d71c1afbabb687a5dfa80ad0ae
12,069
pub mod v1 { //! ## Merkle Tree //! //! #### 算法说明 //! - 哈希树。 //! //! #### 应用场景 //! - 数据检验,存在性证明。 //! //! #### 实现属性 //! - <font color=Red>×</font> 多线程安全 //! - <font color=Green>√</font> 无 unsafe 代码 use ring::digest::{Context, SHA1}; use std::cell::RefCell; use std...
29.508557
94
0.391582
e27809d36ec443808e3c6df7c8a7934f97b8f2e6
4,114
// Copyright 2019 The druid Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
31.891473
114
0.652649
1838b257c6c000c59350f7f4ee95d0f38eebcda7
25,501
#[cfg(target_arch = "x86_64")] use std::borrow::BorrowMut; #[cfg(target_arch = "riscv64")] use core::borrow::BorrowMut; /// A the functions herein are for transposing an 8x8 bit matrix, that /// is presumed to be a block of a larger matrix of size m x n bytes. Brief /// description of the functions: /// /// transpose8...
34.092246
142
0.49998
ff8832aa15f907f316caf73dca56da4eebbeec1c
3,088
use log::{info, warn}; use rust_gpu_tools::Device; use std::collections::HashMap; use std::env; lazy_static::lazy_static! { static ref CORE_COUNTS: HashMap<String, usize> = { let mut core_counts : HashMap<String, usize> = vec![ // AMD ("gfx1010".to_string(), 2560), // Th...
35.090909
111
0.533355
87ac91f25b7778da0332405bd93f66d7fa71da51
6,230
//! Helpful functionality around the `serde_cbor` crate. use alloc::vec::Vec; use serde::Serialize; #[cfg_attr(tarpaulin, skip)] mod error; pub use error::CborError; /// The result type for the `cbor` module. pub type Result<T> = core::result::Result<T, CborError>; /// Serializes an object into CBOR. pub fn encode(...
33.315508
78
0.604334
33272fb0e686901aaf5a328cf38e063c2d4c4d65
607
#[cfg(all(not(feature = "neon-sys"), not(feature = "napi")))] compile_error!("The Neon runtime must have at least one of the `neon-sys` or `napi` backends enabled."); use cfg_if::cfg_if; cfg_if! { if #[cfg(feature = "napi")] { pub mod napi; } } cfg_if! { if #[cfg(feature = "neon-sys")] { ...
27.590909
104
0.584843
33542e7a15acd81384fb6709d7a2249960d6ecf7
75,583
use crate::config::{ AnchorPackage, Config, ConfigOverride, Manifest, ProgramDeployment, ProgramWorkspace, WithPath, }; use anchor_client::Cluster; use anchor_lang::idl::{IdlAccount, IdlInstruction}; use anchor_lang::{AccountDeserialize, AnchorDeserialize, AnchorSerialize}; use anchor_syn::idl::Idl; use anyhow::{an...
33.005677
100
0.560443
080b5c4f3cb5a14622317142c33cf236f41ace65
1,330
mod with_atom_left; mod with_big_integer_left; mod with_empty_list_left; mod with_external_pid_left; mod with_float_left; mod with_heap_binary_left; mod with_list_left; mod with_local_pid_left; mod with_local_reference_left; mod with_map_left; mod with_small_integer_left; mod with_subbinary_left; mod with_tuple_left; ...
26.6
71
0.693985
dba422ca5c63adb061568d481412b78884c80956
496
#[derive(Debug)] pub struct PerilGroup { pub id: String, pub desc: String, pub peril_ids: Vec<String> } impl PerilGroup { pub fn new(id: &str, desc: &str, group_ids: Vec<&str>) -> PerilGroup { let mut id_buffer = Vec::new(); for i in group_ids { id_buffer.push(Str...
20.666667
74
0.524194
5031395c2498e74e6c975939a8918e38b22dcb95
2,641
//! Delimiter bindings to provide byte offsets for all stages. use super::conf::Configuration; /// Delimiters struct to store the input/output separators /// for all stages of a MapReduce lifecycle. Once created, /// this structure should be considered immutable. #[derive(Debug)] pub struct Delimiters { input: Vec...
29.021978
78
0.568345
28a4c9b8c2cdf08d83751d1a380a2c588c022596
626
mod certificate_signing_request; pub use self::certificate_signing_request::CertificateSigningRequest; #[cfg(feature = "api")] pub use self::certificate_signing_request::{ReadCertificateSigningRequestOptional, ReadCertificateSigningRequestResponse}; mod certificate_signing_request_condition; pub use self::certificate...
44.714286
146
0.886581
016d2b88fd8cf5b5a0c25bcf62c3aa2d270688cc
1,928
#![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AesKeyGenParams)] #[derive(Debug, Clone, PartialEq, Eq)] #[doc = "The `AesKeyGenParams` dictionary."] #[doc = ""] #[doc = "*This API requires ...
37.076923
99
0.587656
feccd3bad8bde9e4b08b5862fca41a39fdb325b8
2,457
// Copyright Cryptape Technologies LLC. // // 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 ...
30.333333
75
0.599105
75344e9a91c4fafebadb54e7356c0a129f4679fa
1,898
//! Core I/O traits and combinators when working with Tokio. //! //! A description of the high-level I/O combinators can be [found online] in //! addition to a description of the [low level details]. //! //! [found online]: https://tokio.rs/docs/getting-started/core/ //! [low level details]: https://tokio.rs/docs/going...
27.911765
81
0.672813
29b891da38851505ca736bd5e1d4164ea0ee42d0
2,728
use std::io::Read; use std::str::FromStr; use crate::reader::*; use xml::reader::{EventReader, XmlEvent}; use super::{Paragraph, Table}; impl FromXML for Header { fn from_xml<R: Read>(reader: R) -> Result<Self, ReaderError> { let mut parser = EventReader::new(reader); let mut header = Self::defau...
37.888889
99
0.536657
01da64620e08f20f998dc22d961f2d29bfad6297
3,727
// preludes use chrono::prelude::*; use opencv::prelude::*; // opencv imports use opencv::core; use opencv::core::Point; use opencv::core::Rect; use opencv::core::Scalar; use opencv::imgcodecs::imwrite; use opencv::imgproc::put_text; use opencv::imgproc::rectangle; use opencv::imgproc::FONT_HERSHEY_PLAIN; use opencv::...
29.816
104
0.541723
d9ab29335491654686c87148aea026440fa24b0e
4,550
use crate::trace::{ compressed_reader::{CompressedReader, CompressedReaderState}, trace_reader::{resolve_trace_name, TraceReaderBackend}, trace_stream::{substreams_data, Substream, TraceStream}, }; use capnp::{message, message::ReaderOptions, serialize, serialize_packed::read_message}; use std::{ collec...
28.797468
88
0.587253
1e36f5287a77d9ebb8fe8fef617b5ecf8b6afb6c
669
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
29.086957
68
0.660688
03bec52bec17e458fec0aa488becdf72fa719be9
25,684
// Copyright (c) 2020 rust-mysql-simple contributors // // 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. All files in the project carrying such notice may not ...
34.802168
101
0.48427
d9cc353c66af6655164f59a5f90179e40d93d9a6
19,991
use std::error; use std::ffi::{self, CStr}; use std::fmt; use std::io; use std::str; use curl_sys; /// An error returned from various "easy" operations. /// /// This structure wraps a `CURLcode`. #[derive(Clone, PartialEq)] pub struct Error { code: curl_sys::CURLcode, extra: Option<Box<str>>, } impl Error { ...
32.139871
83
0.651543
d68661f87e92312fc7e7b489862c655e7234d9e4
5,107
//! RTC driver use kernel::common::cells::OptionalCell; use kernel::common::regs::{ReadOnly, ReadWrite}; use kernel::common::StaticRef; use kernel::hil::time::{self, Alarm, Frequency, Time}; #[repr(C)] struct RtcRegisters { ctl: ReadWrite<u32, Control::Register>, // Event flags evflags: ReadWrite<u32, Ev...
25.923858
96
0.58273
76625d3f918cd355b84305a1862c13c71b013f44
7,207
import dvec::{dvec, extensions}; export filename; export filemap; export span; export file_substr; export fss_none; export fss_internal; export fss_external; export codemap; export expn_info; export expn_info_; export expanded_from; export new_filemap; export new_filemap_w_substr; export mk_substr_filename; export loo...
29.416327
77
0.611766
0e7cbd26d119b6987d0551756c687db6a508a600
1,424
use std::collections::HashMap; use crate::{string::ObjString, value::Value}; #[derive(Debug)] pub struct Table { pub entries: HashMap<u64, (*const ObjString, Value)>, } impl Table { pub fn new() -> Self { Table { entries: HashMap::new(), } } pub fn set(&mut self, key: *co...
24.982456
72
0.518961
6abd29f359bdac75aca889555f75095beb707686
802
#![no_std] #![no_main] #![feature(custom_test_frameworks)] #![test_runner(blog_os::test_runner)] //test会生成main函数,调用crate::test_runner #![reexport_test_harness_main = "test_main"] // 给test生成的main函数改个名字,在_start()调用它 use core::panic::PanicInfo; use blog_os::println; #[no_mangle] pub extern "C" fn _start() -> ! { ...
19.095238
79
0.649626