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 |
|---|---|---|---|---|---|
180f13d03719529ce41a74f5116be50658d35b85 | 708 | // 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 ... | 32.181818 | 74 | 0.689266 |
9197442bc90e5cc003c7c560307c8f459bf446e2 | 8,914 | // Generated from definition io.k8s.api.core.v1.PersistentVolumeClaimSpec
/// PersistentVolumeClaimSpec describes the common attributes of storage devices and allows a Source for provider-specific attributes
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PersistentVolumeClaimSpec {
/// AccessModes contains... | 53.698795 | 785 | 0.601862 |
5dab787cba7d9071872dbe695ee2fd19b71f8ee2 | 22,482 | use self::{
module::ModuleEntryIter,
thread::{ThreadIdIter, ThreadIter},
};
pub use self::{
module::{Module, ModuleEntry, ModuleInfo},
thread::{PriorityLevel, Thread},
};
use crate::{Error, Handle, WinResult};
use bitflags::bitflags;
use std::{
ffi::{OsStr, OsString},
mem,
ops::Deref,
os... | 33.858434 | 180 | 0.55391 |
abeb1ef1ea0b02ad629fbef981357c6e9e1c90cf | 445 | use amethyst_assets::Handle;
use amethyst_core::ecs::{Component, DenseVecStorage};
use amethyst_rendy::Texture;
/// Image used UI widgets, often as background.
#[derive(Debug, Clone, PartialEq)]
pub enum UiImage {
/// An image backed by texture handle
Texture(Handle<Texture>),
/// An image entirely covered... | 26.176471 | 55 | 0.719101 |
7a19ee5de4201c9279d2fd8201b31b6de56b4e17 | 4,555 | //! COM runtime facilities
//!
//! This includes initializing the COM runtime as well as creating instances of COM classes
use crate::sys::{
CoCreateInstance, CoGetClassObject, CoIncrementMTAUsage, CoInitializeEx, CoUninitialize,
CLSCTX_INPROC_SERVER, CLSID, COINIT_APARTMENTTHREADED, COINIT_MULTITHREADED, FAILE... | 32.077465 | 102 | 0.669155 |
ebdc3bb9c09baf670fd9f0ce05a22c8d0ef7b497 | 1,550 | use regex::Regex;
fn parse(data: &str) -> Vec<i64> {
let re = Regex::new(r"-?\d+").unwrap();
re.find_iter(data)
.map(|c| c.as_str().parse::<i64>().unwrap())
.collect()
}
fn shoot(mut vx: i64, mut vy: i64, limits: &[i64]) -> (bool, i64) {
let mut x = 0i64;
let mut y = 0;
let is_wit... | 22.794118 | 94 | 0.455484 |
d9f1b6a3240a43c27c0c226459ec8e600cf255c4 | 4,552 | #[doc = "Register `PRO_DCACHE_MEM_SYNC1` reader"]
pub struct R(crate::R<PRO_DCACHE_MEM_SYNC1_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<PRO_DCACHE_MEM_SYNC1_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<PRO_DCACHE_MEM_SYNC1_SPEC>> fo... | 43.769231 | 421 | 0.690466 |
14c636ef45af13f3b6e287ca580bd9b7b8d66e17 | 10,219 | #[doc = "Reader of register HC11_INT"]
pub type R = crate::R<u32, super::HC11_INT>;
#[doc = "Writer for register HC11_INT"]
pub type W = crate::W<u32, super::HC11_INT>;
#[doc = "Register HC11_INT `reset()`'s with value 0"]
impl crate::ResetValue for super::HC11_INT {
type Type = u32;
#[inline(always)]
fn re... | 28.62465 | 86 | 0.533614 |
d6a97b799e094aa354e1ac7c3717789526455019 | 1,618 | use crate::bidiiter::rectstate::OnRectState;
use crate::BidiRect;
use crate::BidiView;
use std::iter::Iterator;
/// An iterator type returning items in a rectangular region.
pub struct OnRect<'v, T: 'v, V: BidiView<Output = T>> {
pub(super) view: &'v V,
pub(super) rect: BidiRect,
pub(super) state: OnRectSt... | 32.36 | 84 | 0.605686 |
9c26bf86dd3d9bc3f9b9a3ae68d5e4d87983bc6c | 1,401 | mod build;
mod cmd;
mod common;
mod config;
mod proxy;
mod serve;
mod watch;
use std::path::PathBuf;
use anyhow::Result;
use structopt::StructOpt;
#[async_std::main]
async fn main() -> Result<()> {
let cli = Trunk::from_args();
if let Err(err) = cli.run().await {
eprintln!("{}", err.to_string());
... | 25.472727 | 76 | 0.625268 |
0efaa13d701770c8fb1227cfec96d6f528d55a84 | 1,015 | use crate::channel::{
embed::Embed,
message::{AllowedMentions, MessageFlags},
};
use serde::{Deserialize, Serialize};
/// Optional extra data sent when responding to an [`Interaction`] of type
/// [`ApplicationCommand`].
///
/// This is used when intending to send a message in the response.
///
/// [`Interact... | 36.25 | 92 | 0.706404 |
9103e12e8e66fdded75788720b304b0848b5b098 | 1,384 | // Definition for a binary tree node.
// #[derive(Debug, PartialEq, Eq)]
// pub struct TreeNode {
// pub val: i32,
// pub left: Option<Rc<RefCell<TreeNode>>>,
// pub right: Option<Rc<RefCell<TreeNode>>>,
// }
//
// impl TreeNode {
// #[inline]
// pub fn new(val: i32) -> Self {
// TreeNode {
// val,
... | 26.615385 | 85 | 0.477601 |
76b1ea8e5cf241af08d642cb8a6cc6ed0c5bd41a | 4,078 | use crate::{Error, STEAM_URL};
use reqwest::{Request, RequestBuilder, Response, Url};
#[derive(Debug, Clone)]
/// Verifies the login details returned after users have gone through the 'sign in with Steam' page
/// # Example
/// ```
/// # use steam_auth::Verifier;
/// # struct Response; impl Response { fn new() -> Sel... | 38.838095 | 649 | 0.633399 |
33ba85d593e3b80d77cca5d17d31d8b467dc61a4 | 234 | // variables2.rs
// Make me compile! Execute the command `rustlings hint variables2` if you want a hint :)
fn main() {
let x:u32 = 0;
if x == 10 {
println!("Ten!");
} else {
println!("Not ten!");
}
}
| 18 | 89 | 0.534188 |
90999c878189b0deb300e83dc532d2e69a5bde94 | 289 | //! Tests auto-converted from "sass-spec/spec/non_conformant/scss-tests/171_test_loud_comment_in_compressed_mode.hrx"
#[test]
fn test() {
assert_eq!(
crate::rsass(
"/*! foo */\
\n"
)
.unwrap(),
"/*! foo */\
\n"
);
}
| 19.266667 | 117 | 0.49481 |
2f4913507d07879a3c793f9f41dfdaa29cdeae6e | 19,954 | use std::sync::Arc;
use piston_meta::bootstrap::Convert;
use range::Range;
use Dfn;
/// Stores a Dyon type.
#[derive(Debug, Clone, PartialEq)]
pub enum Type {
/// Whether a statement is never reached.
Unreachable,
/// A no-type.
Void,
/// Any type.
Any,
/// Boolean type.
Bool,
/// ... | 37.089219 | 102 | 0.423825 |
d7a6d39c367c61bbdeab73cef80a41b16891b4ad | 23,463 | use sdl2::event::Event;
use sdl2::image::{InitFlag, LoadTexture};
use sdl2::keyboard::Keycode;
use sdl2::messagebox::ClickedButton;
use sdl2::messagebox::*;
use sdl2::pixels::Color;
use sdl2::rect::Rect;
use sdl2::render::{Canvas, Texture};
use sdl2::video::Window;
// use shakmaty::{Board, Chess, File, Move, Position,... | 38.717822 | 99 | 0.466905 |
cc65e95766c1d66cffe2d29969ead8ef6c5689cc | 46,894 | //! Convert HTML to text formats.
//!
//! This crate renders HTML into a text format, wrapped to a specified width.
//! This can either be plain text or with extra annotations to (for example)
//! show in a terminal which supports colours.
//!
//! # Examples
//!
//! ```rust
//! # use html2text::from_read;
//! let html ... | 33.809661 | 100 | 0.51529 |
896f0d720e01bc7a4c20076e9807ab53f7330315 | 436 | use hello_macro::HelloMacro;
use hello_macro_derive::HelloMacro;
#[macro_export]
macro_rules! vec2 {
( $( $x:expr ),* ) => {
{
let mut temp_vec = Vec::new();
$(
temp_vec.push($x);
)*
temp_vec
}
};
}
#[derive(HelloMacro)]
struct ... | 15.034483 | 42 | 0.470183 |
03844b83d7988a402e6ff6b03de040b2419a5314 | 7,302 | // Copyright 2017 TiKV Project Authors. Licensed under Apache-2.0.
use crate::time::{monotonic_raw_now, Instant};
use std::cmp::{Ord, Ordering, Reverse};
use std::collections::BinaryHeap;
use std::sync::{mpsc, Arc};
use std::thread::Builder;
use std::time::Duration;
use time::Timespec;
use tokio_executor::park::ParkTh... | 28.523438 | 94 | 0.607779 |
d587344d6549b5d6b668e02c92aeb403613c5663 | 32,201 | use crate::{CoreStage, Plugin, PluginGroup, PluginGroupBuilder, StartupSchedule, StartupStage};
pub use bevy_derive::AppLabel;
use bevy_ecs::{
event::{Event, Events},
prelude::{FromWorld, IntoExclusiveSystem},
schedule::{
IntoSystemDescriptor, Schedule, ShouldRun, Stage, StageLabel, State, StateData... | 34.147402 | 120 | 0.567902 |
e6018ac2c992de4520a6228659a78a25da326782 | 22,824 | extern crate rltk;
use rltk::{ RGB, Rltk, Console, Point, VirtualKeyCode };
extern crate specs;
use specs::prelude::*;
use super::{Pools, gamelog::GameLog, Map, Name, Position, State, InBackpack,
Viewshed, RunState, Equipped, HungerClock, HungerState, rex_assets::RexAssets,
Hidden, camera, Attributes, Attribute... | 40.976661 | 149 | 0.570189 |
cc1008419062697f2e0483f35189d6aaf068c25f | 237 |
use crate::*;
pub struct DebugContainer {
}
impl DebugContainer {
}
impl BuildHandler for DebugContainer {
fn on_build(&mut self, state: &mut State, entity: Entity) {
}
}
impl EventHandler for DebugContainer {
} | 11.285714 | 63 | 0.662447 |
75dfed2ce303e67036740d4fc9cb7945a453d250 | 342 | fn main() {
let mut count = 0u32;
println!("Let's count until infinity!");
loop {
count += 1;
if count == 3 {
println!("three");
continue;
}
println!("{}", count);
if count == 5 {
println!("OK,that's enough");
bre... | 14.25 | 44 | 0.388889 |
ebcea597552f941bc900c49cc16a09d1cd6257b2 | 793 | //! State storage code for Zebra. 🦓
#![doc(html_favicon_url = "https://www.zfnd.org/images/zebra-favicon-128.png")]
#![doc(html_logo_url = "https://www.zfnd.org/images/zebra-icon.png")]
#![doc(html_root_url = "https://doc.zebra.zfnd.org/zebra_state")]
#![warn(missing_docs)]
#![allow(clippy::try_err)]
mod config;
mod... | 24.030303 | 79 | 0.718789 |
acc80c0f3e4e80c3120c727e7511548cb93c8a9f | 2,503 | // WARNING: This file was autogenerated by jni-bindgen. Any changes to this file may be lost!!!
#[cfg(any(feature = "all", feature = "android-database-StaleDataException"))]
__jni_bindgen! {
/// public class [StaleDataException](https://developer.android.com/reference/android/database/StaleDataException.html)
... | 71.514286 | 355 | 0.671994 |
219ad97b6efb9c37ee9cb6108588ae30b43d5bf5 | 3,793 | use byteorder::{NetworkEndian, ReadBytesExt, WriteBytesExt};
use std::error::Error;
use std::io::prelude::*;
use deserialize::{self, FromSql};
use pg::Pg;
use serialize::{self, IsNull, Output, ToSql};
use sql_types;
#[cfg(feature = "quickcheck")]
mod quickcheck_impls;
#[derive(Debug, Clone, PartialEq, Eq, FromSqlRow... | 32.418803 | 96 | 0.558397 |
1e226baead897ff39152f9b38319f4f900bb1c18 | 12,878 | //! Implementation of Chalk debug helper functions using TLS.
use std::fmt;
use chalk_ir::{AliasTy, GenericArg, Goal, Goals, Lifetime, ProgramClauseImplication, TypeName};
use itertools::Itertools;
use super::{from_chalk, Interner};
use crate::{db::HirDatabase, CallableDef, TypeCtor};
use hir_def::{AdtId, AssocContai... | 35.871866 | 95 | 0.514909 |
1d4e38f5512e7b0211550c25f28e8c8b9e2f23bd | 1,347 | use bevy::prelude::*;
fn main() {
App::build()
.add_default_plugins()
.add_startup_system(setup.system())
.add_system(animate_sprite_system.system())
.run();
}
fn animate_sprite_system(
texture_atlases: Res<Assets<TextureAtlas>>,
mut query: Query<(&mut Timer, &mut TextureAt... | 33.675 | 95 | 0.651819 |
2980390912292b664bc29f65d9d86604655f790b | 2,941 | use crate::cpu::{read, CPU};
use crate::ppu::PPU;
use crate::NROM;
pub fn abs(cpu: &mut CPU, ppu: &mut PPU, n_rom: &NROM, mem: &[u8]) -> (u16, usize) {
let ll = read(cpu, ppu, &n_rom, mem, cpu.pc) as u16;
let hh = read(cpu, ppu, &n_rom, mem, cpu.pc + 1) as u16;
cpu.pc += 2;
((hh << 8) | ll, 4)
}
pub f... | 36.308642 | 86 | 0.571234 |
8a6fe16868269197ca7c68e895ad782825309e36 | 3,064 | mod engine;
mod synchronization;
use rand::random;
use protocol::types::{
Address, Block, Bytes, Hash, Hasher, Header, Hex, MerkleRoot, Proof, Validator,
};
use crate::status::CurrentStatus;
const _HEIGHT_TEN: u64 = 10;
fn _mock_block_from_status(status: &CurrentStatus) -> Block {
let block_header = Header... | 29.747573 | 90 | 0.546345 |
d94c0af634f67a66eea948e5065cad9edea4163c | 7,909 | //! Displays spheres with physically based materials.
use amethyst::{
assets::AssetLoaderSystemData,
core::{
ecs::{Builder, ReadExpect, Resources, SystemData},
Transform, TransformBundle,
},
renderer::{
camera::Camera,
light::{Light, PointLight},
mtl::{Material, M... | 32.547325 | 100 | 0.516753 |
386987eb181ea9c411c213b5a802f3b058122ded | 9,431 | use crate::utils::sugg::Sugg;
use crate::utils::{
differing_macro_contexts, eq_expr_value, is_type_diagnostic_item, snippet_with_applicability, span_lint_and_then,
};
use if_chain::if_chain;
use rustc_errors::Applicability;
use rustc_hir::{Block, Expr, ExprKind, PatKind, QPath, StmtKind};
use rustc_lint::{LateConte... | 35.723485 | 117 | 0.421482 |
0adca8dcde701ccdc6380fe3229a83c7523243e6 | 17,379 | // Copyright 2017 The xi-editor Authors.
//
// 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 ag... | 33.485549 | 105 | 0.558202 |
cceb373d552a86ba682c5f63121bf6496979f2fa | 9,736 | use crate::iter::LoopState;
use crate::ops::Try;
/// An iterator able to yield elements from both ends.
///
/// Something that implements `DoubleEndedIterator` has one extra capability
/// over something that implements [`Iterator`]: the ability to also take
/// `Item`s from the back, as well as the front.
///
/// It ... | 31.713355 | 94 | 0.526191 |
165039241229613ae43b3a630794f0bdd0c51317 | 12,738 | #![cfg(not(feature="safe"))]
#[cfg(feature="std")]
use std::{panic,thread, io};
#[cfg(feature="std")]
use std::io::Write;
use core;
use brotli_decompressor::ffi::alloc_util;
use brotli_decompressor::ffi::alloc_util::SubclassableAllocator;
use brotli_decompressor::ffi::interface::{
brotli_alloc_func,
brotli_free_f... | 32.578005 | 127 | 0.680562 |
14ccc12e3653be42607ca9c3d389563d6a4fbcf8 | 1,622 | use std::ops::{Index, IndexMut};
use std::sync::atomic::{AtomicU8, Ordering};
use flume::Sender;
use crate::app::message::Message;
use crate::app::sort::Sortable;
#[derive(Debug)]
pub struct ArrayController {
array: Vec<u8>,
sender: Sender<Message>,
last_mut: (usize, AtomicU8),
}
impl ArrayController {
... | 23.171429 | 86 | 0.602959 |
e82ef8b3b52bfae74c8ba2f3d7fe1028918c9b3e | 20,508 | //! metrics tracked by kitsune_p2p spaces
use std::collections::HashMap;
use std::collections::VecDeque;
use std::sync::Arc;
use tokio::time::Instant;
use crate::types::event::*;
use crate::types::*;
use kitsune_p2p_timestamp::Timestamp;
use kitsune_p2p_types::agent_info::AgentInfoSigned;
use num_traits::*;
/// ho... | 30.978852 | 96 | 0.543056 |
eb7da19b3f50ef224f29101ff234bf4e293091c1 | 13,014 | #[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::CALCTRL {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w m... | 26.944099 | 61 | 0.512602 |
8f3439ed7fe5f9f2f0e96ab31a7c7de3594ccfb1 | 47 |
pub enum Theme {
Default,
ClassicDMG
} | 9.4 | 16 | 0.617021 |
8f69a0d111f495af6fd704a52b3125e5c73b1d92 | 262 | //! Converter traits for things that can be converted into tokens.
use super::tokens::Tokens;
/// Helper trait to convert something into tokens.
pub trait IntoTokens<'el, C> {
/// Convert the type into tokens.
fn into_tokens(self) -> Tokens<'el, C>;
}
| 26.2 | 66 | 0.694656 |
ccf23332a3df446d45c083808c640810278b1632 | 4,019 | // Generated from definition io.k8s.api.apps.v1beta2.DaemonSetUpdateStrategy
/// DaemonSetUpdateStrategy is a struct used to control the update strategy for a DaemonSet.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct DaemonSetUpdateStrategy {
/// Rolling update config params. Present only if type = "Rollin... | 39.792079 | 120 | 0.540931 |
500e52c7afa926b836373299539888b18ecdbaf1 | 1,359 | #pragma version(1)
#pragma rs java_package_name(layers)
rs_allocation In_Blob;
rs_allocation Out_Blob;
float num;
float __attribute__((kernel)) compute(float4 in, uint32_t x)
{
float sum = 0;
for(int i=0;i<100;i++){
float4 s = (in + i) * in;
sum += s.x + s.y + s.z + s.w;
//sum += dot(in... | 23.033898 | 71 | 0.590876 |
2f16712bceb981379f3a0930d384c69a8b3ec2aa | 3,860 | use crate::parse_instruction::{ParsableProgram, ParseInstructionError, ParsedInstructionEnum};
use bincode::deserialize;
use serde_json::json;
use solana_sdk::{
instruction::CompiledInstruction, loader_instruction::LoaderInstruction, pubkey::Pubkey,
};
pub fn parse_bpf_loader(
instruction: &CompiledInstruction... | 38.6 | 98 | 0.601295 |
0a50e71ea00242efd3ecb082137a28f6cf14c896 | 268 | use super::{Consumer, ConsumerError, Context};
use crate::stat::Alias;
use clibri::client;
pub async fn handler<E: client::Error>(
error: Option<ConsumerError<E>>,
context: &mut Context,
consumer: Consumer<E>,
) {
context.inc_stat(Alias::Shutdown);
}
| 22.333333 | 46 | 0.686567 |
0a6265371a0e3c53a4e1f00b1955dad597c2a035 | 9,748 | extern crate sample;
use defs;
use shared::{
event::EngineEvent,
parameter::{
BaseliskPluginParameters,
ParameterId,
},
};
use engine::{
buffer::ResizableFrameBuffer,
filter::{
BiquadCoefficients,
BiquadSampleHistory,
get_lowpass_second_order_biquad_consts,
... | 37.206107 | 89 | 0.555088 |
9b4f8788895593f783dd4e518842a0453fe5ab7b | 33,158 | use std::convert::TryInto;
use std::ffi::c_void;
use std::ptr::null;
use std::slice;
use std::sync::Arc;
use libc::size_t;
use rustls::server::{
AllowAnyAnonymousOrAuthenticatedClient, AllowAnyAuthenticatedClient, ClientCertVerifier,
ClientHello, NoClientAuth, ResolvesServerCert, ServerConfig, ServerConnection... | 42.07868 | 149 | 0.659569 |
183a3d6bca83703f35ec11539689b8e1cbdffc7b | 41 | mod macros;
pub mod serial;
pub mod vga;
| 10.25 | 15 | 0.731707 |
f7c34eb745cb86ee77fab0d945ff89e2776f7c7a | 1,725 | use super::action::Action;
/// Describes a edit context for modifying a line.
#[derive(Debug)]
pub struct EditContext {
action: Option<Action>,
content: Option<String>,
}
impl EditContext {
/// Create a new empty instance.
#[must_use]
pub const fn new() -> Self {
Self {
action: None,
content: None,
}
... | 21.835443 | 85 | 0.666667 |
891125534197b8774ba1e47ffffaf8936218114a | 6,894 | use std::marker::PhantomData;
use super::methods::*;
use super::protocol::Protocol;
use super::protocol::ProtocolId;
use super::RPCError;
use crate::rpc::protocol::Encoding;
use crate::rpc::protocol::Version;
use crate::rpc::{
codec::{base::BaseOutboundCodec, ssz_snappy::SSZSnappyOutboundCodec, OutboundCodec},
... | 37.672131 | 95 | 0.615753 |
e900e7578fdb3e4705837752b9c4face253822c8 | 1,458 | use std::{collections::HashMap, ops::AddAssign};
use anyhow::Result;
use itertools::Itertools;
fn id(a: &str, i: usize) -> char {
a.chars().nth(i).unwrap()
}
pub fn day14(path: &str) -> Result<()> {
let file = std::fs::read_to_string(path)?;
dbg!(&file);
let (template, rules) = file.split_once("\n\n"... | 30.375 | 93 | 0.527435 |
1d78bdadad4a7ab3a267e91864eebfc67b11b0c5 | 21,950 | use crate::conversion::coords::{CoordSeq, CoordType, ToSFCGALGeom};
use crate::{
utils::check_null_geom, GeomType, Point2d, Result, SFCGeometry, ToCoordinates, ToSFCGAL,
};
use failure::Error;
use sfcgal_sys::{
sfcgal_geometry_collection_add_geometry, sfcgal_geometry_collection_create,
sfcgal_geometry_colle... | 40.127971 | 155 | 0.554579 |
de7d74cf2319fe9461c4006bdf037d666d11c726 | 1,998 | #![cfg_attr(not(feature = "std"), no_std)]
pub use self::aggregator::ExchangePrices;
use ink_lang as ink;
#[ink::contract]
mod aggregator {
#[cfg(not(feature = "ink-as-dependency"))]
use ink_storage::collections::HashMap as StorageHashMap;
#[ink(storage)]
pub struct ExchangePrices {
/// Mapp... | 25.615385 | 77 | 0.525526 |
62a64912eceed990e2fcb4f35206c204b43739d4 | 3,833 | extern crate bindgen;
use std::env;
fn main() {
let out_path = env::current_dir().unwrap();
// For native targets, include all types and functions
bindgen::Builder::default()
.header(
out_path
.join("../spirv_cross/src/wrapper.hpp")
.to_str()
... | 40.347368 | 82 | 0.632142 |
115ff5d4bfccf9a523712535171a9f6e36214599 | 1,018 | // structs1.rs
// Address all the TODOs to make the tests pass!
struct ColorClassicStruct {
name: String,
hex: String,
}
struct ColorTupleStruct(String, String);
#[derive(Debug)]
struct UnitStruct;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn classic_c_structs() {
// TODO: Instanti... | 22.622222 | 92 | 0.594303 |
9c547e87215e656853f37e8c5d603658a50c8205 | 2,743 | use std::{thread, time::Duration};
use naia_server::{Event, Server as NaiaServer, ServerAddrs, ServerConfig};
use naia_tickless_demo_shared::{get_shared_config, Protocol, Text};
use naia_empty_world::{EmptyEntity, EmptyWorldRef};
type Server = NaiaServer<Protocol, EmptyEntity>;
pub struct App {
server: Server,... | 34.721519 | 94 | 0.532629 |
db10bfb9f3883b99c4fee56b15c4d9b8108caef0 | 11,288 | use wasm_bindgen::prelude::*;
use std::collections::HashMap;
use super::color_conversion;
use wasm_bindgen::JsValue;
use crate::p5_wasm::P5Wasm;
// color/p5.Color.js
#[wasm_bindgen]
pub struct Color {
array: Vec<f64>,
pub(crate) levels: Vec<f64>,
mode: String,
maxes: HashMap< String, Vec<f64> >,
pub(crate) hsba: ... | 27.46472 | 126 | 0.557938 |
cce0f1023729fe944e72bfe36e5b3664a399ea66 | 4,996 | use super::*;
use crate::test::freeze_timeout;
#[test]
fn with_different_process_sends_message_when_timer_expires() {
TestRunner::new(Config::with_source_file(file!()))
.run(
&(milliseconds(), strategy::process()).prop_flat_map(|(milliseconds, arc_process)| {
(
... | 34.455172 | 96 | 0.533026 |
d9f32435326887a7255ad8bcb9eadd9027e6fb87 | 3,658 | //! Program state processor
use {
crate::{
instruction::AssociatedTokenAccountInstruction,
tools::account::{create_pda_account, get_account_len},
*,
},
borsh::BorshDeserialize,
solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint::ProgramR... | 30.231405 | 100 | 0.66047 |
79b16622632eff50b265bc94abc2062f3ac14cd6 | 8,250 | //! This module provides a token source (`GetToken`) that obtains tokens for service accounts.
//! Service accounts are usually used by software (i.e., non-human actors) to get access to
//! resources. Currently, this module only works with RS256 JWTs, which makes it at least suitable for
//! authentication with Google... | 28.745645 | 102 | 0.653818 |
0ea494851a8e8f86e11d5a8cb15f3d7e598ad672 | 8,510 | use pairing::{
CurveAffine,
CurveProjective,
Engine,
PrimeField,
Field,
PrimeFieldRepr
};
use std::sync::Arc;
use std::io;
use bit_vec::{self, BitVec};
use std::iter;
// use futures::{Future};
use super::multicore::Worker;
use super::SynthesisError;
/// An object that builds a source of bases.... | 27.275641 | 111 | 0.519624 |
ff44a0a92af90b0e8209e57d28962ba6f2ed0532 | 1,727 |
pub struct IconGrain {
props: crate::Props,
}
impl yew::Component for IconGrain {
type Properties = crate::Props;
type Message = ();
fn create(props: Self::Properties, _: yew::prelude::ComponentLink<Self>) -> Self
{
Self { props }
}
fn update(&mut self, _: Self::Message) -> yew::prelu... | 37.543478 | 542 | 0.551824 |
50c87e54ca764ed477be9576680f9beafb92448b | 10,880 | use super::is_valid_nick;
#[derive(Debug, PartialEq)]
pub enum Error {
MissingCommand,
MissingData,
MissingTarget,
MissingParts,
InvalidNickname,
UnknownCommand,
}
#[derive(Debug, PartialEq, Clone)]
pub enum Command {
Privmsg {
target: String,
data: String,
is_notic... | 27.474747 | 96 | 0.408915 |
def19990b96f5d2a4d2f227df3934f1805a936a6 | 4,509 | // Copyright (c) 2015 Daniel Grunwald
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publis... | 46.484536 | 115 | 0.694389 |
ed808f5dabfaa38c6aecf1fe48fb1620ba477a74 | 13,509 | #![allow(unused_braces)]
//! # Direct Memory Access Controller
//!
//! This library provides a type-safe API with compile-time guarantees
//! that the peripheral and individual DMA channels are correctly configured
//! before launching a DMA transfer.
//!
//! This module currently supports most basic DMA
//! functions... | 34.027708 | 99 | 0.65201 |
ff76ab2728da046bb5481c85ae6fdd956b512ab1 | 1,375 | /// An event on the "Standard Gamepad" from w3c shown below.
///
/// 
pub enum Event {
/// Bottom right cluster (A / Circle / Return / Right Click).
Accept(bool),
/// Bottom right cluster (B / X / Shift).
Cancel(bool),
/// Leftmo... | 25 | 75 | 0.571636 |
89c74f338dc68deec85f61ed31f9dc222b692c69 | 3,651 | // copyright 2018 the google ai language team authors and the huggingface inc. team.
// copyright (c) 2018, nvidia corporation. all rights reserved.
// copyright (c) 2019 the sticker developers.
//
// licensed under the apache license, version 2.0 (the "license");
// you may not use this file except in compliance with... | 28.302326 | 85 | 0.57628 |
cc2414706cdb5ec0183f9e57bbdc922042ca72fa | 5,948 | // Copyright 2020 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT
// http://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD
// https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied,
// modified, or di... | 39.390728 | 97 | 0.653665 |
4b4e5d9fcc891132f3b8116a5b05be3c9bdd3e7b | 3,523 | use actix_web::{get,web, HttpResponse, Responder,HttpRequest};
use super::super::{AppState,Song};
use mongodb::{bson::{doc},options::FindOptions};
use futures::stream::{StreamExt};
use chrono::{Utc,DateTime,NaiveDateTime};
use serde::{Deserialize, Serialize};
#[get("/")]
pub async fn index(_request: HttpRequest) -> i... | 34.203883 | 126 | 0.565711 |
90c2439dc34f4556322f383bc0e672c6069618dc | 814 | #![warn(clippy::non_send_fields_in_send_ty)]
#![feature(extern_types)]
use std::rc::Rc;
// Basic tests should not be affected
pub struct NoGeneric {
rc_is_not_send: Rc<String>,
}
unsafe impl Send for NoGeneric {}
pub struct MultiField<T> {
field1: T,
field2: T,
field3: T,
}
unsafe impl<T> Send for ... | 18.5 | 62 | 0.663391 |
395551ea29f1902f8cf6bcdff731a895a6e18cc0 | 840 | // errors4.rs
// Make this test pass! Execute `rustlings hint errors4` for hints :)
use std::num::ParseIntError;
#[derive(PartialEq, Debug)]
struct PositiveNonzeroInteger(u64);
#[derive(PartialEq, Debug)]
enum CreationError {
Negative,
Zero,
}
impl PositiveNonzeroInteger {
fn new(value: i64) -> Result<... | 22.702703 | 73 | 0.638095 |
714f77ede310c7b6d1391ad5e51c6253ff8582f5 | 2,715 | // 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 ... | 28.28125 | 98 | 0.624678 |
e695acd7d06c35248c0fb386c2ddeddd3439be87 | 5,908 | // Copyright 2018-2021 Cargill Incorporated
//
// 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... | 36.02439 | 112 | 0.635917 |
edd8e9948dc6ba1c1631d003e0d01c41eab72f64 | 8,049 | use std::{self, os::raw::*, ptr, time::Instant};
use crate::platform_impl::platform::{app_state::AppState, ffi};
#[link(name = "CoreFoundation", kind = "framework")]
extern "C" {
pub static kCFRunLoopCommonModes: CFRunLoopMode;
pub fn CFRunLoopGetMain() -> CFRunLoopRef;
pub fn CFRunLoopWakeUp(rl: CFRunLo... | 33.123457 | 98 | 0.654615 |
f9fc22b9050cc4b211c241c21f1d89e74e76c532 | 6,564 | //! Demo-code for showing how egui is used.
//!
//! The demo-code is also used in benchmarks and tests.
// Forbid warnings in release builds:
#![cfg_attr(not(debug_assertions), deny(warnings))]
// Disabled so we can support rust 1.51:
// #![deny(
// rustdoc::broken_intra_doc_links,
// rustdoc::invalid_codebloc... | 40.518519 | 890 | 0.699573 |
f50f759d4c092f1281fb36dfe6a94d055a4deb3c | 1,643 | #![allow(non_upper_case_globals)]
extern crate libc;
use libc::{c_void, c_int, c_ulonglong, c_char, size_t};
include!("src/core.rs");
include!("src/crypto_aead_chacha20poly1305.rs");
include!("src/crypto_auth.rs");
include!("src/crypto_auth_hmacsha256.rs");
include!("src/crypto_auth_hmacsha512.rs");
include!("src/c... | 29.339286 | 57 | 0.772368 |
1104a5fde84389eb00a59979e985fb56e07155d2 | 9,566 | #[doc = r" Value read from the register"]
pub struct R {
bits: u8,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u8,
}
impl super::CHCFG3 {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut ... | 27.97076 | 212 | 0.529375 |
e6c9d0b0ab000790cbd7bab015df5e5e0febe80e | 1,746 | use crate::builtin;
use rustc_hir::HirId;
use rustc_middle::{lint::LintExpectation, ty::TyCtxt};
use rustc_session::lint::LintExpectationId;
use rustc_span::symbol::sym;
pub fn check_expectations(tcx: TyCtxt<'_>) {
if !tcx.sess.features_untracked().enabled(sym::lint_reasons) {
return;
}
let fulfil... | 34.92 | 89 | 0.646048 |
115a68954cf2fca39424a7193384c517dc0e643a | 4,449 | use super::{scheduled_task::ScheduledTask, Schedule};
use crate::{broker::Broker, error::BeatError, protocol::TryCreateMessage};
use log::{debug, info};
use std::collections::BinaryHeap;
use std::time::{Duration, SystemTime};
const DEFAULT_SLEEP_INTERVAL: Duration = Duration::from_millis(500);
/// A [`Scheduler`] is ... | 33.201493 | 99 | 0.581479 |
6169f8b83314463aef4b40672c04ec249ec84a8c | 10,170 | //! A library to interface with libatasmart-sys. For more information about libatasmart-sys see
//! [libatasmart-sys](https://github.com/cholcombe973/libatasmart-sys)
//! This library is useful for gathering ata smart information from your hard drives concerning
//! their remaining lifetime. The underlying libatasmar... | 34.948454 | 126 | 0.558997 |
eb1b999b3b19431b9537208a663219f9b1926d49 | 3,841 | //! Chain parameters, can be modified by proposals.
use config::ChainParameterConfig;
#[doc(inline)]
pub use proto::state::ChainParameter;
pub fn default_parameters() -> impl IntoIterator<Item = (ChainParameter, i64)> {
use ChainParameter::*;
return vec code generator ... | 43.960976 | 221 | 0.678429 |
899218d037e7da4cf5d86588f77e1f94e0e5d6ae | 1,076 | #[doc = "Reader of register DSCR2"]
pub type R = crate::R<u32, super::DSCR2>;
#[doc = "Writer for register DSCR2"]
pub type W = crate::W<u32, super::DSCR2>;
#[doc = "Register DSCR2 `reset()`'s with value 0"]
impl crate::ResetValue for super::DSCR2 {
#[inline(always)]
fn reset_value() -> Self::Ux { 0 }
}
#[doc... | 29.081081 | 98 | 0.58829 |
fbb99f30b8ff88ecda3b3adb11898d99f31255d3 | 5,806 | use ibc_proto::ibc::core::commitment::v1::MerkleProof;
use crate::core::ics02_client::client_consensus::AnyConsensusState;
use crate::core::ics02_client::client_def::ClientDef;
use crate::core::ics02_client::client_state::AnyClientState;
use crate::core::ics02_client::context::ClientReader;
use crate::core::ics02_clie... | 31.048128 | 88 | 0.631932 |
e47cc3d133a51076dfc57133ab8c073593ce18cd | 4,229 | extern crate serde;
use self::serde::de::value::{MapDeserializer, SeqDeserializer};
use self::serde::de::{
Deserialize, Deserializer, Error, IntoDeserializer, MapAccess, SeqAccess, Visitor,
};
use self::serde::ser::{Serialize, SerializeMap, SerializeSeq, Serializer};
use std::fmt::{self, Formatter};
use std::hash... | 25.475904 | 91 | 0.608182 |
48bbadac472483a52626718a97538c5ee132b315 | 2,054 | // Copyright 2018 Rust-NumExt 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 ac... | 30.205882 | 90 | 0.572055 |
678e33301460eb742764900d56c6057b7bb34ba7 | 20,348 | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
#![forbid(unsafe_code)]
mod error;
pub use error::Error;
use anyhow::Result;
use diem_crypto::{
ed25519::Ed25519Signature,
hash::{
EventAccumulatorHasher, TransactionAccumulatorHasher, ACCUMULATOR_PLACEHOLDER_HASH,
... | 33.140065 | 111 | 0.656969 |
918fa5f7dc12467bb6a19fd5601756d5ccf027eb | 12,508 | use clippy_utils::diagnostics::span_lint_and_then;
use clippy_utils::higher;
use clippy_utils::ty::is_type_diagnostic_item;
use clippy_utils::{differing_macro_contexts, path_to_local, usage::is_potentially_mutated};
use if_chain::if_chain;
use rustc_errors::Applicability;
use rustc_hir::intravisit::{walk_expr, walk_fn,... | 38.018237 | 107 | 0.514471 |
9c8212621619e63e6f5abff29b15ce16c51ba047 | 1,731 | #![feature(test)]
extern crate test;
use solana::bank::*;
use solana::mint::Mint;
use solana::status_deque::MAX_ENTRY_IDS;
use solana_sdk::hash::hash;
use solana_sdk::signature::{Keypair, KeypairUtil};
use solana_sdk::system_transaction::SystemTransaction;
use solana_sdk::transaction::Transaction;
use test::Bencher;
... | 29.844828 | 94 | 0.580589 |
ff64436fc91fa7f838add7eb3bfd3670ed7bc904 | 16,177 | //! The [Value] trait describes what operations can be performed on interpreter values. The
//! interpreter usually executes using [DataValue]s so an implementation is provided here. The fact
//! that [Value] is a trait, however, allows interpretation of Cranelift IR on other kinds of
//! values.
use core::convert::Try... | 40.042079 | 140 | 0.541633 |
1e472f259f0190c45c9340a893fe00bd7e16da7c | 3,372 | #[doc = "Reader of register LIMITH"]
pub type R = crate::R<u32, super::LIMITH>;
#[doc = "Writer for register LIMITH"]
pub type W = crate::W<u32, super::LIMITH>;
#[doc = "Register LIMITH `reset()`'s with value 0"]
impl crate::ResetValue for super::LIMITH {
type Type = u32;
#[inline(always)]
fn reset_value() ... | 26.761905 | 86 | 0.534401 |
11682afdf899ba0580be428629ebf1cb6a655c7d | 85,839 | //! Rustdoc's HTML rendering module.
//!
//! This modules contains the bulk of the logic necessary for rendering a
//! rustdoc `clean::Crate` instance to a set of static HTML pages. This
//! rendering process is largely driven by the `format!` syntax extension to
//! perform all I/O into files and streams.
//!
//! The ... | 35.136717 | 140 | 0.504666 |
f4dd294669c4118b1e6b2c68f3cb054447e37b9f | 9,989 | use std::{ptr, mem, cmp};
use std::sync::atomic::{AtomicUsize, AtomicBool};
use std::sync::atomic::Ordering::{SeqCst};
use std::sync::{Mutex, Condvar};
use alloc::heap::{allocate, deallocate};
use std::cell::{Cell};
use select::{_Selectable, WaitQueue, Payload};
use alloc::{oom};
use {Error, Sendable};
const CACHE_LI... | 30.454268 | 90 | 0.530584 |
ef0ea4e730ae098736a75b9c157ef720c061cdc9 | 63,744 | /*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not u... | 37.696038 | 221 | 0.580792 |
72dcea0bd9c9365142117a1dda89f60d07d9e756 | 6,696 | use syscall::{self, O_CLOEXEC, O_STAT, O_CREAT, O_EXCL, O_DIRECTORY, O_WRONLY, O_NOFOLLOW, TimeSpec};
use core::slice;
use libc::{c_int, c_char, off_t, mode_t, size_t, ssize_t};
use ::types::{utimbuf, timeval};
pub const PATH_MAX: usize = 4096;
libc_fn!(unsafe access(path: *mut c_char, _amode: c_int) -> Result<c_int... | 35.428571 | 121 | 0.635454 |
effc861e0fd48720692f6a97e37537ee15515198 | 2,023 | use std::io::{Result, Write};
use std::fs::{File, OpenOptions, read_dir};
use chrono::{DateTime, Utc};
fn main() {
println!("cargo:rerun-if-changed=./src/");
updata_version_number().unwrap();
insert_app_data().unwrap();
}
fn updata_version_number() -> Result<()> {
let now: DateTime<Utc> = Utc::now();
... | 26.973333 | 105 | 0.544241 |
161431ca56347a1320c86df71c026053cb9ca20a | 325 | // Copyright 2020-2021 The FuseQuery Authors.
//
// SPDX-License-Identifier: Apache-2.0.
use warp::Filter;
use crate::configs::Config;
pub fn hello_handler(
cfg: Config,
) -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
warp::path!("v1" / "hello").map(move || format!("{:?}", cfg... | 23.214286 | 79 | 0.646154 |
69038d348e25ab4223bdb40cf666ff8794c64972 | 11,948 | //! Protocol logic specific to processing ICS3 messages of type `MsgConnectionOpenAck`.
use crate::core::ics03_connection::connection::{ConnectionEnd, Counterparty, State};
use crate::core::ics03_connection::context::ConnectionReader;
use crate::core::ics03_connection::error::Error;
use crate::core::ics03_connection::... | 40.639456 | 121 | 0.551892 |
338c29235436d0a230472600ecc31b66504882db | 594 | //! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_1355.hrx"
#[allow(unused)]
fn runner() -> crate::TestRunner {
super::runner()
}
#[test]
#[ignore] // wrong error
fn test() {
assert_eq!(
runner().err(
"@function test() {\
\n @return;\
\n}\... | 21.214286 | 83 | 0.427609 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.