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 |
|---|---|---|---|---|---|
5b1cdef794989182294c2eac41d1a20a879e254d | 11,587 | // Copyright 2018 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 {
bitfield::bitfield,
failure::{bail, format_err, Error, ResultExt},
fidl::endpoints::ClientEnd,
fidl_fuchsia_media::{
AudioSam... | 32.917614 | 95 | 0.569431 |
21bae3ff36e0f82564a3ab729be18d9383e749ac | 1,263 | //! Call Management functional descriptor
/// Call Management functional descriptor
#[allow(non_snake_case)]
#[derive(Clone, Copy)]
pub struct Desc {
// bFunctionLength: u8,
// bDescriptorType: u8,
// bDescriptorSubtype: u8,
/// Capabilities
pub bmCapabilities: Capabilities,
/// Interface of th... | 23.830189 | 87 | 0.596991 |
7add0f4a4362eb6d27c08f0cf8a796173f0a6935 | 109,432 | //! HIR (previously known as descriptors) provides a high-level object oriented
//! access to Rust code.
//!
//! The principal difference between HIR and syntax trees is that HIR is bound
//! to a particular crate instance. That is, it has cfg flags and features
//! applied. So, the relation between syntax and HIR is m... | 34.619424 | 124 | 0.527707 |
082aecb6a483d6c770c8146720d62a5fe785c0ca | 2,909 | use pgx::*;
use serde::{Deserialize, Serialize};
use std::ffi::CStr;
use std::str::FromStr;
#[derive(Copy, Clone, PostgresType)]
#[pgvarlena_inoutfuncs]
pub struct VarlenaType {
a: f32,
b: f32,
c: i64,
}
impl PgVarlenaInOutFuncs for VarlenaType {
fn input(input: &CStr) -> PgVarlena<Self> where {
... | 28.519608 | 99 | 0.577862 |
ef7672ccd7f0df1c9766dcb702767ee8811494a6 | 30,073 | // Copyright 2020 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 {
fuchsia_async as fasync,
fuchsia_zircon::{self as zx, AsHandleRef, Duration},
futures::{
channel::mpsc::Receiver,
future:... | 41.537293 | 101 | 0.538722 |
03d198a34080f4fb201966406d39e35b7fcf55ed | 3,450 | use crate::{config::ResourceType, InMemoryCache, UpdateCache};
use twilight_model::{
channel::Channel,
gateway::payload::incoming::{ChannelCreate, ChannelDelete, ChannelPinsUpdate, ChannelUpdate},
id::{marker::ChannelMarker, Id},
};
impl InMemoryCache {
pub(crate) fn cache_channels(&self, channels: imp... | 28.04878 | 97 | 0.588696 |
5b003630da57c6812ea576437619f5be322f97dd | 3,723 | use pir_8_emu::isa::instruction::{ParseInstructionError, Instruction};
use rand::distributions::{Alphanumeric, Distribution};
use self::super::super::super::alt_gp_registers;
use self::super::unrecognised_register_letter;
use pir_8_emu::isa::GeneralPurposeRegister;
use rand::thread_rng;
#[test]
fn load_immedate_byte(... | 40.032258 | 143 | 0.327424 |
f7ce7658e000c3ab06581c0c72597a2f86520e9a | 5,561 | use async_ftp::FtpStream;
use lazy_static::*;
use libunftp::Server;
use unftp_sbe_gcs::CloudStorage;
use more_asserts::assert_ge;
use path_abs::PathInfo;
use pretty_assertions::assert_eq;
use slog::Drain;
use slog::*;
use std::{
io::{Cursor, Read},
path::PathBuf,
process::{Child, Command},
str,
tim... | 33.908537 | 191 | 0.619493 |
d538a8068ac4a16a392e79e43adaa1011022e6d9 | 740 | #![allow(non_upper_case_globals)]
use abi::call::{FnType, ArgType};
fn classify_ret_ty<Ty>(ret: &mut ArgType<Ty>) {
if ret.layout.is_aggregate() && ret.layout.size.bits() > 64 {
ret.make_indirect();
} else {
ret.extend_integer_width_to(32);
}
}
fn classify_arg_ty<Ty>(arg: &mut ArgType<Ty>... | 22.424242 | 65 | 0.586486 |
096a56c11f623a5822b2eca3d344daafa3bd004f | 249 | use wasm_compiler::process;
#[no_mangle]
pub fn compile(code_ptr: usize) -> usize {
process(code_ptr, |code| {
Ok(match wat::parse_str(code) {
Ok(a) => a,
Err(e) => return Err(e.to_string()),
})
})
}
| 20.75 | 48 | 0.526104 |
f4cca9df6a5772e2b851a49af19bfc0521ea1310 | 39,954 | /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu>
This program is free software; you can redistribute it and/or modify
it un... | 36.027051 | 116 | 0.534815 |
de52cab4c64c903a4468153ae123601261ea9f1d | 21,256 | use crate::did_resolve::DIDResolver;
use crate::jsonld::REVOCATION_LIST_2020_V1_CONTEXT;
use crate::one_or_many::OneOrMany;
use crate::vc::{Credential, CredentialStatus, Issuer, VerificationResult, URI};
use async_trait::async_trait;
use bitvec::prelude::Lsb0;
use bitvec::slice::BitSlice;
use bitvec::vec::BitVec;
use c... | 36.775087 | 151 | 0.61305 |
d73662f49362ebd7c547d5e5c6485e50fec94a06 | 15,074 | #![allow(clippy::wildcard_imports, clippy::enum_glob_use)]
use crate::utils::ast_utils::{eq_field_pat, eq_id, eq_pat, eq_path};
use crate::utils::{over, span_lint_and_then};
use rustc_ast::mut_visit::*;
use rustc_ast::ptr::P;
use rustc_ast::{self as ast, Pat, PatKind, PatKind::*, DUMMY_NODE_ID};
use rustc_ast_pretty::... | 36.946078 | 106 | 0.549224 |
f4d5a42b663defc767e319f0b30d1a9b304c200a | 1,875 | //! Core libraries for libsecp256k1.
#![allow(
clippy::cast_ptr_alignment,
clippy::identity_op,
clippy::many_single_char_names,
clippy::needless_range_loop,
clippy::suspicious_op_assign_impl,
clippy::too_many_arguments,
clippy::type_complexity
)]
#![deny(
unused_import_braces,
unuse... | 25.337838 | 94 | 0.6976 |
4bc67bfdee3e7901f82a025aa60ec8a01736f264 | 2,691 | // Copyright 2020 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
use crate::{make_empty_map, make_map_with_root_and_bitwidth, FIRST_NON_SINGLETON_ADDR};
use address::{Address, Protocol};
use cid::Cid;
use encoding::tuple::*;
use encoding::Cbor;
use fil_types::{ActorID, HAMT_BIT_WIDTH};
use ipld_blocksto... | 33.6375 | 99 | 0.643255 |
11412e430b01a832154ef614dec2f959d5450253 | 630 | mod coin_change;
mod edit_distance;
mod egg_dropping;
mod fibonacci;
mod knapsack;
mod longest_common_subsequence;
mod longest_increasing_subsequence;
mod maximum_subarray;
pub use self::coin_change::coin_change;
pub use self::edit_distance::{edit_distance, edit_distance_se};
pub use self::egg_dropping::egg_drop;
pub ... | 33.157895 | 77 | 0.839683 |
72e76f0298b5c3369647ec0c961ec20285143364 | 20,919 | // Copyright 2019 Google LLC
//
// 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 except according to those t... | 32.943307 | 100 | 0.544768 |
039caef3d998bc3fb667ce29963ae31e4a7697b3 | 555 | // -*- rust -*-
use std;
import comm;
import comm::port;
import comm::send;
import comm::chan;
import comm::recv;
import task;
fn a(c: chan<int>) { #debug("task a0"); #debug("task a1"); send(c, 10); }
fn main() {
let p = port();
let ch = chan(p);
task::spawn(|| a(ch) );
task::spawn(|| b(ch) );
le... | 17.34375 | 73 | 0.50991 |
e95c8b810b945ba12009c247b866d3ff2a512f66 | 50 | //! 数据表模型
mod account;
pub use account::Account;
| 10 | 25 | 0.7 |
62d8ba826f452e7c0473115702f34a3a054170b8 | 19,972 | // Copyright (c) 2016 The vulkano 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 co... | 34.140171 | 100 | 0.574404 |
16499ee13958a39f09bd7c116d3b763070de8c36 | 15,971 | #[doc = "Writer for register PMC_SLPWK_ER1"]
pub type W = crate::W<u32, super::PMC_SLPWK_ER1>;
#[doc = "Register PMC_SLPWK_ER1 `reset()`'s with value 0"]
impl crate::ResetValue for super::PMC_SLPWK_ER1 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Write pro... | 27.536207 | 86 | 0.522823 |
01a549e7f9f85237a0c0b6122f547f050fc9cc7f | 527 | use graph::*;
use errors::*;
use ops::interface::default::*;
use super::super::ids;
use std::convert::AsRef;
use std::ops::DerefMut;
//use std::borrow::Borrow;
pub fn mat_mul<T1: AsRef<Expr>, T2: AsRef<Expr>>(arg0: T1, arg1: T2) -> Result<Expr> {
let arg0 = arg0.as_ref();
let arg1 = arg1.as_ref();
same_gra... | 23.954545 | 86 | 0.614801 |
eda938a8ce8d7f1fc29e6ec2a312ea47447a7adf | 3,118 | // This file is part of dpdk. 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/lemonrock/dpdk/master/COPYRIGHT. No part of dpdk, including this file, may be copied, modified, propagated, or distributed except accordin... | 30.271845 | 367 | 0.735407 |
fc89489925d799c170550e11d353f0e9caa8057f | 553 | use crate::BigMapKey;
use naia_serde::{BitReader, BitWrite, Serde, SerdeErr};
// EntityHandle
#[derive(PartialEq, Eq, Hash, Clone, Copy)]
pub struct EntityHandle(u64);
impl BigMapKey for EntityHandle {
fn to_u64(&self) -> u64 {
self.0
}
fn from_u64(value: u64) -> Self {
EntityHandle(value... | 20.481481 | 56 | 0.611212 |
030afb3a10fec6e6803aac0308fb96b19cce4774 | 7,116 | //! Sub-expression variants.
prelude! {}
// use expr::frame::Frame;
#[derive(Debug, Clone)]
pub struct Variant {
e_idx: idx::Expr,
v_idx: idx::Variant,
data: idx::DataMap<expr::Data>,
src: rust::Variant,
zip_handler_id: rust::Id,
zipper_go_up_id: rust::Id,
}
implement! {
impl Variant {... | 28.238095 | 96 | 0.509696 |
ac0fa52c9707096133188f10f75feb10c3888612 | 9,389 | // This file is part of Substrate.
// Copyright (C) 2019-2020 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... | 33.532143 | 101 | 0.657472 |
f92919a2b3a1172c7b158932d329601a0b0b1699 | 344 | mod entity_client;
mod partition_key_client;
mod table_client;
mod table_service_client;
pub use entity_client::{AsEntityClient, EntityClient};
pub use partition_key_client::{AsPartitionKeyClient, PartitionKeyClient};
pub use table_client::{AsTableClient, TableClient};
pub use table_service_client::{AsTableServiceClien... | 38.222222 | 73 | 0.848837 |
0ee2221bbc14b9658c9f5010c94be25821b54f7b | 780 | // 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 | 74 | 0.691026 |
11c8d57b9314592daab61d154b8d3c641da33aa4 | 9,263 | use super::{ItemAccess, KeyPartialOrd, Offset, Storage, StorageMut};
use crate::util::binary_search_min;
use std::marker::PhantomData;
/// Internal node reference.
pub trait InternalRef<S: Storage>: ItemAccess<S> {
/// Returns the identifer of the parent node, if any.
fn parent(&self) -> Option<usize>;
//... | 32.275261 | 117 | 0.562453 |
2800ce4b0031dc150705eadf81e93526ffdacc24 | 32,683 | #![no_std]
extern crate alloc;
use alloc::{boxed::Box, string::String, vec, vec::Vec};
use core::iter::{self, FromIterator};
use rand::{distributions::Alphanumeric, rngs::SmallRng, Rng, SeedableRng};
use casper_contract::{
contract_api::{account, runtime, storage, system},
unwrap_or_revert::UnwrapOrRevert,
... | 48.853513 | 102 | 0.75706 |
33b2f355e086e679350e27c944681ae2fd2c5a54 | 1,920 | #[doc(hidden)]
#[allow(missing_debug_implementations)]
pub struct AppMeta<'b> {
pub name: String,
pub bin_name: Option<String>,
pub author: Option<&'b str>,
pub version: Option<&'b str>,
pub about: Option<&'b str>,
pub more_help: Option<&'b str>,
pub pre_help: Option<&'b str>,
pub aliase... | 27.826087 | 85 | 0.521875 |
618ddd2384a83bc6304fb1bd4f5ff40fb40b9616 | 1,986 | use graph::blockchain;
use graph::blockchain::Block;
use graph::blockchain::TriggerData;
use graph::cheap_clone::CheapClone;
use graph::prelude::hex;
use graph::prelude::web3::types::H256;
use graph::prelude::BlockNumber;
use graph::runtime::asc_new;
use graph::runtime::AscHeap;
use graph::runtime::AscPtr;
use graph::r... | 27.971831 | 93 | 0.573011 |
ddd42adf845875b0bccc35e778db6d7c487301d5 | 1,315 | // This file was generated by gir (d50d839) from gir-files (469db10)
// DO NOT EDIT
use MimeInfo;
use ffi;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct Plugin(Object<ffi::WebKitPlugin, ffi::WebKitPluginClass>);
match fn {... | 23.482143 | 110 | 0.630418 |
1aa43bfac0f68e11d6abe0e157ca4e2762348bbd | 707 | use anyhow::Result;
use structopt::StructOpt;
use tokio::net::TcpListener;
use toy_storage::{api::Server, storage::inmemory};
use tracing::info;
#[derive(StructOpt)]
struct Opts {
#[structopt(short, long, default_value = "127.0.0.1:8080")]
address: String,
}
#[tokio::main]
async fn main() -> Result<()> {
... | 19.108108 | 63 | 0.640736 |
d66fdf2614047878bca5c676fa223c2d720156b0 | 892 | use std::ops::Range;
fn greatest_subsequential_sum(nums: &[i32]) -> (i32, Range<usize>) {
let mut max = 0;
let mut boundaries = 0..0;
for length in 0..nums.len() {
for start in 0..nums.len() - length {
let sum = (&nums[start..start + length]).iter().sum();
if sum > max {
... | 24.108108 | 73 | 0.530269 |
38ac498ea8c7a24f7a3a56d3bff58b89e7a4c0ec | 133 | pub mod request;
pub use self::request::{TransactionRequest,FilledTransactionRequest,CallRequest};
// pub use self::sign::sign_call;
| 33.25 | 81 | 0.796992 |
1c64f3e9ab23ebe524e7b44ed9132a173aaf5bf3 | 906 | #[test]
fn min_height_overrides_height_on_root() {
let mut sprawl = sprawl::Sprawl::new();
let node = sprawl
.new_node(
sprawl::style::Style {
size: sprawl::geometry::Size { height: sprawl::style::Dimension::Points(50f32), ..Default::default() },
min_size: spr... | 39.391304 | 119 | 0.565121 |
d578ff424b56c37bbc24fdf4e8ade85a354bfee4 | 672 | use opentelemetry::{
api,
api::Tracer as _,
api::{Provider, Span},
sdk,
};
use std::thread;
use std::time::Duration;
fn main() {
let tracer = sdk::Provider::default().get_tracer("report_example");
{
let span0 = tracer.start("main", None);
thread::sleep(Duration::from_millis(10))... | 25.846154 | 71 | 0.577381 |
18f256d33ec1bb598e3f946bf138f801d0a5a8ed | 5,460 | // 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.165746 | 100 | 0.594689 |
4b09681548d37ea1a19c45f1903118b9df710281 | 200,164 | //! Lowering rules for X64.
use crate::data_value::DataValue;
use crate::ir::{
condcodes::FloatCC, condcodes::IntCC, types, AbiParam, ArgumentPurpose, ExternalName,
Inst as IRInst, InstructionData, LibCall, Opcode, Signature, Type,
};
use crate::isa::x64::abi::*;
use crate::isa::x64::inst::args::*;
use crate::... | 44.950371 | 135 | 0.470869 |
b9823d915612ea3342b87f1ac7dd9221a0929cdd | 120 | // run: to_json()
#[derive(Deserialize, Document)]
pub enum Ty {
Foo,
#[serde(skip_deserializing)]
Bar,
}
| 12 | 32 | 0.608333 |
0ee0014642ba8e227bd82389a4ae1791b56d6ac8 | 4,608 | // This file is part of the SORA network and Polkaswap app.
// Copyright (c) 2020, 2021, Polka Biome Ltd. All rights reserved.
// SPDX-License-Identifier: BSD-4-Clause
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
... | 42.666667 | 103 | 0.636936 |
f822e426503248da5bf23c83d6fac6a6dc24c090 | 349,269 | //! Persistent accounts are stored in below path location:
//! <path>/<pid>/data/
//!
//! The persistent store would allow for this mode of operation:
//! - Concurrent single thread append with many concurrent readers.
//!
//! The underlying memory is memory mapped to a file. The accounts would be
//! stored across m... | 38.225785 | 264 | 0.561513 |
ccb4f653cb3e884cb09c31d08b725acd08c2737b | 946 | use crate::parser::{KeywordToken, TrySet, attrs};
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub(crate) enum EnumErrorMode {
Default,
ReturnAllErrors,
ReturnUnexpectedError,
}
impl Default for EnumErrorMode {
fn default() -> Self {
Self::Default
}
}
impl From<attrs::ReturnAllErrors> for... | 24.894737 | 91 | 0.624736 |
29fdbae92aceb289108bd76a880dd7552672f73e | 150 | //! Tests auto-converted from "sass-spec/spec/non_conformant/errors/import/url/mixin/control-else"
#[allow(unused)]
use super::runner;
mod outside;
| 21.428571 | 98 | 0.76 |
6133af1bb1f1adcee7687768b5b0a58d36a97d90 | 30,209 | //! Generic WebSocket message stream.
pub mod frame;
pub mod payload;
mod message;
pub use self::{frame::CloseFrame, message::Message};
use log::*;
use std::{
collections::VecDeque,
io::{ErrorKind as IoErrorKind, Read, Write},
mem::replace,
};
use self::{
frame::{
coding::{CloseCode, Contro... | 41.10068 | 112 | 0.576418 |
8fa6010ebb25d034935bb0e174368c8170cb03c3 | 11,600 | use crate::chain::{ChainController, ChainService};
use ckb_chain_spec::consensus::Consensus;
use ckb_core::block::Block;
use ckb_core::block::BlockBuilder;
use ckb_core::cell::{resolve_transaction, OverlayCellProvider, TransactionsProvider};
use ckb_core::header::{Header, HeaderBuilder};
use ckb_core::transaction::{Cel... | 33.048433 | 97 | 0.616379 |
db1fbe05fa38f646a1fc0ab0906274a95ee960f6 | 1,319 | //Author: AlbinoGazelle
//Purpose: Print the "Twelve Days of Christmas" carole.
fn num_day(n: i32){
match n {
1 => print!("first "),
2 => print!("second "),
3 => print!("third "),
4 => print!("fourth "),
5 => print!("fifth "),
6 => print!("sixth "),
7 => print... | 25.862745 | 62 | 0.457165 |
1cbe8827381b8651ed84f5af170977c723d11473 | 1,183 | extern crate unbase;
use unbase::subject::*;
#[test]
fn basic_record_retrieval() {
let net = unbase::Network::create_new_system();
let slab_a = unbase::Slab::new(&net);
let context_a = slab_a.create_context();
let record_id;
{
let record = Subject::new_kv(&context_a, "animal_type","Cat").... | 25.170213 | 79 | 0.651733 |
f4480327a3741a3e257e92513d2f76a5f7b226e1 | 3,557 | use crate::rtweekend::random_int;
use crate::vec3::Point3;
use crate::Vec3;
use std::vec::Vec;
pub struct Perlin {
point_count: i32,
ranvec: Vec<Vec3>,
perm_x: Vec<i32>,
perm_y: Vec<i32>,
perm_z: Vec<i32>,
}
impl Perlin {
pub fn perlin_generate_perm(&mut self, axis: i32) {
let tmp = ma... | 28.007874 | 99 | 0.409896 |
f7190fb7338afdca2589d3c84a9b079d4c6254ff | 5,275 | // This file is part of the uutils coreutils package.
//
// (c) Michael Gehring <mg@ebfe.org>
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
// spell-checker:ignore (ToDO) delim mkdelim
#[macro_use]
extern crate uucore;
use std::cmp::... | 29.305556 | 80 | 0.515829 |
08e885ffa08d76c63f8db505dd96618089773f1d | 375 | #[macro_export]
macro_rules! column {
($($x:expr),* $(,)?) => {
geng::ui::column(vec![$(Box::new($x)),*])
};
}
#[macro_export]
macro_rules! stack {
($($x:expr),* $(,)?) => {
geng::ui::stack(vec![$(Box::new($x)),*])
};
}
#[macro_export]
macro_rules! row {
($($x:expr),* $(,)?) => {
... | 17.857143 | 49 | 0.426667 |
5d32cfbcca777ee24f3a08f162a297909752eaf5 | 1,905 | // * This file is part of the uutils coreutils package.
// *
// * (c) Jordi Boggiano <j.boggiano@seld.be>
// *
// * For the full copyright and license information, please view the LICENSE
// * file that was distributed with this source code.
/* last synced with: printenv (GNU coreutils) 8.13 */
use clap::{crate... | 26.830986 | 149 | 0.56168 |
aced55445f4f55846bbebaea072df9be5ba24de3 | 38,541 |
#![cfg_attr(feature = "clippy", feature(plugin))]
#![cfg_attr(feature = "clippy", plugin(clippy))]
#![cfg_attr(feature = "clippy", deny(clippy))]
use std::borrow::Borrow;
use std::cmp::Ordering;
use std::collections::hash_map::{self, HashMap};
use std::fmt;
use std::hash::{BuildHasher, Hash, Hasher};
use std::iter;
u... | 29.488141 | 104 | 0.507615 |
234ec176f583bc2b0c880915277e595a5de1fc70 | 12,527 | // Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
#![forbid(unsafe_code)]
use serde::{Deserialize, Serialize};
use serde_json::json;
use std::{
collections::HashMap,
convert::{TryFrom, TryInto},
};
use thiserror::Error;
use ureq;
#[derive(Debug, Error, PartialEq)]
pub enum E... | 32.965789 | 99 | 0.595673 |
5699931d16ffbc38a12b720b3f957b920822f67c | 459 | extern crate rosalind;
use rosalind::{algorithmic_heights, utility::parser};
fn parse_input() -> Vec<i32> {
let filename = format!("input_dataset/{}", &parser::cmdline_arguments()[1]);
let mut input_vec = parser::list_of_things(filename).unwrap();
let nums = input_vec.pop().unwrap();
return nums;
}
fn main() {
l... | 27 | 77 | 0.697168 |
3896a96c3e5f12cf143a64eaa4acd610dbc89044 | 1,002 | use enumset::EnumSetType;
use enum_map::Enum;
use strum::EnumIter;
#[derive(Debug, Copy, Clone)]
pub enum ButtonStates {
Colour1 = 0x01,
Colour2 = 0x00,
DimmedColour1 = 0x02,
DimmedColour2 = 0x04,
Flashing = 0x03,
}
#[derive(EnumSetType, Enum, EnumIter, Debug)]
pub enum Buttons {
// These are ... | 21.319149 | 81 | 0.641717 |
1c226cce2c1b5ac70f0d796b5dadb2abfcfab079 | 16,985 | use std::usize;
use std::io;
use http::buf::MemSlice;
use http::io::MemRead;
use self::Kind::{Length, Chunked, Eof};
/// Decoders to handle different Transfer-Encodings.
///
/// If a message body does not include a Transfer-Encoding, it *should*
/// include a Content-Length header.
#[derive(Debug, Clone)]
pub struct... | 35.092975 | 102 | 0.493082 |
263c5f352d68239f299dcdcaf1ca25893a43bfbe | 93 | mod path;
mod query;
pub use path::Path;
pub use path::PathComponent;
pub use query::Query;
| 13.285714 | 28 | 0.731183 |
6910857e0d5de9788c617cd451acbbe42425e9ff | 3,159 | use cell::{Cell, CellId, CellIdGenerator, CellPosition};
use cell_vm::Facing;
use genome::Genome;
use random_generator::RandomGenerator;
use super::{INFLOW_RATE_BASE, POND_HEIGHT, POND_WIDTH};
pub struct CellPond {
grind: Vec<Vec<Cell>>,
}
impl CellPond {
pub fn new(id_generator: &mut CellIdGenerator, generat... | 28.981651 | 98 | 0.487813 |
abfb00a24a115364b7f825a1ae5d1f7c1117ac1b | 79,973 | // 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 ... | 35.527765 | 98 | 0.431596 |
14f277d1767bbc3faf3915ddec606226c46d6327 | 12,992 | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | 35.790634 | 97 | 0.525092 |
8ad960b3f1b45ccb441196d4f576fe8e8954f285 | 786 | // 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.2 | 68 | 0.697201 |
1ed4338fcf82d4e406182cc70ed3e6e5ca4a9413 | 353 | /* automatically generated by rust-bindgen */
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
pub mod Foo {
pub type Type = u32;
pub const Bar: Type = 0;
pub const Qux: Type = 1;
}
pub mod Neg {
pub type Type = i32;
pub const MinusOne: Type = -1... | 17.65 | 45 | 0.623229 |
48458811ffca0f88ba9b2b664d9403394a2ad837 | 4,744 | //! File descriptor operations
//!
//! - open(at)
//! - close
//! - dup2
//! - pipe
use super::*;
use alloc::string::String;
impl Syscall<'_> {
/// Opens or creates a file, depending on the flags passed to the call. Returns an integer with the file descriptor.
pub fn sys_open(&self, path: UserInPtr<u8>, flags... | 30.410256 | 120 | 0.509486 |
623fff6ecbd71c28de4fef83071f55d234bbb608 | 11,696 | // Copyright (c) 2019 - 2020 ESRLabs
//
// 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 ... | 32.579387 | 98 | 0.583191 |
e83c3b8baf631c3c73e6a80960f920a7b832813b | 283 | extern crate libc;
extern crate nix;
extern crate crossbeam;
extern crate serde_json;
mod alias_tree;
mod chunk;
mod device;
mod backup_file;
mod chunk_tracker;
mod change_logger;
mod writer;
pub mod copier;
mod quick_io;
pub mod control;
pub mod server;
pub mod cli;
pub mod lock;
| 14.894737 | 24 | 0.784452 |
d99615d72ee836d1093a2207cb8ce8f5bdef9559 | 5,884 | mod event;
mod input;
use std::cell::Cell;
use crate::{
lexer::Token,
parser_api::Parser,
parser_impl::{
event::{Event, EventProcessor},
input::{InputPosition, ParserInput},
},
SmolStr,
syntax_node::syntax_error::{
ParseError,
SyntaxError,
},
};
use crate::... | 29.128713 | 97 | 0.563902 |
147b31716fe805c1869dbdb622512bbebe3d63b8 | 421 | // if1.rs
pub fn bigger(a: i32, b: i32) -> i32 {
// This is so stupid
if (a > b) {
return a
} else {
return b
}
}
// Don't mind this for now :)
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn ten_is_bigger_than_eight() {
assert_eq!(10, bigger(10, 8));
}
... | 15.592593 | 44 | 0.508314 |
f4c08665a6916e3d6c2ce8231df7e66f484a4f63 | 625 | //! **UNSTABLE:** Structured key-value pairs.
//!
//! This module is unstable and breaking changes may be made
//! at any time. See [the tracking issue](https://github.com/rust-lang-nursery/log/issues/328)
//! for more details.
//!
//! Add the `kv_unstable` feature to your `Cargo.toml` to enable
//! this module:... | 23.148148 | 95 | 0.6336 |
eddeaa5e882eefa89bd8a19e3ce64314203309e3 | 8,598 | use std::collections::BTreeMap;
use std::io;
use chrono::{DateTime, Utc};
use rand::{CryptoRng, Rng};
use crate::armor;
use crate::composed::key::{PublicKey, PublicSubkey};
use crate::composed::signed_key::{SignedKeyDetails, SignedPublicSubKey};
use crate::crypto::hash::HashAlgorithm;
use crate::crypto::public_key::P... | 27.037736 | 99 | 0.580251 |
64026e54ec9f2ae79e607f76a758cd3221ea40de | 1,650 | // 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 ... | 27.5 | 96 | 0.666667 |
ff6cbec70d84d075071683ccd24e04685fea1c97 | 15,683 | use super::{stars, DifficultyAttributes};
use crate::{Beatmap, Mods, PpResult, StarResult};
/// Calculator for pp on osu!ctb maps.
///
/// # Example
///
/// ```
/// # use rosu_pp::{FruitsPP, PpResult, Beatmap};
/// # /*
/// let map: Beatmap = ...
/// # */
/// # let map = Beatmap::default();
/// let pp_result: PpResult... | 30.511673 | 116 | 0.569279 |
7a64071b89ff11b2cd3dba2cb2a6b805ac55e1f2 | 1,644 | use super::BoxTokenStream;
use super::{Token, TokenStream, Tokenizer};
use std::str::CharIndices;
/// Tokenize the text by splitting on whitespaces and punctuation.
#[derive(Clone)]
pub struct SimpleTokenizer;
pub struct SimpleTokenStream<'a> {
text: &'a str,
chars: CharIndices<'a>,
token: Token,
}
impl ... | 27.4 | 77 | 0.57056 |
9156344ea6bfc133b992be9efdc51b2223d820c7 | 3,946 | #[doc = "Register `BUF_09_ID` reader"]
pub struct R(crate::R<BUF_09_ID_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<BUF_09_ID_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<BUF_09_ID_SPEC>> for R {
#[inline(always)]
fn from(read... | 28.388489 | 412 | 0.581095 |
0307fd649c83554c9e2669b4a8d1ab531978ad85 | 2,227 | // 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... | 41.240741 | 92 | 0.465649 |
237cfe19dc49b8218121fe77b13cde5e6f1c9fd4 | 828 | // 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 ... | 27.6 | 68 | 0.63285 |
79112ceae534ea2350e50c2b6b1f53310b5db2c8 | 18,525 | use itertools::Itertools;
use tracing::{debug, error, warn};
use ibc::{
ics02_client::client_state::{ClientState, IdentifiedAnyClientState},
ics03_connection::connection::{IdentifiedConnectionEnd, State as ConnectionState},
ics04_channel::channel::{IdentifiedChannelEnd, State as ChannelState},
ics24_ho... | 32.329843 | 118 | 0.5139 |
87c3a0f47891f9c7d5059f0b42ca824144604145 | 324 | use algorithms::IterativeAlgorithm;
pub trait Execute: IterativeAlgorithm {
fn execute(self) -> Self::Result;
}
impl<T: IterativeAlgorithm> Execute for T {
fn execute(mut self) -> T::Result {
while !self.has_converged() {
self.next_iteration();
}
return self.result();
... | 20.25 | 43 | 0.617284 |
622b330c0ef86925065829d64f3b5e00785e2b9b | 13,398 | #[doc = "Reader of register INTCLR"]
pub type R = crate::R<u32, super::INTCLR>;
#[doc = "Writer for register INTCLR"]
pub type W = crate::W<u32, super::INTCLR>;
#[doc = "Register INTCLR `reset()`'s with value 0"]
impl crate::ResetValue for super::INTCLR {
type Type = u32;
#[inline(always)]
fn reset_value() ... | 29.062907 | 84 | 0.556202 |
fc52357d220ec90a871340bbc59687c7a86e59f1 | 7,884 | // Copyright 2016 Pierre Talbot (IRCAM)
// 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.162055 | 129 | 0.625824 |
89a5140d43bd8d8d7315807ce0e9ea85b4fbb960 | 2,646 | // Copyright 2022 RisingLight Project Authors. Licensed under Apache-2.0.
use bitvec::prelude::BitVec;
use smallvec::SmallVec;
use crate::array::{ArrayImpl, DataChunk};
pub type PackedVec<T> = SmallVec<[T; 16]>;
/// Similar to [`DataChunk`], in the storage system, we use [`StorageChunk`]
/// to represent a set of c... | 27.5625 | 99 | 0.55291 |
e9af2c1df657cd68b7abfa4eae93d3dbaba62056 | 2,102 | // Copyright 2019 Tyler Neely
//
// 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 writ... | 36.877193 | 92 | 0.6451 |
09f86e2e6702dd013e810ed05f77c68c780667aa | 852 | use serde::{Deserialize, Serialize};
use nom::{branch::alt, bytes::complete::tag_no_case, combinator::map, error::ParseError, IResult};
use std::fmt;
/// Sip URI Schema.
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
pub enum UriSchema {
Sip,
Sips,
}
impl fmt::Display for UriSchema {
... | 27.483871 | 98 | 0.57277 |
e55b8e43841c42ca28d5e1963e6dda86dca808c2 | 4,183 | use std::collections::HashMap;
use std::sync::Arc;
use std::sync::Mutex;
use std::fs::File;
use std::io::Write;
use std::io::Read;
use std::thread;
use std::time::Duration;
use serenity::model::id::UserId;
use serenity::model::id::ChannelId;
use serenity::model::id::GuildId;
use serenity::model::voice::VoiceState;
use ... | 33.733871 | 103 | 0.545781 |
08d605b010eb83a4d41faf2b50e285782f112381 | 5,019 | use std::convert::TryFrom;
use std::io;
use async_trait::async_trait;
use crate::{proxy::*, session::*};
pub struct Handler {
pub actors: Vec<AnyOutboundHandler>,
}
impl Handler {
fn next_connect_addr(&self, start: usize) -> OutboundConnect {
for a in self.actors[start..].iter() {
match ... | 33.912162 | 97 | 0.421598 |
56ecc6e68a98c8af8f1f233985b06ab89c84ab5f | 66,692 | use std::any::Any;
use std::cell::{Cell, RefCell};
use std::collections::BTreeSet;
use std::env;
use std::ffi::OsStr;
use std::fmt::Debug;
use std::fs;
use std::hash::Hash;
use std::ops::Deref;
use std::path::{Path, PathBuf};
use std::process::Command;
use std::time::{Duration, Instant};
use build_helper::{output, t};... | 39.346313 | 123 | 0.557398 |
d5ecd861b0b33267a5e0662d03d43803feba2715 | 10,254 | use crate::config;
use crate::elasticsearch;
use crate::error::ResponseError;
use crate::gcp::*;
use crate::guards;
use crate::models::ImageUploadResponse;
use crate::responders::{Cached, Image, JpegReqwestStream, WebpReqwestStream};
use crate::rolodex_client;
use instrumented::instrument;
use libc::{c_float, c_int, s... | 31.550769 | 123 | 0.532768 |
dd948d2f2c02f2341653013d26173cb1378d69fe | 39 | mod color;
pub use self::color::Color;
| 13 | 27 | 0.717949 |
dd708e6cf512bae3777be09ead191e13c9810910 | 4,760 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
pub mod context;
use context::Context;
pub mod application;
pub mod connection_close;
pub mod early;
pub mod interest;
pub use crate::contexts::WriteContext;
pub use interest::Interest;
/// re-export core
pu... | 31.946309 | 96 | 0.607563 |
724d7400b97f2289ddf7193da3ac11248782bdbc | 13,318 | mod guild;
mod channel;
mod user;
pub use guild::*;
pub use channel::*;
pub use user::*;
use crate::gateway::*;
use std::collections::HashMap;
use std::any::{TypeId, Any};
use crate::{Identifiable, Snowflake};
use tokio::sync::{RwLock, RwLockReadGuard, RwLockWriteGuard};
pub trait Stored {
type Storage: Storage;... | 35.705094 | 116 | 0.609626 |
1456a054e58b10503117f03d80324e97bf681fa7 | 696 | use std::io::{self, Cursor, Read, Write};
#[derive(Debug, Default)]
pub struct Packet {
buffer: Cursor<Vec<u8>>,
}
impl From<&[u8]> for Packet {
fn from(buf: &[u8]) -> Self {
Packet {
buffer: Cursor::new(Vec::from(buf)),
}
}
}
impl Read for Packet {
fn read(&mut self, buf:... | 18.810811 | 61 | 0.525862 |
61b578d0e78cca2c7fdaeea1238eb8a2a96d45ae | 1,858 | /* automatically generated by rust-bindgen */
extern "C" {
pub fn cublasHgemm(
handle: cublasHandle_t,
transa: cublasOperation_t,
transb: cublasOperation_t,
m: ::std::os::raw::c_int,
n: ::std::os::raw::c_int,
k: ::std::os::raw::c_int,
alpha: *const __half,
... | 29.967742 | 45 | 0.527987 |
76c409d4dc72ee3180d0cba052ab730c7f87db54 | 762 | mod available_datasets;
pub mod component;
pub mod meal;
pub use available_datasets::AvailableDatasets;
use std::collections::BTreeMap;
use uuid::Uuid;
/// Struct to hold all application data
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct Data {
/// The year the data applies to.
pub year: i... | 23.8125 | 57 | 0.622047 |
ff192179d8e733f3f22774d9a37e3162325e5085 | 245 | use ron::de::from_str;
#[test]
fn test_inf_and_nan() {
assert_eq!(from_str("inf"), Ok(std::f64::INFINITY));
assert_eq!(from_str("-inf"), Ok(std::f64::NEG_INFINITY));
assert_eq!(from_str::<f64>("NaN").map(|n| n.is_nan()), Ok(true))
} | 30.625 | 68 | 0.628571 |
ef65fa5ea14a9d6d8e083e6cf6e1dfefb71dbcaa | 1,828 | // iterators2.rs
// In this exercise, you'll learn some of the unique advantages that iterators
// can offer. Follow the steps to complete the exercise.
// As always, there are hints if you execute `rustlings hint iterators2`!
// Step 1.
// Complete the `capitalize_first` function.
// "hello" -> "Hello"
pub fn capital... | 26.114286 | 78 | 0.582057 |
e9e813465b21638600d68c3b5b7046c792f9208c | 1,148 | /// Benchmark regular indexing flow (using JSONRPC), don't persist the resulting index.
extern crate electrs_tapyrus;
extern crate error_chain;
#[macro_use]
extern crate log;
use electrs_tapyrus::{
cache::BlockTxIDsCache, config::Config, daemon::Daemon, errors::*, fake::FakeStore,
index::Index, metrics::Metri... | 26.697674 | 87 | 0.635017 |
cc046d0a398ff0cb6e4f9b2e929d9e7edbb9448c | 2,467 | use crate::config::*;
use crate::bitvector::BitVector;
use crate::popcount::{popcount_linear};
pub struct BitvectorRank {
bitvec: BitVector,
basic_block_size: position_t,
rank_lut: Vec<position_t>,
}
impl BitvectorRank {
pub fn new(
basic_block_size: position_t,
bitvector_per_level: &V... | 37.378788 | 158 | 0.642886 |
39441ec5eb934974c8b400b679de2aee57682056 | 5,330 | //! Types for context representation
//! See [ctx attribute](super::attributes#ctx) for more information.
use crate::error::DekuError;
use core::marker::PhantomData;
use core::str::FromStr;
#[cfg(feature = "alloc")]
use alloc::format;
/// An endian
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum Endian {
/... | 26.65 | 90 | 0.552908 |
87649340d7b3af0a91510819319456841e7fe3bb | 76 | /*
! Select test to run with
* `cargo test --test {name of file}
*/
| 15.2 | 39 | 0.552632 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.