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 |
|---|---|---|---|---|---|
e54309b7b2dde556fd78a7fd4c375ddd7be5ddac | 883 | use crate::io::IoImpl;
use std::time::Duration;
/// A wrapper around time facilities provided to Laythe
pub struct Time {
time: Box<dyn TimeImpl>,
}
impl Default for Time {
fn default() -> Self {
Self {
time: Box::new(TimeMock()),
}
}
}
impl Time {
/// Create a new wrapper around time
pub fn ... | 18.020408 | 55 | 0.630804 |
f5e53f84c16e6472dc4b39c3aca8a084cba288e7 | 553 | // 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 ... | 39.5 | 68 | 0.723327 |
48cf83c76e3cbc4301dff0fd5e270a626a0c45d4 | 1,326 | use rkyv::{archived_root, Archive, Archived, Deserialize, Infallible};
use std::marker::PhantomData;
/// A wrapper around a byte buffer `B` that denotes the bytes represent an [`Archived<T>`].
///
/// Note: This is not intended for use with archived structures that utilize shared memory like `ArchivedRc` and
/// `Arch... | 24.109091 | 112 | 0.59276 |
6a3d6a0efc697eb2215bf314d2458b3b9c413016 | 3,102 | use std::fmt::Debug;
use crate::magick_rust::MagickWand;
use crate::Crop;
// The general config of an image format.
pub trait ImageConfig: Debug {
fn is_remain_profile(&self) -> bool;
fn get_width(&self) -> u16;
fn get_height(&self) -> u16;
fn get_crop(&self) -> Option<Crop>;
fn get_sharpen(&self)... | 26.288136 | 77 | 0.604771 |
db76e39036452539959378e456206c748f09a0a9 | 8,386 | use crossbeam_channel::{self, Receiver, Sender, SendError};
use hdfs_comm::protos::hdfs::DatanodeIdProto;
use shared::NahFSError;
use shared::protos::BlockMetadataProto;
use crate::index::IndexStore;
use std::sync::{Arc, RwLock};
use std::thread::JoinHandle;
static INDEXED_MASK: u64 = 18446744004990074880;
pub enum... | 35.383966 | 80 | 0.565943 |
8700749f81fc7dd12a7a040ce5e08b0753d19205 | 446 | const THRESHOLD: i32 = 120;
pub struct ScrollAccum {
x: i32,
y: i32,
}
impl Default for ScrollAccum {
fn default() -> Self {
Self { x: 0, y: 0 }
}
}
impl ScrollAccum {
pub fn accumulate(&mut self, x: i32, y: i32) -> (i32, i32) {
self.x += x;
self.y += y;
let result... | 18.583333 | 64 | 0.511211 |
382f73f48e1fed1ada89b8a0891e8dcd0c783ee3 | 3,564 | use crate::util::SendSyncError as Error;
use serde::{Deserialize, Serialize};
use serde_with::{serde_as, DisplayFromStr};
use serenity::{
model::id::{ChannelId, RoleId},
prelude::{RwLock, TypeMapKey},
};
use std::{
collections::{HashMap, HashSet},
fs::File,
sync::Arc,
};
#[serde_as]
#[derive(Defaul... | 27.84375 | 85 | 0.607183 |
b94af23c630b5cd10991beae7049e5fc534a47bc | 27,212 | use std::io::Write;
use std::io::{ErrorKind, Read};
use std::ops::Range;
use crate::errors::RuntimeError;
use crate::ir::ops::{LoopDecrement, Op, OpType};
use crate::parser::Program;
const MAX_HEAP_SIZE: usize = 16 * 1024 * 1024;
/// Interpreter to execute a program
pub struct Interpreter<R: Read, W: Write> {
ma... | 32.20355 | 98 | 0.495664 |
5013c4ebc74015db11951afa7a02fbe4d7a7b6f1 | 110 | pub mod io;
pub use io::MidiIn;
pub mod msg;
pub use msg::Msg;
pub mod port;
pub use port::{PortNb, Ports};
| 12.222222 | 30 | 0.672727 |
eb9336ceb1534d0930f9573884b881e63197f23e | 2,523 | /// 初項 `a`, 項数 `n`, 公差 `d` の等差数列の和を求めます。
///
/// # Panics
/// if `n` is negative or zero.
///
/// # Examples
/// ```
/// use arithmetic_series::arithmetic_series;
///
/// // 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10
/// assert_eq!(arithmetic_series(1, 10, 1), Some(55));
/// // 1 + 3 + 5 + 7 + 9
/// assert_eq!(arithmetic_s... | 25.23 | 65 | 0.474832 |
33a1669c44fb0229f928147bbe79909eee321d75 | 9,466 | use crate::protocol::util;
// use serde::Serialize;
/// ID of the value type of a database column or a parameter.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize)]
pub enum TypeId {
/// For database type TINYINT;
/// used with [`HdbValue::TINYINT`](crate::HdbValue::TINYINT).
TINYINT = 1,
/// For ... | 37.713147 | 93 | 0.517748 |
0e186e6f29ce6636f4c6b669e913229941d4a282 | 580 | // if1.rs
// I AM DONE 2021-05-04 by stphnsmpsn
pub fn bigger(a: i32, b: i32) -> i32 {
if a > b {a}
else {b}
// Complete this function to return the bigger number!
// Do not use:
// - another function call
// - additional variables
// Execute `rustlings hint if1` for hints
}
// Don't mind... | 19.333333 | 58 | 0.577586 |
718a3db6ed789d5cab8bbe742dadee9384aa223e | 611 | use crate::units::altitude::Altitude;
use crate::units::water_density::WaterDensity;
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "use-serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Environment {
water_density: WaterDensity,
altitude: Altitude,
}
impl Environment {
pub fn new(wate... | 22.62963 | 80 | 0.635025 |
d5c66f862077b4d1331efe789090c445ca5d5967 | 1,592 | use std::io::Result;
use std::path::PathBuf;
fn delinkify(path: &PathBuf) -> PathBuf {
let mut delinked = PathBuf::new();
for comp in path.components() {
delinked.push(comp);
/* make sure that `delinked` isn't a link */
while let Ok(target) = std::fs::read_link(&delinked) {
... | 21.513514 | 62 | 0.537688 |
76430ae8786516a313f7f9b4bdf693bd74b172ec | 7,899 | // Unless explicitly stated otherwise all files in this repository are licensed under the
// MIT/Apache-2.0 License, at your convenience
//
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020 Datadog, Inc.
//
use crate::sys::{self, DmaBuffer, Source, SourceType};
use crat... | 31.979757 | 163 | 0.533359 |
38609dba17d220fc612dc2708e406558c94b630a | 1,441 | // Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
use depgraph_api::DeclName;
pub type Result<T, E = Error> = std::result::Result<T, E>;
/// A system error preventing us from proceedin... | 45.03125 | 80 | 0.720333 |
e63d4b19127e0df56971061fcf52d43e5898ca7d | 5,390 | use euclid::vec3;
use gdnative::prelude::*;
#[derive(Debug, Clone, PartialEq)]
pub enum ManageErrs {
CouldNotMakeInstance,
RootClassNotSpatial(String),
}
#[derive(gdnative::NativeClass)]
#[inherit(Spatial)]
struct SceneCreate {
// Store the loaded scene for a very slight performance boost but mostly to sh... | 34.113924 | 99 | 0.613729 |
8a1c0d8252271779257173ddd6f54d321c75f400 | 4,246 | // Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
//! A layer between raw [`Runtime`] webview windows and Tauri.
use crate::{
webview::{FileDropHandler, WebviewAttributes, WebviewRpcHandler},
Dispatch, Params, Runtime, Wind... | 28.884354 | 91 | 0.678521 |
611c04c2bbe659f3681b06ec7d1410f52dc6e51e | 2,129 | use crate::process::ProcessInfo;
use crate::{column_default, Column};
#[cfg(not(target_os = "windows"))]
use chrono::offset::TimeZone;
use chrono::{DateTime, Local};
use std::cmp;
use std::collections::HashMap;
pub struct StartTime {
header: String,
unit: String,
fmt_contents: HashMap<i32, String>,
raw... | 27.649351 | 88 | 0.609206 |
e278b04302653da3135ad4ae4c24e43b80ecc07a | 2,278 |
use std::io;
use std::time::Instant;
use std::sync::Arc;
use std::net::SocketAddr;
use crossbeam::sync::MsQueue;
use mio::{Ready, Poll, PollOpt, Token, Registration, SetReadiness, Evented};
use siege_example_net::GamePacket;
pub struct PacketSender {
pub outbound: Arc<MsQueue<(GamePacket,SocketAddr,Option<u32>)>>... | 32.084507 | 100 | 0.583845 |
6a81d2c8685762602acb9f89aee3b64b7a4b45c0 | 3,081 | use linkify::LinkFinder;
use once_cell::sync::Lazy;
static LINK_FINDER: Lazy<LinkFinder> = Lazy::new(LinkFinder::new);
/// Remove all GET parameters from a URL.
/// The link is not a URL but a String as it may not have a base domain.
pub(crate) fn remove_get_params_and_fragment(url: &str) -> &str {
let path = ma... | 31.762887 | 95 | 0.599481 |
fe9885b84af001c06068b1a4696c73039df190ea | 1,708 | use std::fmt::{Debug, Display};
use crate::{
structs::{PrivateField, Tuple},
traits::Simple,
unions::Basic,
RenamedPlain,
};
pub fn plain() {}
pub const fn const_fn() {}
pub fn one_arg(x: usize) {
println!("{}", x);
}
pub fn struct_arg(s: PrivateField) {
println!("{}", s.x);
}
pub fn fn_ar... | 17.252525 | 91 | 0.559133 |
0ebf209fe0dfac40b9d4a2e3b373b7548ffdcc93 | 1,048 | /*
How to get best move for current state of the board
*/
use pleco::tools::Searcher;
pub fn main()
{
/*
https://docs.rs/pleco/0.5.0/pleco/
https://docs.rs/pleco/0.5.0/pleco/board/struct.Board.html
https://docs.rs/pleco/latest/pleco/board/struct.Board.html#bitboard-representation
https://docs.rs/pleco/lates... | 29.111111 | 143 | 0.626908 |
0390f538b222a160cb2e9292a2a58c91f83d6770 | 4,016 | use crate::auth::AuthenticationScheme;
use crate::bail_status as bail;
use crate::headers::{Header, HeaderName, HeaderValue, Headers, AUTHORIZATION};
/// Credentials to authenticate a user agent with a server.
///
/// # Specifications
///
/// - [RFC 7235, section 4.2: Authorization](https://tools.ietf.org/html/rfc7235... | 29.313869 | 93 | 0.608566 |
d5a6e20b35a7d1231a5c4e12b34cc8b71df5688b | 622 | // Copyright (c) 2015 Robert Clipsham <robert@octarineparrot.com>
//
// 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... | 29.619048 | 79 | 0.721865 |
1cae90ee948cb89a10024218239de92843bd09e2 | 56,169 | // Copyright 2020 The Exonum 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 i... | 36.592182 | 103 | 0.583578 |
acc9030afb1991971abd7183a839b9f01a413c57 | 7,621 | //! Misc example is a catchall program for testing unrelated features.
//! It's not too instructive/coherent by itself, so please see other examples.
use anchor_lang::prelude::*;
use context::*;
use event::*;
use misc2::Auth;
mod account;
mod context;
mod event;
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFs... | 26.834507 | 94 | 0.574728 |
5619517aba21795443eab4aff298ef272907858d | 1,599 | use dprint_cli_core::logging::{LoggerTextItem, render_text_items_with_width};
pub struct TableText {
pub lines: Vec<String>,
pub hanging_indent: u16,
}
impl TableText {
pub fn render(&self, indent: u16, terminal_width: Option<u16>) -> String {
let text_items = self.get_logger_text_items(indent);
... | 31.98 | 85 | 0.602877 |
2f12a4b3bac5724af5982070ecfbfbf7a1664f4f | 31,394 | use num_bigint::BigInt as BigIntValue;
use std::any::Any;
use swc_atoms::JsWord;
use swc_common::Span;
use swc_ecma_ast::*;
use swc_ecma_visit_macros::define;
/// Visitable nodes.
pub trait Node: Any {}
impl<T: ?Sized> Node for T where T: Any {}
define!({
pub struct Class {
pub span: Span,
pub de... | 25.256637 | 64 | 0.565076 |
9c4ab19b84978152cefc6bc4d6d5aac07824fc10 | 1,338 | // Copyright (c) 2021, Roel Schut. 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::*;
use crate::utils::convert::TryInstanceFrom;
#[derive(NativeClass)]
#[inherit(Sprite)]
pub struct PlayerBullet {
#[property(default = 100.0)]... | 26.235294 | 108 | 0.578475 |
486564bde37dcb71c3b68f5cc743e812972ab0bf | 1,721 | // spell-checker:ignore getconf
use std::fmt::{self, Display, Formatter};
#[cfg(any(target_os = "linux", target_os = "macos"))]
use std::process::{Command, Output};
/// Operating system architecture in terms of how many bits compose the basic values it can deal with.
#[cfg_attr(feature = "serde", derive(serde::Serial... | 27.31746 | 102 | 0.558977 |
e4e548a7c63681869453f1490079ee9aa7ac5331 | 30,201 | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
//! This module supports translations of specifications as found in the move-model to
//! expressions which can be used in assumes/asserts in bytecode.
use codespan_reporting::diagnostic::Severity;
use itertools::Itertools;
use std::co... | 40.702156 | 100 | 0.546174 |
d79c81ba1dc5958ebc2ad5ddaa158e0ef34b2c10 | 1,034 | mod memory;
mod mmap;
pub use memory::ArrayReader;
pub use mmap::MMappedReader;
use serde::Serialize;
use std::io::{Read, Result, Seek};
#[derive(Debug, Serialize)]
pub struct Name {
pub id: usize,
pub instance: u32,
}
pub trait Reader: Seek + Read {
fn read_bool(&mut self) -> Result<bool>;
fn read_f... | 26.512821 | 45 | 0.598646 |
8fd2d77be3910475162bce8b5afd3619b3a2da59 | 48 | pub trait Deserialize {
fn deserialize();
}
| 12 | 23 | 0.666667 |
f7eca0d799b1372afeea2fe725ef261c7421fcc7 | 16,960 | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT
use crate::CellRenderer;
use crate::CellRendererMode;
use crate::IconSize;
use glib::object::Cast;
use glib::object::IsA;
use glib::object::ObjectType as ObjectType_;
use glib::s... | 33.784861 | 176 | 0.569693 |
50885e98d0b25916b957369bb9d2feb8e3f5fdbc | 1,474 | mod delete_blob_response;
pub use self::delete_blob_response::DeleteBlobResponse;
mod release_blob_lease_response;
pub use self::release_blob_lease_response::ReleaseBlobLeaseResponse;
mod change_blob_lease_response;
pub use self::change_blob_lease_response::ChangeBlobLeaseResponse;
mod renew_blob_lease_response;
pub us... | 42.114286 | 68 | 0.875848 |
4b8a88ab2ea4020d857bcb59bb1dc3d1e0eb68bd | 15,463 | // Copyright (c) 2018-2021 The MobileCoin Foundation
//! Serves blockchain-related API requests.
use grpcio::{RpcContext, RpcStatus, RpcStatusCode, UnarySink};
use mc_common::logger::{log, Logger};
use mc_consensus_api::{
blockchain,
consensus_common::{BlocksRequest, BlocksResponse, LastBlockInfoResponse},
... | 37.081535 | 100 | 0.599625 |
1a1f5389820c8ef7a35bab04cde1a0a8a6cd9a66 | 865 | // unihernandez22
// https://codeforces.com/problemset/problem/580/A
use std::io;
fn main() {
io::stdin().read_line(&mut String::new()).unwrap();
let mut s = String::new();
io::stdin().read_line(&mut s).unwrap();
let words: Vec<i64> = s.split_whitespace().map(|x| x.parse().unwrap()).colle... | 23.378378 | 86 | 0.485549 |
e90db682adf019d60a943518cd3022b14af6f0bd | 385 | // enums1.rs
// Make me compile! Execute `rustlings hint enums1` for hints!
#[derive(Debug)]
enum Message {
// TODO: define a few types of messages as used below
ChangeColor,
Echo,
Move,
Quit
}
fn main() {
println!("{:?}", Message::Quit);
println!("{:?}", Message::Echo);
println!("{:?}... | 20.263158 | 62 | 0.584416 |
5dcf5538b47c72649bfa77198ffd0b5309678455 | 8,459 | //! A trait to represent a stream
use crate::transport::smtp::{client::mock::MockStream, error::Error};
#[cfg(feature = "native-tls")]
use native_tls::{TlsConnector, TlsStream};
#[cfg(feature = "rustls-tls")]
use rustls::{ClientConfig, ClientSession};
#[cfg(feature = "native-tls")]
use std::io::ErrorKind;
#[cfg(featur... | 36.619048 | 95 | 0.547937 |
e4904863a94bc195a66b4d28e5e84e9abeeb1663 | 13,082 | // 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 ... | 28.688596 | 81 | 0.539444 |
7a1828b6739f1291bd7788a564b108c2bce8f824 | 7,291 | // 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.
pub mod nonce;
// Used in PRF as specified in IEEE Std 802.11-2016, 12.7.1.2.
use crate::Error;
use anyhow::ensure;
use mundane::hash::Digest;
#[allow(dep... | 38.172775 | 205 | 0.632424 |
2129df773dac651bfb6ea8317de8b34e291d0d53 | 100 | pub mod models;
pub mod operations;
#[allow(dead_code)]
pub const API_VERSION: &str = "2021-10-15";
| 20 | 43 | 0.72 |
72f1c36b01fe7a77ca6105d7333d90dd75056f9e | 10,593 | use crate::tokio::sync::mpsc::{channel, Receiver, Sender};
use crate::{error::Error, relay::RelayMessage, router::SenderPair};
use core::fmt::Formatter;
use ockam_core::compat::{string::String, vec::Vec};
use ockam_core::{Address, AddressSet};
/// Messages sent from the Node to the Executor
#[derive(Debug)]
pub enum N... | 33.735669 | 95 | 0.6172 |
fc19c9de76bdadd1bd1c9ecb804e40ad1f2ccb45 | 591 | use castflip::experimental::EncastArg;
use crate::{IData1, IVals1};
#[test]
fn idata1() {
let idata1 = IData1::gen();
let ne_vals_from_ne = IVals1 {
val1_i8: i8::encast( &idata1.ne_bytes[ 0 .. 1]).unwrap(),
val2_i8: i8::encast( &idata1.ne_bytes[ 1 .. 2]).unwrap(),
val_i16: i16::encast( &idata1.ne_b... | 29.55 | 61 | 0.632826 |
ff81f1164396a7f4f45f04b507015e11608f9908 | 21,682 | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... | 29.181696 | 120 | 0.619685 |
14bc33abde715a40ee291a00d706ae5d0efde309 | 1,363 | use super::*;
use std::fmt;
mod backtrace;
mod errno;
mod error;
mod to_errno;
pub use self::backtrace::{ErrorBacktrace, ResultExt};
pub use self::errno::Errno;
pub use self::errno::Errno::*;
pub use self::error::{Error, ErrorLocation};
pub use self::to_errno::ToErrno;
pub type Result<T> = std::result::Result<T, Err... | 25.240741 | 93 | 0.564197 |
0eb1136c3c46dd278165c467ec3b6a4fe7040b1f | 1,236 | // 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... | 32.526316 | 85 | 0.709547 |
76c59e99b3f65b1852703a4ae709a56e85006110 | 1,102 | //! Requires selenium running on port 4444:
//!
//! java -jar selenium-server-standalone-3.141.59.jar
//!
//! Run as follows:
//!
//! cargo run --example tokio_async
use thirtyfour::prelude::*;
use tokio;
#[tokio::main]
async fn main() -> WebDriverResult<()> {
let caps = DesiredCapabilities::chrome();
... | 29.783784 | 86 | 0.660617 |
d931ea88cdf41a5d69a6c58366044e8677b741af | 3,786 | // Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::identifier::{IdentStr, Identifier, ALLOWED_IDENTIFIERS};
use crate::test_helpers::assert_canonical_encode_decode;
use once_cell::sync::Lazy;
use proptest::prelude::*;
use regex::Regex;
use serde_json;
use std::borrow::Borrow... | 31.289256 | 99 | 0.622557 |
ccfce645310c2a9cc1578c25b3679665e145e102 | 4,039 | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under both the MIT license found in the
* LICENSE-MIT file in the root directory of this source tree and the Apache
* License, Version 2.0 found in the LICENSE-APACHE file in the root directory
* of this source tree.
*/
//! P... | 34.818966 | 98 | 0.698688 |
1e0fe993454f670aefd6bc54af3767c7843f339f | 10,686 | use super::duration_to_str;
use super::page::Page;
use super::MetaData;
use crate::db::Pool;
use crate::docbuilder::Limits;
use chrono::{DateTime, NaiveDateTime, Utc};
use iron::prelude::*;
use router::Router;
use serde::ser::{Serialize, SerializeStruct, Serializer};
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) s... | 34.694805 | 100 | 0.539491 |
fb05c196317a4f6575dc4a0af18a5dd8ada1c1ac | 7,620 | // Copyright 2014-2020 bluss and ndarray 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
... | 27.117438 | 99 | 0.535564 |
5d1d873b87af99682a18a9df316dba7de9c455c7 | 713 | pub const USER_STACK_SIZE: usize = 0x4000;
pub const KERNEL_STACK_SIZE: usize = 0x4000;
pub const KERNEL_HEAP_SIZE: usize = 0x20_0000;
#[cfg(feature = "board_qemu")]
pub const MEMORY_END: usize = 0x80A00000;
#[cfg(feature = "board_lrv")]
pub const MEMORY_END: usize = 0x100A00000;
pub const PAGE_SIZE: usize = 0x1000;... | 28.52 | 61 | 0.744741 |
feee5aa5561a8d1d8bf31c209ab50f708d47b78e | 5,780 | #[cfg(test)]
mod trivial {
use crate::types::KllFile;
#[test]
fn define() {
let result = dbg!(KllFile::from_str("myDefine => myCDefine;\n"));
assert!(result.is_ok());
}
#[test]
fn quoted() {
let result = dbg!(KllFile::from_str("\"Foo Bar\" = \"Baz Cubed\";\n"));
... | 25.462555 | 85 | 0.531142 |
61cc9531652a24d814f73ccddbf0b37adbab29ed | 28,968 | // Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
#![allow(unused_mut)]
use cli::{
association_address, client_proxy::ClientProxy, AccountAddress, CryptoHash,
TransactionArgument, TransactionPayload,
};
use libra_config::config::{NodeConfig, RoleType};
use libra_crypto::{ed2551... | 34.985507 | 100 | 0.619028 |
bb6d66a3266c003fb985a63840d9e8c6339a6888 | 4,073 | // Copyright 2021 Contributors to the Parsec project.
// SPDX-License-Identifier: Apache-2.0
use std::convert::{From, TryFrom};
use tss_esapi::{
handles::{ObjectHandle, PcrHandle},
tss2_esys::{
ESYS_TR, ESYS_TR_PCR0, ESYS_TR_PCR1, ESYS_TR_PCR10, ESYS_TR_PCR11, ESYS_TR_PCR12,
ESYS_TR_PCR13, ESYS_... | 45.764045 | 97 | 0.720108 |
b9f6ebebb8fbacfa81b245b91970f510d4a68af9 | 5,631 | use crate::cli::cli::{pre_exec, Colors, Palette};
use clap::{App, Arg, ArgMatches};
use fancy_regex::Regex;
pub struct Cmd {}
impl Cmd {
pub fn new() -> App<'static> {
App::new("du")
.args(&[
Arg::new("FILE").about("[FILE]"),
Arg::new("null").long("null").short(... | 56.31 | 220 | 0.524241 |
1878dd4618730d93d762fc941f926f506a9f023d | 570 | // Jump back and forth between the OS main thread and a new scheduler.
// The OS main scheduler should continue to be available and not terminate
// while it is not in use.
fn main() {
run(100);
}
fn run(i: int) {
log(debug, i);
if i == 0 {
return;
}
do task::task().sched_mode(task::Pla... | 21.111111 | 75 | 0.550877 |
d6e3296e397748d1f30d4bbf49025165c0ca87a3 | 1,722 | use libc::*;
pub const ERR_TXT_MALLOCED: c_int = 0x01;
pub const ERR_TXT_STRING: c_int = 0x02;
pub const ERR_LIB_PEM: c_int = 9;
pub const ERR_LIB_ASN1: c_int = 13;
const_fn! {
pub const fn ERR_PACK(l: c_int, f: c_int, r: c_int) -> c_ulong {
((l as c_ulong & 0x0FF) << 24) |
((f as c_ulong & 0xFFF... | 28.7 | 99 | 0.626016 |
39377b9d83d3f1035f634609b46620023dfa4295 | 489 | gui_main_project.pkg1.DepositWindow$10
gui_main_project.pkg1.DepositWindow$7
gui_main_project.pkg1.DepositWindow$6
gui_main_project.pkg1.DepositWindow$5
gui_main_project.pkg1.DepositWindow$4
gui_main_project.pkg1.DepositWindow$3
gui_main_project.pkg1.DepositWindow$2
gui_main_project.pkg1.DepositWindow$1
gui_main_projec... | 34.928571 | 38 | 0.897751 |
28f5dcf598fca62124d8b01a97a8afa703572a68 | 800 | #[derive(Serialize, Deserialize)]
pub struct ZipResult {
#[serde(rename="post code")]
post_code: String,
country: String,
#[serde(rename="country abbreviation")]
country_abbr: String,
places: Vec<Place>,
}
#[derive(Serialize, Deserialize)]
pub struct Place {
#[serde(rename="place name")]
... | 26.666667 | 97 | 0.6075 |
0e784ecac53323e7128132221a46ed81e52fc3ce | 3,076 | extern crate cc;
use std::env;
use std::path::{ Path, PathBuf };
use std::process::Command;
macro_rules! binary(() => (if cfg!(target_pointer_width = "32") { "32" } else { "64" }));
macro_rules! feature(($name:expr) => (env::var(concat!("CARGO_FEATURE_", $name)).is_ok()));
macro_rules! switch(($condition:expr) => (if... | 33.802198 | 91 | 0.519506 |
edcfac979fb3ef2c11a2e906385b1b1ce52c175f | 399 | use once_cell::sync::Lazy;
use wasmer::{imports, Function, ImportObject, Instance};
pub static IMPORT_OBJECTS: Lazy<ImportObject> = Lazy::new(|| imports! {});
pub fn seach_function<'a>(
instance: &'a Instance,
name: &'a str,
) -> Option<(&'a String, &'a Function)> {
instance
.exports
.iter... | 23.470588 | 74 | 0.573935 |
acbbdcfc7a7aee217f03266bf4bc91a44dacdd77 | 12,330 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// Service config.
///
///
/// Service configuration allows for customization of endpoints, region, credentials providers,
/// and retry configuration. Generally, it is constructed automatically for you from a shared
/// configuration loa... | 37.027027 | 113 | 0.625466 |
64a17ba220323d3b8c4eaff835322c9110b46cee | 4,906 | // Copyright (C) 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 according t... | 28.195402 | 95 | 0.502446 |
fc3a2731089eb406381f6ff37add7f4555b02f87 | 4,814 | // edition:2018
// aux-build: extern_crate.rs
#![crate_name = "foo"]
extern crate extern_crate;
// @has foo/fn.extern_fn.html '//pre[@class="rust fn"]' \
// 'pub fn extern_fn<const N: usize>() -> impl Iterator<Item = [u8; N]>'
pub use extern_crate::extern_fn;
// @has foo/struct.ExternTy.html '//pre[@class="rust s... | 37.317829 | 127 | 0.574366 |
ace23c086a4fb911f7395398020f67b740f0e8dd | 4,574 | #![deny(
warnings,
missing_docs,
missing_debug_implementations,
missing_copy_implementations,
trivial_casts,
trivial_numeric_casts,
unstable_features,
unused_import_braces
)]
//! node macro facilitates users of duid to use html-like syntax
//! for building view of web app components
ext... | 25.553073 | 79 | 0.537822 |
d7b7fc908528e57b852c9be9b861aed32e395295 | 1,914 | //! Utilities for inspecting unicode strings.
//!
//! # Usage
//! Use [DecodedString](decoding/struct.DecodedString.html) to wrap a sequence of bytes and a [rust-encoding](https://lifthrasiir.github.io/rust-encoding/) encoding.
//! ```
//! let bytes = [0x41, 0x42, 0x43];
//! let string = string_inspector::DecodedString... | 44.511628 | 165 | 0.669279 |
cce2a16297a1c6f3038a59503a79530a070c936f | 1,793 | // Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
use std::sync::Arc;
use engine_traits::{self, Error, Result};
use rocksdb::{DBIterator, SeekKey as RawSeekKey, DB};
// FIXME: Would prefer using &DB instead of Arc<DB>. As elsewhere in
// this crate, it would require generic associated types.
pub st... | 24.902778 | 71 | 0.59565 |
09d646681e2bdf18b0555a33c39f03eedc0eb233 | 2,437 | // Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors
// SPDX-License-Identifier: MIT
//! This channel is used to transmit p2p networking messages between actors.
use std::net::SocketAddr;
use std::sync::Arc;
use tezedge_actor_system::actors::*;
use tezos_messages::p2p::encoding::metadata::Metadat... | 27.077778 | 89 | 0.703734 |
0af5fa1e7701358ace38a997b333bb80ec4c2879 | 1,109 | use std::collections::HashMap;
use std::io;
fn main() {
let mut ids = Vec::new();
loop {
let mut buf = String::new();
match io::stdin().read_line(&mut buf) {
Ok(_) => {
if buf == "\n" {
break;
}
ids.push(buf)
... | 22.632653 | 60 | 0.32642 |
d5cfc9b6d6b6c06e0fd69ccaa7fd50a8a8e7f73d | 9,519 | extern crate specs;
use specs::prelude::*;
use super::{Attributes, Skills, WantsToMelee, Name,
HungerClock, HungerState, Pools, skill_bonus,
Skill, Equipped, Weapon, EquipmentSlot, WeaponAttribute, Wearable, NaturalAttackDefense,
effects::*};
pub struct MeleeCombatSystem {}
impl<'a> System<'a> for MeleeCo... | 50.1 | 169 | 0.479987 |
f95229d07750204f27e18816b1989118f4c20ab2 | 680 | #[macro_use]
extern crate plaster;
#[macro_use]
extern crate wasm_bindgen_test;
wasm_bindgen_test_configure!(run_in_browser);
use plaster::prelude::*;
use plaster::virtual_dom::VNode;
struct Comp;
impl Component for Comp {
type Message = ();
type Properties = ();
fn create(_: Self::Properties, _: Compo... | 17.894737 | 68 | 0.620588 |
bbea84529fd7fbc9815bef2d33f064c7047dab76 | 3,207 | #[macro_use]
extern crate serde_json;
#[cfg(test)]
mod tests {
use serde_json::Value;
use serde_pickle as pickle;
use std::fs::File;
use toml;
#[test]
fn test_dynamic_json() {
let j = r#"{
"userid": 103609,
"verified": true,
"friendly_name": "Jason",... | 28.891892 | 86 | 0.494855 |
5b1ae167ce31543850a1475dcf5f9379536baaa6 | 2,299 | // http://rust-lang.org/COPYRIGHT.
//
// #[test_case] is used by custom test authors to mark tests
// When building for test, it needs to make the item public and gensym the name
// Otherwise, we'll omit the item. This behavior means that any item annotated
// with #[test_case] is never addressable.
//
// We mark item... | 33.318841 | 85 | 0.599826 |
908e4acb8d96dbc36d780fea8684b2ae352b9f40 | 1,039 | use shell2batch;
#[test]
fn convert() {
let script = shell2batch::convert(
r#"
set -x
export FILE1=file1
export FILE2=file2
#this is some test code
cp ${FILE1} $FILE2
cp -r ${DIR1} $DIR2
#another
mv file2 file3
export MY_DIR=direct... | 16.758065 | 104 | 0.620789 |
2f71230d5729faa26ee6d5d3bd9c3e430b301d0d | 332 | mod file;
mod misc;
mod projfs;
mod result;
mod windows;
mod zip;
pub use crate::{
file::OnexFile,
misc::{OffsetSeeker, ReadSeek, SeekableVec},
projfs::ProjfsProvider,
result::{Error, Result},
windows::{get_temp_dir, raw_str_to_os_string, to_u16_vec},
zip::{extract_zip, list_zip_contents, zip_a... | 20.75 | 62 | 0.704819 |
f53d40f5f8f89ff90b4da9f09e3c9e8d6b60f861 | 9,316 | use crate::{
ast,
types::{DefaultAttribute, FieldWithArgs, ScalarField, ScalarType, SortOrder},
walkers::{EnumWalker, ModelWalker, Walker},
ParserDatabase, ScalarFieldType,
};
use diagnostics::Span;
/// A scalar field, as part of a model.
#[derive(Debug, Copy, Clone)]
pub struct ScalarFieldWalker<'db> ... | 30.644737 | 120 | 0.560434 |
236730a287ff2b799033dcf789253912c1990df5 | 2,991 | use crate::event::{LogEvent, Value};
use rlua::prelude::*;
impl<'a> ToLua<'a> for LogEvent {
fn to_lua(self, ctx: LuaContext<'a>) -> LuaResult<LuaValue> {
ctx.create_table_from(self.into_iter().map(|(k, v)| (k, v)))
.map(LuaValue::Table)
}
}
impl<'a> FromLua<'a> for LogEvent {
fn from_... | 31.15625 | 94 | 0.452023 |
75821e08a47e34fc82a33a6b31f732e88e4100aa | 40,723 | use crate::bounding_volume::{BoundingSphere, BoundingVolume, AABB};
use crate::mass_properties::MassProperties;
use crate::math::{Isometry, Point, Real, Vector};
use crate::query::{PointQuery, RayCast};
#[cfg(feature = "serde-serialize")]
use crate::shape::SharedShape;
#[cfg(feature = "std")]
use crate::shape::{composi... | 28.984342 | 98 | 0.606365 |
03dff108770413c0959f4c24fbf8d6eb3a468bfc | 154,090 | //! This module contains the "cleaned" pieces of the AST, and the functions
//! that clean them.
pub mod inline;
pub mod cfg;
mod simplify;
mod auto_trait;
mod blanket_impl;
pub mod def_ctor;
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
use rustc_data_structures::sync::Lrc;
use rustc_target::spec::abi::Ab... | 35.851559 | 100 | 0.495386 |
f95494a569b2f6a31c6d79ad3df0cdd257c40d5e | 1,172 | use crate::structure::guid_prefix::GuidPrefix_t;
use speedy::{Readable, Writable};
/// This message is sent from an RTPS Writer to an RTPS Reader
/// to modify the GuidPrefix used to interpret the Reader entityIds
/// appearing in the Submessages that follow it.
#[derive(Debug, PartialEq, Readable, Writable)]
pub stru... | 31.675676 | 76 | 0.590444 |
e246c3c9238b3b2116cb465ef8f0bde0069a618f | 1,554 | use js_sys::{ArrayBuffer, DataView};
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use wasm_bindgen_futures::JsFuture;
use wasm_bindgen_test::*;
use web_sys::Response;
#[wasm_bindgen(module = "/tests/wasm/response.js")]
extern "wasm-bindgen" {
fn new_response() -> Response;
}
#[wasm_bindgen_test]
fn tes... | 33.06383 | 84 | 0.690476 |
09593afdb4b21d515f341c5dea6d8c903ec32f3a | 11,325 | //! Async-graphql integration with Wrap
#![warn(missing_docs)]
#![allow(clippy::type_complexity)]
#![allow(clippy::needless_doctest_main)]
use async_graphql::http::StreamBody;
use async_graphql::{
Data, FieldResult, IntoQueryBuilder, IntoQueryBuilderOpts, ObjectType, QueryBuilder,
QueryResponse, Schema, Subsc... | 35.280374 | 117 | 0.497572 |
6202daff418bfd42ae0561323bf9818381575a12 | 3,118 | // Copyright 2020 the Deno authors. All rights reserved. MIT license.
use super::{Context, LintRule};
use swc_common::Spanned;
use swc_ecma_ast::BinaryOp::{EqEq, EqEqEq, NotEq, NotEqEq};
use swc_ecma_ast::Expr::{Lit, Unary};
use swc_ecma_ast::Lit::Str;
use swc_ecma_ast::UnaryOp::TypeOf;
use swc_ecma_ast::{BinExpr, Modu... | 24.170543 | 76 | 0.589801 |
2f18554ffa3022acf09d3b188049c2f040b0340c | 15,125 | #![warn(rust_2018_idioms)]
use slab::*;
use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe};
#[test]
fn insert_get_remove_one() {
let mut slab = Slab::new();
assert!(slab.is_empty());
let key = slab.insert(10);
assert_eq!(slab[key], 10);
assert_eq!(slab.get(key), Some(&10));
ass... | 22.847432 | 80 | 0.543802 |
6950df95da0959fa0f4525987a941917162fd1a5 | 1,344 | use conquer_once::spin::Lazy;
use x86_64::structures::gdt::{Descriptor, GlobalDescriptorTable, SegmentSelector};
use x86_64::structures::tss::TaskStateSegment;
use x86_64::VirtAddr;
pub const DOUBLE_FAULT_IST_INDEX: u16 = 0;
static TSS: Lazy<TaskStateSegment> = Lazy::new(|| {
let mut tss = TaskStateSegment::new()... | 27.428571 | 82 | 0.659226 |
33b7483fb5620550dbcde0b6c1cea08179a3b140 | 11,363 | // Copyright Materialize, Inc. 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 the Apache License... | 38.259259 | 101 | 0.63918 |
0afa4c4cf01899cdcf7fe1be94acac41936835ce | 1,202 | use actix_web::{delete, get, post, web, Responder};
use sqlx::PgPool;
use crate::user::active_code::model::ActiveCode;
use crate::crud::{CRUD, deal_result};
#[post("/active_code/create")]
async fn create(new: web::Json<ActiveCode>, db_pool: web::Data<PgPool>) -> impl Responder {
let result = ActiveCode::create(new... | 34.342857 | 94 | 0.698835 |
d5a4827a142ffcd40ae82f341354e9f4c4915336 | 1,119 | use super::{error::Error, name_restriction::check_measurement};
use derive_more::{Deref, Display};
use std::{borrow::Borrow, convert::TryFrom};
///The part of the InfluxDB data structure that describes the data stored in the associated fields.
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Hash, Display, Deref... | 25.431818 | 99 | 0.643432 |
8985c13cd4b79cd7373c9266ce022cd239971078 | 2,516 | extern crate rand;
use std::hash::{Hash, Hasher};
use std::time::{Duration, Instant};
use rand::{thread_rng, Rng};
use crate::config::Config;
#[derive(Debug, Clone)]
pub struct Peer {
config: Config,
uri: String,
ping_at: Instant,
stable_at: Instant,
inactive_at: Instant,
remove_at: Instant... | 23.296296 | 86 | 0.566375 |
f95e48d37c20d734512ea5ffc8e341d35701f576 | 2,494 | // This file was ((taken|adapted)|contains (data|code)) from twitch_api,
// Copyright 2017 Matt Shanker
// It's licensed under the Apache License, Version 2.0.
// 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-... | 23.980769 | 80 | 0.599038 |
b96e87c6545a8a83418dea3fbaa970fc45135b27 | 128 | use gdnative::prelude::*;
#[derive(ToVariant)]
pub struct Foo {
#[variant(aoeu = "aoeu")]
bar: String,
}
fn main() {}
| 12.8 | 29 | 0.585938 |
503e8b26912b89e81e9d871b75269b9fd56d0a93 | 1,165 | pub mod database;
pub mod external;
pub use database::LocalDatabase;
pub use external::AuthServer;
pub use super::key::KeyAttestation;
use sshcerts::ssh::{CertType, Extensions};
#[derive(Debug)]
pub enum AuthorizationError {
CertType,
NotAuthorized,
AuthorizerError,
}
#[derive(Debug)]
pub struct Authori... | 22.403846 | 44 | 0.711588 |
1d7828d397b40fbd65dadcef7ff71928f7f96e02 | 283 | extern crate catalyst_protocol_sdk_rust;
use catalyst_protocol_sdk_rust::prelude::*;
use catalyst_protocol_sdk_rust::Cryptography::ErrorCode;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn can_access_value_of_error_code(){
ErrorCode::NO_ERROR.value();
}
} | 23.583333 | 56 | 0.720848 |
de031f4f1bca7e29ff244abc9b360d0afc3caa16 | 52 | pub mod css;
pub mod dom_creator;
pub mod printing;
| 13 | 20 | 0.769231 |
8fc4a88d1fe6bf8b201636de07deb1ab00b98584 | 1,893 | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_lambda::{Client, Error, Region, PKG_VERSION};
use std::str;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
struct Opt {
/// The ... | 29.578125 | 84 | 0.622293 |
abfb6bfdae6abad202e5aef3ed912a69eb02bae0 | 75 | pub use crate::{
regular_cell_data::*,
transition_cell_data::*,
};
| 15 | 28 | 0.64 |
3381377c4c2f1ae7b5c4bdd0e255f9e8c26a108d | 2,519 | #[doc = "Reader of register MICR"]
pub type R = crate::R<u32, super::MICR>;
#[doc = "Writer for register MICR"]
pub type W = crate::W<u32, super::MICR>;
#[doc = "Register MICR `reset()`'s with value 0"]
impl crate::ResetValue for super::MICR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Typ... | 31.886076 | 133 | 0.588329 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.