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 |
|---|---|---|---|---|---|
6a09a2891a60eb31414e384fd0a6a511e3af9fff | 1,052 | #[doc = "Reader of register MDH1"]
pub type R = crate::R<u32, super::MDH1>;
#[doc = "Writer for register MDH1"]
pub type W = crate::W<u32, super::MDH1>;
#[doc = "Register MDH1 `reset()`'s with value 0"]
impl crate::ResetValue for super::MDH1 {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}
#... | 26.3 | 84 | 0.561787 |
9b1b7b52a14c79256368fa201ac97b138011e7a7 | 322 | #![doc(html_root_url = "https://docs.rs/tokio-channel/0.1.0")]
#![deny(missing_docs, warnings, missing_debug_implementations)]
//! Asynchronous channels.
//!
//! This crate provides channels that can be used to communicate between
//! asynchronous tasks.
extern crate futures;
pub mod mpsc;
pub mod oneshot;
mod lock... | 21.466667 | 72 | 0.73913 |
4ae9bc18b3d633d22c1196b6891ee914bbf0c1e4 | 917 | use dirs::GH_MIRRORS_DIR;
use errors::*;
use git;
use std::path::PathBuf;
pub fn repo_dir(url: &str) -> Result<PathBuf> {
let (org, name) = gh_url_to_org_and_name(url)?;
Ok(GH_MIRRORS_DIR.join(format!("{}.{}", org, name)))
}
pub fn gh_url_to_org_and_name(url: &str) -> Result<(String, String)> {
let mut co... | 26.970588 | 70 | 0.59651 |
489427ba1c126202be6eafe31f9d379f7a99074a | 2,557 | // 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 ... | 30.082353 | 93 | 0.68244 |
d9a4bcc28dfe095e2ad32e70420afd0e25405146 | 19,618 | // Copyright 2018-2021 Parity Technologies (UK) Ltd.
//
// 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 applicab... | 30.510109 | 99 | 0.663931 |
097812706416317db0ac8fe34ea907c8e0b4bfd4 | 1,295 | #![crate_name = "uu_whoami"]
/*
* This file is part of the uutils coreutils package.
*
* (c) Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/* last synced with: whoami (GNU coreutils) 8.21 */
... | 23.545455 | 74 | 0.555212 |
628cb08d5cc1409827a6ab1406435f7f55fa2749 | 705 | use bit_vec::BitVec;
#[derive(Debug, Default, Clone)]
pub struct Buffer(BitVec);
impl Buffer {
pub fn new() -> Self {
Self::default()
}
pub fn from_elem(n: usize, default: bool) -> Self {
Self(BitVec::from_elem(n, default))
}
pub fn push_field_list(&mut self, target: Self) {
... | 18.076923 | 55 | 0.548936 |
56e93b4f57de917176104ba22884e0ab9d33b0e1 | 4,833 | #[doc = "Register `MODE` reader"]
pub struct R(crate::R<MODE_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<MODE_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<MODE_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<MODE_SP... | 30.018634 | 394 | 0.581626 |
4a67973982e390ea7fd215da409da1a3c5c274b7 | 1,325 | //! Represents a margin around an axis-aligned rectangle.
use super::vec2::Vec2;
/// Represents a margin around an axis-aligned rectangle.
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C)]
pub struct Thickness {
/// Left x component
pub left: f64,
/// Top y component
pub top: f64,
/// Right x co... | 20.384615 | 75 | 0.524528 |
f5b80ce6a7b5aea5794074b9c2152f40f767b35c | 5,236 | //! This module contains the functions and macros for
//! sending a payload
//! for an HTTP connection, for at least two participants.
//!
//! *This module is available only if MultiCrusty is built with
//! the `"transport"` feature or the `"transport_http"` feature.*
use crate::binary::struct_trait::{send::Send, sess... | 27.851064 | 144 | 0.603896 |
e9008515cb2707166d87c6e09e6ed2962b0dcd4b | 1,933 | //! DMA channels.
#[cfg(any(
stm32_mcu = "stm32f100",
stm32_mcu = "stm32f101",
stm32_mcu = "stm32f102",
stm32_mcu = "stm32f103",
stm32_mcu = "stm32f107",
))]
mod f1;
#[cfg(any(stm32_mcu = "stm32f303"))]
mod f3;
#[cfg(any(
stm32_mcu = "stm32f401",
stm32_mcu = "stm32f405",
stm32_mcu = "st... | 22.476744 | 36 | 0.607346 |
6a81b8e21529e826fca530e9cec20e13bcf39b32 | 1,985 | use wabt::wat2wasm;
use wasmer_clif_backend::CraneliftCompiler;
use wasmer_runtime_core::{import::ImportObject, Instance};
fn main() {
let instance = create_module_1();
let result = instance.call("call-overwritten-element", &[]);
println!("result: {:?}", result);
}
fn create_module_1() -> Instance {
l... | 35.446429 | 95 | 0.631738 |
edbfded68b97b153fa554c95b77832a4a13cca28 | 26,685 | extern crate vsop87;
use vsop87::*;
#[test]
fn it_mercury() {
let coordinates = vsop87d::mercury(2451545.0);
assert!(coordinates.longitude() > 4.4293481035 && coordinates.longitude() < 4.4293481037);
assert!(coordinates.latitude() > -0.0527573410 && coordinates.latitude() < -0.0527573408);
assert!(coo... | 52.633136 | 94 | 0.699232 |
6a45a67ee03f373a640b11e07d9a795e2db27aec | 6,912 | // Copyright (c) 2017 Isobel Redelmeier
// Copyright (c) 2021 Miguel Barreto
//
// 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... | 27.759036 | 100 | 0.603733 |
336fe345954b0bd0fcb363858722c14a164b977c | 3,244 | /**
* [210] Course Schedule II
*
* There are a total of n courses you have to take, labeled from 0 to n-1.
*
* Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]
*
* Given the total number of courses and a list of prerequisite pa... | 33.791667 | 277 | 0.564735 |
118a4977ed4585bccf8bfdf8f126066078c11f5e | 1,670 | // 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
// disclai... | 55.666667 | 118 | 0.777844 |
f7d0ece1999f1cd790e59804be0369d2989012ad | 967 | use nu_engine::get_full_help;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, IntoPipelineData, PipelineData, Signature, Value,
};
#[derive(Clone)]
pub struct RandomCommand;
impl Command for RandomCommand {
fn name(&self) -> &str {
"random"
}
fn signatur... | 23.02381 | 69 | 0.559462 |
e9e6f922417e1268ae83381ca03485776da5df19 | 4,925 | #![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)]
//! <fullname>WAF</fullname>
//! <note>
//! <p>This is the latest version of the <b>WAF<... | 50.255102 | 159 | 0.730964 |
267010d85630cf974d17e40707fce0c382310757 | 9,365 | // Copyright 2018 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... | 28.815385 | 93 | 0.679765 |
ebeeb3b31cd5c4d9f8b5bf19575dc84c7493d615 | 1,526 | //! Delays
//!
//! # What's the difference between these traits and the `timer::CountDown` trait?
//!
//! The `Timer` trait provides a *non-blocking* timer abstraction and it's meant to be used to build
//! higher level abstractions like I/O operations with timeouts. OTOH, these delays traits only
//! provide *blocking... | 31.791667 | 100 | 0.590433 |
e89d300c908e6d87ccfbadbef2e27c47986b7229 | 5,532 | // Generated from definition io.k8s.api.flowcontrol.v1alpha1.QueuingConfiguration
/// QueuingConfiguration holds the configuration parameters for queuing
#[derive(Clone, Debug, Default, PartialEq)]
pub struct QueuingConfiguration {
/// `handSize` is a small positive number that configures the shuffle sharding of r... | 48.526316 | 647 | 0.585141 |
0163293c9d4e56446994f5ec18609c37e5bee805 | 744 | //! This is mostly an internal module, no stability guarantees are provided. Use
//! at your own risk.
mod traits;
mod impls;
mod slices;
mod closures;
pub use self::slices::WasmSlice;
pub use self::traits::*;
pub struct GlobalStack {
next: usize,
}
impl GlobalStack {
#[inline]
pub unsafe fn new() -> Gl... | 20.108108 | 80 | 0.587366 |
5037addcac50d7b6cadf13dd5b7901b01955b935 | 3,186 | /*
* Associated functions & Methods
*
* Some functions are connected to a particular type. These come in two forms:
* associated functions, and methods. Associated functions are functions that
* are defined on a type generally, while methods are associated functions that
* are called on a particular instance of a... | 27.230769 | 79 | 0.630885 |
8fb0c7f057f6e68fba6a4238908279ef565b7da4 | 8,367 | use console::style;
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
use lazy_static::lazy_static;
use rand::{rngs::ThreadRng, Rng, RngCore};
use std::fmt::Debug;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::thread;
use std::time::Duration;
#[derive(Debug, Clone)]
enum Action... | 31.573585 | 99 | 0.493725 |
fcb4cb03774a052a2e03ae33986f4a206601445f | 13,617 | use crate::duration::Duration;
use crate::helpers::{self, Helpers};
use core::cmp::Ordering;
use core::ops;
/// Represents an instant in time.
///
/// The generic `T` can either be `u32` or `u64`, and the const generics represent the ratio of the
/// ticks contained within the instant: `instant in seconds = NOM / DENO... | 39.699708 | 104 | 0.466549 |
ab7767eace8085b902842a410e0bc0b3783accba | 1,363 | use bracket_color::prelude::*;
use bracket_noise::prelude::*;
use bracket_random::prelude::*;
use crossterm::queue;
use crossterm::style::{Color::Rgb, Print, SetForegroundColor};
use std::io::{stdout, Write};
fn print_color(color: RGB, text: &str) {
queue!(
stdout(),
SetForegroundColor(Rgb {
... | 29 | 76 | 0.558327 |
5b7df88ab3f11c9b0642fa7c21f771671050e295 | 4,868 | // Copyright 2014 Pierre Talbot (IRCAM)
// 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... | 39.577236 | 208 | 0.687551 |
38f434a3b99cc3fc597e5fb8c3798208b4e68668 | 4,871 | use std::{
fmt::{self, Display, Formatter},
pin::Pin,
str::FromStr,
};
use tokio::io::{AsyncRead, BufReader};
use crate::{
http::{header, HeaderValue},
Body, IntoResponse, Response,
};
/// The compression algorithms.
#[cfg_attr(docsrs, doc(cfg(feature = "compression")))]
#[derive(Debug, Copy, Clo... | 26.911602 | 98 | 0.561486 |
f9d2271624578054e525f20d4ed41fffc93d7fe4 | 747 | use gtk::prelude::*;
use crate::gui_data::GuiData;
use crate::help_functions::*;
use crate::notebook_enums::*;
pub fn connect_notebook_tabs(gui_data: &GuiData) {
let shared_buttons = gui_data.shared_buttons.clone();
let buttons_array = gui_data.bottom_buttons.buttons_array.clone();
let notebook_main_clone... | 37.35 | 135 | 0.746988 |
dd94fd17fc3a98b924152860a02f3787ba416d9a | 54 | pub mod script;
pub mod nginx_module;
mod nginx_utils; | 18 | 21 | 0.814815 |
9cdbe0e18eab95abcbaf89ae47b81e59bb2fc506 | 3,171 | use proc_macro2::TokenStream as TokenStream2;
use quote::quote;
use rtfm_syntax::{ast::App, Context};
use crate::{
analyze::Analysis,
codegen::{locals, module, resources_struct, util},
};
pub fn codegen(
app: &App,
analysis: &Analysis,
) -> (
// const_app
Vec<TokenStream2>,
// mod_init
... | 26.872881 | 96 | 0.509618 |
fbcfeab99a4deffb9f59a107024aa00c326c282a | 4,071 | // texture.rs
// Texturing functions
// Stephen Marz
// 15 Dec 2020
use crate::perlin::Perlin;
use crate::vector::{Color, Vec3};
use std::fs::File;
use std::sync::Arc;
pub trait Texture {
fn value(&self, u: f64, v: f64, point: &Vec3) -> Color;
}
// TEXTURES
// Solid color
#[derive(Default)]
pub struct SolidColor {... | 21.770053 | 96 | 0.622206 |
033a84305f00bbcb01ec710830951e091d07e3c9 | 5,196 | use backend::*;
struct RoomBuilder {}
impl RoomBuilder {
fn new() -> Box<Self> {
Box::new(Self {})
}
}
fn noise_map(
seed: u64,
octaves: i32,
gain: f32,
lacunarity: f32,
freq: f32,
frames: &mut Vec<(Map, String)>,
x_scale: f32,
y_scale: f32,
title: &str,
) {
le... | 30.034682 | 96 | 0.439376 |
aca50859b6eda9cc7f18ad6bf5080fb8b11a86af | 699 | // 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 ... | 29.125 | 68 | 0.72103 |
1abff1d3125b9139bde84f0c7f992e7058b12721 | 1,772 | use crate::helpers::computer::Computer;
use crate::helpers::file::{read, write};
pub fn ex02() {
let e = "02";
let s = read(e);
write(
e,
&sub1(&s, Some((12, 2))).to_string(),
&sub2(&s).to_string(),
);
}
pub fn sub1(s: &str, args: Option<(i64, i64)>) -> i64 {
let program = ... | 22.15 | 74 | 0.469526 |
d771c690c8fc9cd9d368ac48e0564aa498555222 | 10,177 | //! Contains components suitable to create an array out of N other arrays, by slicing
//! from each in a random-access fashion.
use crate::array::*;
use crate::datatypes::*;
mod binary;
pub use binary::GrowableBinary;
mod boolean;
pub use boolean::GrowableBoolean;
mod fixed_binary;
pub use fixed_binary::GrowableFixed... | 32.104101 | 97 | 0.538371 |
f817df266cb1ce9d1c20488c74bc489f3ac5e80d | 12,309 | #[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::IER {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W... | 25.751046 | 69 | 0.504346 |
d9ad8d16e7638d29fc8e447b5dc07013d207b95b | 1,288 | use crate::soon_to_be_lib::spec::Spec;
use std::path::PathBuf;
#[derive(Debug, StructOpt)]
#[structopt(name = "anon-csv", about = "A CSV-file anonymizer")]
pub struct Args {
/// If set, print all available faker specifications
#[structopt(long = "all-specs")]
pub print_specs: bool,
/// If set, no addit... | 46 | 104 | 0.670031 |
644e6d5823167c838d925ed07f1f3faabb954b5f | 877 | use std::env::current_dir;
use std::fs::create_dir_all;
use cosmwasm_schema::{export_schema, remove_schemas, schema_for};
use my_first_contract::msg::{AllGardenersResponse, HandleMsg, InitMsg, QueryMsg};
use my_first_contract::state::Bonsai;
use my_first_contract::state::BonsaiList;
use my_first_contract::state::Gard... | 35.08 | 81 | 0.738883 |
086b45c6f17fb1b155c22b4aa227bf29dc716302 | 10,733 | #[doc = "Register `RST_MODE_P0` reader"]
pub struct R(crate::R<RST_MODE_P0_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<RST_MODE_P0_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<RST_MODE_P0_SPEC>> for R {
#[inline(always)]
fn f... | 29.567493 | 442 | 0.569925 |
1e6a2a7b92860d42a30e8a1835e8792e877c544b | 12,843 | mod convert;
use crate::{CalculatedSize, ControlNode, Node, Style};
use bevy_app::EventReader;
use bevy_ecs::{
entity::Entity,
query::{Changed, FilterFetch, With, Without, WorldQuery},
system::{Query, Res, ResMut},
};
use bevy_log::warn;
use bevy_math::Vec2;
use bevy_transform::prelude::{Children, Parent, ... | 35.282967 | 100 | 0.573231 |
c1624c4d2d0f8603a41d971bfd8d949adfc926c2 | 662 | //! OSC (Open Sound Control) protocol implementation.
pub mod address;
pub mod data;
pub mod error;
pub mod packet;
/// Prelude module, prefixed with `Osc` to avoid identifier conflict.
pub mod prelude {
pub use crate::address::Address as OscAddress;
pub use crate::data::Value as OscValue;
pub use crate::... | 31.52381 | 95 | 0.71148 |
d9eff81864f1a1bf89324a98757bc69231c59076 | 3,665 | use regex::Regex;
#[derive(Debug, Clone)]
pub struct Passport {
byr: Option<String>,
iyr: Option<String>,
eyr: Option<String>,
hgt: Option<String>,
hcl: Option<String>,
ecl: Option<String>,
pid: Option<String>,
cid: Option<String>,
}
lazy_static! {
static ref CM_REGEX: Regex = Rege... | 31.324786 | 89 | 0.490314 |
ab27750269a75e3b3c4fddf48b152e11dd1566ab | 11,312 | use std::cmp;
#[derive(Debug, PartialEq, Clone, Copy, Eq)]
pub enum Transform {
HeadToTop, HeadToRight, HeadToBottom, HeadToLeft,
HeadToTopInv, HeadToRightInv, HeadToBottomInv, HeadToLeftInv,
}
#[derive(Debug, PartialEq, Clone, Copy)]
pub struct LinearCoeffs {
pub shift: i16,
pub factor: f32
}
fn rec... | 31.248619 | 105 | 0.4718 |
d57a584f7db80164255c9b9974c610fb384aa3ef | 7,765 | // Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
//! The following macros are slightly modified from rust-bitcoin. The original file may be found
//! here:
//!
//! https://github.com/rust-bitcoin/... | 31.184739 | 131 | 0.41906 |
39be2248fc5ff12bb260bc4794b17f79fcc75112 | 2,832 | // Copyright 2018, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: Ryan A. Pavlik <ryan.pavlik@collabora.com>
use crate::{error::*, prelude::*, Buffer, ConstantBufferSize, Unbuffer, WrappedConstantSize};
use bytes::{BufMut, Bytes};
use std::time::{Duration, SystemTime};
#[derive(Clone, Copy, PartialEq,... | 25.745455 | 93 | 0.617232 |
56397106c41d62332525ce3c1b63aa34ff93fef0 | 7,045 | //! `String` impl
use crate::avm2::activation::Activation;
use crate::avm2::class::{Class, ClassAttributes};
use crate::avm2::method::{Method, NativeMethodImpl};
use crate::avm2::names::{Namespace, QName};
use crate::avm2::object::{primitive_allocator, Object, TObject};
use crate::avm2::value::Value;
use crate::avm2::... | 33.547619 | 126 | 0.550035 |
d98e4f439af8531a6b7ac030bc6264f32be0ac33 | 5,124 | use super::{rejection::*, FromRequest, RequestParts};
use async_trait::async_trait;
use std::sync::Arc;
/// Access the path in the router that matches the request.
///
/// ```
/// use axum::{
/// Router,
/// extract::MatchedPath,
/// routing::get,
/// };
///
/// let app = Router::new().route(
/// "/use... | 28.625698 | 93 | 0.516979 |
aca7ad192b857cc4f5364f35688482cb61c1a1d7 | 20,149 | use crate::{
avm1::SoundObject,
avm2::Event as Avm2Event,
avm2::SoundChannelObject,
display_object::{self, DisplayObject, MovieClip, TDisplayObject},
};
use downcast_rs::Downcast;
use gc_arena::Collect;
use generational_arena::{Arena, Index};
pub mod decoders;
pub mod swf {
pub use swf::{
r... | 33.414594 | 157 | 0.602362 |
f4511a1cac4864637ae394fa579fdc50373a522b | 2,043 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Manually modify vtable pointers to force a failure with restrictions.
// FIXME until the corresponding CBMC path lands: https://github.com/diffblue/cbmc/pull/6376
// kani-expect-fail
// kani-flags: ... | 24.614458 | 92 | 0.638767 |
d7caf02488a2bd6870ecd6ce4f970fa1d7c38938 | 14,817 | //! This module implements the global `Reflect` object.
//!
//! The `Reflect` global object is a built-in object that provides methods for interceptable
//! JavaScript operations.
//!
//! More information:
//! - [ECMAScript reference][spec]
//! - [MDN documentation][mdn]
//!
//! [spec]: https://tc39.es/ecma262/#sec-r... | 38.286822 | 128 | 0.590133 |
14d62fefc913556c6bc87bb64ae5b45728cd8e09 | 4,396 | use crate::v1::GENRE_LIST;
use std::borrow::Cow;
use std::mem::swap;
#[derive(Copy, Clone)]
pub struct Parser<'a>(&'a str);
impl<'a> Parser<'a> {
pub fn parse_tcon(s: &'a str) -> Cow<str> {
let mut parser = Parser(s);
let v1_genre_ids = match parser.one_or_more(Self::content_type) {
Ok... | 26.642424 | 99 | 0.447225 |
f7de7ec7e18f44a8bb565dce7efa40106634d736 | 26,278 | use rustc::hir;
use rustc::hir::def::{Res, DefKind};
use rustc::hir::def_id::DefId;
use rustc::lint;
use rustc::lint::builtin::UNUSED_ATTRIBUTES;
use rustc::ty::{self, Ty};
use rustc::ty::adjustment;
use rustc_data_structures::fx::FxHashMap;
use lint::{LateContext, EarlyContext, LintContext, LintArray};
use lint::{Lint... | 38.701031 | 100 | 0.467692 |
563f0b30f1d11e056deb255fc2a15a845e535265 | 2,704 | use derpyfile::{DerpyFile, load_config, save_config};
use acquire::{acquire, AcquireMode, AcquireOutcome};
use consts::{CONFIG_FILE, CONFIG_LOCK_FILE};
use std::collections::BTreeMap;
use dependency::Dependency;
use cmds::CommandContext;
use error::DerpyError;
pub fn cli_upgrade(context: CommandContext) -> Result<(), ... | 36.540541 | 91 | 0.568417 |
7511979ab1870cdeda3186b392e3942c6ad15c7a | 16,634 | use std::{
collections::HashMap,
fs, io,
path::{Path, PathBuf},
sync::mpsc::{channel, Receiver, Sender},
time::{Duration, UNIX_EPOCH},
};
use distill_core::utils::canonicalize_path;
use notify::{watcher, DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher};
use crate::error::{Error, Result}... | 39.323877 | 117 | 0.477756 |
03042940213aaef1acb00ff5c3f5536b20fe5977 | 22,768 | #[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::CTRL {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut ... | 30.892809 | 385 | 0.540012 |
9024ca80519e923c081402da0fb76de1d4cbbae2 | 2,249 | //! Handles async functions
use crate::returned::Returned;
use crate::Handle;
use crate::Marshal;
use futures_executor::ThreadPool;
use futures_util::future::RemoteHandle;
use futures_util::task::SpawnExt;
use futures_util::FutureExt;
use std::collections::HashMap;
use std::future::Future;
use std::lazy::SyncLazy;
use... | 29.207792 | 81 | 0.593597 |
bf5482056d4b414378fd4aba1a029bdc127e5f79 | 189 | // run-pass
// compile-flags: --test
#![feature(main)]
#![allow(dead_code)]
mod a {
fn b() {
(|| {
#[main]
fn c() { panic!(); }
})();
}
}
| 11.8125 | 32 | 0.354497 |
1c7604b88ad62cd7100ee4cd89abda5721c48718 | 4,501 | use hitable::{
Hitable,
HitRecord,
};
use ray::Ray3;
use aabb::AABB;
use material::Material;
use cgmath::{
Point3,
Vector3,
InnerSpace,
};
use std::time::Instant;
pub struct Triangle {
vertices: [Point3<f32>; 3],
surface_normal: Vector3<f32>,
material: Material,
}
impl Triangle {
... | 30.006667 | 166 | 0.536992 |
148b5aa3ca0d5f0453d0125eafb407eccccb0aef | 37 | mod basepoints;
mod batch;
mod prop;
| 9.25 | 15 | 0.756757 |
1c347ad36475c1194d13140a5698690c17e51083 | 20,017 | //! `String` impl
use crate::avm2::activation::Activation;
use crate::avm2::class::{Class, ClassAttributes};
use crate::avm2::method::{Method, NativeMethodImpl};
use crate::avm2::names::{Namespace, QName};
use crate::avm2::object::{primitive_allocator, Object, TObject};
use crate::avm2::regexp::RegExpFlags;
use crate:... | 33.195688 | 122 | 0.534396 |
db16ee0aefc2ae337e4db06ef61dc59d6a0bf49a | 3,335 | // Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
pub use tauri_runtime::{
menu::{
Menu, MenuEntry, MenuItem, MenuUpdate, Submenu, SystemTrayMenu, SystemTrayMenuEntry,
SystemTrayMenuItem, TrayHandle,
},
SystemTrayE... | 29.776786 | 96 | 0.678261 |
90564e8ce172477ba8968365843d4a208889e553 | 2,506 | mod components;
pub use components::*;
mod camera;
pub use camera::*;
mod player;
pub use player::*;
mod map;
pub use map::*;
mod monsters;
pub use monsters::*;
mod bullets;
pub use bullets::*;
mod living_beings;
pub use living_beings::*;
mod monster_ai;
pub use monster_ai::*;
use super::AppState;
use bevy::prelude::*... | 30.560976 | 99 | 0.601756 |
0e19b63c8b6eea266a0ce5c42e542f03f899c01a | 10,135 | #![recursion_limit = "256"]
extern crate proc_macro;
use proc_macro::TokenStream;
use proc_macro2::Span;
use proc_macro_crate::crate_name;
use quote::quote;
use syn::{
parse_macro_input, Attribute, Data, DeriveInput, Fields, FieldsNamed, FieldsUnnamed, Ident,
Meta,
};
#[proc_macro_derive(DeserializeOver, att... | 29.291908 | 99 | 0.506265 |
ac0a0d5709c4081b6449b6ab397e59c2f883da89 | 1,603 | // Copyright 2017 rust-ipfs-api Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except accord... | 30.826923 | 86 | 0.593263 |
9038ac2168886ad8b12ded2aa250e0945bff9796 | 1,790 | use crate::converter::{Converter, IndexWithConverter};
pub trait BackwardIterableIndex: Sized {
type T: Copy + Clone;
fn get_l(&self, i: u64) -> Self::T;
fn lf_map(&self, i: u64) -> u64;
fn lf_map2(&self, c: Self::T, i: u64) -> u64;
fn len(&self) -> u64;
fn iter_backward(&self, i: u64) -> Back... | 25.571429 | 63 | 0.599441 |
72119f7df55a8d58bd79aba26cd10f362daceca6 | 2,986 | use crate::pde_parser::pde_ir::{ir_helper::*, lexer_compositor::*};
use crate::pde_parser::pde_lexer::math::expr;
use crate::pde_parser::pde_lexer::math::factor;
use crate::pde_parser::pde_lexer::var::var;
use nom::branch::alt;
use nom::bytes::complete::tag;
use nom::character::complete::one_of;
use nom::character::com... | 32.456522 | 95 | 0.603818 |
e227408c55628af5d0e49450c135990424384466 | 2,049 | //! API for analog control (ANACTRL) - always on
// use core::marker::PhantomData;
// use crate::typestates::Fro96MHzEnabledToken;
// use crate::{ raw,};
// UM says:
// NOTE: The clock to analog controller module is enabled during boot time
// by the boot loader and it should always stay enabled
//
// So for safety, ... | 37.944444 | 83 | 0.634944 |
8f75d65b40925d778e4cfd12140f8f058f4a72ca | 1,018 | /// ProvidersLdapItem : Specifies the properties for the LDAP authentication provider.
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct ProvidersLdapItem {
/// Specifies the attribute name used when searching for alternate security identities.
#[serde(rename ... | 42.416667 | 100 | 0.731827 |
87ef3d81f839ff896d81a8fe4686eb90ba635e44 | 1,763 | //
//! Copyright 2020 Alibaba Group Holding 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 appl... | 24.150685 | 76 | 0.620533 |
29704c9f73fb7a5472962b4e52682ca6fefb8aba | 185 | mod file;
mod fmt;
mod graph;
mod node;
mod uses;
mod variable;
pub use self::file::*;
pub use self::graph::*;
pub use self::node::*;
pub use self::uses::*;
pub use self::variable::*;
| 14.230769 | 26 | 0.654054 |
0ada2d7cbcd04759665ae022804515277b051e47 | 7,092 | // Copyright 2021 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.
//! Representation of the virtual_device metadata.
use crate::common::{
AudioModel, DataUnits, ElementType, Envelope, PointingDevice, ScreenUnits, Tar... | 30.568966 | 98 | 0.494501 |
efa9ea2581992804d01162b6a4c7030737b36d9c | 8,069 | // 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 {
anyhow::Error, async_trait::async_trait, clonable_error::ClonableError,
fidl::endpoints::ServerEnd, fidl_fuchsia_component as fcomponent,
... | 36.183857 | 98 | 0.632916 |
1a51912dd30bc079cbcdcb27cc0d00e96662b8b9 | 1,049 | use super::schema::{games, users};
use diesel::{Insertable, Queryable};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Queryable, Serialize)]
pub struct User {
pub id: i32,
pub name: String,
pub pronouns: String,
pub age: i32,
#[serde(skip)]
pub deleted: bool,
pub username: Str... | 21.408163 | 48 | 0.648236 |
4b82558fec007cafce4f44f79a2c1a22674f900e | 3,390 | #![doc(html_root_url = "https://docs.rs/mio/0.7.0")]
#![deny(missing_docs, missing_debug_implementations, rust_2018_idioms)]
// Disallow warnings when running tests.
#![cfg_attr(test, deny(warnings))]
// Disallow warnings in examples.
#![doc(test(attr(deny(warnings))))]
//! A fast, low-level IO library for Rust focusi... | 25.681818 | 79 | 0.599705 |
bf7254306a3ef1f14a918410551776a1df7d53b8 | 2,068 | // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
/// A function that converts a float to a string the represents a human
/// readable version of that number.
pub fn human_size(size: f64) -> String {
let negative = if size.is_sign_positive() { "" } else { "-" };
let size = size.abs();
le... | 30.411765 | 74 | 0.613153 |
4b03e1555f28edc7434e1b3cc23ca6c3db16f1c8 | 60 | pub use generate::generate;
mod generate;
mod formatters;
| 10 | 27 | 0.766667 |
23993025b8877d62961cffd705ee29f678695635 | 4,539 | //! Please see the [project README][1] for usage.
//!
//! [1]: https://github.com/osa1/lexgen
mod ast;
mod builtin;
mod char_ranges;
mod collections;
mod dfa;
mod display;
mod nfa;
mod nfa_to_dfa;
mod range_map;
mod regex_to_nfa;
mod semantic_action_table;
#[cfg(test)]
mod tests;
use ast::{Lexer, Regex, Rule, Single... | 30.26 | 95 | 0.530734 |
e62f74a861100b7ef534e3e730bd925ee91a9550 | 12,755 | #![no_std]
#![no_main]
#![feature(lang_items, asm)]
extern crate capsules;
extern crate cc26x2;
extern crate cortexm4;
extern crate enum_primitive;
#[allow(unused_imports)]
use kernel::{create_capability, debug, debug_gpio, static_init};
use capsules::virtual_uart::{MuxUart, UartDevice};
use cc26x2::aon;
use cc26x2:... | 30.73494 | 100 | 0.620149 |
9068d8cf35f46e8b904ea28afab62cff9206af9f | 789 | // https://leetcode.com/problems/find-pivot-index/
struct Solution;
impl Solution {
pub fn pivot_index(nums: Vec<i32>) -> i32 {
if nums.is_empty() { return -1 }
let mut left = 0;
let mut right = nums.iter().sum::<i32>();
for i in 0..nums.len() {
right -= nums[i];
... | 19.243902 | 69 | 0.498099 |
e9438da8e2a79fb3a57ddafdab3ecf249641a6a9 | 6,797 | use pear::parsers::*;
use pear::combinators::*;
use pear::input::{self, Pear, Extent, Rewind, Input};
use pear::macros::{parser, switch, parse_error, parse_try};
use crate::uri::{Uri, Origin, Authority, Absolute, Reference, Asterisk};
use crate::parse::uri::tables::*;
use crate::parse::uri::RawInput;
type Result<'a, ... | 33.648515 | 86 | 0.57187 |
16234feb778aebe6dd27564fa7da82fae24c55e3 | 16,287 | use std::ops::Range;
use regex_syntax::Parser;
use anyhow::{bail, Result};
use crate::regex::NFA;
fn regex_to_nfa<A: std::hash::Hash + Eq + Copy + std::fmt::Debug>(regex: &str) -> Result<NFA<A>> {
let hir = Parser::new().parse(regex)?;
hir_to_nfa(&hir)
}
fn repeated_n_times<A>(mut nfa: NFA<A>, n: u32) -> a... | 36.931973 | 125 | 0.496592 |
ef4d882daf13d1eb72e294eede4c6111f5dc102c | 8,359 | //! Handles interfacing with the database.
use chrono::Utc;
use rocket::{
request::{self, FromRequest, Request},
Outcome, Rocket,
};
use rocket_contrib::{
database,
databases::mongodb::{
self, bson,
coll::{
options::{FindOneAndUpdateOptions, FindOptions},
results... | 35.270042 | 148 | 0.565857 |
16e7c0b03979ff41d6db86668d6809d5822d81c5 | 667 | use elasticsearch::cat::CatTemplatesParts;
pub(crate) const SUBSYSTEM: &'static str = "cat_templates";
async fn metrics(exporter: &Exporter) -> Result<Vec<Metrics>, elasticsearch::Error> {
let response = exporter
.client()
.cat()
.templates(CatTemplatesParts::Name("*"))
.format("js... | 30.318182 | 96 | 0.631184 |
1a35ad37a5b76332ac4ed13a91c829743280c4cd | 5,730 | // Copyright 2020 Andrej Shadura.
// Copyright Materialize, Inc. and contributors. All rights reserved.
//
// 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 in the LICENSE file at the
// root of ... | 32.191011 | 89 | 0.607679 |
fed71e948eb3346f487434939eae07d441fedbb9 | 3,941 | use super::{ApiLinks, ApiMeta};
use super::{HasPagination, HasResponse, HasValue};
use chrono::{DateTime, Utc};
use method::{Get, List};
use request::ActionRequest;
use request::Request;
use url::Url;
use {ROOT_URL, STATIC_URL_ERROR};
const ACTIONS_SEGMENT: &'static str = "actions";
/// Actions are records of events ... | 32.04065 | 121 | 0.670134 |
fe1b7c9ad7f2eb749894e58d5fef21d9a0a25d7e | 28,430 | use crate::*;
pub use bessel_internal::*;
mod bessel_internal {
use crate::*;
#[inline(always)]
pub fn bessel_j0<S: Simd, E: SimdVectorizedSpecialFunctionsInternal<S>, P: Policy>(mut x: E::Vf) -> E::Vf {
/*
if P::POLICY.precision == PrecisionPolicy::Reference {
let xx4 = x * x... | 38.891929 | 114 | 0.539043 |
1eadd03bacfa00702942a1447e114220446290d9 | 15,086 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn serialize_operation_crate_operation_associate_firewall_policy(
input: &crate::input::AssociateFirewallPolicyInput,
) -> Result<aws_smithy_http::body::SdkBody, aws_smithy_http::operation::SerializationError> {
let mut out = S... | 44.89881 | 121 | 0.751094 |
fedb7c0554039ffd9a71cf292ba6b25128b4e386 | 1,134 | //
use std::any::Any;
use crate::core::error::Error;
use hulunbuir::{Keep, Address};
pub struct Object {
content: Box<dyn Any>,
keep: fn(&Object) -> Vec<Address>,
}
impl Keep for Object {
fn with_keep<F: FnOnce(&[Address])>(&self, f: F) {
f(&(self.keep)(self))
}
}
fn keep_helper<T: Any + K... | 24.12766 | 85 | 0.583774 |
0e9deb37069a3f4504439b522c38453a3dfb30eb | 6,317 | extern crate codespan_reporting; // Tested with codespan_reporting v0.9.5
extern crate salsa; // Tested with salsa v0.15.1
use codespan_reporting::{
diagnostic::{Diagnostic, Label, LabelStyle},
files::Files,
term::{
self,
termcolor::{ColorChoice, StandardStream},
Config,
},
};
u... | 32.901042 | 131 | 0.656799 |
5685355c165671c4cf9cd737895626ba5e40b562 | 28,884 | // Copyright 2018 The Epic 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... | 31.916022 | 215 | 0.694329 |
f8f49a653e0deff2ee561c549f305b5d93e3df67 | 12,562 | use bevy_input::{
keyboard::{KeyCode, KeyboardInput},
mouse::MouseButton,
touch::{ForceTouch, TouchInput, TouchPhase},
ElementState,
};
use bevy_math::Vec2;
pub fn convert_keyboard_input(keyboard_input: &winit::event::KeyboardInput) -> KeyboardInput {
KeyboardInput {
scan_code: keyboard_inp... | 55.831111 | 94 | 0.650931 |
3912adb8c474a6f070696690d011d0b8856c8f07 | 752 | #[allow(dead_code)]
#[allow(unused_imports)]
#[allow(unused_variables)]
#[allow(unused_must_use)]
// Sum of the even fibonacci numbers below 4 millions
pub fn evenfib()
{
let max = 4*i64::pow(10, 6);
let mut fib = vec![1,2];
let mut sum = fib[1];
let mut indx = fib.len()-1;
while fib[indx] < max
... | 22.787879 | 91 | 0.537234 |
1e5f29d548beae4f0538f2c4e12b1a4b4c6d1712 | 5,242 | use std::ptr;
use std::sync::Arc;
use libc::c_int;
use crate::client::conn;
use crate::rt::Executor as _;
use super::error::hyper_code;
use super::http_types::{hyper_request, hyper_response};
use super::io::hyper_io;
use super::task::{hyper_executor, hyper_task, hyper_task_return_type, AsTaskType, WeakExec};
/// An... | 32.159509 | 113 | 0.61694 |
e669a7a26c92414580ef50d6f82fdf91fb464032 | 408 | impl Solution {
pub fn flip_and_invert_image(a: Vec<Vec<i32>>) -> Vec<Vec<i32>> {
let mut a = a.clone();
a.iter()
.map(|x| {
x.clone()
.iter()
.map(|y| if y == &0 { 1i32 } else { 0i32 })
.rev()
... | 27.2 | 69 | 0.345588 |
7119e7aff0fc151ad59330c2dea7f7df3642f286 | 251 | use std::io;
pub(super) fn run() -> io::Result<()> {
{
println!("Year 2019 Day 17 Part 1");
println!("Unimplemented");
}
{
println!("Year 2019 Day 17 Part 2");
println!("Unimplemented");
}
Ok(())
}
| 17.928571 | 44 | 0.482072 |
481fee282e039b8c4df4a54cf5ed9bed7d70b5e1 | 1,346 | use rapier2d::prelude::*;
use rapier_testbed2d::Testbed;
pub fn init_world(testbed: &mut Testbed) {
/*
* World
*/
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let impulse_joints = ImpulseJointSet::new();
let multibody_joints = MultibodyJointSet::new();
... | 25.884615 | 80 | 0.543834 |
79ec0bd1ed8b303b6d849b4b4d2e75187bdcadb2 | 11,117 |
extern crate cortex;
extern crate rustusb = "usb";
use std::intrinsics::abort;
use std::ptr::set_memory;
use std::rt::global_heap::malloc_raw;
use cortex::regs::{store, load, set, wait_for};
use sim::{enable_clock, USBOTG};
use sim::{select_usb_source};
use rustusb::usb::{UsbPeripheral, UsbModule};
use rustusb::usb::... | 27.723192 | 82 | 0.538635 |
8abb923af30b65a55c351f762c62294f79a9e1c0 | 39,364 | use std::fmt::{self, Display, Formatter};
use std::iter::ExactSizeIterator;
use std::slice::Iter;
use std::vec::IntoIter;
use std::borrow::Cow;
use std::prelude::v1::*;
use serde::{self, Deserialize, Deserializer};
use serde::de::{self, DeserializeSeed, IntoDeserializer, SeqAccess, Unexpected, Visitor};
use crate::{In... | 31.643087 | 126 | 0.489508 |
3a3d226d6f25ffd9007489d03dd47798df514cfc | 397 | mod backends;
mod cache;
mod calls;
mod compatability;
mod context;
pub mod errors;
mod instance;
mod memory;
mod middleware;
mod modules;
pub mod testing;
mod wasm_store;
pub use crate::cache::CosmCache;
pub use crate::calls::{
call_handle, call_handle_raw, call_init, call_init_raw, call_query, call_query_raw,
};... | 19.85 | 87 | 0.7733 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.