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 |
|---|---|---|---|---|---|
76cea497b5b6c5b05aac34a3bd3fa464ec6be79e | 659 | /// Graph kind determines if `digraph` or `graph` is used as keyword
/// for the graph.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum Kind {
Digraph,
Graph,
}
impl Kind {
/// The edgeop syntax to use for this graph kind.
pub(crate) fn edgeop(&self) -> &'static str {
match *self {
... | 22.724138 | 72 | 0.506829 |
29c624575c3c2328af0f0f0997bbcbe156bc1190 | 61,369 | //! A classic liveness analysis based on dataflow over the AST. Computes,
//! for each local variable in a function, whether that variable is live
//! at a given point. Program execution points are identified by their
//! IDs.
//!
//! # Basic idea
//!
//! The basic model is that each local variable is assigned an index... | 36.442399 | 100 | 0.535319 |
0ece418e7d61382997011d1c7fc92393db48c2d6 | 23,181 | // COPY OF 'src/rust/cli/client.rs'
// DO NOT EDIT
use clap::{App, SubCommand};
use mime::Mime;
use crate::oauth2::{ApplicationSecret, ConsoleApplicationSecret};
use serde_json as json;
use serde_json::value::Value;
use std::env;
use std::error::Error as StdError;
use std::fmt;
use std::fs;
use std::io;
use std::io::{... | 30.949266 | 100 | 0.470428 |
79bfdf92f633a4e2e635eb146f1ebc3f8d4972b1 | 4,235 | // Copyright (c) 2017 Stefan Lankes, RWTH Aachen University
// Colin Finck, RWTH Aachen University
//
// 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 opt... | 29.409722 | 121 | 0.687367 |
901882ab4abe441552b4651307a0ee150c353112 | 3,043 | use iced::{
text_input::{self, State, TextInput},
Column, Container, Length,
};
use crate::ui::{color, component::text};
#[derive(Debug, Clone)]
pub struct Value<T> {
pub value: T,
pub valid: bool,
}
impl std::default::Default for Value<String> {
fn default() -> Self {
Self {
... | 24.739837 | 79 | 0.516267 |
f4b8afc677c69a058e39ff21d2840062572c0184 | 1,326 | macro_rules! accessor {
(type : $type:ty {get=$getter:ident} ) => {
fn $getter(&self) -> $type ;
};
(type : $type:ty {set=$setter:ident} ) => {
fn $setter(&mut self, value:$type) ;
};
(type : $type:ty {get=$getter:ident, set=$setter:ident} ) => {
accessor!(type:$type {get=$ge... | 25.018868 | 73 | 0.50905 |
ccc57e5eaff30e6efd863b5e08c362446b50553f | 19,643 | //! TODO(doc): @doitian
use ckb_build_info::Version;
use ckb_resource::{DEFAULT_P2P_PORT, DEFAULT_RPC_PORT, DEFAULT_SPEC};
use clap::{App, AppSettings, Arg, ArgGroup, ArgMatches, SubCommand};
/// TODO(doc): @doitian
pub const CMD_RUN: &str = "run";
/// TODO(doc): @doitian
pub const CMD_MINER: &str = "miner";
/// TODO(... | 33.406463 | 158 | 0.53052 |
23b51bd905be80e3b9f144900ccbb90509271246 | 603 | use rocket::serde::{Deserialize, Serialize};
use sqlx::FromRow;
#[derive(Serialize)]
pub struct Message {
pub message: &'static str,
}
#[allow(non_snake_case)]
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, FromRow)]
#[serde(crate = "rocket::serde")]
pub struct Fortune {
pub id: i32,
pub messag... | 20.793103 | 67 | 0.676617 |
21c57685063b898be64e233d95bf358495753b8c | 14,768 | // Take a look at the license at the top of the repository in the LICENSE file.
use crate::Align;
use crate::Container;
use crate::IconSize;
use crate::Image;
use glib::object::{IsA, ObjectExt};
use glib::signal::{connect_raw, SignalHandlerId};
use glib::translate::*;
use glib::Cast;
use glib::ToValue;
use std::boxed:... | 31.02521 | 100 | 0.578345 |
9c43cbc67406cc0639c0bab2a35dacc8ca5c5b29 | 3,417 | // بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
// This file is part of Setheum.
// Copyright (C) 2019-2021 Setheum Labs.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License a... | 28.714286 | 102 | 0.689786 |
619573765c2877a4fbe4726055f1f58acbfd6467 | 13,284 | //! Provides a automatically resized orthographic camera.
use amethyst_core::cgmath::Ortho;
use amethyst_core::specs::{
Component, DenseVecStorage, Join, ReadExpect, ReadStorage, System, WriteStorage,
};
use amethyst_core::Axis2;
use amethyst_renderer::{Camera, ScreenDimensions};
/// The coordinates that `CameraO... | 35.050132 | 117 | 0.599368 |
ccefc5f1b6c339a5b45675601e92fc5d56c78431 | 30,938 | //! Internal details to be used by instance.rs only
use std::borrow::{Borrow, BorrowMut};
use std::ptr::NonNull;
use std::sync::{Arc, RwLock};
use wasmer::{HostEnvInitError, Instance as WasmerInstance, Memory, Val, WasmerEnv};
use wasmer_middlewares::metering::{get_remaining_points, set_remaining_points, MeteringPoint... | 36.743468 | 117 | 0.59713 |
90634ac2d5ef485489f2458c3d981e9f1f6c0c71 | 2,777 | //! `fake::Kernel`'s implementation of the Command system call.
use crate::kernel::thread_local::get_kernel;
use crate::{command_return, ExpectedSyscall, SyscallLogEntry};
use libtock_platform::{ErrorCode, Register};
use std::convert::TryInto;
pub(super) fn command(
driver_id: Register,
command_id: Register,
... | 39.671429 | 93 | 0.64206 |
8fcf60c75fd7941ec34f8e6c366de60ed1b336ce | 3,586 | use casper_engine_test_support::{
internal::{
exec_with_return, ExecuteRequestBuilder, WasmTestBuilder, DEFAULT_BLOCK_TIME,
DEFAULT_RUN_GENESIS_REQUEST,
},
DEFAULT_ACCOUNT_ADDR,
};
use casper_execution_engine::core::engine_state::EngineConfig;
use casper_types::{
account::AccountHash, co... | 31.734513 | 96 | 0.693252 |
0ae9a002b40732afb947e0f4be0ee8d7cd0f0f10 | 1,328 | mod client_cfg;
mod protocol;
mod utils;
use protocol::remote_executor_client::RemoteExecutorClient;
use protocol::Command;
use tonic::transport::Channel;
use client_cfg::{parse_config, Start, SubCommand};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let (opts, cfg) = parse_config(... | 27.666667 | 76 | 0.605422 |
561d6403f25ea96d5be92d42c7ee0b02169e796d | 10,889 | //! @brief Example Rust-based BPF program that issues a cross-program-invocation
#![allow(unreachable_code)]
extern crate solana_sdk;
use solana_bpf_rust_invoked::instruction::*;
use solana_sdk::{
account_info::AccountInfo,
entrypoint,
entrypoint::{ProgramResult, MAX_PERMITTED_DATA_INCREASE},
info,
... | 38.477032 | 99 | 0.520158 |
6469e4f5d405a328e6145c297c486a0ce5b617ce | 25,645 | //! `ndarray` for NumPy users.
//!
//! This is an introductory guide to `ndarray` for people with experience using
//! NumPy, although it may also be useful to others. For a more general
//! introduction to `ndarray`'s array type `ArrayBase`, see the [`ArrayBase`
//! docs][ArrayBase].
//!
//! # Contents
//!
//! * [Simi... | 39.092988 | 259 | 0.598869 |
1acff7cb7e5bbe545cd6df5c16fa4e6416056bb5 | 4,333 | use crate::ast::{DataType, Expression, Node};
use std::fmt;
pub type Statement = Node<Statements>;
impl Statement {
pub fn to_string(&self) -> String {
self.node.to_string()
}
}
impl fmt::Display for Statement {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", se... | 25.946108 | 71 | 0.394415 |
01044ffb4718e8d8832258d3bca526c031535bc1 | 184,475 | // Copyright 2018 sqlparser-rs contributors. All rights reserved.
// Copyright Materialize, Inc. and contributors. All rights reserved.
//
// This file is derived from the sqlparser-rs project, available at
// https://github.com/andygrove/sqlparser-rs. It was incorporated
// directly into Materialize on December 21, 20... | 37.989086 | 163 | 0.5028 |
f8da3711036c28a43a9786142068fe129fdb84ae | 3,132 | pub mod channel;
pub mod emoji;
pub mod guild;
pub mod integration;
pub mod interaction;
pub mod member;
pub mod message;
pub mod presence;
pub mod reaction;
pub mod role;
pub mod stage_instance;
pub mod sticker;
pub mod thread;
pub mod voice_state;
use crate::{config::ResourceType, InMemoryCache, UpdateCache};
use st... | 27.234783 | 93 | 0.592273 |
0eed07521f229af8a7da5cd1e08bc49f02cd2557 | 1,207 | // 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.175 | 75 | 0.724938 |
71293436874b1816d9dc6e53fb560bce0ce975fd | 3,313 | use std::cmp;
use na::{DMatrix, DVector, Matrix3x4, Matrix4, Matrix4x3, Vector4};
use nl::LU;
quickcheck! {
fn lup(m: DMatrix<f64>) -> bool {
if m.len() != 0 {
let lup = LU::new(m.clone());
let l = lup.l();
let u = lup.u();
let mut computed1 = &l * &u;
... | 30.675926 | 82 | 0.480531 |
b98f230dc5ce804ff0de0dbb314b9508e6fee806 | 1,173 | //! A dummy optimization printing the basic block data structures
use crate::asm::Body;
use crate::Compiler;
#[derive(Default)]
pub struct Pass;
impl super::Pass for Pass {
fn name(&self) -> &'static str {
"print_structure"
}
#[allow(clippy::cognitive_complexity)]
fn apply<'a>(&mut self, cx:... | 31.702703 | 74 | 0.457801 |
7aaf2180044c0b2c81ded40881c749a32e537697 | 321 | fn main() {
let mut total = 0;
let mut last = 0;
let mut tmp = 0;
let mut current = 1;
while current <= 4000000 {
tmp = current;
current = last + current;
last = tmp;
if current % 2 == 0 {
total += current;
};
};
println!("{}", total);
... | 16.894737 | 33 | 0.442368 |
bbc1b789c0e46e057284aa96fc39c1724bbe8f26 | 12,781 | #![allow(clippy::inconsistent_digit_grouping, clippy::unusual_byte_groupings)]
extern crate autocfg;
extern crate cc;
#[cfg(feature = "vendored")]
extern crate openssl_src;
extern crate pkg_config;
#[cfg(target_env = "msvc")]
extern crate vcpkg;
use std::collections::HashSet;
use std::env;
use std::ffi::OsString;
use... | 33.545932 | 99 | 0.557468 |
ccf2485f6d3c16eb503517e94b745e6291e3c2b2 | 242 | #[cfg(all(feature = "curl-client", not(target_arch = "wasm32")))]
pub(crate) use super::isahc::IsahcClient as NativeClient;
#[cfg(all(feature = "wasm-client", target_arch = "wasm32"))]
pub(crate) use super::wasm::WasmClient as NativeClient;
| 40.333333 | 65 | 0.714876 |
ab398a9a7240b3cf49556cc43442d4c7bc7f9710 | 6,160 | // Non-conventional componentwise operators.
use num::{Signed, Zero};
use std::ops::{Add, Mul};
use alga::general::{ClosedDiv, ClosedMul};
use base::allocator::{Allocator, SameShapeAllocator};
use base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
use base::dimension::Dim;
use base::storage:... | 41.904762 | 185 | 0.483766 |
913f488127c0d110fc41828b52f18dde2474d12b | 5,459 | // Copyright 2018 The proptest 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. This file may not be copied, modified, or distributed
// except a... | 11.209446 | 68 | 0.449167 |
8aa79a0eea983f8a4046c61e42a67b5cd0738920 | 3,337 | use anyhow::Result;
/// Starts an executable file in a cross-platform way.
///
/// This is the Windows version.
#[cfg(windows)]
pub fn start_executable<I, S>(exe_path: &str, exe_arguments: I) -> Result<bool>
where
I: IntoIterator<Item = S>,
S: AsRef<str>,
{
// Fold parameter list into a String
let exe_... | 32.398058 | 84 | 0.580461 |
b9dcd083c0b8c9b176883851952e7cbdd3007cd9 | 73,807 | use super::{ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericArgs};
use rustc_ast::attr;
use rustc_ast::ptr::P as AstP;
use rustc_ast::*;
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_data_structures::thin_vec::ThinVec;
use rustc_errors::struct_span_err;
use rustc_hir as hir;
us... | 39.490102 | 106 | 0.501578 |
01c098b96137b10dd191fd606d9bada30432e555 | 29,146 | // SPDX-License-Identifier: MIT
use core::cell::Cell;
use core::cmp;
#[cfg(not(feature = "no_std"))]
use crate::blur;
use crate::color::Color;
use crate::graphicspath::GraphicsPath;
use crate::graphicspath::PointType;
use crate::Mode;
use crate::FONT;
pub trait Renderer {
/// Get width
fn width(&self) -> u32... | 32.822072 | 98 | 0.4028 |
09e7b6b89d264820836e4178f98748ff991d0df2 | 197 | #[cfg(test)]
mod tests {
//TODO: tests?
}
pub mod cp_info;
pub mod cp;
pub mod attributes;
pub mod opcodes;
pub mod bytecode_tools;
pub mod methods;
pub mod fields;
pub mod class;
pub mod gen; | 14.071429 | 23 | 0.705584 |
093873c849a92622e3861d1cb146a491b6f5e1c5 | 52,190 | use crate::infer::InferCtxtExt as _;
use crate::traits::{self, PredicateObligation};
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sync::Lrc;
use rustc_hir as hir;
use rustc_hir::def_id::{DefId, DefIdMap};
use rustc_hir::Node;
use rustc_infer::infer::error_reporting::unexpected_hidden_region_diag... | 40.488751 | 100 | 0.541713 |
efeb2144788b3058f0106a5c56004a9772c1de31 | 2,916 | use aoc;
//use regex::Regex;
use pcre2::bytes::Regex;
use std::collections::HashMap;
use std::collections::HashSet;
fn main() {
let lines = aoc::lines_from_file("input.txt");
let mut r_pat: HashMap<String, String> = HashMap::new();
let mut u_pat: HashMap<String, Vec<String>> = HashMap::new();
let mut... | 26.27027 | 95 | 0.429012 |
ede9b6d1eb725b8eba9fe5103f59f603590a0fc6 | 132,193 | use std::cell::RefCell;
use std::ffi::{CStr, CString};
use std::fmt;
use std::io::{self, SeekFrom, Write};
use std::path::Path;
use std::slice;
use std::str;
use std::time::Duration;
use curl_sys;
use libc::{self, c_void, c_char, c_long, size_t, c_int, c_double, c_ulong};
use socket2::Socket;
use Error;
use easy::for... | 40.775139 | 99 | 0.625078 |
bf22344adfbfa3cef5086ba292fe8e246f66da08 | 6,284 | use bindings::{
Windows::Foundation::Numerics::*,
Windows::Win32::Direct2D::*
};
use windows::Result;
const DEFAULT_BACKGROUND_COLOR: D2D1_COLOR_F = create_color(0x282828FF);
const DEFAULT_STATUS_BAR_COLOR: D2D1_COLOR_F = create_color(0x141414FF);
const DEFAULT_BRACKET_COLOR: D2D1_COLOR_F = create_colo... | 49.480315 | 146 | 0.693507 |
4aa74f33ab4a7688b29510539c3c9d5db248a691 | 8,606 | #[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::ST6_TCONFA {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'... | 24.801153 | 59 | 0.495584 |
28dc30e56a30640fa61e145d82e0eed4aa886972 | 7,703 | // Copyright (c) 2018-2022 The MobileCoin Foundation
use core::{
convert::TryFrom,
fmt::{Debug, Display},
hash::Hash,
result::Result as StdResult,
};
use displaydoc::Display;
use mc_common::{NodeID, ResponderId, ResponderIdParseError};
use mc_crypto_keys::{DistinguishedEncoding, Ed25519Public, KeyError... | 36.334906 | 91 | 0.631183 |
e5c473fcc2579be2c0a7de577163af60b080c2ab | 3,324 | extern crate dirs_sys_next;
use std::path::PathBuf;
use std::iter::FromIterator;
use BaseDirs;
use UserDirs;
use ProjectDirs;
pub fn base_dirs() -> Option<BaseDirs> {
let home_dir = dirs_sys_next::known_folder_profile();
let data_dir = dirs_sys_next::known_folder_roaming_app_data();
let data_... | 36.527473 | 106 | 0.629964 |
56b88da4b3bf2899b46bd0f05771cb36597d789c | 38,907 | #![doc = "generated by AutoRust 0.1.0"]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ServiceResource {
#[serde(flatten)]
pub tracked_resource: TrackedResource,
#[serde(default, skip_serial... | 44.062288 | 109 | 0.709307 |
de2a2c85a0c1c43482ea7447bcb10613fb9438b7 | 1,885 | mod buffer;
mod counts;
mod flow_control;
mod prioritize;
mod recv;
mod send;
mod state;
mod store;
mod stream;
mod streams;
pub(crate) use self::prioritize::Prioritized;
pub(crate) use self::recv::Open;
pub(crate) use self::send::PollReset;
pub(crate) use self::streams::{DynStreams, OpaqueStreamRef, StreamRef, Stream... | 27.720588 | 80 | 0.732626 |
89deeaa751a538d8da5e079109ad96b6c6fb3c7e | 1,344 | use crate::errors;
use crate::models::Config;
use clap::Clap;
use colored::*;
use log::trace;
#[derive(Clap, Debug)]
pub struct List {}
impl List {
pub fn exec(&self) -> Result<(), errors::LeftError> {
let config = Config::load().unwrap_or_default();
println!("{}", "\nInstalled themes:".blue().bol... | 31.255814 | 69 | 0.409226 |
de50bb3bfed9b1abe8bba0b117837e9e5559d686 | 6,887 | // 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 ... | 40.751479 | 101 | 0.557863 |
3350116ebbe2fb1a841e5f2a5f6abe20791bce4d | 1,159 | use sp_runtime::RuntimeDebug;
use codec::{Decode, Encode};
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
#[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, RuntimeDebug, PartialOrd, Ord)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub enum CurrencyId {
Native,
TokenSymbol {... | 23.653061 | 84 | 0.57377 |
e6182bbcc884e6cbe6f5bf08a44d940e483bbd4c | 1,581 | #[doc = "Register `T32RIS2` reader"]
pub struct R(crate::R<T32RIS2_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<T32RIS2_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::convert::From<crate::R<T32RIS2_SPEC>> for R {
fn from(reader: crate::R<T3... | 30.403846 | 247 | 0.630614 |
0afc884d8217275f73fd9f1e7fb3040efe305b37 | 1,766 | /*
* Swaggy Jenkins
*
* Jenkins API clients generated from Swagger / Open API specification
*
* The version of the OpenAPI document: 1.1.2-pre.0
* Contact: blah@cliffano.com
* Generated by: https://openapi-generator.tech
*/
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct Pipel... | 33.320755 | 91 | 0.654587 |
ffc25e82f885e2dedd004adda7f3527636d4100d | 772 | // https://leetcode-cn.com/problems/number-of-substrings-with-only-1s/
// Runtime: 4 ms
// Memory Usage: 2.1 MB
const MOD: i64 = 1_000_000_007;
pub fn num_sub(s: String) -> i32 {
let mut res: i64 = 0;
let mut it = s.chars().peekable();
while let Some(c) = it.next() {
if c == '1' {
let mu... | 26.62069 | 70 | 0.503886 |
90052a2a89569483684c0a9dd429c535802bca0a | 15,805 | use self::ctx::Ctx;
use crate::{
debug::{dump, AssertValid},
marks::Marks,
mode::Mode,
option::CompressOptions,
util::ModuleItemExt,
MAX_PAR_DEPTH,
};
use rayon::prelude::*;
use swc_common::{pass::Repeated, util::take::Take, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_visit::{noop_visit_mut_typ... | 25.491935 | 89 | 0.512306 |
e880e8d0ae75dfbf7fb7c66a7ecc1da73ae5f594 | 1,121 | // This file is part of Substrate.
// Copyright (C) 2020-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... | 36.16129 | 83 | 0.73595 |
e6418122cd6c9c8130ca524bba1e1306004502f4 | 12,855 | extern crate cli_test_dir;
extern crate sit_core;
extern crate which;
extern crate remove_dir_all;
use std::process;
use sit_core::{Repository, record::RecordOwningContainer, path::ResolvePath};
use cli_test_dir::*;
use remove_dir_all::*;
include!("includes/config.rs");
/// Should list no records if there are none... | 37.587719 | 145 | 0.585298 |
218070a5c03b2ad80bdce1106dcd1560bf9acf92 | 6,300 | //! Defines the `Backend` trait.
use crate::DataContext;
use crate::DataId;
use crate::FuncId;
use crate::Linkage;
use crate::ModuleNamespace;
use crate::ModuleResult;
use core::marker;
use cranelift_codegen::isa::TargetIsa;
use cranelift_codegen::Context;
use cranelift_codegen::{binemit, ir};
use std::borrow::ToOwne... | 35.195531 | 99 | 0.646984 |
fe0e45d00dd90271e108c0e9bbb032e66fc1ee25 | 4,327 | // Copyright 2014 M. Rizky Luthfianto.
// Licensed under the MIT license (http://opensource.org/licenses/MIT)
// This file may not be copied, modified, or distributed
// except according to those terms.
use nalgebra::DMatrix;
lazy_static! {
// taken from https://github.com/seqan/seqan/blob/master/include%2Fseqan%2Fs... | 50.313953 | 109 | 0.340421 |
ebc15f058d7eed1961c85b773db60d694d69907f | 4,861 | // @generated
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Transfers {
#[prost(message, repeated, tag="1")]
pub transfers: ::prost::alloc::vec::Vec<Transfer>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Transfer {
#[prost(bytes="vec", tag="1")]
pub from: ::prost::alloc::vec::V... | 74.784615 | 99 | 0.636495 |
9b96b8435e24f8071ed44e88c4fe89f6505a6093 | 1,541 | #![feature(custom_test_frameworks)]
#![no_std]
#![no_main]
#![test_runner(gifos::test_runner)]
#![reexport_test_harness_main = "test_main"]
#![deny(unsafe_op_in_unsafe_fn)]
extern crate alloc;
use bootloader::{entry_point, BootInfo};
use core::panic::PanicInfo;
use gifos::{
println,
task::{executor::Executor,... | 23.348485 | 97 | 0.667099 |
69a6bbd528b8936494595b624e8f7a1409085e4b | 2,492 | #![allow(clippy::module_inception)]
#![allow(clippy::upper_case_acronyms)]
#![allow(clippy::large_enum_variant)]
#![allow(clippy::wrong_self_convention)]
#![allow(clippy::should_implement_trait)]
#![allow(clippy::blacklisted_name)]
#![allow(clippy::vec_init_then_push)]
#![allow(clippy::type_complexity)]
#![allow(rustdo... | 33.226667 | 111 | 0.751605 |
d6cede224fe1fe325b846dc8e13e2c49898cc359 | 2,263 | extern crate redox_users;
use std::env;
use std::ffi::OsString;
use std::path::PathBuf;
use self::redox_users::AllUsers;
pub fn home_dir() -> Option<PathBuf> {
let current_uid = redox_users::get_uid().ok()?;
let users = AllUsers::new(false).ok()?;
let user = users.get_by_id(current_uid)?;
Some(PathBu... | 50.288889 | 159 | 0.648255 |
ff364f571828109748b211c3d02cdc5ba93718bb | 53 | use crate::token::tokens::Token;
token!(Character);
| 13.25 | 32 | 0.716981 |
d7deebc175c9da952a9f7dd388d333747fdf6ec7 | 13,647 | //! Tests for when multiple artifacts have the same output filename.
//! See https://github.com/rust-lang/cargo/issues/6313 for more details.
//! Ideally these should never happen, but I don't think we'll ever be able to
//! prevent all collisions.
use cargo_test_support::registry::Package;
use cargo_test_support::{ba... | 28.372141 | 152 | 0.503041 |
224fced730fdedc8b6e84b4b0a0913160251c957 | 773 | use language::operations::{make_param_doc, Operation, ParamInfo};
pub struct StrStoreStringRegOp;
const DOC: &str = "Copies the contents of one string register from another.";
pub const OP_CODE: u32 = 2321;
pub const IDENT: &str = "str_store_string_reg";
impl Operation for StrStoreStringRegOp {
fn op_code(&sel... | 22.085714 | 77 | 0.570505 |
bfdf6c9f7aa93e1ff09a17d92e75f8455b0f4ade | 6,824 | #![deny(unused_imports, unused_variables, unused_unsafe, unreachable_patterns)]
//! Wasmer-runtime is a library that makes embedding WebAssembly
//! in your application easy, efficient, and safe.
//!
//! # How to use Wasmer-Runtime
//!
//! The easiest way is to use the [`instantiate`] function to create an [`Instance`... | 33.950249 | 107 | 0.674091 |
2257441c1168a75d42a772748cbf9edc2a3a1d29 | 1,090 | #[doc = "Reader of register S6NDTR"]
pub type R = crate::R<u32, super::S6NDTR>;
#[doc = "Writer for register S6NDTR"]
pub type W = crate::W<u32, super::S6NDTR>;
#[doc = "Register S6NDTR `reset()`'s with value 0"]
impl crate::ResetValue for super::S6NDTR {
type Type = u32;
#[inline(always)]
fn reset_value() ... | 26.585366 | 74 | 0.56422 |
9bb9b21215a99513bad4fa1d801eb311ee1e1ca5 | 2,556 | //!
//!
#![deny(missing_docs)]
#![warn(unused_imports)]
#![warn(dead_code)]
use crate::types::{Address, Commit, ConsensusOutput, Hash, Signature, Status};
use serde::{de::DeserializeOwned, ser::Serialize};
use std::fmt::Debug;
/// Consensus support
pub trait ConsensusSupport<F: Content + Sync> {
/// Support erro... | 35.013699 | 99 | 0.641628 |
69492419b948fd95d556ada5e63541f3fa3ffd11 | 2,520 | #![allow(incomplete_features)]
#![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(specialization))]
#![cfg_attr(RUSTC_NEEDS_PROC_MACRO_HYGIENE, feature(proc_macro_hygiene))]
// Allows macro expansion of `use ::solana_sdk::*` to work within this crate
extern crate self as solana_sdk;
#[cfg(feature = "full")]
pub use signe... | 26.25 | 110 | 0.755159 |
080dd329a731b7966d30f3070290b802b7a2459c | 1,974 | // Copyright (C) 2021 Leandro Lisboa Penz <lpenz@lpenz.org>
// This file is subject to the terms and conditions defined in
// file 'LICENSE', which is part of this source code package.
#![warn(rust_2018_idioms)]
#![warn(missing_docs)]
//! copstr is a COPy STRing module
//!
//! [`copstr::Str`] wraps a fixed-size array... | 30.84375 | 70 | 0.628166 |
2f8e1c96eac7a65ef0fb465500a0bf1f8858ab57 | 945 | use solana_program::{account_info::{AccountInfo,next_account_info},entrypoint,entrypoint::ProgramResult,pubkey::Pubkey,msg};
use mokshyafeed::collection_price;
use std::{
str::FromStr
};
// Returns the current price of the collection as per the collection account info
entrypoint!(read_price);
pub fn read_price... | 35 | 124 | 0.719577 |
e244b34dbde7c94e4b3be3bd602d55c32f7fbf46 | 48,168 | use crate::chain::{address, Network, OutPoint, Transaction, TxIn, TxOut};
use crate::config::Config;
use crate::errors;
use crate::new_index::{compute_script_hash, Query, SpendingInput, Utxo};
use crate::util::{
create_socket, electrum_merkle, extract_tx_prevouts, full_hash, get_innerscripts,
get_script_asm, ge... | 33.778401 | 103 | 0.523709 |
5d0a0c06bd41f8729ab0b51ba9b285b0791045c4 | 2,817 | use crate::commands::constants::*;
use crate::{Error, TmuxCommand, TmuxOutput};
use std::borrow::Cow;
/// # Manual
///
/// tmux ^3.1:
/// ```text
/// tmux list-keys [-1aN] [-P prefix-string -T key-table]
/// (alias: lsk)
/// ```
///
/// tmux ^2.4:
/// ```text
/// tmux list-keys [-T key-table]
/// (alias: lsk)
/// ```
... | 24.076923 | 91 | 0.526092 |
877a234bd8791e5ef5494ba135b15d78f75b4e19 | 30,392 | #![allow(clippy::rc_buffer)]
use {
super::{
broadcast_utils::{self, ReceiveResults},
*,
},
crate::{
broadcast_stage::broadcast_utils::UnfinishedSlotInfo, cluster_nodes::ClusterNodesCache,
},
solana_entry::entry::Entry,
solana_ledger::shred::{
ProcessShredsStats, ... | 37.290798 | 101 | 0.57706 |
e9b6ba0117cf4a1a2155aa34750781a0e45162b0 | 1,680 | pub use self::context::Context;
pub use self::module::{Module, ModuleBuilder};
pub use self::function::{Function, FunctionLabel, FunctionBuilder};
pub use self::builder::{Builder, PositionedBuilder};
pub use self::block::{BasicBlock, Label};
pub use self::value::Value;
pub use self::phi::Phi;
pub use self::alloca::Allo... | 32.307692 | 106 | 0.741071 |
3384b02d57e970f201c34155a16539dfb101140d | 1,141 | use std::{thread,time};
extern crate rand;
use std::sync::{Arc,Mutex};
#[macro_use] extern crate lazy_static;
lazy_static! {
static ref NEURAL_NET_WEIGHTS: Vec<Arc<Mutex<Vec<f64>>>> = {
let mut nn = Vec::with_capacity(10000);
for _ in 0..10000 {
let mut mm = Vec::with_capacity(100);
fo... | 24.276596 | 92 | 0.567046 |
eb161d1b09d9325a8e4cfb9ff722921074d9835b | 3,670 | use super::super::bus::rcc;
use super::super::generic::platform::stm32f3x;
use super::super::generic::traits::primitive_extensions;
use super::super::registerblocks::dma::DMA;
pub mod dma {
use super::primitive_extensions::BitOps;
use super::rcc;
use super::stm32f3x::adresses;
use super::DMA;
pub ... | 28.015267 | 84 | 0.529155 |
64a21135232a34f2902f58d762b2df4bbe74e748 | 10,829 | #![crate_name = "uu_unexpand"]
/*
* This file is part of the uutils coreutils package.
*
* (c) Virgile Andreani <virgile.andreani@anbuco.fr>
* (c) kwantam <kwantam@gmail.com>
* 20150428 updated to work with both UTF-8 and non-UTF-8 encodings
*
* For the full copyright and license information, please view th... | 30.333333 | 100 | 0.462185 |
6af5649119431ee2ea3679404dd2f1ba96c71bbf | 83,917 | // Assorted public API tests.
use std::sync::Arc;
use std::sync::Mutex;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::mem;
use std::fmt;
use std::env;
use std::error::Error;
use std::io::{self, Write, Read};
use rustls;
use rustls::{ClientConfig, ClientSession, ResolvesClientCert};
use rustls::{ServerConfi... | 35.709362 | 130 | 0.618778 |
d5e32eefc5be4b9235257ec2647135acd4a032c9 | 4,081 | use byteorder::{BigEndian, ReadBytesExt};
use colors::{BitDepth, ColorType};
use crc::crc32;
use error::PngError;
use std::io::Cursor;
#[derive(Debug, Clone, Copy)]
/// Headers from the IHDR chunk of the image
pub struct IhdrData {
/// The width of the image in pixels
pub width: u32,
/// The height of the ... | 33.178862 | 106 | 0.574369 |
090035dfc592c02d4c33b5416b85228e3c34cef3 | 25,950 | //! Driver for the LSM303DLHC 3D accelerometer and 3D magnetometer sensor.
//!
//! May be used with NineDof and Temperature
//!
//! I2C Interface
//!
//! <https://www.st.com/en/mems-and-sensors/lsm303dlhc.html>
//!
//! The syscall interface is described in [lsm303dlhc.md](https://github.com/tock/tock/tree/master/doc/sy... | 33.965969 | 132 | 0.498882 |
abb77af52801bcf93a47c536216e82662cba8bde | 793 | use derive_more::From;
use hedera::TransactionReceipt;
use pyo3::prelude::*;
#[pyclass(name = TransactionReceipt)]
#[derive(From)]
pub struct PyTransactionReceipt {
pub(crate) inner: TransactionReceipt,
}
#[pymethods]
impl PyTransactionReceipt {
#[getter]
pub fn status(&self) -> PyResult<u8> {
Ok(... | 24.030303 | 68 | 0.6343 |
22e9c77801f2ab328f0c871a265437fc538e658d | 7,153 | /// Test that \p pattern fails to parse with default flags.
pub fn test_parse_fails(pattern: &str) {
let res = regress::Regex::new(pattern);
assert!(res.is_err(), "Pattern should not have parsed: {}", pattern);
}
/// Format a Match by inserting commas between all capture groups.
fn format_match(r: ®ress::Ma... | 29.92887 | 98 | 0.575003 |
5d61de3e09cfd24589da00963ebfbf6f489dc0cc | 8,387 | use crate::common::Direction;
use crate::framework::error::GameResult;
use crate::npc::NPC;
use crate::rng::RNG;
use crate::shared_game_state::SharedGameState;
use crate::stage::{Stage, BackgroundType};
impl NPC {
pub(crate) fn tick_n001_experience(&mut self, state: &mut SharedGameState, stage: &mut Stage) -> Game... | 30.277978 | 129 | 0.481459 |
4a58b8ed06adde35ee69d95804c583f1e953a382 | 3,695 | // Copyright 2018-2021 Parity Technologies (UK) Ltd.
//
// 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 applicab... | 31.853448 | 83 | 0.60406 |
eb815788fd634b992057929acd1941c0796abe39 | 356 | mod with_compact;
mod without_compact;
use super::*;
use liblumen_alloc::erts::process::Process;
use liblumen_alloc::erts::term::prelude::Atom;
fn option(process: &Process, digits: u8) -> Term {
process
.tuple_from_slice(&[tag(), process.integer(digits).unwrap()])
.unwrap()
}
fn tag() -> Term {
... | 19.777778 | 69 | 0.662921 |
e9521940512d3e5ca5ff5eddf5a339e40b279687 | 2,379 | use bytes::Bytes;
use mini_redis::client;
use tokio::sync::mpsc;
use tokio::sync::oneshot;
/// Multiple different commands are multiplexed over a single channel.
#[derive(Debug)]
enum Command {
Get {
key: String,
resp: Responder<Option<Bytes>>,
},
Set {
key: String,
val: Vec... | 26.730337 | 74 | 0.513241 |
22b9eb8e754453ea44d56f3669c8fbf1371e8c71 | 10,186 | // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | 44.675439 | 99 | 0.456803 |
f72759a8394ab10ac18efee9330380161a33b88e | 1,368 | use rocket::http;
use rocket::request;
use rocket::Outcome;
use rocket::State;
use nats::Client;
use r2d2::PooledConnection;
use r2d2_nats::NatsConnectionManager;
use std::ops::Deref;
use std::ops::DerefMut;
use std::env;
type Pool = r2d2::Pool<NatsConnectionManager>;
pub fn init_pool() -> Pool {
let manager =
... | 23.586207 | 96 | 0.626462 |
38956aede49132c44bd5bfafd6e59b29c7d01961 | 1,252 | //! Borp: A re-implementation of Borg in Rust
//!
//! There are several purposes here. One is to have a project of reasonable complexity to work on
//! in Rust. Another is to understand how Borg works better. Ultimately, this may become a useful
//! alternative implementation itself.
//!
//! But, to start with, we'r... | 30.536585 | 99 | 0.621406 |
c18df83786e1a42fe09fa4e5bba9c8f376428203 | 1,500 | use rand::Rng;
use futures::AsyncWriteExt;
use smol::{fs::File, io::BufWriter};
use std::error::Error;
use crate::io::{ClientId, Transaction, TransactionId};
const LINES: usize = 10000000;
pub async fn generate_random(file_out: &str) -> Result<(), Box<dyn Error>> {
let mut wri = BufWriter::new(File::create(file... | 30 | 76 | 0.502 |
62f80e1c18ebfa890660eaa2bf5b82952666f335 | 20,079 | //! SocketCAN support.
//!
//! The Linux kernel supports using CAN-devices through a network-like API
//! (see https://www.kernel.org/doc/Documentation/networking/can.txt). This
//! crate allows easy access to this functionality without having to wrestle
//! libc calls.
//!
//! # An introduction to CAN
//!
//! The CAN ... | 29.571429 | 99 | 0.598884 |
ac42348ba8214d79f37ccafbe98bca1e8b46942f | 474 | // 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.
pub mod accessor;
pub mod archivist;
mod component_lifecycle;
pub mod configs;
pub mod constants;
pub mod container;
pub mod diagnostics;
pub mod error;
pu... | 22.571429 | 73 | 0.776371 |
117322c5315ef72d434d86d8ba4041ba5d25112f | 4,540 | /*!
* Admin command handlers
*/
use chrono::{DateTime, Utc};
use itertools::Itertools;
use diesel::prelude::{ExpressionMethods, QueryDsl, RunQueryDsl, OptionalExtension};
use serenity::{
client::Context,
model::prelude::Message,
utils::MessageBuilder,
};
use uuid::Uuid;
use crate::error::Error;
use crat... | 34.656489 | 99 | 0.519383 |
8752386d6bfe0580ee244ec11a7a2cac3e23c235 | 2,583 | mod use_context;
mod use_effect;
mod use_reducer;
mod use_ref;
mod use_state;
pub use use_context::*;
pub use use_effect::*;
pub use use_reducer::*;
pub use use_ref::*;
pub use use_state::*;
use crate::{HookUpdater, CURRENT_HOOK};
use std::cell::RefCell;
use std::ops::DerefMut;
use std::rc::Rc;
/// Low level buildin... | 35.875 | 99 | 0.662795 |
d73caa416d3ccce351a70fe8a65393c7b4ca6421 | 7,735 | use futures::{Async, Future};
use tower_load as load;
use tower_service::Service;
use tower_test::mock;
use super::*;
macro_rules! assert_fut_ready {
($fut:expr, $val:expr) => {{
assert_fut_ready!($fut, $val, "must be ready");
}};
($fut:expr, $val:expr, $msg:expr) => {{
assert_eq!(
... | 27.045455 | 86 | 0.55863 |
5beb1d8b8c476feb3d4478afa731239c0c807643 | 260 | // Regression test for HashMap only impl'ing Send/Sync if its contents do
use std::collections::HashMap;
use std::rc::Rc;
fn foo<T: Send>() {}
fn main() {
foo::<HashMap<Rc<()>, Rc<()>>>();
//~^ ERROR `Rc<()>` cannot be sent between threads safely
}
| 21.666667 | 73 | 0.619231 |
712b73e7f3c03062a3ff8bab1e5d68df9fe4aaa3 | 2,547 | #[doc = "Register `RD_MAC_SPI_SYS_3` reader"]
pub struct R(crate::R<RD_MAC_SPI_SYS_3_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<RD_MAC_SPI_SYS_3_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<RD_MAC_SPI_SYS_3_SPEC>> for R {
#[inli... | 34.418919 | 240 | 0.660777 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.