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 |
|---|---|---|---|---|---|
f4f42c9086ff8dbe0ce1cca9f7a647018c9af0f9 | 6,328 | use crate::{dashboard::basic_components, translation::TranslationBundle, LocalizedId};
use super::{
EmptyContainer, EmptyControl, SettingContainer, SettingControl, SettingsContext,
SettingsResponse,
};
use egui::Ui;
use serde_json as json;
use settings_schema::EntryData;
use std::collections::HashMap;
pub str... | 32.618557 | 99 | 0.462863 |
bb900bc584adc5dc68693161ab30001174b37a64 | 7,999 | use std::collections::{BTreeMap, VecDeque};
use std::error::Error;
use std::sync::{Arc, Mutex};
use serde::{Deserialize, Serialize};
use crate::config::*;
use crate::interpolate::interpolate_modify;
use crate::worker::LogStream;
use crate::worker::WorkerMessage;
#[derive(Clone, Copy, Debug, Serialize, Deserialize, P... | 31.368627 | 107 | 0.55907 |
0e8b4d44e8406fb208ddcb3b747bba142a2a5890 | 16,616 | use {
crate::transaction_notifier_interface::TransactionNotifierLock,
crossbeam_channel::{Receiver, RecvTimeoutError},
itertools::izip,
solana_ledger::{
blockstore::Blockstore,
blockstore_processor::{TransactionStatusBatch, TransactionStatusMessage},
},
solana_runtime::bank::{
... | 39.188679 | 99 | 0.516731 |
62174175670579924be9e8d1ee4a3cda92926ca3 | 4,509 | // Generated from definition io.k8s.api.authorization.v1.SelfSubjectAccessReviewSpec
/// SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set
#[derive(Clone, Debug, Default, PartialEq)]
pub struct SelfSubj... | 44.643564 | 170 | 0.592149 |
f9e81a0edd229feea4bf38baa288f59e0c1bd95b | 136 | extern crate lolbench ; # [ test ] fn end_to_end ( ) {
lolbench :: end_to_end_test ( "clap_2_31_2" , "_03_complex::parse_clean" , ) ;
} | 45.333333 | 78 | 0.669118 |
2265ed2f03b6e7600fcab1abdebd2255d64d3401 | 466 |
#[allow(dead_code)]
pub fn set_panic_hook() {
// When the `console_error_panic_hook` feature is enabled, we can call the
// `set_panic_hook` function at least once during initialization, and then
// we will get better error messages if our code ever panics.
//
// For more details see
// https:/... | 35.846154 | 78 | 0.716738 |
696c60d2a60378feb2659218114517fd2a207585 | 6,686 | /*
* Copyright 2021 Datafuse Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | 35.754011 | 100 | 0.673347 |
50c021d179e3ee5d0a04a4af0b48c495c9422da3 | 864 | //! Utilities for working with buffers.
//!
//! `io-uring` APIs require passing ownership of buffers to the runtime. The
//! crate defines [`IoBuf`] and [`IoBufMut`] traits which are implemented by buffer
//! types that respect the `io-uring` contract.
mod io_buf;
pub use io_buf::IoBuf;
mod io_buf_mut;
pub use io_buf... | 32 | 85 | 0.696759 |
f59405871fac9463a6bd0f7c13bf2d4d686818e7 | 213 | #![no_std]
#![feature(llvm_asm)]
extern crate alloc;
pub mod debug;
pub mod entry;
pub mod error;
pub mod global_alloc_macro;
pub mod muta_constants;
pub use ckb_allocator;
pub mod high_level;
pub mod syscalls;
| 15.214286 | 27 | 0.765258 |
9ce947c7725de715a317ac044896cf7d045188d3 | 2,592 | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use DOMElement;
use DOMEventTarget;
use DOMHTMLElement;
use DOMNode;
use DOMObject;
use glib::GString;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::SignalHandlerI... | 34.56 | 264 | 0.697917 |
ff6872add5d1029fa79be27ddea798ef297631d4 | 1,334 |
macro_rules! str_enum {
(
$enum_access: vis enum $enum_name: ident {
$error_access: vis type Err = $error_name: ident;
$( $variant_name: ident ( $variant_str: literal ) ),* $(,)?
}
) => {
#[derive(::core::cmp::Eq, ::core::cmp::PartialEq)]
$enum_access enu... | 31.023256 | 86 | 0.455772 |
1c779a3aeb11a880d4562f5685c7a58ad7130e2c | 6,913 | use crate::core::ribosome::error::RibosomeError;
use crate::core::ribosome::CallContext;
use crate::core::ribosome::RibosomeT;
use crate::core::workflow::call_zome_workflow::CallZomeWorkspace;
use crate::core::workflow::integrate_dht_ops_workflow::integrate_to_authored;
use holochain_cascade::error::CascadeResult;
use ... | 40.664706 | 100 | 0.634457 |
0aec737a6d0f55b221a4f953c7ed40aadada4f8d | 7,678 | use crate::common::{
configuration::{
genesis_model::{Fund, GenesisYaml, Initial, LinearFees},
jormungandr_config::JormungandrConfig,
node_config_model::{Log, LogEntry, NodeConfig, TrustedPeer},
secret_model::SecretModel,
},
file_utils, jcli_wrapper,
startup::build_genesi... | 34.9 | 98 | 0.644569 |
56678e701d4947de687159aa92ab80e71d4c1dcc | 3,732 | use crate::consts::KeyNumber;
use core::fmt::{self, Display};
#[cfg(feature = "std")]
extern crate std;
/// The error type which is returned when some `signify` operation fails.
#[derive(Debug, PartialEq)]
pub enum Error {
/// Not enough data was found to parse a structure.
InsufficentData,
/// Parsing a ... | 33.927273 | 100 | 0.625134 |
117053e9cd27215cd5cf7be915afeb430d11137e | 30,203 | // Generated from definition io.k8s.api.storage.v1.VolumeAttachment
/// VolumeAttachment captures the intent to attach or detach the specified volume to/from the specified node.
///
/// VolumeAttachment objects are non-namespaced.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct VolumeAttachment {
/// Standa... | 43.96361 | 211 | 0.601099 |
67c42eee25662bcaed207ff839a89df08afd9ed6 | 8,570 | // Copyright (c) 2017-2018 ETH Zurich
// Fabian Schuiki <fschuiki@iis.ee.ethz.ch>
//! A git repository and context for command execution.
#![deny(missing_docs)]
use std::path::Path;
use std::process::Command;
use std::ffi::OsStr;
use futures::Future;
use futures::future;
use tokio_process::CommandExt;
use error::*... | 34.979592 | 114 | 0.531272 |
1d460fbfc7b67e7307d76665749586998bb24c5d | 20,219 | #[cfg(feature = "actix-multipart")]
use super::schema::TypedData;
use super::{
models::{
DefaultOperationRaw, DefaultSchemaRaw, Either, Items, Parameter, ParameterIn, Response,
SecurityScheme,
},
schema::{Apiv2Errors, Apiv2Operation, Apiv2Schema},
};
use crate::util::{ready, Ready};
use acti... | 30.087798 | 95 | 0.578861 |
fe096fa6e6c8d418feb388a7bf32010dd3682e8d | 6,173 | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use super::MVHashMap;
use proptest::{collection::vec, prelude::*, sample::Index, strategy::Strategy};
use std::{
collections::{BTreeMap, HashMap},
fmt::Debug,
hash::Hash,
sync::atomic::{AtomicUsize, Ordering},
};
const ... | 33.010695 | 96 | 0.45132 |
dd580ce207f23e6e5c265765787ebdef2bd4b311 | 3,802 | // Copyright 2019 The Exonum Team
//
// 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... | 35.867925 | 87 | 0.646502 |
d614fadb1682a2e2b04cbf7c0c2c0bf07fcfbd75 | 93 | pub type c_char = i8;
pub type wchar_t = i16;
pub type c_long = i64;
pub type c_ulong = u64;
| 18.6 | 23 | 0.698925 |
fc09be913dc4260d682b7a1cc09a626ddb8b21af | 549 | use std::convert::TryInto;
use std::mem;
use liblumen_alloc::badarg;
use liblumen_alloc::erts::exception::Exception;
pub fn decode(bytes: &[u8]) -> Result<(u32, &[u8]), Exception> {
const U32_BYTE_LEN: usize = mem::size_of::<u32>();
if U32_BYTE_LEN <= bytes.len() {
let (len_bytes, after_len_bytes) = ... | 27.45 | 72 | 0.635701 |
481edb8c66cf841fef661808f03ea19af69692ce | 19,825 | //! Parallel iterator types for `IndexSet` with [rayon](https://docs.rs/rayon/1.0/rayon).
//!
//! You will rarely need to interact with this module directly unless you need to name one of the
//! iterator types.
//!
//! Requires crate feature `"rayon"`.
use super::collect;
use super::rayon::iter::plumbing::{Consumer, ... | 29.326923 | 97 | 0.581236 |
28c7a466dd06e838035138e5df26236abe12b041 | 3,155 | use super::*;
fn inline_list_kserds<'a, E: CxErr<'a>>(i: &'a str) -> IResult<&'a str, Vec<Kserd<'a>>, E> {
context(
"comma separated kserds",
separated_list0(
ignore_inline_whitespace(char(',')),
ignore_inline_whitespace(kserd_inline),
),
)(i)
}
/// Concise list... | 31.237624 | 93 | 0.577179 |
ab37628a6b9c001412df26c19e135f4b9119076a | 10,057 | use crate::signatures::SignatureRegistry;
use crate::{Config, Trap};
use anyhow::Result;
#[cfg(feature = "parallel-compilation")]
use rayon::prelude::*;
use std::sync::Arc;
#[cfg(feature = "cache")]
use wasmtime_cache::CacheConfig;
use wasmtime_runtime::{debug_builtins, InstanceAllocator};
/// An `Engine` which is a g... | 39.285156 | 98 | 0.621259 |
0efe6ece6e87250d755e37357ef69f09ab7301c0 | 2,959 | use parking_lot::RwLock;
use std::collections::{HashMap, VecDeque};
use std::hash::Hash;
use std::sync::Arc;
#[derive(Clone)]
pub struct NamedMap<K, V>
where
K: Clone + Eq + Hash,
V: Clone,
{
inner: Arc<RwLock<InnerMap<K, V>>>,
}
#[derive(Default)]
struct InnerMap<K, V>
where
K: Clone + Eq + Hash,
... | 24.056911 | 66 | 0.487665 |
21060576f2ec5f9085d80898ba764501c3e17161 | 661 | // 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 ... | 25.423077 | 68 | 0.683812 |
22a1c976887ef889d2e4b3ee3abda8c4d25715ad | 72,988 | use core::fmt;
use std::{cmp::{self, Reverse}, collections::HashMap, convert::TryFrom, error::Error};
use log::{debug, info, warn};
use screeps::{Attackable, ConstructionSite, FindOptions, HasId, HasPosition, HasStore, MoveToOptions, ObjectId, Part, Path, Position, RawObjectId, Resource, ResourceType, ReturnCode, Room... | 40.548889 | 530 | 0.458075 |
b9e9f55971dc4996d83fc748120613560b32fc1d | 176 | // Copyright 2019 Contributors to the Parsec project.
// SPDX-License-Identifier: Apache-2.0
//! IPC front handlers
pub mod domain_socket;
pub mod front_end;
pub mod listener;
| 25.142857 | 53 | 0.772727 |
c17833ee830707a68594d794735dec2ba9354486 | 595 | // 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 ... | 33.055556 | 71 | 0.690756 |
f5994fa419b33ba70b9d1f720d9c59070dcfb647 | 10,656 | extern crate clap;
use self::clap::{App, Arg};
use clap::crate_version;
use regex::Regex;
use std::process::Command;
use std::time::{SystemTime, UNIX_EPOCH};
trait Executor {
fn execute(&mut self, args: Vec<String>) -> String;
fn last_executed(&self) -> Option<Vec<String>>;
}
struct RealShell {
executed: Optio... | 27.677922 | 129 | 0.598067 |
0e8e87f2dff5c9512574cc8c5b192d882c5a6d58 | 705 | use crate::spec::TargetOptions;
pub fn opts() -> TargetOptions {
TargetOptions {
os: "vxworks".to_string(),
env: "gnu".to_string(),
vendor: "wrs".to_string(),
linker: Some("wr-c++".to_string()),
exe_suffix: ".vxe".to_string(),
dynamic_linking: true,
executabl... | 29.375 | 63 | 0.585816 |
5b69248735f1e702b803e1e7ebc2783402d81087 | 2,355 | /*
* 给定一个包含 m x n 个元素的矩阵(m 行, n 列),请按照顺时针螺旋顺序,返回矩阵中的所有元素。
*
* 示例 1:
*
* 输入:
* [
* [ 1, 2, 3 ],
* [ 4, 5, 6 ],
* [ 7, 8, 9 ]
* ]
* 输出: [1,2,3,6,9,8,7,4,5]
* 示例 2:
*
* 输入:
* [
* [1, 2, 3, 4],
* [5, 6, 7, 8],
* [9,10,11,12]
* ]
* 输出: [1,2,3,4,8,12,11,10,9,5,6,7]
*/
struct Solution {}
impl S... | 23.787879 | 82 | 0.407643 |
50c81596edffe9ac1145979f97804c934131c217 | 11,702 | // 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... | 34.621302 | 87 | 0.532302 |
9c046a6d18b17b5d86aa84825bc093035a75196a | 5,135 | use super::*;
use crate as mining;
use crate::{Config, Module};
use frame_support::pallet_prelude::{GenesisBuild, Hooks, MaybeSerializeDeserialize};
use frame_support::sp_runtime::traits::AtLeast32Bit;
use frame_support::{construct_runtime, ord_parameter_types, parameter_types, traits::EnsureOrigin, weights::Weight};
u... | 28.060109 | 116 | 0.744693 |
de52674cd1d3a291b7e87c8713f460c6d5b8cd3c | 2,409 | //! Database-related functions
use crate::config::{IConfig, CONFIG};
use actix_web::web;
use diesel::{
mysql::MysqlConnection,
pg::PgConnection,
r2d2::{ConnectionManager, PoolError},
sqlite::SqliteConnection,
Connection,
};
#[serde(untagged)]
#[derive(Clone, Deserialize, Debug, PartialEq)]
#[serde(... | 29.024096 | 100 | 0.663346 |
03df4d59ba91fffd8a9a7f38c32da7a31ef374ee | 1,589 | // Copyright 2020 Contributors to the Parsec project.
// SPDX-License-Identifier: Apache-2.0
use crate::constants::algorithm::HashingAlgorithm;
use crate::structures::Digest;
use crate::tss2_esys::{TPMT_HA, TPMU_HA};
use crate::{Error, Result, WrapperErrorKind};
use std::convert::{TryFrom, TryInto};
#[derive(Debug)]
p... | 32.428571 | 88 | 0.56073 |
0e65a42a1704a29463191dcf796c12398e02964b | 4,730 | //! A simple filterer in the style of the watchexec v1 filter.
use std::ffi::OsString;
use std::path::{Path, PathBuf};
use ignore::gitignore::{Gitignore, GitignoreBuilder};
use tracing::{debug, trace, trace_span};
use crate::error::RuntimeError;
use crate::event::{Event, FileType};
use crate::filter::Filterer;
use c... | 29.5625 | 100 | 0.67463 |
3832faadc9c29e0475c2ca16afe4c1ca7ee125e6 | 17,271 | // Generated from definition io.k8s.api.batch.v1.JobSpec
/// JobSpec describes how the job execution will look like.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct JobSpec {
/// Specifies the duration in seconds relative to the startTime that the job may be active before the system tries to terminate it; v... | 63.730627 | 728 | 0.569625 |
5b8736e15f4eeb631656fea8d97fef00dde4e3e9 | 136 | use crate::Node;
/// Item iterated over using an iterator.
pub struct Item<'a, T> {
pub node: &'a Node<T>,
pub level: usize,
}
| 17 | 41 | 0.617647 |
72509d67c4b1f2b1e5316c24126dc97bdd507922 | 3,003 | use bevy::{asset::LoadState, prelude::*, sprite::TextureAtlasBuilder};
/// In this example we generate a new texture atlas (sprite sheet) from a folder containing
/// individual sprites
fn main() {
App::build()
.init_resource::<RpgSpriteHandles>()
.add_plugins(DefaultPlugins)
.add_state(App... | 36.180723 | 100 | 0.694972 |
9ce59acfd7f23e7f24f91b9565c1368c63d2e2a4 | 22,688 | use csml_engine::{
data::{RunRequest}, start_conversation, user_close_all_conversations,
Client, CsmlResult
};
use csml_interpreter::data::csml_bot::CsmlBot;
use std::ffi::{CStr, CString};
use std::os::raw::c_char;
#[derive(Debug, serde::Deserialize)]
pub struct LimitPaginationQueryParams {
limit: Option<i6... | 26.259259 | 95 | 0.486821 |
09b250a13ce47131da41e7ba36597b92d109ef3c | 4,553 | use super::*;
use crate::config::Config;
use crate::rustfmt_diff::{make_diff, print_diff};
pub(crate) struct DiffEmitter {
config: Config,
}
impl DiffEmitter {
pub(crate) fn new(config: Config) -> Self {
Self { config }
}
}
impl Emitter for DiffEmitter {
fn emit_formatted_file(
&mut s... | 32.992754 | 93 | 0.518559 |
e6860be491332eccc9b495dcd5cb804e2688b11e | 6,992 | //! A wrapper type for representing a layer of indirection within a file.
//!
//! A `FilePtr<P, T>` is composed of two types: a pointer type `P` and a value type `T` where
//! the pointer type describes an offset to read the value type from. Once read from the file
//! it can be dereferenced to yield the value it point... | 30.801762 | 115 | 0.572654 |
28e19398c9f0761985cf929363be7c0a78e2312c | 15,171 | //! The `faucet` module provides an object for launching a Solana Faucet,
//! which is the custodian of any remaining lamports in a mint.
//! The Solana Faucet builds and send airdrop transactions,
//! checking requests against a request cap for a given time time_slice
//! and (to come) an IP rate limit.
use bincode::... | 33.490066 | 98 | 0.5614 |
fe852e5d8eaee4c95df68851587fde0643bb912e | 568 | // 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 ... | 35.5 | 68 | 0.732394 |
5dfcbf1350e492a1992e965a6ff18e3893388390 | 7,995 | use serde::{Serialize, Deserialize};
use serde_with::skip_serializing_none;
use super::request_mixin::*;
use crate::janus::core::json::*;
// mixins: RoomParameters (optional), AdminKeyParameters (if enabled)
#[skip_serializing_none]
#[derive(Serialize, Deserialize)]
pub struct CreateParameters {
request: String,
pub... | 33.734177 | 101 | 0.779862 |
edb1e0facaaf22f878bd5e8318de604ab9cd79ad | 2,018 | #[doc = "Reader of register FLT_DLC"]
pub type R = crate::R<u32, super::FLT_DLC>;
#[doc = "Writer for register FLT_DLC"]
pub type W = crate::W<u32, super::FLT_DLC>;
#[doc = "Register FLT_DLC `reset()`'s with value 0x08"]
impl crate::ResetValue for super::FLT_DLC {
type Type = u32;
#[inline(always)]
fn reset... | 31.046154 | 86 | 0.589693 |
fbc68c47ee6fac056b20a6454da0bccf71cdcf18 | 18,993 | use futures::future::BoxFuture;
use futures::{join, FutureExt};
use regex::Regex;
use serde::de::DeserializeOwned;
use serde_json::from_slice;
use std::convert::Into;
use std::future::Future;
use super::cache::{CacheExpiry, CacheManager, CachePolicy, FetchResult};
use super::client::{SpotifyApiError, SpotifyClient, Sp... | 30.004739 | 152 | 0.495551 |
22955fa94dc87afd302a83e65bab8467934dcf3a | 7,953 | //use std::collections::HashMap;
use std::convert::TryFrom;
use std::fmt;
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use std::path::Path;
pub trait SequenceCollection {
type SeqType;
type CollectionType;
fn from_fasta(fasta: File) -> Self::CollectionType;
fn new() -> Self::Coll... | 30.011321 | 89 | 0.50811 |
4a9875e55adea85da70c1b2b8166c204f54160e4 | 1,435 | #[test]
fn absolute_layout_justify_content_center() {
let layout = stretch::node::Node::new(
stretch::style::Style {
justify_content: stretch::style::JustifyContent::Center,
size: stretch::geometry::Size {
width: stretch::style::Dimension::Points(110f32),
... | 38.783784 | 70 | 0.565854 |
5066f19cb099502372ed7eace85822784711326b | 2,989 | use super::super::args::BaseArgs;
use super::super::credentials::{Credentials, CredentialsFile};
use super::super::error::TwitterError;
use std::fs;
use std::path::PathBuf;
const HELP: &str = "Initialize your credentials file!\n
Usage: tw init [OPTIONS]
Options:
-c, --credentials <name>
The file name or p... | 29.89 | 140 | 0.573101 |
2f470a83cdc31c4d6b93a65f4fb12b78770a3ba7 | 17,332 | // 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 ... | 27.7312 | 88 | 0.500577 |
6415ffe8d725fa7fded08769491589776658864c | 1,278 | use bb8::Pool;
use bb8_postgres::PostgresConnectionManager;
use std::str::FromStr;
// Select some static data from a Postgres DB
//
// The simplest way to start the db is using Docker:
// docker run --name gotham-middleware-postgres -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d postgres
#[tokio::main]
async f... | 31.170732 | 110 | 0.546166 |
ccaa0d4e1b1b059de8214d48454ea049d7897eac | 8,374 | // Copyright 2012-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-MI... | 31.961832 | 90 | 0.546334 |
23a993ecd1597f3b34243c7c0727fbec1bc94f87 | 2,053 | use std::io::{self, BufRead, Write};
use std::time::Duration;
use url::Url;
use crate::console;
use errors::Result;
/// Wait for user input and return what they typed
fn read_line() -> Result<String> {
let stdin = io::stdin();
let stdin = stdin.lock();
let mut lines = stdin.lines();
lines
.ne... | 28.513889 | 97 | 0.528495 |
9039707b763f9f95f3008c288ac7fe0319938ec5 | 903 | use crate::config::{read, Conf, NuConfig};
use indexmap::IndexMap;
use nu_protocol::Value;
use nu_source::Tag;
use parking_lot::Mutex;
use std::path::{Path, PathBuf};
use std::sync::Arc;
#[derive(Debug)]
pub struct FakeConfig {
pub config: NuConfig,
}
impl Conf for FakeConfig {
fn env(&self) -> Option<Value> ... | 20.066667 | 84 | 0.550388 |
fbdc4f395d9ffffb500288f7f45f72d6ccc7c7a0 | 3,952 | use crate::query_builder::limit_clause::{LimitClause, NoLimitClause};
use crate::query_builder::limit_offset_clause::{BoxedLimitOffsetClause, LimitOffsetClause};
use crate::query_builder::offset_clause::{NoOffsetClause, OffsetClause};
use crate::query_builder::{AstPass, IntoBoxedClause, QueryFragment};
use crate::resul... | 31.870968 | 97 | 0.628289 |
7654d8c440390189fcd282fc445bc9159adaf979 | 137 | // run-rustfix
#[allow(unused_macros)]
macro_rules! foo! { //~ ERROR macro names aren't followed by a `!`
() => {};
}
fn main() {}
| 15.222222 | 66 | 0.576642 |
09c81c394d88878c8cfec9e24613a7ec3dc5281a | 42,605 | //! Full build support for the Skia library, SkiaBindings library and bindings.rs file.
use crate::build_support::{android, cargo, clang, git, ios, vs};
use cc::Build;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::{env, fs};
/// The libraries to link with.
mod lib {
pub const SKIA: ... | 34.581981 | 147 | 0.554231 |
33e6653c553d64319db54db5857b0975ddefb693 | 231 | // variables2.rs
// Make me compile! Execute the command `rustlings hint variables2` if you want a hint :)
fn main() {
let x = 0u8;
if x == 10 {
println!("Ten!");
} else {
println!("Not ten!");
}
}
| 19.25 | 89 | 0.536797 |
bf3e9d4d19ac85b920c0a2bc735e6b5ecb47a203 | 319 | // enums1.rs
// Make me compile! Execute `rustlings hint enums1` for hints!
#[derive(Debug)]
enum Message {
Quit,
Echo,
Move,
ChangeColor
}
fn main() {
println!("{:?}", Message::Quit);
println!("{:?}", Message::Echo);
println!("{:?}", Message::Move);
println!("{:?}", Message::ChangeColor);
}
| 17.722222 | 62 | 0.579937 |
f79e631656f39fb589f0a3940ab2bc93075fad9e | 37,590 | #![doc = "generated by AutoRust"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use super::models;
#[derive(Clone)]
pub struct Client {
endpoint: String,
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
scopes: Vec<String>,
pipeline: azure_core::Pipeline,
... | 55.9375 | 136 | 0.5307 |
50666b8c649bc3f3561d0ac90ae1e9bc92bf8758 | 1,641 | // 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 ... | 26.467742 | 68 | 0.589275 |
1db6dccc89860037a6bc0f8f34291ae6ab1fa860 | 32,876 | // This file is part of sidh-rs.
// Copyright (c) 2017 Erkan Tairi
// See LICENSE for licensing information.
//
// Author:
// - Erkan Tairi <erkan.tairi@gmail.com>
//
use field::ExtensionFieldElement;
use curve::{ProjectiveCurveParameters, ProjectivePoint};
use isogeny::*;
use constants::*;
use fp::*;
use heapless::V... | 48.5613 | 315 | 0.612787 |
1c95656120323c3a2cb4d1f366b0cfda3e7413c5 | 351 | use raw::Local;
use cslice::CMutSlice;
// Suppress a spurious rustc warning about the use of CMutSlice.
#[allow(improper_ctypes)]
extern "C" {
#[link_name = "NeonSys_Buffer_New"]
pub fn new(out: &mut Local, size: u32) -> bool;
#[link_name = "NeonSys_Buffer_Data"]
pub fn data<'a, 'b>(out: &'a mut CMut... | 23.4 | 68 | 0.655271 |
9b15a4d06991cf0c8826e49e3de3e5c4e2e26d34 | 3,444 | // Copyright 2013-2015 The Servo 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>... | 43.05 | 92 | 0.624855 |
4bfe0537327ff1188f020c8235064f209c5bc16c | 878 | use actix::registry::SystemService;
use actix::*;
use chrono;
#[derive(Default)]
pub struct Ingestor;
impl Actor for Ingestor {
type Context = Context<Self>;
}
impl Supervised for Ingestor {}
impl SystemService for Ingestor {
fn service_started(&mut self, _ctx: &mut Context<Self>) {
info!("started In... | 22.512821 | 61 | 0.628702 |
fbfb2f0f36cf92c6c9fb9f9532f90ff7f6999659 | 5,307 | #![cfg_attr(not(feature = "std"), no_std)]
use sp_std::{prelude::*, vec::Vec, if_std};
use frame_support::{
decl_module, decl_event, decl_storage, decl_error,
ensure, dispatch,
traits::EnsureOrigin
};
use frame_system::{self as system, ensure_signed, RawOrigin};
/// Configure the pallet by specifying the parameter... | 36.102041 | 112 | 0.707368 |
08ffd5ff8f7f7f86ee32ac0ee9892dedb6845c10 | 9,467 | use crate::crypto::keys::strip_secret;
use crate::error::ClientError;
use std::fmt::{Debug, Display};
#[derive(ApiType)]
pub enum ErrorCode {
NotImplemented = 1,
InvalidHex = 2,
InvalidBase64 = 3,
InvalidAddress = 4,
CallbackParamsCantBeConvertedToJson = 5,
WebsocketConnectError = 6,
Websoc... | 31.039344 | 100 | 0.586669 |
2f4606a92818a423a160857c3e13da9da77adca8 | 1,559 | #[macro_use]
extern crate cpython;
use std::{
cell::RefCell,
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
use cpython::{PyResult, Python};
use midas_rs::{default, Float, Int, MidasR as MidasR_, MidasRParams};
py_module_initializer!(midas, initmidas, PyInit_midas, |py, module| {
modu... | 27.350877 | 77 | 0.609365 |
6940425d3eeba28921bb47808674640e4faa7195 | 4,148 | use emd_c::{SignatureT, DistFeaturesT, emd_call};
pub fn emd(doc_bow1: &[f32], doc_bow2: &[f32], distance_matrix: &[f32]) -> f32 {
let (features1, weights1) = bow_to_features_weights(doc_bow1);
let (features2, weights2) = bow_to_features_weights(doc_bow2);
unsafe {
emd_call(
&mut Signa... | 25.925 | 92 | 0.511331 |
6a45b9d9ecde756f2343f9b484b366b9110767ae | 2,927 | // -*- mode: rust; -*-
//
// This file is part of dalek-frost.
// Copyright (c) 2020 isis lovecruft
// See LICENSE for licensing information.
//
// Authors:
// - isis agora lovecruft <isis@patternsinthevoid.net>
//! Zero-knowledge proofs.
use k256::AffinePoint;
use k256::ProjectivePoint;
use k256::Scalar;
#[cfg(fea... | 31.138298 | 101 | 0.599932 |
67602786aa64b9a4dbff5c5ca1fb3119eaed083c | 4,300 | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use crate::translate::*;
use crate::MainContext;
crate::wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Source(Shared<ffi::GSource>);
match... | 34.677419 | 142 | 0.634419 |
69babf27fbb778e3b6cb57df708052934b52ed73 | 7,416 | // Copyright 2021 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | 36.895522 | 98 | 0.570119 |
7abc998d3882fccc0ebfd88dd40df276b859b113 | 52,623 | //! A pass that promotes borrows of constant rvalues.
//!
//! The rvalues considered constant are trees of temps,
//! each with exactly one initialization, and holding
//! a constant value with no interior mutability.
//! They are placed into a new MIR constant body in
//! `promoted` and the borrow rvalue is replaced w... | 41.897293 | 109 | 0.488152 |
76e56fe49ed0c0d1a29748b7f8cbbac8e364d38d | 3,081 | use std::collections::HashMap;
const ALPHABETS: [(&'static str, &'static str); 26] = [
("numeric", "1234567890"),
("abcd", "abcd"),
("qwerty", "asdfqwerzxcvjklmiuopghtybn"),
("qwerty-homerow", "asdfjklgh"),
("qwerty-left-hand", "asdfqwerzcxv"),
("qwerty-right-hand", "jkluiopmyhn"),
("azerty", "qsdfazerwx... | 27.265487 | 85 | 0.605972 |
8f9f4223f650fd2e5169d53e846c1e26e5534d9f | 5,506 | #[doc = "Register `WPMR` reader"]
pub struct R(crate::R<WPMR_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<WPMR_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<WPMR_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<WPMR_SP... | 29.762162 | 415 | 0.58409 |
693aabb78b4d8fe39076e157bb47f71b46a59868 | 2,888 | use std::{
convert::From,
error, fmt,
io::{self, prelude::*},
num::ParseIntError,
};
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum ErrorKind {
ConnectionLost,
InvalidBytesRead,
IOError,
}
#[derive(Debug)]
enum Repr {
Simple(ErrorKind),
Extended(ExtendedError),
}
#[derive(D... | 23.867769 | 96 | 0.553324 |
ed99f80478781f3a006d3793016ded32d5c32be4 | 17,042 | //! Parsing implementation for Tor authority certificates
//!
//! An "authority certificate" is a short signed document that binds a
//! directory authority's permanent "identity key" to its medium-term
//! "signing key". Using separate keys here enables the authorities
//! to keep their identity keys securely offline... | 34.015968 | 98 | 0.586023 |
d90be4fb1c9f0447a034dba4977c089e6a481189 | 42,861 | // Copyright 2014-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-MI... | 34.621163 | 83 | 0.568256 |
e4697127e4182b6b9056053cfe4edaffbdc3211a | 2,744 | #[allow(unused_imports)]
use builtin::*;
mod pervasive;
use pervasive::*;
use state_machines_macros::state_machine;
use state_machines_macros::case_on_next;
use state_machines_macros::case_on_init;
state_machine!{
B {
fields {
pub number: int,
}
init!{
initialize()... | 21.107692 | 83 | 0.492347 |
f7c07cb204e33ca3b6dede13a2edfa6388edfcc3 | 12,079 | use crate::{app::ldtk_entity::*, app::ldtk_int_cell::*};
use bevy::prelude::*;
/// Provides functions to register [Bundle]s to bevy's [App] for particular LDtk layer identifiers,
/// entity identifiers, and IntGrid values.
///
/// After being registered, [Entity]s will be spawned with these bundles when some IntGrid t... | 38.104101 | 104 | 0.632585 |
edce187e7c88b02ee4909d29c50d0c6b5c73202f | 6,576 | #![cfg(feature = "std")]
const VALUES: &[&str] = &[
"Rust",
"C",
"C++",
"C#",
"JavaScript",
"TypeScript",
"Java",
"Kotlin",
"Go",
];
const EXPECTED_LEFT: &[&str] = &[
"Rust------",
"C---------",
"C++-------",
"C#--------",
"JavaScript",
"TypeScript",
"Ja... | 24.446097 | 96 | 0.519313 |
fe3df462abcb036eb2b1304740aa03cbce0c5c51 | 599 | #![feature(test)]
extern crate route_recognizer;
extern crate test;
use route_recognizer::Router;
#[bench]
fn benchmark(b: &mut test::Bencher) {
let mut router = Router::new();
router.add("/posts/:post_id/comments/:id", "comment".to_string());
router.add("/posts/:post_id/comments", "comments".to_string()... | 29.95 | 70 | 0.659432 |
1a34fe59e0a76b31244dbebf4bd696e3ebf3c319 | 7,526 | //! Build program to generate a program which runs all the testsuites.
//!
//! By generating a separate `#[test]` test for each file, we allow cargo test
//! to automatically run the files in parallel.
//!
//! Idea adapted from: https://github.com/CraneStation/wasmtime/blob/master/build.rs
//! Thanks @sunfishcode
fn m... | 34.209091 | 96 | 0.46625 |
186e29c22176e31433a89ff3b2744a1282df919e | 3,974 | use crate::{functions::*, ndarray_util::as_2d, *};
use ndarray::s;
pub struct SelectNet<
S: Layer<Input = Computed, Output = Computed>,
L: Layer<Input = Computed, Output = Computed>,
> {
pub output_size: usize,
pub select_layer: S,
pub layers: Vec<L>,
}
impl<S: Layer<Input = Computed, Output = Co... | 28.589928 | 104 | 0.491696 |
e6a44c57f1b6581a8cc810ae559160ef20401b4f | 4,120 | // 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.785714 | 85 | 0.442718 |
d66b2a5cf84a651495d55be6ba7baef8ba758a77 | 14,335 | use rexpect::errors::Error;
use rexpect::spawn_stream;
use serialport::prelude::*;
use serialport::SerialPortSettings;
use std::env;
use std::fs::OpenOptions;
use std::process::{Command, Stdio};
use std::time::Duration;
use std::{thread, time};
fn earlgrey_cw310_flash(
app_name: &str,
) -> Result<rexpect::session:... | 29.864583 | 123 | 0.600279 |
ebdcff495a4cacd19a19fcf47b80a06dd30ae6fb | 529 | //! IOx Query Server Implementation.
#![deny(rustdoc::broken_intra_doc_links, rust_2018_idioms)]
#![warn(
missing_copy_implementations,
missing_docs,
clippy::explicit_iter_loop,
clippy::future_not_send,
clippy::use_self,
clippy::clone_on_ref_ptr
)]
#![allow(dead_code)]
pub use client_util::con... | 20.346154 | 60 | 0.746692 |
6a9ca910570a4f77d439db5312b12d5fd2b7526d | 1,008 | //! Link-time-optimization
/// Dummy type for pointers to the LTO object
#[allow(non_camel_case_types)]
pub type llvm_lto_t = *mut ::libc::c_void;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum llvm_lto_status_t {
LLVM_LTO_UNKNOWN = 0,
LLVM_LTO_OPT_SUCCESS = 1,
LLVM_LTO_READ_SUCCESS = 2,
... | 31.5 | 72 | 0.628968 |
223554e3e9ad93571cb31c4ccf3d4ff315e95626 | 25,237 | use crate::{
crypto::{AuthorityPen, AuthorityVerifier, KeyBox},
data_io::{reduce_header_to_num, AlephData, DataProvider, DataStore, FinalizationHandler},
default_aleph_config,
finalization::{AlephFinalizer, BlockFinalizer},
first_block_of_session,
justification::{
AlephJustification, Jus... | 36.681686 | 148 | 0.582399 |
e546f7f5083b883a914317f6b1454d789d07c49c | 4,804 | // Copyright 2019 Google LLC
//
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... | 35.323529 | 118 | 0.532681 |
89f980165a01d9fce456940e271b655471c3b645 | 7,836 | // SPDX-FileCopyrightText: 2021 Jason Francis <jafrancis999@gmail.com>
// SPDX-License-Identifier: MIT
use proc_macro2::TokenStream;
use proc_macro_error::abort;
use quote::quote;
pub fn impl_variant_type(input: syn::DeriveInput) -> TokenStream {
let crate_path = super::crate_path();
let mut repr_attr = None;... | 38.038835 | 109 | 0.401863 |
1ce093b4afd66514a4757bdbc90d369170f56ef7 | 22,019 | // Copyright 2013-2015, The Gtk-rs Project Developers.
// See the COPYRIGHT file at the top-level directory of this distribution.
// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
use ffi;
use font::{FontExtents, FontFace, FontOptions, Glyph, ScaledFont, TextCluster, TextE... | 27.050369 | 99 | 0.559335 |
8fb2f2147579ad99cb7c5e56e2ea455adb57e0bf | 2,436 | use qca_common::mbscanners::channel::{
MBBaud, MBChannel, MBChannelAddress, MBChannelRTUAddress, MBChannelTCPAddress, MBDataBits, MBFlowControl, MBParity,
MBStopBits,
};
use qca_common::mbscanners::device::MBDevice;
use qca_common::mbscanners::scanline::{MBScanline, MBScanlineCode};
use qca_common::mbscanners::... | 34.309859 | 119 | 0.503695 |
89dbdf01968d86f3e66db4c623ce0846c619df08 | 1,331 | // structs2.rs
// Address all the TODOs to make the tests pass!
//
#[derive(Debug)]
struct Order {
name: String,
year: u32,
made_by_phone: bool,
made_by_mobile: bool,
made_by_email: bool,
item_number: u32,
count: u32,
}
fn create_order_template() -> Order {
Order {
name: Stri... | 25.596154 | 82 | 0.619835 |
71e17b854e529d24a3befb06368f28e28cab474a | 9,299 | // Part of ethercat-rs. Copyright 2018-2019 by the authors.
// This work is dual-licensed under Apache 2.0 and MIT terms.
//! Modbus server allowing access to the PLC "memory" variables.
use std::collections::BTreeMap;
use std::io::{Result, Read, Write, ErrorKind};
use std::net::{TcpListener, TcpStream};
use std::thr... | 36.466667 | 102 | 0.450263 |
ed5cccf9df00675dc4aed5dc40f08f1c2efef731 | 9,914 | use std::{
collections::{BTreeMap, HashMap, HashSet},
ops::{Add, Mul, Sub},
};
pub fn solve() -> (usize, isize) {
let scanners = parse(std::fs::read_to_string("res/day19.txt").unwrap());
(part1(&scanners), part2(&scanners))
}
fn part1(scanners: &[Vec<Vector>]) -> usize {
let mut beacons: HashSet<... | 33.157191 | 100 | 0.507262 |
64cf00e54c85354829a9bfa14c85de1ac84d3c08 | 10,779 | use binary_derive::WasmBinary;
use ordered_float::OrderedFloat;
use crate::{BlockType, FunctionType, GlobalType, Idx, Label, Memarg, MemoryType, RawCustomSection, TableType, ValType, WasmBinary};
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct Module {
pub sections: Vec<Section>,
}
/// Just a marker; doe... | 30.709402 | 131 | 0.617404 |
64f2a28c7ac437bcd8ba83e88e58d9140c730fbd | 966 | // Author: Netcan @ https://github.com/netcan/Leetcode-Rust
// Zhihu: https://www.zhihu.com/people/netcan
use std::cmp::min;
impl Solution {
pub fn mincost_tickets(days: Vec<i32>, costs: Vec<i32>) -> i32 {
// dp[day]: 第day天所花费的最小票价
// dp[day] = min(dp[day-1]+costs[0], dp[day-7]+costs[1], dp[day-30]... | 34.5 | 85 | 0.478261 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.