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 |
|---|---|---|---|---|---|
efb876f9603c353a224d9d266ac631df308dcba6 | 12,915 | use crate::slicevec::SliceVec;
#[inline]
pub fn errno_get() -> i32 {
errno::errno().0
}
#[derive(Debug)]
pub struct SymlinkCounter {
max: u16,
cur: u16,
}
impl SymlinkCounter {
// This is Linux's limit (sysconf(_SC_SYMLOOP_MAX) always fails on glibc, so we need a fallback)
const DEFAULT_SYMLOOP_M... | 31.195652 | 103 | 0.459233 |
90e4958e63bd663d16e9d6e9504ba9d1505abeee | 2,438 | use std::io::Write;
use byteorder::{BE, WriteBytesExt};
use crate::error::{parse_io, TychoStatus};
use crate::Number;
use crate::types::ident::NumberIdent;
use crate::write::func::write_byte;
pub(crate) const NUM_LEN_1: u8 = 0x00;
pub(crate) const NUM_LEN_8: u8 = 0x01;
pub(crate) const NUM_LEN_16: u8 = 0x02;
pub(cra... | 42.77193 | 96 | 0.640689 |
016d18e0d44188294ec231bee2f954fdb1f7f5f5 | 1,477 | use bioinformatics_algorithms::alignment::pairwise::gotoh_space_efficient::GotohSpaceEfficientAligner;
use bioinformatics_algorithms::alignment::pairwise::nw_se::NwSpaceEfficientAligner;
use bioinformatics_algorithms::alignment::AlignmentResult;
use bioinformatics_algorithms::alignment::MatchParams;
use bioinformatics_... | 43.441176 | 102 | 0.743399 |
f75ab3f431c2a23455f6a471fa2f814e3711b506 | 5,239 | // 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 ... | 29.432584 | 90 | 0.552586 |
d58dbeee37c7b1796cbecb5ffc92b259dcf6fc98 | 10,433 | pub mod subscription {
use crate::common::{CerberusError, CerberusResult, User};
pub async fn run(
global: &clap::ArgMatches<'_>,
params: &clap::ArgMatches<'_>,
user_opt: Option<User<'_>>,
) -> CerberusResult<()> {
let sub_info_opt = params.value_of("stream").and_then(|strea... | 36.865724 | 98 | 0.483849 |
382f1fcbe82515d6b22d012bfff27d70451f6a3b | 15,254 | use fluvio_controlplane::UpdateDerivedStreamRequest;
use fluvio_controlplane_metadata::message::SmartModuleMsg;
use fluvio_controlplane_metadata::partition::Replica;
use fluvio_controlplane_metadata::smartmodule::SmartModuleSpec;
use fluvio_controlplane_metadata::derivedstream::DerivedStreamSpec;
use fluvio_future::tim... | 31.004065 | 132 | 0.585748 |
ab3afc73025af5474aaf67dcb35c3944390a7e44 | 2,594 | //! Timers.
#![feature(proc_macro_hygiene)]
#![warn(missing_docs)]
#![warn(clippy::pedantic)]
#![allow(clippy::type_repetition_in_bounds, clippy::wildcard_imports)]
#![no_std]
#[cfg(any(
stm32_mcu = "stm32f401",
stm32_mcu = "stm32f405",
stm32_mcu = "stm32f407",
stm32_mcu = "stm32f410",
stm32_mcu =... | 25.94 | 70 | 0.627602 |
e99b37c8bf13ad59eb7ee5e6e2ffae7de5141876 | 7,277 | use std::ffi::OsStr;
use std::{io, ptr};
use widestring::WideCString;
use winapi::um::winsvc;
use crate::sc_handle::ScHandle;
use crate::service::{to_wide, RawServiceInfo, Service, ServiceAccess, ServiceInfo};
use crate::{Error, Result};
bitflags::bitflags! {
/// Flags describing access permissions for [`Service... | 34.488152 | 100 | 0.564793 |
031576dd30830480655873f2b3d10179d6f4abb7 | 743 | // 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 ... | 28.576923 | 68 | 0.728129 |
09d59061243af9cf940e58aba743b5794eeaa8b0 | 114 | use ink_lang as ink;
const INPUT: &str = "test";
const _: u32 = ink::selector_bytes!(INPUT);
fn main() {}
| 16.285714 | 44 | 0.614035 |
91fa6273198e0712f5085b7f6ae196d2c20adb6f | 1,757 | mod shapes;
mod operations;
use glam::{Mat2, Vec2};
use crate::operations::{Intersection, Invert, Rotation, Subtraction, Translation, Union};
use crate::shapes::{Circle, Hexagon, Horseshoe, Rectangle};
pub trait Sdf : Sized{
fn density(&self, pos: Vec2) -> f32;
}
pub struct Shapes;
impl Shapes {
pub fn circl... | 23.426667 | 89 | 0.54354 |
ffc73f4c947c5c10b24182713ba0c48338496b73 | 58,377 | /// Video annotation request.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnnotateVideoRequest {
/// Input video location. Currently, only
/// [Cloud Storage](<https://cloud.google.com/storage/>) URIs are
/// supported. URIs must be specified in the following format:
/// `gs://bucket-id/obj... | 46.851525 | 117 | 0.675454 |
e259b4dc0771aaf5214f90076228ab068ab51af5 | 2,657 | use time;
use std::collections::VecDeque;
use std::fs::{File, OpenOptions};
use std::io::BufWriter;
use std::io::Error as IOError;
use std::io::prelude::*;
use std::path::PathBuf;
/// Debug is meant to output text to a text buffer and a file, printing
/// messages generated by errors and to quantify other metrics for ... | 27.391753 | 77 | 0.475725 |
acb9deebbf10a2d3dc8a3625da928a5a862a547e | 2,046 | use std::collections::HashSet;
use std::env;
use std::fmt;
use std::fs::File;
use std::io::{self, BufRead};
fn main() -> Result<(), InputError> {
let args: Vec<String> = env::args().collect();
if args.len() < 2 {
return Err(InputError::InvalidArguments);
}
let filename = &args[1];
let file ... | 30.088235 | 82 | 0.5435 |
233abc2b2b6fc66d45fdcf0f62e33a3158bc96b2 | 30,360 | // Copyright (c) Microsoft. All rights reserved.
#![deny(rust_2018_idioms)]
#![warn(clippy::all, clippy::pedantic)]
#![allow(
clippy::default_trait_access,
clippy::let_and_return,
clippy::let_underscore_drop,
clippy::let_unit_value,
clippy::missing_errors_doc,
clippy::module_name_repetitions,
... | 35.971564 | 124 | 0.561726 |
c19819ded77aa45559cb14edabaf0b5ca6471168 | 979 | use rpc::{commands, types, RpcClient};
use std::env;
use url::Url;
mod get_balance_from_block;
mod get_blocks_in_chain;
mod get_invalid_blocks_in_chain;
fn get_rpc_client() -> RpcClient {
let tezos_node_url = get_tezos_node_url_for_test();
RpcClient::new(tezos_node_url)
}
fn get_tezos_node_url_for_test() -> ... | 23.309524 | 76 | 0.674157 |
72993e672195eb6ca9149039ec09ff17ca12be66 | 5,365 | #[cfg(test)]
pub mod helpers {
use super::*;
use crate::contract::query;
use crate::contract::{instantiate, INITIAL_MIXNODE_BOND};
use crate::transactions::{try_add_gateway, try_add_mixnode};
use config::defaults::DENOM;
use cosmwasm_std::coin;
use cosmwasm_std::from_binary;
use cosmwasm... | 29.157609 | 96 | 0.534949 |
de84b039aceae49c0b0dcc01dbbed367bba79a39 | 1,991 | // PNG Pong
//
// Copyright © 2019-2020 Jeron Aldaron Lau
// Copyright © 2014-2017 Kornel Lesiński
// Copyright © 2005-2016 Lode Vandevenne
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// https://apache.org/licenses/LICENSE-2.0>, or the Zlib License, <LICENSE-ZLIB
// or http://opensource.org... | 29.279412 | 80 | 0.598192 |
8710fb5b87194b4c291d0b5188f59a8ef0ddbf5c | 16,926 | /*
* Copyright 2019 DTAI Research Group - KU Leuven.
* License: Apache License 2.0
* Author: Laurens Devos
*/
use num::{Integer, One};
use std::mem::{size_of};
use std::slice;
use std::ops::{BitAnd, BitOr, Shr, Shl, Not, Deref, DerefMut};
use std::convert::From;
// - Utilities ------------------------------... | 28.543002 | 104 | 0.500177 |
723f2cd5edcacec6fe7956e0c22a03357a5e98a2 | 5,560 | use map_gui::tools::{draw_isochrone, ChooseSomething, ColorLegend};
use map_gui::ID;
use map_model::AmenityType;
use widgetry::{
Cached, Choice, Color, Drawable, EventCtx, GfxCtx, HorizontalAlignment, Line, Panel,
SimpleState, State, TextExt, Transition, VerticalAlignment, Widget,
};
use crate::isochrone::{Bor... | 31.771429 | 99 | 0.546763 |
d75afddf30f5543f64527d575fdd6838da8630f2 | 10,136 | use crate::utility::*;
use crate::*;
use azure_kinect_sys::k4a::*;
use std::ptr;
pub struct Device<'a> {
pub(crate) api: &'a azure_kinect_sys::api::Api,
pub(crate) handle: k4a_device_t,
}
#[derive(Copy, Clone)]
pub struct ColorControlCapabilities {
pub supports_auto: bool,
pub min_value: i32,
pub ... | 34.127946 | 109 | 0.639108 |
d541779ac0de226bf1380ded5b0b016cd7196528 | 1,720 | /// The ContentFilterProperty_t field provides all the required information to
/// enable content filtering on the Writer side. For example, for the default
/// DDSSQL filter class, a valid filter expression for a data type containing
/// members a, b and c could be “(a < 5) AND (b == %0) AND (c >= %1)” with
/// expres... | 47.777778 | 79 | 0.719186 |
64c020dc2dc2ab415ba03e545e1a2df3cdece861 | 2,890 | use crate::gles2::gles2_bindings::types::GLenum;
use crate::gles2::{gles2_bindings, GlContext, LocationId};
use crate::RafxResult;
pub fn is_uniform_buffer_field_type(gl_type: GLenum) -> bool {
match gl_type {
gles2_bindings::INT
| gles2_bindings::BOOL
| gles2_bindings::FLOAT
| gles... | 39.054054 | 95 | 0.661246 |
6479df59a386f404a76b775c0746c2537096ce8b | 645 | // This powerful wrapper provides the ability to store a positive integer value.
// Rewrite it using generics so that it supports wrapping ANY type.
// Execute `rustlings hint generics2` for hints!
struct Wrapper<T> {
value: T,
}
impl<T> Wrapper<T> {
pub fn new(value: T) -> Self {
Wrapper { value }
... | 18.970588 | 80 | 0.603101 |
14924c260a17987b56d064f63b1a0457921f9a02 | 10,824 | #![deny(rust_2018_idioms, warnings)]
#![allow(clippy::type_complexity)]
use std::future::Future;
use std::rc::Rc;
use std::task::{self, Context, Poll};
mod and_then;
mod and_then_apply_fn;
mod apply;
mod apply_cfg;
pub mod boxed;
mod fn_service;
mod fn_transform;
mod map;
mod map_config;
mod map_err;
mod map_init_err... | 30.150418 | 98 | 0.64357 |
4a06d98622bbdb78e553315bbda2b77238201c42 | 1,732 | #![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... | 31.490909 | 80 | 0.76963 |
e88f64bd427edd6643a2e143e3734c24829de847 | 20,507 | #[doc = "Register `PWM_CAPINEN` reader"]
pub struct R(crate::R<PWM_CAPINEN_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<PWM_CAPINEN_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<PWM_CAPINEN_SPEC>> for R {
#[inline(always)]
fn f... | 32.8112 | 425 | 0.59487 |
5d8830abb4721ab1d1173c76d96e778c1add99f6 | 2,703 | pub mod docker;
#[cfg(not(windows))]
pub mod posix_perm;
pub mod serde_string;
pub mod sys;
#[cfg(windows)]
pub mod win_perm;
use std::{mem,
time::Duration};
/// Provide a way to convert numeric types safely to i64
pub trait ToI64 {
fn to_i64(self) -> i64;
}
impl ToI64 for usize {
fn to_i64(self) -... | 25.5 | 98 | 0.54458 |
016bac1a78f37d7a39ec118083f17ad0f9c1f6ae | 723 | use serde_json::Value;
use super::super::errors;
use super::super::scope;
#[allow(missing_copy_implementations)]
pub struct Not {
pub url: url::Url,
}
impl super::Validator for Not {
fn validate(&self, val: &Value, path: &str, scope: &scope::Scope) -> super::ValidationState {
let schema = scope.resol... | 24.931034 | 97 | 0.554633 |
f4f21f1a0648f86346b77b4b25c2fbec395b8f84 | 1,340 | use serde::{Deserialize, Serialize};
use std::borrow::Cow;
use vila::{EmptyResponse, Request, RequestData};
pub mod matchers;
pub struct EmptyHello;
impl Request for EmptyHello {
type Data = ();
type Response = EmptyResponse;
fn endpoint(&self) -> Cow<str> {
"/hello".into()
}
}
#[derive(Ser... | 17.631579 | 51 | 0.607463 |
76891f44e2991fb1c98fe1f96c1a88abcf00c3c7 | 408 | pub use crate::{
IntoQueueNameClient, IntoQueueServiceClient, MessageBodyRequired, MessageBodySupport,
MessageTTLRequired, MessageTTLSupport, NumberOfMessagesOption, NumberOfMessagesSupport,
PopReceiptRequired, PopReceiptSupport, QueueNameService, QueueService, VisibilityTimeoutOption,
VisibilityTimeout... | 51 | 99 | 0.845588 |
e4697f172644dba9049bc6b510c45ed73fd24213 | 695 |
extern crate std;
use std::sync::mpsc::{channel, Receiver, Sender};
use std::sync::Mutex;
use serde_json::Value;
use chatroom::ChatRoom;
use user::User;
lazy_static!{
pub static ref SRV_MSG: (Mutex<Sender<SrvMsg>>, Mutex<Receiver<SrvMsg>>) = {
let (tx, rx) = channel();
(Mutex::new(tx), Mutex::new... | 20.441176 | 80 | 0.656115 |
fc2be53d73d2a14e7e00b01d5027766987cf09e6 | 5,207 | use crate::modules::{RevisionDateNode, RevisionNode};
use crate::parser::*;
use crate::Node;
use nom::branch::alt;
use nom::bytes::complete::{tag, take_while_m_n};
use nom::character::complete::{char, multispace0, multispace1};
use nom::error::{make_error, ErrorKind};
use nom::multi::many0;
use nom::sequence::delimite... | 29.754286 | 76 | 0.541195 |
08379240ba6ca1d64419fe35d76845f4fa0d6da6 | 27,044 | use crate::context::CommandRegistry;
use crate::errors::ShellError;
use crate::evaluate::{evaluate_baseline_expr, Scope};
use crate::object::TaggedDictBuilder;
use crate::parser::{hir, Operator};
use crate::prelude::*;
use crate::Text;
use chrono::{DateTime, Utc};
use chrono_humanize::Humanize;
use derive_new::new;
use... | 33.470297 | 104 | 0.4797 |
e2fb7e05495e31450734a7962590991e29b60965 | 3,823 | // Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use std::path::Path;
use crate::{
api::{RpcGatewayServer, SignedTransaction, TransactionBytes},
rpc_gateway::responses::{GetObjectInfoResponse, ObjectResponse, SuiTypeTag},
};
use anyhow::anyhow;
use async_trait::async_trait;
use ... | 26.365517 | 88 | 0.627779 |
72a39c15ee6c894528431e42d6e6451d0ae657f5 | 2,541 | use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct Player {
pub name: String,
pub connection_id: String,
}
pub type LobbyId = String;
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct Lobby {
pub id: LobbyId,
pub players: Vec... | 27.923077 | 101 | 0.644235 |
149cc5c73cd02d4f2468258e95f14a18bfc80e24 | 1,280 | // Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use executable_helpers::helpers::{setup_executable, ARG_CONFIG_PATH, ARG_DISABLE_LOGGING};
use signal_hook;
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
};
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = je... | 27.826087 | 91 | 0.625 |
ccac3bf7343b1c04ef2deb9c9c7e8b6f1f018644 | 1,131 | // One tricky thing about the macros is that the `assert_approx_eq` crate doesn't support messages
// when something fails. This means that it can be hard to tell which of the many sub assertions is
// the one that failed.
#[macro_export]
macro_rules! assert_tuple_approx_eq {
($a:expr, $b:expr) => {{
use a... | 30.567568 | 99 | 0.591512 |
4be9c8d3f0ba256d4ccd4d9d22e84783045c59cf | 2,617 | use std::env;
use std::fmt;
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() != 3 {
println!("Usage: fastpebsym <depth> <total-amt>");
std::process::exit(1);
}
let depth = args[1].parse::<u32>();
let height = args[2].parse::<u32>();
if depth.is_err() {
... | 24.457944 | 100 | 0.495224 |
3a5e7e8cb78f998e618b303877e83c9ead9db460 | 6,136 | pub use crate::{Arena, Handle};
impl crate::Module {
/// Apply the usual default interpolation for vertex shader outputs and fragment shader inputs.
///
/// For every [`Binding`] that is a vertex shader output or a fragment shader
/// input, and that has an `interpolation` or `sampling` of `None`, assi... | 51.133333 | 105 | 0.535365 |
2224bf5f66e90103c4f2542583f0e849b4779797 | 75,994 | use std::any::{type_name, Any};
use std::cell::{Cell, RefCell};
use std::collections::BTreeSet;
use std::env;
use std::ffi::OsStr;
use std::fmt::{Debug, Write};
use std::fs;
use std::hash::Hash;
use std::ops::Deref;
use std::path::{Component, Path, PathBuf};
use std::process::Command;
use std::time::{Duration, Instant}... | 39.051387 | 134 | 0.548754 |
33f3ad79838e9f79f9dc6fb34a43584fc0058f3e | 737 | //! A plugin to demonstrate getting and setting blocks in the world.
use quill::{entities::Player, BlockState, Game, Plugin, Position};
quill::plugin!(BlockAccess);
pub struct BlockAccess;
impl Plugin for BlockAccess {
fn enable(_game: &mut quill::Game, setup: &mut quill::Setup<Self>) -> Self {
setup.ad... | 26.321429 | 80 | 0.632293 |
5d73eb53da2f926e11b2650d2068a1bd221d07b7 | 1,316 | // structs2.rs
// Address all the TODOs to make the tests pass!
#[derive(Debug)]
struct Order {
name: String,
year: u32,
made_by_phone: bool,
made_by_mobile: bool,
made_by_email: bool,
item_number: u32,
count: u32,
}
fn create_order_template() -> Order {
Order {
name: String::... | 26.857143 | 82 | 0.645137 |
386f8106044b80e821a92be73b3c8bfc2be0751e | 1,299 | mod link;
use serenity::{
client::Context,
model::{
id::GuildId,
interactions::{ApplicationCommandOptionType, Interaction},
},
};
pub async fn register(ctx: &Context, guild_id: GuildId, application_id: u64) {
Interaction::create_guild_application_command(&ctx.http, guild_id, applicatio... | 32.475 | 96 | 0.539646 |
f7d700ea8dab164607471c339c33d500bffb52e4 | 4,489 | use std::borrow::Cow;
#[cfg(not(feature = "http"))]
use std::fs::File;
use std::path::{Path, PathBuf};
#[cfg(feature = "http")]
use reqwest::Client;
#[cfg(feature = "http")]
use tokio::{fs::File, io::AsyncReadExt};
use url::Url;
#[cfg(feature = "http")]
use crate::error::{Error, Result};
/// Enum that allows a user ... | 30.537415 | 105 | 0.521051 |
039f4e97ea6c1611a658f6a22adaaac9f43be88a | 41,398 | // Copyright Materialize, Inc. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License... | 41.522568 | 100 | 0.547756 |
9160f2ed659deab0ac8a522aa37f38d1bd02bd8d | 1,202 | use crate::math::{AngVector, Vector, SPATIAL_DIM};
use na::{DVectorSlice, DVectorSliceMut};
use na::{Scalar, SimdRealField};
use std::ops::AddAssign;
#[derive(Copy, Clone, Debug)]
#[repr(C)]
//#[repr(align(64))]
pub struct DeltaVel<N: Scalar + Copy> {
pub linear: Vector<N>,
pub angular: AngVector<N>,
}
impl<N... | 25.574468 | 78 | 0.599002 |
28fad62db0604bcc43ea32cc8716bf80c8f01ecb | 806 | use rand::Rng;
use std::cmp::Ordering;
use std::io;
pub fn start() {
println!("Guess the number!");
let secret_number = rand::thread_rng().gen_range(1, 100);
loop {
println!("Please input your guess");
let mut guess = String::new();
io::stdin()
.read_line(&mut guess)
... | 26.866667 | 61 | 0.483871 |
29593f7d8ceedab3568ace0f73f096f3fa25ee6e | 2,508 | #[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::DSCR {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut ... | 23.660377 | 59 | 0.496411 |
8a2d3418c257b2c85292836dd8e2ec56d20a1bf9 | 2,088 | use crate::{DirectionalLight, PointLight, StandardMaterial};
use bevy_asset::Handle;
use bevy_ecs::{bundle::Bundle, component::Component};
use bevy_render2::{
mesh::Mesh,
primitives::{CubemapFrusta, Frustum},
view::{ComputedVisibility, Visibility, VisibleEntities},
};
use bevy_transform::components::{Global... | 31.636364 | 113 | 0.717912 |
334cae38422e9cf148e70a255ca0e679089208ca | 3,804 | //! There are cases where you may want to interrupt this synchronous execution of the Wasm module
//! while the it is calling a host function. This can be useful for saving resources, and not
//! returning back to the guest Wasm for execution, when you already know the Wasm execution will
//! fail, or no longer be need... | 34.581818 | 101 | 0.618822 |
23b083d408fd5867f580b6387ce107a234e85bbf | 428 | use std::env;
use std::fs;
fn main() {
let args: Vec<String> = env::args().collect();
let file_name = match args.len() {
0 | 1 => {
panic!("invalid argument length");
}
_ => args.get(1).unwrap(),
};
let contents = fs::read_to_string(file_name)
.expect("Somethin... | 19.454545 | 57 | 0.530374 |
4b10451c81363dbee8596fdbc22163184ad03109 | 5,188 | // 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.628931 | 79 | 0.689476 |
8768c18215711afc03ae57d7466096f1e6170f4f | 1,488 | // Copyright 2020 The Grin Developers
//
// 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 agree... | 24.393443 | 87 | 0.757392 |
22878471f84237f649a90285ea9d16a14e83e878 | 1,670 | use std::{
collections::HashMap,
path::{Path, PathBuf},
sync::{Arc, Once, RwLock, Weak},
};
use super::{Result, ResultWrap, StorageData};
type Storages = Arc<RwLock<HashMap<PathBuf, Weak<StorageData>>>>;
static mut STORAGES: Option<Storages> = None;
static INITIALIZE_STORAGES: Once = Once::new();
#[inli... | 25.30303 | 84 | 0.576048 |
221fa10b1046a710b094e6c1923fc902945b6ca8 | 4,595 | use crate::connection;
use crate::db;
use crate::oracle;
use crate::process_manager;
use crate::rollover_taker;
use anyhow::Result;
use async_trait::async_trait;
use futures::StreamExt;
use maia::secp256k1_zkp::schnorrsig;
use model::OrderId;
use std::time::Duration;
use time::OffsetDateTime;
use tokio_tasks::Tasks;
us... | 28.899371 | 102 | 0.573014 |
db0912e601d0444b237f1faf9000eff876ca22b4 | 2,148 | use crate::{Address, Gas};
/// Holds `Transaction` **agnostic** content.
///
/// Once created it **can't** be modified (immutable).
///
/// The [`Envelope`]'s data should be passed externally from the `Node`.
/// That's why we are not allowed to touch its content, and have it immutable.
#[derive(Debug, Clone, PartialE... | 24.689655 | 87 | 0.549814 |
5d62fa5553a24deaa1f7c67712c13456be9e70f3 | 11,911 | //! Source implementation for MySQL database.
mod errors;
mod typesystem;
pub use self::errors::MySQLSourceError;
use crate::{
data_order::DataOrder,
errors::ConnectorXError,
sources::{PartitionParser, Produce, Source, SourcePartition},
sql::{count_query, get_limit, CXQuery},
};
use anyhow::anyhow;
us... | 27.132118 | 139 | 0.522878 |
8fe7ee15ef3e1f4071c9abe3f7073f49d31d0752 | 1,888 | use super::*;
#[test]
fn with_number_or_atom_second_returns_first() {
with_process_arc(|arc_process| {
TestRunner::new(Config::with_source_file(file!()))
.run(
&(
strategy::term::local_reference(arc_process.clone()),
strategy::term::number... | 27.362319 | 82 | 0.555085 |
1e40ff24e3ae5a90dc9a3c82933a36b005c567c7 | 25,549 | use expect_test::expect;
use super::{check_infer, check_no_mismatches, check_types};
#[test]
fn bug_484() {
check_infer(
r#"
fn test() {
let x = if true {};
}
"#,
expect![[r#"
10..37 '{ ... {}; }': ()
20..21 'x': ()
24..34... | 23.656481 | 205 | 0.377001 |
acbc127913d692b5efb896293553f51e2ecce337 | 3,486 | #[doc = r" Value read from the register"]
pub struct R {
bits: u16,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u16,
}
impl super::PACKET_RAM_0_255 {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(... | 23.714286 | 59 | 0.49082 |
87f489695dc94332e175ca2c714504794ba3d139 | 745 | use std::cmp::PartialOrd;
use std::fmt;
use std::str::FromStr;
use anyhow::Error;
use graph::impl_slog_value;
use crate::DataSource;
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd)]
pub struct NodeCapabilities {}
impl FromStr for NodeCapabilities {
type Err = Error;
fn from_str(_s: &str) -> Result<... | 21.911765 | 77 | 0.672483 |
9b956dbd0be36b56534c66e4552ac7e6ee461112 | 5,684 | use event::{Action, MouseButton, WindowEvent};
use na::{self, Matrix3, Point2, Translation2, Vector2};
use num::Pow;
use planar_camera::PlanarCamera;
use resource::ShaderUniform;
use std::f32;
use window::Canvas;
/// A 2D camera that can be zoomed and panned.
#[derive(Clone, Debug)]
pub struct Sidescroll {
at: Poi... | 30.724324 | 91 | 0.562808 |
bfbe763f05d94c331acc72b4020fcd2048f650e9 | 13,637 | // Copyright Materialize, Inc. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License... | 33.671605 | 99 | 0.485077 |
16e074e9d08c63b9f1ee05f0bece0cb1f6e491b3 | 81 | #[macro_use]
extern crate quick_error;
pub mod node;
pub mod path;
pub mod net;
| 11.571429 | 25 | 0.740741 |
c149f373edef20e40058ccd915449d9decaf532f | 16,394 | //! QUIC connection transport parameters
//!
//! The `TransportParameters` type is used to represent the transport parameters
//! negotiated by peers while establishing a QUIC connection. This process
//! happens as part of the establishment of the TLS session. As such, the types
//! contained in this modules should ge... | 38.393443 | 146 | 0.55441 |
e8c59d07b3ac3982b6185bf3e815e69837eb02a7 | 51,921 | use super::grammars::{ExternalToken, LexicalGrammar, SyntaxGrammar, VariableType};
use super::nfa::CharacterSet;
use super::rules::{Alias, AliasMap, Symbol, SymbolType};
use super::tables::{
AdvanceAction, FieldLocation, GotoAction, LexState, LexTable, ParseAction, ParseTable,
ParseTableEntry,
};
use core::ops:... | 34.963636 | 98 | 0.47189 |
712c2ef944b8115196ea0354dce49c7bf7f5bf4e | 10,328 | use std::fs::File;
use std::io::{BufWriter, Result, Write};
use std::path::Path;
use super::Object::*;
use super::{Dictionary, Document, Object, Stream, StringFormat};
use crate::xref::*;
impl Document {
/// Save PDF document to specified file path.
#[inline]
pub fn save<P: AsRef<Path>>(&mut self, path: P... | 34.426667 | 134 | 0.490802 |
9b4085f2a961b822d3245e89799a997480f6e814 | 7,794 | #[doc = "Register `sf2_if_io_dly_0` reader"]
pub struct R(crate::R<SF2_IF_IO_DLY_0_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<SF2_IF_IO_DLY_0_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::convert::From<crate::R<SF2_IF_IO_DLY_0_SPEC>> for R {... | 31.942623 | 412 | 0.6165 |
1a5a3aed6047bbd4b46557750019d0fae80fc371 | 3,280 | use time::{at_utc, Tm, Timespec};
use json::{FromJsonnable, ToJsonnable};
use serde::de::{Error, Type};
use serde_json::value::Value;
use serde_json::error::Error as JsonError;
use serde_json::builder::ObjectBuilder;
impl FromJsonnable for Tm {
// Deserialize via Timespec
fn from_json(json: Value) -> Result<Self, J... | 25.625 | 91 | 0.609756 |
21ce975aa499e678ae7390df06dbada4721c1ede | 2,040 | /*
* MIT License
*
* Copyright (c) 2017 Robert Swain <robert.swain@gmail.com
*
* 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 rig... | 34.576271 | 92 | 0.687745 |
9c160a1b63fcb98bc07a70ab5284f1f0ba50f713 | 4,150 | #[doc = "Register `DIEPTSIZ0` reader"]
pub struct R(crate::R<DIEPTSIZ0_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<DIEPTSIZ0_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<DIEPTSIZ0_SPEC>> for R {
#[inline(always)]
fn from(read... | 29.856115 | 431 | 0.596386 |
bb99a4196d0eb51b7c7bebbe4b4dc36acefd293c | 6,580 | /*
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 not use this f... | 35.956284 | 98 | 0.64848 |
d78a7959bda4d17f26ae0244b992a00d6d97b053 | 2,245 | extern crate birl;
fn main(){
/* Print heading info. */
eprintln!("O SHELL QUE CONSTRÓI FIBRA. VERSÃO {}", env!("CARGO_PKG_VERSION"));
eprintln!("BIRL © 2018, RAFAEL RODRIGUES NAKANO.");
eprintln!("SHELL © 2018, MATHEUS BRANCO BORELLA.");
eprintln!();
/* Setup BIRL.
* The Context interpreter is not built to ... | 26.411765 | 79 | 0.638307 |
671d2e3837c798d8bad9bc820be0e4c4edd602d8 | 4,775 | // 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 ... | 35.37037 | 83 | 0.54911 |
08b6c3141a1e3acb8730359768b0c1f616f8f582 | 227 | pub fn slice_1(s: &String) -> usize {
let bytes = s.as_bytes();
for (i, &item) in bytes.iter().enumerate() {
// Declare ' ' to byte.
if item == b' ' {
return i;
}
}
s.len()
}
| 20.636364 | 48 | 0.440529 |
90c27ca74fcc3edb114c59fd88b2c4295d2edd90 | 3,206 | <?xml version="1.0" encoding="UTF-8"?>
<WebElementEntity>
<description></description>
<name>i_menu</name>
<tag></tag>
<elementGuidId>3075b26f-8515-4202-9dc2-329f156e4fb3</elementGuidId>
<selectorCollection>
<entry>
<key>CSS</key>
<value>#main-view > div > div.navbar > div > div.le... | 38.166667 | 283 | 0.658141 |
76a4cde02b60d1a7d92e541b1d604136023876c4 | 66,959 | use flo_draw::*;
use flo_draw::canvas::*;
use flo_curves::*;
use flo_curves::bezier::*;
use flo_curves::bezier::path::*;
use futures::prelude::*;
use futures::executor;
use futures::stream;
use std::f64;
use std::thread;
use std::time::{Duration, Instant};
///
/// Demonstrates capturing the paths for a complicated r... | 34.373203 | 130 | 0.792425 |
61b7c11d07156ba70b27e2cb9b382bac8413d68b | 23,985 | //! Support code for rustc's built in unit-test and micro-benchmarking
//! framework.
//!
//! Almost all user code will only be interested in `Bencher` and
//! `black_box`. All other interactions (such as writing tests and
//! benchmarks themselves) should be done via the `#[test]` and
//! `#[bench]` attributes.
//!
//... | 34.61039 | 103 | 0.5867 |
501af6a11dd4272e4c49c31fe498631a0da25293 | 1,145 | use crate::internal_prelude::*;
#[cfg(hdf5_1_8_15)]
mod hdf5_1_8_15 {
use super::*;
#[repr(C)]
#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
pub enum H5PL_type_t {
H5PL_TYPE_ERROR = -1,
H5PL_TYPE_FILTER = 0,
H5PL_TYPE_NONE = 1,
}
pub use self::H5PL_type_t::*;
... | 29.358974 | 86 | 0.661135 |
fe8b82fcf5582c4bf95f937004b4feed70561032 | 5,995 | //! Mappings between old and new `NodeId`s. Also has some support for `AttrId`s.
use std::collections::hash_map::Entry;
use std::collections::{BTreeSet, HashMap, HashSet};
use std::mem;
use std::ops::Bound::Included;
use std::ops::Deref;
use syntax::ast::{AttrId, NodeId, DUMMY_NODE_ID};
use syntax::source_map::symbol:... | 35.05848 | 99 | 0.493078 |
72e868fb95b9997ea542213248d710333b97391c | 40,077 | use std::{
path::Path,
process::Command,
sync::{
atomic::{AtomicBool, Ordering},
Arc, RwLock,
},
thread,
time::Duration,
};
use glium::{
backend::glutin::Display,
glutin::{
event::{ElementState, ModifiersState, MouseScrollDelta, VirtualKeyCode, WindowEvent},
... | 38.132255 | 108 | 0.39761 |
48bcd93b1c2420501ade2b082e5e083155243d9d | 4,083 | // Copyright 2021, The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// di... | 35.504348 | 119 | 0.643155 |
01a0a42c638cbb18d040dd69a4baf380a598be83 | 1,901 | use libc::c_char;
use scraper::{ElementRef, Html, Selector};
use std::ffi::{CStr, CString};
pub struct NokogiriRust {
document: Html,
}
impl NokogiriRust {
fn parse(html: &str) -> Self {
NokogiriRust {
document: Html::parse_document(html),
}
}
fn at_css(&self, selector: &s... | 21.602273 | 86 | 0.596528 |
4a61853be4ea6c70a4549dc453a9cf495e3ea7a7 | 674 | // Copyright 2021 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | 33.7 | 75 | 0.753709 |
56d903fed3b564f3afd468a44d866640eb1bf27a | 23,501 | // 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... | 30.720261 | 99 | 0.489171 |
7a7d65f654cbb9cca919ae62db2f36cefeb7b0be | 11,026 | use crate::{
json_wallet::{
Aes128Ctr, ChecksumModule, Cipher, CipherModule, Crypto, EmptyMap, EmptyString, JsonWallet,
Kdf, KdfModule, Sha256Checksum, TypeField, Version,
},
KeyType, ValidatorPath,
};
pub use bip39::{Mnemonic, Seed as Bip39Seed};
pub use eth2_key_derivation::{DerivedKey, De... | 33.311178 | 105 | 0.583893 |
3ac7ea7cccea1f5ccc7e11de52277e5509da0254 | 360 | #![allow(dead_code)]
//! Runtime Driver Protocol
//!
//! The runtime driver protocol...
pub const PROTOCOL_GUID: r_efi::base::Guid = r_efi::base::Guid::from_fields(
0xd487ddb4,
0x008b,
0x11d9,
0xaf,
0xdc,
&[0x00, 0x10, 0x83, 0xff, 0xca, 0x4d],
);
#[repr(C)]
pub struct Protocol {... | 20 | 77 | 0.6 |
1d9e6f7b6443864a7e9998c94484f55c1437bac1 | 45 | pub mod ocean;
pub mod paint;
pub mod shape;
| 11.25 | 14 | 0.733333 |
4a88419426130fca46c617065048e6a4525a5933 | 7,793 | #![allow(trivial_casts)]
use super::{InnermostTypeId, Metadata, Pointer};
use core::{
any::{Any, TypeId},
cell::{Ref, RefCell, RefMut},
marker::Unsize,
ptr,
};
#[cfg(all(feature = "alloc", not(feature = "std")))]
use alloc::{boxed::Box, rc, sync};
#[cfg(feature = "std")]
use std::{boxed::Box, rc, syn... | 23.831804 | 90 | 0.594123 |
ab51016c459154b3660cc7584ac6162d4fc14a6c | 3,582 | // Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::FuzzTarget;
use failure::prelude::*;
use sha1::{Digest, Sha1};
use solana_libra_proptest_helpers::ValueGenerator;
use std::{
env,
ffi::OsString,
fs,
io::Write,
path::{Path, PathBuf},
process::Command,... | 30.10084 | 100 | 0.590173 |
0e9a207e5fb44e2b2e6d64f23e082f9758697945 | 1,386 | #![no_std]
#[macro_use]
extern crate alloc;
extern crate contract_ffi;
use contract_ffi::contract_api::{runtime, storage, Error, TURef};
use contract_ffi::key::Key;
use contract_ffi::unwrap_or_revert::UnwrapOrRevert;
use contract_ffi::value::uint::U512;
const POS_CONTRACT_NAME: &str = "pos";
const UNBOND_METHOD_NAM... | 33 | 91 | 0.718615 |
ffee169323a9fd3996d130753f251e71c0cc154c | 1,859 | /*
Copyright 2019 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 ag... | 23.833333 | 75 | 0.607854 |
fe08ae6dd393ed86ce8d3a005620aaf0678151c2 | 2,565 | #[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::_2_DBRISE {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R... | 25.65 | 74 | 0.5423 |
2864af72349023f057aa88e114715fe5fa9de560 | 1,026 | #![feature(c_unwind)]
#[macro_use]
extern crate gmod;
extern crate font_loader as fonts;
use fonts::system_fonts;
#[lua_function]
unsafe fn get_installed_fonts(lua: gmod::lua::State) -> i32 {
let sys_fonts = system_fonts::query_all();
lua.new_table();
for (i, font) in sys_fonts.iter().enumerate() {
lua.push_in... | 20.117647 | 61 | 0.692982 |
e46d66246c900c7c31185224ea8ba9e78b6a7647 | 23,440 | extern crate provider_archive;
use crate::keys::extract_keypair;
use crate::util::{convert_error, format_output, Output, OutputKind, Result};
use nkeys::KeyPairType;
use provider_archive::*;
use serde_json::json;
use std::fs::File;
use std::io::prelude::*;
use std::path::PathBuf;
use structopt::clap::AppSettings;
use s... | 31.505376 | 172 | 0.510538 |
8ae073c42b920e2480b6284ad235110ac9d424e6 | 19,888 | /*!
Provides a convenient and fluent builder interface for constructing policies.
# Example
```rust
use aws_iam::model::*;
use aws_iam::model::builder::*;
use aws_iam::io::write_to_writer;
use std::io::stdout;
let policy: Policy = PolicyBuilder::new()
.named("confidential-data-access")
.evaluate_statement(
... | 32.129241 | 99 | 0.527353 |
11a0b08f72b9a08a9d3a48b7e23863f74d758152 | 4,133 | use byteorder::{BigEndian, ReadBytesExt};
use log::*;
use multisock::{SocketAddr, Stream};
use ssh_agent::proto;
use ssh_agent::proto::public_key::PublicKey;
use ssh_agent::proto::signature;
use ssh_agent::proto::{from_bytes, to_bytes, Message};
use std::io::{Read, Write};
// use std::mem::size_of;
use std::net::Shutd... | 31.549618 | 85 | 0.530849 |
b9196acbcf9efb1a3e399fb37d5ad355089182b8 | 38,488 | // Copyright Materialize, Inc. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License... | 40.008316 | 100 | 0.549574 |
0e723f4100d5da865aae187284f513b8cc88def2 | 22,452 | //! The Daily Byte solutions.
use std::collections::{HashMap, HashSet, LinkedList, VecDeque};
use std::iter::FromIterator;
pub fn reverse_string(s: &str) -> String {
s.chars().rev().collect()
}
// Given two binary strings (strings containing only 1s and 0s) return
// their sum (also as a binary string). Note: neit... | 27.214545 | 121 | 0.614823 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.