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 |
|---|---|---|---|---|---|
ff839aef53eccbd48281df951e6151d797cf0216 | 25,359 | // Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
#![allow(clippy::field_reassign_with_default)]
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_json::Value as JsonValue;
use serde_with::skip_serializin... | 33.019531 | 184 | 0.703182 |
9b71f516212a920341339b706adc851225236948 | 4,402 | #[doc = "Register `RISE` reader"]
pub struct R(crate::R<RISE_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<RISE_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<RISE_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<RISE_SP... | 42.326923 | 419 | 0.648342 |
621c4c21bfcc7fab11ba70a3eb406537be122112 | 991 | /*
Copyright ⓒ 2016 rust-custom-derive contributors.
Licensed under the MIT license (see LICENSE or <http://opensource.org
/licenses/MIT>) or the Apache License, Version 2.0 (see LICENSE of
<http://www.apache.org/licenses/LICENSE-2.0>), at your option. All
files in the project carrying such notice may not be copied, m... | 28.314286 | 70 | 0.694248 |
ab8e989787b160bbf2c1e633bf15a6c61f42d9c6 | 1,041 | use std::{
env,
fmt::{self, Debug, Display},
path::PathBuf,
};
#[derive(Clone)]
pub struct RootPath(PathBuf);
impl Default for RootPath {
fn default() -> Self {
Self(
env::current_dir()
.expect("current dir")
.canonicalize()
.expect("c... | 21.244898 | 68 | 0.535062 |
1d946b0e1040d7b27ad96a0214997f854ab1fac1 | 624,862 | #![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use super::{models, models::*, API_VERSION};
pub mod big_data_pools {
use super::{models, models::*, API_VERSION};
pub async fn get(
operation_config: &crate::OperationConfig,
subs... | 48.855512 | 366 | 0.594818 |
4805f9dc6f904c6e41318e002446e22879736bb0 | 2,556 | ///
/// Since Rust is a little different and having global variable is difficult
/// we need a place to have separate instances of players, with paddle images
/// and that counts their own score, and movement.
///
use ggez::event::{EventHandler, KeyCode};
use ggez::graphics::{self, Color, DrawParam, Mesh};
use ggez::{t... | 36.514286 | 137 | 0.616197 |
9138b96ad1bb632fcc39add9b87979d7a34b0782 | 5,399 | use crate::Entity;
use std::any::{Any, TypeId};
use std::fmt::Debug;
/// Determines how the event propagates through the tree
#[derive(Debug, Clone, PartialEq)]
pub enum Propagation {
/// Events propagate down the tree to the target entity, e.g. from grand-parent to parent to child (target)
Down,
/// Even... | 29.342391 | 119 | 0.594925 |
118bf52f38af3fde1d40a0bfb67f4cf81caacc94 | 223 | // As a quick test here, let's try dumping the generated bindings here...
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
include!(concat!(env!("OUT_DIR"), "/linux-bindgen.rs"));
| 37.166667 | 73 | 0.726457 |
1422dda276b9b0a78eba0956d6ac92543f909b3f | 300 | // Make sure that we're handling bound lifetimes correctly when validating trait
// bounds.
// run-pass
trait X<'a> {
type F: FnOnce(&i32) -> &'a i32;
}
fn f<T: for<'r> X<'r> + ?Sized>() {
None::<T::F>.map(|f| f(&0));
}
fn main() {
f::<dyn for<'x> X<'x, F = fn(&i32) -> &'x i32>>();
}
| 18.75 | 80 | 0.523333 |
bb284f78f285ae9719eb1d1c20a7e9dbffafe62b | 550 | // Function calls aren't allowed in static initialiers.
#[allow(dead_code)]
fn screen_area() -> usize {
640 * 480
}
const NBADGERS: usize = 8; // ok, 8 is a constant
static NBUNNIES: usize = NBADGERS * 50; // ok, constant expression
static NCARROTS: usize = screen_area() / 100; // erro... | 30.555556 | 92 | 0.654545 |
4a481beffd2a2c06d540bbaa50b2a32790d8da3c | 795 | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | 23.382353 | 68 | 0.70566 |
16a7c6d076c73d488c372642010b69f1a84efb9c | 1,573 | use dotenv::dotenv;
use serenity::{client::bridge::gateway::GatewayIntents, prelude::*};
use std::env;
mod commands;
mod database;
mod modules;
use modules::event_handler::Handler;
#[tokio::main]
async fn main() {
dotenv().ok();
database::core::migrate_database();
let token = env::var("DISCORD_TOKEN").ex... | 34.955556 | 96 | 0.6459 |
48ea9cd4e44754817b086816a467abba7e652a80 | 1,124 | use sdl2::VideoSubsystem;
use sdl2::video::Window;
use super::graphics::graphics_context::GraphicsContext;
use crate::core::graphics::renderer::Renderer;
pub struct AppWindow
{
sdl_window: Window,
graphics_context: GraphicsContext
}
impl AppWindow
{
pub fn new(video: &VideoSubsystem,
args: AppWin... | 22.48 | 65 | 0.605872 |
dd2ea59f787f1854199c36055f455630f722a26a | 8,169 | /// Calls a function and aborts if it panics.
///
/// This is useful in unsafe code where we can't recover from panics.
#[cfg(feature = "default")]
#[inline]
pub fn abort_on_panic<T>(f: impl FnOnce() -> T) -> T {
struct Bomb;
impl Drop for Bomb {
fn drop(&mut self) {
std::process:... | 28.968085 | 104 | 0.492716 |
09bd1c8492f919d8b4d6cf37df772ac1a3fc8892 | 202 | fn main() -> i32 {
//~^ ERROR `main` has invalid return type `i32`
//~| NOTE `main` can only return types that implement `std::process::Termination`
//~| HELP consider using `()`, or a `Result`
0
}
| 28.857143 | 81 | 0.633663 |
098aeb95b9e445349ef296c8df94b97c16981303 | 701 | use std::env;
use tools::{teprintln, tprintln, CompatibleDB, DB};
fn main() {
let args = env::args().collect::<Vec<String>>();
if args.len() < 2 {
teprintln!("Expected bano csv file");
return;
}
let mut db = DB::new("addresses.db", 10000, true).expect("failed to create DB");
bano::... | 25.962963 | 84 | 0.563481 |
503509544b95eac4ca6650ad9f30401b20694839 | 629 | use std::ops::Sub;
use num_traits::{CheckedAdd, One, Zero};
use num_traits::cast::{FromPrimitive, AsPrimitive};
use std::hash::Hash;
use std::fmt::{Debug, Display};
/// Trait for exponents in polynomials.
pub trait Exponent
: Hash
+ Zero
+ Debug
+ Display
+ One
+ FromPrimitive
+ AsPrimitive... | 17 | 51 | 0.54531 |
edd0d73bdb86dbc9e31c6986ed1404ac7b83ce40 | 4,792 | // Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
crate::rate_limiter::RateLimiterMonotonic,
anyhow::{Context as _, Error},
fidl_fuchsia_update_channel::{ProviderRequest, ProviderRequestS... | 35.235294 | 99 | 0.622496 |
9087dec4469403a84ac6a99ed4653f96798eb0ab | 5,898 | use serde::{Deserialize, Serialize};
use serde_json::Value as JsonValue;
pub mod file;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Idl {
pub version: String,
pub name: String,
pub instructions: Vec<IdlInstruction>,
#[serde(skip_serializing_if = "Option::is_none", default)]
... | 29.939086 | 87 | 0.561038 |
165dde64dbb336aac5c10c325cb93ea867ea930c | 8,782 | // Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::pool::AccountSeqNumberClient;
use crate::TxStatus;
use anyhow::Result;
use crypto::keygen::KeyGen;
use network_api::messages::{PeerTransactionsMessage, TransactionsMessage};
use network_api::PeerId;
use parking_lot::RwLoc... | 33.64751 | 100 | 0.64097 |
2306c9c93ec1f7254695257f999f67ed5f022c13 | 5,126 | use bytes::buf::BufMut;
use pin_project_lite::pin_project;
use std::{
io::Result,
pin::Pin,
task::{Context, Poll},
};
use tokio::io::{
AsyncBufRead as AsyncBufRead1, AsyncRead as AsyncRead1, AsyncWrite as AsyncWrite1, ReadBuf,
};
use tokio_02::{
io::{AsyncBufRead as AsyncBufRead02, AsyncRead as Asyn... | 29.45977 | 98 | 0.557745 |
d6f4ffcd3718769d5dde9df0462c2d10e9f44a70 | 406 | // Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
// kani-verify-fail
#![feature(core_intrinsics)]
use std::intrinsics;
// The code below attempts to zero-initialize type `&i32`, causing the intrinsic
// `assert_zero_valid` to generate a panic during compilation.
#[kani::proof]
fn main() {
... | 25.375 | 80 | 0.692118 |
fc613409194062a9d98aa99ad042bfda2500d7df | 3,099 | // 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... | 37.792683 | 97 | 0.60342 |
f560889218421b7c52cb7c6716ccbbe6034791fb | 124 | use crate::fetch_info;
use warp::reply::{json, Json};
pub fn invoke() -> Json {
let info = fetch_info();
json(&info)
}
| 15.5 | 30 | 0.629032 |
08ab9793182ca74685ffc2a76268713a685f5c7c | 9,577 | extern crate diff;
extern crate lalrpop_util;
use std::cell::RefCell;
use lalrpop_util::ParseError;
use util::tok::Tok;
/// demonstration from the Greene text; one of the simplest grammars
/// that still ensures we get parse tree correct
mod sub;
/// test something other than test-all
mod sub_ascent;
mod sub_table... | 26.901685 | 101 | 0.556646 |
0eff093beb4bdd639d7e79638bac733c5ebb87d2 | 14,424 | //! Defines `Body`: a lowered representation of bodies of functions, statics and
//! consts.
mod lower;
#[cfg(test)]
mod tests;
pub mod scope;
use std::{mem, ops::Index, sync::Arc};
use base_db::CrateId;
use cfg::{CfgExpr, CfgOptions};
use drop_bomb::DropBomb;
use either::Either;
use hir_expand::{
ast_id_map::Ast... | 33.466357 | 99 | 0.618067 |
ac06bc8f60ff725a5ad0719ec523f367ec0b10a9 | 30,764 | // Copyright (c) Microsoft. All rights reserved.
use std::sync::{Arc, RwLock};
use std::time::{Duration, Instant};
use base64;
use bytes::Bytes;
use chrono::{DateTime, Utc};
use futures::future::Either;
use futures::{future, Future};
use hyper::client::Service;
use hyper::{Error as HyperError, Method, Request, Respon... | 38.551378 | 146 | 0.493791 |
0ec6ff8eac3b2d01a65cbea9a5dc745bd4ecce00 | 705 | extern crate flate2;
use std::io::prelude::*;
use std::io;
use flate2::Compression;
use flate2::write::GzEncoder;
use flate2::bufread::GzDecoder;
// Compress a sample string and print it after transformation.
fn main() {
let mut e = GzEncoder::new(Vec::new(), Compression::default());
e.write(b"Hello World").u... | 28.2 | 74 | 0.662411 |
ab828fb1221380053e4d2f6d8f7b25502f32bedd | 1,686 | // Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
anyhow::{bail, Result},
ffx_core::ffx_plugin,
ffx_off_args::OffCommand,
fidl::Error as FidlError,
fidl_fuchsia_hardware_power_sta... | 29.578947 | 97 | 0.537367 |
b937e66a4d4a420ba91db6ed6ed360a7e6f64d49 | 512 | use structopt::StructOpt;
#[derive(StructOpt, Debug, Default, Clone)]
pub struct PredictCost {
/// The node type used for calculation.
#[structopt(short = "n", long = "node-type")]
pub node_type: String,
/// CPU requirement.
#[structopt(short = "c", long = "cpu")]
pub cpu: f32,
/// Cluste... | 24.380952 | 66 | 0.59375 |
91a750c20c4bc2e6b3e4e9245f02b0a4a9d7d731 | 2,231 | #[derive(Copy, Clone, Debug)]
struct Component {
left_pins: u16,
right_pins: u16,
}
impl Component {
fn from_str(s: &str) -> Self {
let mut iter = s.trim().split("/");
Component {
left_pins: iter.next().unwrap().parse().unwrap(),
right_pins: iter.next().unwrap().pars... | 29.355263 | 85 | 0.56701 |
1cabcbdc79a4f375d1b08b3fe63c42403656c3f0 | 79 | //pub mod contract;
pub mod error;
pub mod helper;
pub mod msg;
pub mod state;
| 13.166667 | 19 | 0.721519 |
4b5a634889a7920fa50cc16782547c17d850a504 | 4,197 | // 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... | 32.284615 | 80 | 0.57827 |
bff5863616ddb6957ebb1d42ddeab2b253f30ea1 | 608 | use azure_sdk_core::errors::AzureError;
use azure_sdk_cosmos::clients::{Client, ClientBuilder, CosmosUriBuilder};
use azure_sdk_cosmos::{AuthorizationToken, TokenType};
pub fn initialize() -> Result<Client<impl CosmosUriBuilder>, AzureError> {
let account = std::env::var("COSMOS_ACCOUNT").expect("Set env variable ... | 43.428571 | 99 | 0.75 |
3ac37b4b3e749c8f23ba90e6e83c4ee28e3573d9 | 2,095 | extern crate rand;
use std::{thread, time};
use rand::{thread_rng, Rng};
trait Observer {
fn update(&self, generator: Box<&NumberGenerator>);
}
struct DigitObserver {}
impl DigitObserver {
fn new() -> DigitObserver {
DigitObserver {}
}
}
impl Observer for DigitObserver {
fn update(&self, ge... | 21.597938 | 63 | 0.599045 |
1ce5cad7a312f4e40b35c3e54055e211cbf01b6a | 7,619 | use curl;
use curl::easy::{Auth, Easy2, Handler, List, WriteError};
use serde::Serialize;
use serde::de::DeserializeOwned;
use serde_json;
use std::fmt::Display;
struct Collector(Vec<u8>);
impl Handler for Collector {
fn write(&mut self, data: &[u8]) -> Result<usize, WriteError> {
self.0.extend_from_slice... | 28.011029 | 186 | 0.499278 |
91e8316e57507f8fcf4b9dd7d54cc22501caa33d | 1,389 | struct Solution {}
impl Solution {
pub fn insert(mut intervals: Vec<Vec<i32>>, mut new_interval: Vec<i32>) -> Vec<Vec<i32>> {
let start = intervals
.iter()
.map(|v| v[0])
.collect::<Vec<i32>>()
.binary_search(&new_interval[0]);
let mut start = match st... | 26.711538 | 94 | 0.432685 |
2fea75c79e6f4743d6a0e8c2f3a48588f3c13f74 | 2,628 | struct Ingredient {
prop: [i32; 5],
}
impl Ingredient {
fn new(s: &str) -> Ingredient {
let mut v = aoc::ints::<i32>(s);
Ingredient {
prop: [
v.next().unwrap(),
v.next().unwrap(),
v.next().unwrap(),
v.next().unwrap(),
... | 25.514563 | 84 | 0.479833 |
e81855213cd259a411ca1410c1f8a60561f6cd7d | 84,804 | //! # Fingerprints
//!
//! This module implements change-tracking so that Cargo can know whether or
//! not something needs to be recompiled. A Cargo `Unit` can be either "dirty"
//! (needs to be recompiled) or "fresh" (it does not need to be recompiled).
//! There are several mechanisms that influence a Unit's freshne... | 41.919921 | 99 | 0.610926 |
8a7ef3f2808b77bc92b94f42fa5832d198d55e55 | 4,709 | use std::sync::{Arc, Mutex};
use simple_parallel;
use state::LSystem;
use super::{LProcessor, SimpleProcessor};
/// Parallel processor dividing a state into chunks to be individually iterated
/// within a pool of threads.
pub struct ChunksProcessor {
/// The number of symbols per full chunk.
chunk_size: usize... | 37.373016 | 98 | 0.531323 |
61092fc9b7343cf350b1854ffda46167c9f4d375 | 2,709 | // 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 agre... | 29.769231 | 88 | 0.709856 |
e95a4626c4c04551fec06ebe5561c49fadfeb592 | 1,090 | pub mod rome;
use std::io;
fn read_eval(input: String, env: &mut rome::Model) -> Result<rome::Oexp, rome::RomeError> {
let (parsed_exp, _) = rome::parse(&rome::tokenise(input))?;
let evaluated_exp = rome::eval(&parsed_exp, env)?;
Ok(evaluated_exp)
}
fn slurp_input() -> String {
let mut input = ... | 27.25 | 91 | 0.511927 |
08472400cf1d3498aa53709efd8501c40f9107e1 | 31,596 | // This file is part of Substrate.
// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// ht... | 33.119497 | 99 | 0.572541 |
fbc8ec723c75812d7b22f7a8e86e08e1e8f1a505 | 1,537 | use cosmwasm_std::{Addr, Decimal, Uint128};
use cw_controllers::Claims;
use cw_storage_plus::{Item, Map};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
pub struct Config {
pub owner: Addr,
pub staking_token: Addr,
pub t... | 29 | 79 | 0.716981 |
691459f1220faa4f6501d839b7d4a2e769509553 | 10,280 | use std::fs;
use std::fs::File;
use std::io::prelude::*;
use std::io::BufWriter;
use std::path::PathBuf;
use std::time::SystemTime;
use crossbeam_channel::Receiver;
use crate::common::Common;
use crate::common_dir_traversal::{Collect, DirTraversalBuilder, DirTraversalResult, ErrorType, FileEntry, ProgressData};
use c... | 36.978417 | 161 | 0.606907 |
8a9d9f25c0c034fa9c65f17314f3e972e9b5aee0 | 22,857 | use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::io::{self, BufReader};
use std::path::PathBuf;
const IN: &str = "neon.spec";
const ARM_OUT: &str = "generated.rs";
const AARCH64_OUT: &str = "generated.rs";
const UINT_TYPES: [&str; 6] = [
"uint8x8_t",
"uint8x16_t",
"uint16x4_t",
"uint... | 30.435419 | 105 | 0.47854 |
891d6e1060df85cf3446ce270ae1e856c22f4400 | 9,868 | // Copyright (c) Facebook, Inc. and its affiliates.
//
// 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 applicabl... | 32.675497 | 93 | 0.537394 |
919b0f37dbd29b2d3872ffb2ea733d8af686c345 | 7,919 | use super::*;
pub(super) const PATTERN_FIRST: TokenSet = expressions::LITERAL_FIRST
.union(paths::PATH_FIRST)
.union(token_set![BOX_KW, REF_KW, MUT_KW, L_PAREN, L_BRACK, AMP, UNDERSCORE, MINUS, DOT]);
pub(crate) fn pattern(p: &mut Parser) {
pattern_r(p, PAT_RECOVERY_SET);
}
/// Parses a pattern list sepa... | 24.366154 | 101 | 0.454224 |
c1480d3d149eadfe8d92cdbf3019ee4d19961fb5 | 9,514 | use specs::prelude::*;
use super::*;
use crate::components::{Pools, Player, Attributes, Confusion, SerializeMe, Duration, StatusEffect,
Name, EquipmentChanged, Slow, DamageOverTime, Skills};
use crate::map::Map;
use crate::gamesystem::{player_hp_at_level, mana_at_level};
use crate::gamelog::GameLog;
use specs::sav... | 40.832618 | 109 | 0.490961 |
e2d7da45c81a92dc731fbb0e6849492cf545ab01 | 10,680 | #[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::FsHcint6 {
#[doc = r" Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(... | 24.895105 | 66 | 0.493258 |
4a8e66c042d9fcb0d491a76b79fba520a596e5cb | 1,896 |
pub struct IconVisibilityOff {
props: crate::Props,
}
impl yew::Component for IconVisibilityOff {
type Properties = crate::Props;
type Message = ();
fn create(props: Self::Properties, _: yew::prelude::ComponentLink<Self>) -> Self
{
Self { props }
}
fn update(&mut self, _: Self::Messag... | 41.217391 | 695 | 0.59019 |
69e55c972785bff3743400e3ad9aa4b1d5a98b9c | 1,962 | #[macro_use]
extern crate lua;
mod lib;
use lua::{Error, Index};
use lib::{example, vector};
use std::{env, fs, io};
fn main() {
let mut state = lua::State::new();
state.open_libs();
vector::load_lib("vec", &mut state).unwrap();
example::load_lib("rust", &mut state).unwrap();
// evaluate file... | 25.815789 | 96 | 0.514781 |
0eb604a783acde7c24780b46f83673cb0493912e | 8,089 | use crate::search::{Search, SearchCommand, SearchInfo, SearchResult, MAX_SEARCH_DEPTH};
use crossbeam_channel::{Receiver, Sender};
use eval::eval::{Eval, Score, CHECKMATE_BLACK, CHECKMATE_WHITE, EQUAL_POSITION, NEGATIVE_INF};
use movegen::move_generator::MoveGenerator;
use movegen::position_history::PositionHistory;
us... | 33.987395 | 97 | 0.518853 |
2311e13cb74a41ff530acc96afb1709d96e3b897 | 13,930 | //! Peripheral Reset and Enable Control (REC)
//!
//! This module contains safe accessors to the RCC functionality for each
//! periperal.
//!
//! At a minimum each peripheral implements
//! [ResetEnable](trait.ResetEnable.html). Peripherals that have an
//! individual clock multiplexer in the PKSU also have methods
//... | 39.129213 | 105 | 0.427207 |
1e20dca86c6f1be4b79b6af9f06e291aed1c49ab | 290 | // tests2.rs
// This test has a problem with it -- make the test compile! Make the test
// pass! Make the test fail! Execute `rustlings hint tests2` for hints :)
// I AM NOT DONE
#[cfg(test)]
mod tests {
#[test]
fn you_can_assert_eq() {
assert_eq!("test","test");
}
}
| 20.714286 | 74 | 0.62069 |
bf50c2d29095be04ba8e633b396a7f67158760eb | 6,473 | use crate::{
physics::camera::default_camera,
physics::player::PhysicsPlayer,
physics::BlockContainer,
player::{PlayerId, PlayerInput},
};
use nalgebra::Point3;
use std::{
collections::HashMap,
time::{Duration, Instant},
};
/// Input of the whole simulation.
#[derive(Debug, Clone, Default)]
pub... | 31.8867 | 102 | 0.615634 |
79a307f88aae83497b6d3bd2c819df4d1d4b1721 | 2,055 | use crate::{cmd::*, result::Result, wallet::Wallet};
use helium_api::accounts::{self, Account};
use prettytable::Table;
use qr2term::print_qr;
use serde_json::json;
/// Get wallet information
#[derive(Debug, StructOpt)]
pub struct Cmd {
/// Display QR code for a given single wallet.
#[structopt(long = "qr")]
... | 36.052632 | 87 | 0.567397 |
713e97e5fae808a9db6d2f03d37a1b0ffaa8024a | 903 | //! This crate contains computational geometry algorithms for [Rust CV](https://github.com/rust-cv/).
//!
//! ## Triangulation
//!
//! In this problem we know the relative pose of cameras and the [`Bearing`] of the same feature
//! observed in each camera frame. We want to find the point of intersection from all camera... | 27.363636 | 101 | 0.469546 |
91813e1db5209ba3554cfa211e9316f2c5405a05 | 36 |
mod serde;
mod display;
mod debug;
| 7.2 | 12 | 0.722222 |
1d3576244c4afc0d597389a18b5231e0a32fbf6d | 94,933 | //! This query borrow-checks the MIR to (further) ensure it is not broken.
use crate::borrow_check::nll::region_infer::RegionInferenceContext;
use rustc::hir::{self, HirId};
use rustc::hir::Node;
use rustc::hir::def_id::DefId;
use rustc::infer::InferCtxt;
use rustc::lint::builtin::UNUSED_MUT;
use rustc::lint::builtin:... | 40.022344 | 100 | 0.507758 |
f8aba7a0f97fa77cd88449fb84770decd44854cf | 3,762 | /**
* [0648] Replace Words
*
* In English, we have a concept called root, which can be followed by some other word to form another longer word - let's call this word successor. For example, when the root "an" is followed by the successor word "other", we can form a new word "another".
* Given a dictionary consistin... | 32.153846 | 280 | 0.607124 |
feb8026f501a871c113cd32b46038b2be9df8550 | 1,461 | // Copyright 2016 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 ... | 30.4375 | 86 | 0.720739 |
235563adc0980fd443a02ff0ebb55209bea73eaf | 884 | // Take a look at the license at the top of the repository in the LICENSE file.
use crate::EventType;
use glib::translate::*;
use std::fmt;
define_event! {
TouchEvent,
ffi::GdkTouchEvent,
ffi::gdk_touch_event_get_type,
&[EventType::TouchBegin, EventType::TouchUpdate, EventType::TouchEnd, EventType::To... | 26.787879 | 97 | 0.638009 |
2fc07e2cdd855b5ef03b9a508c9166707112916e | 46,568 | // Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use std::collections::HashMap;
use std::io::{ErrorKind, Read, Write};
use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
use std::os::unix::net::{UnixListener, UnixStream};
use std::path::Path;
use mio::... | 39.904027 | 142 | 0.554071 |
4ab35e74d575502ae591f8bf71930cccf7d42203 | 5,663 | //! A module that contains all the actions related to reading input from the terminal.
//! Like reading a line, reading a character and reading asynchronously.
mod input;
#[cfg(unix)]
mod unix_input;
#[cfg(windows)]
mod windows_input;
#[cfg(unix)]
pub use self::unix_input::SyncReader;
#[cfg(unix)]
use self::unix_inp... | 29.649215 | 166 | 0.648596 |
db40898f27a09110d950e800a689ae372238ffd1 | 26,593 | use crate::error::{ErrorResponse, RestApiResult};
use async_std::sync::{Arc, RwLock};
use factorio_bot_core::process::process_control::InstanceState;
use factorio_bot_core::types::{AreaFilter, FactorioEntity};
use rocket::serde::json::Json;
use rocket::State;
#[derive(FromForm, Debug, JsonSchema)]
pub struct FindEntit... | 34.225225 | 120 | 0.585116 |
fe5925f26f0ac206507734f27f46353339bd3818 | 9,153 | // 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... | 33.163043 | 77 | 0.488474 |
23175127f08d9bca29e4cffe7d9fb33a6aaa3986 | 7,768 | //! # WASM Encrypt/Decrypt Functions
//!
//! The library contains the `encrypt` and `decrypt` functions that are
//! exported for use in javascript via the WebAssembly interface (wasm).
//!
//! # Example Javascript Import
//! ```js
//! // Import the encrypt and decrypt functions.
//! // Must be in a module.
//! import ... | 30.825397 | 150 | 0.619851 |
d7fca6a8c8d2cd45cb8854b84331c1f9339d1876 | 11,548 | use serde::{Deserialize, Serialize};
use serde_json::json;
use serde_json::Value as Json;
use std::convert::TryFrom;
use svm_abi_decoder::CallData;
use svm_abi_encoder::{ByteSize, Encoder};
use svm_sdk_types::value::{Composite, Primitive, Value as SdkValue};
use svm_sdk_types::{Address, Amount};
use super::get_field... | 29.839793 | 98 | 0.52797 |
1128daf9c90ff2f8b8eea755d1bce3bb9574aa4f | 156 | // cargo-deps: reqwest
extern crate reqwest;
fn main() {
println!("{}", reqwest::get("https://www.rust-lang.org/en-US/").unwrap().text().unwrap());
}
| 19.5 | 94 | 0.615385 |
1c1b338236c71fa9e816ad7713737b94c003abef | 90 | use std::fs::File;
use std::io;
pub fn sync_files(source: ,target:) {
} | 11.25 | 37 | 0.522222 |
e8bdacfcd0d54c9efd6f0200d40aae891cfaba17 | 57,299 | use crate::internal_prelude::*;
use core::{
cmp::Ordering::{self, Equal, Greater, Less},
ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign},
time::Duration as StdDuration,
};
use core::convert::TryFrom;
use core::convert::TryInto;
/// A span of time with nanosecond precision.
///
//... | 30.723324 | 95 | 0.555559 |
d770796d8f9a352b69736195b8d2f67bee62194d | 531 | use actix_web::{post, HttpResponse, web, Error};
use crate::models::{publish_request::PublishRequest, publish_response::PublishResponse};
#[post("/publish")]
pub async fn publish(req: web::Json<PublishRequest>, res: web::Json<PublishResponse>) -> Result<HttpResponse, Error> {
translate_to_cache(req);
Ok(HttpR... | 33.1875 | 118 | 0.702448 |
38ca31bbbcb5985eb2869624ee2e58ad794a8f0e | 65 | #[macro_use]
extern crate log;
pub mod provider;
pub mod runner;
| 13 | 17 | 0.753846 |
c14e43a4964729ee769cb97a27f5715e255bd82c | 13,029 | //! Core traits for rule definitions and rule context.
//! As well as an internal prelude to make imports for rules easier.
#![allow(unused_variables, unused_imports)]
use crate::autofix::Fixer;
use crate::Diagnostic;
use dyn_clone::DynClone;
use rslint_errors::Severity;
use rslint_parser::{SyntaxNode, SyntaxNodeExt,... | 33.753886 | 153 | 0.604267 |
4bb57431beed90664c7e44e7bcbd4b83175120b0 | 34,048 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(clippy::unnecessary_wraps)]
pub fn parse_describe_affected_accounts_for_organization_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::output::DescribeAffectedAccountsForOrganizationOutput,
... | 41.07117 | 228 | 0.604294 |
91056c9f8c158db97ec53c96b749ea9cdd7aea8f | 3,730 | use std::time::Duration;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use xt::{Format, Handle};
criterion_main!(small, large);
criterion_group! {
name = small;
config = Criterion::default();
targets = small_json,
small_yaml,
small_toml,
small_msgp... | 24.539474 | 91 | 0.608847 |
913dbec65f10f1193c75dc819c3ce693319cd51a | 564 | //! Substrate Node Template CLI library.
#![warn(missing_docs)]
#![warn(unused_extern_crates)]
mod chain_spec;
mod service;
mod cli;
pub use substrate_cli::{VersionInfo, IntoExit, error};
fn run() -> cli::error::Result<()> {
let version = VersionInfo {
name: "Substrate Node",
commit: env!("VERGEN_SHA_SHORT"),
... | 21.692308 | 54 | 0.691489 |
2815f43ab6a2777f6e2361628258a037286e8cda | 5,939 | use crate::Error;
use ark_std::rand::{CryptoRng, Rng, SeedableRng};
use ark_std::{
cfg_chunks,
fmt::{Debug, Formatter, Result as FmtResult},
marker::PhantomData,
vec,
vec::Vec,
};
#[cfg(feature = "parallel")]
use rayon::prelude::*;
use super::pedersen;
use crate::variable_length_crh::VariableLength... | 31.42328 | 99 | 0.589662 |
29d1f045c9a09318ebad6239bf154384fd80f7e1 | 74 | /// An account is a user of the service.
pub mod database;
pub mod model;
| 18.5 | 40 | 0.716216 |
23645ab189aec1c06de223a6a6cad88f1eeceaac | 1,191 | #![crate_name = "lightning"]
//! Rust-Lightning, not Rusty's Lightning!
//!
//! A full-featured but also flexible lightning implementation, in library form. This allows the
//! user (you) to decide how they wish to use it instead of being a fully self-contained daemon.
//! This means there is no built-in threading/exe... | 38.419355 | 97 | 0.756507 |
f8564ee3223b512958142b2b4ad758a5c822139f | 252 | [
// https://tools.ietf.org/html/rfc3394#section-4.1
TestVector {
encryption_key: "000102030405060708090A0B0C0D0E0F",
plaintext: "00112233445566778899AABBCCDDEEFF",
ciphertext: "1FA68B0A8112B447AEF34BD8FB5A7B829D3E862371D2CFE5",
},
]
| 28 | 67 | 0.761905 |
fe06b2390bb6fbdcb51bcdfff007b7418e73c7b4 | 6,646 | mod thing;
use thing::*;
use crate::{controller::ControllerConfig, data::DittoDeviceStatus, ditto::Client as DittoClient};
use async_trait::async_trait;
use drogue_client::{
core::v1::Conditions,
meta::v1::{CommonMetadataExt, CommonMetadataMut},
openid::{AccessTokenProvider, OpenIdTokenProvider, TokenProv... | 26.690763 | 97 | 0.593139 |
1ef572faeac0cc53a273ac682e588ccc13c22669 | 3,724 | //! Tests auto-converted from "sass-spec/spec/core_functions/color/adjust_color/error/mixed_formats.hrx"
#[test]
#[ignore] // missing error
fn blue_and_lightness() {
assert_eq!(
crate::rsass(
"a {b: adjust-color(red, $blue: 1, $lightness: 1%)}\
\n"
)
.unwrap_err(),
... | 30.52459 | 104 | 0.439581 |
ff05468d3d8491c3b5dc5bf10155d4499facc462 | 7,541 | //! Code to construct paths to a directory for non-anonymous downloads
use super::TorPath;
use crate::{DirInfo, Error, Result};
use tor_error::bad_api_usage;
use tor_guardmgr::{GuardMgr, GuardMonitor, GuardUsable};
use tor_netdir::{Relay, WeightRole};
use tor_rtcompat::Runtime;
use rand::Rng;
/// A PathBuilder that c... | 35.909524 | 113 | 0.514255 |
9b1ea3b4c4cf503d4b3d691eb2a6a4773aee09e8 | 48,390 | //! Finds crate binaries and loads their metadata
//!
//! Might I be the first to welcome you to a world of platform differences,
//! version requirements, dependency graphs, conflicting desires, and fun! This
//! is the major guts (along with metadata::creader) of the compiler for loading
//! crates and resolving depe... | 42.410167 | 131 | 0.553399 |
d7d00e39c1c438d47c5e405a6a97ebc66b1d3411 | 3,055 | use std::collections::HashMap;
use near_sdk::{
// log,
require,
env, ext_contract, near_bindgen, assert_one_yocto,
Gas, Balance, AccountId, BorshStorageKey, PanicOnDefault,
Promise, PromiseResult, promise_result_as_success,
collections::{Vector, LookupMap, UnorderedMap, UnorderedSet},
borsh::{self, BorshDeseri... | 30.55 | 140 | 0.761375 |
726dd771130111569de18b877c57f15676a817c9 | 2,913 | // 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... | 30.030928 | 101 | 0.569516 |
716a8644ff79d1669ecbfe9a6963cfe60f0b9942 | 7,589 | // Copyright 2019 Parity Technologies (UK) Ltd.
//
// 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, mer... | 35.297674 | 98 | 0.521149 |
7166c136369edcc758aa524a47b817aff4fb726b | 23,037 | use crate::vm::{FileId, VM};
use dora_parser::lexer::position::Position;
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum SemError {
Unimplemented,
UnknownClass(String),
UnknownType(String),
UnknownIdentifier(String),
UnknownStruct(String),
UnknownFunction(String),
UnknownField(String, Strin... | 45.982036 | 100 | 0.567956 |
18b9c42f9ba963cd0b2dabb1eb70e848440a5b37 | 4,165 | #![cfg(test)]
use enr::Enr;
use eth2_libp2p::Multiaddr;
use eth2_libp2p::NetworkConfig;
use eth2_libp2p::Service as LibP2PService;
use slog::{debug, error, o, Drain};
use std::time::Duration;
pub fn build_log(level: slog::Level, enabled: bool) -> slog::Logger {
let decorator = slog_term::TermDecorator::new().build... | 35.905172 | 100 | 0.630732 |
64ebc773c97a19dabe28ac996f74601598418f59 | 3,293 | use std::collections::HashMap;
use std::io::{BufRead, BufReader};
use std::net::Ipv4Addr;
use std::str::FromStr;
use std::time::Duration;
use std::time::Instant;
use tokio::net::UdpSocket;
use hyper::{body::HttpBody as _, Body, Client, Request, Uri};
use spectral::prelude::*;
use testcontainers::core::Port;
use testco... | 30.775701 | 105 | 0.609778 |
ddc14e68675a98cd3af319e08e56a05a3700bdb2 | 603 | pub trait MyIterator {
}
pub struct MyStruct<T>(T);
macro_rules! array_impls {
($($N:expr)+) => {
$(
impl<'a, T> MyIterator for &'a MyStruct<[T; $N]> {
}
)+
}
}
// @has issue_53812/trait.MyIterator.html '//*[@id="implementors-list"]/h3[1]' 'MyStruct<[T; 0]>'
// @has - ... | 28.714286 | 97 | 0.517413 |
ccd0b15fb493133c3c6b982b0b015103b79ade1e | 4,134 | //! This program shows how to render a triangle and change its position and color on the fly by
//! updating “shader uniforms”. Those are values stored on the GPU that remain constant for the
//! whole duration of a draw call (you typically change it between each draw call to customize each
//! draw).
//!
//! This exam... | 29.319149 | 99 | 0.634253 |
acabb90da7b766858192e2aac6f53987c10f99d0 | 25,087 | use super::{Emitter, Result};
use crate::{list::ListFormat, text_writer::WriteJs};
use swc_common::Spanned;
use swc_ecma_ast::*;
use swc_ecma_codegen_macros::emitter;
impl<'a> Emitter<'a> {
#[emitter]
fn emit_pat_or_ts_param_prop(&mut self, n: &ParamOrTsParamProp) -> Result {
match *n {
Par... | 26.351891 | 95 | 0.521226 |
21123e7faf293dcb19bf566c4c30d8aaf317496f | 1,562 |
pub struct IconAssignmentLate {
props: crate::Props,
}
impl yew::Component for IconAssignmentLate {
type Properties = crate::Props;
type Message = ();
fn create(props: Self::Properties, _: yew::prelude::ComponentLink<Self>) -> Self
{
Self { props }
}
fn update(&mut self, _: Self::Mess... | 33.956522 | 359 | 0.574264 |
39d66bf07131bf4470e3658d59cfc5808cb5e429 | 13,757 | /*
*
* * This file is part of OpenTSDB.
* * Copyright (C) 2021 Yahoo.
* *
* * 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/LICENS... | 33.553659 | 279 | 0.63335 |
791e89d5a6088fdc03c73f7faf855cfd45f1c63a | 15,199 | // use std::io::{stdout, Write};
use crossterm;
use super::*;
use super::keybindings::keys;
impl Lino {
pub(crate) fn initiate_input_event_loop(&mut self, syntect_config: &mut SyntectConfig) {
loop {
if self.rendering.is_rendering { continue; }
self.render(syntect_config);
... | 43.301994 | 92 | 0.440292 |
d666c80b899e99e13d86e223d020945f80f90823 | 87,311 | #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(in_band_lifetimes)]
#![feature(nll)]
#![recursion_limit = "256"]
#[macro_use]
extern crate syntax;
use rustc::bug;
use rustc::hir::def::{DefKind, Res};
use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc::hir::intr... | 41.556878 | 114 | 0.516957 |
e565ec4df2f5d5b85cfc788aa07dfed2e350a3a9 | 45 | #[macro_use]
mod write;
float_module!(f64);
| 9 | 19 | 0.711111 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.