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 |
|---|---|---|---|---|---|
f4b5f3e4c08ed3a3af741936fdc3718582efb24d | 27,657 | // Rust Elements Library
// Written by
// The Elements developers
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This software is distributed without
// any warranty.
//
// You should have rec... | 36.200262 | 149 | 0.557472 |
f8fca8a2b1cf00cdf643b72ca04eff9199070724 | 1,358 | use failure::Fail;
use serde::Serialize;
use ara_error::{ApiError, BoxedError};
use ara_model::core::{User, UserCredential};
use ara_model::db::tx;
use crate::shared::{sha256_hex, PlainContext};
pub fn activate(context: &dyn PlainContext, token: &str) -> Result<(), ActivationError> {
tx(context.db(), |conn| {
... | 30.863636 | 95 | 0.648012 |
dd9740a41e142addd3367ec87d267d274f1cf424 | 14,168 | //!
//! Serialize a Rust data structure into a `JsValue`
//!
use errors::Error;
use errors::ErrorKind;
use errors::Result as LibResult;
use neon::prelude::*;
use serde::ser::{self, Serialize};
use std::marker::PhantomData;
use num;
fn as_num<T: num::cast::NumCast, OutT: num::cast::NumCast>(n: T) -> LibResult<OutT> {
... | 24.469775 | 95 | 0.5583 |
de41cf1b8959f1564aead3194c943e73886e285e | 2,233 | const RI_REG_MODE: u32 = 0x0470_0000;
const RI_REG_CONFIG: u32 = 0x0470_0004;
const RI_REG_CURRENT_LOAD: u32 = 0x0470_0008;
const RI_REG_SELECT: u32 = 0x0470_000C;
const RI_REG_REFRESH: u32 = 0x0470_0010;
const RI_REG_LATENCY: u32 = 0x0470_0014;
const RI_REG_RERROR: u32 = 0x0470_0018;
const RI_REG_WERROR: u32 = 0x0470_... | 27.567901 | 84 | 0.479624 |
14d6508ebc6d5f386295a5d371c50fb1768c94df | 2,321 | use intern::intern;
use grammar::repr::*;
use lr1::lookahead::{Token, TokenSet};
use lr1::lookahead::Token::EOF;
use lr1::tls::Lr1Tls;
use test_util::{normalized_grammar};
use super::FirstSets;
pub fn nt(t: &str) -> Symbol {
Symbol::Nonterminal(NonterminalString(intern(t)))
}
pub fn term(t: &str) -> Symbol {
... | 22.533981 | 62 | 0.525636 |
3304a7b614604acf7ac75266beb0c6a1598fabfa | 8,058 | use protobuf::RepeatedField;
use reqwest::Response;
pub struct HttpClient {
uri: reqwest::Url,
http_client: reqwest::Client,
}
impl Default for HttpClient {
fn default() -> Self {
use reqwest::header;
let mut headers = header::HeaderMap::new();
headers.insert(header::ACCEPT, header... | 35.813333 | 109 | 0.605361 |
389e4b072a8a9e21b775a398cb068b1763caee34 | 1,393 | use super::UInt32Value;
use quick_xml::events::BytesStart;
use quick_xml::Reader;
use quick_xml::Writer;
use reader::driver::*;
use std::io::Cursor;
use writer::driver::*;
#[derive(Clone, Default, Debug)]
pub struct WorkbookView {
active_tab: UInt32Value,
}
impl WorkbookView {
pub fn get_active_tab(&self) -> &... | 27.313725 | 80 | 0.577172 |
aba9940ba774338f35bd9c9ade063d2be4a2b96b | 7,416 | #[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate tera;
#[macro_use]
extern crate log;
extern crate pretty_env_logger;
extern crate simple_error;
pub mod short;
pub mod shortdb;
use short::Short;
use futures::{future, Future};
use std::env;
use std::path::Path;
use std::fs;
use std::error::Error;
use ... | 29.903226 | 117 | 0.570388 |
28b9aad71a80c3e032939b6c58bd5412c945c7f3 | 2,042 | pub trait Queue<T> {
fn with_capacity(capacity: usize) -> Self;
fn len(&self) -> usize;
fn is_empty(&self) -> bool {
self.len() == 0
}
fn push_back(&mut self, val: T);
fn pop_front(&mut self) -> Option<T>;
}
/// A custom implementation of a circular queue which is
/// extremely quick an... | 26.868421 | 86 | 0.563173 |
90cc49c35c54d47cfbdaf4e82ab1badbf1e17ad7 | 352 | use std::io::{Result, Error, ErrorKind};
use std::fs::File;
use std::path::PathBuf;
pub fn make_io_error(message: String) -> Error {
Error::new(ErrorKind::Other, message)
}
pub fn open_file(path: &PathBuf) -> Result<File> {
File::open(path)
.map_err(|why| make_io_error(format!("Failed to open file at ... | 29.333333 | 99 | 0.644886 |
67f58be0089df541678f559636c878dae47e09b9 | 2,212 | /// Scheduler in-memory store
pub mod store;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use serde_json::value::RawValue;
use std::time::Duration;
use url::Url;
/// The representation of a Scheduled job
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct ScheduledJob {
/// The unique ... | 31.6 | 99 | 0.653255 |
2f0df59b2b710910dfec7f0b0a2828699901524b | 2,792 | //! Serial
use core::{fmt, marker::PhantomData};
use crate::{
gpio::*,
hal::{prelude::*, serial},
sysctl::{self, Clocks},
time::Bps,
};
use nb::{self, block};
use void::Void;
pub use tm4c129x::{UART0, UART1, UART2, UART3, UART4, UART5, UART6, UART7};
pub use tm4c_hal::{serial::*, uart_hal_macro, uart... | 24.068966 | 75 | 0.53904 |
086fbc9d3ddddcfba357846e45e897f806118814 | 75,625 | #![feature(box_patterns)]
#![feature(in_band_lifetimes)]
#![feature(iter_zip)]
#![feature(rustc_private)]
#![feature(control_flow_enum)]
#![recursion_limit = "512"]
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
#![allow(clippy::missing_errors_doc, clippy::missing_panics_doc, clippy::must_use_candidate)]
// wa... | 34.866298 | 120 | 0.561626 |
14953b872b1a60b2f3dedd22da1e0ffb535388f3 | 4,394 | // The From trait is used for value-to-value conversions.
// If From is implemented correctly for a type, the Into trait should work conversely.
// You can read more about it at https://doc.rust-lang.org/std/convert/trait.From.html
#[derive(Debug)]
struct Person {
name: String,
age: usize,
}
// We implement th... | 29.099338 | 96 | 0.561447 |
ff09d0bec75600c504e28403d36bfa24a280f3db | 9,307 |
use rocket::response::Flash;
use rocket::request::FlashMessage;
use rocket::response::content::Html;
use blog::*;
use titlecase::titlecase;
use super::{BLOG_URL, USER_LOGIN_URL, ADMIN_LOGIN_URL};
pub const UNAUTHORIZED_POST_MESSAGE: &'static str = "You are not authorized to post articles. Please login ... | 48.222798 | 185 | 0.447083 |
89e37561c8770e3afd5fc5b5da2876c2bf657efd | 2,049 | pub mod auth;
pub mod header;
pub mod typed;
pub mod untyped;
pub use header::Header;
pub use untyped::*;
/// Simple NewType around `Vec<Header>` that gives many helpful methods when dealing with headers
/// in [super::Request], [super::Response] and [super::SipMessage].
#[derive(Debug, PartialEq, Eq, Clone, Default)]... | 22.516484 | 97 | 0.527574 |
eb711f68a13048fda45c24baf81d65b314c55ad4 | 86 | fn foo() {
S {};
S { x, y: 32, };
S { x, y: 32, ..Default::default() };
}
| 14.333333 | 41 | 0.348837 |
71a44a01a69aa8bded2625f70cdddbb49450d9ab | 762 | // traits2.rs
//
// Your task is to implement the trait
// `AppendBar' for a vector of strings.
//
// To implement this trait, consider for
// a moment what it means to 'append "Bar"'
// to a vector of strings.
//
// No boiler plate code this time,
// you can do this!
trait AppendBar {
fn append_bar(self) -> Self;... | 21.166667 | 61 | 0.598425 |
e6c4aded1e00fedcf0ea88a430b3dbf4b82e8cf0 | 239 | // macros1.rs
// Make me compile! Execute `rustlings hint macros1` for hints :)
// run using ``rustlings run macros1``
macro_rules! my_macro {
() => {
println!("Check out my macro!");
};
}
fn main() {
my_macro!();
}
| 15.933333 | 65 | 0.58159 |
21ce08ab69c73cb5bf5244bffa361d39ca5e04f2 | 116 | // run-pass
#![allow(dead_code)]
#![feature(const_let)]
enum Foo {
Bar = { let x = 1; 3 }
}
pub fn main() {}
| 10.545455 | 26 | 0.534483 |
d689e6dda9b0c09b3f02356bfc8d4672b1f1b44b | 2,690 | // Copyright 2017-2021 Lukas Pustina <lukas@pustina.de>
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed ... | 30.568182 | 106 | 0.625651 |
d5c2033b516a6bc18719dbb5243688bac625455e | 5,384 | // Copyright (c) 2016-2017 Chef Software Inc. and/or applicable 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
//
// Unl... | 32.630303 | 92 | 0.615713 |
4809225ac7f212d8266c73fd8658b01f82b39524 | 1,259 | #[test]
fn kill_window() {
use crate::{KillWindow, TargetWindow};
use std::borrow::Cow;
// Kill the current window or the window at target-window, removing it from any sessions
// to which it is linked
//
// # Manual
// tmux ^1.7:
// ```text
// tmux kill-window [-a] [-t target-windo... | 27.977778 | 92 | 0.575854 |
2362bf13236949939f2fd02c065c77b1b82ba214 | 5,216 | use blake2::Blake2b;
use bls12_381_plus::Scalar;
use ff::Field;
use hkdf::HkdfExtract;
use rand_chacha::ChaChaRng;
use rand_core::{CryptoRng, RngCore, SeedableRng};
use serde::{Deserialize, Serialize};
use short_group_signatures_core::lib::*;
use zeroize::Zeroize;
/// The secret key contains a field element for each
/... | 28.043011 | 94 | 0.546587 |
1cf36dab395fd3f1091014239be44fa40264d3b5 | 2,456 | // 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 ... | 29.590361 | 85 | 0.588762 |
38d39667774867199abf98bf5bb476e50da52eaa | 6,457 | #[macro_use]
mod sys_common;
use sys_common::{io::tmpdir, symlink_supported};
#[test]
fn cap_smoke_test() {
let tmpdir = tmpdir();
check!(tmpdir.create_dir_all("dir/inner"));
check!(tmpdir.write("red.txt", b"hello world\n"));
check!(tmpdir.write("dir/green.txt", b"goodmight moon\n"));
check!(tmpdi... | 28.570796 | 82 | 0.56946 |
5ba5462c798a2476969040752f98b3fcc8722541 | 4,584 | #![allow(clippy::integer_arithmetic)]
use clap::{crate_description, crate_name, value_t, App, Arg};
use panoptes_ledger::entry::{self, create_ticks, init_poh, EntrySlice, VerifyRecyclers};
use panoptes_measure::measure::Measure;
use panoptes_perf::perf_libs;
use panoptes_sdk::hash::hash;
fn main() {
panoptes_logge... | 33.459854 | 99 | 0.497382 |
bf46edcfab8b172ffc4affd0eff34f98625e62af | 1,990 | // 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 ... | 25.844156 | 68 | 0.639196 |
1da05dcbc084c009c187ccfed440c1203b20bdf3 | 2,418 | use regex::{Error, Regex, RegexBuilder};
#[derive(Debug, PartialEq)]
pub enum ErrorKind {
UnknownCommand(char),
UnknownFlag(char),
TooManySegments,
NotEnoughSegments,
RegexError(Error),
}
#[derive(Debug, PartialEq)]
pub struct RegexData {
pattern_str: String,
pub replace_str: String,
p... | 24.18 | 64 | 0.53019 |
e4e1259df8bab428a64bedd95d0863f182de6a46 | 10,577 | //! The `genesis_config` module is a library for generating the chain's genesis config.
#![cfg(feature = "full")]
use crate::{
account::Account,
clock::{UnixTimestamp, DEFAULT_TICKS_PER_SLOT},
epoch_schedule::EpochSchedule,
fee_calculator::FeeRateGovernor,
hash::{hash, Hash},
inflation::Inflat... | 31.108824 | 99 | 0.556774 |
235e4f00ede540de156792597d66a2f87be12082 | 496 | pub mod aur_use {
use reqwest;
use serde::Deserialize;
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AurResponse {
pub version: i16,
pub r#type: String,
pub resultcount: i32,
}
pub async fn does_pkg_exist(pkg_name: &str) -> Result<... | 22.545455 | 88 | 0.570565 |
4880d13f39a6b539b317402c3313d3ee8d857d0e | 6,504 | use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::eager_or_lazy::is_lazyness_candidate;
use clippy_utils::source::{snippet, snippet_with_applicability, snippet_with_macro_callsite};
use clippy_utils::ty::{implements_trait, is_type_diagnostic_item, match_type};
use clippy_utils::{contains_return, get_... | 37.37931 | 109 | 0.481704 |
1a75b10f85c19a7f25f54118060a6e20fedae0de | 489 | //! Business Identifier Code (BIC, or SWIFT BIC or SWIFT code) as defined by ISO 9362.
use crate::iso3166::CountryCode;
use crate::iso9362::{BranchCode, InstitutionCode, LocationCode};
use serde::{Deserialize, Serialize};
/// [`BIC`] is an ISO 9362 BIC code.
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, ... | 32.6 | 86 | 0.728016 |
5d10dfdb9b0f4ea9a2bde121329b72e3ad830f2e | 2,239 | use indexmap::map::IndexMap;
use serde::{Deserialize, Serialize};
use crate::auth::KrakenAuth;
// Structs/Enums
use super::{EndpointInfo, KrakenInput, MethodType};
// Traits
use super::{Input, MutateInput, Output, UpdateInput};
/// Request builder for the Cancel Open Order endpoint
pub struct KICancelOrder {
par... | 27.641975 | 99 | 0.613667 |
5dcf1824ef0b7e3d387d0507f8f987a0ccf011df | 3,025 | use clippy_utils::diagnostics::span_lint;
use clippy_utils::is_hir_ty_cfg_dependant;
use if_chain::if_chain;
use rustc_hir::{Expr, ExprKind, GenericArg};
use rustc_lint::LateContext;
use rustc_middle::ty::layout::LayoutOf;
use rustc_middle::ty::{self, Ty};
use rustc_span::symbol::sym;
use super::CAST_PTR_ALIGNMENT;
p... | 37.345679 | 115 | 0.567934 |
9b87b5260a2c242cea1a121c904952cb82282fe2 | 7,778 | // Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or... | 26.546075 | 91 | 0.524814 |
9137cac76edc683ea50c378bcb006555b219d92c | 651 | use super::{Field, InformationElement};
use std::str;
use std::str::Utf8Error;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Ssid {
bytes: Vec<u8>,
}
impl Ssid {
pub fn new(bytes: Vec<u8>) -> Ssid {
Ssid { bytes }
}
pub fn as_str(&self) -> Result<&str, Utf8Error> {
str::from_utf8(... | 19.147059 | 67 | 0.585253 |
bb064c6ef616fcf15cb771d3cd37d8a908cb72f2 | 4,018 | use azure_core::errors::AzureError;
use azure_core::AddAsHeader;
use http::request::Builder;
use http::HeaderMap;
use std::borrow::Cow;
use std::collections::HashMap;
use std::convert::TryFrom;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Properties<'a, 'b>(HashMap<Cow<'a, str>, Cow<'b, str>>);
const HEADER: &st... | 39.009709 | 237 | 0.564958 |
d9ed7d10a35890b398150e1d31fff52679749bed | 600 | use vizia::*;
// Example showing inline styling of views
fn main() {
Application::new(WindowDescription::new().with_title("Style"), |cx| {
VStack::new(cx, |cx| {
Label::new(cx, "Label 1")
.width(Pixels(100.0))
.height(Pixels(30.0))
.background_co... | 26.086957 | 73 | 0.481667 |
e5fd7e11881375696a71f6e5805c08088a7e8e71 | 18,870 | /*---------------------------------------------------------------------------------------------
* Copyright © 2016-present Earth Computing Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE.txt in the project root for license information.
*----------------------------------------------... | 53.760684 | 194 | 0.602279 |
fce3e747301492d32c5a7cbfd2c482674318b420 | 20,974 | use self::{
ctx::Ctx,
storage::{Storage, *},
};
use crate::{
marks::Marks,
util::{can_end_conditionally, idents_used_by, now},
};
use fxhash::{FxHashMap, FxHashSet};
use std::time::Instant;
use swc_atoms::JsWord;
use swc_common::{SyntaxContext, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_utils::{ident:... | 27.561104 | 97 | 0.501573 |
fb8a234fd14096b764b24ce0eb1d952190d068dc | 16,616 | /*!
The `Page` class deals with operations done on pages, like editing.
*/
#![deny(missing_docs)]
use crate::media_wiki_error::MediaWikiError;
use crate::api::Api;
use crate::title::Title;
use serde_json::Value;
use std::collections::HashMap;
use std::error::Error;
use std::fmt;
/// Represents a page.
#[derive(Debug... | 33.5 | 109 | 0.519921 |
67db7b913a3daee2ac186c6cce96d449637db178 | 3,358 | use std::fs::File;
use std::io::BufReader;
use std::io::BufRead;
use std::collections::VecDeque;
struct Node {
name: String,
enodes: Vec<usize>,
checked: bool,
parent: usize,
}
struct Graph {
nodes: Vec<Node>,
}
impl Graph {
fn search_node(&mut self, name: &str) -> usize {
for i in ... | 25.633588 | 128 | 0.471114 |
fe15715dce17ccaebef8a41a64c72bf87a2095a1 | 823 | /*
* Hetzner Cloud API
*
* Copied from the official API documentation for the Public Hetzner Cloud.
*
* The version of the OpenAPI document: 0.5.0
*
* Generated by: https://openapi-generator.tech
*/
/// RetryIssuanceOrRenewalResponse : Response to POST https://api.hetzner.cloud/v1/certificates/{id}/actions/re... | 26.548387 | 114 | 0.703524 |
62d9a33c83d7af78d0280a0118e950844b59c99b | 1,834 | // 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... | 29.111111 | 76 | 0.647764 |
723c6ad10a10fc3215085ce6be65ea63fb8f6812 | 3,066 | #[doc = "Register `HBN_PIR_VTH` reader"]
pub struct R(crate::R<HBN_PIR_VTH_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<HBN_PIR_VTH_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<HBN_PIR_VTH_SPEC>> for R {
#[inline(always)]
fn f... | 29.76699 | 404 | 0.608284 |
67cc694ae12c7087121c76cacbf2a749273923a5 | 1,045 | // 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 ... | 34.833333 | 76 | 0.643062 |
bfcc0391c83e35708e7ce662e2722de0819077e3 | 784 | use std::iter::FromIterator;
use super::Treemap;
impl FromIterator<u64> for Treemap {
/// Convenience method for creating treemap from an iterator.
///
/// # Examples
///
/// ```
/// use std::{u32, u64};
/// use croaring::Treemap;
///
/// let treemap: Treemap = (1..3).chain(u64::fr... | 29.037037 | 101 | 0.563776 |
f7e5dab5332db02e33bfd1eaf47c85bab67d0380 | 597 | use bakkesmod::prelude::*;
use bakkesmod::wrappers::unreal::*;
use bakkesmod::{game, console};
#[plugin_init]
pub fn on_load() {
console::register_notifier("set_ball_location", Box::new(move |_: Vec<String>| {
let game = match game::get_game_event_as_server() {
Some(g) => g,
None =>... | 28.428571 | 84 | 0.512563 |
9b8925be4bbba13250634e3dff1b0dc29a799175 | 5,503 | // Copyright © 2016-2017 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use rabble::{self, Pid, CorrelationId, Envelope};
use msg::Msg;
use super::utils::QuorumTracker;
use vr::vr_msg::{self, VrMsg, RecoveryResponse, ClientOp};
use vr::VrCtx;
use vr::vr_fsm::{Transition, VrState, State};
use ... | 34.829114 | 100 | 0.550427 |
dd7b6e34a1cf26e70f9fab004555e70264913525 | 1,791 | // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
use super::dispatch_json::{JsonOp, Value};
use crate::op_error::OpError;
use crate::ops::json_op;
use crate::state::State;
use crate::worker::WorkerEvent;
use deno_core::*;
use futures::channel::mpsc;
use futures::sink::SinkExt;
use std::convert... | 27.553846 | 77 | 0.683417 |
d6ce2f3d8fa4a1152529f6f798dd5e9ff9525ad5 | 22,337 | use Cursive;
use Printer;
use With;
use align::{Align, HAlign, VAlign};
use direction::Direction;
use event::{Callback, Event, EventResult, Key, MouseButton, MouseEvent};
use menu::MenuTree;
use std::borrow::Borrow;
use std::cell::Cell;
use std::cmp::min;
use std::rc::Rc;
use theme::ColorStyle;
use unicode_width::Unico... | 31.110028 | 79 | 0.505036 |
1af4a8ad723860c577a7b988d06eb3b139148172 | 666 | // This file is part of olympus-xmp. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/raphaelcohn/olympus-xmp/master/COPYRIGHT. No part of olympus-xmp, including this file, may be copied, modified, propagated, or dist... | 95.142857 | 390 | 0.791291 |
759b21218c353e70787f853a6c09725bf7132b10 | 16,147 | // Inspired by Paul Woolcock's cargo-fmt (https://github.com/pwoolcoc/cargo-fmt/).
#![deny(warnings)]
#![allow(clippy::match_like_matches_macro)]
use std::cmp::Ordering;
use std::collections::{BTreeMap, BTreeSet};
use std::env;
use std::ffi::OsStr;
use std::fs;
use std::hash::{Hash, Hasher};
use std::io::{self, Write... | 29.519196 | 100 | 0.565182 |
71127e88ec32c0f231822ffeb1f4bf50f6783b82 | 1,180 | // This file is part of Substrate.
// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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
//
// ht... | 30.25641 | 84 | 0.750847 |
2316d905a326fdd74ca7bb928779c4ebd43d5a5a | 7,302 | //! Collect statistics about what is being painted.
use crate::*;
/// Size of the elements in a vector/array.
#[derive(Clone, Copy, PartialEq)]
enum ElementSize {
Unknown,
Homogeneous(usize),
Heterogenous,
}
impl Default for ElementSize {
fn default() -> Self {
Self::Unknown
}
}
/// Aggr... | 30.049383 | 98 | 0.536154 |
3ad78f088f9c9f5fe26e92187f40e0cee21218d7 | 1,272 | // 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 ... | 24.941176 | 68 | 0.60456 |
eb3a2f6d110c846f6b86fb5f998031c8c1edd734 | 6,420 | use std::convert::{TryFrom, TryInto};
use thiserror::Error;
tonic::include_proto!("io.linkerd.proxy.net");
/// Indicates an IP address could not be decoded.
#[derive(Clone, Debug, Error)]
#[error("invalid IP address")]
pub struct InvalidIpAddress;
/// Indicates an IP address could not be decoded.
#[derive(Clone, Deb... | 26.097561 | 82 | 0.499844 |
1e450bae4c03c717364a73295d0cddef5ea3e976 | 4,940 | // External imports
use num::{rational::Ratio, BigUint};
// Workspace imports
use zksync_types::{Token, TokenId, TokenLike, TokenPrice};
use zksync_utils::{big_decimal_to_ratio, ratio_to_big_decimal};
// Local imports
use crate::tests::db_test;
use crate::{
tokens::{TokensSchema, STORED_USD_PRICE_PRECISION},
Qu... | 32.287582 | 87 | 0.640486 |
9c6430c0039a3e832b30205ef70e233da7236b0e | 3,482 | //! Derive `Write`.
use crate::internal::get_root_path;
use proc_macro2::TokenStream as TokenStream2;
use quote::{quote, quote_spanned, ToTokens};
use syn::{
parse::{Parse, ParseStream, Result as ParseResult},
parse_quote,
spanned::Spanned,
Data, DeriveInput, Fields, GenericParam, Generics, Ident, Index... | 32.542056 | 101 | 0.42332 |
620487b86cc52737d6fb9074c1de85e39e7d0859 | 2,334 | use std::marker::PhantomData;
use bitvec::prelude::{BitVec, Lsb0};
use super::super::PrimitiveFixedWidthEncode;
use super::BlockBuilder;
/// Encodes fixed-width data into a block, with null element support.
///
/// The layout is fixed-width data and a u8 bitmap, concatenated together.
pub struct PlainPrimitiveNullab... | 29.544304 | 94 | 0.604113 |
d96db9436f2c69b5dd39f1ef1291b159df9b9a85 | 144 | pub(crate) mod list;
mod login;
pub(crate) mod register;
pub(crate) mod token;
pub(crate) use login::login;
pub(crate) use register::register;
| 18 | 34 | 0.736111 |
d6ff89473ccb4ddab4937ef382364d2e5abf201d | 5,544 | mod utils;
use wasm_bindgen::prelude::*;
use web_sys::console;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
// JS doesn't have a chars type which means:
// - The... | 28.725389 | 99 | 0.664322 |
1836c5415d29f52d36759cde8909640fc6283618 | 12,542 | use crate::whole_stream_command::{whole_stream_command, Command};
use indexmap::IndexMap;
use nu_errors::ShellError;
use nu_parser::ParserScope;
use nu_protocol::{hir::Block, Signature, Value};
use nu_source::Spanned;
use std::sync::Arc;
#[derive(Debug, Clone)]
pub struct Scope {
frames: Arc<parking_lot::Mutex<Vec... | 28.634703 | 106 | 0.536517 |
0386f3369833a73403bce53dc79c561ecfe2bba0 | 85,114 | // Copyright Materialize, Inc. and contributors. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by ... | 39.025218 | 160 | 0.507355 |
5d206dec984e6fb3bd4688c676032b8b0d559c5d | 1,921 | //! Semihosting operations
// TODO document
#![allow(missing_docs)]
pub const CLOCK: usize = 0x10;
pub const CLOSE: usize = 0x02;
pub const ELAPSED: usize = 0x30;
pub const ERRNO: usize = 0x13;
pub const FLEN: usize = 0x0c;
pub const GET_CMDLINE: usize = 0x15;
pub const HEAPINFO: usize = 0x16;
pub const ISERROR: usiz... | 33.12069 | 54 | 0.675169 |
b986f6aabcc228225fef1f7d965720c3bc58e613 | 14,381 | use crate::distribution::{self, poisson, Discrete, Univariate};
use crate::function::{beta, gamma};
use crate::statistics::*;
use crate::{Result, StatsError};
use rand::distributions::Distribution;
use rand::Rng;
use std::f64;
/// Implements the
/// [NegativeBinomial](http://en.wikipedia.org/wiki/Negative_binomial_dis... | 30.663113 | 95 | 0.518462 |
d771be077ae3a403aeb830a216ea5a2d12f7f1fb | 25,259 | // 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 ... | 39.966772 | 98 | 0.548755 |
d6a0d24bef360dea669754ea951c436952b821c2 | 10,871 | // Take a look at the license at the top of the repository in the LICENSE file.
use glib::subclass::prelude::*;
use glib::translate::*;
use glib::{Cast, Error};
use crate::Cancellable;
use crate::InputStream;
use crate::OutputStream;
use crate::OutputStreamSpliceFlags;
use std::ptr;
pub trait OutputStreamImpl: Obj... | 28.458115 | 98 | 0.511912 |
71945983d3c39e335847624056197c0e9c7aa6d1 | 13,337 | use form_urlencoded::Serializer;
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::{
convert::{Into, TryFrom, TryInto},
vec::IntoIter,
};
use crate::app::models::*;
#[derive(Serialize)]
pub struct Uris {
pub uris: Vec<String>,
}
pub enum SearchType {
Artist,
Album,
}
impl SearchTyp... | 24.382084 | 300 | 0.521032 |
fca55bd749ff3ddaece4f1c491fb96395e9b0987 | 2,226 | use crate::model::model::{FieldType, Field, DataType, DataValue, DataError, IncompatibleError};
use crate::image::ImageView;
use image::{ImageFormat, ImageError};
use imageproc::drawing::Canvas;
use base64::DecodeError;
pub const IMAGE_TYPE: FieldType = FieldType(0b_000_000_000);
pub(crate) struct ImageDataType;
imp... | 36.491803 | 123 | 0.579964 |
506d7a2321045d52c82e0f3d4db8ff3b7fbb98aa | 64,670 | //! Manage xml character escapes
use memchr;
use std::borrow::Cow;
use std::collections::HashMap;
use std::ops::Range;
#[derive(Debug)]
pub enum EscapeError {
/// Entity with Null character
EntityWithNull(::std::ops::Range<usize>),
/// Unrecognized escape symbol
UnrecognizedSymbol(
::std::ops:... | 37.102697 | 100 | 0.416004 |
d57077dc7526e57e068d42ea9c529023a593179f | 1,196 | use shaderc::{OptimizationLevel, ShaderKind};
use std::fs;
pub struct Compiler;
impl Compiler {
pub fn compile_shaders(directory: &str) {
for entry in fs::read_dir(directory).unwrap() {
let path = entry.unwrap().path();
let name = path.as_path().to_str().unwrap();
if p... | 34.171429 | 109 | 0.600334 |
bb9d6335831aaf39c548cc199584a5cb40a4c18b | 960 | use rcc::traits::Rcc;
use rcc::traits::Hsi;
use bitbanding::range::Range;
use bitbanding::traits::PeripheralBitbanding;
use parts::stm32::f4:Stm32F439 as Stm32F439Trait;
pub struct Stm32F439 {}
pub trait Stm32F439Trait {}
impl Stm32F439Trait for Stm32F439 {}
impl Rcc for Stm32F439 {
const RCC: u32 = 0x4002_38... | 23.414634 | 50 | 0.702083 |
1cb82c7195b9fa791ee32655f727e3c04378b377 | 1,627 | #[doc = "Register `WLENGTHH` reader"]
pub struct R(crate::R<WLENGTHH_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<WLENGTHH_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<WLENGTHH_SPEC>> for R {
#[inline(always)]
fn from(reader: ... | 30.698113 | 245 | 0.628765 |
71d7467fe94960b09eeb9417838b4b8ff06c9ebf | 11,239 | // Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
file_format::{CodeOffset, FunctionDefinitionIndex, TableIndex},
IndexKind,
};
use move_core_types::{
language_storage::ModuleId,
vm_status::{self, StatusCode, StatusType, VMStatus},
};
use std::fmt;
pub ty... | 29.11658 | 99 | 0.525581 |
56ca9ba59a627ec8f2622c2267c6b34869161add | 379 | use uinput::{Error, Device};
use uinput::event::Keyboard::All;
use uinput;
pub fn create() -> Result<Device, String> {
create_device()
.map_err(|e| format!("{}", e))
}
fn create_device() -> Result<Device, Error> {
let device = uinput::open("/dev/uinput")?
.name("razer-naga-virtual-keyboard")?
... | 21.055556 | 45 | 0.583113 |
ab59ab6348e97ea7efa27c1e1e727c33cb933187 | 14,588 | // Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
use std::cmp::Ordering;
use crate::codec::collation::Collator;
use crate::{match_template_collator, match_template_evaltype};
use crate::{Collation, EvalType, FieldTypeAccessor};
use match_template::match_template;
use tipb::FieldType;
use super::*;
... | 31.782135 | 122 | 0.503427 |
fe498e0a3247d8be98e90c31178f97f3937e6029 | 1,693 | /*
* Copyright 2022 nzelot<leontsteiner@gmail.com>
*
* 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 la... | 31.943396 | 91 | 0.642646 |
ef28aeaa953d4211da2786e9cb14cfb6d45c936a | 4,667 | //! Processing of received requests
use crate::net::request::Request;
use super::resolver::DoHResolver;
use log::*;
use threadpool::{Builder as ThreadPoolBuilder, ThreadPool};
use num_cpus;
use crossbeam_channel::{Receiver as XBeamReceiver, RecvTimeoutError as XBeamRecvTimeoutError};
use srvzio;
use std::{thread, ti... | 30.907285 | 117 | 0.63574 |
5699ef376929a440bb26524b26635ae1d4684fb2 | 1,219 | //! The RFC 2389 Feature (`FEAT`) command
use crate::server::commands::Cmd;
use crate::server::error::FTPError;
use crate::server::reply::{Reply, ReplyCode};
use crate::server::CommandArgs;
use crate::storage;
pub struct Feat;
impl<S, U> Cmd<S, U> for Feat
where
U: Send + Sync + 'static,
S: 'static + storage... | 30.475 | 77 | 0.602953 |
225d4c2b4d68e506425c7479baf0b62dcf59c2b9 | 137 | FieldFoo(<u32 as ::configure_me::parse_arg::ParseArg>::Error),
FieldBar(<String as ::configure_me::parse_arg::ParseArg>::Error),
| 45.666667 | 69 | 0.708029 |
bbb2cd11024177404c258353ef57360b49728f7d | 873 | //! Test saving "default" and specific quality jpeg.
#![cfg(all(feature = "jpeg", feature = "tiff"))]
extern crate image;
use image::{ImageOutputFormat, ImageFormat};
use std::io::Cursor;
#[test]
fn jqeg_qualitys() {
let img = image::open("tests/images/tiff/testsuite/mandrill.tiff").unwrap();
let mut default... | 29.1 | 80 | 0.618557 |
efe43d008b3f6d2db8b5ee5812552296c7dc3c6a | 100,521 | mod client;
mod output;
use {
crate::{
client::*,
output::{CliStakePool, CliStakePoolDetails, CliStakePoolStakeAccountInfo, CliStakePools},
},
clap::{
crate_description, crate_name, crate_version, value_t, value_t_or_exit, App, AppSettings,
Arg, ArgGroup, ArgMatches, SubComm... | 37.66242 | 167 | 0.565504 |
084ee1a966348052b2df2c4624365c3ce4fa0b1a | 4,374 | use crate::error::Result;
use crate::expr::{Expression, Variable};
use std::fmt;
#[derive(Clone, Debug, Hash, Eq, PartialEq)]
pub enum Node {
/// A simple comment.
Comment(String),
/// Bind the expression to a variable.
Let { var: Variable, expr: Expression },
/// Assert that the condition is true.... | 32.4 | 97 | 0.537723 |
acc109b9ed6a614c375389030093bb133487effb | 1,756 |
pub struct IconRvHookup {
props: crate::Props,
}
impl yew::Component for IconRvHookup {
type Properties = crate::Props;
type Message = ();
fn create(props: Self::Properties, _: yew::prelude::ComponentLink<Self>) -> Self
{
Self { props }
}
fn update(&mut self, _: Self::Message) -> yew:... | 38.173913 | 565 | 0.585991 |
de301b1fc499d9aa43048174657fc88cbdacc67d | 8,538 | use super::*;
use crate::symbol::Symbol;
use crate::source_map::{SourceMap, FilePathMapping};
use crate::parse::token;
use crate::with_default_globals;
use errors::{Handler, emitter::EmitterWriter};
use std::io;
use std::path::PathBuf;
use syntax_pos::{BytePos, Span};
fn mk_sess(sm: Lrc<SourceMap>) -> ParseSess {
... | 31.622222 | 94 | 0.548021 |
9cd3a43b976f5f277948b06f55a5277dcae2815f | 1,825 | use libzeropool::{
fawkes_crypto::{borsh, BorshDeserialize, BorshSerialize},
native::{account::Account as NativeAccount, note::Note as NativeNote},
};
use libzeropool_rs::client::state::{State, Transaction as InnerTransaction};
use serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::*;
use crate::datab... | 29.918033 | 85 | 0.661918 |
e5fbf33b82cc6d539870ca18c4015a5e9ed2567f | 2,652 | #![allow(clippy::module_inception)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::ptr_arg)]
#![allow(clippy::large_enum_variant)]
#![doc = "generated by AutoRust 0.1.0"]
#[cfg(feature = "package-2018-09")]
pub mod package_2018_09;
#[cfg(all(feature = "package-2018-09", not(feature = "no-default-version")))]
pu... | 38.434783 | 130 | 0.691176 |
116f2230fa07c4837c09b285423f8c2f9b50f2f1 | 3,811 | #[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::CPUIRQSEL36 {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &... | 25.238411 | 81 | 0.511939 |
9cc22d9d109b64b5a9e7f8ae63bdd728f6e2d7ae | 392 | mod keywords;
mod writer;
use std::fmt::Error as FmtError;
use thiserror::Error;
pub use writer::Writer;
#[derive(Error, Debug)]
pub enum Error {
#[error(transparent)]
IoError(#[from] FmtError),
}
pub fn write_string(module: &crate::Module) -> Result<String, Error> {
let mut w = Writer::new(String::new(... | 18.666667 | 70 | 0.647959 |
cc6e3e5483be93a1d2b533f079aacb62256f9335 | 3,311 | use yew::prelude::*;
use crate::components::{Icon, Link};
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ButtonSize {
Large,
Medium,
Small,
}
impl Default for ButtonSize {
fn default() -> Self {
Self::Medium
}
}
#[derive(Debug, Clone, PartialEq, Properties)]
pub struct ButtonProps {
... | 24.894737 | 71 | 0.520991 |
621ae44646daff5dc7bd4a342bdeb0a5315cb024 | 865 | #[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Interrupt Enable 1"]
pub sfrie1: crate::Reg<sfrie1::SFRIE1_SPEC>,
#[doc = "0x02 - Interrupt Flag 1"]
pub sfrifg1: crate::Reg<sfrifg1::SFRIFG1_SPEC>,
#[doc = "0x04 - RESET Pin Control Register"]
pub sfrrpcr: crate::R... | 37.608696 | 70 | 0.690173 |
ff7675bc34c3868b0f4e14ec1130024935ad6835 | 738 | extern crate quire;
#[macro_use] extern crate serde_derive;
use quire::{parse_config, Options};
use quire::validate::{Structure, Scalar};
#[derive(Deserialize)]
#[allow(dead_code)]
struct Config {
item1: String,
item2: Option<String>,
}
fn validator() -> Structure<'static> {
Structure::new()
.member("... | 23.0625 | 57 | 0.607046 |
f93602dbe1aa7a1fb0b49457f5a8fa0e65d4c9c1 | 11,191 | //! Parameter optimization
//!
//! The fit of the parameters is done by gradient descent (using the ADAM algorithm) on the gradient of the marginal log-likelihood
//! (which let us use all the data without bothering with cross-validation)
//!
//! If the kernel can be rescaled, we use ideas from [Fast methods for traini... | 42.877395 | 171 | 0.574301 |
fc51191451740c9fdf2832c7aa72530412073200 | 663 | // 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 ... | 31.571429 | 68 | 0.704374 |
1e923d009b9dc1fd53448ea726769c30d5cbb607 | 2,687 | use std::cell::RefCell;
use std::iter::Iterator;
use std::sync::mpsc::{channel, Receiver, Sender};
use compression::Compression;
use error;
use frame::events::{
SchemaChange as FrameSchemaChange, ServerEvent as FrameServerEvent,
SimpleServerEvent as FrameSimpleServerEvent,
};
use frame::parser::parse_frame;
us... | 30.885057 | 93 | 0.649423 |
017b9377adaa9b09729b176c84b6fcc2446194d0 | 962 | use std;
use trackable::error::{ErrorKind as TrackableErrorKind, ErrorKindExt, TrackableError};
use entity::object::ObjectVersion;
/// クレート固有の`Error`型。
#[derive(Debug, Clone, TrackableError, Serialize, Deserialize)]
pub struct Error(TrackableError<ErrorKind>);
impl From<std::io::Error> for Error {
fn from(f: std:... | 26 | 86 | 0.674636 |
01fc1de4a5e061b0073b0b57702b2ba4fe281d35 | 6,688 | //! Holds definition to wrap and alter game.
use error::MaeveError;
use load::save;
use protos::master::Conditional;
use protos::master::Context;
use protos::master::Game;
use protos::master::State;
use protos::master::branch::Branch;
use protos::master::context::Content;
use protos::master::context::Scope;
use protos... | 33.108911 | 80 | 0.533343 |
ab459a96389b22614bb12f1bbaa547331e76cbdc | 1,213 | extern crate serde_json;
use std::net::TcpListener;
use std::io::{BufReader, BufRead};
use std::thread;
use chat::ChatMessage;
use chat::ReplyMessage;
use std::sync::mpsc::Sender;
pub fn listen(sender: Sender<ReplyMessage>) {
let listener = TcpListener::bind("127.0.0.1:2933").expect("Failed to bind port");
for... | 35.676471 | 107 | 0.436109 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.