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 |
|---|---|---|---|---|---|
9b487641c2b43813f9056084e9251009c816e210 | 3,287 | //!
//! The constant array element tests.
//!
use num::BigInt;
use crate::error::Error;
use crate::semantic::element::constant::array::error::Error as ArrayConstantError;
use crate::semantic::element::constant::error::Error as ConstantError;
use crate::semantic::element::error::Error as ElementError;
use crate::seman... | 26.087302 | 96 | 0.594463 |
e41e85bece498b8ec8d2ca6ebed404575e48b54c | 363 | // if1.rs
pub fn bigger(a: i32, b: i32) -> i32 {
return if a > b { a } else { b }
}
// Don't mind this for now :)
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn ten_is_bigger_than_eight() {
assert_eq!(10, bigger(10, 8));
}
#[test]
fn fortytwo_is_bigger_than_thirtytwo() {
... | 16.5 | 44 | 0.534435 |
fc2747fe3e74767fd691cb99a67bc1fdff6a3b87 | 663 | use ink_lang as ink;
#[ink::contract(
version = "0.1.0",
compile_as_dependency = true,
)]
mod flipper {
#[ink(storage)]
struct Flipper {
value: bool,
}
impl Flipper {
#[ink(constructor)]
fn new(init_value: bool) -> Self {
Self {
value: init_v... | 17 | 42 | 0.435897 |
e28bc810a5bf0d5736d4c3f2e5835301b58fe84e | 4,229 | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
//! This module defines representation of Diem core data structures at physical level via schemas
//! that implement [`schemadb::schema::Schema`].
//!
//! All schemas are `pub(crate)` so not shown in rustdoc, refer to the source code to... | 40.663462 | 98 | 0.700166 |
ccc837052bd2d8920de6fba95b743326b3403263 | 16,411 | use influxdb_line_protocol::ParsedLine;
use chrono::{DateTime, TimeZone, Utc};
use serde::{Deserialize, Serialize};
use snafu::Snafu;
#[derive(Debug, Snafu)]
pub enum Error {
#[snafu(display("Error in {}: {}", source_module, source))]
PassThrough {
source_module: &'static str,
source: Box<dyn ... | 37.045147 | 91 | 0.643471 |
0a1b2817a9de91cd4a9ddc0825f957bdc061d472 | 9,544 | use std::marker::PhantomData;
use std::mem;
use libc::c_int;
use libusb::*;
use io::IoType;
use device_list::{self, DeviceList};
use device_handle::{self, DeviceHandle};
use error;
/// A `libusb` context.
pub struct Context<Io> {
context: *mut libusb_context,
io: Io,
}
impl<Io> Drop for Context<Io> {
///... | 36.707692 | 122 | 0.544635 |
67feec61c820ad805c42cf4ad807d5c702bee2bc | 18,290 | // 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.
#![cfg(test)]
use anyhow::Context as _;
use fuchsia_async::TimeoutExt as _;
use futures::stream::{self, StreamExt as _, TryStreamExt as _};
use net_declar... | 41.757991 | 107 | 0.510279 |
89becdf2e650e8cf474b68960ebe6307626cb379 | 1,916 | use std::sync::Arc;
use consensus::{Consensus, ConsensusEvent, ConsensusProtocol};
use parking_lot::RwLock;
use json::JsonValue;
use crate::handler::Method;
use crate::handlers::Module;
pub struct ConsensusHandler<P>
where P: ConsensusProtocol + 'static
{
pub consensus: Arc<Consensus<P>>,
state: Arc<RwLo... | 29.030303 | 99 | 0.546973 |
69f3bf44043fd6de8c0129cb952665f5df7837f8 | 19,838 | //! Server launchers
use std::{net::IpAddr, path::PathBuf, process, time::Duration};
use clap::{Arg, ArgGroup, ArgMatches, Command, ErrorKind as ClapErrorKind};
use futures::future::{self, Either};
use log::{info, trace};
use tokio::{self, runtime::Builder};
use shadowsocks_service::{
acl::AccessControl,
con... | 38.670565 | 218 | 0.520365 |
5b3fe4ea86a5e89fbe9cbb160564b969c23cbbe4 | 225 |
#![feature(test)]
extern crate test;
extern crate incoming;
#[bench]
fn universe_ticks(b: &mut test::Bencher) {
let mut universe = wasm_game_of_life::Universe::new();
b.iter(|| {
universe.tick();
});
} | 16.071429 | 58 | 0.622222 |
e884bc4d5c413f18ed1f98376009a9c69541dea6 | 1,839 | // Copyright 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-MIT or ... | 27.863636 | 75 | 0.656335 |
fef7b172016fd6a17fd23f9c2cdc9b4ef7505458 | 2,934 | // Copyright 2018 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... | 27.679245 | 100 | 0.740968 |
d6ec8f0d979e0cde74402f03afdcc9dfa10cdb3f | 42,825 | // 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 ... | 29.616183 | 99 | 0.503678 |
0985ddc2fbe2e60d519047af1a7cc8c6089a82b1 | 3,495 | // 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... | 35.30303 | 98 | 0.674678 |
e66b63bfe2b4c0b342c08a6664caa0d5abd58251 | 476 | // clippy1.rs
// The Clippy tool is a collection of lints to analyze your code
// so you can catch common mistakes and improve your Rust code.
//
// For these exercises the code will fail to compile when there are clippy warnings
// check clippy's suggestions from the output to solve the exercise.
// Execute `rustlings... | 29.75 | 83 | 0.670168 |
fe9750e45bb0841d281576ddc4333a470e2e5f2f | 5,149 | // 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... | 32.796178 | 142 | 0.585551 |
f5d99e7772803fda738cf382811ef8b3cb4022f8 | 773 | #![feature(proc_macro_non_items)]
extern crate cedar;
use cedar::hypertext;
type Model = String;
#[derive(PartialEq)]
enum Message {
NewContent(String),
}
fn update(_: Model, message: &Message) -> Model {
match message {
&Message::NewContent(ref content) => content.clone(),
}
}
type Object = c... | 18.853659 | 78 | 0.564036 |
6215e51cb4faf3f6b4c5320596b790d1005d878a | 9,789 | use crate::crypto::ErrorReplication;
use ic_types::crypto::canister_threshold_sig::error::{
IDkgVerifyComplaintError, IDkgVerifyDealingPrivateError, IDkgVerifyDealingPublicError,
IDkgVerifyOpeningError, ThresholdEcdsaVerifySigShareError,
};
use ic_types::crypto::threshold_sig::ni_dkg::errors::create_transcript_... | 49.690355 | 103 | 0.64409 |
76310d2825b548618c33857194efeb488dfd58ae | 14,366 | //! HAL interface to the SPIM peripheral
//!
//! See product specification, chapter 31.
use core::ops::Deref;
use core::sync::atomic::{compiler_fence, Ordering::SeqCst};
#[cfg(feature="9160")]
use crate::target::{spim0_ns as spim0, SPIM0_NS as SPIM0 };
#[cfg(not(feature="9160"))]
use crate::target::{spim0, SPIM0};
p... | 33.565421 | 116 | 0.580468 |
4b3bfb2571286f1c525a1ee01fe7583cca5aaf73 | 3,767 | use crate::V;
#[derive(Debug, Default, PartialEq)]
#[repr(C)]
pub struct Vector3(pub [f64; 3]);
impl Vector3 {
/// Build a new `Vector3` struct from given `x`, `y` and `z` coordinates
pub const fn new(x: f64, y: f64, z: f64) -> Self {
Self([x, y, z])
}
/// Returns the `x` coordinate of the vect... | 28.11194 | 80 | 0.5442 |
29c6bde8c7df1daf11cf124feed182db2dae4acd | 1,500 | pub mod cmd;
pub mod rsp;
use message::{MessageClass, MessageHeader, MessagePayload, MessageType};
use std::io::{Error, ErrorKind};
pub fn parse(header: &MessageHeader, buffer: &[u8]) -> Result<MessagePayload, Error> {
match header {
MessageHeader {
message_type: MessageType::command_response,... | 31.25 | 86 | 0.588667 |
bfd883be84876252e9671819c0980948d79dc78a | 7,946 | // 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 ... | 37.658768 | 96 | 0.530204 |
9174f8e8456f33908d4ccc2d906f7045b480af9a | 52,516 | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | 32.557967 | 95 | 0.503047 |
719921663c91a1db49147e48714790cfa46fcf0f | 4,921 | /// Return the basic type name, stripped of any crates.
pub(crate) fn basic_type_name<T>() -> &'static str {
let tn = std::any::type_name::<T>();
match tn.rsplit_once("::") {
Some((_, basic)) => basic,
None => tn,
}
}
/// Implement Display for a given class by formatting it as pretty-printe... | 39.368 | 141 | 0.4304 |
fb971526ba8e884b4c057a41d6cda492da3f95f3 | 1,224 | use std::borrow::Cow;
use reqwest::Method;
use crate::api::req::HttpReq;
use crate::api::resp::RespType;
use crate::api::TGReq;
use crate::errors::TGBotResult;
use crate::types::ReplyMarkup;
use crate::vision::PossibilityMessage;
/// Use this method to edit captions of messages sent by the bot.
#[derive(Debug, Clone... | 26.042553 | 94 | 0.683007 |
916c26e9f287b2cb81f421bf6f9fc500e7dd22e5 | 3,604 | use crate::{
for_each2, for_each3, Array2ForEach, Array3ForEach, ArrayForEach, ArrayStrideIter, Local,
Local2i, Local3i, LockStepArrayForEach, LockStepArrayForEach2, LockStepArrayForEach3, Stride,
};
use building_blocks_core::prelude::*;
pub trait ArrayIndexer<N> {
fn stride_from_local_point(shape: PointN... | 29.540984 | 128 | 0.617092 |
26be8e93357e94cc54bd37a3ae06a002bbfe554f | 18,675 | //! TCP connection stream for local server with remote (proxy server or remote target)
use std::{
fmt::{self, Display, Formatter},
io::{self, Error},
net::SocketAddr,
pin::Pin,
task::{self, Poll},
time::Duration,
};
use bytes::{Buf, BufMut, BytesMut};
use futures::ready;
use log::{debug, error... | 34.203297 | 134 | 0.51427 |
5668420574b0e2ed13c75e1da08785b97da1eadc | 5,870 | // Copyright 2015-2021 Swim Inc.
//
// 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 ... | 23.110236 | 75 | 0.528279 |
1cded509c3ef5c09787049e1539faaf960ee5411 | 6,432 | // Copyright (c) 2017-present PyO3 Project and Contributors
use crate::defs;
use crate::func::impl_method_proto;
use crate::method::FnSpec;
use crate::pymethod;
use proc_macro2::{Span, TokenStream};
use quote::quote;
use quote::ToTokens;
use std::collections::HashSet;
pub fn build_py_proto(ast: &mut syn::ItemImpl) ->... | 36.754286 | 100 | 0.539335 |
893a020bbcba4685eca12eb2e2c1e43c0265ac69 | 2,757 | // Copyright (c) 2019 Parity Technologies (UK) Ltd.
//
// 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. All files in the project carrying such notice may not b... | 35.805195 | 104 | 0.682989 |
9c857f91953de6639901258f050c072136b32138 | 8,478 | // Copyright 2020 Tran Tuan Linh
//
// 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 in w... | 29.747368 | 99 | 0.667138 |
dee70b6f576116c3e45c9f0f54b969b3e9b2e6b8 | 366 | extern crate proc_macro;
#[proc_macro_derive(Serialize, attributes(serde))]
pub fn serialize(_items: proc_macro::TokenStream) -> proc_macro::TokenStream {
proc_macro::TokenStream::new()
}
#[proc_macro_derive(Deserialize, attributes(serde))]
pub fn deserialize(_items: proc_macro::TokenStream) -> proc_macro::TokenS... | 28.153846 | 80 | 0.762295 |
753fc815c474be6120ba250fef891c659ba7f79f | 855 | use crate::objc::NSObject;
objc_subclass! {
/// A singleton object used to represent null values in collection objects that
/// don’t allow `nil` values.
///
/// See [documentation](https://developer.apple.com/documentation/foundation/nsnull).
pub class NSNull: NSObject<'static>;
}
impl Default fo... | 25.909091 | 89 | 0.592982 |
67a4c27b27e176f92e66b17a98d029355cb3f81d | 2,538 | pub mod segment_cwd;
pub mod segment_host;
pub mod segment_jobs;
pub mod segment_nix;
pub mod segment_perms;
pub mod segment_ps;
pub mod segment_root;
pub mod segment_ssh;
pub mod segment_time;
pub mod segment_user;
pub mod segment_virtualenv;
pub use self::segment_cwd::*;
pub use self::segment_host::*;
pub use self::... | 25.636364 | 103 | 0.564618 |
ab1948a41fc40ed7c2c3acc45c42dd672e033c31 | 9,922 | /*
* Copyright 2018-2021 TON Labs LTD.
*
* Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use
* this file except in compliance with the License.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,... | 29.096774 | 100 | 0.489317 |
db43f7a425ce66558658b0889f31da6b82703bc3 | 9,309 | // Not in interpret to make sure we do not use private implementation details
use std::convert::TryFrom;
use rustc_hir::Mutability;
use rustc_middle::mir;
use rustc_middle::mir::interpret::{EvalToValTreeResult, GlobalId};
use rustc_middle::ty::{self, TyCtxt};
use rustc_span::{source_map::DUMMY_SP, symbol::Symbol};
u... | 39.113445 | 98 | 0.61274 |
488b1ee9b203b7aa28b69bcbf396717dc35bb0ac | 11,344 | //! <div align="center">
//! <h1>🌗🚀 Dioxus</h1>
//! <p>
//! <strong>A concurrent, functional, virtual DOM for Rust</strong>
//! </p>
//! </div>
//!
//! # Resources
//!
//! This overview provides a brief introduction to Dioxus. For a more in-depth guide, make sure to check out:
//! - [Getting Started](https:... | 31.423823 | 186 | 0.610279 |
1891956d7408b7578295c25544dad859253ce870 | 52,466 | #![doc = "generated by AutoRust"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use super::models;
#[derive(Clone)]
pub struct Client {
endpoint: String,
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
scopes: Vec<String>,
pipeline: azure_core::Pipeline,
... | 48.624652 | 135 | 0.504384 |
71ad14c895d79bff09e7fbc8c77e1e3cc1e874a8 | 1,796 |
pub struct IconSettingsPhone {
props: crate::Props,
}
impl yew::Component for IconSettingsPhone {
type Properties = crate::Props;
type Message = ();
fn create(props: Self::Properties, _: yew::prelude::ComponentLink<Self>) -> Self
{
Self { props }
}
fn update(&mut self, _: Self::Messag... | 39.043478 | 595 | 0.578508 |
fb2a2b9cb9c1de9e0fcbd1a445cd88d9cf41dd10 | 11,432 | use std::{fs, io, path::Path};
/// The character length of the random string used for temporary file names.
const TMP_NAME_LEN: usize = 7;
/// Represents an action that should be run when this objects runs out of scope,
/// unless it's explicitly deactivated.
///
/// This helps with implementing functions that have t... | 29.015228 | 96 | 0.50866 |
9c59e2a7413427992ef40b271fab82f804035256 | 88,878 | // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
#[macro_use]
extern crate lazy_static;
#[cfg(unix)]
extern crate nix;
#[cfg(unix)]
extern crate pty;
extern crate tempfile;
use futures::prelude::*;
use std::io::BufRead;
use std::process::Command;
use tempfile::TempDir;
#[test]
fn std_tests()... | 27.406105 | 279 | 0.641115 |
0910b878890cb569194238f104047080ab265e3f | 44,135 | use crate::prelude::*;
macro intrinsic_pat {
(_) => {
_
},
($name:ident) => {
stringify!($name)
},
($name:literal) => {
stringify!($name)
},
($x:ident . $($xs:tt).*) => {
concat!(stringify!($x), ".", intrinsic_pat!($($xs).*))
}
}
macro intrinsic_arg {
... | 40.013599 | 131 | 0.482905 |
50deb4aa3da1c97fbd2a01c3d7c2620850e799ff | 13,911 | pub mod mock;
use crate::mock::{MockComponentBuilder, MockFile, MockInstallerBuilder};
use rustup::dist::component::Components;
use rustup::dist::component::Transaction;
use rustup::dist::component::{DirectoryPackage, Package};
use rustup::dist::dist::DEFAULT_DIST_SERVER;
use rustup::dist::prefix::InstallPrefix;
use r... | 32.276102 | 98 | 0.572568 |
11861d23a0602b6c42a609bedaf1c428e1fe8f28 | 8,764 | mod candidate_uncles;
use crate::component::entry::TxEntry;
use crate::config::BlockAssemblerConfig;
use crate::error::BlockAssemblerError as Error;
pub use candidate_uncles::CandidateUncles;
use ckb_chain_spec::consensus::Consensus;
use ckb_jsonrpc_types::{BlockTemplate, CellbaseTemplate, TransactionTemplate, UncleTe... | 36.978903 | 111 | 0.60372 |
e2623f788d01c618830dddc169ee8a2dece7f25b | 1,256 | mod camera;
mod font_data;
mod image_data;
mod mesh_data;
mod mesh_group;
mod mesh_instance;
mod window;
use self::{camera::*, font_data::*, image_data::*, mesh_data::*, mesh_group::*, mesh_instance::*, window::*};
use crate::game_graph_driver::GGD_RenderEngine;
pub const RENDER_ENGINE: GGD_RenderEngine = GGD_RenderE... | 19.625 | 109 | 0.806529 |
481527f04b1ee267da0b93ba9b1b7ccc26d1709c | 2,587 | // Copyright 2019 Mats Kindahl
//
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | 26.947917 | 87 | 0.635872 |
d6a0e604de841a8aaf3a9c558330ff1a6f09142a | 17,396 | // Generated by gir (https://github.com/gtk-rs/gir @ ee37253c10af)
// from gir-files (https://github.com/gtk-rs/gir-files @ 5502d32880f5)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ f05404723520)
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case... | 41.222749 | 100 | 0.656415 |
2fc12cdeb6d80972366fc7391498c2b76cd9e2de | 8,937 | #[doc = "Register `PRSET2` writer"]
pub struct W(crate::W<PRSET2_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<PRSET2_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut ... | 27.41411 | 335 | 0.548059 |
23b548dacd45303e75dbb651f79e3a36457b3a9d | 25,730 | //! Lower-level client connection API.
//!
//! The types in this module are to provide a lower-level API based around a
//! single connection. Connecting to a host, pooling connections, and the like
//! are not handled at this level. This module provides the building blocks to
//! customize those things externally.
//!... | 31.883519 | 100 | 0.568558 |
ab1116ec036565f74a263c6aa18d9522539a4169 | 1,554 | use std::fmt;
use crate::expression::Value;
#[derive(Debug, Clone)]
pub enum Type {
// Single character tokens
LeftParen, RightParen, LeftBrace, RightBrace,
Comma, Dot, Minus, Plus, Semicolon, Slash, Star,
// One or two character tokens
Bang, BangEqual,
Equal, EqualEqual,
Greater, Greater... | 21 | 75 | 0.545689 |
1ae9c345cdd93d1923a7d3c1590a0cae4999b90c | 922 | use serde::{de, Deserialize, Deserializer, Serializer};
use serde_with::{DeserializeAs, SerializeAs};
pub struct BoolFromNumber;
impl SerializeAs<bool> for BoolFromNumber {
fn serialize_as<S>(source: &bool, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
if *source {
... | 26.342857 | 79 | 0.533623 |
56f6d717e1ea84399cf501a22b2e53205d0cb430 | 7,178 | use std::io;
use std::io::{ErrorKind, Result};
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
use std::path::{Path, PathBuf};
use std::str::FromStr;
use std::{env, fs};
use yaml_rust::yaml::Hash;
use yaml_rust::{Yaml, YamlEmitter, YamlLoader};
pub struct Config {
pub coordinator: Option<reqwest::Url>,
pu... | 31.902222 | 99 | 0.530092 |
799c7612611824b7a71a33c7b576d04690fe268b | 2,710 | extern crate clap;
use clap::{App, Arg};
fn main() {
// Positional arguments are those values after the program name which are not preceded by any
// identifier (such as "myapp some_file"). Positionals support many of the same options as
// flags, as well as a few additional ones.
let matches = App::n... | 44.42623 | 97 | 0.573063 |
e29b1fd50b70caefaa17d024c25153d314be601a | 1,629 | use crate::co;
use crate::comctl::decl::HIMAGELIST;
use crate::kernel::decl::WinResult;
use crate::prelude::{ComctlHimagelist, UserHicon};
use crate::shell::decl::{SHFILEINFO, SHGetFileInfo};
impl ComctlShellHimagelist for HIMAGELIST {}
/// [`HIMAGELIST`](crate::HIMAGELIST) methods from `comctl`+`shell` featu... | 34.659574 | 84 | 0.626765 |
4ae02f608bd115370aeacaa989754bd3f53fc717 | 32,873 | // Copyright 2018 Google LLC
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
//! The BoringSSL API.
//!
//! This module provides a safe access to the BoringSSL API.
//!
//! It accomplishes this using the following ... | 35.045842 | 145 | 0.615916 |
e2b01ff8edf059736da194e03d3a7c066bb4ca51 | 4,962 | use crate::conf::MEM_OFF;
#[derive(Debug)]
pub struct Dram {
memory: Vec<u8>,
}
impl Dram {
pub fn new(mem_size: usize) -> Dram {
Dram {
memory: vec![0; mem_size],
}
}
#[inline(always)]
fn set_mem(&mut self, idx: usize, data: u8) {
if self.memory.len() < idx {
... | 24.934673 | 73 | 0.43551 |
89c9bcee052fbf73427ebb581082c6b18d4b45e9 | 429 | // Checks if the correct annotation for the sysv64 ABI is passed to
// llvm. Also checks that the abi-sysv64 feature gate allows usage
// of the sysv64 abi.
// ignore-arm
// ignore-aarch64
// ignore-riscv64 sysv64 not supported
// compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]
// CHECK: define x86_6... | 23.833333 | 67 | 0.715618 |
33a8ba896f5089acc69bd89ae78eaf0288363334 | 186 | pub mod controls;
mod core;
pub mod get;
pub mod put;
pub mod tools;
pub use self::core::{MessageData, MessageStore, Settings, INITIAL};
pub use self::get::Get;
pub use self::put::Put;
| 18.6 | 67 | 0.72043 |
6172b440a09ca9e5535ab10f08f03f575f186b0e | 2,291 | use bytes::Bytes;
use std::mem;
use crate::dds::{DdsVariableDetails, VarType};
/// XDR encoded length.
pub fn xdr_length(len: u32) -> [u8; 8] {
let len = len.to_be();
let x: [u32; 2] = [len, len];
unsafe { mem::transmute(x) }
}
/// Upcast 16-bit datatypes to 32-bit datatypes. Non 16-bit variables are pa... | 25.741573 | 95 | 0.450458 |
bbae2032c40b173b14273ed25e3f272e827711ee | 10,136 | use futures_util::stream::Stream;
use http_range::HttpRange;
use hyper::body::{Body, Bytes};
use std::cmp::min;
use std::io::{Cursor, Error as IoError, SeekFrom, Write};
use std::mem::MaybeUninit;
use std::pin::Pin;
use std::task::{Context, Poll};
use std::vec;
use tokio::fs::File;
use tokio::io::{AsyncRead, AsyncSeek,... | 30.715152 | 100 | 0.581788 |
08dce130c2a1d089dd68cefefac4c81eff1d6e89 | 14,316 | use crate::query::{Expression, IdentExpression, Value};
use proc_macro2::Span;
use syn::parse::{Parse, ParseBuffer};
use syn::{parenthesized, token, Error, Token};
pub enum MathematicalExpression {
Paren(Box<Expression>),
BitInverse(Box<Expression>),
BitXor(Box<Expression>, Box<Expression>),
Multi(Box<... | 36.243038 | 99 | 0.545264 |
649c1fedda5c75cf6e7cad62dae7b7abb24a738d | 6,565 | //! Bindings to the Legacy/gauges.h API
use crate::sys;
#[doc(hidden)]
pub trait SimVarF64 {
fn to(self) -> f64;
fn from(v: f64) -> Self;
}
impl SimVarF64 for f64 {
fn to(self) -> f64 {
self
}
fn from(v: f64) -> Self {
v
}
}
impl SimVarF64 for bool {
fn to(self) -> f64 {... | 25.057252 | 100 | 0.506778 |
390ecb306366fa501713778e6567395a237ce997 | 16,197 | #[doc = "Register `MAN` reader"]
pub struct R(crate::R<MAN_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<MAN_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<MAN_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<MAN_SPEC>) ... | 29.719266 | 419 | 0.566092 |
f926fef065ea6c228fed4cc17a473a5ac0e7930f | 1,826 | // 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 ... | 33.2 | 88 | 0.743702 |
898d500607f257879ee840f44c6ff901c0d72591 | 3,764 | use std::io::Write;
use log::debug;
use pulldown_cmark::Event;
pub(crate) trait Highlighter {
/// # Highlight a Code Block
///
/// Returns a list of the events to emit to the TOC to represent the block.
fn hl_codeblock<'a>(&self, name: &str, block: &str) -> Vec<Event>;
/// # Write any HTML header... | 30.354839 | 106 | 0.581296 |
33ef96d1f0dc3dd8eb0522645ef8370f3c3f7f3c | 4,217 | use build::mac::{parse_mac, is_path};
use syntax::ast;
use syntax::ext::base::ExtCtxt;
use syntax::ptr::P;
/*
use build::Builder;
use syntax::visit;
impl<'a, 'b: 'a> Builder<'a, 'b> {
pub fn contains_transition<E: ContainsTransition>(&self, expr: E) -> bool {
expr.contains_transition(self.is_inside_loop()... | 25.871166 | 84 | 0.606118 |
87eb3f6224004ecc653545e4ba3ff03f567e68df | 333 | // run-pass
// Test that unsafe impl for Sync/Send can be provided for extern types.
#![feature(extern_types)]
extern "C" {
type A;
}
unsafe impl Sync for A {}
unsafe impl Send for A {}
fn assert_sync<T: ?Sized + Sync>() {}
fn assert_send<T: ?Sized + Send>() {}
fn main() {
assert_sync::<A>();
assert_se... | 16.65 | 72 | 0.618619 |
18a0e527970667dec465185a73cdf2c0d36f3dba | 7,056 | #[derive(Debug, PartialEq)]
#[cfg_attr(feature = "persistence", derive(serde::Deserialize, serde::Serialize))]
enum Enum {
First,
Second,
Third,
}
#[cfg_attr(feature = "persistence", derive(serde::Deserialize, serde::Serialize))]
pub struct WidgetGallery {
enabled: bool,
boolean: bool,
radio: E... | 30.812227 | 130 | 0.536706 |
645ce8bb150626cd42b891f39b35ea671ad8cd61 | 57,960 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Gets Suite Definition Configuration.</p>
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct SuiteDefinitionConfiguration {
/// <p>Gets Suite Definition Configuration name.</p>
pub suite_definition... | 40.305981 | 200 | 0.591132 |
7550345d7e787355cb346ee63817a52611352d75 | 5,089 | use libc::FILE;
use std::ffi::c_void;
use std::ffi::CString;
use std::os::raw::c_char;
use std::os::raw::c_double;
use std::os::raw::c_float;
use std::os::raw::c_int;
use std::os::raw::c_long;
#[repr(C)]
pub struct TinyTiffFile {
file: *mut FILE,
last_ifd_offset_field: u32,
last_start_pos: c_long,
last... | 31.608696 | 91 | 0.635488 |
0314f109a7c8129a7184b936f8900300ca03d86d | 547 | // 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 ... | 39.071429 | 68 | 0.727605 |
e846109b0ece962e9a47df7e6d729885bb5afa8e | 2,951 | //! Holds enums that don't clearly belong to any specific moudle
use synthizer_sys::*;
mod transmutable {
/// Marker trait so that we can internally make sure that it's safe to
/// transmute enums in generic contexts. Guarantees that the enum came from
/// us, and is backed by an i32.
pub unsafe trait... | 32.076087 | 80 | 0.709251 |
2359b8292f89e8c31d28e41a4077241ed950d5a8 | 11,976 | extern crate x264_sys as ffi;
use std::mem;
use ffi::x264::*;
use std::ptr::null;
use std::os::raw::c_int;
use std::ffi::CString;
pub struct Picture {
pic: x264_picture_t,
plane_size: [usize; 3],
native: bool,
}
struct ColorspaceScale {
w: [usize; 3],
h: [usize; 3],
}
fn scale_from_csp(csp: u32) ... | 29.643564 | 96 | 0.483717 |
0e4e3f42a1a8d8e75fea9226d80a1f12f4524ee8 | 16,905 | // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use deno_core::error::null_opbuf;
use deno_core::error::resource_unavailable;
use deno_core::error::AnyError;
use deno_core::error::{bad_resource_id, not_supported};
use deno_core::AsyncMutFuture;
use deno_core::AsyncRefCell;
use deno_core::Can... | 26.622047 | 80 | 0.642295 |
ab88faa66905be80526eef761a86e141886e1b25 | 4,237 | use std::{convert::Infallible, fmt};
mod option;
pub use option::{OptionPatch, OptionPatchError};
pub trait Patchable {
type Patch: Clone;
type Error: fmt::Display;
/// Takes a value and produces a patches which when applied to the original object results in
/// makes it equal to the taken value
... | 25.524096 | 97 | 0.523012 |
ffab7dc2e41355c6a7d6fd08c5eca57a3108dd1d | 1,142 | // 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 ... | 31.722222 | 81 | 0.691769 |
3ae6e7fca6907858de19b20124d88c6d4ee9dabe | 4,527 | mod additive_map_diff;
mod deploy_item_builder;
pub mod exec_with_return;
mod execute_request_builder;
mod step_request_builder;
mod upgrade_request_builder;
pub mod utils;
mod wasm_test_builder;
use lazy_static::lazy_static;
use num_traits::identities::Zero;
use engine_core::engine_state::{
genesis::{GenesisAcco... | 39.025862 | 93 | 0.706649 |
6183369df4ede8b7a3774fcc0bab28c24b3c5dc8 | 16,132 | use crate::{client, frame, proto, server};
use crate::codec::RecvError;
use crate::frame::{Reason, StreamId};
use crate::frame::DEFAULT_INITIAL_WINDOW_SIZE;
use crate::proto::*;
use bytes::{Bytes, IntoBuf};
use futures::{Stream, try_ready};
use tokio_io::{AsyncRead, AsyncWrite};
use std::marker::PhantomData;
use std... | 37.429234 | 97 | 0.514071 |
14e9ca342d79fa9e0f69889ee33e56ec1dec1a07 | 12,163 | use crate::config::{ModuleConfig, SegmentConfig};
use crate::segment::Segment;
use ansi_term::{ANSIString, ANSIStrings, Style};
use std::fmt;
// List of all modules
// Keep these ordered alphabetically.
// Default ordering is handled in configs/mod.rs
pub const ALL_MODULES: &[&str] = &[
"aws",
#[cfg(feature = ... | 30.870558 | 98 | 0.555208 |
22d2c63a54b355acbb085e48b59141747daefa37 | 273 | extern crate unrar_sys as native;
extern crate regex;
extern crate num;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate enum_primitive;
#[macro_use]
extern crate bitflags;
extern crate widestring;
pub use archive::Archive;
pub mod error;
pub mod archive;
| 18.2 | 33 | 0.791209 |
01e3ff7d66e4ee0ae757375f067d67e6db3775bd | 5,518 | /*
Syntax to validate:
* Order of items: description, instance resolvers
* Optional Generics/lifetimes
* Custom name vs. default name
* Optional commas between items
* Optional trailing commas on instance resolvers
*
*/
use std::marker::PhantomData;
use crate::{
ast::InputValue,
graphql_object,
schema::... | 24.968326 | 79 | 0.580826 |
4a68035e051a05ded2b4acc89be95b6ec4a3fb2e | 2,727 | #[doc = "Register `PRODTEST[%s]` reader"]
pub struct R(crate::R<PRODTEST_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<PRODTEST_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<PRODTEST_SPEC>> for R {
#[inline(always)]
fn from(read... | 30.988636 | 269 | 0.621562 |
64ecf1c52afdb8bca3e6ddf0edec651745498622 | 673 | //! Demonstrates basic assembling for a full program.
#![crate_type="rlib"]
fn exit() -> ! {
#[direct_asm::assemble]
unsafe extern "C" fn exit_raw() -> ! {
"xor %rdi, %rdi";
"mov %rax, 60";
// Argument setup in edi
"syscall"
}
unsafe {
exit_raw()
}
}
fn writ... | 19.228571 | 84 | 0.506686 |
fc962879c8f4a908b819d60d24128df25aaf3830 | 8,510 | // Copyright (c) The nextest Contributors
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Metadata management.
use crate::{
config::{NextestJunitConfig, NextestProfile},
errors::WriteEventError,
list::TestInstance,
reporter::TestEvent,
runner::{ExecuteStatus, ExecutionDescription, ExecutionResul... | 41.111111 | 169 | 0.518801 |
18a156f4a1c5ff6ecc73413b93961de345542452 | 2,326 | use std::sync::{
atomic::{AtomicU64, Ordering},
Arc,
};
#[derive(Clone)]
pub struct ScoreCounter {
score: Arc<AtomicU64>,
count: Arc<AtomicU64>,
}
impl ScoreCounter {
pub fn inc_by(&self, score: i64) {
self.score.fetch_add(score as u64, Ordering::SeqCst);
self.count.fetch_add(1, Or... | 19.880342 | 61 | 0.512468 |
119a207f7c5f9f63fc80e728e9c077498b8b5d4c | 2,576 | use crate::*;
test_case!(unique, async move {
use {executor::ValidateError, prelude::Value};
run!(
r#"
CREATE TABLE TestA (
id INTEGER UNIQUE,
num INT
)"#
);
run!(
r#"
CREATE TABLE TestB (
id INTEGER UNIQUE,
num INT UNIQUE
)"#
);
run!(
r#"
CREATE TABLE... | 29.272727 | 95 | 0.527562 |
21366531e8103ca62ede68ae85f5a5b9d9877874 | 24,685 | use crate::syntax::discriminant::DiscriminantSet;
use crate::syntax::file::{Item, ItemForeignMod};
use crate::syntax::report::Errors;
use crate::syntax::Atom::*;
use crate::syntax::{
attrs, error, Api, Doc, Enum, ExternFn, ExternType, Impl, Include, IncludeKind, Lang,
Namespace, Pair, Receiver, Ref, ResolvableN... | 33.585034 | 99 | 0.506785 |
abc03af3f0ec6d92c6029860945b6ee864765335 | 2,196 | use jfs;
use std::path;
use sda_protocol::AgentId;
use SdaServerResult;
use stores::{BaseStore, AuthTokensStore, AuthToken};
use jfs_stores::JfsStoreExt;
pub struct JfsAuthTokensStore {
auth_tokens: jfs::Store,
}
impl JfsAuthTokensStore {
pub fn new<P: AsRef<path::Path>>(prefix: P) -> SdaServerResult<JfsAu... | 27.797468 | 92 | 0.610656 |
14e2ca35db5457a6f0a8d7fc85963e9d0c48eb33 | 7,929 | use std::{
cell::{Ref, RefCell},
fs::{File, OpenOptions},
rc::Rc,
};
use crate::{
encoder::Encoder,
raw::{drm_mode_get_planes, drm_mode_get_resources, drm_set_client_capability},
Buffer, BufferType, Connector, Crtc, Error, Output, Plane, Result,
};
#[allow(dead_code)]
#[derive(Debug)]
#[repr(u... | 24.396923 | 100 | 0.533232 |
75a3caf22430c0f006bf52bb16881dfa8dd172bc | 1,859 | // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use crate::bindings;
use rusty_v8 as v8;
use std::ops::Deref;
use std::ops::DerefMut;
/// A ZeroCopyBuf encapsulates a slice that's been borrowed from a JavaScript
/// ArrayBuffer object. JavaScript objects can normally be garbage collected,
/... | 23.2375 | 77 | 0.649812 |
2804197c02fd029aefe449b5bf3f47fcfdb504ee | 621 | #![allow(non_camel_case_types)]
pub const BMA421_DEVICE_ID: u8 = 0x11;
pub const BMA421_ALT_DEVICE_ID: u8 = 0x12; //TODO this is a guess
pub const BMA423_DEFAULT_DEVICE_ID: u8 = 0x18;
pub const BMA423_ALT_DEVICE_ID: u8 = 0x19;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[repr(u8)]
pub enum Register {
CHIP_ID =... | 19.40625 | 65 | 0.661836 |
7676a80fe18ff34ab6e740d5e615d13f7045010e | 284 | //! A mininal runtime / startup for OpenSBI on RISC-V.
#![no_std]
#![feature(llvm_asm, global_asm)]
#![feature(alloc_error_handler)]
#![deny(warnings, missing_docs)]
extern crate alloc;
#[macro_use]
pub mod io;
mod log;
mod runtime;
pub mod sbi;
pub use opensbi_rt_macros::entry;
| 16.705882 | 54 | 0.725352 |
d56039a665b44cb7a89e26d45698e65210838aa5 | 1,989 | /*
* NHL API
*
* Documenting the publicly accessible portions of the NHL API.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct ScheduleGame {
#[serde(rename = "gamePk", skip_serializing_if = ... | 34.293103 | 75 | 0.638009 |
f7f77e144778416f1b31715c2f19bb657d07ad7b | 28,432 | use std::iter;
use cgmath::prelude::*;
use wgpu::util::DeviceExt;
use winit::{
event::*,
event_loop::{ControlFlow, EventLoop},
window::Window,
};
mod model;
mod texture;
use model::{DrawLight, DrawModel, Vertex};
#[rustfmt::skip]
pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4<f32> = cgmath::Matrix4::n... | 35.944374 | 107 | 0.502392 |
7ad715dbaa55caf38e77a7bbd81fabc9387c0ffd | 1,794 | use crate::html_to_element;
use material_yew::MatIconButton;
use yew::prelude::*;
pub struct Codeblock {
link: ComponentLink<Self>,
props: Props,
showing_code: bool,
}
pub enum Msg {
FlipShowCode,
}
#[derive(Properties, Clone)]
pub struct Props {
// pub children: Children,
// pub code: String... | 24.575342 | 95 | 0.501115 |
1e489fb926d6bf8af4127690fa22e43d93d372ab | 3,656 | pub mod conditionals;
mod animation_action;
mod call;
mod control_action;
mod delay;
mod echo;
mod entity_action;
mod foreign_entity_action;
mod group;
mod health_action;
mod insert_components;
mod lifecycle_action;
mod move_action;
mod player_action;
mod random;
mod repeat_delay;
mod sound_action;
mod spawn_action;
m... | 36.56 | 80 | 0.713895 |
622ba1a5cce2765568b244c096ce01adade3cb02 | 10,645 | // Type encoding
use io::WriterUtil;
use std::map::hashmap;
use syntax::ast::*;
use syntax::diagnostic::span_handler;
use middle::ty;
use middle::ty::vid;
use syntax::print::pprust::*;
export ctxt;
export ty_abbrev;
export ac_no_abbrevs;
export ac_use_abbrevs;
export enc_ty;
export enc_bounds;
export enc_mode;
type ... | 27.57772 | 78 | 0.480319 |
1e0c11641f9a4e4a15f3d9e1f389560f75cd4815 | 35,426 | // 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... | 37.807898 | 99 | 0.571332 |
f5417dbf32f61bcc146e1cb200210626aa34663c | 11,561 | pub mod convert;
use std::fmt;
use proc_macro2::TokenStream;
use quote::{ToTokens, TokenStreamExt};
use syn::{
ext::IdentExt,
parenthesized,
parse::{Parse, ParseStream},
punctuated::Punctuated,
token::{Let, Match, Paren},
LitStr, Token,
};
pub type Epsilon = Token![_];
pub type Ident = syn::... | 24.862366 | 79 | 0.549001 |
7acced20249675ff469713ff2e42f83a473de2b6 | 26,764 | //! This module contains the `CyclesAccountManager` which is responsible for
//! updating the cycles account of canisters.
//!
//! A canister has an associated cycles balance, and may `send` a part of
//! this cycles balance to another canister
//! In addition to sending cycles to another canister, a canister `spend`s
... | 38.620491 | 166 | 0.611456 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.