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 |
|---|---|---|---|---|---|
03d0e65f0702305824efd162de0f9ae230e5c87a | 370 | #[macro_use]
extern crate diesel;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate log;
#[macro_use]
extern crate failure;
#[macro_use]
extern crate serde_json;
extern crate futures;
extern crate actix;
extern crate dotenv;
extern crate env_logger;
extern crate crypto;
extern crate clap;
pub mod datab... | 17.619048 | 26 | 0.783784 |
db57b88c1d8615bf58405b5f5647090e3c241414 | 266 | use base::EntityKind;
use ecs::EntityBuilder;
use quill_common::entities::WanderingTrader;
pub fn build_default(builder: &mut EntityBuilder) {
super::build_default(builder);
builder
.add(WanderingTrader)
.add(EntityKind::WanderingTrader);
}
| 24.181818 | 51 | 0.725564 |
1108281244f43697c7c8633995546225f9ec2ed1 | 4,782 | //! Tool to convert Wycheproof test vectors to raw hex format
#![doc(
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
html_root_url = "https://docs.rs/wycheproof2blb/0.1.0"
)]
u... | 33.440559 | 101 | 0.584274 |
9b40eaa550770e3ec66ceb55e567321554abaca4 | 1,159 | /* The following exercises were borrowed from Will Crichton's CS 242 Rust lab. */
use std::collections::HashSet;
fn main() {
println!("Hi! Try running \"cargo test\" to run tests.");
}
fn add_n(v: Vec<i32>, n: i32) -> Vec<i32> {
let mut vret: Vec<i32> = Vec::new();
for i in v.iter() {
vret.push(i + ... | 18.693548 | 81 | 0.47541 |
5be960b5129ecb4e0010a634196f9eb6236ad4d4 | 6,971 | // 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... | 34.004878 | 92 | 0.496629 |
b9b826398e1b13bd5398df01066e245fb063e494 | 1,981 | #[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
impl super::FSM_ERA {
#[doc = r" Reads the contents of the register"]
#[inline]
pub fn read(&self) -> R {
R { bits: self.register.get() }
}
}
#[doc = r" Value of the field"]
pub struct RESERVED26R {
bits: u8,
}
impl RE... | 24.158537 | 78 | 0.519435 |
1682672cd8fda85539198e2fba10855740aecc65 | 2,937 | // 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::tests::fakes::base::Service;
use anyhow::{format_err, Error};
use fidl::endpoints::{ServerEnd, ServiceMarker};
use fidl_fuchsia_ui_input::MediaB... | 33.758621 | 105 | 0.585291 |
fba4a2402247407c5a79abd85e4dd7224edcff15 | 2,808 | #[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate serde_xml_rs;
extern crate xml;
use serde::Deserialize;
use serde_xml_rs::{from_str, to_string};
use serde_xml_rs::{EventReader, ParserConfig};
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct Item {
name: String,
source: Strin... | 26.490566 | 113 | 0.622507 |
ab0a31ee50f3b83ee14fa77c943e910b6ecd86fd | 1,547 | mod errors;
mod handlers;
mod helpers;
use std::error::Error;
use std::sync::Arc;
use asset_services_celery::run_helpers::{init_celery_from_env, init_logging_from_env};
use axum::handler::post;
use axum::{AddExtensionLayer, Router};
use tower_http::cors::CorsLayer;
use crate::helpers::bind_addr_from_env;
#[tokio::m... | 31.571429 | 94 | 0.662573 |
fe8ed969acfc64193ae60df0e76d0d13bbf049ea | 22,525 | use alloc::fmt;
#[cfg(feature = "coff")]
use crate::read::coff;
#[cfg(feature = "elf")]
use crate::read::elf;
#[cfg(feature = "macho")]
use crate::read::macho;
#[cfg(feature = "pe")]
use crate::read::pe;
#[cfg(feature = "wasm")]
use crate::read::wasm;
use crate::read::{
self, Architecture, BinaryFormat, Compressed... | 32.363506 | 101 | 0.551387 |
9c27feb979b2fb54eec0b02cb49f5219b6d7ebe6 | 4,071 | use position::*;
use token::*;
use std::str::Chars;
#[derive(Clone)]
pub struct Tokenizer<'a> {
chars: Chars<'a>,
pos: Position
}
impl<'a> Tokenizer<'a> {
pub fn tokenize(chars: Chars<'a>) -> Tokenizer {
Tokenizer {
chars: chars,
pos: Position::new("string... ")
}
... | 30.155556 | 83 | 0.38197 |
1ef486c093d67788fc6c296700f5721446a2e75d | 24,562 | #![deny(warnings, rust_2018_idioms)]
#![type_length_limit = "16289823"]
#![recursion_limit = "256"]
use linkerd2_app_integration::*;
macro_rules! generate_tests {
(server: $make_server:path, client: $make_client:path) => {
use linkerd2_proxy_api as pb;
#[tokio::test]
async fn outbound_ask... | 39.111465 | 151 | 0.520275 |
d650ef56435ac0d8831a9f7406685deb020611fe | 1,836 | #[doc = "Register `HOST_SLCHOST_GPIO_STATUS1` reader"]
pub struct R(crate::R<HOST_SLCHOST_GPIO_STATUS1_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<HOST_SLCHOST_GPIO_STATUS1_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<HOST_SLCHOST_GP... | 34 | 228 | 0.680283 |
db3f85604ba423534ceacbe8ba23d89ed5dcfdd6 | 22,751 | //! This module specifies the input to rust-analyzer. In some sense, this is
//! **the** most important module, because all other fancy stuff is strictly
//! derived from this input.
//!
//! Note that neither this module, nor any other part of the analyzer's core do
//! actual IO. See `vfs` and `project_model` in the `... | 29.896189 | 103 | 0.56881 |
3a5ce7345ef8ffd8195a0465c69cea5ae99e82ea | 97 | mod entity;
/// This structure defines a schema for a table
#[derive(Debug)]
pub struct Schema;
| 16.166667 | 47 | 0.731959 |
18aeede2a3f93ceb3ec5cf6ba037efebe3a95d90 | 6,316 | mod client_socket_connection;
mod connection_info;
mod messages;
mod room_actor;
mod server_state;
mod service_actor;
use crate::room_actor::GetConnectionInfo;
use actix_web::error::ErrorInternalServerError;
use actix_web::web::{self, get};
use actix_web::{web::Data, App, Error, HttpRequest, HttpResponse, HttpServer, ... | 32.22449 | 97 | 0.607505 |
f554e16b4f475452b81396897b5ca6b48a44ec1e | 266 | /// I want...
///
/// # Anchor!
pub struct Something;
// @has intra_links_anchors/struct.SomeOtherType.html
// @has - '//a/@href' '../intra_links_anchors/struct.Something.html#Anchor!'
/// I want...
///
/// To link to [Something#Anchor!]
pub struct SomeOtherType;
| 20.461538 | 76 | 0.661654 |
293605d2c92bd42774308307c0273e62cac95a48 | 2,388 | // this file is auto-generated by hap-codegen
use serde::ser::{Serialize, SerializeStruct, Serializer};
use crate::{
accessory::{AccessoryInformation, HapAccessory},
service::{HapService, accessory_information::AccessoryInformationService, door::DoorService},
HapType,
Result,
};
/// Door Accessory.
#[derive(Debu... | 26.533333 | 95 | 0.595059 |
2895129e683fc047267af48c7cf2e75ad065d84b | 289 | mod exchange;
mod grant;
mod refresh;
pub use self::exchange::{Exchange, ExchangeResponse};
pub use self::grant::{Grant, GrantUrl};
pub use self::refresh::{Refresh, RefreshResponse};
#[derive(Debug, Clone)]
pub struct Credential {
pub client_id: String,
pub client_secret: String,
}
| 20.642857 | 53 | 0.737024 |
21de9bb7eaee281cec7d16ac08a816b3c758d331 | 5,043 | use cosmwasm_std::{Addr, BlockInfo, Decimal, StdResult, Storage, Uint128};
use cosmwasm_storage::{Bucket, ReadonlyBucket};
use pylon_token::common::OrderBy;
use pylon_utils::range::{calc_range_end, calc_range_start};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::cmp::{max, min};
use std::conve... | 32.960784 | 96 | 0.581797 |
c180bb073ca7994668d62a6d1ae0cb961ea070bd | 2,099 | use crate::{codec::Encode, util::PartialBuffer};
use std::{fmt, io::Result};
use brotli2::{
raw::{CoStatus, Compress, CompressOp},
CompressParams,
};
pub struct BrotliEncoder {
compress: Compress,
}
impl BrotliEncoder {
pub(crate) fn new(params: &CompressParams) -> Self {
let mut compress = C... | 27.986667 | 90 | 0.580276 |
87e74778ea37a31c98a5b06ca19f0f25fc283fc0 | 3,902 | use xhighlight::syntax::rust::Rust;
use xhighlight::render::{Renderer, HtmlRenderer};
#[macro_use]
extern crate lazy_static;
const RUST_CSS: [(Rust, &str); 19] = [
// Here, you define the CSS classes for tokens
// E.g. a keyword is encoded as <span class="kwd">...</span>
(Rust::Text, ""),
(Ru... | 32.516667 | 358 | 0.549462 |
79642ca43cdf24112fd5ba4f8a1d939f7e8ce50b | 412 | extern crate jemalloc_sys;
extern crate jemallocator;
// Work around https://github.com/alexcrichton/jemallocator/issues/19
#[global_allocator]
static A: jemallocator::Jemalloc = jemallocator::Jemalloc;
#[test]
fn smoke() {
unsafe {
let ptr = jemalloc_sys::malloc(4);
*(ptr as *mut u32) = 0xDECADE;... | 24.235294 | 69 | 0.662621 |
e8c48f016563712256eeb1ef0c1f17db66cdf97b | 4,667 | // Reads the url
use std::ops::{Deref, Drop};
use std::env;
use std::fs::{File, remove_file};
use std::path::{Path, PathBuf};
use std::io::{self, BufRead, Read, BufWriter, Write};
use std::process::{Command, ChildStderr, Stdio};
use std::string::FromUtf8Error;
use reqwest::{get, Response};
use time::get_time;
fn execu... | 26.367232 | 118 | 0.544461 |
9bfa1b150259f6c2b6146fa33e30e3beb9924838 | 31,582 | //! Low-Level binding for [Array API](https://docs.scipy.org/doc/numpy/reference/c-api.array.html)
use libc::FILE;
use pyo3::ffi::{self, PyObject, PyTypeObject};
use std::ops::Deref;
use std::os::raw::*;
use std::ptr;
use std::sync::{Once, ONCE_INIT};
use npyffi::*;
pub(crate) const MOD_NAME: &str = "numpy.core.multi... | 78.758105 | 320 | 0.715123 |
0a29a2e18379953d60cae5ee462c23911a3b6cdb | 7,503 | use crate::{
buffer::event::{BufferPool, BufferWriter, PoolInfo},
data::{ArconEvent, ArconEventWrapper, ArconMessage, ArconType, NodeID},
stream::channel::{strategy::send, Channel},
};
use kompact::prelude::{ComponentDefinition, SerError};
use std::sync::Arc;
/// A Broadcast strategy for one-to-many messag... | 33.64574 | 99 | 0.518193 |
217f7983c39064ebc852686936d6a3364347ae62 | 5,416 | use futures::future::FutureResult;
use std::time::{SystemTime, UNIX_EPOCH};
use super::*;
use graph::data::subgraph::schema::*;
fn check_subgraph_exists(
store: Arc<dyn NetworkStore>,
subgraph_id: SubgraphDeploymentId,
) -> impl Future<Item = bool, Error = Error> {
future::result(
store
... | 34.496815 | 98 | 0.607644 |
ff44454481f0508d6b26748915d4bdcbe465393f | 1,588 | use crate::error::*;
use serde::Serialize;
use snafu::ResultExt;
use std::collections::BTreeMap;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Variables(BTreeMap<String, serde_yaml::Value>);
impl Variables {
pub fn new() -> Self {
Variables(BTreeMap::new())
}
pub fn append(&mut self,... | 31.137255 | 93 | 0.593199 |
ab1f5f14c9540f784123741fe761d61ac1cb72be | 1,222 | extern crate barn;
use ::fringe;
pub use self::barn::basic::*;
use self::barn::scheduler::{self, Request};
static mut SCHEDULER: Option<Scheduler> = None;
pub fn start<F: FnOnce() + Send + 'static>(f: F) {
let stack = fringe::OwnedStack::new(16 * 1024);
let thread = Thread::new(stack, f);
let mut q = Queue::... | 26 | 75 | 0.641571 |
09872f8b13ea93edc6ae03fe2f85add08e7b2e9c | 19,359 | // 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... | 36.117537 | 111 | 0.564595 |
90d1a8b7c8b599572b74b19554e422d014bec1e5 | 3,619 | #[cfg(feature = "managed")]
mod tests {
use std::sync::Arc;
use std::time::Duration;
use async_trait::async_trait;
use tokio::sync::mpsc::{channel, Receiver, Sender};
use tokio::sync::Mutex;
use tokio::task::yield_now;
use tokio::time::timeout;
use deadpool::managed::{RecycleError, Re... | 32.603604 | 75 | 0.540481 |
69bb2e1e694a01488b7821041518d113031a2e39 | 7,422 | //! const fn combinations iter adapter
//!
//! # Examples
//!
//! ```
//! use const_combinations::IterExt;
//!
//! let mut combinations = (1..5).combinations();
//! assert_eq!(combinations.next(), Some([1, 2, 3]));
//! assert_eq!(combinations.next(), Some([1, 2, 4]));
//! assert_eq!(combinations.next(), Some([1, 3, 4])... | 37.11 | 90 | 0.598356 |
899d0cf864e7dcb9b77f0a984c4da0fb8ca63526 | 3,203 | use std::collections::HashMap;
use crate::errors::Result;
use crate::request::get_requests::get;
use crate::request::put_requests::put;
use crate::{Client, QueryMeta, QueryOptions, WriteMeta, WriteOptions};
#[serde(default)]
#[derive(Clone, Default, Eq, PartialEq, Serialize, Deserialize, Debug)]
pub struct SessionID ... | 28.855856 | 94 | 0.558851 |
11b2e9d601653f9f02b1f5d5c2e5c330ae2e3eb3 | 309 | // run-rustfix
#[allow(unused_parens)]
fn main() {
let _ = +1; //~ ERROR leading `+` is not supported
let _ = (1.0 + +2.0) * +3.0; //~ ERROR leading `+` is not supported
//~| ERROR leading `+` is not supported
let _ = [+3, 4+6]; //~ ERROR leading `+` is not supported
}
| 34.333333 | 71 | 0.517799 |
f86b0bc0c33cf219a3de9f60e8afcb1dcd39f21b | 1,475 | use rubysys::types::{c_char, c_int, c_void, size_t, Value};
extern "C" {
// void *
// rb_check_typeddata(VALUE obj, const rb_data_type_t *data_type)
pub fn rb_check_typeddata(object: Value, data_type: *const RbDataType) -> *mut c_void;
// int
// rb_typeddata_inherited_p(const rb_data_type_t *child,... | 33.522727 | 98 | 0.696271 |
ab1ab431ec907f6be811d646c51f85357dc70afe | 127 | use arrows::send;
use arrows::Addr;
use arrows::Msg;
fn main() {
let _rs = send!(Addr::listen_addr(), Msg::shutdown());
}
| 15.875 | 58 | 0.629921 |
232ec9aac6d0bea7caefe158f7497f3916595932 | 134 | table! {
books (id) {
id -> Int4,
title -> Varchar,
author -> Varchar,
published -> Bool,
}
}
| 14.888889 | 26 | 0.41791 |
dd19590e017fdfd54cf10cb1511fa55b3ecd709e | 148,686 | #![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use crate::models::*;
pub mod domains {
use crate::models::*;
pub async fn get(
operation_config: &crate::OperationConfig,
subscription_id: &str,
resource_group_name: &str,... | 49.562 | 277 | 0.605477 |
08878f250bf09c148542d0f67b102f172a499df2 | 21,180 | use super::pins::pin_header::PinHeader;
use super::timesets::timeset::Timeset;
use crate::pins::vec_to_ppin_ids;
use origen::core::tester::TesterSource;
use origen::error::Error;
use origen::testers::SupportedTester;
use origen::{Operation, STATUS, TEST};
use pyo3::prelude::*;
use pyo3::types::{PyAny, PyDict, PyTuple};... | 36.205128 | 177 | 0.493012 |
716c2cc39e5910acadceca32e536e92a4f108cf5 | 2,226 | pub fn default_generic_type_parameter_and_operator_overloading() {
use std::ops::Add;
#[derive(Debug, PartialEq)]
struct Point {
x: i32,
y: i32,
}
impl Add for Point {
type Output = Point;
fn add(self, other: Point) -> Point {
Point {
x: self.x + other.x,
y: self.y + o... | 20.422018 | 72 | 0.544924 |
189027b86bb4cce1843e9c4fbd530a0df1657e29 | 7,312 | use crate::command_args::CommandArgs;
use crate::documentation::get_full_help;
use crate::evaluate::block::run_block;
use crate::evaluation_context::EvaluationContext;
use crate::example::Example;
use nu_errors::ShellError;
use nu_parser::ParserScope;
use nu_protocol::hir::Block;
use nu_protocol::{ReturnSuccess, Signat... | 30.722689 | 99 | 0.485914 |
e909114101602ef88b6d2fa83e6c904f1346f2a6 | 2,764 | use std::sync::Arc;
use std::{fs, path};
use crate::tfpb::graph::GraphDef;
use tract_core::model::{InletId, Model, OutletId};
use tract_core::{ToTract, TractResult, Tractify};
/// Load a SharedTensor protobul model from a file.
pub fn for_path<P: AsRef<path::Path>>(p: P) -> TractResult<Model> {
for_reader(fs::Fil... | 38.388889 | 97 | 0.543777 |
71fb47b545e0b77b626085d9db8a8fc5228c9dcc | 8,489 | #![deny(missing_docs)]
//! Types subcrate for kitsune-p2p.
/// Re-exported dependencies.
pub mod dependencies {
pub use ::futures;
pub use ::ghost_actor;
pub use ::lair_keystore_api;
pub use ::lair_keystore_api_0_0;
pub use ::observability;
pub use ::paste;
pub use ::rustls;
pub use ::s... | 24.821637 | 90 | 0.595123 |
b9669dce6d73cdccbaf84c8f39daf9c11837ff06 | 1,812 | /*
* DMNTK - Decision Model and Notation Toolkit
*
* MIT license
*
* Copyright (c) 2018-2022 Dariusz Depta Engos Software
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE ... | 34.846154 | 102 | 0.727373 |
e86aa9a9c21ee3b4104c7838474ce90aae78b6ae | 38,377 | use crate::{
create_terrain_layer_material, make_save_file_selector, make_scene_file_filter,
scene::{
commands::{graph::AddNodeCommand, sound::AddSoundSourceCommand, PasteCommand},
EditorScene, Selection,
},
send_sync_message,
settings::{Settings, SettingsWindow},
GameEngine, Mes... | 44.676368 | 99 | 0.448341 |
38911c48918cb9ca5617dc7e1149451f40caccfd | 10,235 | //! Types for Assets, Jig and LearningPath.
use std::{
collections::HashMap,
fmt::{self, Debug},
str::FromStr,
};
use chrono::{DateTime, Utc};
// use dyn_clone::DynClone;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use crate::domain::{
category::CategoryId,
// learning_path::AdditionalRe... | 24.782082 | 101 | 0.546556 |
d5378eae7abc38f331c2b8f8e57d1858fb1ad131 | 6,725 | use std::sync::Arc;
use druid::{
piet::{Text, TextLayout, TextLayoutBuilder},
BoxConstraints, Command, Cursor, Data, Env, Event, EventCtx, FontFamily,
LayoutCtx, LifeCycle, LifeCycleCtx, MouseEvent, PaintCtx, Point, Rect,
RenderContext, Size, Target, UpdateCtx, Widget, WidgetId,
};
use lapce_data::{
... | 28.375527 | 81 | 0.474796 |
e23232835acb6b429c39178551a82d5ca6ce5a28 | 3,786 | use ic_base_types::CanisterId;
#[cfg(target_arch = "x86_64")]
pub mod ids;
// WARNING: The NNS canisters MUST be installed in the NNS subnet,
// in the following order, otherwise they won't be able to find
// each other.
//
// These constants are used to write a file with the PB below in
// nns/common/build.rs.
//
//... | 38.632653 | 99 | 0.767036 |
5d878d30a42f081e7a034db2516966b66e7fc97f | 611 | // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.
use hashbrown::{hash_map,... | 24.44 | 77 | 0.603928 |
0ac57faaccc291a6c0cfc8346501684b39077d96 | 1,606 | // This file is part of nvml. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/nvml/master/COPYRIGHT. No part of predicator, including this file, may be copied, modified, propagated, or distributed except ac... | 39.170732 | 373 | 0.750311 |
72b66a4ff95c3e458001e0a4b4e59569519f7a87 | 1,097 | // Copyright 2021 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.
#![deny(missing_docs)]
//! This crate provides utilities for the Fuchsia display-controller API.
/// Custom error definitions for `fuchsia.hardware.displ... | 30.472222 | 100 | 0.757521 |
2f0cb2858e84119eadc7568ce4544963a86fa2ba | 1,330 | #[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::CIENR {
#[doc = r" Writes to the register"]
#[inline]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
let mut w = W::reset_value();
f(&mut w);
self.register.set(w... | 26.6 | 212 | 0.533835 |
e87991a58347e940ca5f1eae2d10cc7ccbf516b5 | 6,861 | #[doc = "Reader of register TPIUCTRL"]
pub type R = crate::R<u32, super::TPIUCTRL>;
#[doc = "Writer for register TPIUCTRL"]
pub type W = crate::W<u32, super::TPIUCTRL>;
#[doc = "Register TPIUCTRL `reset()`'s with value 0"]
impl crate::ResetValue for super::TPIUCTRL {
type Type = u32;
#[inline(always)]
fn re... | 31.617512 | 174 | 0.570325 |
2f6957aec37534326dc83f5ec4d0b997b9935507 | 1,773 | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | 34.096154 | 97 | 0.655386 |
e8fcb80f44b5432d96edcd4fae12f55ff927a69b | 853 | use std::io;
fn main() {
let mut buf = String::new();
io::stdin().read_line(&mut buf).unwrap();
let mut integers = buf.split_whitespace();
let m: u16 = integers.next().unwrap().parse().unwrap();
let n: u16 = integers.next().unwrap().parse().unwrap();
let p: u16 = integers.next().unwrap().parse(... | 31.592593 | 59 | 0.385698 |
4b01f54e0b3b283ae6b0d3dd1cb40c2c1e6637ee | 15,157 | // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
use crate::colors;
use crate::emit::TypeLib;
use crate::errors::get_error_class_name;
use deno_core::error::custom_error;
use deno_core::error::AnyError;
use deno_core::ModuleSpecifier;
use deno_graph::Dependency;
use deno_graph::MediaType;
use... | 32.525751 | 80 | 0.556509 |
2fcce85d3e8666f8d7a6df4cbe2897e5ff8c0b4b | 5,119 | #[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::RQR {
#[doc = r" Writes to the register"]
#[inline]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
let mut w = W::reset_value();
f(&mut w);
self.register.set(w.b... | 26.251282 | 128 | 0.524517 |
3982a8205ee36fdd2ffc1d8163ff5cd197f4a75b | 3,629 | use crate::imp::history::file_hist::file_history::FileHistory;
use crate::imp::history::file_hist::history_file_data::HistoryFileData;
use std::path::Path;
use crate::imp::common::path::hash_dir_path::hash_dir_path;
use std::ops::Range;
use crate::common::remove_hash_dir;
use crate::error::FsResult;
/// Represents eve... | 37.412371 | 120 | 0.587765 |
d755c163bba0e284f01c3e9b9dc1c084f6472b6b | 394 | fn main() {
// Cast a function pointer such that on a call, the argument gets transmuted
// from raw ptr to reference. This is ABI-compatible, so it's not the call that
// should fail, but validation should.
fn f(_x: &i32) { }
let g: fn(*const i32) = unsafe { std::mem::transmute(f as fn(&i32)) };
... | 32.833333 | 83 | 0.639594 |
4b78c35a7803a1f7c936dccf889cb4e126e5005c | 6,578 | //! Fairing implementation
use ::log::{error, info};
use rocket::http::{self, uri::Origin, Status};
use rocket::{self, error_, info_, log_, outcome::Outcome, Request};
use crate::{
actual_request_response, origin, preflight_response, request_headers, validate, Cors, Error,
};
/// Request Local State to store COR... | 32.564356 | 100 | 0.604895 |
8f9cf888b0ff7416573ef082e294563940f0959d | 23,759 | include!("../src/main.rs");
#[cfg(test)]
mod tests {
use super::{
config_options, create_header, decode_token, encode_token, is_payload_item,
is_timestamp_or_duration, translate_algorithm, OutputFormat, Payload, PayloadItem,
SupportedAlgorithms,
};
use chrono::{Duration, TimeZone, U... | 34.786237 | 166 | 0.551202 |
0aa0df71ef55efd200a1178def45b879c6ac7390 | 1,983 | use std::env;
use std::path::PathBuf;
fn main() -> Result<(), ()> {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=wrapper.h");
println!("cargo:rerun-if-changed=Cargo.lock");
// The bindgen::Builder is the main entry point
// to bindgen, and lets you build up options ... | 38.134615 | 65 | 0.616238 |
75375af201b9d93dc9666012e385d8a5881762f7 | 3,269 | extern crate sdl2;
use sdl2::pixels::Color;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::rect::Rect;
#[allow(dead_code)]
enum Mode {
Points,
Lines,
}
const MODE: Mode = Mode::Lines;
const CLEAR_FRAMES: bool = false;
const k: i32 = 10;
fn main() {
let sdl_context = sdl2::init().unwrap()... | 29.1875 | 98 | 0.437749 |
ffa2d7e5a4e155eca7e0f09f69e0a7b243bbf63d | 4,124 | use crate::datastruct::{Currency, SqlResult};
use rusqlite::{params, Result, NO_PARAMS};
// SELECT SUM(c.balance) - SUM(d.balance) FROM Credits as c, Debits as d;
pub fn check_integrity(
conn: r2d2::PooledConnection<r2d2_sqlite::SqliteConnectionManager>,
) -> Result<bool> {
let mut stmt =
conn.prepare... | 30.10219 | 201 | 0.541222 |
91236fb88e0914ee4abd67f207116a1dd610a8d0 | 2,143 | #[allow(unused_imports)]
use futures::stream::futures_unordered::FuturesUnordered;
#[allow(unused_imports)]
use futures::stream::StreamExt;
use std::error::Error;
use std::thread::sleep;
use std::time::Instant;
#[allow(unused_imports)]
use tokio::net::TcpStream;
use tokio::prelude::*;
#[tokio::main]
async fn main() ->... | 29.356164 | 91 | 0.564162 |
1cfb2415a748851f6b23a4c720876c0015cd59e2 | 4,114 | use std::fmt;
use bytes::{Buf, BufMut};
use crate::proto::coding::{self, BufExt, BufMutExt};
#[derive(Debug, PartialEq)]
pub enum Error {
Overflow,
UnexpectedEnd,
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::... | 26.037975 | 95 | 0.535002 |
336a61708683e0d6b05bea15cc3b490a54d67632 | 8,526 | // 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.052632 | 85 | 0.62327 |
1a3058608a50f03e74cb4771726b46efcfaa365c | 1,458 | use std::fmt::Write;
use termion;
use termion::color;
use xrl::Style;
use failure::Error;
fn get_color(argb_color: u32) -> color::Rgb {
let r = ((argb_color & 0x00ff_0000) >> 16) as u8;
let g = ((argb_color & 0x0000_ff00) >> 8) as u8;
let b = (argb_color & 0x0000_00ff) as u8;
color::Rgb(r, g, b)
}
pu... | 25.137931 | 68 | 0.541152 |
393420e5726cb63bd736f6f68f0fea4a0b46460c | 4,254 | #![deny(clippy::all)]
#![deny(clippy::pedantic)]
#![allow(clippy::cast_possible_truncation)]
#![allow(clippy::cast_precision_loss)]
#![allow(clippy::cast_sign_loss)]
#![forbid(unsafe_code)]
use std::fs::File;
use std::io::{self, Read};
use std::process;
use arrayvec::ArrayVec;
use byteorder::{ByteOrder, NativeEndian}... | 28.938776 | 82 | 0.537377 |
abf169676ed6547643d4a10c2b283994de5eaa1b | 8,909 | use std::collections::HashMap;
use std::io::BufWriter;
use std::iter::FromIterator;
use image::codecs::bmp::BmpEncoder;
use image::codecs::farbfeld::FarbfeldEncoder;
use image::codecs::jpeg::JpegEncoder;
use image::codecs::png::PngEncoder;
use image::codecs::pnm::PnmEncoder;
use image::codecs::tga::TgaEncoder;
use ima... | 32.278986 | 99 | 0.521046 |
d792dbf5037ae8a911ab879093be733cbaae3fb4 | 1,180 | /*
* Cosmos SDK - Legacy REST and gRPC Gateway docs
*
* A REST interface for state queries, legacy transactions
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct IbcCoreChannelV1QueryPacke... | 33.714286 | 168 | 0.737288 |
eb30886de2b4fb3217d7048df7c25e1bb0b3e3a3 | 1,080 | // Generated by `scripts/generate.js`
use utils::vk_traits::*;
/// Wrapper for [VkDriverId](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkDriverId.html).
#[repr(i32)]
#[derive(Debug, PartialEq, Copy, Clone)]
pub enum VkDriverId {
AmdProprietary = 1,
AmdOpenSource = 2,
MesaRadv = ... | 24.545455 | 116 | 0.661111 |
f90ede35a13b5d5afb96d557e961a64c4c107a42 | 4,115 | //! Variable data length implementation of the [`Registers`] trait using the
//! [`embedded-hal`] blocking SPI trait, and an infallible GPIO pin.
//!
//! This uses the W5500 variable data length mode (VDM).
//! In VDM mode the SPI frame data length is determined by the chip select pin.
//! This is the preferred blockin... | 32.401575 | 93 | 0.559174 |
f9904ec7887dd18abdda275d6cafb1f9ba201189 | 43 | #[cfg(test)]
mod extended_line_method_test; | 21.5 | 30 | 0.813953 |
38ab85d88265cbf673799cc69406af542293430f | 3,330 | use crate::manifest::State;
use clap::ArgMatches;
use log::{debug, info};
use snafu::{ResultExt, Snafu};
#[derive(Debug, Snafu)]
pub enum PackageJogError {
#[snafu(display("No supported package manager detected! Please check the docs for all supported package managers."))]
NoManager { source: std::io::Error },... | 29.469027 | 121 | 0.466667 |
f8afc930aaa7acf6b5ae578e67447d15799ad6b6 | 6,692 | //! Fully integrated benchmarks for rust-analyzer, which load real cargo
//! projects.
//!
//! The benchmark here is used to debug specific performance regressions. If you
//! notice that, eg, completion is slow in some specific case, you can modify
//! code here exercise this specific completion, and thus have a fast... | 34.142857 | 98 | 0.611775 |
726009feb5f52d16f8d81be6284f9c60022898d4 | 1,681 | #![allow(dead_code)]
fn main() {
let x = 25;
println!("Is x greater than 5?, {}", greater_than_five(x));
is_divisible(x);
// let is_positive = if x >= 0 { true } else { false };
let is_positive = x >= 0;
println!("Is x positive? {}", is_positive);
count_to_10();
countdown_from(10);
... | 18.88764 | 63 | 0.477692 |
e51f234d2ab7e6a27a7d29d664412c94190ff234 | 539 | use super::{default_copy_getter, default_copy_setter, Control, ControlFieldGenerator};
use crate::ast::{AudioExtractField, ControlField, ControlType};
pub struct AudioExtractControl;
impl Control for AudioExtractControl {
fn control_type() -> ControlType {
ControlType::AudioExtract
}
fn gen_fields... | 29.944444 | 86 | 0.699443 |
71c074a4dd7a06da15b06f816277e967432f7146 | 326 | fn main() {
let mut input = include_str!("../input.txt")
.lines()
.map(|i| i.parse::<usize>().unwrap());
let mut prev = input.next().unwrap();
let mut counter = 0;
for i in input {
if prev < i{
counter += 1;
}
prev = i
}
println!("{}", counte... | 19.176471 | 48 | 0.447853 |
e4d1203ebf810631d2a1b0a1c73a24ea8ebe0027 | 30,960 | #![doc = "Peripheral access API for LPC178X_7X microcontrollers (generated using svd2rust v0.17.0)\n\nYou can find an overview of the API [here].\n\n[here]: https://docs.rs/svd2rust/0.17.0/svd2rust/#peripheral-api"]
#![deny(const_err)]
#![deny(dead_code)]
#![deny(improper_ctypes)]
#![deny(missing_docs)]
#![deny(no_mang... | 24.493671 | 215 | 0.559981 |
916a14631ad4662e0dc68f03dc43ea47767a5555 | 16,995 | // Copyright 2016 TiKV Project Authors. Licensed under Apache-2.0.
use std::borrow::Borrow;
use std::fmt::{self, Debug, Display, Formatter};
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use std::time::Duration;
use engine_rocks::raw::{ColumnFamilyOptions,... | 31.183486 | 100 | 0.557811 |
08ab2faf40133862282ecdb814130ae166657e5a | 1,455 | // Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::cli_state::CliState;
use crate::StarcoinOpt;
use anyhow::Result;
use scmd::{CommandAction, ExecContext};
use starcoin_account_api::AccountInfo;
use starcoin_vm_types::account_address::AccountAddress;
use structopt::Struct... | 29.693878 | 97 | 0.690034 |
0e6eba0e6cae281e55063eb6db0948458130e96f | 2,049 | use anyhow::{Context, Error, Result};
use tokio::sync::mpsc::channel;
use crate::providers::http::Report as HttpReport;
use crate::report::Report;
use crate::tasks::adapters::from_file;
use crate::utils::timestamp::current_timestamp;
use crate::worker::{Squad, Worker};
/// This is likely to change in the future in or... | 32.52381 | 111 | 0.457296 |
4b2980bc3a6957211a1e286003d84910203ed527 | 26,275 | // Copyright 2013-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... | 36.442441 | 100 | 0.544091 |
168d74459ac272ecf2ebe355d28bc3d5577bb1e9 | 19,394 | //! `cargo upgrade`
#![warn(
missing_docs,
missing_debug_implementations,
missing_copy_implementations,
trivial_casts,
trivial_numeric_casts,
unsafe_code,
unstable_features,
unused_import_braces,
unused_qualifications
)]
#[macro_use]
extern crate error_chain;
use crate::errors::*;
... | 36.318352 | 108 | 0.546664 |
d973e12aa3004f3fdda4f1f6b3fb2e29b45900a8 | 4,837 | use std::fs;
use std::env;
use std::path;
use console::style;
use url::{Url};
use indicatif::{ProgressBar, ProgressStyle};
use clap::{ArgMatches};
use gitlfs::lfs;
use crate::gpm;
use crate::gpm::command::{Command, CommandError, CommandResult};
use crate::gpm::package::Package;
pub struct DownloadPackageCommand {
}... | 32.033113 | 110 | 0.528427 |
50c5b7403189c7bba7075a1f8986638e843ef563 | 639 | use reqwest::Certificate;
#[derive(Debug, Clone)]
pub struct RestSettings {
pub enable_debug: bool,
pub use_https: bool,
pub certificate: Option<Certificate>,
pub cors: Option<String>,
}
impl RestSettings {
pub fn new_use_https() -> Self {
RestSettings {
enable_debug: false,
... | 19.96875 | 41 | 0.549296 |
ac03b58e3b3e427721cf0af2f1b5300e2f7c795f | 79 | mod point2d;
mod grid;
pub use self::point2d::Point2D;
pub use self::grid::*;
| 13.166667 | 31 | 0.696203 |
4856074a62bd01d0824226e28fc7341285f2d1a5 | 36,727 | //! Pre-computed tables powers-of-5 for extended-precision representations.
//!
//! These tables enable fast scaling of the significant digits
//! of a float to the decimal exponent, with minimal rounding
//! errors, in a 128 or 192-bit representation.
//!
//! DO NOT MODIFY: Generated by `src/etc/dec2flt_table.py`
pub... | 54.734724 | 98 | 0.706864 |
ed8bc70a7bdd31519f5286454b5b257273e1da76 | 188 | mod common;
#[cfg(feature = "mssql")]
pub mod mssql;
#[cfg(feature = "mysql")]
pub mod mysql;
#[cfg(feature = "postgres")]
pub mod postgres;
#[cfg(feature = "sqlite")]
pub mod sqlite;
| 13.428571 | 28 | 0.643617 |
0877efba1ac01372605d5c0026ab54bf3c81f690 | 4,112 | //! Button/SimpleButton prototype
use crate::avm1::activation::Activation;
use crate::avm1::error::Error;
use crate::avm1::function::{Executable, FunctionObject};
use crate::avm1::globals::display_object;
use crate::avm1::property::Attribute;
use crate::avm1::{Object, ScriptObject, TObject, Value};
use crate::display_... | 31.630769 | 107 | 0.535992 |
1a76545011a306c2d1bd1a0c2b59e9716982c6e7 | 506 | use {crate::common::*, maud::html};
pub(crate) fn map_error(
mut stderr: Stderr,
result: Result<Response<Body>, Error>,
) -> Response<Body> {
result.unwrap_or_else(|error| {
error.print_backtrace(&mut stderr);
writeln!(stderr, "{}", error).ok();
let mut response = html::wrap_body(
error.status(... | 23 | 59 | 0.579051 |
f78a32e5069b87b79438da6e2661937bedbdc4f9 | 12,066 | use ark_ff::{
biginteger::{BigInteger, BigInteger256},
fields::{
fp6_3over2::Fp6Parameters, FftField, FftParameters, Field, FpParameters, PrimeField,
SquareRootField,
},
One, UniformRand, Zero,
};
use ark_serialize::{buffer_bit_byte_size, CanonicalSerialize};
use ark_std::rand::Rng;
use ... | 23.893069 | 92 | 0.540941 |
e4440fc46753ea5b68aa432b66e51c5bca84883c | 34,570 | // This module provides a data structure, `Ignore`, that connects "directory
// traversal" with "ignore matchers." Specifically, it knows about gitignore
// semantics and precedence, and is organized based on directory hierarchy.
// Namely, every matcher logically corresponds to ignore rules from a single
// directory,... | 34.743719 | 95 | 0.562019 |
5d7c40a82f6965bd88d34ff367c33cec73a9ab75 | 9,977 | // encoder.rs
//
// Copyright (c) 2019 Minnesota Department of Transportation
//
//! Encoder for Mapbox Vector Tile (MVT) geometry.
//!
use std::vec::Vec;
use crate::error::Error;
use crate::geom::{Transform, Vec2};
#[derive(Clone, Debug)]
enum Command {
MoveTo = 1,
LineTo = 2,
ClosePath = 7,
}
struct Co... | 30.233333 | 77 | 0.438609 |
9133e31a86e40cd050ef38ceecbf8db78395c8e7 | 6,877 | use crate::common::get_xpub_data;
use crate::Result;
use common::error::CoinError;
use core::result;
use transport::message::send_apdu;
use bch_addr::Converter;
use bitcoin::util::address::Error as BtcAddressError;
use bitcoin::{Address as BtcAddress, Network, PublicKey, Script};
use common::apdu::{Apdu, ApduCheck, Bt... | 32.438679 | 98 | 0.633125 |
61905658d5e6d671ba23e0cd511ddf358fe523fe | 5,995 | //! Navigator backend for web
use js_sys::{Array, ArrayBuffer, Uint8Array};
use ruffle_core::backend::navigator::{
url_from_relative_url, NavigationMethod, NavigatorBackend, OwnedFuture, RequestOptions,
};
use ruffle_core::loader::Error;
use std::borrow::Cow;
use std::collections::HashMap;
use std::time::Duration;... | 34.0625 | 93 | 0.497581 |
abf32af45e9453a3c22212a49a683b09162abde9 | 73 | pub fn init() {
wasm_logger::init(wasm_logger::Config::default());
}
| 18.25 | 54 | 0.657534 |
d6e0bd5cb0dcccd702a44dc3ba07ad6c9d49213a | 15,574 | #[doc = "Register `DORMANT_WAKE_INTS3` reader"]
pub struct R(crate::R<DORMANT_WAKE_INTS3_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<DORMANT_WAKE_INTS3_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<DORMANT_WAKE_INTS3_SPEC>> for R {
... | 31.526316 | 122 | 0.631309 |
d5df975eae3ef19e205808846d824d227dc84771 | 19,884 | use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer};
use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState};
use vulkano::device::{Device, DeviceExtensions};
use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract, Subpass};
use vulkano::image::{ImageUsage, SwapchainImage};
us... | 40.414634 | 112 | 0.559747 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.