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 |
|---|---|---|---|---|---|
0912ee724b6b223d4842326e0f107884a4906d2e | 3,137 | extern crate clap;
extern crate sha1;
extern crate sha2;
use clap::{App, Arg};
use sha2::Digest;
use std::fs;
use std::fs::read_dir;
use std::io::{self, Read};
use std::path::Path;
fn calculate_hash(data: &[u8], sha: usize) -> String {
let strout: String = match sha {
224 => format!("{:x}", sha2::Sha224::d... | 33.731183 | 88 | 0.48167 |
5df9d0222b4bb22ca10e9e3f1cbcd343c5ce1b7c | 623 | // 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 ... | 29.666667 | 68 | 0.725522 |
c1c4e7a2486fab0f20c4fd8e9c5cd7d6598c47be | 3,135 | /*
* MIT License
*
* Copyright (c) 2021 Luiz Ferraz
*
* 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, modi... | 31.35 | 81 | 0.627432 |
71af51a31d22145cabe22c01569891fb34b2abdc | 4,298 | //! Structures used in Tendermint RPC
mod block_results;
use parity_scale_codec::Decode;
use serde::{Deserialize, Serialize};
use crate::{ErrorKind, Result, ResultExt, Transaction};
use chain_core::init::config::InitConfig;
use chain_core::tx::data::TxId;
use chain_core::tx::fee::LinearFee;
use chain_core::tx::{TxAux... | 34.66129 | 105 | 0.577943 |
ccbe0a5592c8cbf87a57d3fe57ecf8b2b8d215bb | 6,159 | // Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any late... | 39.480769 | 104 | 0.73145 |
f7bae99b9e20653c91191a4d5bd83da02c3135ff | 313 | #[test]
fn roundtrip_compound_type() {
use hdf5::H5Type;
#[derive(H5Type)]
#[repr(C)]
struct Compound {
a: u8,
b: u8,
}
let dt = hdf5::Datatype::from_type::<Compound>().unwrap();
let td = dt.to_descriptor().unwrap();
assert_eq!(td, Compound::type_descriptor());
}
| 20.866667 | 62 | 0.571885 |
c19f8b92949875ad0b8afe8e938212744471171b | 4,943 | #[doc = "Reader of register IMR2"]
pub type R = crate::R<u32, super::IMR2>;
#[doc = "Reader of field `WRDY`"]
pub type WRDY_R = crate::R<bool, bool>;
#[doc = "Reader of field `ENDTX`"]
pub type ENDTX_R = crate::R<bool, bool>;
#[doc = "Reader of field `TXBUFE`"]
pub type TXBUFE_R = crate::R<bool, bool>;
#[doc = "Reader ... | 47.07619 | 86 | 0.600445 |
3a2c535d946940419db6ffc07ed32f03c919d05d | 3,029 | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
smoke_test_environment::new_local_swarm,
test_utils::diem_swarm_utils::load_validators_backend_storage,
};
use diem_config::config::NodeConfig;
use diem_global_constants::CONSENSUS_KEY;
use diem_key_manager::{
d... | 39.337662 | 100 | 0.72004 |
ac3deae342f61d5d0c01620f3d38306c9d2d2d87 | 2,660 |
#[macro_use]
extern crate serde_derive;
/// Ethabi
mod abi;
/// The Jsonrpc Client
pub mod client;
/// Encryption algorithm library
pub mod crypto;
/// Error of tool
pub mod error;
/// Transaction protobuf code
pub mod protos;
/// Request and Response type
pub mod rpctypes;
pub use crate::abi::{decode_input, decode_... | 27.708333 | 96 | 0.593609 |
2668328dc47e19930b4baef881e411eeedece0f7 | 8,650 | // This file is part of linux-support. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-support/master/COPYRIGHT. No part of linux-support, including this file, may be copied, modified, propagated, or ... | 20.94431 | 394 | 0.664393 |
4b7509b9cac7c1fc5122df0601e17502fc21dff3 | 390 | mod pyrocord;
use crate::pyrocord::client::client;
use pyo3::prelude::*;
#[pymodule]
fn init_models(_py: Python, _m: &PyModule) -> PyResult<()> {
Ok(())
}
#[pymodule]
fn pyrocord(py: Python, m: &PyModule) -> PyResult<()> {
m.add_class::<client::Client>()?;
let submod = PyModule::new(py, "models")?;
... | 18.571429 | 60 | 0.607692 |
e4c8ff97c1b05ce1953aab2ff7bea091ef10c5d1 | 17,983 | // 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... | 39.350109 | 96 | 0.626203 |
080fee4d47f807e19d7f8304f3f1cfba8874c5f8 | 6,874 | use crate::{from_lsp, state::LanguageServerSnapshot, to_lsp, FilePosition};
use lsp_types::{CompletionContext, CompletionItem, DocumentSymbol};
use mun_syntax::{AstNode, TextSize};
/// Computes the document symbols for a specific document. Converts the LSP types to internal
/// formats and calls [`LanguageServerSnapsh... | 35.071429 | 99 | 0.570119 |
eb4aea5eaacf0c1cd53d72bd920c103bbde19903 | 15,813 | use clap::{App, Arg, ArgGroup, ArgMatches};
use cluster_test::{
aws::Aws,
cluster::Cluster,
deployment::{DeploymentManager, SOURCE_TAG, TESTED_TAG},
effects::{Effect, Reboot},
experiments::{Experiment, RebootRandomValidators},
health::{DebugPortLogThread, HealthCheckRunner, LogTail},
log_pru... | 35.375839 | 97 | 0.546386 |
3ae9c668a829f8bb07c14280e5990bcef3ba1663 | 999 | use language::operations::{make_param_doc, Operation, ParamInfo};
pub struct ReplaceScenePropsOp;
const DOC : &str = "Replaces all instances of specified scene prop type with another scene prop type. Commonly used to replace damaged walls with their intact versions during normal visits to castle scenes. Can only be c... | 28.542857 | 294 | 0.634635 |
dd45b6ed278e8cca74fb7c03f08b0e89a08e1868 | 941 | // Tests that array sizes that depend on const-params are checked using `ConstEvaluatable`.
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
#[allow(dead_code)]
struct ArithArrayLen<const N: usize>([u32; 0 ... | 30.354839 | 91 | 0.683316 |
dd3a3dcf9e7362e7894168797174860ff573d3fc | 5,290 | use crate::utils::{ConfigurationResult, ServerError};
use clingo::{parse_term, Part, Symbol, TruthValue};
use serde_json::Value;
pub fn json_to_configuration_result(val: &Value) -> Result<ConfigurationResult, ServerError> {
match val {
Value::String(s) => Ok(ConfigurationResult::Value(s.clone())),
... | 35.266667 | 99 | 0.44707 |
7a834657f0f836a2a1691a578651d058d56ad604 | 7,249 | use std::{
fs::OpenOptions,
io::{stdin, stdout, BufWriter, Read, Write},
path::Path,
};
use clap::{arg_enum, App, AppSettings, Arg};
#[cfg(not(feature = "wasm"))]
use grass::{from_path, from_string, Options, OutputStyle};
// TODO remove this
arg_enum! {
#[derive(PartialEq, Debug)]
pub enum Style ... | 30.586498 | 112 | 0.472755 |
1e04c851827252f6ce0f3d27a9ed31e01cc3092a | 2,310 | use boostvoronoi::builder as VB;
use boostvoronoi::BvError;
type I = i32;
type F = f64;
fn almost_equal(x1: F, x2: F, y1: F, y2: F) -> bool {
let delta = 0.0001;
assert!(F::abs(x1 - x2) < delta, "{} != {}", x1, x2);
assert!(F::abs(y1 - y2) < delta, "{} != {}", y1, y2);
(F::abs(x1 - x2) < delta) && (F... | 37.258065 | 66 | 0.546753 |
f7c27cfb275f411d71ae7effbf1649848a3c809d | 725 |
//!
//! Default windows for easy setup and event handling.
//! Currently [glutin](https://crates.io/crates/glutin/main.rs) for cross-platform desktop
//! and canvas using [wasm-bindgen](https://rustwasm.github.io/wasm-bindgen/) for web.
//!
#[doc(hidden)]
pub mod frame_input;
#[doc(inline)]
pub use frame_input::*;
#... | 29 | 90 | 0.684138 |
71ebec40d80d2bfc01e213a06ff4205534fe991a | 279 | use pulldown_cmark::{html, Parser};
#[test]
fn test_parse_markdown() {
let markdown = include_str!("demo.md");
let parser = Parser::new(markdown);
let mut html_output = String::new();
html::push_html(&mut html_output, parser);
println!("{}", html_output);
}
| 25.363636 | 46 | 0.655914 |
5dedc72265baa664dd2768e2dbcd2bcdd2804af6 | 530 | // Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::contract_event::{ContractEvent, EventWithProof};
use lcs::test_helpers::assert_canonical_encode_decode;
use proptest::prelude::*;
proptest! {
#[test]
fn event_lcs_roundtrip(event in any::<ContractEvent>()) {
... | 27.894737 | 84 | 0.728302 |
e63e5d7038285835bcf16a78daf40af58c05e98b | 4,108 | use super::super::{Language, TimeUnit};
#[derive(Default)]
pub struct Russian;
impl Russian {
fn accusative(&self, tu: TimeUnit) -> &'static str {
use TimeUnit::*;
match tu {
Nanoseconds => "наносекунду",
Microseconds => "микросекунду",
Milliseconds => "ми... | 41.494949 | 81 | 0.527264 |
756914345ab6d991e559ee754dab54e92eb3891d | 9,480 | use brotli;
use bzip2::read::BzDecoder;
use std::io::{self, ErrorKind};
use std::vec::Vec;
use std::{
convert::TryInto,
io::{Cursor, Read, Seek},
};
use binread::{BinRead, BinResult, ReadOptions};
#[derive(Debug, Eq, PartialEq)]
pub enum CompressorType {
Bz2,
Brotli,
}
const fn as_u32_be(array: &[u8;... | 34.347826 | 100 | 0.589768 |
3a457f3e04b24d6da76400e9220d90a9bc9330c1 | 2,078 | /*
* EVE Swagger Interface
*
* An OpenAPI for EVE Online
*
* OpenAPI spec version: 1.3.8
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
/// GetStatusOk : 200 ok object
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct GetStatusOk {
... | 19.603774 | 87 | 0.646776 |
147347a75abe8264f04a1f140240ae809fb7189d | 21,829 | // 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 ... | 37.766436 | 98 | 0.558569 |
e67c2b62a5d01816330be907f06cdcb806d02cc7 | 3,742 | // Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
crate::model::{
actions::{Action, ActionKey, ActionSet, DiscoverAction},
component::{
Component, ComponentInstance, I... | 35.301887 | 98 | 0.556654 |
e87c33d1b09dd42d6e688b0e079a7760817b4a36 | 18,487 | use crate::utils::{implements_trait, is_entrypoint_fn, is_type_diagnostic_item, return_ty, span_lint};
use if_chain::if_chain;
use itertools::Itertools;
use rustc_ast::ast::{AttrKind, Attribute};
use rustc_data_structures::fx::FxHashSet;
use rustc_hir as hir;
use rustc_lint::{LateContext, LateLintPass};
use rustc_middl... | 35.146388 | 119 | 0.538487 |
6a1114d92a90bc70c0cb39e3771bbec1487bc66f | 6,776 | //! The `bank_forks` module implments BankForks a DAG of checkpointed Banks
use hashbrown::{HashMap, HashSet};
use solana_metrics::counter::Counter;
use solana_runtime::bank::Bank;
use solana_sdk::timing;
use std::ops::Index;
use std::sync::Arc;
use std::time::Instant;
pub struct BankForks {
banks: HashMap<u64, A... | 33.215686 | 89 | 0.574233 |
90c4ac87ee0cd2b2243349286d8e39fd4ea75b21 | 60,179 | // This file was generated by gir (https://github.com/gtk-rs/gir @ 58cffd4)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
extern crate gstreamer_sys;
extern crate shell_words;
extern crate tempdir;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of... | 53.444938 | 144 | 0.652836 |
1a592666d46d19cfd460c1f893028f3ff59f360b | 14,980 | //! A custom kubelet backend that can run [waSCC](https://wascc.dev/) based workloads
//!
//! The crate provides the [`WasccProvider`] type which can be used
//! as a provider with [`kubelet`].
//!
//! # Example
//! ```rust,no_run
//! use kubelet::{Kubelet, config::Config};
//! use kubelet::store::oci::FileStore;
//! u... | 34.279176 | 101 | 0.599466 |
ed6d45ffc2a9e4a2283cdfe4cc73672545e7be6d | 4,151 | use std::{cmp::Ordering, fmt, hash, ptr::NonNull};
/// A pointer for accessing data of a specific type.
///
/// See [documentation](https://developer.apple.com/documentation/swift/unsafepointer).
#[repr(transparent)]
pub struct UnsafePointer<T> {
inner: NonNull<T>,
}
impl<T> Clone for UnsafePointer<T> {
#[inl... | 22.559783 | 94 | 0.582992 |
e5b8ab05c8fe115c84b18e50bdbb864202dfe917 | 3,120 | use crate::{command::Commands, renderer::Renderer, virtual_dom::Html};
use log::info;
use std::{cell::Ref, cell::RefCell, fmt, rc::Rc};
use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::spawn_local;
struct State<Model, Message> {
model: Model,
html: Html<Message>,
}
impl<Model, Message> State<Model, Mes... | 28.108108 | 97 | 0.574038 |
ef78881dd1d4cd9de34b95ffaaec516be5934685 | 1,298 | // This file is part of network. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/network/master/COPYRIGHT. No part of predicator, including this file, may be copied, modified, propagated, or distributed exc... | 30.904762 | 379 | 0.751156 |
71fa2202c452c1732ff6fc7015b39333318d4a5e | 1,076 | use std::os::raw::c_void;
use std::ptr::null;
pub mod ffi {
extern {
pub fn sg_imgui_wrap_init(ctx: *mut super::SgImGui);
pub fn sg_imgui_wrap_discard(ctx: *mut super::SgImGui);
pub fn sg_imgui_wrap_draw(ctx: *mut super::SgImGui);
}
}
#[repr(C)]
#[derive(Debug)]
pub struct SgImGui {
... | 19.563636 | 63 | 0.565985 |
56953aaf60b1088b6d0f2970b20ac996c3be765d | 107 | // compile-flags: -Z parse-only
// error-pattern: unterminated double quote string
fn main() {
"
}
| 10.7 | 50 | 0.64486 |
bb035dfd8e0a1cbacb9108eda34bdddde8ba23b6 | 15,833 | //! Import from an another json format logic.
extern crate serde_json;
use serde::{Deserialize, Serialize};
use std::io::{BufReader, Read};
use vrp_pragmatic::format::problem::*;
use vrp_pragmatic::format::{FormatError, Location};
mod hre {
use super::*;
#[derive(Clone, Debug, Deserialize, Serialize)]
p... | 34.645514 | 117 | 0.507169 |
f784c2604f3b5387f2a60ef9deb65013bbf5a14e | 28,768 | // Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/// This module tests pkg-resolver's resolve keeps working when
/// MinFs is broken.
use {
fidl::endpoints::{Proxy, RequestStream, ServerEnd},
fidl... | 40.347826 | 100 | 0.618152 |
fbca8921e2d7ec218c24a13d4c66689919793744 | 6,260 | //! Block watcher for efficient `get_latest_block`.
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc, Mutex,
};
use futures::{prelude::*, stream::Fuse, try_ready};
use tokio::{spawn, sync::watch};
use super::snapshot::BlockSnapshot;
/// Block watcher error.
#[derive(Debug, Fail)]
pub enum WatchError {
... | 29.952153 | 98 | 0.519169 |
61dc3a7e3a2d36ed83fb6a2e6df9208f71157c67 | 198,291 | #[doc = "Register `PH_INTEN` reader"]
pub struct R(crate::R<PH_INTEN_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<PH_INTEN_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<PH_INTEN_SPEC>> for R {
#[inline(always)]
fn from(reader: ... | 61.907899 | 709 | 0.651653 |
035b222e6ce62073fc38e1194584f029c4236a88 | 2,001 | // 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 ... | 32.274194 | 79 | 0.611694 |
678ee9b0afc6b503313bc388f10f4909302df585 | 15,176 | // Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
//! An implementation of x25519 elliptic curve key pairs required for
//! [Diffie-Hellman key
//! exchange](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange)
//! in the Libra project.
//!
//! This is an API for [Ellipt... | 35.792453 | 118 | 0.66961 |
891522cc24f7e1d08159c0f1713b35bf13dfbbc3 | 55,781 | // This file contains code from external sources.
// Attributions: https://github.com/wasmerio/wasmer/blob/master/ATTRIBUTIONS.md
use crate::translator::{
type_to_irtype, FuncEnvironment as BaseFuncEnvironment, GlobalVariable, TargetEnvironment,
};
use cranelift_codegen::cursor::FuncCursor;
use cranelift_codegen::... | 36.080854 | 99 | 0.574335 |
e557953b796b09edb59a261851ebf7eafedbf281 | 27,703 | // This file is lightly modified from project_variables.rs from cargo-generate
// source: https://github.com/cargo-generate/cargo-generate
// version: 0.9.0
// license: MIT/Apache-2.0
//
use crate::generate::{config::Config, ParamMap, TomlMap, PROJECT_NAME_REGEX};
use anyhow::{anyhow, Result};
use regex::Regex;
u... | 30.987696 | 162 | 0.520954 |
79f8844295a6c826b0df1e397c3bdd1da9a57228 | 18,385 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// All possible error types for this service.
#[non_exhaustive]
#[derive(std::fmt::Debug)]
pub enum Error {
/// <p>This engine is not compatible with the voice that you have designated.
/// Choose a new voice that is compatible wi... | 56.743827 | 173 | 0.659559 |
1ca4a7379b8ed03e4fe23398f57e708c7597625f | 9,864 | #![allow(dead_code)]
use libc::*;
use super::ffi::*;
use std::ptr::NonNull;
#[repr(transparent)]
pub struct Context(NonNull<udev>);
impl Context {
pub fn new() -> Option<Self> {
unsafe { NonNull::new(udev_new()).map(Self) }
}
pub fn as_ptr(&self) -> *mut udev { self.0.as_ptr() }
pub unsafe fn from_ptr(p: *mut u... | 34.25 | 107 | 0.649635 |
2f95adb8a31200c0061d974355231f887dbebea0 | 277 | use unicode_truncate::Alignment;
use unicode_truncate::UnicodeTruncateStr;
#[test]
fn main() {
let (rv, w) = "你好吗".unicode_truncate(5);
assert_eq!(rv, "你好");
assert_eq!(w, 4);
let rv = "你好吗".unicode_pad(5, Alignment::Left, true);
assert_eq!(rv, "你好 ");
}
| 21.307692 | 57 | 0.631769 |
7681e20fe4ab42547a3dd2ae39e45199e336732b | 7,339 | //! Parks the runtime.
//!
//! A combination of the various resource driver park handles.
use crate::loom::sync::{Arc, Mutex, Condvar};
use crate::loom::sync::atomic::AtomicUsize;
use crate::park::{Park, Unpark};
use crate::runtime::time;
use crate::util::TryLock;
use std::sync::atomic::Ordering::SeqCst;
use std::tim... | 32.473451 | 85 | 0.562474 |
8733f7de244385f6bdb550c87ae27b3b2a40e70a | 255 | use super::*;
use crate::Hash256;
impl TestRandom for Hash256 {
fn random_for_test(rng: &mut impl RngCore) -> Self {
let mut key_bytes = vec![0; 32];
rng.fill_bytes(&mut key_bytes);
Hash256::from_slice(&key_bytes[..])
}
}
| 23.181818 | 56 | 0.615686 |
def49253b9102865c1b2e311d043e51c2ea7669d | 4,063 | use svm_types::{BytesPrimitive, Sections, TemplateAddr};
use crate::{GlobalState, StorageResult};
/// A [`GlobalState`] wrapper, enriched with utility methods to access and
/// modify [`Template`](svm_types::Template) data.
pub struct TemplateStorage {
/// The internal [`GlobalState`] instance used to access the ... | 29.875 | 93 | 0.610879 |
38d21c25b43696421edd92d2f54fccb7b0a2f6d1 | 6,534 | use crate::Error;
use algebra::{bytes::ToBytes, to_bytes, ToConstraintField};
use r1cs_core::{ConstraintSynthesizer, ConstraintSystemRef, SynthesisError};
use crypto_primitives::{CommitmentScheme, FixedLengthCRH};
use crate::{
constraints::{plain_dpc::execute_proof_check_gadget, Assignment},
dpc::plain_dpc::{... | 39.6 | 94 | 0.690695 |
f48bf523fea357fd1b845e5e1ab1ca7dbdfd2e61 | 1,286 | // Autogenerated from KST: please remove this line if doing any edits by hand!
extern crate kaitai_struct;
extern crate rust;
use kaitai_struct::KaitaiStruct;
use rust::DefaultEndianExprInherited;
#[test]
fn test_default_endian_expr_inherited() {
if let Ok(r) = DefaultEndianExprInherited::from_file("src/endian_e... | 44.344828 | 81 | 0.674961 |
5d51fc3983415547f312c85d4dc9c9e56c3953a8 | 12,534 | use std::ops::{Add, Sub};
use std::time::{Duration, SystemTime};
use std::default::Default;
use std::thread;
use redis;
use rand::{thread_rng, Rng};
use scripts::{LOCK, UNLOCK, EXTEND};
use errors::{RedlockResult, RedlockError};
use util;
#[derive(Debug)]
enum RequestInfo<'a> {
Lock,
Extend { resource_value: &... | 31.492462 | 96 | 0.50008 |
c1c62854e945e0bfeada21ea9c60cbd0a9450a3d | 1,388 | extern crate weathergov;
use std::{thread, time};
use std::env;
fn main() {
if let Some(station) = env::args().nth(1) {
println!("{}", current_weather(&station));
} else {
println!("Please specify station.");
}
}
pub fn current_weather(station: &str) -> String {
// Gets the current t... | 32.27907 | 92 | 0.512248 |
89edee13a255f35247bb3b309cc282cc6b09401a | 1,748 | use crate::service_actor::{ServiceActor, ServiceActorContext};
use crate::{RoomActor, Server};
use actix::dev::channel::channel;
use actix::{Addr, Arbiter, Context};
use actix_web::Result;
use stateroom::{StateroomService, StateroomServiceFactory};
const MAILBOX_SIZE: usize = 16;
pub struct ServerState {
pub room... | 29.627119 | 88 | 0.567506 |
f491e685f5a6002d114b5daf02b31133731fcaae | 5,300 | use ethane::rpc::{self, Rpc};
use ethane::types::{Bytes, PrivateKey, TransactionRequest, H160, H256, U256};
use rand::Rng;
use serde::de::DeserializeOwned;
use serde_json::Value;
use std::fmt::Debug;
use std::path::Path;
use std::process::Command;
use std::str::FromStr;
use tiny_keccak::{Hasher, Keccak};
mod spin_up;... | 28.494624 | 103 | 0.620189 |
8f560e35ad8ee8dba85bf222b38043d999d89599 | 644 | // Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
fidl_fuchsia_io2::{self as fio2},
lazy_static::lazy_static,
};
// TODO(https://fxbug.dev/71901): remove aliases once the routing lib has a s... | 33.894737 | 87 | 0.709627 |
878faf2072bf6006df143a166088b2158f260a76 | 4,629 | // Copyright 2018 Developers of the Rand project.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
/... | 38.256198 | 93 | 0.600562 |
c118515f1f04ff205f315cf5110b2afbcb410680 | 22,091 | // 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... | 32.296784 | 110 | 0.553845 |
db2567a889e19844e2004866424e8edfd8b9e6e4 | 1,214 | use std::io::{self, Read};
use clap::{Arg, App};
mod day1;
mod day2;
mod day3;
mod day4;
mod util;
fn main() -> io::Result<()> {
let matches = App::new("aoc2020")
.arg(Arg::with_name("day")
.long("day")
.required(true)
.takes_value(true))
.arg(Arg::with_name(... | 25.829787 | 54 | 0.478583 |
eb0a8ddc0bdea55b65be6c4e918c4670987f718f | 2,665 | //!
//! The transaction data, which is sent between Zandbox, Zargo, and front-ends.
//!
pub mod error;
pub mod msg;
use serde::Deserialize;
use serde::Serialize;
use zksync_types::tx::PackedEthSignature;
use zksync_types::tx::ZkSyncTx;
use zksync_types::TokenLike;
use self::error::Error;
use self::msg::Msg;
use cra... | 28.351064 | 104 | 0.604128 |
14ef07c8c1ab1711becdabbdd549362ad1d19766 | 129 | extern crate log;
extern crate naia_derive;
pub mod behavior;
pub mod protocol;
mod shared;
pub use shared::get_shared_config;
| 14.333333 | 34 | 0.790698 |
8a1ab6c2f50569fe9ed43f62cef042b38430d3be | 3,254 | #![no_std]
extern crate atsamd_hal as hal;
pub use hal::atsamd21g18a::*;
use hal::prelude::*;
pub use hal::*;
use gpio::{Floating, Input, Output, Port, PushPull};
use hal::clock::GenericClockController;
use hal::sercom::{I2CMaster5, PadPin, SPIMaster3};
use hal::time::Hertz;
define_pins!(
/// Maps the pins to t... | 27.576271 | 82 | 0.603565 |
118ba1711191b3f086b9fe5dc73efb62c9d92ba4 | 2,170 | // force-host
#![feature(plugin_registrar, rustc_private)]
#![feature(box_syntax)]
#[macro_use] extern crate rustc;
#[macro_use] extern crate rustc_session;
extern crate rustc_driver;
extern crate syntax;
use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass};
use rustc_driver::plugin::Registry;
use rust... | 29.324324 | 89 | 0.627189 |
1c9ed126251e930c49a751f7ccdb229ec56ca897 | 3,866 | use std::sync::{Arc, Mutex};
use cubesql::CubeError;
#[cfg(build = "debug")]
use log::trace;
use neon::prelude::*;
use tokio::sync::oneshot;
use crate::utils::bind_method;
type JsAsyncChannelCallback = Box<dyn Fn(Result<String, CubeError>) + Send>;
pub struct JsAsyncChannel {
callback: JsAsyncChannelCallback,
}... | 28.850746 | 92 | 0.589498 |
5b2e998c451a6f20578b9225a6c57491a31ade8d | 18,656 | use alloc::boxed::Box;
use alloc::format;
use alloc::string::String;
use alloc::vec::Vec;
use core::any::Any;
use core::cmp::min;
use arrayref::array_ref;
use crate::math::vector::Vector;
use crate::rsp::rsp::RSP;
use crate::rsp::rsp_assembler::{E, GPR, RSPAssembler, VR};
use crate::rsp::spmem::SPMEM;
use crate::test... | 36.155039 | 200 | 0.560838 |
ffbf6b93cca441e256e4fd540222d4515ad1b1ad | 1,348 | use disn::CONFIG;
use std::time::Duration;
use tokio::time::sleep;
mod helpers;
#[tokio::test]
async fn did_api_works() {
let endpoint = helpers::spawn_app().await;
sleep(Duration::from_millis(1000)).await;
let client = reqwest::Client::new();
// Act
let response = client
.post(format!("{... | 26.96 | 64 | 0.579377 |
012e0ec9e3167f0249cab827a174bd230933167d | 3,386 | use rafx::render_feature_extract_job_predule::*;
use super::{
ExtractedSpriteData, SpritePrepareJob, SpriteRenderNode, SpriteRenderNodeSet,
SpriteStaticResources,
};
use rafx::assets::AssetManagerRenderResource;
use rafx::base::slab::RawSlabKey;
pub struct SpriteExtractJob {}
impl SpriteExtractJob {
pub ... | 34.55102 | 100 | 0.601595 |
f9dc0fce09fc0550502c0ac86971b4d9e59ed8b3 | 13,412 | #[doc = "Reader of register LSR"]
pub type R = crate::R<u32, super::LSR>;
#[doc = "Receiver Data Ready. LSR\\[0\\]
is set when the RBR holds an unread character and is cleared when the UART1 RBR FIFO is empty.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RDR_A {
#[doc = "0: The UART1 rec... | 39.563422 | 566 | 0.616836 |
1ad3a8a15c6522be632d0a59fbc8920ac4f4a3ff | 3,668 | use super::driver::*;
use super::XlsxError;
use quick_xml::events::Event;
use quick_xml::Reader;
use std::{io, result};
use structs::DefinedName;
use structs::Spreadsheet;
use structs::WorkbookView;
use structs::Worksheet;
const FILE_PATH: &str = "xl/workbook.xml";
pub(crate) fn read<R: io::Read + io::Seek>(
arv... | 39.021277 | 89 | 0.512268 |
1d371453c1c9707f2bb48be05933c5622e114b0c | 1,975 | //! Progress-Bar implementation.
/// Progress-bar structure.
pub struct ProgressBar {
/// Graphics.
pb: indicatif::ProgressBar,
/// Current value.
count: usize,
/// Total target value.
total: usize,
}
impl ProgressBar {
/// Construct a new instance.
#[inline]
#[must_use]
pub fn... | 24.6875 | 121 | 0.53519 |
2238861f13b14d60b5c2f784e377cce15aa0e0cc | 3,982 | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use move_package::BuildConfig;
pub mod base;
pub mod experimental;
pub mod package;
pub mod sandbox;
/// Default directory where saved Move resources live
pub const DEFAULT_STORAGE_DIR: &str = "storage";
/// Default directory for bui... | 28.647482 | 104 | 0.650427 |
08bf83096c9fc9d04bb22a2e33fbf322bbb7a639 | 492 | use rlua::prelude::*;
pub mod git;
pub mod log;
pub mod markdown;
pub mod tera;
pub mod diff;
#[cfg(feature = "tantivy_bindings")]
pub mod tantivy;
// Dummy modules
#[cfg(not(feature = "tantivy_bindings"))]
pub mod tantivy {
pub fn init(_: &rlua::Lua) -> rlua::Result<()> { Ok(()) }
}
pub fn init(lua: &Lua) -> L... | 17.571429 | 61 | 0.579268 |
28bdfc362a99d2e59c2744528f9c1b60b530b306 | 2,039 | #![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
use lexer::Lexer;
use stmt::Stmt;
use expr::Expr;
use token::*;
#[derive(Debug)]
pub struct Parser {
lex: Lexer
}
impl Parser {
pub fn new(lex: Lexer) -> Parser {
Parser {
lex
}
}
fn skipNewLine(&mut ... | 27.931507 | 145 | 0.495341 |
71cfb170bf6aa37adcf426d280deec067e6ba0c3 | 850 | // run-pass
// compile-flags: -Zdrop-tracking
// Based on addassign-yield.rs, but with drop tracking enabled. Originally we did not implement
// the fake_read callback on ExprUseVisitor which caused this case to break.
#![feature(generators)]
fn foo() {
let _y = static || {
let x = &mut 0;
*{
... | 20.238095 | 95 | 0.429412 |
38972aad8bef285d05af6373776d6ddaed05fe52 | 237 | //TODO While in debug mode allow for a snapshot of the program to be created?
//TODO Should there be a separate debugging runtime?
//TODO For now the compiler will have a hta binary creator and the runtime will have a hta binary reader.
| 59.25 | 105 | 0.780591 |
8a96a577c501f99638521624ea51aef2a20b9f26 | 7,279 | /*
* Copyright 2020 Fluence Labs Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | 34.827751 | 151 | 0.566699 |
2291316118bee2131c79b302f929f08ba481ff35 | 5,372 | use std::collections::HashMap;
use std::collections::VecDeque;
fn main() {
let prog = std::fs::read_to_string("input.txt")
.unwrap()
.trim()
.split(',')
.map(|x| x.parse::<i64>().unwrap())
.collect::<Vec<i64>>();
let mut computers : Vec<Computer> = Vec::new();
... | 28.273684 | 77 | 0.364296 |
647cdbc8667434d147d736d3cb690210aaabc36c | 97 | use crate::compound_state::*;
use std::rc::Rc;
pub type Connection = (Rc<CompoundState>, char);
| 19.4 | 48 | 0.701031 |
bb87d7e0c2ab4f264471f3b555f29df268f439af | 6,486 | use dominator::{clone, html, Dom};
use std::rc::Rc;
use utils::prelude::*;
use super::state::*;
use crate::{
hebrew_buttons::HebrewButtons,
overlay::handle::OverlayHandle,
tooltip::{
callbacks::TooltipErrorCallbacks,
state::{
Anchor, ContentAnchor, MoveStrategy, State as Tooltip... | 46.661871 | 121 | 0.388375 |
21703e00a23a13b7a3b32d29afdbdae4bdda4528 | 65,603 | //! A module for working with processes.
//!
//! This module is mostly concerned with spawning and interacting with child
//! processes, but it also provides [`abort`] and [`exit`] for terminating the
//! current process.
//!
//! # Spawning a process
//!
//! The [`Command`] struct is used to configure and spawn process... | 31.815228 | 101 | 0.573099 |
1c80f5770423b363e2fb7b52ea6ddb386d54c946 | 97 | #![cfg(test)]
#![allow(dead_code)]
pub mod common;
pub mod constants;
pub mod random_generator;
| 13.857143 | 25 | 0.721649 |
abfcfe0d36f2aa0bf1862b35d419f2a9033d7f44 | 2,033 | // 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 ... | 26.402597 | 75 | 0.584358 |
8fec2e7b106935ce85a8c531663756ea86c2deb1 | 448 | use scale_info::TypeInfo;
use crate::*;
pub trait DemocracyGovernanceDelegate<T: SystemConfig, Proposal, Balance> {
fn propose(origin: OriginFor<T>, proposal: Proposal, value: Balance) -> DispatchResult;
}
#[cfg_attr(feature = "std", derive(Debug))]
#[derive(Clone, Encode, Decode, PartialEq, TypeInfo)]
pub struct Li... | 29.866667 | 88 | 0.754464 |
03a47f5a6d0b7113f18957d7eea75b0242100351 | 11,452 | // Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0
use aptos_types::transaction::{
ExecutionStatus, Module, SignedTransaction, Transaction, TransactionStatus,
};
use language_e2e_tests::{
account::AccountData, compile::compile_script, current_function_name, executor::FakeExecutor,
};
use move_deps::... | 30.620321 | 97 | 0.613255 |
9c90b433c8c439a852692f869b942cd54dd52e6d | 2,038 | struct R2cf {
n1: i64,
n2: i64,
}
// This iterator generates the continued fraction representation from the
// specified rational number.
impl Iterator for R2cf {
type Item = i64;
fn next(&mut self) -> Option<i64> {
if self.n2 == 0 {
None
} else {
let t1 = self.... | 23.159091 | 73 | 0.500981 |
87abca49873df5d7f5810ecd7148e1216e7b6215 | 4,261 | mod ticket {
/// We will begin our journey of building our own JIRA clone defining the cornerstone of
/// JIRA's experience: the ticket.
/// For now we want to limit ourselves to the essentials: each ticket will have a title
/// and a description.
/// No, not an ID yet. We will get to that in due t... | 53.936709 | 118 | 0.635766 |
cc892fd589eb7da77506a86d744dab42c697bc82 | 10,099 | // The following code is from (scipr-lab's zexe)[https://github.com/scipr-lab/zexe] and thanks for their work
use crate::{
bytes::{FromBytes, ToBytes},
fields::{Field, PrimeField, SquareRootField},
groups::Group,
UniformRand, Vec,
};
use core::{
fmt::{Debug, Display},
hash::Hash,
ops::{Add,... | 31.073846 | 113 | 0.621151 |
082da65f9bbc29e985499b334e71ad9a29a2bc27 | 1,157 | use crate::le::att::pdus::{PackablePDU, Response, UnpackablePDU};
use crate::le::att::Opcode;
use crate::le::connection::MTU;
use crate::PackError;
use core::convert::TryInto;
#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Debug, Hash)]
pub struct ExchangeMTURsp(pub MTU);
impl ExchangeMTURsp {
pub const BYT... | 29.666667 | 70 | 0.643907 |
fbd296f27d1129ece66e951f35ebbf1e43a9ed4c | 3,891 | mod conf;
mod nuconfig;
#[cfg(test)]
pub mod tests;
pub(crate) use conf::Conf;
pub(crate) use nuconfig::NuConfig;
use crate::commands::from_toml::convert_toml_value_to_nu_value;
use crate::commands::to_toml::value_to_toml_value;
use crate::prelude::*;
use directories::ProjectDirs;
use indexmap::IndexMap;
use log::tr... | 27.992806 | 99 | 0.603701 |
391b11c4d16c58441b6c2be53952baf642377861 | 17,920 | //! This algorithm is not intended to be an optimization, it is rather for legalization.
//! Specifically, spir-v disallows things like a `StorageClass::Function` pointer to a
//! `StorageClass::Input` pointer. Our frontend definitely allows it, though, this is like taking a
//! `&Input<T>` in a function! So, we inline... | 36.646217 | 99 | 0.524275 |
ed567ad597abad406296ad36b798a2f154a777f5 | 5,767 | //! disjoint sparse table。
use std::convert::From;
use std::ops::{Index, Range, RangeBounds};
use binop::Monoid;
use buf_range::bounds_within;
use fold::Fold;
/// disjoint sparse table。
///
/// 要素数 $n$ の配列の任意の区間について、モノイド積の値を計算できる。
/// 値の更新はできない。
/// 半群を返すことにしてもよいが、要検討。
///
/// # Idea
/// 各 $k$ ($1\\le k\< \\log\_2(n... | 28.408867 | 106 | 0.48188 |
f4f8ef3ce33b81e99e40ae082dd63d62865b0a69 | 2,155 | //! Types for parsers
use alloc::string::String;
use alloc::vec::Vec;
use core::ops::Range;
/// Statements
#[derive(Clone, Debug, PartialEq)]
pub struct Statement<L> {
/// The kind of the statement
pub kind: StatementKind<L>,
/// The range in the file
pub span: Range<L>,
}
/// Kinds of statements
#[de... | 21.767677 | 68 | 0.623666 |
094b40e1ce4d02b087ae3429ed5bf618e99997d1 | 174 | // functions1.rs
// Make me compile! Execute `rustlings hint functions1` for hints :)
fn call_me() {
println!("I'm not main function!");
}
fn main() {
call_me();
}
| 15.818182 | 68 | 0.626437 |
7550c0eddd90176b22d243b4ad5ea03aa32e4912 | 413,788 | use std::collections::HashMap;
use std::cell::RefCell;
use std::borrow::BorrowMut;
use std::default::Default;
use std::collections::BTreeMap;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use std::thread::sleep;
use crate::client;
// ##############
// UTILITIES ###
// ############
/// Identifies th... | 44.700011 | 781 | 0.582941 |
1c8bfe23b6d4d01bde38426abc4603be123d8b80 | 4,214 | #![recursion_limit = "128"]
extern crate proc_macro;
extern crate proc_macro2;
extern crate syn;
#[macro_use]
extern crate quote;
use proc_macro2::Span;
#[proc_macro_derive(Uniform)]
pub fn uniform(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let input = proc_macro2::TokenStream::from(input);
... | 29.062069 | 80 | 0.507594 |
5ddfff25081df197db39ff2a3e247ac072beb837 | 77 | mod control;
pub use control::*;
mod segmentation;
pub use segmentation::*;
| 12.833333 | 24 | 0.727273 |
5be860ef0675962f4eb4b51c5bb4ffc3de609e40 | 2,420 | /* Project Euler Problem 18 Solution
*
* Problem statement:
* By starting at the top of the triangle below and moving
* to adjacent numbers on the row below, the maximum total
* from top to bottom is 23.
* 3
* 7 4
* 2 4 6
* 8 5 9 3
* That is, 3... | 32.702703 | 69 | 0.583884 |
69239f9f0159895d7addf3ea48fdfac15a30a630 | 199 | fn main() {
let args: Vec<String> = std::env::args().collect();
let query = &args[1];
let filename = &args[2];
println!("query: {}", query);
println!("filename: {}", filename);
}
| 24.875 | 55 | 0.542714 |
18ccd58f43cc7625ac15aa2150a56035d1cfc5d0 | 832 | use {
crate::append_vec::{StoredAccountMeta, StoredMeta},
solana_sdk::{account::AccountSharedData, clock::Slot},
std::sync::{Arc, RwLock},
};
pub trait AccountsUpdateNotifierInterface: std::fmt::Debug {
/// Notified when an account is updated at runtime, due to transaction activities
fn notify_acco... | 41.6 | 97 | 0.747596 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.