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 |
|---|---|---|---|---|---|
14c4f99cb7bec53461f22dfb8ff482e790be9b36 | 1,949 | use crate::errors::ApiError;
use crate::models::{ConstructionSubmitRequest, ConstructionSubmitResponse};
use crate::request::transaction_operation_results::TransactionOperationResults;
use crate::request::transaction_results::TransactionResults;
use crate::request_handler::{verify_network_id, RosettaRequestHandler};
us... | 39.77551 | 86 | 0.67727 |
565182dd323f6e7a10034167526ff8a0ab4768e3 | 29,752 | // 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 ... | 31.252101 | 131 | 0.586616 |
11f7fc9deb8e185a28383b9c2cebc53819507cf2 | 3,260 | use ring::digest::*;
use std::fs::File;
use std::io::{self, Read, Write};
use std::path::Path;
use std::sync::atomic::{AtomicUsize, Ordering};
#[cfg(target_pointer_width = "64")]
//pub type AtomicU64 = AtomicUsize;
pub struct AtomicU64 {
inner: AtomicUsize,
}
#[cfg(target_pointer_width = "64")]
impl AtomicU64 {
... | 26.721311 | 103 | 0.517485 |
e2c282d13bb37c7cf904abc588d1108d9ccd2f4f | 4,136 | use async_std::io::{BufRead as AsyncBufRead, Read as AsyncRead};
use async_std::prelude::*;
use async_std::task::{ready, Context, Poll};
use std::io;
use std::pin::Pin;
use std::time::Duration;
pin_project_lite::pin_project! {
/// An SSE protocol encoder.
#[derive(Debug)]
pub struct Encoder {
buf:... | 29.542857 | 94 | 0.502901 |
e284b354e3037f17f0e0aa1c2df20e553892aa08 | 13,988 | //! Statement and declaration parsing.
//!
//! More information:
//! - [MDN documentation][mdn]
//! - [ECMAScript specification][spec]
//!
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements
//! [spec]: https://tc39.es/ecma262/#sec-ecmascript-language-statements-and-declarations
m... | 32.009153 | 108 | 0.558908 |
ffd4b950a1cf4116f85fd772fbf557d4c3f4f782 | 1,542 | use crate::{
data::{DEBUG, DISABLE_SSL_VERIFY},
ConversationInfo,
};
use curl::{easy::Easy, Error};
use std::env;
use std::io::Read;
use std::time::SystemTime;
fn format_and_transfer(curl: &mut Easy, mut msg: &[u8], result: &mut Vec<u8>) -> Result<(), Error> {
let now = SystemTime::now();
match env::v... | 25.7 | 100 | 0.518807 |
90656330795aba4d289b19d9acc35b9f188043ca | 49,517 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[derive(Debug)]
pub(crate) struct Handle<
C = aws_smithy_client::erase::DynConnector,
M = aws_hyper::AwsMiddleware,
R = aws_smithy_client::retry::Standard,
> {
client: aws_smithy_client::Client<C, M, R>,
conf: crate::C... | 45.345238 | 297 | 0.60456 |
fec4066a42ee93e70e5e4ea81225ca5329c0d486 | 1,406 | struct Solution;
impl Solution {
fn check_valid(matrix: Vec<Vec<i32>>) -> bool {
let n = matrix.len();
for i in 0..n {
let mut col = vec![false; n];
for j in 0..n {
let x = matrix[i][j];
if (1..=n as i32).contains(&x) {
let... | 26.037037 | 63 | 0.347084 |
9c6089f0fc79849e0f8f787488e5ed3bbb94837e | 24,054 | //! The reactor notifying [`Async`][`crate::Async`] and [`Timer`][`crate::Timer`].
//!
//! There is a single global reactor that contains all registered I/O handles and timers. The
//! reactor is polled by the executor, i.e. the [`run()`][`crate::run()`] function.
#[cfg(not(any(
target_os = "linux", // epoll
... | 32.950685 | 100 | 0.513303 |
de1299dcfda130fdc57f4d298470b68337f7e74d | 57,607 | use std::fmt::{self, Write};
use std::mem;
use bytes::{BytesMut};
use http::header::{self, Entry, HeaderName, HeaderValue};
use http::{HeaderMap, Method, StatusCode, Version};
use httparse;
use error::Parse;
use headers;
use proto::{BodyLength, DecodedLength, MessageHead, RequestLine, RequestHead};
use proto::h1::{En... | 36.162586 | 128 | 0.477702 |
230c1258185867f553e7722e29e8198234e5f2e6 | 1,749 | //! CLI options and logging setup
use lazy_static::lazy_static;
use log::{info, trace, warn};
use serde_derive::Deserialize;
use std::env::{set_var, var};
use structopt::StructOpt;
/// deciduously-com backend
#[derive(Debug, Deserialize, StructOpt)]
#[structopt(name = "rollenspielsahce-svc")]
pub struct Opt {
/// ... | 27.761905 | 94 | 0.578045 |
6785ea55fca7f305d7c7209acc8ecb8b1ae17efa | 73 | mod Trigonometry;
mod RegressionAnalysis;
mod Conversions;
mod Bases;
| 9.125 | 23 | 0.794521 |
720be1b14c7411ebb97b6a323dceb508b5997215 | 5,999 | // Generated from definition io.k8s.api.apps.v1beta2.ReplicaSetSpec
/// ReplicaSetSpec is the specification of a ReplicaSet.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ReplicaSetSpec {
/// Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for... | 47.992 | 307 | 0.57743 |
d7818046f29f5a5b0c2dd0ec09f5e1d4cb6990a9 | 226 | pub fn square_of_sum(n: u32) -> u32 {
let x = n * (n+1) / 2;
x * x
}
pub fn sum_of_squares(n: u32) -> u32 {
n * (n+1) * (2*n+1) / 6
}
pub fn difference(n: u32) -> u32 {
square_of_sum(n) - sum_of_squares(n)
}
| 17.384615 | 40 | 0.526549 |
284f4b0d13d79e1cf03c1b84dd77cf8cda366c6e | 95,041 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(clippy::unnecessary_wraps)]
pub fn parse_add_profile_permission_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::output::AddProfilePermissionOutput,
crate::error::AddProfilePermissionErro... | 42.966094 | 203 | 0.523027 |
28f0b2c85decc89f6d40052fd99c93624e827ce4 | 263 | //! Zcash global and per-network constants.
pub mod mainnet;
pub mod testnet;
pub mod regtest;
pub const SPROUT_CONSENSUS_BRANCH_ID: u32 = 0;
pub const OVERWINTER_CONSENSUS_BRANCH_ID: u32 = 0x5ba8_1b19;
pub const SAPLING_CONSENSUS_BRANCH_ID: u32 = 0x76b8_09bb;
| 26.3 | 60 | 0.802281 |
d7885ee359f940d8bd17226a2d071465c5912f46 | 1,769 | use crate::import::structs::PrimitiveType;
use std::{
borrow::Borrow,
convert::AsRef,
fmt,
ops::Index,
};
use ffi::aiFace;
define_type_and_iterator! {
/// Face type (not yet implemented)
struct Face(&aiFace)
/// Face iterator type.
struct FaceIter
}
impl Face {
/// The "kind" of t... | 24.569444 | 103 | 0.574336 |
bf310183c976f85e4171df26d7b8228b6131ff5b | 3,696 | //! Contains [Chain] and implementations
use crate::{error::Result, Block};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// Representation of an Onft blockchain
///
/// # Using
///
/// You can, in high level terms, do the following directly to a blockchain:
///
/// - Create an initial blockchain: [... | 26.782609 | 80 | 0.535173 |
e62631414d5d9dfbfe5778969d21d1b37f56b322 | 102 | pub const HSIZE_CHARS : u16 = 44;
pub const VSIZE_CHARS : u16 = 37;
pub mod display;
pub mod render;
| 17 | 33 | 0.715686 |
e2da809f2d4579d546eeb16c4e9ac64033b6503c | 4,922 | use std::io::Read;
use wai::*;
use wast::WastDirective;
macro_rules! wasm_test {
($func:ident, $path:expr) => {
#[test]
fn $func() -> anyhow::Result<()> {
assert_wasm($path)
}
};
}
wasm_test!(add, "./examples/wat/add.wat");
wasm_test!(fib, "./examples/wat/fib.wat");
wasm_t... | 35.157143 | 97 | 0.536977 |
910aebd87e1ffe065f4f0d1e97366a8f561cca4f | 2,587 | use super::*;
use sha2::{ Digest };
use rsa::{ PublicKey };
#[wasm_bindgen]
#[derive(Debug, Clone)]
pub struct RSAPublicKeyPair {
n: String,
e: String,
public_instance: Option<RSAPublicKey>
}
#[wasm_bindgen]
impl RSAPublicKeyPair {
#[wasm_bindgen(constructor)]
pub fn new() -> Self {
RSAPub... | 30.081395 | 94 | 0.535369 |
e928d91054b08b6544de799cc03fa0e15f818172 | 4,839 | use super::*;
use std::fmt;
use colored::*;
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
pub struct AttackRequestBuilder {
path:String,
parameters: Vec<RequestParameter>,
auth: Authorization,
method: Method,
headers: Vec<MHeader>,
}
impl AttackRequestBuilder {
pub fn ... | 35.321168 | 266 | 0.492457 |
bf5769706501bc53e6735950780c40f733cf2d8f | 5,367 | use std::ffi::OsStr;
use std::fs::{self, Permissions};
use std::os::unix::fs::PermissionsExt;
use std::path::{Path, PathBuf};
use std::process;
use anyhow::{anyhow, Result};
use console::Style;
use derive_getters::Getters;
use serde::Serialize;
use tempdir::TempDir;
use crate::common::{EnvMap, DEPS_SCRIPT};
#[derive... | 29.327869 | 96 | 0.535122 |
ff89b70d578f2a4231c8c4672bdc5fa4064a0d00 | 6,564 | //! RenderPass handling.
use crate::format::Format;
use crate::image;
use crate::pso::PipelineStage;
use std::ops::Range;
use crate::Backend;
/// Specifies the operation which will be applied at the beginning of a subpass.
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(Seriali... | 35.673913 | 100 | 0.686015 |
7246d0c59ba1ad20e192125bc638093b38e315d4 | 8,028 | use crate::ast::{Enum, Field, Input, Struct, Variant};
use crate::attr::Attrs;
use quote::ToTokens;
use std::collections::BTreeSet as Set;
use syn::{Error, GenericArgument, Member, PathArguments, Result, Type};
impl Input<'_> {
pub(crate) fn validate(&self) -> Result<()> {
match self {
Input::S... | 34.307692 | 151 | 0.514574 |
abce38a7a98cb4262195780d1e022027c2ed5cc6 | 4,042 | use nu_test_support::fs::AbsolutePath;
use nu_test_support::fs::Stub::FileWithContent;
use nu_test_support::playground::{says, Playground};
use hamcrest2::assert_that;
use hamcrest2::prelude::*;
#[test]
fn clearing_config_clears_config() {
Playground::setup("environment_syncing_test_1", |dirs, nu| {
let f... | 29.079137 | 90 | 0.556655 |
0af114ef48d8715a82c179d872ccc3158e5fee14 | 2,048 | use crate::model::{id::Id, user::User};
use chrono::{DateTime, Utc};
use mime::Mime;
use serde::{Deserialize, Serialize};
use url::Url;
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct DriveFileProperties {
#[cfg(feature = "12-75-0")]
#[cfg_attr(docsrs, doc(cfg(fea... | 29.681159 | 63 | 0.636719 |
3ad01194efc141fae0c3341c4b9d60e604ffb2fb | 3,691 | use utils::{files, parse_field_unwrap};
fn main() {
let filename = "src/input.txt";
let lines = files::read_in_lines(filename);
let parsed: Vec<(Vec<String>, Vec<String>)> = lines.iter()
.map( |s| {
let (l, r) = parse_field_unwrap!(&s => String, " | " | String, "");
let v1 =... | 42.425287 | 85 | 0.530209 |
d952b8632fb1572f9ddb0fe91f6c3d4006f04de4 | 1,028 | // Copyright 2020 The Vega 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 in ... | 34.266667 | 75 | 0.722763 |
9b9734bc78e6554cc48544c4ced6f1c10ee603ec | 13,766 | use std::{
borrow::Cow,
fmt::{self, Formatter, Display},
str::FromStr,
};
use indexmap::IndexMap;
use regex::Regex;
use once_cell::sync::Lazy;
use serde::{
de::{Error as _, Deserialize, Deserializer},
ser::{Serialize, Serializer},
};
use codespan::Span;
use crate::{
ast::{ArgumentValue, Literal}... | 26.626692 | 80 | 0.499056 |
d9d0df2f408656cb72eb2cf9da021e51dda34997 | 693 | // Copyright (C) 2018-2019 Boyu Yang
//
// 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 distributed
// except accord... | 25.666667 | 74 | 0.597403 |
03ce6d865c4095f03c0fe65b34526e9eb28816bc | 92,319 | #![doc = "generated by AutoRust"]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[doc = "Profile for enabling a user to access a managed cluster."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct AccessProfile {
#[doc = "Base64-encoded ... | 42.562932 | 583 | 0.683705 |
e65bcb8b593fed9ad9e8e7e0a0b313aa9cc966a9 | 39,945 | // Generated from definition io.k8s.api.autoscaling.v1.Scale
/// Scale represents a scaling request for a resource.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Scale {
/// Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata.
pub metadata: ... | 43.277356 | 213 | 0.598223 |
08a58bdffc0db618bbb99a201b22f435efc4f294 | 85 | // pub mod hosting {
// pub fn add_to_waitlist() {}
// }
pub mod hosting;
| 14.166667 | 35 | 0.541176 |
f7d91f01066ec842c0221f28d7e0b028f3ed6174 | 14,626 | // < begin copyright >
// Copyright Ryan Marcus 2020
//
// See root directory of this project for license terms.
//
// < end copyright >
#![allow(clippy::needless_return)]
#[macro_use]
mod load;
use load::{load_data, DataType};
use rmi_lib::{train, train_bounded};
use rmi_lib::KeyType;
use rmi_lib::optimizer... | 38.795756 | 107 | 0.51511 |
0ac9266c0d95669826f03f77962e581866c3ffa1 | 1,070 | /*
* Ory APIs
*
* Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers.
*
* The version of the OpenAPI document: v0.0.1-alpha.187
* Contact: support@ory.sh
* Generated by: https://openapi-ge... | 35.666667 | 248 | 0.705607 |
019dc9c80de5a0cd2d0addd0a131d0fe6cd12b6e | 88 | pub use client::*;
pub use daemon::*;
mod discord;
mod daemon;
mod client;
mod lastfm;
| 11 | 18 | 0.693182 |
ff91f93def3b866621fb8d154affea16ce875e80 | 7,894 | use std::collections::HashMap;
use std::env;
use std::fmt::Write;
use std::fs;
use std::path::PathBuf;
fn main() {
let chip_name = match env::vars()
.map(|(a, _)| a)
.filter(|x| x.starts_with("CARGO_FEATURE_STM32"))
.get_one()
{
Ok(x) => x,
Err(GetOneError::None) => pani... | 31.07874 | 111 | 0.529389 |
67fc758a97327bf8c860fe6a8d8028ce9e793d06 | 373 | use naia_derive::Replicate;
use naia_shared::Property;
#[derive(Replicate)]
#[protocol_path = "crate::protocol::Protocol"]
pub struct Auth {
pub username: Property<String>,
pub password: Property<String>,
}
impl Auth {
pub fn new(username: &str, password: &str) -> Self {
return Auth::new_complete(... | 23.3125 | 78 | 0.683646 |
3345f3452e836164074c900cb1c68e1f4c409c72 | 1,316 | use std::io;
use std::io::prelude::*;
extern crate regex;
use regex::Regex;
struct CodeGenerator { code: u64, }
impl Iterator for CodeGenerator {
type Item = u64;
fn next(&mut self) -> Option<Self::Item> {
self.code *= 252533;
self.code %= 33554393;
Some(self.code)
}
}
fn parse(in... | 25.803922 | 69 | 0.512918 |
db68f84ce21e09aaeff094f163e21243348a6c6b | 23,455 | //! Contains the `Error` and `Result` types that `mongodb` uses.
use std::{
collections::{HashMap, HashSet},
fmt::{self, Debug},
sync::Arc,
};
use bson::Bson;
use serde::Deserialize;
use thiserror::Error;
use crate::{bson::Document, options::ServerAddress};
const RECOVERING_CODES: [i32; 5] = [11600, 116... | 34.341142 | 112 | 0.618333 |
1ecd693219b891e364335a251953b76d6aa8187e | 1,617 | use mysql;
use crate::material::MySQLConnection;
pub trait Select {
fn select<T>(&self, query_str: &str, process_row: &dyn Fn(mysql::Row) -> T) -> Vec<T>;
fn select_wparams<T>(&self, query_str: &str, process_row: &dyn Fn(mysql::Row) -> T, params: std::vec::Vec<(std::string::String, mysql::Value)>) -> Vec<T>;
fn... | 38.5 | 165 | 0.615337 |
904624f9ab0161d1c67a9614a826bf5832fdb3ec | 11,451 | //! Renderer for function calls.
use hir::{AsAssocItem, HasSource, HirDisplay};
use ide_db::SymbolKind;
use itertools::Itertools;
use syntax::ast;
use crate::{
item::{CompletionItem, CompletionItemKind, CompletionKind, CompletionRelevance, ImportEdit},
render::{
builder_ext::Params, compute_exact_name... | 24.785714 | 98 | 0.527378 |
699479104eead928393994804e03d222e9f9345d | 346 | // Copyright (c) The Dijets Core Contributors
// SPDX-License-Identifier: Apache-2.0
pub fn read_env_var(v: &str) -> String {
std::env::var(v).unwrap_or_else(|_| String::new())
}
pub fn read_bool_env_var(v: &str) -> bool {
let val = read_env_var(v).to_lowercase();
val.parse::<bool>() == Ok(true) || val.pa... | 28.833333 | 68 | 0.635838 |
ef3a7c9821b972aea7b0c07669556fc3b13b1bf8 | 7,195 | use std::fs;
use std::path::Path;
use std::sync::Arc;
use fuzzy_matcher::skim::SkimMatcherV2;
use fuzzy_matcher::FuzzyMatcher;
use ini::Ini;
use serde::{Deserialize, Serialize};
use walkdir::WalkDir;
use druid::{
AppDelegate, Command, DelegateCtx, Env, Event, HotKey, KeyCode, SysMods, Target, WindowId,
};
use cr... | 32.853881 | 100 | 0.484781 |
112f97cb0138360a7d6a7bc555a170f9b144c3e8 | 1,596 | /*
* Copyright 2020 Fluence Labs Limited
*
* 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 a... | 33.25 | 86 | 0.675439 |
39f8cf10eba97e247e646e8fa27d5744a890f038 | 29,843 | // Copyright 2020. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... | 41.049519 | 184 | 0.523004 |
386635af4ee591f229ba21fccd6d3f4fc2484bd3 | 2,303 | #[cfg(test)]
#[cfg(feature = "mosquitto-available")]
mod tests {
use std::process::{Command, Stdio};
use std::{thread, time};
use assert_cmd::prelude::*;
use predicates::prelude::*;
#[test]
/// Tests that only one instance of `tedge_agent` is running.
/// This is done by spawning/running t... | 37.754098 | 100 | 0.534086 |
91de9f87dfbb3949a7d6195ab6e43d0aeca7fde9 | 899 | extern crate timely;
use timely::dataflow::operators::*;
fn main() {
let iterations = std::env::args().nth(1).unwrap().parse::<u64>().unwrap();
let elements = std::env::args().nth(2).unwrap().parse::<u64>().unwrap();
// initializes and runs a timely dataflow
timely::execute_from_args(std::env::args(... | 33.296296 | 78 | 0.50723 |
1c197abbf7d8fc50238bb12d4fa57182d812988a | 24,564 | //! Types and functions related to graphical outputs
//!
//! This modules provides two main elements. The first is the
//! [`OutputHandler`](struct.OutputHandler.html) type, which is a
//! [`MultiGlobalHandler`](../environment/trait.MultiGlobalHandler.html) for
//! use with the [`init_environment!`](../macro.init_envir... | 36.717489 | 112 | 0.607596 |
26b1f9f5b40d46dea7d6fc02b9f80f61d934c2d9 | 2,294 | #[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::DEV_ADDR {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w ... | 23.649485 | 59 | 0.501744 |
ed890ff30806d9f3cc5cc28df1304d48d6017a25 | 5,248 | //! This code is needed in order to support a channel that can receive with a
//! timeout.
use Builder;
use mpmc::Queue;
use wheel::{Token, Wheel};
use futures::task::Task;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::time::{Duration, Instant};
use std::thread::{self, Thread};
#[derive(... | 28.994475 | 93 | 0.536204 |
7114aa3e434d3e760ea914e72f704cd7b7993ac0 | 1,679 |
use rustc_serialize::json;
use client::Client;
use std::io::Read;
pub struct UserService {
pub client: Client,
}
#[derive(RustcDecodable, RustcEncodable, Debug)]
pub struct User {
pub login: String,
pub id: i32,
pub avatar_url: String,
pub gravatar_id: String,
pub url: String,
pub html_ur... | 23.985714 | 77 | 0.624777 |
142eba1b72332f83486f9b638c0b368b95b6d8e5 | 92,818 | //! The Rust abstract syntax tree module.
//!
//! This module contains common structures forming the language AST.
//! Two main entities in the module are [`Item`] (which represents an AST element with
//! additional metadata), and [`ItemKind`] (which represents a concrete type and contains
//! information specific to ... | 31.011694 | 101 | 0.579209 |
abecbf538b8047d2142b77f81691034269065a42 | 454 | use core::ops::Range;
use easy_ext::ext;
use crate::inherent::Sealed;
#[ext]
pub impl<T> [T]
where Self: Sealed<[T]>
{
fn as_ptr_range(&self) -> Range<*const T> {
let start = self.as_ptr();
let end = unsafe { start.add(self.len()) };
start..end
}
fn as_mut_ptr_range(&mut self) -> ... | 20.636364 | 53 | 0.555066 |
c1f1a3311b0d8b40dd6072cd80c3c179df6136e3 | 2,164 | use core::ffi::c_void;
use core::ptr::null_mut;
use crate::basic_types::c_int;
use crate::basic_types::c_char;
use crate::basic_types::c_uchar;
use crate::basic_types::size_t;
#[no_mangle]
pub extern "C" fn memchr(src: *const c_void, c: c_int, n: size_t) -> *mut c_void {
let src1: *const c_char = src as *const c_cha... | 20.807692 | 102 | 0.597043 |
5deae94fe0c8e785086b005f72b626051e1e9d43 | 2,186 | use std::error::Error;
use std::fmt;
use rustc_middle::mir::AssertKind;
use rustc_span::{Span, Symbol};
use super::InterpCx;
use crate::interpret::{ConstEvalErr, InterpErrorInfo, Machine};
/// The CTFE machine has some custom error kinds.
#[derive(Clone, Debug)]
pub enum ConstEvalErrKind {
NeedsRfc(String),
... | 35.258065 | 99 | 0.635407 |
fbe4ecdfe16d07e8508adc81ab352834b06cff86 | 546 | use super::region::*;
use super::region_id::*;
use flo_curves::bezier::path::*;
use std::time::{Duration};
///
/// Collects a list of animation regions into a set of IDs and paths
///
pub fn collect_regions<'a, Region: 'a+AnimationRegion, RegionIter: IntoIterator<Item=&'a Region>>(regions: RegionIter, time: Duration... | 27.3 | 178 | 0.630037 |
d752b9e7e6f2f9fffb75b72dac116ace3c056e1c | 31 | pub mod pty;
pub mod sessions;
| 10.333333 | 17 | 0.741935 |
390ca53738bfaa26f650fbf3a4d129a55154557b | 4,185 | use crate::serialization::op_code::OpCode;
use crate::serialization::sigma_byte_reader::SigmaByteRead;
use crate::serialization::sigma_byte_writer::SigmaByteWrite;
use crate::serialization::SigmaParsingError;
use crate::serialization::SigmaSerializable;
use crate::serialization::SigmaSerializeResult;
// use crate::type... | 34.303279 | 137 | 0.564158 |
09ef1b4e5ebc326a2659a5a141fae3844a605a2e | 138,312 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
use std::fmt::Write;
/// See [`CancelJobRunInput`](crate::input::CancelJobRunInput)
pub mod cancel_job_run_input {
/// A builder for [`CancelJobRunInput`](crate::input::CancelJobRunInput)
#[non_exhaustive]
#[derive(std::default... | 41.685353 | 134 | 0.58731 |
d6b264db2ac98d87402e1cc3ce670481a0870ee6 | 25,319 | #[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::EIR {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W... | 25.093162 | 59 | 0.490304 |
e4bc2533ac68c8e485748fd375845c04404e4031 | 2,118 | use std::error::Error;
use std::fs;
pub struct Config {
pub query: String,
pub filename: String,
pub case_sensitive: String,
}
impl Config {
pub fn new(args: &[String]) -> Result<Config, &'static str> {
if args.len() < 3 {
return Err("not enough arguments");
}
let q... | 21.18 | 84 | 0.530217 |
760fc96c84146505eea4014fb18fff6c09f5d5b5 | 8,527 | use core::fmt::Debug;
use std::collections::HashMap;
type Universe = HashMap<Coordinate, bool>;
trait UniverseFuncs {
fn is_active(&self, coordinate: &Coordinate) -> bool;
fn dimension_count(&self) -> usize;
}
impl UniverseFuncs for Universe {
fn is_active(&self, coordinate: &Coordinate) -> bool {
... | 29.302405 | 99 | 0.523044 |
4a9870278b934c57b9af8feb6c5701fe3f815019 | 52,202 | #[doc = "Register `CFG1` reader"]
pub struct R(crate::R<CFG1_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<CFG1_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<CFG1_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<CFG1_SP... | 47.542805 | 804 | 0.654362 |
335bdb2ba3610106f92ebf2724466f9b7323a471 | 8,305 | use nix::mount::{mount, MsFlags};
use nix::sched::{unshare, CloneFlags};
use nix::sys::signal::{kill, Signal};
use nix::sys::wait::{waitpid, WaitPidFlag, WaitStatus};
use nix::unistd;
use nix::unistd::{fork, ForkResult};
use std::env;
use std::fs;
use std::io;
use std::io::prelude::*;
use std::os::unix::fs::symlink;
us... | 32.956349 | 96 | 0.556773 |
f5eb92c1bb5aa0522b736321736d31c22551ec06 | 176,296 | // ignore-tidy-filelength
//! Rustdoc's HTML rendering module.
//!
//! This modules contains the bulk of the logic necessary for rendering a
//! rustdoc `clean::Crate` instance to a set of static HTML pages. This
//! rendering process is largely driven by the `format!` syntax extension to
//! perform all I/O into file... | 35.83252 | 121 | 0.506222 |
c151cb17cd49653c026f6950fbed00c0352be2a6 | 566 | //! Utility functions shared among various unit tests.
use crate::*;
use std::env;
use std::path;
mod audio;
mod conf;
mod filesystem;
mod graphics;
mod mesh;
mod text;
/// Make a basic `Context` with sane defaults.
pub fn make_context() -> (Context, event::EventsLoop) {
let mut cb = ContextBuilder::new("ggez_un... | 23.583333 | 64 | 0.660777 |
5044130c6866add94f22a836eb05ddae87cc3cd4 | 295 | /// protobuf crate version
pub const VERSION: &'static str = "2.25.2";
/// This symbol is used by codegen
#[doc(hidden)]
pub const VERSION_IDENT: &'static str = "VERSION_2_25_2";
/// This symbol can be referenced to assert that proper version of crate is used
pub const VERSION_2_25_2: () = ();
| 36.875 | 80 | 0.715254 |
bbe86fb0ba6aaf84a1ce4a1e7af183e43e22b956 | 14,311 | // 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.
extern crate lazy_static;
use std::{
convert::{Into, TryFrom, TryInto},
num::{FpCategory, Wrapping},
};
mod float {
use std... | 31.873051 | 95 | 0.520579 |
62b1254287724aedacab6f5a7642124dbfd2bcdb | 15,349 | use crate::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use crate::hir;
use rustc_ast as ast;
use rustc_ast::NodeId;
use rustc_macros::HashStable_Generic;
use rustc_span::hygiene::MacroKind;
use std::array::IntoIter;
use std::fmt::Debug;
/// Encodes if a `DefKind::Ctor` is the constructor of an enum variant or a s... | 31.582305 | 100 | 0.558147 |
ebd4c1b9d4c2d76c9dda0bebd849b11ea844358d | 907 | #[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
impl super::DIEP2_TXFSTS {
#[doc = r" Reads the contents of the register"]
#[inline]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
}
#[doc = r" Value of the field"]
pub struct SPCAVAILR {... | 21.595238 | 56 | 0.509372 |
01f730f47781ce5a6dd2ff40301cc86cccebd19b | 3,251 | // Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::nymd::cosmwasm_client::types::ContractCodeId;
use cosmrs::tendermint::block;
use cosmrs::{bip32, rpc, tx, AccountId};
use std::io;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum NymdError {
#[er... | 32.188119 | 131 | 0.677638 |
87a056acef215d6fdfa526aaf1376c0676a520f3 | 892 | use rustc_serialize::json;
use std::ops::Deref;
use rustc_serialize::{Encoder, Encodable};
pub static DELETE_KEY : &'static str = "$$delete";
//pub static UPDATE_KEY : &'static str = "$$delete";
#[derive(Clone, Debug)]
pub enum Entry{
Insert(json::Json),
Delete(json::Json),
Update(json::Json)
}
//impl De... | 24.777778 | 71 | 0.513453 |
ef3114ff394eb75baa9e5bddb70fed1a85ec6c01 | 960 | // 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 ... | 25.945946 | 68 | 0.59375 |
91df928002a1b71b487a76808722bf6e22a4aa9c | 40,905 | // Copyright 2016 TiKV Project Authors. Licensed under Apache-2.0.
use std::fmt::{self, Display, Formatter};
use std::io;
use std::sync::mpsc::{self, Sender};
use std::sync::Arc;
use std::thread::{Builder, JoinHandle};
use std::time::{Duration, Instant};
use futures::Future;
use tokio_core::reactor::Handle;
use tokio... | 35.787402 | 124 | 0.510402 |
48e2da083f6e0d7997a2e806101a57efe5d01bfc | 13,269 | // Copyright 2020, The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... | 38.912023 | 119 | 0.664029 |
f9952c0dc540d9a8acbec97facdcdbf4dbcdfe4b | 4,027 | extern crate polyhorn_yoga as yoga;
use yoga::{
Align, Direction, FlexDirection, Justify, Node, Overflow, PositionType, StyleUnit, Wrap,
};
#[test]
fn test_assert_default_values() {
let root = Node::new();
assert_eq!(root.get_child_count(), 0);
assert!(root.get_child(1).is_null());
assert_eq!(Direction::Inheri... | 41.091837 | 89 | 0.772039 |
d7d4d8b2413ced9f18cf17a04a6b9a7f41f285f3 | 2,145 |
mod sphere; pub use sphere::*;
mod plane; pub use plane::*;
mod triangle; pub use triangle::*;
mod bound; pub use bound::*;
mod point_light; pub use point_light::*;
use crate::types::*;
// A trait for types that can be in Objects.
pub trait Surface {
// Takes in a ray and performs an intersection test
// on... | 28.986486 | 92 | 0.641492 |
089562566e4282139557845c18e1a2f242b2f8ab | 3,343 | use common::Result;
use packets::icmp::v6::{Icmpv6, Icmpv6Packet, Icmpv6Payload, Icmpv6Type, Icmpv6Types};
use packets::ip::v6::Ipv6Packet;
use packets::{buffer, Fixed, Packet};
use std::fmt;
/* From https://tools.ietf.org/html/rfc4443#section-4.1
Echo Request Message
0 1 ... | 27.628099 | 96 | 0.498953 |
7636557708c38bd3f1bd0b9aaa02264e741c822e | 2,471 | use crate::core::Method;
use crate::core::{ValueType, OHLCV};
use crate::prelude::Candle;
use std::borrow::BorrowMut;
/// Implements some methods for sequence manipulations.
pub trait Sequence<T>: AsRef<[T]> {
/// Validates the sequence.
fn validate(&self) -> bool;
/// Applies [`Method`](crate::core::Method) on th... | 25.214286 | 93 | 0.614326 |
380ee005d0302232f834732149ce55b2529c5432 | 6,621 | use crate::theory::contraint_db::Enabler;
use crate::theory::{Timepoint, W};
use aries_core::{BoundValueAdd, Lit, VarBound};
/// A unique identifier for an edge in the STN.
/// An edge and its negation share the same `base_id` but differ by the `is_negated` property.
///
/// For instance, valid edge ids:
/// - `a - ... | 27.473029 | 103 | 0.561849 |
710fa232f816ffd3355fb06b9f013bc91ad9f1a5 | 1,295 | use std::path::PathBuf;
use anyhow::{Context, Result};
use clap::Args;
use tokio::sync::broadcast;
use crate::config::{ConfigOpts, ConfigOptsBuild, ConfigOptsServe, ConfigOptsWatch};
use crate::serve::ServeSystem;
/// Build, watch & serve the Rust WASM app and all of its assets.
#[derive(Args)]
#[clap(name = "serve"... | 33.205128 | 92 | 0.658687 |
ac71a825739006ba0c27b810cb49e48a6ea6aa4e | 24,037 | // 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.
use crate::{
app::{MessageInternal, RenderOptions},
drawing::DisplayRotation,
geometry::UintSize,
input::ScenicInputHandler,
message::Me... | 36.866564 | 125 | 0.589591 |
5d244e77d7516aa2f2410d5e061fdc15db5bbe48 | 80,681 |
::bobbin_mcu::periph!( , Dma2d, _PERIPH, Dma2dPeriph, _OWNED, _REF_COUNT, 0x00000000, 0x00, 0x0c);
#[doc="DMA2D controller"]
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct Dma2dPeriph(pub usize);
impl Dma2dPeriph {
#[doc="Get the CR Register."]
#[inline] pub fn cr_reg(&self) -> ::bobbin_mcu::register::Regi... | 29.467129 | 98 | 0.521139 |
ed1e6131e45ac75dd18b9bc3f34c92c25a9b5602 | 1,571 | use std::pin::Pin;
use std::time::Duration;
use async_trait::async_trait;
use futures03::prelude::Stream;
use serde_json::Value;
use slog::Logger;
use crate::data::subgraph::Link;
use crate::prelude::Error;
/// The values that `json_stream` returns. The struct contains the deserialized
/// JSON value from the input ... | 32.729167 | 96 | 0.690643 |
0a6a6823d4614d341c8771033194d6e82d4b24eb | 138 | pub mod paging;
pub mod driver;
pub mod cpu;
pub mod interrupts;
// pub mod smp;
pub mod pti;
pub mod gdt;
pub mod idt;
pub mod syscall; | 12.545455 | 19 | 0.710145 |
6a4833ecef18200732c81a978ce45050e137afb4 | 11,898 | // 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.
//! Overnet daemon for Fuchsia
#![deny(missing_docs)]
mod mdns;
mod serial;
use anyhow::{Context as _, Error};
use argh::FromArgs;
use fidl_fuchsia_over... | 34.486957 | 107 | 0.576483 |
ed006bb243415e42de0fecf17332f89b18547314 | 107 | #[derive(Queryable)]
pub struct User {
pub id: i32,
pub email: String,
pub password: String,
}
| 15.285714 | 25 | 0.626168 |
031d56bfa0389847d080a46e0c8e440408502c3e | 5,833 | use crate::dhcp::constant::{BULLETIN_HELPER, COMMAND_PROMPT, WINDOWS_BULLETIN, DIRECTORY_PATH,
DHCP_FILE, DHCP_FILE_PATH, DHCP_LOGS};
use crate::dhcp::operations::fetch_dhcp_logs::fetch_dhcp_logs;
use crate::dhcp::operations::filter_dhcp_logs::filter_dhcp_logs;
use crate::utilities::constant... | 37.391026 | 100 | 0.590091 |
760aea02b5f4e8a4bc034ea2c567b773651d88c3 | 412 | //! Tests auto-converted from "sass-spec/spec/non_conformant/extend-tests/164_test_combinator_unification_angle_space.hrx"
#[allow(unused)]
fn runner() -> crate::TestRunner {
super::runner()
}
#[test]
#[ignore] // wrong result
fn test() {
assert_eq!(
runner().ok(".a.b > x {a: b}\
\n.a y {... | 21.684211 | 122 | 0.536408 |
640d80dfa82d5634b506ae38347861257a839e29 | 4,433 | //! (!) a decision was made to go with the approach of recording rarities PER BANK
//!
//! an alternative would be to record rarities PER COLLECTION
//! then we'd only allow the update_authority recorded on the Metadata to store rarity scores
//!
//! Pros of chosen approach:
//! - flexibility: if update_authority Keypa... | 36.04065 | 166 | 0.625987 |
d50bf01b7c2cf9428ad4b08a527b58a151a53d2b | 1,958 | use super::*;
use std::io::*;
pub fn read_u1(r: &mut impl Read) -> Result<u8> {
let mut buffer = [0u8; 1];
r.read_exact(&mut buffer)?;
Ok(buffer[0])
}
pub fn read_u2(r: &mut impl Read) -> Result<u16> {
let mut buffer = [0u8; 2];
r.read_exact(&mut buffer)?;
Ok(u16::from_be_bytes(buffer))
}
pub... | 27.577465 | 107 | 0.578652 |
67ce237918cdea21612eeeb15073bb3cfb6d2723 | 177 | use day_3::day_3;
fn main() {
let input = day_3::input::<12>();
println!("part 1 => {}", day_3::part_1(&input));
println!("part 2 => {}", day_3::part_2(&input));
}
| 22.125 | 52 | 0.536723 |
29e401b48c91072cfa09b2447b36aaebc44adf41 | 61,405 | // Generated by gir (https://github.com/gtk-rs/gir @ 79e747a1a188)
// from gir-files (https://github.com/gtk-rs/gir-files @ b827978e7d18)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ 0220d4948268)
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case... | 42.850663 | 99 | 0.631431 |
1a23039fc9d9adce74f3084679736f60755e98f1 | 275 | fn main() {
env_logger::init_from_env(env_logger::Env::default().filter_or("WAIT_LOGGER_LEVEL", "debug"));
let mut sleep = wait::sleeper::new();
wait::wait(&mut sleep, &wait::config_from_env(), &mut on_timeout);
}
fn on_timeout() {
std::process::exit(1);
}
| 25 | 98 | 0.654545 |
232d3ef53851078ca455023433f3b0e6260b1a74 | 30,492 | #[doc = "Reader of register PCR3"]
pub type R = crate::R<u32, super::PCR3>;
#[doc = "Writer for register PCR3"]
pub type W = crate::W<u32, super::PCR3>;
#[doc = "Register PCR3 `reset()`'s with value 0x0743"]
impl crate::ResetValue for super::PCR3 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self... | 29.806452 | 431 | 0.543684 |
33edd77900d1de2cdfbeb562663cc3f88a1399a6 | 765 | use crate::lexer::SyntaxKind;
use num_traits::{FromPrimitive, ToPrimitive};
#[derive(Debug, Eq, PartialEq, PartialOrd, Ord, Hash, Clone, Copy)]
pub(crate) enum ShakespeareProgrammingLanguage {}
impl rowan::Language for ShakespeareProgrammingLanguage {
type Kind = SyntaxKind;
fn kind_from_raw(raw: rowan::Synt... | 31.875 | 85 | 0.738562 |
1a5ffd93701c65bd0f81e90ccfe084679380854d | 4,140 | use super::ObjectSafetyViolation;
use crate::infer::InferCtxt;
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::{struct_span_err, DiagnosticBuilder};
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_middle::ty::TyCtxt;
use rustc_span::{MultiSpan, Span};
use std::fmt;
use std::iter;
impl<'a, 't... | 36.964286 | 100 | 0.608213 |
d6aaf53f10246a3b1cd80d85ef5d6170f730f04f | 14,636 | use hir::HasSource;
use ra_syntax::{
ast::{
self,
edit::{self, AstNodeEdit, IndentLevel},
make, AstNode, NameOwner,
},
SmolStr,
};
use crate::{
assist_context::{AssistContext, Assists},
ast_transform::{self, AstTransform, QualifyPaths, SubstituteTypeParams},
utils::{get_... | 21.273256 | 99 | 0.519268 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.