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 |
|---|---|---|---|---|---|
1c5f8996e1b454ecf419ab27f9f315c67a26470e | 136,862 | // ignore-tidy-filelength
//! This crate is responsible for the part of name resolution that doesn't require type checker.
//!
//! Module structure of the crate is built here.
//! Paths in macros, imports, expressions, types, patterns are resolved here.
//! Label and lifetime names are resolved here as well.
//!
//! T... | 40.100205 | 114 | 0.535912 |
9b6302752880f1a3e86b3bc6705c4f3821e7d435 | 14,907 | //! Mailbox property interface
//!
//! (ref: https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface)
use super::fb::FramebufferInfo;
use bcm2837::mailbox::{Mailbox, MailboxChannel};
use lazy_static::lazy_static;
use alloc::string::String;
use core::mem;
use spin::Mutex;
use aarch64::asm;
lazy_static!... | 42.110169 | 105 | 0.625746 |
0a63f920fa2f8d8ff39ae686a2172ead7609ece4 | 5,526 | // Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::account_address::AccountAddress;
use anyhow::{Error, Result};
#[cfg(any(test, feature = "fuzzing"))]
use libra_crypto::{ed25519::Ed25519PrivateKey, PrivateKey, Uniform};
use libra_crypto::{ed25519::Ed25519PublicKey, traits::... | 40.043478 | 100 | 0.700869 |
1a93e203a3d3c5990383c9e3c392ad86e0e87efe | 22,277 | use crate::core::compiler::{BuildConfig, MessageFormat};
use crate::core::Workspace;
use crate::ops::{CompileFilter, CompileOptions, NewOptions, Packages, VersionControl};
use crate::sources::CRATES_IO_REGISTRY;
use crate::util::important_paths::find_root_manifest_for_wd;
use crate::util::{paths, toml::TomlProfile, val... | 34.645412 | 100 | 0.532388 |
e2962fdaa93b08ca6f35f344cd7bfabaa7bbab2c | 9,222 | /*! Access to networking hardware.
The `phy` module deals with the *network devices*. It provides a trait
for transmitting and receiving frames, [Device](trait.Device.html)
and implementations of it:
* the [_loopback_](struct.Loopback.html), for zero dependency testing;
* _middleware_ [Tracer](struct.Tracer.html)... | 33.413043 | 117 | 0.65463 |
9beeec135595090bce48cd101703a7fa036ae939 | 7,401 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct InvokeEndpointOutput {
/// <p>Includes the inference provided by the model.</p>
/// <p>For information about the format of the response body, see <a hre... | 56.068182 | 162 | 0.65329 |
87df38d89927e4e80dad2387e8b6a015d212270a | 16,467 | //! Defines `FaerieBackend`.
use crate::container;
use crate::traps::{FaerieTrapManifest, FaerieTrapSink};
use anyhow::anyhow;
use cranelift_codegen::binemit::{
Addend, CodeOffset, NullStackmapSink, NullTrapSink, Reloc, RelocSink, Stackmap, StackmapSink,
};
use cranelift_codegen::isa::TargetIsa;
use cranelift_code... | 32.099415 | 100 | 0.562033 |
f43e670bff89cd39545b29192ffee3e30c4959d4 | 1,042 | #![deny(rust_2018_idioms)]
use migration_helpers::common_migrations::AddPrefixesMigration;
use migration_helpers::{migrate, Result};
use std::process;
/// We added new settings for running kubelet in standalone mode, and for using TLS auth.
/// We also added new configuration files to apply these settings. They need ... | 35.931034 | 98 | 0.699616 |
e2fb723de74bfac1766c6b254e44f9b4b1c77626 | 9,139 | use crate::{
create_error,
support::{default_error_inheritance, export_and_insert},
StdError, StdResult,
};
use laythe_core::{
hooks::{GcHooks, Hooks},
if_let_obj,
managed::{Gc, GcObj, GcStr, Trace},
module::{Module, Package},
object::{LyNative, Native, NativeMetaBuilder, ObjectKind},
signature::{Arit... | 25.889518 | 99 | 0.627312 |
8a8780878925ecb954a3dfe20b4be6e4ac7f040f | 1,795 | // Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Checks that `roundf32` does return:
// * The nearest integer to the argument for some concrete cases.
// * A value that is closer to one of the limits (zero, infinity or negative
// infinity, based on the fractional part of the argume... | 24.589041 | 77 | 0.572702 |
8750a344e4e4a3de1257e768ef348750df99119d | 563 | pub trait PPUCPUConnection {
fn is_nmi_pin_set(&self) -> bool;
fn clear_nmi_pin(&mut self);
fn is_dma_request(&self) -> bool;
fn clear_dma_request(&mut self);
fn dma_address(&mut self) -> u8;
fn send_oam_data(&mut self, address: u8, data: u8);
}
pub trait APUCPUConnection {
fn request_dmc_r... | 28.15 | 55 | 0.685613 |
bfec2f720099e83df171f8804ac4ce0ec356c7e5 | 3,491 | // Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
#[macro_use]
extern crate lazy_static;
use address::Address;
use clock::ChainEpoch;
use num_bigint::BigInt;
pub mod actor;
pub mod address;
pub mod bigint;
pub mod clock;
pub mod commcid;
pub mod consensus;
pub mod crypto;
pub mod d... | 30.893805 | 149 | 0.752506 |
1c6a0e3ce3113eaf07e843a968eab2fb72fc0e3e | 6,065 | /*
* BSD 3-Clause License
*
* Copyright (c) 2021, Alex Katlein
* All rights reserved.
*
* 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... | 33.508287 | 100 | 0.509975 |
099344ca83998ab2e61bec86ee6f1b1958c0f5b1 | 215 | use crate::*;
#[test]
fn it_works() {
let mut p = std::ptr::null_mut();
unsafe {
std_FooPtr_ctor(&mut p, std::ptr::null_mut());
foo_Foo_create(&mut p);
std_FooPtr_dtor(p);
}
}
| 15.357143 | 54 | 0.539535 |
c1ce54bea394986b5570d5032f22425f4053e67c | 16,029 | //! FIXME: write short doc here
use ra_db::{FileId, SourceDatabase};
use ra_syntax::{
algo::find_node_at_offset,
ast::{self, DocCommentsOwner},
match_ast, AstNode, SyntaxNode,
};
use crate::{
db::RootDatabase,
display::ShortLabel,
references::{classify_name_ref, NameKind::*},
FilePosition,... | 25.402536 | 94 | 0.402832 |
1c95fe0f8a9cf1d8b404e8a0bdcb985b4bdae6eb | 1,487 | // This file is part of security-keys-rust. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/security-keys-rust/master/COPYRIGHT. No part of security-keys-rust, including this file, may be copied, modified, ... | 24.783333 | 409 | 0.721587 |
1ca045bd4afc2243b0a157de458f75d17b91a4ca | 4,228 | use super::ReadBuf;
use std::io;
use std::ops::DerefMut;
use std::pin::Pin;
use std::task::{Context, Poll};
/// Reads bytes from a source.
///
/// This trait is analogous to the [`std::io::Read`] trait, but integrates with
/// the asynchronous task system. In particular, the [`poll_read`] method,
/// unlike [`Read::re... | 32.274809 | 84 | 0.593425 |
91a630692dfac1bf71e70dc6c5754aa0753c3d6d | 4,646 | use crate::datatypes::TimeUnit;
use crate::{datatypes::DataType, types::NativeType};
use parquet2::schema::types::{
LogicalType, ParquetType, TimeUnit as ParquetTimeUnit, TimestampType,
};
use parquet2::statistics::PrimitiveStatistics as ParquetPrimitiveStatistics;
use parquet2::types::NativeType as ParquetNativeTy... | 34.932331 | 97 | 0.62204 |
d94dd24af3edc74277110793b5c7a9e6449ee334 | 87,385 | // 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 ... | 35.740286 | 99 | 0.438039 |
76822d661f60ceb097eb11677d53448cce7d582a | 394 | use bevy::ecs::system::EntityCommands;
use bevy::prelude::*;
use crate::prelude::MelodyGrid;
use notation_model::prelude::BarLane;
pub struct MelodyPlugin;
impl Plugin for MelodyPlugin {
fn build(&self, _app: &mut AppBuilder) {}
}
impl MelodyPlugin {
pub fn insert_lane_extra(commands: &mut EntityCommands, _... | 21.888889 | 78 | 0.71066 |
6a3c2477a4bb7e59bf4621f8796fa205b821aa6d | 1,909 | #![deny(clippy::all)]
#![deny(missing_docs)]
#![forbid(unsafe_code)]
#![doc(html_root_url = "https://docs.rs/libunftp/0.18.2")]
//! libunftp is an extensible, async, cloud orientated FTP(S) server library.
//!
//! Because of its plug-able authentication (e.g. PAM, JSON File, Generic REST) and storage
//! backends (e.g... | 34.089286 | 113 | 0.658984 |
263e598a23920901fe29418df841df9a38256c21 | 2,699 | //! XML namespacing support
use crate::string::{AvmString, WStr, WString};
use gc_arena::{Collect, MutationContext};
use std::fmt;
/// Represents a scoped name within XML.
///
/// All names in XML are optionally namespaced. Each namespace is represented
/// as a string; the document contains a mapping of namespaces t... | 30.325843 | 87 | 0.600963 |
1d5f7d5c0099e6360383987f4705290268bf742c | 752 | #![feature(generic_associated_types)]
struct Texture;
trait Surface {
type TextureIter<'a>: Iterator<Item = &'a Texture>
where
Self: 'a;
fn get_texture(&self) -> Self::TextureIter<'_>;
}
trait Swapchain {
type Surface<'a>: Surface
where
Self: 'a;
fn get_surface(&self) -> Sel... | 18.8 | 62 | 0.589096 |
1e8ea35ca8152a1a23d534c23e2eb019fdd1b820 | 1,466 | use std::fmt::{Debug, Error, Formatter};
use crate::{ExClause, TableIndex};
use crate::context::{Context, InferenceTable};
use crate::table::AnswerIndex;
#[derive(Debug)]
crate struct CanonicalStrand<C: Context> {
pub(super) canonical_ex_clause: C::CanonicalExClause,
/// Index into `ex_clause.subgoals`.
c... | 31.191489 | 72 | 0.677353 |
e85eb7b8969357621c2e3683e3b5e788277fc950 | 3,355 | use std::cmp::Ordering;
pub fn main(input: &str) -> Metrics {
let (bits_count, numbers) = parse_text(input);
let common_bits_mask: usize = (0..bits_count)
.into_iter()
.rev()
.map(|bit| numbers.mcb(bit as u32).expect("0 and 1 equally common") << bit)
.sum();
let gamma_rate... | 28.675214 | 84 | 0.565723 |
29d81e84ccd65d306b1aeea63ad4dac88f3eda37 | 81 |
fn main() {
let x = 1 ;
let y = x ; //copy x
let z = x ; //legal
} | 8.1 | 24 | 0.382716 |
f9cf52f51edd3e7f1841d0dd77e571a4a84b495b | 8,053 | //! `MovieClipLoader` impl
use crate::avm1::activation::Activation;
use crate::avm1::error::Error;
use crate::avm1::object::script_object::ScriptObject;
use crate::avm1::object::TObject;
use crate::avm1::property::Attribute;
use crate::avm1::{Object, UpdateContext, Value};
use crate::backend::navigator::RequestOptions... | 30.274436 | 90 | 0.569974 |
b9be05417d2ec8d5c57f950b1427e22c127cae1d | 23,486 | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under both the MIT license found in the
* LICENSE-MIT file in the root directory of this source tree and the Apache
* License, Version 2.0 found in the LICENSE-APACHE file in the root directory
* of this source tree.
*/
//! O... | 28.995062 | 94 | 0.529337 |
299ed97a7e8245af9c6ff3e9c5bb52b885ee68c6 | 5,191 | //! egui core library
//!
//! To quickly get started with egui, you can take a look at [`egui_template`](https://github.com/emilk/egui_template)
//! which uses [`eframe`](https://docs.rs/eframe).
//!
//! To create a GUI using egui you first need a [`CtxRef`] (by convention referred to by `ctx`).
//! Use one of [`SidePa... | 28.679558 | 118 | 0.638027 |
1c9594c0ac1090db9054257db1208aa0de0b3dcc | 12,815 | use std::marker::PhantomData;
use swc_common::{util::take::Take, Spanned, DUMMY_SP};
use swc_ecma_ast::*;
use crate::ExprFactory;
pub struct FunctionWrapper<T> {
pub binding_ident: Option<Ident>,
pub function: Expr,
pub ignore_function_name: bool,
pub ignore_function_length: bool,
function_iden... | 29.45977 | 97 | 0.508467 |
ab71c1cfe3c0690cffbbd2a18f0b6cfd950737f8 | 1,353 | use chrono::NaiveDateTime;
use diesel::prelude::*;
use uuid::Uuid;
use crate::{
schema::messages,
utils::establish_connection
};
use std::{error::Error, str::FromStr};
#[derive(Debug, Clone, Queryable, QueryableByName, Identifiable)]
#[table_name="messages"]
pub struct Message {
pub id: Vec<u8>,
pub... | 24.160714 | 81 | 0.617147 |
33ed70458016ba315aaaa4bfce54344b00f18991 | 617 | pub trait UnwrapFromDrop<T> {
fn unwrap_from_drop(self) -> T;
}
impl<T, E> UnwrapFromDrop<T> for Result<T, E>
where
T: Default,
E: std::fmt::Debug,
{
fn unwrap_from_drop(self) -> T {
use std::thread::panicking;
match self {
Ok(t) => t,
Err(e) => {
... | 23.730769 | 86 | 0.424635 |
3381b95c2a38e1fd9946c29d088ae2c1a6a06a5a | 108,609 | //! MIR datatypes and passes. See the [rustc dev guide] for more info.
//!
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/mir/index.html
use crate::mir::interpret::{GlobalAlloc, Scalar};
use crate::mir::visit::MirVisitable;
use crate::ty::adjustment::PointerCast;
use crate::ty::fold::{TypeFoldable, TypeF... | 37.169405 | 101 | 0.565727 |
336da19d19227f3fe7cf10dfa14f999b384e85a1 | 512 | use chrono::{NaiveDate, NaiveDateTime};
fn main() {
let date_time: NaiveDateTime = NaiveDate::from_ymd(2017, 11, 12).and_hms(17, 33, 44);
println!(
"Number of seconds between 1970-01-01 00:00:00 and {} is {}.",
date_time, date_time.timestamp());
let date_time_after_a_billion_second... | 36.571429 | 93 | 0.660156 |
143dea827294be82b20d444b6fd53e8b9947e0f2 | 21,782 | //! SVG output support for piet
#![deny(clippy::trivially_copy_pass_by_ref)]
#[cfg(feature = "evcxr")]
mod evcxr;
mod text;
use std::{borrow::Cow, fmt, fmt::Write, io, mem};
use image::{DynamicImage, GenericImageView, ImageBuffer};
use piet::kurbo::{Affine, Point, Rect, Shape, Size};
use piet::{
Color, Error, F... | 31.522431 | 98 | 0.482187 |
75536c4648687cee0a8daf7d664fed5f74567853 | 31,884 | use crate::error::{
Error, InvalidFunctionArgument, ResponseError, UnknownResponseStatus,
UnsupportedQueryResultType,
};
use crate::response::*;
use crate::selector::Selector;
use crate::util::{validate_duration, RuleType, TargetState};
use std::collections::HashMap;
use url::Url;
/// A client used to execute ... | 30.279202 | 136 | 0.499435 |
5d7c5077e8b2015a0b1a45d1bfa8caf518ec1b53 | 6,602 | use pact_matching::models::*;
use pact_matching::models::matchingrules::MatchingRules;
#[cfg(test)]
use regex::Regex;
use std::collections::HashMap;
use prelude::*;
#[cfg(test)]
#[allow(unused_imports)]
use env_logger;
/// Various methods shared between `RequestBuilder` and `ResponseBuilder`.
pub trait HttpPartBuild... | 32.204878 | 108 | 0.566949 |
5d67bbd5ed5e3696c22ff58a392f42376f1fc976 | 19,637 | #[doc = "Reader of register RTCPS1CTL"]
pub type R = crate::R<u16, super::RTCPS1CTL>;
#[doc = "Writer for register RTCPS1CTL"]
pub type W = crate::W<u16, super::RTCPS1CTL>;
#[doc = "Register RTCPS1CTL `reset()`'s with value 0"]
impl crate::ResetValue for super::RTCPS1CTL {
type Type = u16;
#[inline(always)]
... | 27.933144 | 86 | 0.538473 |
bf150a277e9e540d2880f7aa05d3464d1677fba0 | 13,720 | // Copyright 2016 PingCAP, Inc.
//
// 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 i... | 31.685912 | 99 | 0.556122 |
483b761a2315dce648a370a1349b0ecadf6066d8 | 719 | use std::io;
fn main() {
let mut cl = String::new();
println!("Digite o valor do Ciclo-CL:");
io::stdin()
.read_line(&mut cl)
.expect("Erro ao ler Ciclo-CL");
let cl: f64 = cl
.trim()
.parse()
.expect("ciclo cl dado não é um número inteiro");
let m... | 22.46875 | 59 | 0.515994 |
fc1a55a5a75a5e64bef8cf9e4e9528783ed1dc31 | 15,428 | //! (deprecated) Test fixtures for interactive distributed key generation.
use crate::api::dkg_errors::{DkgVerifyReshareDealingError, DkgVerifyResponseError};
use crate::api::{combine_signatures, keygen, sign_message, verify_combined_signature};
use crate::dkg::secp256k1 as dkg_lib;
use crate::types::public_coefficient... | 36.386792 | 109 | 0.581346 |
bbe290c8ddf39004689abbea86ffb6254169bbee | 37,738 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// Operation shape for `BatchGetTraces`.
///
/// This is usually constructed for you using the the fluent builder returned by
/// [`batch_get_traces`](crate::client::Client::batch_get_traces).
///
/// See [`crate::client::fluent_builders:... | 42.071349 | 148 | 0.689146 |
d529f6b0e80eeb366cbeae08faa1722b1b164b4f | 4,550 | #[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.863388 | 64 | 0.499121 |
39a6d0302e5331cbdef5c9520b851e15c3892462 | 467 | #[derive(Debug)]
pub struct StorageError {
pub error: String,
}
impl std::fmt::Display for StorageError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Cause: {}", self.error)
}
}
#[derive(Debug)]
pub struct QueryError {
pub error: String,
}
impl std::fmt::Di... | 21.227273 | 72 | 0.586724 |
fcf03460a9dfca729dfb467444eafba5daf51261 | 731 | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{contract_event::ContractEvent, write_set::WriteSet};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
pub struct ChangeSet {
write_set: WriteSet,
events: Vec<... | 24.366667 | 73 | 0.651163 |
fbd68d0aaa8dd9353f39f7bd73d9faabe4ef94eb | 1,489 | // Copyright 2019 The n-sql Project Developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// ex... | 25.672414 | 68 | 0.730692 |
6abc93e7b32a0e829b3f9b6ee1f626461f8c151b | 6,721 | // 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.
//! Helper builder for constructing a `MetricEvent`.
use {
cobalt_client::traits::AsEventCodes,
fidl_fuchsia_metrics::{HistogramBucket, MetricEven... | 32.004762 | 128 | 0.605416 |
29ec85590b32044a14d900e7a92ffae09bc1230f | 34,095 | // 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... | 31.395028 | 100 | 0.482211 |
e574f309cc235b0e76fefff9818086b97c957ae8 | 3,897 | //! This module provides a bounded queue of futures which are identified by a
//! key.
//!
//! This module tries to uphold the following guarantees:
//!
//! - During a flush, no further futures can be enqueued
//! - wait, wait_async, and contains_key can only indicate future completion if it has actually
//! been com... | 27.251748 | 95 | 0.531691 |
d654e5f7c8aac23bb1c2f3048e384b8afc21b3a1 | 87 | use std::path::PathBuf;
#[derive(Debug)]
pub struct Config {
pub file: PathBuf,
}
| 12.428571 | 23 | 0.655172 |
ac841c5e98345270b3225cc2eae54777f7778225 | 618 | // Copyright 2018-2021 Cargill Incorporated
//
// 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... | 41.2 | 75 | 0.750809 |
8a30a3cb5feebf27fd79024218fb72ec4f062f8c | 4,659 | use std::fmt::Debug;
use std::marker;
use amethyst_core::ecs::{DispatcherBuilder, Entity, World};
use amethyst_error::Error;
use amethyst_core::{SystemBundle};
use cgmath::{Basis2, Point2, Point3, Quaternion};
use collision::algorithm::broad_phase::{SweepAndPrune2, SweepAndPrune3};
use collision::dbvt::TreeValueWrappe... | 28.937888 | 105 | 0.564928 |
9c49f5d42b8e8005e7c31d609411eb1d38af3d32 | 2,707 | #[doc = "Register `MSGBOX_FIFO_STATUS_REG%s` reader"]
pub struct R(crate::R<MSGBOX_FIFO_STATUS_REG_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<MSGBOX_FIFO_STATUS_REG_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<MSGBOX_FIFO_STATUS_REG... | 36.093333 | 257 | 0.670484 |
7a3609a255f0822be802d6f7b3cb2917006d6d66 | 68,907 | // 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... | 46.12249 | 155 | 0.544096 |
89e4305551399a394eaafa6d854690a8d3f377c4 | 1,707 | use crate::Renderer;
pub(crate) struct DepthBufferTexture {
pub depth_format: wgpu::TextureFormat,
pub view: wgpu::TextureView,
pub sampler: wgpu::Sampler,
}
impl DepthBufferTexture {
pub(crate) fn new(
device: &wgpu::Device,
sc_desc: &wgpu::SwapChainDescriptor,
name: &str,
... | 30.482143 | 87 | 0.578793 |
ef3df64aef1315b18f2ad6d2723ffe3bdfa6425f | 16,153 | // Copyright 2018 (c) rust-themis 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 o... | 35.895556 | 99 | 0.614251 |
d9084da10a71860ecdacf4fa0c8dc2572d077e42 | 1,265 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>GetEntitlements retrieves entitlement values for a given product. The results can be
/// filtered based on customer identifier or product dimensions.</p>
#[derive(std::default::Default, std::clone::Clone, std::fmt::Debug)]
pub struc... | 42.166667 | 118 | 0.684585 |
3ac250c1d3b7e9c392f3d6e359999824e4723fc5 | 19,347 | use std::borrow::Cow;
use std::cmp::Ordering;
use std::collections::HashMap;
use prelude::*;
use nom_sql::OrderType;
#[derive(Clone, Serialize, Deserialize)]
struct Order(Vec<(usize, OrderType)>);
impl Order {
fn cmp(&self, a: &[DataType], b: &[DataType]) -> Ordering {
for &(c, ref order_type) in &self.0... | 33.646957 | 100 | 0.472476 |
de0876f35bf67b4d92ff38df575281eab139c44d | 755 | /*
* Copyright 2018 ProximaX Limited. All rights reserved.
* Use of this source code is governed by the Apache 2.0
* license that can be found in the LICENSE file.
*/
use super::{AbstractTransactionDto, HashAlgorithm};
/// SecretProofTransactionDto : Transaction that revealed a proof.
#[derive(Serialize, Deserial... | 31.458333 | 66 | 0.712583 |
7939e288ebf8dcc492c343526750d1420ec00e59 | 1,740 | #![deny(missing_docs)]
//! Constraints and projections
//!
//! This module defines the trait [`Constraint`], which specifies an abstract
//! projection method, and a collection of simple sets, such as norm-balls,
//! finite sets, second-order cones and their Cartesian products.
//!
//!
//! [`Constraint`]: trait.Constra... | 27.619048 | 82 | 0.593678 |
03eda3396f67f7b4aa0e0c349336866bba0ea8c4 | 102,940 | #![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use crate::models::*;
pub mod product_settings {
use crate::models::*;
pub async fn list(
operation_config: &crate::OperationConfig,
subscription_id: &str,
resource_group_n... | 48.080336 | 342 | 0.587216 |
ed216ca9aa473c16fff981281caa7bd80d26a4ae | 1,791 | use bit_vec::BitVec;
#[derive(Serialize, Deserialize)]
#[serde(remote = "BitVec")]
struct BitVecSerde {
#[serde(getter = "BitVec::to_bytes")]
bits: Vec<u8>,
}
impl From<BitVecSerde> for BitVec {
fn from(bv: BitVecSerde) -> BitVec {
BitVec::from_bytes(&bv.bits)
}
}
#[derive(Default, Debug, Par... | 22.961538 | 89 | 0.60134 |
726803131a45b7209e7c6738eea1665be353676c | 1,794 | use super::pool::{Handle as PoolHandle, Pool};
use core::fmt::Debug;
use core::mem::size_of;
use core::ptr::{null_mut, read, write};
pub trait Allocator {
type Error: Debug;
unsafe fn reallocate(&mut self, ptr: *mut u8, capacity: usize) -> Result<*mut u8, Self::Error>;
}
pub unsafe fn reallocate<T, A: Alloca... | 23.605263 | 99 | 0.56466 |
f79264fc093b41c05e1d879d1cacef04950a9691 | 181 | //! This modules provides structures, which bind definitions from `aead` crate into `inplace` compatible types.
pub mod aead_block;
pub mod aead_chain_enc;
pub mod aead_chain_dec;
| 30.166667 | 111 | 0.79558 |
01bff0cc9e11d9f0061be467cbe3fe5625a813db | 17,209 | use crate::physical_plan::state::ExecutionState;
use crate::physical_plan::PhysicalAggregation;
use crate::prelude::*;
use polars_core::frame::groupby::GroupsProxy;
use polars_core::series::unstable::UnstableSeries;
use polars_core::{prelude::*, POOL};
use std::convert::TryFrom;
use std::sync::Arc;
pub struct BinaryEx... | 37.821978 | 126 | 0.464524 |
0933909bb6cec23ac86e6c53f1810ded1bd5ad57 | 1,480 | struct Board {
pieces: Vec<Vec<char>>,
num_rows: usize,
num_cols: usize
}
impl Board {
fn annotated(&self) -> Vec<String> {
(0..self.num_rows).map(|y| self.annotated_row(y)).collect()
}
fn annotated_row(&self, y: usize) -> String {
self.pieces[y]
.iter()
... | 26.428571 | 96 | 0.491216 |
90739e35c9cf677e685e4e55596b04cf28f27701 | 4,259 | // Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use anyhow::*;
use bitflags::_core::time::Duration;
use futures::channel::mpsc::channel;
use futures::prelude::*;
use log::{debug, error};
use network_p2p::config::{RequestResponseConfig, TransportConfig};
use network_p2p::{
ide... | 39.435185 | 93 | 0.624325 |
29725272c6341b92bb1c2736d3f3fec03cff9006 | 5,322 | #[doc = "Register `NFCID1_2ND_LAST` reader"]
pub struct R(crate::R<NFCID1_2ND_LAST_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<NFCID1_2ND_LAST_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::convert::From<crate::R<NFCID1_2ND_LAST_SPEC>> for R {... | 30.94186 | 438 | 0.598647 |
4a890a7c141c0b5f1583b97066501700c751a99c | 12,864 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[derive(Debug)]
pub(crate) struct Handle<
C = aws_smithy_client::erase::DynConnector,
M = crate::middleware::DefaultMiddleware,
R = aws_smithy_client::retry::Standard,
> {
pub(crate) client: aws_smithy_client::Client<C, M,... | 48 | 422 | 0.636427 |
ff93fa4d8e1569714121bd94d0aeb2ac5e6e7ef0 | 1,825 | // 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... | 26.838235 | 66 | 0.673973 |
d6f376ad1e8a3f6569916b57f9e55504a84bd4e9 | 2,914 | use crate::{
exec::Executable,
gc::{Finalize, Trace},
syntax::ast::node::Node,
Context, Result, Value,
};
use std::fmt;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// The `if` statement executes a statement if a specified condition is [`truthy`][truthy]. If
/// the condition is [`f... | 28.019231 | 117 | 0.566575 |
ef51f55511f2b1527d8685baf84e6562e6468a41 | 13,648 | // Copyright 2020. 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... | 37.806094 | 118 | 0.655994 |
69ccb95b0e8f04bc70ca2d41cf2c87fe234ec7c7 | 1,895 | // Copyright 2020 - developers of the `grammers` project.
// Copyright 2021 - developers of the `tdgrand` project.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
/... | 37.156863 | 96 | 0.669657 |
72c2dbbf66a64cc8d2004a2f1710ee1713f0c5a0 | 8,332 | use crate::core::make_alphanumeric;
use crate::core::BPF;
use crate::error::BccError;
use bcc_sys::bccapi::bpf_probe_attach_type_BPF_PROBE_ENTRY as BPF_PROBE_ENTRY;
use bcc_sys::bccapi::bpf_probe_attach_type_BPF_PROBE_RETURN as BPF_PROBE_RETURN;
use bcc_sys::bccapi::bpf_prog_type_BPF_PROG_TYPE_KPROBE as BPF_PROG_TYPE_... | 32.169884 | 93 | 0.56373 |
28cfdee1a0506f4b0d1b5c86f0cf69ce3cc37132 | 8,429 | use anyhow::anyhow;
use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
use syn::parse::{Error as ParseError, Result as ParseResult};
/// Crate parse context
///
/// Keeps track of modules defined within a crate.
pub struct CrateContext {
modules: BTreeMap<String, ParsedModule>,
}
impl CrateContext {
... | 33.987903 | 117 | 0.503618 |
edd79442fb5a186ca7775e354f1bcbe265a91c14 | 231 | //! Basic type conversion traits. Unlike the native standard library, `U: From<T>` does not yet
//! imply `T: Into<U>`.
pub trait From<T>: Sized {
fn from(_: T) -> Self;
}
pub trait Into<T>: Sized {
fn from(self) -> T;
}
| 21 | 95 | 0.61039 |
8f58c32e6566cb8307d07bffb1d5904aa3b9b057 | 355 | use ink_lang as ink;
#[ink::contract]
mod contract {
#[ink(storage)]
pub struct Contract {}
#[ink(impl)]
impl Contract {}
#[ink(impl)]
impl Contract {
#[ink(constructor)]
pub fn constructor() -> Self {
Self {}
}
#[ink(message)]
pub fn messa... | 14.791667 | 38 | 0.487324 |
1ca709d09755bc7bc71a0cf82acb1ab3999279cc | 528 | // check-pass
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
struct Foo<const D: usize> {
state: Option<[u8; D]>,
}
impl<const D: usize> Iterator for Foo<{D}> {
type Item = [u8; D];
fn next(&m... | 22.956522 | 53 | 0.583333 |
d6ed38df62f856cb1bdd15debf12343561ba1a1a | 49 | pub mod home;
pub mod not_found;
pub mod slides;
| 12.25 | 18 | 0.755102 |
4b32d7e2616342c49c3e5bbd8007f87b2be618a7 | 1,878 | // Having flags in terms of bitshifts is more readable.
#![allow(clippy::identity_op)]
use crate::raw::*;
use bitflags::bitflags;
bitflags! {
#[derive(Default)]
pub struct SetupFlags : u32 {
const IOPOLL = IORING_SETUP_IOPOLL;
const SQPOLL = IORING_SETUP_SQPOLL;
const SQ_AFF = IORING_... | 23.185185 | 60 | 0.601171 |
d72c093adece6bd272a228e2d99481217f4e801b | 1,993 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
use aws_http::user_agent::AwsUserAgent;
use aws_sdk_s3::middleware::DefaultMiddleware;
use aws_sdk_s3::operation::ListObjectsV2;
use aws_sdk_s3::{Credentials, Region};
use aws_smithy_client::test_connect... | 36.907407 | 277 | 0.662318 |
6a724d4c632bb24d0fa0ed4fc4841df5685f5b4d | 3,078 | #![no_std]
#![feature(concat_idents)]
#![feature(collections)]
extern crate collections;
use collections::vec::Vec;
/**
* @section License
*
* The MIT License (MIT)
*
* Copyright (c) 2017, Erik Moqvist
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and ass... | 29.314286 | 70 | 0.616309 |
fbd9065fa433ea170da4cbb7cccd2a3338080fed | 17,382 | // Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{data_cache::RemoteCache, logging::NoContextLog, move_vm::MoveVM};
use move_core_types::{
account_address::AccountAddress,
gas_schedule::{GasAlgebra, GasUnits},
identifier::Identifier,
language_storage::{Modu... | 31.318919 | 100 | 0.60252 |
e50d48c0c74d10d6bb82d05b15dabfbe4cfec477 | 7,907 | // 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.
//! An implementation of the [FIDL wire format] for laying out messages whose types are defined
//! at runtime.
//!
//! [FIDL wire format]: https://fuchsia... | 31.007843 | 137 | 0.512331 |
e62c89984d3865d8da28fa9a54ea9f6d85adbc1f | 3,056 | //! SSD1306 I2C Interface
use hal;
use super::DisplayInterface;
use crate::Error;
// TODO: Add to prelude
/// SSD1306 I2C communication interface
pub struct I2cInterface<I2C> {
i2c: I2C,
addr: u8,
}
impl<I2C, CommE> I2cInterface<I2C>
where
I2C: hal::blocking::i2c::Write<Error = CommE>,
{
/// Create ... | 26.573913 | 87 | 0.536976 |
c1301298bef0bd145bc6c5331a4688aa86397c27 | 3,214 | // Topic: TryFrom/TryInto
//
// Summary:
// * A library is needed for an application to convert hex color codes
// into their component color values (red, green, and blue). Hex color codes
// consist of a hash symbol followed by six hex digits. Every two hex digits
// represent a color component in the order of r... | 27.237288 | 78 | 0.578407 |
e60c553c0d7b386f8ba91ff98f70e2318aa90cf3 | 41,406 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[non_exhaustive]
#[derive(std::fmt::Debug)]
pub struct CreateSavingsPlanError {
pub kind: CreateSavingsPlanErrorKind,
pub(crate) meta: smithy_types::Error,
}
#[non_exhaustive]
#[derive(std::fmt::Debug)]
pub enum CreateSavingsPlanE... | 36.740018 | 136 | 0.645655 |
6275f05b5c3f841246322d9d10126fbb31f0e510 | 8,340 | // 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 {
crate::{
capability::*,
model::{
error::ModelError,
hooks::{Event, EventPayload, EventType, Hook, HooksRe... | 33.095238 | 97 | 0.596283 |
9bc2695fb83f59e5884739d712afb5555aa31b24 | 2,138 | #[doc = "Register `INTERP1_BASE1` reader"]
pub struct R(crate::R<INTERP1_BASE1_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<INTERP1_BASE1_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<INTERP1_BASE1_SPEC>> for R {
#[inline(always)]
... | 30.985507 | 300 | 0.638915 |
f7c9292c605a1b8612d88c53a16a8b20a3aaec94 | 1,643 | use std::sync::Arc;
use crate::{array::FromFfi, error::Result, ffi};
use super::super::{ffi::ToFfi, Array};
use super::UnionArray;
unsafe impl ToFfi for UnionArray {
fn buffers(&self) -> Vec<Option<std::ptr::NonNull<u8>>> {
if let Some(offsets) = &self.offsets {
vec![
Some(sel... | 26.934426 | 61 | 0.513086 |
ac13ff20f23bd81ec08cd9d0c7a2fb1ff833ca5e | 10,081 | //! The SNMP Management Information Base itself.
mod interpretation;
mod linker;
mod smi_well_known;
pub use crate::mib::interpretation::{
InetAddress, InetAddressEncoding, SMIInterpretation, SMIScalar, SMITable, SMITableCell,
TableIndexEncoding, TableIndexValue,
};
use std::collections::BTreeMap;
use std::f... | 41.829876 | 101 | 0.60371 |
edf0ea40c1d3183da347e9822227c11c50dc7a50 | 7,436 | use std::path::{Path, PathBuf};
use anyhow::{Context, Result};
use log::{debug, info, trace, warn};
pub struct Cartridge {
data: Box<[u8]>,
ram: Box<[u8]>,
selected_rom_bank: u8,
secondary_bank_register: u8,
banking_mode_1: bool,
save_file: PathBuf,
}
impl Cartridge {
pub fn load<P: AsRef... | 32.190476 | 127 | 0.512776 |
fe574b5a025afc0b706c51aa2f55b91f1dafca83 | 19,173 | #![allow(clippy::manual_map)]
use super::{gi_docgen, LocationInObject};
use crate::{
analysis::functions::Info,
library::{FunctionKind, TypeId},
nameutil, Env,
};
use log::{info, warn};
use once_cell::sync::Lazy;
use regex::{Captures, Regex};
const LANGUAGE_SEP_BEGIN: &str = "<!-- language=\"";
const LANGU... | 34.176471 | 111 | 0.548323 |
757caed023a6c1ebaa7423cfbeab00b7ec43e7c3 | 5,314 | // * This file is part of the uutils coreutils package.
// *
// * (c) Alan Andrade <alan.andradec@gmail.com>
// *
// * For the full copyright and license information, please view the LICENSE
// * file that was distributed with this source code.
// spell-checker:ignore (ToDO) MAKEWORD addrs hashset
use std::coll... | 32.402439 | 99 | 0.539706 |
fb9e855a807d8038c9330183029a81c3dc3b21e1 | 15,118 | /*
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... | 30.115538 | 119 | 0.740905 |
deede1e9cdae033d3cbaee913e0c488c07ecbcd9 | 875 | use crate::CellOption;
use papergrid::{Entity, Grid, Settings};
/// Indent is responsible for a left/right/top/bottom indent of particular cells.
///
/// ```rust,no_run
/// # use tabled::{Style, Indent, Row, Table, Modify};
/// # let data: Vec<&'static str> = Vec::new();
/// let table = Table::new(&data).with(... | 30.172414 | 96 | 0.597714 |
8a4cb0165d01e2f78121d5baa403a832e19b5b8f | 21,487 | use std::collections::hash_map::{HashMap, Entry};
use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
use std::slice;
use core::{Package, VirtualManifest, EitherManifest, SourceId};
use core::{PackageIdSpec, Dependency, Profile, Profiles};
use ops;
use util::{Config, CargoResult, Filesystem, human};
use ut... | 38.369643 | 96 | 0.521618 |
726562d8087d125ef6c7bde7d7fbb20dd666c186 | 3,582 | // Copyright 2019 MesaTEE Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to... | 31.147826 | 108 | 0.65885 |
cc680ba7a41c847d62cdab36225f00c58daaf9f8 | 134 | //! Backends for `ugly`.
//!
//! At the time of writing, only one backend exists: SDL2.
#[cfg(feature = "backend_sdl")]
pub mod sdl;
| 19.142857 | 58 | 0.649254 |
4aef6a5fa61363d62a1da568d69b5f8db7646d87 | 475 | use super::*;
#[test]
fn case_sensitive() {
let query = "duct";
let contents = "\
Rust:
safe, fast, productive.
Pick three.
Duct tape.";
assert_eq!(vec!["safe, fast, productive."], search(query, contents));
}
#[test]
fn case_insensitive() {
let query = "rUsT";
let contents = "\
... | 19.791667 | 85 | 0.591579 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.