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 |
|---|---|---|---|---|---|
d6e50209f72ddf73471091869bd6d72ea42a31d6 | 5,103 | //! Error Reporting for Anonymous Region Lifetime Errors
//! where both the regions are anonymous.
use crate::infer::error_reporting::nice_region_error::util::AnonymousParamInfo;
use crate::infer::error_reporting::nice_region_error::NiceRegionError;
use crate::util::common::ErrorReported;
use rustc_error_codes::*;
us... | 36.978261 | 98 | 0.542622 |
e52c72301096b18b889348b1f2b31d68c60e4e78 | 7,185 | use super::*;
use crate::support::int;
use crate::support::CxxVTable;
use crate::support::FieldOffset;
use crate::support::Opaque;
use crate::support::RustVTable;
use crate::support::UniquePtr;
// class Channel {
// public:
// virtual ~Channel() = default;
// virtual void sendResponse(int callId,
// ... | 26.910112 | 94 | 0.672373 |
f9bb51861b797415db2e6b077d1a0195ef58e7d0 | 40,972 | // This file is dual licensed under the terms of the Apache License, Version
// 2.0, and the BSD License. See the LICENSE file in the root of this repository
// for complete details.
use crate::asn1::{big_asn1_uint_to_py, AttributeTypeValue, Name, PyAsn1Error};
use chrono::{Datelike, Timelike};
use pyo3::conversion::T... | 36.549509 | 164 | 0.606072 |
115c17767599fafbf68cc851cd431469aca27c54 | 4,451 | crate::util_macros::testcase!(
(|mut glue: multisql::Glue| {
crate::util_macros::execute!(glue, "CREATE TABLE Test (id INTEGER AUTO_INCREMENT NOT NULL, name TEXT)");
crate::util_macros::execute!(glue, "INSERT INTO Test (name) VALUES ('test1')");
crate::util_macros::assert_select!(glue, r#"
SELECT
*
... | 28.532051 | 179 | 0.60009 |
d7f31c1d971b6e5a2ceb96d64493a8228ae948a1 | 461 | // Issue #5886: a complex instance of issue #2687.
trait Iterator<A> {
fn next(&mut self) -> Option<A>;
}
trait IteratorUtil<A>: Sized
{
fn zip<B, U: Iterator<U>>(self, other: U) -> ZipIterator<Self, U>;
}
impl<A, T: Iterator<A>> IteratorUtil<A> for T {
fn zip<B, U: Iterator<B>>(self, other: U) -> ZipIte... | 19.208333 | 70 | 0.579176 |
7a4b4e77f31b4b542c62b262f5975c20b6101717 | 10,813 | use lazy_static::lazy_static;
use casper_engine_test_support::{
internal::{
utils, ExecuteRequestBuilder, InMemoryWasmTestBuilder, DEFAULT_PAYMENT,
DEFAULT_RUN_GENESIS_REQUEST,
},
DEFAULT_ACCOUNT_ADDR,
};
use casper_execution_engine::{core::engine_state::CONV_RATE, shared::motes::Motes};
us... | 30.982808 | 98 | 0.655045 |
9ca13e85b533304f2f2c5c7bc5657da138556343 | 10,980 | // 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 ... | 28.445596 | 82 | 0.566302 |
6236fd0e0e56345882a71eeebeb989586d75e645 | 25,638 | // 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 ... | 36.836207 | 92 | 0.634293 |
561b5dde1ee4742663396f4f5dbbf49a2a32b3ec | 10,377 | #[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::CFG {
#[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... | 24.474057 | 62 | 0.485882 |
6458045a168243b7a3704255d2553a79eb8c3c7c | 8,752 | #[doc = "Reader of register DORMANT_WAKE_INTS1"]
pub type R = crate::R<u32, super::DORMANT_WAKE_INTS1>;
#[doc = "Reader of field `GPIO15_EDGE_HIGH`"]
pub type GPIO15_EDGE_HIGH_R = crate::R<bool, bool>;
#[doc = "Reader of field `GPIO15_EDGE_LOW`"]
pub type GPIO15_EDGE_LOW_R = crate::R<bool, bool>;
#[doc = "Reader of fie... | 38.218341 | 65 | 0.623972 |
281b537fd0c57e7a233b4d442798a9b72e8b3086 | 39,988 | //! duckdb-rs is an ergonomic wrapper for using DuckDB from Rust. It attempts to
//! expose an interface similar to [rusqlite](https://github.com/rusqlite/rusqlite).
//!
//! ```rust
//! use duckdb::{params, Connection, Result};
//! use arrow::record_batch::RecordBatch;
//! use arrow::util::pretty::print_batches;
//!
//... | 32.563518 | 178 | 0.520756 |
f56d4a31820cc13aa1fa8ed04faa199bb6694f0e | 1,912 | use super::routing;
use super::server;
use super::{Request, Response};
use hyper::http::Extensions;
use hyper::Body;
use std::future::Future;
use std::net::SocketAddr;
use std::pin::Pin;
use std::sync::Arc;
pub struct ResponderFactory {
router: Arc<routing::Router<Request, Response>>,
}
impl ResponderFactory {
... | 26.929577 | 88 | 0.624477 |
8ae94334ea0290fb49983d8aa93a6ff72c84bf9a | 6,958 | use std::fmt::{Display, Error, Formatter};
use std::slice::Iter;
use std::str::FromStr;
use std::{ops, write};
#[derive(Clone)]
enum Expr {
Var,
Num(f64),
Add(Box<Expr>, Box<Expr>),
Sub(Box<Expr>, Box<Expr>),
Mul(Box<Expr>, Box<Expr>),
Div(Box<Expr>, Box<Expr>),
Pow(Box<Expr>, Box<Expr>),
... | 30.924444 | 100 | 0.371371 |
bb61590dd8955e98fb053a98b20671bcb32a6dd1 | 5,268 | //! Components for SPI.
//!
//! This provides three components.
//!
//! 1. `SpiMuxComponent` provides a virtualization layer for a SPI bus.
//!
//! 2. `SpiSyscallComponent` provides a system call interface to SPI.
//!
//! 3. `SpiComponent` provides a virtualized client to the SPI bus.
//!
//! `SpiSyscallComponent` is u... | 31.54491 | 98 | 0.643318 |
e4239a1a84623f750fb24fb9e6b0a56771b12ea5 | 1,984 | use ntex_mqtt::{v3, v5, MqttServer};
#[derive(Clone)]
struct Session;
#[derive(Debug)]
struct ServerError;
impl From<()> for ServerError {
fn from(_: ()) -> Self {
ServerError
}
}
impl std::convert::TryFrom<ServerError> for v5::PublishAck {
type Error = ServerError;
fn try_from(err: ServerE... | 29.61194 | 83 | 0.592238 |
29cadc52f4ef0849b95faec37caaf9ca80fb45c2 | 3,835 | // Copyright (c) 2019 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
generate_element!(
/// Source element for t... | 29.274809 | 112 | 0.592177 |
872b4ec1a8f450750ba2f996fdb25e8399e15a73 | 11,561 | // Copyright 2020 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::node::{
client_handling::websocket::message_receiver::MixMessageSender,
storage::{inboxes::ClientStorage, ClientLedger},
};
use futures::{
channel::{mpsc, oneshot},
StreamExt,
};
use gateway_... | 36.470032 | 127 | 0.590087 |
f773ee0d3af0fd5b096f5d89314d67e4a2386285 | 135 | pub mod attachments;
pub mod autumn;
pub mod channel;
pub mod events;
pub mod id;
pub mod instance_data;
pub mod server;
pub mod user;
| 15 | 22 | 0.762963 |
215659418c50c32746dca8aa88fb8b810faf2efe | 3,743 | // 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 agre... | 31.191667 | 86 | 0.631846 |
507e9b59bb355deaa2a1ec40c54a9c052413a0c2 | 20,913 | // Copyright 2016 TiKV Project Authors. Licensed under Apache-2.0.
use std::fmt::{self, Debug, Display, Formatter};
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use std::time::Duration;
use engine_rocks::raw::ColumnFamilyOptions;
use engine_rocks::raw_uti... | 32.173846 | 98 | 0.550614 |
e882b6e6ef76cd6529c919ae4d377ca85c6ce2d9 | 2,174 | //! Types for the *m.dummy* event.
use std::ops::{Deref, DerefMut};
use ruma_events_macros::BasicEventContent;
use ruma_serde::empty::Empty;
use serde::{Deserialize, Serialize};
use crate::BasicEvent;
/// This event type is used to indicate new Olm sessions for end-to-end encryption.
///
/// Typically it is encrypt... | 29.378378 | 96 | 0.668813 |
876e51d939adc8eb2cc0b5bffa9720b3ab50e626 | 4,258 | mod networker;
mod pipe_builder;
use glib::MainLoop;
use gstreamer_rtsp_server::{
RTSPMediaFactory, RTSPMediaFactoryExt, RTSPMountPointsExt, RTSPServer, RTSPServerExt,
RTSPServerExtManual,
};
use structopt::StructOpt;
use pipe_builder::{Encoder, Input, Pipe, VideoSize};
#[derive(Debug, StructOpt)]
#[structop... | 33.527559 | 135 | 0.591592 |
79b6d38db1a23261ba7324e32a3cc9d679da8e7d | 584 | #![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt as rt;
#[macro_use]
extern crate cortex_m;
extern crate panic_itm;
extern crate stm32f103xx_hal;
use rt::{entry, exception, ExceptionFrame};
#[entry]
fn main() -> ! {
let p = cortex_m::Peripherals::take().unwrap();
let m... | 17.69697 | 52 | 0.631849 |
e27bed9589322fb31428ec0cf81267cd98332e80 | 386 | extern crate hangeul;
fn main() {
let cho = 'ㄱ';
let jung = 'ㅏ';
let jong = Some(&'ㅄ');
let composed = hangeul::compose_char(&cho, &jung, jong).unwrap();
assert_eq!(composed, '값');
let (cho2, jung2, jong2) = hangeul::decompose_char(&composed).unwrap();
assert_eq!(cho, cho2);
assert_eq... | 24.125 | 75 | 0.601036 |
6716e5c5fcdac2dc12dac8f75193395f29f05a26 | 5,142 | // 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... | 30.790419 | 93 | 0.677752 |
c16bf229cbb5b88db575668fe6b2018cbd67a8ce | 6,107 | use super::traits::*;
use super::notify_fn::*;
use std::rc::*;
use std::sync::*;
use std::cell::*;
thread_local! {
static CURRENT_CONTEXT: RefCell<Option<BindingContext>> = RefCell::new(None);
}
///
/// Represents the dependencies of a binding context
///
#[derive(Clone)]
pub struct BindingDependencies {
///... | 33.740331 | 134 | 0.630752 |
76fa54317fc1123cd59df792356aac98476b7f57 | 38,971 | // Copyright 2012-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... | 40.300931 | 100 | 0.470991 |
7a7cbeb367a769a9e15908fd8d483943c11c0fdb | 63,859 | /**
* Copyright (c) 2016, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the "hack" directory of this source tree. An additional
* directory.
*
**
*
* THIS FILE IS @generated; DO NOT EDIT IT
* To regenerate this file, run
*
* bu... | 37.084204 | 83 | 0.315367 |
01cb03730b87319e90f634ae3f1e4d5b3c5b4587 | 4,550 | // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// 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>,... | 35 | 92 | 0.602857 |
91875ba9919f9f207de377efdebdefe9972f116f | 3,207 | use json_utils::json::JsValue;
use crate::core::ruleset::*;
use crate::json::std as j;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum JsonFilter {
#[serde(rename = "or")]
Or(Vec<JsonFilter>),
#[serde(rename = "and")]
And(Vec<JsonFilter>),
#[serde(rename = "eq")]
Eq { pat... | 36.443182 | 96 | 0.53851 |
fe95e66c85b6232b63d04ecded63f3f7d26b6a7f | 728 | pub trait Resumable {
fn resumer(&self) -> String;
}
pub struct ArticleDePresse {
pub titre: String,
pub lieu: String,
pub auteur: String,
pub contenu: String,
}
impl Resumable for ArticleDePresse {
fn resumer(&self) -> String {
format!("{}, par {} ({})", self.titre, self.auteur, self.... | 20.222222 | 70 | 0.616758 |
75eb9c9906230eb28cf341f450d378b6674f3220 | 1,394 | // Author: hanvskun@hotmail.com
#![deny(warnings)]
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Method, Request, Response, Server, StatusCode};
use backend::google_user::get_google_user_info;
use backend::channels::get_all_channels;
// router for v1 interface
// - api/v1/user
// - api/v1/c... | 29.041667 | 94 | 0.582496 |
c171c4656f8f2933de27369002c283df7eb40ef2 | 9,901 | #[doc = "Register `LSR` reader"]
pub struct R(crate::R<LSR_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<LSR_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<LSR_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<LSR_SPEC>) ... | 26.831978 | 231 | 0.555095 |
39cec0502c538c725087ee216e130a9ba7cff135 | 30,214 | //! # Algorithm
//!
//! For an atom and type on input (when type is not set `Undefined` is used):
//! * [Atom::Variable] is returned as is.
//! * [Atom::Symbol] and [Atom::Grounded] are type checked:
//! * If type is corrent then atom is returned as is.
//! * If type is incorrect then error result is returned.
//! ... | 40.285333 | 136 | 0.589958 |
894dbad97fc0d0897dc889d91bf6ae690d0cd29c | 2,290 | // Copyright (c) the JPEG XL Project 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::bit_reader::BitReader;
use crate::error::Error;
use std::collections::HashSet;
use crate::entropy_coding::decode::*;
fn move_to_fron... | 30.533333 | 94 | 0.565939 |
083e401be10af496a630d75cf7be7c703711daaa | 10,448 | use std::borrow::Cow;
use std::fs::OpenOptions;
use std::io::Read;
use std::path::Path;
use std::collections::{HashMap, BTreeMap};
use minidom::{Element, Error};
use serde::{Serialize, Deserialize};
use crate::utils::prelude::*;
use failure::Error as FailError;
mod component;
mod condition;
mod device;
pub use compon... | 31.660606 | 93 | 0.537615 |
9b835b0d14ec954c8d79d7aa697fccbb720919f9 | 4,760 | //! Simple HTTPS echo service based on hyper-rustls
//!
//! First parameter is the mandatory port to use.
//! Certificate and private key are hardcoded to sample files.
//! hyper will automatically use HTTP/2 if a client starts talking HTTP/2,
//! otherwise HTTP/1.1 will be used.
use std::{env, fs, io, sync};
use asyn... | 35.522388 | 88 | 0.601261 |
764fc9a097b891512292122f32821e478ed4b151 | 3,380 | use pest::Parser;
#[cfg(debug_assertions)]
const _GRAMMAR: &'static str = include_str!("normalise.pest");
#[derive(Parser)]
#[grammar = "parse/normalise.pest"]
struct Normaliser;
pub fn normalise(input: String) -> String {
Normaliser::parse_str(Rule::space_split, &(input.to_lowercase()))
.unwrap()
... | 25.606061 | 71 | 0.469231 |
8a574bcf325a4a4f973a77885f3503dc5288208f | 61,799 | #![allow(
unused_parens,
clippy::excessive_precision,
clippy::missing_safety_doc,
clippy::not_unsafe_ptr_arg_deref,
clippy::should_implement_trait,
clippy::too_many_arguments,
clippy::unused_unit,
)]
//! # Hierarchical Data Format I/O routines
//!
//! This module provides storage routines for Hierarchical Data ... | 46.326087 | 285 | 0.669121 |
8a1103c5d557a4c35a9d33495515bba670fcd3e2 | 5,799 | use rustpython_vm::obj::objstr::PyStrRef;
use rustpython_vm::pyobject::{BorrowValue, PyIterable, PyResult, TryFromObject};
use rustpython_vm::scope::{NameProtocol, Scope};
use rustpython_vm::VirtualMachine;
pub struct ShellHelper<'vm> {
vm: &'vm VirtualMachine,
scope: Scope,
}
fn reverse_string(s: &mut String... | 33.912281 | 102 | 0.509226 |
bb39662b903941dabe6fe72268674e7ba4ff66c9 | 1,106 | use std::pin::Pin;
use pin_project_lite::pin_project;
use crate::stream::Stream;
use crate::task::{Context, Poll};
pin_project! {
/// A stream that does something with each element of another stream.
///
/// This `struct` is created by the [`inspect`] method on [`Stream`]. See its
/// documentation f... | 22.12 | 90 | 0.534358 |
79b06f086f6cf5296e60261392efdb029cf74465 | 107 | use super::component_prelude::*;
#[derive(Default, Component)]
#[storage(NullStorage)]
pub struct Player;
| 17.833333 | 32 | 0.747664 |
76c636f6e560b7ca0cfb8765ea533505ad0f7975 | 4,084 | use super::{Value, ValueInternal};
use crate::context::internal::Env;
use crate::context::Context;
use crate::handle::{Handle, Managed};
use crate::object::Object;
use crate::result::{JsResult, JsResultExt};
use neon_runtime;
use neon_runtime::raw;
use std::error::Error;
use std::fmt;
use std::fmt::Debug;
/// A JavaSc... | 30.706767 | 132 | 0.615328 |
bff0717c678201bddeacc73448e4cc8de224b983 | 19,685 | // Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0.
use std::cmp::Ordering;
use std::convert::TryInto;
use std::marker::PhantomData;
use std::sync::atomic::{AtomicU64, Ordering as AtomicOrdering};
use std::sync::Arc;
use crate::storage::mvcc::{Lock, LockType, WriteRef, WriteType};
use engine_traits::{
... | 34.65669 | 96 | 0.561443 |
265ad53692d69fee0de2f648ac94ef4c697e1b1d | 8,019 | use crate::Analyzer;
use anyhow::Result;
use common::filters::{bandpass_filter, convolve, cutoff_from_frequency};
use common::synth::quantize_samples;
use ndarray::prelude::*;
use ndarray::{ScalarOperand, Slice};
use num::{traits::FloatConst, Float, NumCast, One};
use std::error;
use std::fmt;
type Peak = i16;
#[deri... | 34.123404 | 99 | 0.539593 |
3993de1486c52c0608bccb3b6635acb7efc6f566 | 20,037 | use std::error::Error;
use std::io;
use std::sync::{atomic::AtomicBool, atomic::Ordering, Arc, RwLock};
use super::events::{Event, Events};
use crate::network::{NetworkInfo, PacketInfo, PacketType};
use termion::{event::Key, raw::IntoRawMode};
use tui::{
backend::TermionBackend,
layout::{Alignment, Constraint... | 36.968635 | 99 | 0.42177 |
ed5979eb11dae8b29a6e8a440248d29a4fd155d0 | 38,482 | //!
//! Asynchronous serial communication using UART/USART peripherals
//!
//! # Word length
//!
//! By default, the UART/USART uses 8 data bits. The `Serial`, `Rx`, and `Tx` structs implement
//! the embedded-hal read and write traits with `u8` as the word type.
//!
//! You can also configure the hardware to use 9 dat... | 27.96657 | 100 | 0.552778 |
d725520ad1d13049b0b294bae9d3e2607d58a25d | 13,847 | //! Mutators that can handle recursive types.
//!
//! There are two main mutators:
//! 1. [`RecursiveMutator`] is the top-level mutator for the recursive type
//! 2. [`RecurToMutator`] is the mutator used at points of recursion. It is essentially a weak reference to [`RecursiveMutator`]
//!
//! In practice, you will wa... | 31.257336 | 128 | 0.589658 |
9cb59a463c3c41a3d4f8146ef51268171a1d2ebe | 4,397 | use std::ffi::{c_void, CString};
use ultralight_sys::{
ulBitmapErase, ulBitmapGetBpp, ulBitmapGetFormat, ulBitmapGetHeight, ulBitmapGetRowBytes,
ulBitmapGetSize, ulBitmapGetWidth, ulBitmapIsEmpty, ulBitmapLockPixels, ulBitmapOwnsPixels,
ulBitmapSwapRedBlueChannels, ulBitmapUnlockPixels, ulBitmapWritePNG, u... | 24.702247 | 104 | 0.541506 |
67a6221df017cb08a9b8e801967e7971a49a2e12 | 155 | // error-pattern: attempted dynamic environment-capture
fn foo(x: int) {
fn mth() {
fn bar() { log(debug, x); }
}
}
fn main() { foo(2); }
| 17.222222 | 55 | 0.541935 |
2f0c668f87a7e7724a966a34bc4ce437e6b7430f | 5,435 | use crate::{assert_eq, *};
use currency::Amount;
use frame_support::transactional;
use redeem::RedeemRequestStatus;
pub const USER: [u8; 32] = ALICE;
pub const VAULT: [u8; 32] = BOB;
pub const USER_BTC_ADDRESS: BtcAddress = BtcAddress::P2PKH(H160([2u8; 20]));
pub struct ExecuteRedeemBuilder {
redeem_id: H256,
... | 32.740964 | 120 | 0.662741 |
9021de5372e59ba59727ddb938a75014886bf118 | 3,778 | #![allow(non_snake_case, non_upper_case_globals)]
#![allow(non_camel_case_types)]
//! Liquid crystal display controller
//!
//! Used by: stm32l4x3, stm32l4x6
#[cfg(not(feature = "nosync"))]
pub use crate::stm32l4::peripherals::lcd_v2::Instance;
pub use crate::stm32l4::peripherals::lcd_v2::{RegisterBlock, ResetValues};... | 32.568966 | 97 | 0.619375 |
9cbaf35acd33fe978ae9fa0e73496a941352c249 | 82,099 | // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | 39.661353 | 100 | 0.502917 |
5b47b78a1840b82a0ffb72011f33de8d7b87050c | 2,898 | use ic_metrics::{buckets::decimal_buckets, MetricsRegistry, Timer};
use prometheus::HistogramVec;
const LABEL_STATUS: &str = "status";
const LABEL_TYPE: &str = "type";
const METRIC_BUILD_PAYLOAD_DURATION: &str = "bitcoin_builder_build_payload_duration_seconds";
const METRIC_VALIDATE_PAYLOAD_DURATION: &str = "bitcoin_b... | 42.617647 | 122 | 0.65666 |
e4237df592394f9dd5370250dcaa9f63527a967d | 19,239 | //! The implementation of the query system itself. This defines the macros that
//! generate the actual methods on tcx which find and execute the provider,
//! manage the caches, and so forth.
use crate::dep_graph::DepGraph;
use crate::ty::query::Query;
use crate::ty::tls::{self, ImplicitCtxt};
use crate::ty::{self, T... | 34.355357 | 103 | 0.485212 |
91db9302f6414dbc0549f54bb6b2457c5f6ea26e | 46,974 | // Copyright 2012-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-MI... | 32.440608 | 98 | 0.521182 |
e6c138ee6c3518c50bacba2cb12c9a48640e4af0 | 6,232 | use clap::value_t_or_exit;
use noria_server::{Builder, ReuseConfigType, ZookeeperAuthority};
use std::path::PathBuf;
use std::sync::Arc;
use std::time::Duration;
fn main() {
use clap::{App, Arg};
let matches = App::new("noria-server")
.version("0.0.1")
.arg(
Arg::with_name("address"... | 35.011236 | 112 | 0.532413 |
62c4b596318243eb758c0b6dbb53191d3387ac4b | 6,010 | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::block_storage::{BlockReader, BlockStore};
use consensus_types::{
block::{block_test_utils::certificate_for_genesis, Block},
common::Round,
executed_block::ExecutedBlock,
quorum_cert::QuorumCert,
sync_info:... | 30.663265 | 100 | 0.641265 |
039715822a4c1ffa807701c185284de3be046149 | 2,550 | /// Process/thread subsystem.
///
/// The subsystem implements process/thread-related system calls, which are
/// mainly based on the three concepts below:
///
/// * [`Process`]. A process has a parent and may have multiple child processes and
/// can own multiple threads.
/// * [`Thread`]. A thread belongs to one and ... | 31.875 | 83 | 0.756863 |
de42cfd33031e765c113b6ef7b02ae0bb4285dca | 3,364 | use crate::stream::{Fuse, FuturesUnordered, StreamExt};
use futures_core::future::Future;
use futures_core::stream::{Stream, FusedStream};
use futures_core::task::{Context, Poll};
#[cfg(feature = "sink")]
use futures_sink::Sink;
use pin_project_lite::pin_project;
use core::fmt;
use core::pin::Pin;
pin_project! {
/... | 26.28125 | 79 | 0.580856 |
5bd746face02422f883ea0c2d2ada333e9b31c1a | 611 | //! Verification of the mask reduction API for `x86`/`x86_64`+`SSE2`
use packed_simd::*;
use stdarch_test::assert_instr;
macro_rules! verify {
($id:ident => $instr:tt) => {
verify_mask!($id["avx2"] => $instr);
}
}
// 128-bit wide:
verify!(m8x16 => vpmovmskb);
verify!(m16x8 => vpmovmskb);
verify!(m32x... | 22.62963 | 68 | 0.648118 |
2f114108b2a13c0d66bfbcb08a136f851ac35162 | 13,774 | // Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0
//! This file defines transaction store APIs that are related to committed signed transactions.
use crate::{
change_set::ChangeSet,
errors::AptosDbError,
schema::{
transaction::TransactionSchema, transaction_by_account::TransactionByAcc... | 35.5 | 102 | 0.601278 |
0115dd5c730207782f85203d014752c2936abe63 | 608 | use async_channel::SendError;
use fluvio_types::PartitionError;
use fluvio_storage::StorageError;
use fluvio_socket::SocketError;
#[derive(Debug, thiserror::Error)]
pub enum InternalServerError {
#[error("Storage error")]
Storage(#[from] StorageError),
#[error("Partition error")]
Partition(#[from] Part... | 26.434783 | 52 | 0.6875 |
764023977e7ad39a3ffe449f735aef28537e02e3 | 7,992 | //! This is an example of a simple application
//! which calculates the Collatz conjecture.
//!
//! The function itself is trivial on purpose,
//! so that we can focus on understanding how
//! the application can be made localizable
//! via Fluent.
//!
//! To try the app launch `cargo run --example simple-fallback NUM ... | 32.888889 | 96 | 0.566942 |
bba8f383e1bea184abb4e9234511196f0a7d2b4c | 3,175 | // This file is part of file-descriptors. 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/file-descriptors/master/COPYRIGHT. No part of file-descriptors, including this file, may be copied, modified, propag... | 56.696429 | 403 | 0.748031 |
39da1af8c91052c476028431a65c88e9aab86575 | 197,893 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// All possible error types for this service.
#[non_exhaustive]
#[derive(std::fmt::Debug)]
pub enum Error {
/// <p>You do not have sufficient permissions to perform this action.</p>
AccessDeniedException(crate::error::AccessDenied... | 47.939196 | 164 | 0.591284 |
4b54c32fbd36ac9247fd70ef359ab3976d1386fc | 1,117 | // 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 ... | 24.282609 | 69 | 0.599821 |
115f06ccc9ac47f00e978199b283866da5e3c281 | 12,356 | use crate::ast::{self, EventField, Field, GenericArg, TypeAlias, TypeDesc};
use crate::grammar::expressions::parse_expr;
use crate::grammar::functions::parse_single_word_stmt;
use crate::node::{Node, Span};
use crate::{ParseFailed, ParseResult, Parser, TokenKind};
use vec1::Vec1;
/// Parse a [`ModuleStmt::Struct`].
//... | 32.861702 | 127 | 0.45573 |
bb2e310476ff7d537ca1d0d4a00c3cee0d5397df | 1,639 | use alloc::{boxed::Box, sync::Arc, vec};
use core::ops::Drop;
pub struct Buffer {
queue: Arc<wgpu::Queue>,
pub(crate) buffer: Arc<wgpu::Buffer>,
pub(crate) offset: usize,
size: usize,
free: Box<dyn Fn() + Sync + Send + 'static>,
}
impl Buffer {
pub(crate) fn new<F>(queue: Arc<wgpu::Queue>, buf... | 28.754386 | 121 | 0.555217 |
5d96989f967c44555a7a08f2b3cbb68b875b9d0d | 46,258 | #![allow(unused_imports, non_camel_case_types)]
use crate::models::r4::Address::Address;
use crate::models::r4::Age::Age;
use crate::models::r4::Annotation::Annotation;
use crate::models::r4::Attachment::Attachment;
use crate::models::r4::CodeableConcept::CodeableConcept;
use crate::models::r4::Coding::Coding;
use cra... | 31.748799 | 100 | 0.540534 |
ffbfe76d08dc52094adc3f894c125270c9015015 | 6,560 | #[doc = "Writer for register PWRSET"]
pub type W = crate::W<u32, super::PWRSET>;
#[doc = "Register PWRSET `reset()`'s with value 0"]
impl crate::ResetValue for super::PWRSET {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Set Hibernate Domain Enable\n\nValue ... | 26.77551 | 86 | 0.539482 |
5604553780496668884840d8c9771f358ee39ad6 | 4,827 | // Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0.
use std::i64;
use super::{EvalContext, Result, ScalarFunc};
use crate::coprocessor::codec::Datum;
impl ScalarFunc {
#[inline]
pub fn bit_count(&self, ctx: &mut EvalContext, row: &[Datum]) -> Result<Option<i64>> {
let res = self.childr... | 35.233577 | 99 | 0.484359 |
14bc19dffd5d0b6f307856c23ccdf8814b74fdf9 | 16,430 | // Copyright 2012-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-MI... | 36.838565 | 98 | 0.59227 |
75de3974089556bbad1016f5d403380cb8de35f4 | 1,256 | extern crate log;
extern crate log4rs;
use log::LevelFilter;
use log4rs::append::console::ConsoleAppender;
use log4rs::append::file::FileAppender;
use log4rs::config::{Appender, Config, Logger, Root};
use log4rs::encode::pattern::PatternEncoder;
pub fn init_log4(path: &str) {
let stdout = ConsoleAppender::builder(... | 32.205128 | 79 | 0.557325 |
1c8ef3d6b88f3b159dadd7ebf6f871fc5e24e6a9 | 223 | use serde::{Deserialize, Serialize};
/// This object represents a service message about a voice chat ended in the
/// chat.
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
pub struct VoiceChatEnded {}
| 31.857143 | 76 | 0.744395 |
7609554033cef5021c56421362d0eb388d039591 | 19,436 | // Copyright 2012-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... | 40.831933 | 98 | 0.563851 |
39a077e8f64219830d05e2a6670b01636a709ee9 | 68 | #[allow(dead_code)]
struct Bcd;
mod b {
}
mod c {
}
mod d {
}
| 4.533333 | 19 | 0.514706 |
1e21cbabc716cb107fb652ae7ff3748f723f8154 | 40,881 | //! Helper module to submit transactions into the zkSync Network.
// Built-in uses
use std::iter::FromIterator;
use std::{
collections::{HashMap, HashSet},
fmt::Display,
str::FromStr,
};
// External uses
use bigdecimal::BigDecimal;
use chrono::{Duration, Utc};
use futures::{
channel::{mpsc, oneshot},
... | 36.370996 | 128 | 0.590715 |
bbecf447ad67923e20cd33d2f1dc0e4a2d9ea361 | 20,467 | extern crate env_logger;
extern crate gfx_corell;
#[cfg(feature = "dx12")]
extern crate gfx_device_dx12ll as back;
#[cfg(feature = "vulkan")]
extern crate gfx_device_vulkanll as back;
#[cfg(feature = "metal")]
extern crate gfx_device_metalll as back;
extern crate winit;
extern crate image;
use gfx_corell::{buffer, co... | 38.984762 | 142 | 0.605023 |
c1c85031ba6ab33b8d07643fa02713c2793b96dc | 3,297 | use proc_macro2::{Span, TokenStream};
use quote::ToTokens;
use std::collections::HashSet;
use std::iter;
use syn::{Data, DeriveInput, Field, Fields, Ident};
use utils::{
add_where_clauses_for_new_ident, field_idents, get_field_types_iter, named_to_vec,
number_idents, unnamed_to_vec,
};
pub fn expand(input: &De... | 33.642857 | 100 | 0.606915 |
897b95c6a52523cae5df8efa1f5d7767cfbc7896 | 347 | use anyhow::Result;
use aoc_2015_day_08::*;
#[test]
fn part_one_answer() -> Result<()> {
let input = include_str!("../input/input.txt");
assert_eq!(part_one(input)?, 1342);
Ok(())
}
#[test]
fn part_two_answer() -> Result<()> {
let input = include_str!("../input/input.txt");
assert_eq!(part_two(in... | 19.277778 | 51 | 0.596542 |
5bf98f1f87f2e0a593e1e20803bcc53bee45e665 | 1,841 | use std::{error,
fmt,
fs::{self, File},
io,
io::{prelude::*, BufWriter, Write}};
use robin::prelude::*;
use robin::redis_queue::*;
pub fn setup() {
fs::create_dir("tests/tmp").ok();
}
pub fn teardown() {}
pub fn test_config() -> Config {
Config::default()
}
pub fn te... | 23.0125 | 91 | 0.590983 |
647dcc27b89de164130dbc6f07df03f5901f396c | 2,232 | //! This crate provides ways of identifying an actor within the git repository both in shared/mutable and mutable variants.
//!
//! ## Feature Flags
#![cfg_attr(
feature = "document-features",
cfg_attr(doc, doc = ::document_features::document_features!())
)]
#![forbid(unsafe_code)]
#![deny(rust_2018_idioms, mis... | 33.313433 | 123 | 0.683244 |
d7acf3b85f3d504f8a5718a1e7abbb29095f8455 | 4,875 | use super::obj::*;
use super::sprite::{gui__col_tex_ps, gui__pos_col_tex_vs, sampler};
use crate::uses::{math::*, *};
use GL::{atlas::VTex2d, shader::*, tex::*, VaoBinding};
pub struct Sprite9<'r, S> {
pub pos: Vec2,
pub size: Vec2,
pub corner: f32,
pub color: Color,
pub tex: &'r VTex2d<S, u8>,
}
impl<S: TexSize>... | 36.931818 | 145 | 0.534154 |
761ae3433e10b1f43d7cf501fbf32795da0139eb | 1,655 | use rand::XorShiftRng;
use vec::{random_in_unit_disc, Ray, Vec3};
use std::f32::consts::PI;
#[derive(Clone, Copy, Debug)]
pub struct Camera {
origin: Vec3,
u: Vec3, // unit vector in direction of x coordinates
v: Vec3, // unit vector in dirction of y coordinates
w: Vec3, // unit vector from the target... | 30.090909 | 98 | 0.559517 |
5bdb3c84955330673f74e2cb4c9d898c771b6d45 | 3,960 | /*
Copyright 2020 Adobe
All Rights Reserved.
NOTICE: Adobe permits you to use, modify, and distribute this file in
accordance with the terms of the Adobe license agreement accompanying
it.
*/
use super::{ctrl_c_handler, serve_req};
use crate::cache::Cache;
use crate::settings::Settings;
use async_stream::stream;
use c... | 34.736842 | 93 | 0.594697 |
29c2dbe950fab77b747da51f01de4e88608aec7a | 4,352 | //! Group membership API.
use std::ffi::CStr;
use std::fmt;
use std::slice;
use rdkafka_sys as rdsys;
use rdkafka_sys::types::*;
use crate::util::{KafkaDrop, NativePtr};
/// Group member information container.
pub struct GroupMemberInfo(RDKafkaGroupMemberInfo);
impl GroupMemberInfo {
/// Returns the ID of the ... | 27.719745 | 96 | 0.548024 |
b963abe4a5201bb2779cf791ea43a078a7b74411 | 3,789 | mod models;
pub mod persistence;
use std::collections::hash_map::Entry;
use chrono::{Duration, Utc};
use itertools::Itertools;
use redis::AsyncCommands;
use tokio::time::interval;
use tracing::{info, instrument};
use crate::aggregator::models::{Analytics, BattleCount, DurationWrapper};
use crate::aggregator::persist... | 33.830357 | 98 | 0.492478 |
9c282f3dd78b6fc41a27f1285a54c94cdb225471 | 3,115 | use core::fmt::{Arguments, Debug};
use crate::{IntoWriteFn, NeverError, WriteBytes, WriteStr};
/// A writer that calls `write_str` once with a combined string.
///
/// Write function can return either `()` or `for<T, E> `[`Result`]`<T, E>`.
///
/// # Panics
///
/// Writer panics if the write function returns `Result:... | 28.842593 | 92 | 0.642376 |
112de6846608446dca9fccf999e6b41a3bdcaefd | 83,202 | pub mod on_unimplemented;
pub mod suggestions;
use super::{
ConstEvalFailure, EvaluationResult, FulfillmentError, FulfillmentErrorCode,
MismatchedProjectionTypes, Obligation, ObligationCause, ObligationCauseCode,
OnUnimplementedDirective, OnUnimplementedNote, OutputTypeParameterMismatch, Overflow,
Pred... | 42.711499 | 107 | 0.455903 |
e2a8924f5bc83d325c64b1ff73c25ff58f716547 | 5,062 | #[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult};
use cw2::set_contract_version;
use crate::error::ContractError;
use crate::msg::{CountResponse, ExecuteMsg, InstantiateMsg, QueryMsg};
use crate::state::{State, S... | 34.202703 | 99 | 0.617938 |
339c263120c9576e34c4e558f6cf7bfe6c3751c0 | 356 | // primitive_types3.rs
// Create an array with at least 100 elements in it where the ??? is.
// Execute `rustlings hint primitive_types3` for hints!
// I AM NO DONE
fn main() {
let a = [0;100];
if a.len() >= 100 {
println!("Wow, that's a big array!");
} else {
println!("Meh, I eat arrays ... | 22.25 | 69 | 0.592697 |
1db704b65ca0f909193571c6e07b01a8d8d097c3 | 4,716 | use crate::text::parsers::numeric_support::{
digits_before_dot, exponent_digits, floating_point_number,
};
use crate::text::parsers::stop_character;
use crate::text::text_value::TextValue;
use nom::branch::alt;
use nom::bytes::streaming::tag;
use nom::character::streaming::one_of;
use nom::combinator::{map, map_res... | 35.727273 | 99 | 0.619169 |
29a2e3545bcf7840d00e7c95bc425e5acff40753 | 31,191 | //! A C representation of Rust's `std::option::Option` used across the FFI
//! boundary for Solana program interfaces
//!
//! This implementation mostly matches `std::option` except iterators since the iteration
//! trait requires returning `std::option::Option`
use std::{
convert, mem,
ops::{Deref, DerefMut},... | 31.44254 | 125 | 0.494886 |
f9bd2bf2f7a5f601d6edef5d8e66ff49ec4083ab | 17,861 | use failure::{Error, ResultExt};
use flate2::read::GzDecoder;
use git2::{BranchType, Repository, Sort};
use package::Checksum;
use reqwest::Client;
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
use sha2::{Digest, Sha256};
use std::{fmt, fs, io::BufReader, path::PathBuf, str::FromStr};
use tar::Arch... | 35.368317 | 108 | 0.423493 |
0e31d26b3b687a53e0cfc8dc0341e55f989360bc | 5,667 | use quicksilver::prelude::*;
use quicksilver::lifecycle::Asset;
use specs::prelude::*;
use crate::color::{Palette};
use crate::game::level::{Level};
use crate::game::level_gen;
use crate::game::fov::Fov;
use crate::game::system::{GameActor, GameActionQueue, GameAction, GameActionType, GameEventQueue, GameEvent};
use cr... | 27.245192 | 113 | 0.541733 |
8a211048756f5149c3bf3acc33bbf0c0f1a9d6b4 | 1,259 | /*
* Copyright 2017 Sreejith Krishnan R
*
* 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... | 22.890909 | 75 | 0.607625 |
795e8f4fdcf667b33b0009cab0c26889a002c2d1 | 4,536 | use std::fmt;
struct ANSIString {
color_code: Option<&'static str>,
s: String,
}
impl ANSIString {
pub fn new<S: Into<String>>(color_code: &'static str, s: S) -> Self {
Self {
color_code: Some(color_code),
s: s.into(),
}
}
// don't set any colors
pub fn ... | 24.12766 | 96 | 0.511684 |
e4722021271b4302904a2485a3cc5d5597842be6 | 889 | use serde_with::SerializeDisplay;
use strum_macros::{Display, EnumString};
#[derive(Debug, Display, EnumString, SerializeDisplay)]
#[strum(serialize_all = "snake_case")]
pub enum OrderStatus {
Unfilled,
PartiallyFilled,
FullyFilled,
CanceledUnfilled,
CanceledPartiallyFilled,
}
#[cfg(test)]
mod tes... | 20.674419 | 59 | 0.583802 |
212e3b13af2ddeb7720e901670ed02c8a884cba0 | 1,356 | fn main() {
let mut v: Vec<String> = Vec::new();
v.push(String::from("Cofi"));
v.push(String::from("Draga"));
v.push(String::from("Johnny"));
let v1 = vec![1,2,3,4,5];
let third = &v1[2];
let second = v1.get(1);
let mut no_element = v1.get(20);
println!("{}", no_element.get_... | 17.384615 | 65 | 0.493363 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.