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 |
|---|---|---|---|---|---|
fe711453e5de0906f307c1df4e550e1d5f6f946a | 13,760 | //! Core traits for rule definitions and rule context.
//! As well as an internal prelude to make imports for rules easier.
#![allow(unused_variables, unused_imports)]
use crate::autofix::Fixer;
use crate::Diagnostic;
use dyn_clone::DynClone;
use rslint_errors::Severity;
use rslint_parser::{SyntaxNode, SyntaxNodeExt,... | 33.891626 | 153 | 0.605596 |
1cfef2eee17feaab71f83fdc40ff3b1f44ca95f4 | 3,201 | #![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(rustdoc::bare_urls)]
#![warn(missing_docs... | 43.849315 | 411 | 0.768822 |
ed68b198b84f7e44051fee6fa59cc53e8140da5f | 18,688 | extern crate serde;
extern crate rltk;
use rltk::{Console, GameState, Rltk, Point};
extern crate specs;
use specs::prelude::*;
use specs::saveload::{SimpleMarker, SimpleMarkerAllocator};
#[macro_use]
extern crate specs_derive;
mod components;
pub use components::*;
mod map;
pub use map::*;
mod player;
use player::*;
mo... | 38.691511 | 156 | 0.552012 |
38687c7900268eaf889979a4f49c0a3669d6b03a | 950 | use super::{identification, producer::Control, protocol, scope::AnonymousScope, Context};
use crate::stat::Alias;
use crate::test::samples;
use clibri::server;
use std::str::FromStr;
use uuid::Uuid;
type BroadcastStructA = (Vec<Uuid>, protocol::StructA);
type BroadcastStructB = (Vec<Uuid>, protocol::StructB);
#[allow... | 32.758621 | 89 | 0.635789 |
ac383dfb4f4993c83f5f985e214a8f4cb3aa4258 | 411 | pub mod activity;
pub mod alert;
pub mod app;
pub mod completion;
pub mod editor;
pub mod explorer;
pub mod find;
pub mod hover;
pub mod keymap;
mod logging;
pub mod palette;
pub mod panel;
pub mod picker;
pub mod plugin;
pub mod problem;
pub mod scroll;
pub mod search;
pub mod settings;
pub mod source_control;
pub mod... | 15.222222 | 23 | 0.754258 |
ebe3fd86bd134d594f5ef6f9211f7d0361234ac0 | 2,138 | use num_derive::{FromPrimitive, ToPrimitive};
use solana_sdk::decode_error::DecodeError;
use snafu::Snafu;
/// Reasons the evm execution can fail.
#[derive(Debug, Clone, PartialEq, FromPrimitive, ToPrimitive, Snafu)]
pub enum EvmError {
#[snafu(display("Cross-Program EVM execution disabled."))]
CrossExecution... | 30.985507 | 131 | 0.718896 |
5d96357610c9de4567981909e67b18fe7942884d | 11,966 | use rand::Rng;
use rust_hdl::core::prelude::*;
use rust_hdl::hls::prelude::*;
use rust_hdl::widgets::prelude::*;
#[derive(LogicBlock, Default)]
struct ControllerTest {
to_cpu: FIFOReadController<Bits<16>>,
from_cpu: FIFOWriteController<Bits<16>>,
to_cpu_fifo: SyncFIFO<Bits<16>, 6, 7, 1>,
from_cpu_fifo:... | 36.932099 | 96 | 0.544209 |
1a397e3540733e6be43879128d695f2775e83620 | 3,198 | //
// Copyright 2021 The Project Oak 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 o... | 32.30303 | 96 | 0.678549 |
fed4829e76a2c6f014b06fb8078419d1d527e89b | 2,535 | use rand::prelude::*;
use crate::math::Point;
/// Perlin noise generator.
pub struct Perlin {
rand_f: [f64; Self::POINT_COUNT],
perm_x: [usize; Self::POINT_COUNT],
perm_y: [usize; Self::POINT_COUNT],
perm_z: [usize; Self::POINT_COUNT],
}
impl Perlin {
const POINT_COUNT: usize = 256;
pub fn n... | 24.852941 | 89 | 0.413018 |
8f156bd8d4b4fef589ea307a817946182b6468f9 | 2,101 | #[doc = "Register `FsinEXTCFG` reader"]
pub struct R(crate::R<FSINEXTCFG_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<FSINEXTCFG_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<FSINEXTCFG_SPEC>> for R {
#[inline(always)]
fn from(... | 32.323077 | 445 | 0.63446 |
f7e3fb1ab02362068baa0c69d530e87a99ecaff4 | 4,487 | #[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::IFLAG2 {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mu... | 26.708333 | 110 | 0.530198 |
896cd301b9b6f5955f0e1e4e5e3e280995d8c0f1 | 12,471 | //! A typed high-level pipeline interface.
use std::borrow::Borrow;
use std::mem;
use std::marker::PhantomData;
use {hal, format, handle};
use hal::image::Layout;
use hal::pass::{AttachmentOps, AttachmentLoadOp, AttachmentStoreOp};
use {Backend, Device, Primitive, Supports, Transfer, Graphics, Encoder};
pub use hal... | 29.622328 | 110 | 0.553043 |
8a3bdcbd3d5ed4df4d8c4bf1b0557a09569d2c90 | 2,421 | use libc;
pub type __uint32_t = libc::c_uint;
pub type uint32_t = __uint32_t;
pub type size_t = libc::c_ulong;
// https://www.geeksforgeeks.org/move-zeroes-end-array/
pub unsafe fn push_zeroes_to_end(mut arr: *mut uint32_t,
mut n: size_t) -> size_t {
let mut count: size_t = 0i32 as ... | 35.086957 | 70 | 0.570838 |
395f56e110f052ff76b6383796269220e5f911b2 | 2,635 | use crate::flows;
use crate::flows::core::Variant;
use crate::structures::config::Command::{Alfred, Best, Fn, Preview, Query, Repo, Search, Widget};
use crate::structures::config::{AlfredCommand, Config, RepoCommand};
use anyhow::Context;
use anyhow::Error;
pub fn handle_config(config: Config) -> Result<(), Error> {
... | 43.916667 | 97 | 0.528273 |
ed4e36cc3dd031a3da7a2f910c976cde6b8042e5 | 2,821 | use std::os::raw::{c_float, c_int};
use skia_safe::{AlphaType, ColorType, ImageInfo, IPoint, ISize, IVector, Rect};
use crate::common::context::Context;
use crate::common::context::pixel_manipulation::image_data::ImageData;
pub mod image_data;
impl Context {
pub fn create_image_data(width: c_int, height: c_int)... | 26.613208 | 79 | 0.458703 |
26ce8bd7b74c4efa7dc34da105763405419eb463 | 1,678 | // Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors
// SPDX-License-Identifier: MIT
use crate::protocol_runner::init::context::{
ProtocolRunnerInitContextErrorAction, ProtocolRunnerInitContextState,
};
use crate::protocol_runner::init::ProtocolRunnerInitState;
use crate::protocol_runner::Protoc... | 39.023256 | 93 | 0.678188 |
71ad86def4f874b069ec8a48dba8f4456491dd50 | 1,710 | #![forbid(unsafe_code)]
// #![forbid(rust_2018_idioms)]
#![allow(dead_code)]
use std::ops::Range;
/// A span is a range into a set of bytes - see it as a selection into a Git config file.
///
/// Similar to [`std::ops::RangeInclusive`], but tailor made to work for us.
/// There are various issues with std ranges, whi... | 32.264151 | 154 | 0.681871 |
acbf73bf62a244f544190caa265074fe96f4381d | 28,443 | pub mod color_format;
pub mod error;
mod iter;
pub mod options;
mod utils;
use crate::geometry::{
color::Color,
mesh::{Face, Mesh, Vertex},
position::Position,
};
use self::{
error::{Error, Kind},
iter::OffLines,
options::Options,
utils::{ConvertVec, StrParts},
};
pub type Result<T = ()> ... | 28.846856 | 139 | 0.440741 |
1460635557fe0c572e41cc835ccdb97bb1f10c67 | 1,458 | #[cfg(test)]
mod process_token_tests {
use super::jwt::JwtToken;
use super::process_token;
use actix_web::test::TestRequest;
#[test]
fn no_token_process_token() {
let mock_request = TestRequest::with_header("test", "test").to_srv_request();
match process_token(&mock_request) {
... | 29.16 | 98 | 0.615912 |
e223aa7bc765621233d07465ab0865da9a849f4c | 36,877 | //! Formatters for logging `tracing` events.
use super::time::{self, FormatTime, SystemTime};
use crate::{
field::{MakeOutput, MakeVisitor, RecordFields, VisitFmt, VisitOutput},
fmt::fmt_subscriber::FmtContext,
fmt::fmt_subscriber::FormattedFields,
registry::LookupSpan,
};
use std::{
fmt::{self, Wr... | 30.227049 | 129 | 0.551997 |
d68f4c9d23c701a33085a9ea03fbb6eb7e4ddfe2 | 20,287 | // Musium -- Music playback daemon with web-based library browser
// Copyright 2021 Ruud van Asseldonk
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// A copy of the License has been included in the root of the repository.
use st... | 36.885455 | 115 | 0.567063 |
e9f26cb39169caa782a8bd6b96c353a68a6befe5 | 279 | // compile-flags: -Z parse-only
// ignore-tidy-linelength
struct Foo;
impl Foo {
fn foo() {}
#[stable(feature = "rust1", since = "1.0.0")]
} //~ ERROR expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, or
fn main() {}
| 21.461538 | 114 | 0.584229 |
8a2f83e83d9cca779c0cd8e02eeab8db2661fd6c | 65 | pub mod rpm_tape;
pub mod rpm_tape_box;
pub mod rpm_tape_tracks;
| 16.25 | 24 | 0.815385 |
8ab384f8e324f0187ce30718a16aded1ddf16719 | 440 | pub fn part1(_input: &str) -> ! {
todo!()
}
pub fn part2(_input: &str) -> ! {
todo!()
}
#[allow(unreachable_code)]
#[cfg(test)]
#[test]
fn part1_test() {
assert_eq!(
part1(&std::fs::read_to_string("input/day07.txt").unwrap()),
()
);
}
#[allow(unreachable_code)]
#[cfg(test)]
#[test]
fn ... | 16.296296 | 68 | 0.540909 |
de35c60ce348b4157914cd91505bfb1f192fad21 | 32,804 | use super::config::ClientConfig;
use super::user_config::UserConfig;
use failure::{err_msg, format_err};
use rspotify::spotify::client::Spotify;
use rspotify::spotify::model::album::{FullAlbum, SavedAlbum, SimplifiedAlbum};
use rspotify::spotify::model::artist::FullArtist;
use rspotify::spotify::model::context::FullPla... | 33.576254 | 124 | 0.529417 |
2624506866904ac93e885c48b12ce2e01a415ffb | 1,467 | use std::io::{self, BufRead};
use std::collections::BTreeSet;
fn password_contains_duplicates(password: &str) -> bool {
let mut wordset = BTreeSet::new();
for word in password.split_whitespace() {
if wordset.contains(word) {
return true;
}
wordset.insert(word);
}
fal... | 28.764706 | 104 | 0.597819 |
873c6c7f69bfbdbab47e5409cab0d80aa8d54edd | 4,737 | // Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0
use crate::{
metrics::DIEM_PRUNER_LEAST_READABLE_VERSION, pruner::db_pruner::DBPruner,
transaction::TransactionSchema, TransactionStore,
};
use aptos_logger::{error, info};
use aptos_types::transaction::{AtomicVersion, Transaction, Version};
use sch... | 33.835714 | 97 | 0.618324 |
229638701c69aaaec05659b2fa82ba4b3389925c | 793 | use crate::list::ListIndex;
use js_sys::Object;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
/// The `ActionDetail` type
///
/// [MWC Documentation](https://github.com/material-components/material-components-web-components/tree/master/packages/list#mwc-list-2)
#[derive(Debug)]
pub struct ActionDetail {
... | 24.78125 | 135 | 0.673392 |
4b20e2428950c8e003fa664db4139dc242d9dfb9 | 36,864 | #![allow(non_snake_case, non_upper_case_globals)]
#![allow(non_camel_case_types)]
//! USB Power Delivery interface
//!
//! Used by: stm32g071, stm32g07x, stm32g081
use crate::{RORegister, RWRegister};
#[cfg(not(feature = "nosync"))]
use core::marker::PhantomData;
/// UCPD configuration register
pub mod CFG1 {
//... | 25.423448 | 58 | 0.477241 |
09f7121d2de56ff737c8da403f67094c257d0055 | 11,588 | //! Defines types to use with the ACL commands.
use crate::types::{
ErrorKind, FromRedisValue, RedisError, RedisResult, RedisWrite, ToRedisArgs, Value,
};
macro_rules! not_convertible_error {
($v:expr, $det:expr) => {
RedisError::from((
ErrorKind::TypeError,
"Response type not ... | 38.370861 | 99 | 0.529513 |
ff0ea0eeb2c020444d922362b22ddbba8538ec96 | 4,683 | mod chat;
mod lua;
mod object;
mod repo;
mod util;
mod world;
use crate::chat::{AppState, ChatSocket};
use crate::util::ResultAnyError;
use crate::world::{World, WorldRef};
use actix::clock::Duration;
use actix::prelude::*;
use actix_web::middleware::Logger;
use actix_web::{web, App, HttpRequest, HttpResponse, HttpSer... | 25.313514 | 111 | 0.646808 |
79fb569c77a5ce56c33de27fb9c4b31b9182f966 | 2,438 | // This file is part of Substrate.
// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// ht... | 31.662338 | 93 | 0.700164 |
224acf5de05ba2148eef9308f381391d2227bb41 | 4,676 | extern crate specs;
use specs::prelude::*;
use crate::{MyTurn, Faction, Position, Map, raws::Reaction, Viewshed, WantsToFlee,
WantsToApproach, Chasing, SpecialAbilities, WantsToCastSpell, Name, SpellTemplate};
pub struct VisibleAI {}
impl<'a> System<'a> for VisibleAI {
#[allow(clippy::type_complexity)]
ty... | 46.29703 | 142 | 0.462575 |
61a26ac5971cdb52f3de1de6ad506afeba867486 | 17,392 | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
cfgir::{
ast::{BasicBlock, BasicBlocks, BlockInfo, LoopEnd, LoopInfo},
remove_no_ops,
},
errors::*,
hlir::ast::{Command, Command_, Exp, ExpListItem, Label, UnannotatedExp_, UnitCase},
sha... | 32.939394 | 100 | 0.531796 |
f519dc0b7ed599dce14e7144a6966031fa37e374 | 611 | use num_traits;
use num_traits::NumCast;
use noise::{NoiseModule, Perlin, Seedable};
fn cast<T: NumCast, R: NumCast>(val: T) -> R {
num_traits::cast(val).unwrap()
}
pub struct Noise {
perlin: Perlin,
}
impl Noise {
pub fn new() -> Noise {
info!("[PX8][Noise] new");
Noise { perlin: Perli... | 19.709677 | 58 | 0.546645 |
e48404bf8212801b7426da501c65356290200e26 | 1,225 | //! @brief zk_token_elgamal syscall tests
extern crate solana_program;
use {
solana_program::{custom_panic_default, msg},
solana_zk_token_sdk::zk_token_elgamal::{
ops,
pod::{ElGamalCiphertext, Zeroable},
},
};
#[no_mangle]
pub extern "C" fn entrypoint(_input: *mut u8) -> u64 {
let zero... | 22.685185 | 74 | 0.578776 |
759274a9644a12d9190240ac89c6248d7df6d688 | 7,195 | use crate::build_filter_helper::derive_non_table_filter;
use crate::diagnostic_shim::{Diagnostic, DiagnosticShim};
use crate::field::Field;
use crate::model::Model;
use crate::utils::{is_has_many, wrap_in_dummy_mod};
use proc_macro2::{Span, TokenStream};
use quote::quote;
use syn::parse_quote;
pub fn derive(item: &syn... | 33.621495 | 141 | 0.535511 |
16d49954dce7ab214184678fa44a208118d9b10b | 683 | // 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 ... | 27.32 | 78 | 0.729136 |
79f8ce22ce6dcc77a37438f1e69b3cf020d0d097 | 831 | #[derive(Debug)]
pub struct Scale {
pub min: i64,
pub max: i64,
pub ticks: Vec<i64>,
}
impl Scale {
pub fn new(mut min: i64, mut max: i64) -> Self {
debug_assert!(min <= max);
if max < min + 3 {
max += 2;
min -= 2;
}
if min > 0 && (max - min) * 4 >... | 23.083333 | 60 | 0.399519 |
38a4a5b587bc26ba1d4781345aad58f67ac9b3f5 | 7,962 | use std::marker::PhantomData;
use futures::{Async, Future, Poll};
use super::{IntoNewService, NewService, Service};
use crate::cell::Cell;
/// Service for the `and_then` combinator, chaining a computation onto the end
/// of another service which completes successfully.
///
/// This is created by the `ServiceExt::an... | 25.601286 | 96 | 0.528259 |
56170bbb869f31e8d3cec75b7e072ae8976fde6d | 3,017 | // Copyright 2017 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.902778 | 80 | 0.672522 |
e6de0a844e01ad91572731ae73e092c2a8ba25db | 467 | mod window;
use gtk::prelude::*;
use gtk::Application;
use crate::window::Window;
fn main() {
// Create a new application
let app = Application::builder()
.application_id("org.gtk-rs.example")
.build();
// Connect to signals
app.connect_activate(build_ui);
// Run the application... | 17.961538 | 45 | 0.620985 |
fcea769f76cb6cb5ac28d1d8481000477f74c9b0 | 825 | /*
*
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct LolCollectionsGameDat... | 25.78125 | 109 | 0.704242 |
01847e1e51fa8cc77e2218ed96c2dacb31e281df | 56 | mod prim;
pub use self::prim::{prim, prim_with_start};
| 14 | 44 | 0.714286 |
5014e7cb7b6511598b06c34a09231f73ad780a4e | 2,621 | use super::*;
use lsp_types::{
DocumentChanges, OneOf, OptionalVersionedTextDocumentIdentifier, Position,
PrepareRenameResponse, TextDocumentEdit, TextEdit, Url, WorkspaceEdit,
};
pub(crate) fn prepare_rename(
uri: Url,
position: Position,
docs: &Docs,
wa: &mut WorkspaceAnalysis,
) -> Option<Pr... | 28.182796 | 85 | 0.585273 |
ef3ccd5aead030131eb2c30dbe34d302bd5fefa3 | 11,445 | // 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 ... | 31.185286 | 95 | 0.577108 |
fc9c79819e159589f0128e575c25644a1a3deff4 | 4,790 | use crate::read_lines;
pub fn part1() -> usize {
let lines = read_lines("./data/day11.txt");
let nrow = lines.len();
let ncol = lines[0].len();
let mut layout: Vec<Vec<i8>> = vec![vec![-1i8; ncol + 2]; nrow + 2];
for i in 0..nrow {
for (j, c) in lines[i].bytes().into_iter().enumerate() {
... | 24.818653 | 72 | 0.320668 |
3af1382e128462b60a71771ba1aa2af8de4e7b81 | 22,022 | use super::mpz::mp_limb_t;
use std;
use libc::c_int;
#[link(name = "gmp")]
extern "C" {
static __gmp_bits_per_limb: c_int;
}
#[test]
fn test_limb_size() {
// We are assuming that the limb size is the same as the pointer size.
assert_eq!(std::mem::size_of::<mp_limb_t>() * 8,
unsafe { __gmp_b... | 30.714086 | 114 | 0.502815 |
d98d532acf6517c0835577d6d6d293d15119e6ac | 965 | //! A TCP client.
//!
//! First start a server:
//!
//! ```
//! cargo run --example tcp-server
//! ```
//!
//! Then start a client:
//!
//! ```
//! cargo run --example tcp-client
//! ```
use std::net::TcpStream;
use smol::{future, io, Async, Unblock};
fn main() -> io::Result<()> {
smol::run(async {
// Cr... | 24.125 | 94 | 0.537824 |
bbae49626b344911ea12889def34d147428eb317 | 8,155 | //! A cross platform Rust library that returns the vendor and product IDs of
//! currently connected USB devices
//!
//! [](https://github.com/timfish/usb-enumeration/actions)
//!
//! # Example
//! ```no_run
//! let devices = usb_enu... | 30.657895 | 145 | 0.529123 |
1ab29e6ce5e74ef07b4f1c91dd2f96fd816db9f7 | 2,280 | use crate::error::{Error, ErrorKind};
use std::os::raw::c_char;
use std::sync::RwLock;
use ffi_support::rust_string_to_c;
use once_cell::sync::Lazy;
static LAST_ERROR: Lazy<RwLock<Option<Error>>> = Lazy::new(|| RwLock::new(None));
#[derive(Debug, PartialEq, Copy, Clone, Serialize)]
#[repr(i64)]
pub enum ErrorCode ... | 27.804878 | 90 | 0.602632 |
5b8f36b150701d2d63532d7652778030a27eacbd | 2,738 | use crate::data::TypedData;
use crate::errors::Error;
//Don't know why awsm_web needs FutureExt but awsm_renderer doesn't...
use futures::future::{self, TryFutureExt, FutureExt};
use std::future::Future;
use js_sys::ArrayBuffer;
use wasm_bindgen_futures::JsFuture;
use web_sys::{ AudioBuffer, AudioContext };
pub fn a... | 32.987952 | 127 | 0.663623 |
bf22badeff800eedd8cd432c4a276a1529d3b25e | 1,766 | //! Attribute-related types used by the proc macro
use crate::Asn1Type;
use syn::{Attribute, Lit, Meta, MetaList, MetaNameValue, NestedMeta};
#[derive(Debug)]
pub(crate) struct Asn1Attrs {
/// Value of the `#[asn1(type = "...")]` attribute if provided
pub asn1_type: Option<Asn1Type>,
}
impl Asn1Attrs {
/... | 34.627451 | 85 | 0.426387 |
0e09d34cc9bd3774c0c0ee13936cc266ce66c483 | 9,575 | // 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 ... | 35.861423 | 99 | 0.587258 |
5028ed77422f4d0c750c94ac02253509579ffdb7 | 891 | /// This function divides two numbers.
///
/// # Example #1: 10 / 2 == 5
///
/// ```
/// let result = doctest001::div(10, 2); // TODO: finish this test!
/// assert_eq!(result, 5);
/// ```
///
/// # Example #2: 6 / 2 = 3
///
/// ```
/// let result = doctest001::div(6, 2);
/// assert_eq!(result, 3);
/// ```
///
/// # Pa... | 18.5625 | 68 | 0.483726 |
289c912abf9c36cf0766a9cfa1411d1e4ef4437c | 124 | #[derive(Debug, Clone, Copy)]
pub enum AttributeComponentSize {
One = 1,
Two = 2,
Three = 3,
Four = 4
} | 17.714286 | 33 | 0.548387 |
017763880f248abb03bef9da09e2c24b77894ffe | 1,099 | use chrono::{DateTime, Local};
use serde::{Deserialize, Serialize};
use crate::User;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Release {
pub url: String,
pub assets_url: String,
pub upload_url: String,
pub html_url: String,
pub id: usize,
pub author: User,
pub node_id: Str... | 24.977273 | 47 | 0.673339 |
e2b0297d31c37a4d6cedce6185d6e72b9a63f851 | 1,925 | #[cfg(test)]
mod test;
use bson::{doc, Document};
use serde::Deserialize;
use crate::{
cmap::{Command, CommandResponse, StreamDescription},
error::Result,
operation::{append_options, Operation},
options::ListDatabasesOptions,
selection_criteria::{ReadPreference, SelectionCriteria},
};
#[derive(De... | 23.47561 | 81 | 0.58961 |
8f2505a4ecbe8a496c069de42839abe5dcbd665e | 30,342 | #![cfg(feature = "stargate")]
// The CosmosMsg variants are defined in results/cosmos_msg.rs
// The rest of the IBC related functionality is defined here
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::cmp::{Ord, Ordering, PartialOrd};
#[cfg(feature = "ibc3")]
use crate::addresses::Addr;
use c... | 33.638581 | 256 | 0.619768 |
5ba94cd60e599d5d4e5a3c8eaa2a60c0991ce07f | 2,114 | use crate::commands::WholeStreamCommand;
use crate::context::CommandRegistry;
use crate::prelude::*;
use nu_errors::ShellError;
use nu_protocol::{Signature, SyntaxShape, UntaggedValue};
use nu_source::Tagged;
pub struct Keep;
#[derive(Deserialize)]
pub struct KeepArgs {
rows: Option<Tagged<usize>>,
}
#[async_tra... | 24.870588 | 98 | 0.543519 |
1e57df5197f9d8673f6a4d76d9a538d042b42d14 | 52 | pub mod camera;
pub mod buffer;
pub mod resolution;
| 13 | 19 | 0.769231 |
50f4dc95ba7bbdbd01c1475ca347e5d25313455a | 666 | // Copyright 2018, The Gtk-rs Project Developers.
// See the COPYRIGHT file at the top-level directory of this distribution.
// Licensed under the MIT license, see the LICENSE file or <https://opensource.org/licenses/MIT>
#![allow(deprecated)]
extern crate cairo;
extern crate cairo_sys;
extern crate glib_sys;
extern ... | 23.785714 | 96 | 0.767267 |
8a7707562e8eea4b9b75702ce3edb546e32c9883 | 7,486 | #[doc = r" Value read from the register"]
pub struct R {
bits: u8,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u8,
}
impl super::INTENSET {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mu... | 24.870432 | 58 | 0.493855 |
21ae62cd5ab4951c43d2f25c60418807084b3424 | 1,498 | /*
* Twilio - Api
*
* This is the public Twilio REST API.
*
* The version of the OpenAPI document: 1.25.0
* Contact: support@twilio.com
* Generated by: https://openapi-generator.tech
*/
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct ApiV2010AccountNewKey {
/// The RFC 282... | 32.565217 | 99 | 0.668224 |
6169408da10c858eaa41f9a4e2cbc8ee9eb7d14f | 27,636 | use std::io::{Cursor};
use std::error::Error;
use std::{i16, i32, i64};
use std::sync::Arc;
use std::time::UNIX_EPOCH;
use bytes::{Bytes, Buf};
use edgedb_protocol::codec::{build_codec, build_input_codec};
use edgedb_protocol::codec::{Codec, ObjectShape};
use edgedb_protocol::value::{Value, Duration};
use edgedb_prot... | 33.017921 | 79 | 0.516826 |
d957755ed841637f69e965bfa887ce8d0c9c9393 | 10,396 | #![deny(unused)]
#[macro_use]
extern crate log;
pub mod constants;
#[macro_use]
mod utils;
mod config;
mod logic;
mod processor;
pub use config::Config;
use std::{fmt, io, net, thread};
use std::collections::HashMap;
use std::sync::{atomic, mpsc, Arc, Mutex};
use bitcoin::network::message::NetworkMessage;
use bit... | 28.021563 | 85 | 0.680743 |
75aa75a2f02315fa9288523f9164a28ef0dd088d | 9,773 | use rand::{RngCore, SeedableRng};
use rand_xorshift::XorShiftRng;
use runiversal::common::{
btree_multimap_insert, mk_cid, mk_sid, mk_t, BasicIOCtx, CoreIOCtx, GeneralTraceMessage,
GossipData, SlaveIOCtx, SlaveTraceMessage, Timestamp,
};
use runiversal::coord::{CoordConfig, CoordContext, CoordForwardMsg, CoordState... | 33.241497 | 98 | 0.650466 |
f9d1c115b5d41e8ad321b2b093cb68400c632acd | 3,782 | use instruction_def::*;
use test::run_test;
use Operand::*;
use Reg::*;
use RegScale::*;
use RegType::*;
use {BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
#[test]
fn mulx_1() {
run_test(
&Instruction {
mnemonic: Mnemonic::MULX,
operand1:... | 24.558442 | 95 | 0.453464 |
1a4a8c1a637e7a1e0c0df8a0294f0750265f40b8 | 68,978 | // 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.992651 | 197 | 0.720186 |
0972acccb11678fff24e25d2db8ef4646f6557d0 | 3,569 | #![allow(non_snake_case, non_upper_case_globals)]
#![allow(non_camel_case_types)]
//! Basic-timers
//!
//! Used by: stm32l0x1, stm32l0x2, stm32l0x3
#[cfg(not(feature = "nosync"))]
pub use crate::stm32l0::peripherals::tim6::Instance;
pub use crate::stm32l0::peripherals::tim6::{RegisterBlock, ResetValues};
pub use crate... | 32.743119 | 84 | 0.615859 |
bffd32a502cd4b00dac52b9a8be86dcad60e7552 | 933 | #![no_std]
use contract::{
contract_api::{account, runtime},
unwrap_or_revert::UnwrapOrRevert,
};
use types::{
account::{PublicKey, Weight},
ApiError,
};
enum Arg {
Account = 0,
Weight,
}
#[repr(u16)]
enum Error {
AddAssociatedKey = 100,
}
impl Into<ApiError> for Error {
fn into(self... | 23.325 | 96 | 0.6806 |
23eb2d439a4a013956c9b8180be70ee875212e66 | 521 | use anyhow::Result;
use std::sync::{Arc, Barrier};
use std::thread;
use std::{error::Error, time::Duration};
/**
* Barrier: 栅栏,线程间同步机制
*/
fn main() -> Result<(), Box<dyn Error>> {
let barrier = Arc::new(Barrier::new(10));
for _ in 0..10 {
let c = Arc::clone(&barrier);
thread::spawn(move || ... | 20.84 | 45 | 0.506718 |
0388f16d1506c976844b780e7ab1989790b71a28 | 1,186 | // Dummy platform to let it compile and do nothing. Only useful if you don't want a graphical backend.
use crate::prelude::BTerm;
use crate::Result;
use parking_lot::Mutex;
pub use winit::event::VirtualKeyCode;
use pancurses::Window;
mod main_loop;
pub use main_loop::main_loop;
mod font;
pub use font::*;
mod init;
... | 19.766667 | 102 | 0.65683 |
2934d921868a8ec76c96d8d0508c6d934fa3a2b0 | 23,225 | use rustc_errors::{Applicability, DiagnosticBuilder};
use rustc_infer::infer::TyCtxtInferExt;
use rustc_middle::mir::*;
use rustc_middle::ty;
use rustc_mir_dataflow::move_paths::{
IllegalMoveOrigin, IllegalMoveOriginKind, LookupResult, MoveError, MovePathIndex,
};
use rustc_span::{sym, Span, DUMMY_SP};
use rustc_tr... | 40.532286 | 100 | 0.481249 |
e9f6235ca1d05d959e373816a83afe5a9d6b6a73 | 4,013 | //! Systems and components specific to player entities.
use crate::broadcasters::movement::LastKnownPositions;
use crate::chunk_logic::ChunkHolder;
use crate::entity;
use crate::entity::{CreationPacketCreator, EntityId, Name, SpawnPacketCreator};
use crate::io::NewClientInfo;
use crate::join::Joined;
use crate::networ... | 32.104 | 97 | 0.67082 |
f9973668639c2f64aa964dd6727c9f47a414c0a7 | 3,056 | use crate::{
AppliedMigration, CommitTransaction, DefaultQueries, Error, ExecuteMultiple, Migrate,
MigrateGrouped, Query, Transaction, WrapMigrationError,
};
use chrono::{DateTime, Local};
use postgres::{
transaction::Transaction as PgTransaction, Connection as PgConnection, Error as PgError,
};
fn query_a... | 30.56 | 92 | 0.635144 |
1df6ce8ec1caecbe443497b21a9b1d11fb4bc799 | 5,882 | use futures::{future, Future};
use rain_core::{errors::*, types::*};
use std::path::Path;
use std::sync::Arc;
use super::TaskResult;
use governor::data::{Data, DataBuilder};
use governor::graph::TaskRef;
use governor::state::State;
/// Task that merge all input blobs and merge them into one blob
pub fn task_concat(st... | 32.860335 | 91 | 0.569874 |
1e39ccf25e93742f72d54e61e6afdc21f844ed4b | 7,359 | use common::external::{get_version, Camera, Injection};
use memory_rs::external::process::Process;
use std::f32;
use std::io::Error;
use std::rc::Rc;
use std::thread;
use std::time::{Duration, Instant};
use winapi::shared::windef::POINT;
use winapi::um::winuser;
use winapi::um::winuser::{GetAsyncKeyState, GetCursorPos,... | 31.448718 | 119 | 0.549803 |
ffca5a079f3316c9395845d8cd2189908fcb80b6 | 3,654 | use rand::seq::SliceRandom;
/// Generates a random name from a list of 69 random first and last
/// nicknames through a `rng`
///
/// Requires the `SliceRandom` trait from `rand`
///
/// Name returned as a `String`
pub fn generate_random_alias() -> String {
let names = [
"Baby Oil",
"Bad News",
... | 21.244186 | 67 | 0.445539 |
ed8943df42b4f22b1501e95f8e80037fbfec1c97 | 19,838 | #![doc = "generated by AutoRust"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(clippy::redundant_clone)]
use super::models;
#[derive(Clone)]
pub struct Client {
endpoint: String,
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
scopes: Vec<String>,
... | 50.350254 | 139 | 0.486138 |
2628baefa685318005a92c38aa3adea8d51efce2 | 131,241 | use crate::{
ancestors::Ancestors,
contains::Contains,
inline_spl_token_v2_0::{self, SPL_TOKEN_ACCOUNT_MINT_OFFSET, SPL_TOKEN_ACCOUNT_OWNER_OFFSET},
secondary_index::*,
};
use bv::BitVec;
use dashmap::DashSet;
use log::*;
use ouroboros::self_referencing;
use panoptes_measure::measure::Measure;
use panop... | 34.848911 | 151 | 0.544418 |
38de02108cf1dd040a970f1a645c4db7e4158a01 | 3,797 | use crate::bi_type_app::*;
pub enum FunctionF {}
pub enum FunctionMutF {}
pub enum FunctionOnceF {}
pub trait IsFnOnce: BiTypeCon
{
fn apply_once<'a, A: 'a, B: 'a>(
f: BiApp<'a, Self, A, B>,
a: A,
) -> B;
}
pub trait IsFnMut: IsFnOnce
{
fn apply_mut<'a, A: 'a, B: 'a>(
f: &mut BiApp<'a, Self, A, B>,... | 17.660465 | 80 | 0.515407 |
330876373735488138e8746c273aafe6c9eec8d1 | 4,581 | use super::*;
#[test]
fn with_different_process_sends_message_when_timer_expires() {
with_process_arc(|arc_process| {
TestRunner::new(Config::with_source_file(file!()))
.run(
&(milliseconds(), strategy::term(arc_process.clone())),
|(milliseconds, message)| {
... | 33.933333 | 99 | 0.485702 |
bb15b168a5688debfce7e69a3b378e33dd623406 | 34,485 | use std::collections::{HashMap, HashSet};
use std::ffi::OsString;
use std::path::PathBuf;
use lazy_static::lazy_static;
use structopt::clap::AppSettings::{ColorAlways, ColoredHelp, DeriveDisplayOrder};
use structopt::{clap, StructOpt};
use syntect::highlighting::Theme as SyntaxTheme;
use syntect::parsing::SyntaxSet;
... | 44.268293 | 105 | 0.695201 |
29d6567509e4fc0958a8fe9210fc92806a96fdba | 748 | use rayon::prelude::*;
/// A single executable segment
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
pub struct Segment {
pub addr: u64,
pub bytes: Vec<u8>,
}
impl Segment {
/// Constructor
pub fn new(addr: u64, bytes: Vec<u8>) -> Segment {
Segment { addr, bytes }
}
/// Check if contai... | 24.129032 | 77 | 0.534759 |
7a182d130e91f0e53fa0a3f9341abb478e92dead | 1,631 | /*
Copyright 2021 Integritee AG and Supercomputing Systems AG
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... | 28.12069 | 84 | 0.741876 |
fb4dcd4021169b0252367a8d6e23efc1e164ba72 | 2,808 | use std::env;
use sentry_core::protocol::{DebugImage, SymbolicDebugImage};
use sentry_core::types::{CodeId, DebugId, Uuid};
use findshlibs::{SharedLibrary, SharedLibraryId, TargetSharedLibrary, TARGET_SUPPORTED};
const UUID_SIZE: usize = 16;
/// Converts an ELF object identifier into a `DebugId`.
///
/// The identi... | 34.666667 | 96 | 0.594373 |
ed5649310e3fd61e13ae24958fcd86db04d0fc60 | 19,454 | use super::diagnostics::Error;
use super::expr::LhsExpr;
use super::pat::GateOr;
use super::path::PathStyle;
use super::{BlockMode, Parser, PrevTokenKind, Restrictions, SemiColonMode};
use crate::maybe_whole;
use crate::DirectoryOwnership;
use rustc_errors::{Applicability, PResult};
use syntax::ast;
use syntax::ast::{... | 40.698745 | 100 | 0.535365 |
11d7714136a595a0fbdf828f8c39a2d6dad5c0aa | 366 | use ksql::parser::{Parser, Value};
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
let src = r#"{"name":"MyCompany", "properties":{"employees": 50}"#.as_bytes();
let ex = Parser::parse(".properties.employees > 20")?;
let result = ex.calculate(src)?;
println!("{}", &result);
assert_... | 28.153846 | 82 | 0.587432 |
bf84c2fa3ed5cee857213957bac1fc7ee562a949 | 146 | // Only the meta-provider is exposed outside this module.
pub mod provider;
pub mod args;
mod file_provider;
mod lib_provider;
mod http_provider; | 20.857143 | 57 | 0.794521 |
9b0c879d591a01a6cabea057827dd8c8d392630b | 2,595 | #[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::KEYR3 {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut... | 24.481132 | 66 | 0.503276 |
23723947eb1c5771959fa94acd4d2f8c41428c00 | 5,092 | use crate::arkworks::pasta_fp::WasmPastaFp;
use crate::arkworks::pasta_fq::WasmPastaFq;
use mina_curves::pasta::{
pallas::Affine as AffinePallas, pallas::G_GENERATOR_X as GeneratorPallasX,
pallas::G_GENERATOR_Y as GeneratorPallasY, vesta::Affine as AffineVesta,
vesta::G_GENERATOR_X as GeneratorVestaX, vesta... | 25.083744 | 105 | 0.667125 |
6a07a74d8378799bd241a9d5dab8061dece45885 | 2,308 | use std::collections::HashMap;
use serde::{Deserialize, Serialize};
/// Response from executing
/// [ReadConfigurationRequest][crate::api::auth::oidc::requests::ReadConfigurationRequest]
#[derive(Deserialize, Debug, Serialize)]
pub struct ReadConfigurationResponse {
pub bound_issuer: Option<String>,
pub defau... | 33.941176 | 90 | 0.731802 |
4ad4ef60a5294728fef1b8d20bbb089bb2cb2695 | 649 | // run-pass
#![allow(unused_imports)]
#![feature(rustc_private)]
extern crate rustc_macros;
extern crate rustc_serialize;
use rustc_macros::{Decodable, Encodable};
use rustc_serialize::opaque::{MemDecoder, MemEncoder};
use rustc_serialize::{Decodable, Encodable, Encoder};
#[derive(Encodable, Decodable)]
struct A {
... | 21.633333 | 54 | 0.670262 |
7a3347d47435752e0302e0605f5df67f129e3627 | 26,282 | //! Commit, Data Change and Rollback Notification Callbacks
#![allow(non_camel_case_types)]
use std::os::raw::{c_char, c_int, c_void};
use std::panic::{catch_unwind, RefUnwindSafe};
use std::ptr;
use crate::ffi;
use crate::{Connection, InnerConnection};
/// Action Codes
#[derive(Clone, Copy, Debug, PartialEq)]
#[re... | 32.208333 | 116 | 0.524618 |
28ca48abfea1460584e56353f97df7839365b735 | 3,406 | #![allow(unused_imports)]
use super::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "wasm-bindgen" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = NotificationEventInit)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `NotificationEventInit` dictionary."]
#[doc = ""]
#[doc... | 36.234043 | 120 | 0.572813 |
288521eef0f5583894ffd7fada38768ba1f3c52a | 5,245 |
// /// Reinterprets this `MappedPages`'s underlying memory region as a struct of the given type,
// /// i.e., overlays a struct on top of this mapped memory region.
// ///
// /// # Arguments
// /// `offset`: the offset into the memory region at which the struct is located (where it should start).... | 50.92233 | 202 | 0.547188 |
1d755632055560af0748e99fb03635162f394136 | 8,061 | // This file specifies an output builder for the Receipt stage.
use crate::bank::BankBox;
use crate::error::ProtocolError;
use crate::input_boxes::{ReserveCoinBox, StableCoinBox};
use crate::parameters::{MIN_BOX_VALUE, RESERVECOIN_TOKEN_ID, STABLECOIN_TOKEN_ID};
use ergo_headless_dapp_framework::{
create_candidate,... | 37.493023 | 92 | 0.643344 |
1d01aa47cd0bcd80703248094d04fbe01cf4b4f4 | 1,015 | extern crate think_cap;
extern crate time;
use think_cap::{NN, HaltCondition, LearningMode};
#[test]
fn xor_4layers() {
// create examples of the xor function
let examples = [
(vec![0f64, 0f64], vec![0f64]),
(vec![0f64, 1f64], vec![1f64]),
(vec![1f64, 0f64], vec![1f64]),
(vec![... | 26.710526 | 61 | 0.581281 |
48b9c318bcc452176ce0574a17fc63cad9f15749 | 5,870 | use crate::{checks, LocalNetwork};
use clap::ArgMatches;
use futures::prelude::*;
use node_test_rig::{
environment::EnvironmentBuilder, testing_client_config, testing_validator_config,
ClientGenesis, ValidatorFiles,
};
use rayon::prelude::*;
use std::cmp::max;
use std::net::{IpAddr, Ipv4Addr};
use std::time::{D... | 35.149701 | 101 | 0.622658 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.