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 |
|---|---|---|---|---|---|
5b07b3916d870c667bce13dc19c6c69b235db0c3 | 303 | // SPDX-License-Identifier: MIT
// Copyright (C) 2018-present iced project and contributors
use crate::formatter::nasm::tests::fmt_factory;
use crate::formatter::tests::registers::register_tests;
#[test]
fn test_regs() {
register_tests("Nasm", "RegisterTests", || fmt_factory::create_registers());
}
| 27.545455 | 77 | 0.745875 |
5b36539f707932347fb39bde63ca8faabfa678b1 | 8,272 | use nu_engine::{eval_block, CallExt};
use nu_protocol::ast::Call;
use nu_protocol::engine::{CaptureBlock, Command, EngineState, Stack};
use nu_protocol::{
Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape,
Value,
};
use indexmap::IndexMap;
#[derive(Clone)]
pub struct G... | 30.750929 | 96 | 0.464942 |
8a358fd33904fcd6206b89f8c2751b02d9744d86 | 1,816 | use reqwest::Client;
use serde::Serialize;
use time::OffsetDateTime;
use crate::highscores::HighScore;
pub struct HighScoreApi {
base_url: String,
client: Client,
}
#[derive(Serialize)]
struct QueryParams {
#[serde(with = "time::serde::rfc3339")]
since: OffsetDateTime,
}
impl HighScoreApi {
pub ... | 25.222222 | 85 | 0.555066 |
b935ccb7398e23e33407343ffa7a991bffbaa1fb | 2,757 | //! Walks the crate looking for items/impl-items/trait-items that have
//! either a `rustc_symbol_name` or `rustc_def_path` attribute and
//! generates an error giving, respectively, the symbol name or
//! def-path. This is used for unit testing the code that generates
//! paths etc in all kinds of annoying scenarios.
... | 37.767123 | 95 | 0.612985 |
62e85c5f895b10af79b9994b35585ffaa239230a | 2,583 | /// Utilities for creating data dumps.
use std::collections::{HashMap, HashSet};
use std::path::{Path, PathBuf};
use rpki::uri;
//------------ DumpRegistry --------------------------------------------------
/// A registration for all the repositories encountered during a dump.
#[derive(Clone, Debug)]
pub struct Dum... | 30.034884 | 78 | 0.540844 |
114d94cd1b5ab8b4704e3c379154f681804d13b2 | 21,912 | use std::iter;
use proc_macro2::{Ident, Literal, Span, TokenStream};
use common_gen::*;
use protocol::*;
use util::*;
use Side;
pub(crate) fn generate_protocol_client(protocol: Protocol) -> TokenStream {
let modules = protocol.interfaces.iter().map(|iface| {
let doc_attr = iface.description.as_ref().map(... | 40.804469 | 127 | 0.369067 |
bfb358143165789f052da6fd04e4cb7941fb26be | 2,102 | use crate::{db::models::keys::OriginPrivateSigningKey,
server::error::{Error,
Result}};
use builder_core::crypto;
use diesel::pg::PgConnection;
use biome_core::crypto::keys::{Key,
KeyCache};
use std::time::Instant;
pub mod encrypt_secret_keys;
/... | 36.877193 | 99 | 0.52236 |
fca3cc7b1300d02c8444332b33e4523d2350cd8b | 11,613 | extern crate core;
mod test_util;
use crate::test_util::TestServer;
use beatrice::internal::{read_http_head, Head, HeadError, HttpError};
use beatrice::{AsciiString, Response};
use fixed_buffer::FixedBuf;
use futures_lite::AsyncWriteExt;
use safina_sync::Receiver;
use safina_timer::sleep_for;
use std::time::Duration;... | 31.991736 | 217 | 0.520882 |
1dc172f65bcd8d41dbb7079d049fcac874e5a12e | 11,269 | // Copyright (c) SimpleStaking and Tezedge Contributors
// SPDX-License-Identifier: MIT
//! Listens for events from the `protocol_runner`.
use std::convert::TryFrom;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use std::thread;
use std::thread::JoinHandle;
use std::time::Duration;
use ... | 33.638806 | 149 | 0.547342 |
e5e791a33c7b2359100b5ec19dd4e17808e218d9 | 5,748 | use reference_parser::{BibleReference, BibleVerse, BibleVersePart, Book};
use serde::{Deserialize, Serialize};
use crate::Reference;
/// Represents an entire psalm
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
pub struct Psalm {
/// The psalm number (e.g., 8 for Psalm 8)
pub number: u8,... | 40.765957 | 98 | 0.510438 |
628642fc0466525a38242ffaa9fb51b3c76a7bcc | 783 | use proc_macro2::TokenStream;
use super::super::{DeclGenerics, FuncIdent};
pub(in super::super) fn quote_cuda_generic_function(
DeclGenerics {
generic_start_token,
generic_kernel_params: generic_params,
generic_close_token,
generic_kernel_where_clause: generic_where_clause,
... | 30.115385 | 95 | 0.660281 |
bbd195eeb3345754aadeb9a1e2aea38a965a4014 | 4,223 | use super::{compute_arr_presc, Error, Event, FTimer, Instance, Timer};
use core::ops::{Deref, DerefMut};
use fugit::HertzU32 as Hertz;
/// Hardware timers
pub struct CounterHz<TIM>(pub(super) Timer<TIM>);
impl<T> Deref for CounterHz<T> {
type Target = Timer<T>;
fn deref(&self) -> &Self::Target {
&self... | 25.907975 | 86 | 0.578735 |
f85283edb2c704799a9e22283ff226d24ccf3f98 | 734 | extern crate flif;
use std::fs::File;
use std::io::BufReader;
use flif::Error;
use flif::Flif;
use flif::Limits;
#[test]
fn maniac_size_limit() {
let file = BufReader::new(File::open("../resources/sea_snail.flif").unwrap());
let mut limits: Limits = Default::default();
limits.maniac_nodes = 16;
match... | 30.583333 | 124 | 0.643052 |
4af26e19b370c08e8ec33c3a236cbfc3fe86b6ef | 118,995 | use crate::session::{self, DataTypeKind};
use crate::ty::{self, Ty, TyCtxt, TypeFoldable, ReprOptions};
use syntax::ast::{self, Ident, IntTy, UintTy};
use syntax::attr;
use syntax_pos::DUMMY_SP;
use std::cmp;
use std::fmt;
use std::i128;
use std::iter;
use std::mem;
use std::ops::Bound;
use crate::hir;
use crate::ic... | 41.089434 | 100 | 0.464078 |
892a203efa9469ec58aee2a6f408a8b344f4fca6 | 2,343 | #![feature(async_await, await_macro)]
use futures::executor::block_on;
use riker::actors::*;
#[test]
fn system_create() {
assert!(ActorSystem::new().is_ok());
assert!(ActorSystem::with_name("valid-name").is_ok());
assert!(ActorSystem::with_name("/").is_err());
assert!(ActorSystem::with_name("*").is_e... | 24.154639 | 82 | 0.577038 |
8a469d4c0d299c4198d4a565b369ca19428ccdf8 | 8,062 | //! Structures to keep the process alive until some event occurs
use domain::event::DeathReason;
use futures::{
channel::mpsc::{channel, Receiver, Sender},
lock::Mutex,
pin_mut,
prelude::*,
select,
};
use std::{
sync::Arc,
time::{Duration, Instant},
};
use tokio::signal::{
ctrl_c,
u... | 30.888889 | 105 | 0.579757 |
2628ce0b7b825eed6a39e3bc43f9e8c81b986e99 | 13,648 | use crate::errors::{EventError, EventErrorType};
use crate::peer::PeerId;
use bincode::serialize;
use failure::Error;
use ring::digest::{digest, SHA256};
use serde::Serialize;
use std::collections::HashMap;
pub mod event_hash;
pub mod event_signature;
pub mod parents;
use self::event_hash::EventHash;
use self::event_... | 35.727749 | 109 | 0.567922 |
eb873bf1d371efd02cceb3a993611b339c58c007 | 3,038 | // Taken from: https://gitlab.com/Toru3/ring-algorithm/-/blob/c4eaf606e88cb62cf87df98c99f923b253ad976a/src/lib.rs
// Original code is licensed under terms of: MIT OR Apache-2.0
use num_bigint::Sign;
use num_traits::Signed;
use crate::arithmetic::{One, Zero};
use super::BigInt;
fn leading_unit(n: &BigInt) -> BigInt ... | 32.319149 | 113 | 0.563858 |
ab391efb62e0230e06922589888f6342cab019af | 22,823 | #[doc = "Register `FRCE_OFF` reader"]
pub struct R(crate::R<FRCE_OFF_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<FRCE_OFF_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<FRCE_OFF_SPEC>> for R {
#[inline(always)]
fn from(reader: ... | 26.756155 | 300 | 0.538229 |
4862925a6721607b9b1c3c488bf82091a05d7afd | 758 | use libloragw_sx1302::hal;
pub mod rak;
pub mod semtech;
#[derive(Default, Clone)]
pub struct Configuration {
pub radio_count: usize,
pub clock_source: u8,
pub full_duplex: bool,
pub lora_multi_sf_bandwidth: u32,
pub radio_config: Vec<RadioConfig>,
pub gps_tty_path: Option<String>,
pub spi... | 24.451613 | 64 | 0.707124 |
f9b09326e637ed2ab03cec05f10f90fe109ba87d | 84 | pub mod dom;
pub(super) mod sections;
pub(super) mod state;
pub(super) mod actions;
| 16.8 | 24 | 0.738095 |
11f923e88acbcf9244f8cbaf66f33bb8f6988ea7 | 6,380 | // industrial-io/src/lib.rs
//
// Copyright (c) 2018-2020, Frank Pagliughi
//
// Licensed under the MIT license:
// <LICENSE or http://opensource.org/licenses/MIT>
// This file may not be copied, modified, or distributed except according
// to those terms.
//
//!
//! The Rust Industrial I/O crate for Linux.
//!
//! T... | 27.033898 | 94 | 0.57837 |
9c84128f58a5b58284f1ce7ed43c6565a5e8e973 | 98 | pub mod abc;
pub mod simple;
pub mod generic;
pub use self::generic::*;
pub use self::simple::*;
| 14 | 25 | 0.683673 |
039dc8daed1836bc81417312d1cbc302078fabc2 | 28,528 | //! Public Raft interface and data types.
use std::collections::BTreeSet;
use std::fmt::Debug;
use std::sync::Arc;
use std::time::Duration;
use serde::Deserialize;
use serde::Serialize;
use tokio::sync::mpsc;
use tokio::sync::oneshot;
use tokio::sync::watch;
use tokio::sync::Mutex;
use tokio::task::JoinHandle;
use tr... | 37.145833 | 120 | 0.609857 |
fc5269055e1d34b329d387a1c50f8bb8ca942201 | 2,464 | use std::iter::repeat;
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct ByteAddr(u8);
fn addr(bit: usize) -> (usize, ByteAddr) {
(bit / 8, ByteAddr((bit % 8) as u8))
}
impl ByteAddr {
pub fn clear_mask(self) -> u8 {
match self.0 {
0 => 0b1111_1110,
1 => 0b1111_1101,
... | 25.666667 | 80 | 0.519886 |
69cb13c991faa98f161e44d0088980ebb6f80b61 | 3,302 | extern crate ruzstd;
use std::fs::File;
use std::io::Read;
use std::io::Write;
struct StateTracker {
bytes_used: u64,
old_percentage: i8,
}
fn main() {
let mut file_paths: Vec<_> = std::env::args().filter(|f| !f.starts_with('-')).collect();
let flags: Vec<_> = std::env::args().filter(|f| f.starts_with... | 31.75 | 139 | 0.527256 |
75cfcb19c7ae5cd93aba6b84a2c7556eb1d34265 | 368 | pub mod renderer;
pub use renderer::Renderer;
pub mod material;
pub mod mesh;
mod render_graph;
pub use render_graph::{CommandBufferQueue, CommandQueueItem, RenderGraph};
mod pipeline;
pub use pipeline::{BindGroupWithData, SimplePipeline, SimplePipelineDesc, VertexStateBuilder};
pub mod pipelines;
pub mod resourc... | 18.4 | 94 | 0.80163 |
ff8ee9a8672fea5dc3b5b263915ce5430444b17e | 674 | #![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
use defmt::{info, unwrap};
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_nrf::Peripherals;
use defmt_rtt as _; // global logger
use panic_probe as _;
#[embassy::task]
async fn run1() {
loop {
info!("BIG INFREQUE... | 19.823529 | 56 | 0.637982 |
75cd9e2f967727d4914e3cc234d118010b432e90 | 12,331 | // 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 ... | 33.969697 | 100 | 0.582272 |
d91853b6202348e0de5a8d28667d4c0be453434f | 6,359 | use std::{cmp, ops};
use anyhow::Result;
use ordered_float::NotNan;
use serde::{Deserialize, Serialize};
use crate::{deserialize_f64, serialize_f64, trim_f64, Duration};
/// In seconds since midnight. Can't be negative.
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Serialize, Deserialize)]
pub struct Time(
... | 28.013216 | 91 | 0.527756 |
db15c5adc800a1d16d1cec47d4b96f600addcbd0 | 7,151 | // Copyright 2021 Sonatype.
//
// 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 in wr... | 35.40099 | 626 | 0.561879 |
fb374e64cb988cc8981cdec1e85a31fe41063983 | 112 | use beat_saber_example::real_main;
use hotham::HothamResult;
fn main() -> HothamResult<()> {
real_main()
}
| 16 | 34 | 0.696429 |
1d65a0a5e9e8c32276be1e78d43e8c26c8932226 | 768 | // ignore-fast
// 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 licens... | 24 | 69 | 0.686198 |
def71d1b18769cbcabe7e274ef4f524a0969ed27 | 49,834 | //! Tools for compiling SPWN into GD object strings
use crate::ast;
use crate::builtin::*;
use crate::levelstring::*;
use crate::STD_PATH;
use std::collections::{HashMap, HashSet};
use crate::parser::{ParseNotes, SyntaxError};
use std::fs;
use std::path::PathBuf;
use crate::compiler_types::*;
use crate::print_with_co... | 39.208497 | 149 | 0.398503 |
de331469420118e7c00a168a11805a1bd8542fb8 | 1,051 | #[doc = "Reader of register ADDR2"]
pub type R = crate::R<u16, super::ADDR2>;
#[doc = "Writer for register ADDR2"]
pub type W = crate::W<u16, super::ADDR2>;
#[doc = "Register ADDR2 `reset()`'s with value 0"]
impl crate::ResetValue for super::ADDR2 {
type Type = u16;
#[inline(always)]
fn reset_value() -> Sel... | 25.634146 | 70 | 0.55471 |
6a715db7e31a7232dfffde03ac486fc143d37bb4 | 927 | // Copyright 2020-2021 The Datafuse Authors.
//
// SPDX-License-Identifier: Apache-2.0.
use std::sync::Arc;
use common_datavalues::DataSchema;
use common_datavalues::DataSchemaRef;
use crate::Partitions;
use crate::Statistics;
#[derive(serde::Serialize, serde::Deserialize, Clone, Debug)]
pub struct ReadDataSourcePl... | 23.769231 | 61 | 0.632147 |
6280af3d6fa03e533e447182d549250646349c41 | 2,505 | pub fn find(buffer: &[u8], kind: u8) -> Option<&[u8]> {
let mut iter = buffer[8..].iter().enumerate();
let buffer_len = buffer.len();
loop {
match iter.next() {
Some((_, &len)) => match iter.next() {
Some((i, potentialkind)) => {
if potentialkind == &... | 29.127907 | 99 | 0.422754 |
cc19383339b4bddd3b415f1252b38fa1a0c220e3 | 67,424 | //! FIXME: write short doc here
use std::{iter, sync::Arc};
use arrayvec::ArrayVec;
use base_db::{CrateDisplayName, CrateId, Edition, FileId};
use either::Either;
use hir_def::{
adt::{ReprKind, StructKind, VariantData},
builtin_type::BuiltinType,
expr::{BindingAnnotation, LabelId, Pat, PatId},
import_m... | 32.714216 | 133 | 0.559608 |
ab82a5a6695596de4cf3197b8d67211180648b9b | 6,827 | use serde::{Deserialize, Serialize};
use std::fmt;
#[cfg(target_arch = "aarch64")]
pub(crate) use crate::simd_aarch64::*;
#[cfg(target_arch = "x86_64")]
pub(crate) use crate::simd_amd64::*;
pub(crate) use crate::simd_common::*;
impl PartialOrd for F32x8 {
#[inline]
fn partial_cmp(&self, other: &Self) -> Optio... | 24.916058 | 95 | 0.478248 |
db188e2d17250196e039d81e41eb5f477374d64b | 1,990 | use std::collections::HashMap;
use failure::Error;
use utility;
use utility::io::Parseable;
/// Introduction to Random Strings
///
/// Given: A DNA string s of length at most 100 bp and an array A
/// containing at most 20 numbers between 0 and 1.
///
/// Return: An array B having the same length as A in which B[k] ... | 33.166667 | 100 | 0.632663 |
ed0f3d7029436e95cbc09d28e8f44931fb9a93a8 | 1,571 | use std::sync::Arc;
use anyhow::Result;
use crate::browser::tab::Tab;
use crate::protocol::cdp::Target::CreateTarget;
/// Equivalent to a new incognito window
pub struct Context<'a> {
id: String,
browser: &'a super::Browser,
}
impl<'a> Context<'a> {
pub fn new(browser: &'a super::Browser, context_id: St... | 28.053571 | 94 | 0.562062 |
bf6c856198e5a19e48c752934b55b57fe9e437ab | 1,426 | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/vhdirk/gir-files.git)
// from webkit2gtk-gir-files
// DO NOT EDIT
use glib::translate::*;
glib::wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct NetworkProxySettings(Boxed<ffi::W... | 33.952381 | 96 | 0.642356 |
67b6f38343c558b77cd4534db1587d5c713d5153 | 268 | #![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate rocket;
#[macro_use]
extern crate rocket_contrib;
#[macro_use]
extern crate rocket_okapi;
mod db;
mod macros;
mod model;
#[cfg(test)]
mod test;
mod web;
fn main() {
web::rocket().launch();
}
| 13.4 | 43 | 0.708955 |
67d7fc49d4ca2b19fd47f1130e6430d9aa896932 | 4,188 | /*
* Hurl (https://hurl.dev)
* Copyright (C) 2022 Orange
*
* 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 ... | 31.022222 | 89 | 0.523639 |
defee75fbc74bc3ea9daab391dbdf5450c015c5d | 3,591 | //! # 全局属性
//!
//! - `#![no_std]`
//! 禁用标准库
#![no_std]
//!
//! - `#![no_main]`
//! 不使用 `main` 函数等全部 Rust-level 入口点来作为程序入口
#![no_main]
//!
//! - `#![deny(missing_docs)]`
//! 任何没有注释的地方都会产生警告:这个属性用来压榨写实验指导的学长,同学可以删掉了
#![warn(missing_docs)]
//! # 一些 unstable 的功能需要在 crate 层级声明后才可以使用
//!
//! - `#![feature(alloc_error_h... | 23.318182 | 81 | 0.605681 |
33f814f2d795b356d0a6319800c833c4c07d02ea | 2,839 | use azure_sdk_cosmos::prelude::*;
use std::error::Error;
#[macro_use]
extern crate serde_derive;
#[derive(Serialize, Deserialize, Debug)]
struct MySampleStructOwned {
id: String,
a_string: String,
a_number: u64,
a_timestamp: i64,
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let... | 27.298077 | 99 | 0.556886 |
76f9941fb913e55c57d5870fe63a161a440d717f | 23,183 | // 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... | 29.532484 | 106 | 0.653496 |
ccf117395febcd36a69b2175d248fefa371541fc | 10,776 | // Note: section 7.2.3 shows which pins support I2C Hs mode
use crate::clock;
use crate::time::Hertz;
use crate::hal::blocking::i2c::{Read, Write, WriteRead};
use crate::target_device::sercom0::I2CM;
use crate::target_device::{MCLK, SERCOM0, SERCOM1, SERCOM2, SERCOM3};
use crate::target_device::{SERCOM4, SERCOM5};
co... | 28.967742 | 114 | 0.517446 |
ac73620825ecb1332e2eec5010181e74aa931469 | 4,327 | // Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
use std::fmt;
use std::str;
// A struct that divide a name into serveral parts that meets rust's guidelines.
struct NameSpliter<'a> {
name: &'a [u8],
pos: usize,
}
impl<'a> NameSpliter<'a> {
fn new(s: &str) -> NameSpliter {
NameSp... | 27.916129 | 80 | 0.497342 |
edb28090cedbd507fc6d04e8acb0d3cace01a9cd | 190 | pub fn data_key(s3_prefix: &str, path: &str) -> String {
format!("{}data/{}", s3_prefix, path)
}
pub fn manifest_key(s3_prefix: &str) -> String {
format!("{}manifest", s3_prefix)
}
| 23.75 | 56 | 0.626316 |
617fe345da280940c1bb5cb7f0e451cae47899ec | 13,761 | use std::convert::TryFrom;
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::Arc;
use std::time::{Duration, Instant};
use anyhow::Result;
use ton_api::ton::{self, TLObject};
use super::neighbour::*;
use super::neighbours_cache::*;
use crate::dht_node::*;
use crate::overlay_node::*;
use crate::utils::*;
pu... | 32.686461 | 96 | 0.528886 |
c1d00b6326a38cea6465f187a747de4a066c31dd | 1,635 | #[path = "protobuf/sf.near.codec.v1.rs"]
mod pbcodec;
use graph::{
blockchain::Block,
blockchain::BlockPtr,
prelude::{hex, web3::types::H256, BlockNumber},
};
use std::convert::TryFrom;
use std::fmt::LowerHex;
pub use pbcodec::*;
impl From<&CryptoHash> for H256 {
fn from(input: &CryptoHash) -> Self {... | 22.39726 | 80 | 0.57737 |
18e02b2ad4cdd1ab0c6fc21f304a3a162079bff0 | 15 | pub mod errors; | 15 | 15 | 0.8 |
ffcd18ee40d9f631fcdda0f12c5022853e939e92 | 6,284 | #[macro_use]
extern crate clap;
#[macro_use]
extern crate failure;
extern crate gb_live32;
extern crate itertools;
#[macro_use]
extern crate log;
extern crate rand;
extern crate serialport;
extern crate simplelog;
use clap::{Arg, ArgMatches};
use failure::Error;
use gb_live32::Gbl32;
use rand::rngs::SmallRng;
use rand... | 26.627119 | 106 | 0.574952 |
aca7e7d46c7fc6c05e717c7583939c56e227bd9c | 17,718 | // Copyright (c) 2017-present PyO3 Project and Contributors
use crate::method::{FnType, SelfType};
use crate::pymethod::{
impl_py_getter_def, impl_py_setter_def, impl_wrap_getter, impl_wrap_setter, PropertyType,
};
use crate::utils;
use proc_macro2::{Span, TokenStream};
use quote::quote;
use syn::ext::IdentExt;
us... | 34.270793 | 116 | 0.515352 |
56ac03bf097cb26feab312cb166cc3d063c6c48d | 16,037 | //! Development-related functionality: helpers and types for writing tests
//! against concrete implementations of the traits in this crate.
use crate::{
consts::U32,
error::{Error, Result},
ff::{Field, PrimeField},
group,
rand_core::RngCore,
scalar::ScalarBits,
sec1::{FromEncodedPoint, ToE... | 23.793769 | 93 | 0.608343 |
8f7eb4a7e08819ad7d1b6c19806d5e37386d058c | 1,609 | // Function copied from here https://github.com/tomaka/glium/blob/master/examples/support/mod.rs
use obj;
use genmesh;
#[derive(Copy, Clone)]
pub struct Vertex {
pub position: [f32; 3],
pub normal: [f32; 3],
pub texture: [f32; 2],
pub id: u32,
}
implement_vertex!(Vertex, position, normal, texture, id);... | 32.836735 | 96 | 0.485395 |
acb4c932b9d700882807b55f33bb84f12efda0a2 | 2,575 | use crate::vendor::tera::errors::Error;
/// Escape HTML following [OWASP](https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet)
///
/// Escape the following characters with HTML entity encoding to prevent switching
/// into any execution context, such as script, style, or event handlers. U... | 29.94186 | 116 | 0.541359 |
11f67aedb9e8523bf96f173f861c32910911cf73 | 27,050 | // Copyright (c) Microsoft. All rights reserved.
use super::{compute_validity, refresh_cert};
use failure::ResultExt;
use futures::{future, Future, IntoFuture, Stream};
use hyper::{Body, Request, Response};
use serde_json;
use edgelet_core::{
Certificate, CertificateProperties, CertificateType, CreateCertificate,... | 38.152327 | 100 | 0.569168 |
89c7d6af26aca457ee8d4c4c477d860879aeec02 | 56 | net.sf.jasperreports.engine.fill.OffsetElementsIterator
| 28 | 55 | 0.892857 |
6a6730ad5de90b1f9bf22060148dd3724a3a914d | 4,115 | use std::sync::Arc;
use metrics::{counter, histogram};
use tokio::{sync::Mutex, task, time::Instant};
use tracing::info;
use crate::{
error::Result,
format::{TableDesc, TableReader, Timestamp},
manifest::{Manifest, VersionDesc},
memtable::MemTable,
storage::Storage,
};
struct Table {
desc: Ta... | 30.036496 | 95 | 0.539733 |
566ac7429e64c206ba5004eefaeed4612e392b1e | 1,921 | //! [GET /_matrix/client/r0/rooms/{roomId}/context/{eventId}](https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-rooms-roomid-context-eventid)
use ruma_api::ruma_api;
use ruma_events::{collections::only, EventResult};
use ruma_identifiers::{EventId, RoomId};
ruma_api! {
metadata {
... | 36.942308 | 167 | 0.62936 |
628b679236e1d4d879df4e906fcb79cbb5cb13d2 | 54,189 | #[doc = include_str!("panic.md")]
#[macro_export]
#[rustc_builtin_macro(core_panic)]
#[allow_internal_unstable(edition_panic)]
#[stable(feature = "core", since = "1.6.0")]
#[rustc_diagnostic_item = "core_panic_macro"]
macro_rules! panic {
// Expands to either `$crate::panic::panic_2015` or `$crate::panic::panic_202... | 35.005814 | 146 | 0.587499 |
75fd2721f5b1031edb533b0cfab493f54eae4aae | 2,809 | use super::seed::*;
use crate::theory::{hertz::*, key::Key, piano_key::PianoKey, pitch::Pitch, scale::Scale};
use rodio::source::Source;
use std::{f32::consts::PI, fmt, str::FromStr, time::Duration};
pub struct MusicMaker {
key: Key,
seed: Box<dyn MusicSeed>,
current_note: PianoKey,
current_sample: usi... | 26.252336 | 91 | 0.56497 |
db0542a8979f9e050cbb5eb6621bf327b5b8320e | 1,304 | /*
* Swaggy Jenkins
*
* Jenkins API clients generated from Swagger / Open API specification
*
* The version of the OpenAPI document: 1.1.2-pre.0
* Contact: blah@cliffano.com
* Generated by: https://openapi-generator.tech
*/
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct SwapS... | 31.804878 | 89 | 0.693252 |
b9be21fc61b9949807e56c003897add958ebe2e4 | 3,936 | // Copyright (c) 2018-2022 The MobileCoin Foundation
#![deny(missing_docs)]
//! Test Client
use mc_common::logger::{create_app_logger, log, o};
use grpcio::{RpcStatus, RpcStatusCode};
use mc_fog_test_client::{
config::TestClientConfig,
error::TestClientError,
test_client::{TestClient, TestClientPolicy},
... | 32.8 | 86 | 0.64126 |
4ada6e2b564e42439c6499814f5e50ccbffadc19 | 10,506 | use std::collections::HashMap;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use indexmap::IndexMap;
use metrics::{Counter, Gauge, Histogram, Key, KeyName, Recorder, Unit};
use metrics_util::registry::{GenerationalAtomicStorage, Recency, Registry};
use parking_lot::RwLock;
use crate::common::Snapshot;
use crat... | 38.203636 | 100 | 0.555207 |
db747cde9c93f06edef0050a96c32e1849dbc43f | 7,267 | //! A small [CBOR] codec suitable for `no_std` environments.
//!
//! The crate is organised around the following entities:
//!
//! - [`Encoder`] and [`Decoder`] for type-directed encoding and decoding
//! of values.
//!
//! - [`Encode`] and [`Decode`] traits which can be implemented for any
//! type that should be enco... | 31.872807 | 78 | 0.610568 |
90e86cf84ced2f0b8a06bac81dcb619aaccade23 | 1,612 | //! A middleware that boxes HTTP response bodies.
use crate::BoxBody;
use futures::{future, TryFutureExt};
use linkerd_error::Error;
use linkerd_stack::{layer, Proxy, Service};
use std::task::{Context, Poll};
#[derive(Clone, Debug)]
pub struct BoxResponse<S>(S);
impl<S> BoxResponse<S> {
pub fn layer() -> impl la... | 27.793103 | 85 | 0.609181 |
9bb54caed6d3b9dc6a80957ff0369f884ed3e2de | 3,262 | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
use fnv::FnvBuildHasher;
use indexmap::IndexMap;
use intern::string_key::StringKey;
use serde::{Deserialize, Serialize};
use stru... | 31.365385 | 95 | 0.685162 |
29f7da3039d2010ff22b29293c6450e6a84b62f0 | 5,391 | use crate::models::DisplayTicketPricing;
use chrono::{NaiveDateTime, Utc};
use db::prelude::*;
use diesel::PgConnection;
use uuid::Uuid;
#[derive(Debug, Deserialize, PartialEq, Serialize)]
pub struct UserDisplayTicketType {
pub id: Uuid,
pub name: String,
pub description: Option<String>,
pub status: Ti... | 42.117188 | 129 | 0.575032 |
79d43e521021dc80a6974eefdfa735fb06c6d365 | 717 | #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
mod config;
mod gui;
use anyhow::{anyhow, Result};
use directories_next::ProjectDirs;
use log::LevelFilter;
use relm::Widget;
pub use config::CONFIG;
lazy_static::lazy_static! {
pub static ref DIRS: ProjectDirs = ProjectDirs::from("com", "ecmelb... | 23.129032 | 132 | 0.665272 |
2201751d3ec63b2d6b7d484ed7e9adb4d1b6c263 | 2,847 | /*
* Ory APIs
*
* Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers.
*
* The version of the OpenAPI document: v0.0.1-alpha.46
* Contact: support@ory.sh
* Generated by: https://openapi-gen... | 39.541667 | 179 | 0.656129 |
edcd9ad07296f98997262ddf60a18edd8ec0b6ed | 3,342 | #[doc = "Register `PRIMECELL_ID_3` reader"]
pub struct R(crate::R<PRIMECELL_ID_3_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<PRIMECELL_ID_3_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<PRIMECELL_ID_3_SPEC>> for R {
#[inline(alway... | 32.134615 | 413 | 0.634051 |
fcfd77dab0aa3f88296d562f01147b1cc49c8dde | 4,331 | // xfail-fast
// xfail-test
// XFAIL'd because this is going to be revamped, and it's not compatible as
// written with the new mutability rules.
// 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.
//
// Lic... | 24.061111 | 75 | 0.494805 |
d6843fee52dc592df9c3eed2fcbd21f950755ded | 1,447 | use cursive::view::{Boxable, Identifiable};
use cursive::views::{Dialog, EditView, LinearLayout, TextView};
use cursive::Cursive;
// This example shows a way to access multiple views at the same time.
fn main() {
let mut siv = Cursive::default();
// Create a dialog with 2 edit fields, and a text view.
//... | 33.651163 | 71 | 0.628887 |
186ad0d8834ba24a5b309951ef1c33ef9c8b520d | 2,771 | //! Provides components and systems to create an in game user interface.
#![doc(
html_logo_url = "https://amethyst.rs/brand/logo-standard.svg",
html_root_url = "https://docs.amethyst.rs/stable"
)]
#![warn(
missing_debug_implementations,
missing_docs,
rust_2018_idioms,
rust_2018_compatibility
)]... | 32.22093 | 99 | 0.740888 |
4b58b32ae0944108b6a0bbb8bde9404057314fe5 | 4,118 | pub use liquid_core::Value::Nil;
#[allow(dead_code)]
pub fn date(y: i32, m: u8, d: u8) -> liquid_core::Value {
use liquid_core::model::Date;
use liquid_core::model::Value;
Value::scalar(Date::from_ymd(y, m, d))
}
#[allow(dead_code)]
pub fn with_time(_time: &str) -> liquid_core::Value {
Nil
}
#[allow(... | 29.84058 | 85 | 0.589121 |
2285cd8bf6c6ec79316b336203cdee4d611faee3 | 1,693 | // type aliases
use gw_types::U256;
pub use sparse_merkle_tree::H256;
pub trait H256Ext {
fn one() -> H256;
fn from_u32(n: u32) -> H256;
fn to_u32(&self) -> u32;
fn from_u64(n: u64) -> H256;
fn to_u64(&self) -> u64;
fn from_u128(n: u128) -> H256;
fn to_u128(&self) -> u128;
fn from_u256... | 26.873016 | 56 | 0.537507 |
218c3d20db04318ae0c42d58b61d0d39989ab9ec | 357 | pub(crate) mod mesh;
pub use mesh::Mesh;
pub(crate) mod transform;
pub use transform::Transform;
pub(crate) mod camera_data;
pub use camera_data::CameraData;
pub(crate) mod material;
pub use material::Material;
pub(crate) mod skybox;
pub use skybox::SkyboxData;
pub(crate) mod light_data;
pub use light_data::*;
pu... | 17.85 | 32 | 0.745098 |
9ba68192a09dcd4342b0c3dea4cb5b1b8306bd49 | 1,222 | extern crate itertools;
use itertools::Itertools;
const BOOK_PRICE: f64 = 8.0;
const DISCOUNT: &[f64] = &[1.0, 0.95, 0.9, 0.8, 0.75];
pub fn lowest_price(books: &[usize]) -> f64 {
if books.is_empty() {
return 0.0;
}
let mut stats = vec![0; 5];
for &book in books.iter() {
stats[book -... | 26.565217 | 79 | 0.518822 |
9b8c9df051dd5573d3597a9cd00b24d3c4e1b937 | 4,819 | use anyhow::Result;
use rusqlite::types::{FromSql, FromSqlError, FromSqlResult, ToSql, ToSqlOutput, ValueRef};
use rusqlite::{params, Row, Transaction};
use std::str::FromStr;
use crate::{Status, StatusError};
#[derive(Debug, Clone)]
pub struct GuidanceRecord {
pub(crate) id: String,
pub(crate) checksum: Stri... | 25.230366 | 93 | 0.501764 |
56c587faa54cf86d3f16b1a8b4624e17ebe08a9f | 2,020 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_dynamodb::{Client, Error, Region, PKG_VERSION};
use tokio_stream::StreamExt;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
struct... | 25.897436 | 84 | 0.584653 |
89ce6f56c6620863afa9a6cca35dbfcccbeb0b1f | 5,540 | //! A library for rank-one constraint systems.
#![cfg_attr(not(feature = "std"), no_std)]
#![warn(unused, future_incompatible, nonstandard_style, rust_2018_idioms)]
#![allow(clippy::op_ref, clippy::suspicious_op_assign_impl)]
#![cfg_attr(not(use_asm), forbid(unsafe_code))]
#![cfg_attr(use_asm, feature(llvm_asm))]
#
pub mod create_member_input {
/// A builder for [`CreateMemberInput`](crate::input::CreateMemberInput)
#[non_exhaustive]
#[derive(std::default:... | 41.964882 | 450 | 0.58461 |
11cd034aa16e7059d158fe748a4bbff65ef19d45 | 5,846 | #[doc = "Register `SUBSCRIBE_STOPTX` reader"]
pub struct R(crate::R<SUBSCRIBE_STOPTX_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<SUBSCRIBE_STOPTX_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<SUBSCRIBE_STOPTX_SPEC>> for R {
#[inli... | 29.525253 | 436 | 0.585358 |
6a49bb0d41df5e628a70f42f579533fee2350584 | 9,236 | use std::any::TypeId;
use std::collections::HashMap;
use std::marker::PhantomData;
use std::os::raw::{c_int, c_void};
use std::sync::{Arc, Mutex};
use std::{ptr, str};
use libc;
use context::Context;
use ffi;
use markers::NoRefUnwindSafe;
use types::Callback;
use util::{
assert_stack, init_error_metatables, prote... | 37.697959 | 100 | 0.607514 |
1c0be28d07591017786f0e0fa771877ecec8e8e6 | 2,014 | // Copyright 2020 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | 31.46875 | 75 | 0.573486 |
335c08003218b116b4aa7d8b20aadbd2b9bb6081 | 1,058 | use anyhow::Result;
use bevy_asset::AssetLoader;
use std::{io::Cursor, path::Path, sync::Arc};
/// A source of audio data
#[derive(Debug, Clone)]
pub struct AudioSource {
pub bytes: Arc<[u8]>,
}
impl AsRef<[u8]> for AudioSource {
fn as_ref(&self) -> &[u8] {
&self.bytes
}
}
/// Loads mp3 files as ... | 22.510638 | 85 | 0.606805 |
14ffe6a38af9a6f28da13ff85cbbc20a16cc95aa | 8,561 | //! A type-safe wrapper around the sys module, which in turn exposes
//! the API exported by winpty.dll.
//! https://github.com/rprichard/winpty/blob/master/src/include/winpty.h
#![allow(dead_code)]
use super::sys::*;
use bitflags::bitflags;
use failure::{bail, ensure, format_err, Error};
use filedescriptor::{FileDescr... | 30.466192 | 89 | 0.604719 |
dd95ad3525925ef7ec380ba53ba0fb0e62676f26 | 1,069 | /*
* Copyright (C) 2012 The Android Open Source Project
*
* 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 app... | 30.542857 | 75 | 0.703461 |
1873271f855b3038e4d0a287323772dd361026a5 | 42,861 | // This is a part of Chrono.
// See README.md and LICENSE.txt for details.
//! # Chrono: Date and Time for Rust
//!
//! It aims to be a feature-complete superset of
//! the [time](https://github.com/rust-lang-deprecated/time) library.
//! In particular,
//!
//! * Chrono strictly adheres to ISO 8601.
//! * Chrono is ti... | 37.762996 | 105 | 0.600173 |
d6c5b8a592a51791836ed4a62c88f653a4bc07cd | 3,537 | use crate::core::{AxisDirection, MaterialSide};
use crate::primitives::RaytracingObject;
use nalgebra::{Affine3, Point3, Unit, Vector2, Vector3};
pub trait Intersectable {
fn intersect(&self, ray: &Ray, max_distance: Option<f64>) -> Option<Intersection>;
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Ray... | 26.2 | 92 | 0.579587 |
8ad3b2670bcc6f295844ee3a742b9726a9f83fa9 | 135 | mod client;
mod link;
mod register_client;
mod spec;
pub use client::*;
pub use link::*;
pub use register_client::*;
pub use spec::*;
| 13.5 | 27 | 0.696296 |
efa743e57ab72144d7c988939fdb24d811d6cf61 | 983 | //! Testes da seção de informações sobre o transporte
use std::convert::TryFrom;
use std::fs::File;
use crate::*;
#[test]
fn from_instance() -> Result<(), String> {
let f = File::open("xmls/nfe_layout4.xml").map_err(|e| e.to_string())?;
let transporte = Nfe::try_from(f).map_err(|e| e.to_string())?.transporte... | 23.97561 | 81 | 0.636826 |
dd974ee21f183292857cafa73f9d5b824f132d28 | 9,164 | use crate::types::{
file::InputFile,
photo_size::PhotoSize,
primitive::{Float, Integer},
};
use serde::{Deserialize, Serialize};
use serde_json::Error as JsonError;
use std::{error::Error as StdError, fmt};
/// The part of the face relative to which the mask should be placed
#[derive(Clone, Copy, Debug, De... | 30.546667 | 105 | 0.583806 |
d545e1efe6791312d29d03faebdb93f8c1635239 | 12,636 | use crate::{
dpi::{PhysicalPosition, Size},
event::ModifiersState,
icon::Icon,
platform_impl::platform::{event_loop, util},
window::{CursorIcon, Fullscreen, Theme, WindowAttributes},
};
use parking_lot::MutexGuard;
use std::io;
use windows_sys::Win32::{
Foundation::{HWND, RECT},
Graphics::Gd... | 33.606383 | 103 | 0.571937 |
911348ccad2a4b9c933ffac69f246030a53c83a3 | 16,832 | #[doc = "Reader of register INTENSET"]
pub type R = crate::R<u32, super::INTENSET>;
#[doc = "Writer for register INTENSET"]
pub type W = crate::W<u32, super::INTENSET>;
#[doc = "Register INTENSET `reset()`'s with value 0"]
impl crate::ResetValue for super::INTENSET {
type Type = u32;
#[inline(always)]
fn re... | 28.100167 | 86 | 0.550261 |
0af53ce21476266f7efcdaf72eaa3cc46dc1929c | 4,007 | use super::bit_depth::BitDepth;
use super::image::BitMap;
use super::rgba::Rgba;
pub struct RgbQuad {
data: Vec<Rgba>,
}
///
/// Used for constants
///
impl RgbQuad {
pub fn single_rgb_quad_size() -> usize {
4
}
}
///
/// Core implementation
///
impl RgbQuad {
///
/// From a from_slice of... | 25.360759 | 91 | 0.528076 |
50df5618e061e6f4197665645cd76d79fa8d8cd5 | 10,184 | use std::{collections::HashMap, fmt::Write};
use krpc_proto::{
r#type::TypeCode, Class, Enumeration, EnumerationValue, Error, Procedure,
Services, Type,
};
use protobuf_but_worse::encoding::EncodingResult;
mod class;
mod connection;
mod control;
mod vessel;
pub use connection::KrpcConnection;
pub use control... | 33.172638 | 79 | 0.490966 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.