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 |
|---|---|---|---|---|---|
11bf9768085fea30bca0df46d4564990f9bc27a8 | 25,996 | use std::cmp::Ordering;
use std::ops::Range;
/// `Position` represents a two-dimensional position which has line and column.
#[derive(PartialEq, Debug, Clone, Copy)]
pub struct Position {
/// A line number. It is in a range [0, _the number of lines_).
pub line: usize,
/// A column number. It is in a range ... | 31.663825 | 86 | 0.51204 |
accc898b8a8081ce1b82a5e97b2bf6f70c0bbe46 | 1,360 | // 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 ... | 26.666667 | 83 | 0.666912 |
11fbf1cb19b9ff943a406e0b90e554f87d037c02 | 7,258 | // Copyright 2019 Parity Technologies
//
// 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.032 | 118 | 0.671259 |
33917c1f36f004e0a5294193be3558b9330fc33f | 1,250 | use core_sled::SledKeySpace;
use super::kv_types::{
FSMMetaKey, LogMetaKey, LogMetaValue, RaftStateKey, RaftStateValue, StateMachineMetaValue,
};
use crate::types::openraft::{Entry, LogIndex};
/// Types for raft log in SledTree
pub struct Logs {}
impl SledKeySpace for Logs {
const PREFIX: u8 = 1;
const NA... | 26.041667 | 94 | 0.668 |
79c211e6182297d678d7c325561ca70e847a70e9 | 57,397 | use anyhow::Context;
use detail::DeploymentDetail;
use diesel::connection::SimpleConnection;
use diesel::pg::PgConnection;
use diesel::prelude::*;
use diesel::r2d2::{ConnectionManager, PooledConnection};
use graph::components::store::{EntityType, StoredDynamicDataSource};
use graph::data::subgraph::status;
use graph::p... | 37.786043 | 128 | 0.557468 |
26b50a4285d5d01be893fa2d443dd6feb2aeefd3 | 67 | //! This module holds Discord handlers for the bot.
pub mod ping;
| 16.75 | 51 | 0.731343 |
6991ffdcae1f0d965dcfc1964c3f838d9a260f82 | 1,273 | // Copyright 2016 Joe Wilm, The Alacritty Project Contributors
//
// 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 b... | 28.931818 | 100 | 0.739984 |
1669ad495e85e4f0b182fadec3106f535268a205 | 5,903 | use std::{
env, fs,
path::{Path, PathBuf},
sync::Arc,
};
use casper_execution_engine::{
core::engine_state::{EngineConfig, EngineState},
storage::{
global_state::lmdb::LmdbGlobalState, transaction_source::lmdb::LmdbEnvironment,
trie_store::lmdb::LmdbTrieStore,
},
};
use casper_h... | 31.068421 | 99 | 0.637642 |
cc03ac38943045d23e307050a5559c34843aebab | 201 | pub mod num {
pub trait Num2 {
fn from_int2(n: int) -> Self;
}
}
pub mod float {
impl ::num::Num2 for float {
fn from_int2(n: int) -> float { return n as float; }
}
}
| 16.75 | 61 | 0.517413 |
912ac73464043a3e4c43076dae0f67ac37dbc7f2 | 4,552 | #[doc = "Reader of register HC1_SPLT"]
pub type R = crate::R<u32, super::HC1_SPLT>;
#[doc = "Writer for register HC1_SPLT"]
pub type W = crate::W<u32, super::HC1_SPLT>;
#[doc = "Register HC1_SPLT `reset()`'s with value 0"]
impl crate::ResetValue for super::HC1_SPLT {
type Type = u32;
#[inline(always)]
fn re... | 28.993631 | 86 | 0.545914 |
fc4de69a7ee8007740c75e4bf66e250afe6d2b82 | 1,784 | use criterion::{black_box, criterion_group, criterion_main, Criterion, ParameterizedBenchmark};
use rand::{thread_rng, Rng};
use storage_proofs::drgraph::{new_seed, Graph, BASE_DEGREE};
use storage_proofs::hasher::blake2s::Blake2sHasher;
use storage_proofs::hasher::pedersen::PedersenHasher;
use storage_proofs::stacked:... | 34.307692 | 95 | 0.548206 |
038834b92c1648a934b56eec73337c1d36c8c5f2 | 892 | #[doc(hidden)]
#[macro_export]
macro_rules! _parse_unary_op {
(-, $($t:tt)+) => (_impl_unary_op_internal!(Neg, neg, $($t)+););
(!, $($t:tt)+) => (_impl_unary_op_internal!(Not, not, $($t)+););
}
#[doc(hidden)]
#[macro_export]
macro_rules! _impl_unary_op_internal {
($ops_trait:ident, $ops_fn:ident, &$lhs:ty,... | 27.875 | 96 | 0.475336 |
6a7ed588182518812229e8d6125e24332bdab54e | 2,651 | use libp2p::gossipsub::Topic;
use serde_derive::{Deserialize, Serialize};
/// The gossipsub topic names.
// These constants form a topic name of the form /TOPIC_PREFIX/TOPIC/ENCODING_POSTFIX
// For example /eth2/beacon_block/ssz
pub const TOPIC_PREFIX: &str = "eth2";
pub const TOPIC_ENCODING_POSTFIX: &str = "ssz";
pub... | 36.819444 | 86 | 0.667295 |
281a9e86bbf9edaae5c185508da32261ea4f1229 | 1,128 | use cpython::*;
use failure::Fail;
py_exception!(fast_stat, StatisticsError);
#[derive(Fail, Debug)]
crate enum MyError {
#[fail(display = "harmonic_mean requires at least one data point")]
HarmonicNoDataPoints,
#[fail(display = "harmonic mean does not support negative values")]
HarmonicNegatives,
... | 31.333333 | 86 | 0.655142 |
aca4d176724ff793156e6e73d4392d05a800498c | 14,712 | use crate::utils::span_lint;
use itertools::Itertools;
use pulldown_cmark;
use rustc::hir;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_tool_lint, impl_lint_pass};
use rustc_data_structures::fx::FxHashSet;
use std::ops::Range;
use syntax::ast::{AttrKind, Attribute};
use syntax:... | 34.535211 | 116 | 0.530315 |
4ba6eec12e97e46a29208ea4e0f063dfd3ed748c | 5,075 | extern crate walkdir;
#[cfg(windows)]
extern crate winres;
#[cfg(windows)]
extern crate cc;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate toml;
use walkdir::WalkDir;
use std::env;
use std::path::PathBuf;
use std::fs::copy;
use std::fs::create_dir_all;
use std::fs::File;
use std::io::Bu... | 29.505814 | 100 | 0.504236 |
f5bb5df3fa953f3aabaf22f8faf3a51f03a28cf9 | 998 | use pyo3::prelude::*;
/// Returns hexadecimal value of given RGB tuple. `r`, `g`, and `b` must be
/// in the range 0 - 255.
#[pyfunction]
fn rgb_to_hex(red: u8, green: u8, blue: u8) -> PyResult<u32> {
Ok(((red as u32) << 16) | ((green as u32) << 8) | blue as u32)
}
/// Returns a tuple `(r, g, b)` of the RGB integ... | 35.642857 | 80 | 0.625251 |
16698c643d20bb923468eb1c6ded0c0657e1859f | 4,540 | // Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0.
use crate::perf_context_metrics::{
APPLY_PERF_CONTEXT_TIME_HISTOGRAM_STATIC, STORE_PERF_CONTEXT_TIME_HISTOGRAM_STATIC,
};
use crate::{
raw_util, set_perf_flags, set_perf_level, PerfContext as RawPerfContext, PerfFlag, PerfFlags,
};
use engine_t... | 35.748031 | 97 | 0.644714 |
16a76f6cfea6b33c9760719bbfbc289ec08ef1e6 | 2,517 | use crate::command_prelude::*;
use anyhow::bail;
use cargo::{drop_println, CargoResult};
use serde::Serialize;
pub fn cli() -> App {
subcommand("locate-project")
.about("Print a JSON representation of a Cargo.toml file's location")
.arg(opt("quiet", "No output printed to stdout").short("q"))
... | 26.776596 | 87 | 0.559396 |
187c21136f3c5562e0971d046959bf20631cf782 | 16,511 | //
// Copyright 2020 The Project Oak Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law o... | 37.956322 | 100 | 0.585428 |
71e9270fe4b0cba6df22453a51f7f3533e51477e | 5,436 | // 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 ... | 22.46281 | 76 | 0.542494 |
7a0ac9d8b4f935fdd8c78368d18310ed75a51329 | 9,368 | #![allow(unused_imports, non_camel_case_types)]
use crate::models::r4::CodeableConcept::CodeableConcept;
use crate::models::r4::Element::Element;
use crate::models::r4::Extension::Extension;
use serde_json::json;
use serde_json::value::Value;
use std::borrow::Cow;
/// Set of definitional characteristics for a kind of... | 33.942029 | 94 | 0.593296 |
9ba612a8d75514d494aa99230136456dfe78204b | 10,761 | // Copyright 2019-2020 Twitter, Inc.
// Licensed under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
use rustcommon_metrics::*;
use serde_derive::{Deserialize, Serialize};
use strum_macros::{EnumIter, EnumString, IntoStaticStr};
#[cfg(feature = "bpf")]
use crate::common::bpf::*;
#[der... | 37.757895 | 93 | 0.587957 |
ac2d2365611e24c6f7cf35ffd7be3b0e3b36b344 | 9,918 | use crate::gc::Gc;
use crate::rerrs::{ErrorKind, SteelErr};
use crate::rvals::{Result, SteelVal};
use crate::stop;
use im_rc::HashSet;
use crate::primitives::ListOperations;
use crate::primitives::VectorOperations;
pub struct HashSetOperations {}
impl HashSetOperations {
pub fn hs_construct() -> SteelVal {
... | 31.585987 | 95 | 0.461182 |
625e9cbf182dc0eb979c1b3f1c47f3fbf5a6c317 | 2,312 | use std::str::FromStr;
use aoc_runner_derive::aoc;
use recap::Recap;
use serde::Deserialize;
#[derive(Debug, Deserialize, Hash, PartialEq, Recap)]
#[recap(regex = r#"(?x)
(?P<number_1>\d+)
-
(?P<number_2>\d+)
\s+
(?P<character>.)
:\s+
(?P<password>\S+)
"#)]
pub struct PasswordValidator {... | 23.835052 | 85 | 0.508218 |
690cfd5627d5c9bf98cfe67c6834ef9da653a0c0 | 276 | use crate::model::link::WrappedUri;
/// Pagination links
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
pub struct Pagination {
pub first: Option<WrappedUri>,
pub prev: Option<WrappedUri>,
pub next: Option<WrappedUri>,
pub last: Option<WrappedUri>,
}
| 27.6 | 55 | 0.710145 |
28dcd0f42c0625e65b01b6cec2fe78986797f363 | 880 | // option2.rs
// Make me compile! Execute `rustlings hint option2` for hints
fn main() {
let optional_value = Some(String::from("rustlings"));
// TODO: Make this an if let statement whose value is "Some" type
if let Some(value) = optional_value {
println!("the value of optional value is: {}", value... | 33.846154 | 108 | 0.625 |
8fc3468adbbe1c6bb106b84fc7f0151b4c25e589 | 57 | org.jfree.chart.renderer.category.StackedBarRendererTest
| 28.5 | 56 | 0.894737 |
9b71559100567c1642502279b62ef14c8135364a | 1,042 | // Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::cli_state::CliState;
use crate::StarcoinOpt;
use anyhow::Result;
use scmd::{CommandAction, ExecContext};
use starcoin_account_api::AccountInfo;
use structopt::StructOpt;
/// Create a new account
#[derive(Debug, StructOpt... | 26.05 | 97 | 0.673704 |
14f4db277edb1c57c95a8e8b7e2587d793872740 | 7,853 | //! A library that provides a more flexible way to construct
//! and extend the recursive function.
//!
//! The `RecurFn` trait is an abstraction of a recursive function.
//! By accepting a function parameter `recur` as the recursion
//! rather than recurring directly, it makes constructing an
//! anonymous recursive f... | 25.250804 | 101 | 0.546543 |
18edb603c6cf1ffcc3be91ae2ca7a11cf5bc43b6 | 26,724 | //! Implements "Stacked Borrows". See <https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md>
//! for further information.
use std::cell::RefCell;
use std::collections::{HashMap, HashSet};
use std::fmt;
use std::num::NonZeroU64;
use std::rc::Rc;
use rustc::hir::Mutability;
use rustc:... | 42.018868 | 145 | 0.585691 |
d937763c78be6d86bd64dd3333e1b4fa232f41e7 | 25,361 | // Copyright (c) Microsoft. All rights reserved.
use std::cmp::Ordering;
use std::path::{Path, PathBuf};
use regex::Regex;
use url::Url;
use url_serde;
use crate::crypto::MemoryKey;
use crate::error::{Error, ErrorKind};
use crate::module::ModuleSpec;
use crate::DEFAULT_AUTO_GENERATED_CA_LIFETIME_DAYS;
const DEVICEI... | 30.518652 | 139 | 0.568392 |
4a70c9c2f7cd3bf6d3cc563e6b2c5a86b3a0079e | 5,353 | //! [](https://docs.rs/slog_unwraps)
//! 
//! [](https://travis-ci.org/najamelan/slog_unwraps)
//! [... | 31.122093 | 202 | 0.566785 |
1db4e964996de7f8b3ad5abe8dbc5e42e0a3aa04 | 634 | #[doc = "POWER register accessor: an alias for `Reg<POWER_SPEC>`"]
pub type POWER = crate::Reg<power::POWER_SPEC>;
#[doc = "Description cluster: RAM\\[n\\]
power control register"]
pub mod power;
#[doc = "POWERSET register accessor: an alias for `Reg<POWERSET_SPEC>`"]
pub type POWERSET = crate::Reg<powerset::POWERSET_S... | 39.625 | 72 | 0.722397 |
ab1186722f0623e6e361824bde0a350d6a120457 | 15,008 | use std::prelude::v1::*;
use std::fmt;
use std::str::Chars;
use std::time::Duration;
use std::error::Error as StdError;
quick_error! {
/// Error parsing human-friendly duration
#[derive(Debug, PartialEq, Clone, Copy)]
pub enum Error {
/// Invalid character during parsing
///
/// Mor... | 36.338983 | 83 | 0.534382 |
e4174b47b99e2ef56d5474f0dfdc5cbb6eff1935 | 681 | use cell_project::cell_project as project;
use std::cell::Cell;
mod a {
pub struct Foo {
pub name: String,
pub build: i32,
}
pub struct Bar<T> {
pub name: String,
pub build: T,
}
pub struct Quax<T, U> {
pub name: String,
pub build: T,
pub va... | 20.636364 | 100 | 0.534508 |
4bcb13525d52aeaf7b4496d3d84b9fb1eb808f0d | 21,945 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[derive(std::fmt::Debug)]
pub(crate) struct Handle<C = aws_hyper::DynConnector> {
client: aws_hyper::Client<C>,
conf: crate::Config,
}
#[derive(Clone, std::fmt::Debug)]
pub struct Client<C = aws_hyper::DynConnector> {
handle:... | 38.165217 | 100 | 0.551652 |
8f767bc3154e479e72826f7563c2c7d9878523cb | 40,713 | use std::time::{Duration, Instant};
use metrix::{
processor::ProcessorMount, AggregatesProcessors, Decrement, DecrementBy, Increment,
IncrementBy, TelemetryTransmitter, TimeUnit, TransmitsTelemetryData,
};
use serde::{Deserialize, Serialize};
use crate::components::{
committer::CommitError,
connector... | 39.993124 | 100 | 0.561393 |
6a498ffc363b221e35a59981c33044c996fd8c72 | 3,689 | // Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
use env::{emitter::Emitter, Env};
use error::{Error, Result};
use hhbc::{hhas_attribute::HhasAttribute, hhbc_id, typed_value::TypedValue... | 35.471154 | 98 | 0.622662 |
d627de24d679451b66a8d9778720593479bc886b | 1,221 | // 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 ... | 39.387097 | 68 | 0.694513 |
16263eed8175ac41590879c04622b68ea4fc1f9a | 3,460 | use std::mem;
use std::ops::{Deref, DerefMut};
use core_foundation::base::{mach_port_t, kCFNull, kCFAllocatorDefault, CFType, TCFType};
use core_foundation::dictionary::{CFDictionary, CFMutableDictionary, CFMutableDictionaryRef};
use core_foundation::string::CFString;
use mach::{port, mach_port, kern_return, traps};
... | 26.412214 | 93 | 0.613873 |
ccb0044df9e55da91568e5b45be0f1df5be47c72 | 319 | use yew_router::{switch::Permissive, Switch};
#[derive(Debug, Clone, Switch)]
pub enum AppRoute {
#[to = "/login!"]
Login,
#[to = "/dashboard!"]
Dashboard,
#[to = "/list/{id}"]
List { id: usize },
#[to = "/user!"]
User,
#[to = "/page-not-found"]
NotFound(Permissive<String>),
}
| 19.9375 | 45 | 0.53605 |
4b0a3e7de797b9d70300490fd294b0831107f85e | 14,526 | //! Instruction Set Architectures.
//!
//! The `isa` module provides a `TargetIsa` trait which provides the behavior specialization needed
//! by the ISA-independent code generator. The sub-modules of this module provide definitions for
//! the instruction sets that Cranelift can target. Each sub-module has it's own im... | 37.341902 | 99 | 0.666185 |
1d898c6423dba88b26827e4c37fddbe0a44618fd | 4,663 | // SPDX-License-Identifier: Apache-2.0
use super::cpuid_page::CpuidPage;
use super::snp::firmware::Firmware;
use super::snp::launch::*;
use super::SnpKeepPersonality;
use crate::backend::kvm::builder::kvm_try_from_builder;
use crate::backend::kvm::mem::Region;
use std::convert::TryFrom;
use std::sync::{Arc, RwLock};... | 27.591716 | 77 | 0.514261 |
6773ad15f95283f783b1767311390d6dca413dee | 1,144 | //! SeaORM Entity. Generated by sea-orm-codegen 0.6.0
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "underscores")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: u32,
#[sea_orm... | 24.340426 | 81 | 0.621503 |
21f3a15509ac4f7c7412db1ae4675ed3c661a0ad | 1,605 | // 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... | 34.891304 | 83 | 0.711526 |
5d23d8ee854dac726de6a764ba545c88e7d7e817 | 12,758 | pub mod infer;
mod patterns;
use super::*;
#[cfg(feature = "dtype-date")]
use crate::chunkedarray::date::naive_date_to_date;
#[cfg(feature = "dtype-time")]
use crate::chunkedarray::time::time_to_time64ns;
use chrono::ParseError;
pub use patterns::Pattern;
#[cfg(feature = "dtype-time")]
fn time_pattern<F, K>(val: &str... | 33.397906 | 99 | 0.467001 |
2962eabbc4a8a94a0b7ae43b3677eafb1bec3805 | 14,204 | // This pallet use The Open Runtime Module Library (ORML) which is a community maintained collection of Substrate runtime modules.
// Thanks to all contributors of orml.
// Ref: https://github.com/open-web3-stack/open-runtime-module-library
#![cfg_attr(not(feature = "std"), no_std)]
// Disable the following two lints ... | 37.477573 | 199 | 0.577795 |
ac6d67109967c1fd4461f6ff88d6e8e508274f2b | 78,740 | #![doc = "generated by AutoRust 0.1.0"]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct OperationListResult {
#[serde(skip_serializing_if = "Vec::is_empty")]
pub value: Vec<Operation>,
}
#[derive... | 38.999505 | 108 | 0.703289 |
f5ae8ab5c5487b71b7a99e8a157d3440ff504ef7 | 10,806 | use std::os::raw::{c_char, c_int};
pub type BOOL = c_int;
/* ------------------------------------------------------------ */
/* Miscellaneous Declarations */
/* ------------------------------------------------------------ */
pub const MAX_PATH: usize = 260; // this is the current wi... | 40.171004 | 142 | 0.704886 |
f77c7777a29a19305e0e38f18cf6c4297e0eeddf | 1,834 | use db::Database;
use hyper::{body, Body, HeaderMap, Response, StatusCode};
use model::quiz::Submission;
/// Attempts to create a new quiz. Returns the ObjectID of the document.
async fn try_submit_quiz(db: &Database, sub: &Submission) -> Result<[u8; 12], StatusCode> {
let choice_count = sub.quiz.choices.len();
... | 39.021277 | 112 | 0.663032 |
760371ce533a41d0d3266ebcea6edd232c2d40d4 | 4,189 | //! # Object Records
//!
//! Each object Environment Record is associated with an object called its binding object.
//! An object Environment Record binds the set of string identifier names that directly
//! correspond to the property names of its binding object.
//! Property keys that are not strings in the form of an... | 30.801471 | 123 | 0.613034 |
e54cf93f6be3b4975acefad21ab63ceae8147746 | 2,450 | //! A module containing all possible replies the bot could send.
use super::SPOILER_TITLE_SEPARATOR;
/// Informs the user to send the content to be spoiled.
pub(crate) static PREPARING_A_SPOILER: &'static str =
"Preparing a spoiler. To cancel, type /cancel.
First send the content to be spoiled. It can be text, ph... | 43.75 | 100 | 0.738367 |
cc5861c415e8af27b84d0c7e706c7558a8fdcba7 | 697 | #[derive(Debug, Default)]
pub struct RawFileLoaderSource;
impl amethyst::assets::Source for RawFileLoaderSource {
fn modified(&self, _path: &str) -> Result<u64, amethyst::Error> {
Ok(0)
}
fn load(&self, path: &str) -> Result<Vec<u8>, amethyst::Error> {
use crate::initialize_paths;
u... | 26.807692 | 88 | 0.56528 |
169caf1f672667e7c064f3ce8e17d5b6b57fdc0d | 15,817 | // 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 ... | 40.043038 | 98 | 0.542644 |
383bbdc006e317b3d179896677f4abfde2926ce1 | 553 | use crate::aliases::{TMat3, TMat4, TVec3};
use crate::RealNumber;
/// Builds a 3x3 matrix `m` such that for any `v`: `m * v == cross(x, v)`.
///
/// # See also:
///
/// * [`matrix_cross`](fn.matrix_cross.html)
pub fn matrix_cross3<T: RealNumber>(x: &TVec3<T>) -> TMat3<T> {
x.cross_matrix()
}
/// Builds a 4x4 matr... | 26.333333 | 74 | 0.600362 |
1e15eb41bdc62f2c7ba6fccb19e5b8e2dd0ab2e5 | 817 | use crate::primitive::Primitive;
use crate::PancursesRenderer;
use iced_native::widget::slider;
use iced_native::{Point, Rectangle};
use std::ops::RangeInclusive;
impl slider::Renderer for PancursesRenderer {
fn height(&self) -> u32 {
1
}
fn draw(
&mut self,
bounds: Rectangle,
... | 25.53125 | 90 | 0.599755 |
5bc5222f9fc15666e479f38be15802fb9668df32 | 117,497 | //! Name resolution for lifetimes.
//!
//! Name resolution for lifetimes follows *much* simpler rules than the
//! full resolve. For example, lifetime names are never exported or
//! used between functions, and they operate in a purely top-down
//! way. Therefore, we break lifetime name resolution into a separate pass.... | 40.349245 | 100 | 0.469935 |
f48a44fd9a72872bafc81c933d3baf775c3f5bd2 | 7,099 | //! Gets video information by video ID (one or more), user ID (one only), or game ID (one only).
//! [`get-videos`](https://dev.twitch.tv/docs/api/reference#get-videos)
//!
//! # Accessing the endpoint
//!
//! ## Request: [GetVideosRequest]
//!
//! To use this endpoint, construct a [`GetVideosRequest`] with the [`GetVi... | 39.438889 | 219 | 0.660516 |
79f3ac267f818eba692a728a8f24484a187e885c | 99 | pub type QuickLink = *mut ::core::ffi::c_void;
pub type ShareOperation = *mut ::core::ffi::c_void;
| 33 | 51 | 0.69697 |
e4e02b62aabaf69bec5b50c0fff20587c48af74c | 4,076 | // let () = msg_send! is a common pattern for objc
#![allow(clippy::let_unit_value)]
use super::window::WindowInner;
use crate::connection::ConnectionOps;
use crate::spawn::*;
use cocoa::appkit::{NSApp, NSApplication, NSApplicationActivationPolicyRegular};
use cocoa::base::{id, nil};
use core_foundation::date::CFAbsol... | 29.536232 | 99 | 0.542934 |
2fc96836de0a9ffa21640d0aba948e9456c84b26 | 1,591 | use std::env;
fn increase(number: i32) {
println!("{}", number + 1);
}
fn decrease(number: i32) {
println!("{}", number - 1);
}
fn help() {
println!("usage:
match_args <string>
Check whether given string is the answer.
match_args {{increase|decrease}} <integer>
Increase or decrease given integer ... | 24.106061 | 77 | 0.395977 |
5b112b05f2e16d377014012d3feaf98b6f7945ed | 5,818 | // note this uses `smol`. you can use `tokio` or `async_std` or `async_io` if you prefer.
use anyhow::Context as _;
use std::collections::HashMap;
// extensions to the Privmsg type
use twitchchat::PrivmsgExt as _;
use twitchchat::{
messages::{Commands, Privmsg},
runner::{AsyncRunner, NotifyHandle, Status},
... | 33.245714 | 107 | 0.553283 |
877c0be00e1b89ff8dfec3fc656e92dad16f49a5 | 2,692 | // 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... | 35.421053 | 90 | 0.586924 |
9b62991f417f30e387a3a7a9307f143f6e9c2b61 | 3,747 | use mrklt::proof::ProofElem;
use wasm_bindgen::prelude::{wasm_bindgen, JsValue};
/// Accepts a list of blake2b-256 hashes packed into a single array. Returns the 32 byte root hash.
///
/// # Panics
///
/// Panics if the input value is not a multiple of 32.
/// Panics if number of leaves is 0.
#[wasm_bindgen]
pub fn co... | 30.463415 | 99 | 0.632773 |
d99b915ccf6811a4e32b2df645cc9e3b6d24e1dd | 1,938 | extern crate clap;
use clap::{App, Arg, SubCommand};
extern crate chrono;
use chrono::{Datelike, Local};
use directories::ProjectDirs;
use std::fs;
use std::fs::OpenOptions;
use std::io::prelude::*;
use std::io::Error;
use std::path::PathBuf;
fn main() -> Result<(), Error> {
let matches = App::new("daily-bread"... | 35.888889 | 99 | 0.5387 |
4a4a40e106deac1f4353ee6dca38781735d34822 | 29,767 | pub mod gk;
mod master_key;
mod side_tasks;
use crate::{
benchmark,
contracts::{
pink::{
group::GroupKeeper,
messaging::{WorkerPinkReport, WorkerPinkRequest},
},
ExecuteEnv, NativeContract,
},
pink::messaging::ContractInfo,
secret_channel::{PeelingRec... | 32.53224 | 103 | 0.518628 |
905056155481014361b8ea34b3b8d7173c9a3694 | 27,999 | //! Radio driver, Bluetooth Low Energy, NRF52
//!
//! The generic radio configuration i.e., not specific to Bluetooth are functions and similar which
//! do not start with `ble`. Moreover, Bluetooth Low Energy specific radio configuration
//! starts with `ble`
//!
//! For more readability the Bluetooth specific configu... | 33.774427 | 137 | 0.584164 |
e837b50b57e2b60989e8df2eb50baa0e2d8fa85b | 8,107 | use std::borrow::Cow;
use futures_util::stream::{Stream, StreamExt, TryStreamExt};
use indexmap::map::IndexMap;
use crate::connection::edge::Edge;
use crate::connection::page_info::PageInfo;
use crate::parser::types::Field;
use crate::resolver_utils::{resolve_container, ContainerType};
use crate::types::connection::{... | 32.558233 | 96 | 0.524855 |
bb69e93cb128f2b1ac95a8e3ed57efa7d8014b0d | 82,474 | // Copyright © 2015-2017 winapi-rs developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// All files in the project carrying such notice may not be copied,... | 29.709654 | 102 | 0.655807 |
f5e038060455fdb3e549302f21b55f193c2f2559 | 26,163 | // Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless ... | 27.86262 | 118 | 0.590758 |
5d693e0341a74559b12f544843d83c809aeab53e | 55,127 | // Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! Tools for providing Fuchsia services.
use {
byteorder::{LittleEndian, WriteBytesExt as _},
failure::{bail, Error, Fail, ResultExt},
fidl::... | 38.904023 | 123 | 0.578591 |
01388b92615c8097eb0499c0e471381c0d386da7 | 1,549 | use crate::models::Window;
use crate::models::WindowHandle;
use serde::{Deserialize, Serialize};
/// These are responses from the Window manager.
/// The display server should act on these actions.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum DisplayAction {
/// Nicely ask a window if it would please c... | 30.98 | 72 | 0.688832 |
e428fc927f05cf925caded37c7dfa77a947a0c63 | 76,251 | // 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.973133 | 99 | 0.55834 |
bfa7e932a9a90c2b8c9b855a73a832065fdb73fb | 3,345 | use super::super::app::{ActiveBlock, App, RouteId, LIBRARY_OPTIONS};
use super::common_key_events;
use termion::event::Key;
pub fn handler(key: Key, app: &mut App) {
match key {
k if common_key_events::right_event(k) => common_key_events::handle_right_event(app),
k if common_key_events::down_event(... | 39.352941 | 101 | 0.459791 |
d6ae283c9faa1970c56c3232f0a8d5d39cf8bc35 | 5,329 | mod auth;
mod environment;
mod graphql;
mod helpers;
mod model;
mod session;
mod sql;
use clap::Clap;
use environment::Environment;
use helpers::problem;
use hyper::server::Server;
use listenfd::ListenFd;
use std::convert::Infallible;
use std::net::SocketAddr;
use warp::Filter;
#[derive(Clap, Debug)]
#[clap(
name... | 29.441989 | 98 | 0.51642 |
2968e2e83dbd76458eb32609cc352a3e49d7d9a3 | 2,415 | use crate::{
Capacity, Clear, Collection, CollectionMut, CollectionRef, Get, GetMut, Iter, IterMut, Len,
PopBack, PushBack, Remove, Reserve, WithCapacity,
};
use smallvec::{Array, SmallVec};
impl<A: Array> Collection for SmallVec<A> {
type Item = A::Item;
}
impl<A: Array> CollectionRef for SmallVec<A> {
type Item... | 18.157895 | 92 | 0.632712 |
ddde6fc7ab9778544d31329c1a6104d029c86ab5 | 2,030 | //! An interface trait so that rest of Youki can call
//! necessary functions without having to worry about their
//! implementation details
use std::{any::Any, ffi::OsStr, path::Path, sync::Arc};
use anyhow::Result;
use bitflags::bitflags;
use caps::{CapSet, CapsHashSet};
use nix::{
mount::MsFlags,
sched::Clo... | 32.741935 | 87 | 0.620197 |
9022fce191c26440380b95f544e34e9c2d44f10f | 5,434 | // main.rs
use failure::{err_msg, Fail};
use futures::{future, future::Either, Future};
use hyper::client::connect::{Destination, HttpConnector};
use tower_grpc::Request;
use tower_hyper::client::ConnectError;
use tower_hyper::{client, util};
use tower_util::MakeService;
use crate::etcdserverpb::RangeRequest;
use cr... | 29.857143 | 96 | 0.493191 |
e8392af8948f9952114ecf942ea25dbd58bf6bd1 | 1,921 | // 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 ... | 30.492063 | 114 | 0.686101 |
f7901b3594531951249e2ddf3d25d278aaf82f40 | 15,408 | use std::convert::TryFrom;
/// The opcodes of the vm.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(u8)]
pub enum Opcode {
/// Pop the top value from the stack.
///
/// Operands:
///
/// Stack: value **=>**
Pop,
/// Push a copy of the top value on the stack.
///
/// Ope... | 22.928571 | 104 | 0.47722 |
e2c239d6da11c363a48a8aff96bdf3f5c683e1c3 | 3,981 | // Copyright 2017 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... | 30.389313 | 95 | 0.577744 |
b94a7f876ab0c854b651bbd684cb97d75ead5c84 | 8,706 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn serialize_operation_crate_operation_accept_invitation(
input: &crate::input::AcceptInvitationInput,
) -> Result<aws_smithy_http::body::SdkBody, aws_smithy_http::operation::SerializationError> {
let mut out = String::new();
... | 46.063492 | 98 | 0.753733 |
509ea5012066eb1ec87811dd33fe387a08299fd7 | 158 | #[test]
fn ui() {
let t = trybuild::TestCases::new();
t.pass("tests/ui/01-api-sanity-check.rs");
t.compile_fail("tests/ui/02-invalid-path.rs");
}
| 22.571429 | 50 | 0.613924 |
1e9ec229aa304a230d1fb5f2c41f61184cf643cd | 746 | use crate::fs::DirEntry;
use crate::wasi::types;
/// Iterator over the entries in a directory.
///
/// This corresponds to [`std::fs::ReadDir`].
///
/// TODO: Not yet implemented.
///
/// [`std::fs::ReadDir`]: https://doc.rust-lang.org/std/fs/struct.ReadDir.html
pub struct ReadDir {
fd: types::Fd,
}
impl ReadDir ... | 22.606061 | 84 | 0.628686 |
de7eeb57de10d7143351c8b9efc6dc91b6a12e78 | 1,084 | // 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 ... | 29.297297 | 76 | 0.664207 |
b9639b35fa3ee23d2539ca862d9bac139ec0767b | 79,366 | use {
crate::nonce_keyed_account::NonceKeyedAccount,
log::*,
solana_program_runtime::{ic_msg, invoke_context::InvokeContext},
solana_sdk::{
account::{AccountSharedData, ReadableAccount, WritableAccount},
account_utils::StateMut,
feature_set,
instruction::InstructionError,... | 36.273309 | 131 | 0.553247 |
29e7c2ef48d4fca06aedb9d1532ca1f2ecb9948a | 5,035 | use std::fs::File;
use std::io::Read;
use symbolic_unreal::{Unreal4Crash, Unreal4Error, Unreal4FileType};
fn get_unreal_crash() -> Result<Unreal4Crash, Unreal4Error> {
let mut file =
File::open("../testutils/fixtures/unreal/unreal_crash").expect("example file opens");
let mut file_content = Vec::new()... | 28.607955 | 99 | 0.65005 |
dd2c561eae81a8d9aa0ff01357dfe66d32c5a73a | 19,656 | /// Contains functions for retrieving the values of some of the DWARF attributes.
pub mod attributes;
/// Contains structs representing the different Rust data types and more.
pub mod evaluate;
use crate::call_stack::MemoryAccess;
use crate::registers::Registers;
use anyhow::{anyhow, Result};
use evaluate::{convert_t... | 37.655172 | 120 | 0.517145 |
fe86a610d41e42c310e92cca6347321016b0662c | 6,892 | use bevy::{prelude::*, type_registry::TypeRegistry};
/// This example illustrates loading and saving scenes from files
fn main() {
App::build()
.add_default_plugins()
// Registering components informs Bevy that they exist. This allows them to be used when loading scenes
// This step is only... | 45.342105 | 139 | 0.679193 |
f78100d176e4bc19b9c2b862e68205f3c474818c | 2,951 | use super::scene::*;
use super::record::*;
pub(crate) enum Tab {
AbilityCfg,
LimitRuleCfg,
AbilityEffectCfg,
AbilityEffectTypeCfg,
FightBuffCfg,
FightBuffEffectCfg,
TargetRuleCfg,
FightPointCfg,
FightCfg,
FightTypeCfg,
FightRepressTypeCfg,
FightStarRepress... | 36.432099 | 94 | 0.622162 |
676caae9fad38c3acea6c492284cbe4372556f54 | 7,607 | use std::{collections::HashMap, convert::TryFrom};
use anomaly::BoxError;
use tendermint_rpc::event::{Event as RpcEvent, EventData as RpcEventData};
use ibc::ics02_client::events::NewBlock;
use ibc::ics02_client::height::Height;
use ibc::ics24_host::identifier::ChainId;
use ibc::{
events::{IbcEvent, RawObject},
... | 33.511013 | 110 | 0.572105 |
ac731d772e44d619d76f3d456584b26474a6c62c | 154 | use crate::common::*;
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
pub(crate) struct Link {
pub(crate) text: String,
pub(crate) url: Url,
}
| 17.111111 | 29 | 0.681818 |
fb6552866610f22407a3f5ff5efb4eec59f38b1d | 13,362 | //! Connection configuration.
//!
//! Requires the `runtime` Cargo feature (enabled by default).
use crate::connection::Connection;
use crate::Client;
use log::info;
use std::fmt;
use std::path::Path;
use std::str::FromStr;
use std::sync::Arc;
use std::time::Duration;
use tokio::runtime;
#[doc(inline)]
pub use tokio_p... | 35.163158 | 120 | 0.646086 |
d5de0610ac58ccac071f20f38173b1d1698e1a85 | 1,481 | // Copyright Rivtower Technologies 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed ... | 25.101695 | 84 | 0.632681 |
260ed5802ef5bb1f00a5d919a7fb792e5d163024 | 171 | use gdnative::prelude::*;
#[derive(NativeClass)]
#[inherit]
struct Foo {}
#[methods]
impl Foo {
fn new(_owner: &Node) -> Self {
Foo {}
}
}
fn main() {}
| 11.4 | 35 | 0.54386 |
b9989e366f9cb9c5f41cca1144cce0ad6cba28d4 | 3,334 | use crate::sys::{
CoCreateInstance, CoGetClassObject, CoInitializeEx, CoUninitialize, CLSCTX_INPROC_SERVER,
COINIT_APARTMENTTHREADED, FAILED, HRESULT, IID, S_FALSE, S_OK,
};
use std::ffi::c_void;
use crate::{
interfaces::iclass_factory::{IClassFactory, IID_ICLASS_FACTORY},
CoClass, ComInterface, ComPtr... | 33.009901 | 101 | 0.573485 |
d953c7b513f66448edf23c8d7e24af972b5f22b7 | 3,773 | //! A collection of functions that are useful for unit testing your html! views.
use crate::VirtualNode;
impl VirtualNode {
/// Get a vector of all of the VirtualNode children / grandchildren / etc of
/// your virtual_node that have a label that matches your filter.
///
/// # Examples
///
/// ... | 28.156716 | 87 | 0.508879 |
bfa2574dd69536cec00010107a970d62280b231d | 14,793 | //! Line rendering.
use core::convert::Infallible;
use crate::{
alignment::{HorizontalTextAlignment, VerticalTextAlignment},
parser::{Parser, Token},
rendering::{cursor::LineCursor, line_iter::LineElementParser},
style::{color::Rgb, height_mode::HeightMode, TextBoxStyle},
utils::str_width,
};
use e... | 30.12831 | 99 | 0.469884 |
2170a0abb619b373c4aad39b242eb5fd27416298 | 2,355 | use crate::{AttributeList, Diff, List, PatchAttributeList, PatchCommon};
use sulafat_macros::{Clone, PartialEq, Serialize};
#[derive(Default, Clone, Debug, PartialEq, Serialize)]
pub struct Common<Msg> {
#[serde(skip)]
pub(crate) key: Option<String>,
pub(crate) attribute_list: AttributeList<Msg>,
pub(c... | 30.192308 | 96 | 0.563057 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.