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 |
|---|---|---|---|---|---|
720e03597546e9fd6172431c482bab2de47f9578 | 3,753 | // 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 anyhow;
use argh::FromArgs;
use fidl::encoding::Decodable;
use fidl::endpoints::create_endpoints;
use fidl_fuchsia_media_sessions2::*;
use fuchsia_asyn... | 29.093023 | 81 | 0.594991 |
3a91608908f0b1615c08de9e093a8c32ced82d9b | 214 | extern crate slog_stdlog;
extern crate slog_envlogger;
#[macro_use]
extern crate log;
fn main() {
let _guard = slog_envlogger::init().unwrap();
error!("error");
info!("info");
trace!("trace");
}
| 15.285714 | 49 | 0.640187 |
e546e921924144e06a49e91e22e46654f3f0c378 | 963 | // just hard code all special cases
const VERSES: [&'static str; 3] =
["No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy \
some more, 99 bottles of beer on the wall.\n",
"1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more \
... | 38.52 | 97 | 0.563863 |
14974eb89b1aebd874514d25a043809e81828c2a | 2,072 | use crate::buf::IoBuf;
use crate::driver::{Op, SharedFd};
use crate::BufResult;
use socket2::SockAddr;
use std::io::IoSlice;
use std::task::{Context, Poll};
use std::{boxed::Box, io, net::SocketAddr};
pub(crate) struct SendTo<T> {
#[allow(dead_code)]
fd: SharedFd,
pub(crate) buf: T,
#[allow(dead_code)]... | 28.777778 | 91 | 0.539093 |
e966b4f1ece918c9fa1b99096b41139c2923078e | 494,250 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[derive(Debug)]
pub(crate) struct Handle<
C = aws_smithy_client::erase::DynConnector,
M = crate::middleware::DefaultMiddleware,
R = aws_smithy_client::retry::Standard,
> {
pub(crate) client: aws_smithy_client::Client<C, M,... | 58.909416 | 778 | 0.629685 |
b945e2b05e8b28ea314712f4ba4302eb4fe9e29c | 622 | use crate::{NodeCommand, WalletCommand};
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(name = "cardano", about = "Manage cardano components")]
pub enum CardanoCommand {
Node(NodeCommand),
Wallet(WalletCommand),
// Tx(TxCommand),
// Mint(MintCommand),
// Address(AddressCommand),
... | 27.043478 | 67 | 0.663987 |
6a3cf0cac9fcbf6f7b8e80c63794fa47afb1378a | 2,151 | use std::env;
use std::error::Error;
use std::fs;
pub struct Config {
pub query: String,
pub filename: String,
pub case_sensitive: bool,
}
impl Config {
pub fn new(mut args: std::env::Args) -> Result<Config, &'static str> {
args.next();
let query = match args.next() {
Some... | 20.485714 | 84 | 0.529521 |
d7aadfda9469a0e336c33fe66e68e2bec3813535 | 1,075 | use std::path::Path;
use config::Config;
use monsterapi::{database, scraping, Result};
fn main() -> Result<()> {
let config = Config::builder()
.add_source(config::File::with_name("config.toml"))
.add_source(config::Environment::default())
.build()?;
let dal = database::AccessLayer::... | 32.575758 | 93 | 0.650233 |
fe6616e134656e935b2bdf767f7ae9696a2739cc | 33,270 | pub extern crate pulldown_cmark;
pub extern crate serde_yaml;
#[macro_use]
extern crate lazy_static;
mod context;
mod frontmatter;
mod references;
mod walker;
pub use context::Context;
pub use frontmatter::{Frontmatter, FrontmatterStrategy};
pub use walker::{vault_contents, WalkOptions};
use frontmatter::{frontmatt... | 40.036101 | 138 | 0.566757 |
d9ec5a5fb00b92293c68ec87063cd08f586aa34d | 16,160 | //! ACME supports.
//!
//! Reference: <https://datatracker.ietf.org/doc/html/rfc8555>
//! Reference: <https://datatracker.ietf.org/doc/html/rfc8737>
//!
//! * HTTP-01
//!
//! # Example
//!
//! ```no_run
//! use salvo_core::listener::{AcmeListener, TcpListener};
//! use salvo_core::prelude::*;
//!
//! #[fn_handler]
... | 32.646465 | 113 | 0.591213 |
4a01370aefbdcaa7e0896f2538b50449438d824f | 129,350 | #![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.578383 | 277 | 0.605528 |
09020080d662b38284b11ec10104575a52681ce0 | 4,662 | use std::convert::{TryFrom, TryInto};
use std::mem;
use std::sync::Arc;
use std::time::{UNIX_EPOCH, Duration};
use anyhow::{anyhow, Result};
use flate2::{Compression, write::GzEncoder};
use log::{debug, error, warn};
use parking_lot::Mutex;
use reqwest::{Client as HttpClient, Method, Request, Url};
use reqwest::header:... | 34.279412 | 83 | 0.516088 |
6ae2ec5b52e4c7e337df1ebcef6a26cc8d98487c | 24,914 | // 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... | 33.713126 | 97 | 0.546319 |
0ac7f69d2c5c40cf9fb364af1efa2eed3e58398a | 31,496 | use crate::{
arena::{Arena, Handle},
BinaryOperator, Constant, ConstantInner, Expression, ScalarKind, ScalarValue, Type, TypeInner,
UnaryOperator,
};
#[derive(Debug)]
pub struct ConstantSolver<'a> {
pub types: &'a Arena<Type>,
pub expressions: &'a Arena<Expression>,
pub constants: &'a mut Arena... | 36.327566 | 100 | 0.438246 |
08e9f77d2325a0df104d8fc0cf4140b4e74c020a | 2,516 | // Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
pub mod ap;
pub mod client;
pub mod clone_utils;
pub mod mesh;
pub mod phy_selection;
mod sink;
#[cfg(test)]
pub mod test_utils;
pub mod timer;
use fidl_f... | 26.484211 | 73 | 0.697933 |
ab09bb5e523d1517d1760d5d6b118a76c73df2ae | 2,309 | use duct::cmd;
use std::{ffi::OsString, fmt, io};
/// Creates a [`DisplayCmd`] instance.
///
/// Arguments must implement `Into<`[`OsString`]`>`.
macro_rules! display_cmd {
($name:expr $(, $arg:expr)* $(,)?) => {
$crate::cmd::DisplayCmd::new($name)$(.arg($arg))*
};
}
/// A representation of a shell co... | 26.848837 | 70 | 0.51191 |
39b2510af1ab8c1797f5f538eff0d765705e9415 | 4,496 | use std::collections::{HashMap, HashSet};
use std::error::Error;
use std::fmt::{Debug, Display, Formatter};
use std::hash::Hash;
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
pub struct CircularDependencyError;
impl CircularDependencyError {
pub fn new() -> Self {
Self
}
}
impl Display for CircularDep... | 26.139535 | 93 | 0.487767 |
e5713b73eb94b4cfc7de2c4181487e808b49826e | 5,515 | use crate::array::*;
use crate::bitmap::Bitmap;
use crate::datatypes::{DataType, IntervalUnit};
use crate::types::days_ms;
fn validity_size(validity: &Option<Bitmap>) -> usize {
validity.as_ref().map(|b| b.bytes().len()).unwrap_or(0)
}
macro_rules! dyn_primitive {
($array:expr, $ty:ty) => {{
let array... | 37.013423 | 106 | 0.558477 |
c1fe95d6e997b9287e1f3c1125617faff8ee58ed | 48,994 | // 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 {
anyhow::Error,
argh::FromArgs,
carnelian::{
make_app_assistant, render::*, AnimationMode, App, AppAssistant, Color, Point,
... | 36.078056 | 120 | 0.505184 |
1121a397c6a2a1baf33f3a8e9ac37bf6003fec6d | 17,572 | #[doc = "Reader of register XTALCTRL"]
pub type R = crate::R<u32, super::XTALCTRL>;
#[doc = "Writer for register XTALCTRL"]
pub type W = crate::W<u32, super::XTALCTRL>;
#[doc = "Register XTALCTRL `reset()`'s with value 0x0358"]
impl crate::ResetValue for super::XTALCTRL {
type Type = u32;
#[inline(always)]
... | 30.56 | 84 | 0.574437 |
56d40f00897cc029b4d4637c96715043fbc01277 | 1,111 | use crate::fs::{Metadata, MetadataExt};
use posish::fs::{statat, AtFlags};
use std::{
fs, io,
sync::atomic::{AtomicBool, Ordering::Relaxed},
};
/// Like `file.metadata()`, but works with `O_PATH` descriptors on old (pre 3.6)
/// versions of Linux too.
pub(super) fn file_metadata(file: &fs::File) -> io::Result<... | 38.310345 | 83 | 0.612961 |
d62d64f13a0a441559aa0d505d4d281a71ed09db | 3,630 | // This file is part of Substrate.
// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the F... | 27.923077 | 89 | 0.707163 |
f5cd21f3cb8b268791bd71d4f36b7f3e07d1520b | 1,188 | /// Algebra - Assign Monoidal Act
use crate::algebra::act::*;
use crate::algebra::monoid::*;
#[derive(Debug, Clone, Copy)]
pub enum Assign<X> {
Some(X),
None,
}
impl<X> std::ops::Mul for Assign<X> {
type Output = Self;
fn mul(self, other: Self) -> Self {
match (self, &other) {
(x, A... | 25.276596 | 78 | 0.51431 |
c17d78646e73df04ae4606d6099e739b63f10e1a | 1,333 | //! Support for building the types in `pact_matching::models`. This could
//! theoretically be moved into `pact_matching::models` at some future date,
//! but that's currently undergoing heavy construction.
mod interaction_builder;
mod http_part_builder;
mod pact_builder;
mod request_builder;
mod response_builder;
pu... | 34.179487 | 80 | 0.63991 |
d53f1cddae0fa87ee3cafd934b94f5db0f49f7a4 | 1,733 | use bitcoin::Error as BitcoinError;
use hex::FromHexError;
use jsonrpc_core_client::RpcError;
use jsonrpc_http_server::jsonrpc_core::Error as JsonRpcError;
use parity_scale_codec::Error as CodecError;
use runtime::{substrate_subxt::Error as XtError, Error as RuntimeError};
use std::net::AddrParseError;
use thiserror::E... | 34.66 | 72 | 0.694749 |
e2320e53b7eaa9faf20831877e0a63f4e80c9a9c | 17,064 | use crate::repository::{MessageData, MsgParams as repoMsgParams, Repository, TokenData};
use message::Msg;
use std::collections::HashMap;
use std::sync::mpsc::{Receiver as mpscReceiver, Sender as mpscSender};
use std::sync::{mpsc, Arc, Mutex};
use std::thread;
use std::time::Duration;
use ws::{Builder, CloseCode, Handl... | 33.992032 | 130 | 0.43038 |
91d80ca4aa16886f6b1319a47ddb11f34380ab7c | 618 | use std::env::args;
use pdf::error::PdfError;
use pdf::file::File;
/// extract and print a PDF's metadata
fn main() -> Result<(), PdfError> {
let path = args()
.nth(1)
.expect("Please provide a file path to the PDF you want to explore.");
let file = File::<Vec<u8>>::open(&path).unwrap();
... | 26.869565 | 79 | 0.545307 |
794a0c23b0feea01bbbfb4ab2ca74bc86e681685 | 344 | fn main() {
let path = "../../kernel/target/x86_64/release/deps";
println!("cargo:rustc-link-search=all={}", path);
let path = "../../kernel/target/aarch64/release/deps";
println!("cargo:rustc-link-search=all={}", path);
let path = "../../kernel/target/release/deps";
println!("cargo:rustc-link-s... | 38.222222 | 58 | 0.613372 |
48ecad1c7e7f0f0f8167cbad2a20f2777a085be3 | 932 | use ignite_plugin_utils::{console::log, editor::ignite};
use serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::*;
#[derive(Debug, Clone, Serialize, Deserialize)]
struct Payload {
pub message: String,
}
#[wasm_bindgen]
pub fn query(query: &str, data: JsValue) -> Result<(), JsValue> {
match query {
... | 26.628571 | 65 | 0.492489 |
3ae0749ac75480ebe634f686a2a2cafb277d0428 | 5,554 | <?xml version="1.0" encoding="UTF-8"?>
<MobileElementEntity>
<description></description>
<name>TextView - ADD TO CART</name>
<tag></tag>
<elementGuidId>00000000-0000-0000-0000-000000000000</elementGuidId>
<selectorMethod>BASIC</selectorMethod>
<useRalativeImagePath>false</useRalativeImagePath>
<web... | 34.930818 | 556 | 0.67951 |
db2961fcc6e88335ae320310a0c3b591dd114305 | 2,051 | use crate::base_inference::resolve_to_base_inferred::ResolveToBaseInferred;
use crate::base_inference::{BaseInference, BaseInferenceTables};
use crate::results::TypeCheckResults;
use crate::TypeCheckDatabase;
use crate::TypeChecker;
use crate::UniverseBinder;
use generational_arena::Arena;
use lark_collections::{FxInde... | 32.555556 | 80 | 0.680644 |
61dd994e614224dd3a1267ec52664bdb65638075 | 67,279 | //! The `pubsub` module implements a threaded subscription service on client RPC request
use crate::{
optimistically_confirmed_bank_tracker::OptimisticallyConfirmedBank,
rpc::{get_parsed_token_account, get_parsed_token_accounts},
};
use core::hash::Hash;
use jsonrpc_core::futures::Future;
use jsonrpc_pubsub::{... | 36.624388 | 111 | 0.566284 |
dd5a1a46d9ba46251dc0228edffdcaa544124381 | 6,633 | // Copyright (c) The Dijets Core Contributors
// SPDX-License-Identifier: Apache-2.0
pub mod command_adapter;
pub mod local_fs;
#[cfg(test)]
mod test_util;
#[cfg(test)]
mod tests;
use crate::storage::{
command_adapter::{CommandAdapter, CommandAdapterOpt},
local_fs::{LocalFs, LocalFsOpt},
};
use anyhow::{ensu... | 35.281915 | 101 | 0.665008 |
abd1aa29d780d498b6c6a0034f55a063e36472f0 | 6,794 | // 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... | 34.140704 | 179 | 0.650574 |
d7efe18690b370e33069909b9e8075d7f7dc5c24 | 5,129 | use std::sync::Arc;
use bonsaidb_core::{permissions::PermissionDenied, schema, schema::InsertError, AnyError};
use schema::InvalidNameError;
/// An error occurred while interacting with a [`Server`](crate::Server).
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// An error occurred from the QUIC transport l... | 31.466258 | 91 | 0.643205 |
d70c037d32a5a04e95eed4c28fffcab974528a35 | 36,526 | use copyless::BoxHelper;
use serde::{Deserialize, Serialize};
use swc_atoms::{js_word, JsWord};
use swc_common::Spanned;
use swc_ecma_ast::{
Accessibility, Expr, MemberProp, Pat, TruePlusMinus, TsArrayType, TsAsExpr,
TsCallSignatureDecl, TsConditionalType, TsConstAssertion, TsConstructSignatureDecl,
TsConst... | 33.448718 | 99 | 0.600887 |
fe5042f51a1c3c0c2040fcb3448c634204f790e9 | 36,366 | use std::{
borrow::Cow,
convert::{TryFrom, TryInto},
fmt,
vec,
};
use serde::de::{
self,
Deserialize,
DeserializeSeed,
Deserializer as _,
EnumAccess,
Error,
MapAccess,
SeqAccess,
Unexpected,
VariantAccess,
Visitor,
};
use serde_bytes::ByteBuf;
use crate::{
... | 29.881676 | 100 | 0.478139 |
d5e1c061bf0bab92f8c1c9b8ca551a27e33d329a | 109,411 | //! Error Reporting Code for the inference engine
//!
//! Because of the way inference, and in particular region inference,
//! works, it often happens that errors are not detected until far after
//! the relevant line of code has been type-checked. Therefore, there is
//! an elaborate system to track why a particular ... | 42.423808 | 100 | 0.467147 |
7a51897b4791d17df53a7d31a01a658c2f785d96 | 77 | extern crate glutin;
pub use input::glutin::{ElementState, VirtualKeyCode};
| 19.25 | 54 | 0.779221 |
8a21c368e1e4afe64f3a8c4f825e3692781171c2 | 2,563 | use swc_ecma_ast::*;
use swc_ecma_utils::is_valid_ident;
use swc_ecma_visit::{noop_fold_type, Fold, FoldWith};
use swc_trace_macro::swc_trace;
/// babel: `transform-member-expression-literals`
///
/// # Input
/// ```js
/// obj["foo"] = "isValid";
///
/// obj.const = "isKeyword";
/// obj["var"] = "isKeyword";
/// ```
/... | 24.883495 | 89 | 0.489661 |
71b840569aa6bee023d0eb2a15ca95e92f9890e8 | 10,290 | use crossterm::{cursor, terminal, RawScreen};
use crossterm::{InputEvent, KeyEvent};
use nu_errors::ShellError;
use nu_protocol::{
outln, serve_plugin, CallInfo, Plugin, Primitive, Signature, UntaggedValue, Value,
};
use nu_source::AnchorLocation;
use syntect::easy::HighlightLines;
use syntect::highlighting::{Styl... | 34.646465 | 99 | 0.416132 |
defb9bc47e12259345bedfedf1c5ccfec0d258e9 | 4,764 | // Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
crate::net::{set_nonblock, EventedFd},
futures::{
future::Future,
task::{Poll, Waker},
try_ready,
},
std::{
... | 28.357143 | 99 | 0.536734 |
873837ac269e73c51e00599fbcb68c7b2ff24b9c | 3,350 | #[doc = "Reader of register EN"]
pub type R = crate::R<u32, super::EN>;
#[doc = "Writer for register EN"]
pub type W = crate::W<u32, super::EN>;
#[doc = "Register EN `reset()`'s with value 0"]
impl crate::ResetValue for super::EN {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
... | 26.587302 | 86 | 0.53194 |
f74ecbc902999c3745dd3a80955611b9d83af5ba | 3,221 | extern crate simple_logger;
#[macro_use]
extern crate log;
extern crate base64;
extern crate bincode;
extern crate image;
extern crate qrcode;
extern crate reqwest;
extern crate whatsappweb;
use std::fs::{remove_file, File, OpenOptions};
use std::io::Read;
use std::sync::Arc;
use image::Luma;
use whatsappweb::connec... | 30.102804 | 100 | 0.561006 |
712935d0e4f36bc2c6ebaf1e4e42cac0d5855217 | 2,676 | //! Encoders
use std::fmt;
use std::io;
use log::LogRecord;
pub mod pattern;
pub mod writer;
/// A trait implemented by types that can serialize a `LogRecord` into a
/// `Write`r.
///
/// `Encode`rs are commonly used by `Append`ers to format a log record for
/// output.
pub trait Encode: fmt::Debug + Send + Sync + '... | 25.485714 | 77 | 0.599028 |
0e3a46b781a781ed843b444111198ebb17ffce2b | 2,309 | // Copyright 2018-2020 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... | 30.381579 | 99 | 0.65916 |
677dc08c67f13c5e801788ba74192798bdf98f3c | 5,621 | use hacspec_lib::*;
pub enum Error {
InvalidAddition,
}
const BITS: usize = 256;
public_nat_mod!(
type_name: P256FieldElement,
type_of_canvas: FieldCanvas,
bit_size_of_field: 256, // XXX: Unfortunately we can't use constants here.
modulo_value: "ffffffff00000001000000000000000000000000fffffffffff... | 32.12 | 99 | 0.601316 |
64e23e4ad60be0e401a0bf58626262da314d3145 | 3,810 | //! Availability Impact (A)
use crate::{Error, Metric, MetricType, Result};
use alloc::borrow::ToOwned;
use core::{fmt, str::FromStr};
/// Availability Impact (A) - CVSS v3.1 Base Metric Group
///
/// Described in CVSS v3.1 Specification: Section 2.3.3:
/// <https://www.first.org/cvss/specification-document#t6>
///
/... | 38.1 | 76 | 0.64042 |
1105bda0e75197863457c2f242897aeeb43f8f7a | 7,526 | use super::ViewPage;
use seed::prelude::*;
use crate::{
entity::{
form::settings::{Field, Form, Problem},
Viewer,
},
loading, request,
route::{self, Route},
GMsg, Session,
};
// ------ ------
// Model
// ------ ------
// ------ Model ------
#[derive(Default)]
pub struct Model... | 27.367273 | 91 | 0.425193 |
e82a4ba0a474c2f4e513e937eeced0e11a1758bf | 62,335 | use std::cell::{RefCell, RefMut};
use std::collections::HashMap;
use std::convert::TryFrom;
use std::rc::Rc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::time::Instant;
use anyhow::anyhow;
use anyhow::Error;
use never::Never;
use semver::Version;
use wasmtime::{Memory, Trap};
use graph::blockchain::{Blockc... | 36.667647 | 127 | 0.556349 |
fc83b13aa10da3008207f13ea78f454ae1c686c4 | 5,163 | use awint::prelude::*;
use rand_xoshiro::{rand_core::SeedableRng, Xoshiro128StarStar};
/// [Bits::lut] needs its own test because of its special requirements
#[test]
fn lut_and_field() {
let mut rng = Xoshiro128StarStar::seed_from_u64(0);
#[cfg(not(miri))]
let (out_bw_max, pow_max) = (258, 8);
#[cfg(mi... | 38.244444 | 87 | 0.561883 |
fbdff89781f9e9e2323d9d10b35cf2e3381c5435 | 2,016 | // WASI:
// mapdir: .:test_fs/hamlet
// this program is used in the pause/resume test
use std::fs;
#[cfg(target_os = "wasi")]
use std::os::wasi::prelude::AsRawFd;
use std::path::PathBuf;
#[cfg(target_os = "wasi")]
#[repr(C)]
struct WasiIovec {
pub buf: u32,
pub buf_len: u32,
}
#[cfg(target_os = "wasi")]
#[l... | 23.172414 | 76 | 0.554067 |
bf631dc797a9637659fda1daac5dcfce4708b94b | 10,165 | use {
clap::{crate_description, crate_name, App, Arg, ArgMatches},
safecoin_faucet::faucet::FAUCET_PORT,
safecoin_sdk::{
fee_calculator::FeeRateGovernor,
pubkey::Pubkey,
signature::{read_keypair_file, Keypair},
},
std::{net::SocketAddr, process::exit, time::Duration},
};
con... | 34.811644 | 119 | 0.547664 |
ddae8fa824843d8c4111944d8841120e1f1979c6 | 1,057 | //! Echo characters sent back to the serial port.
//!
//! Note: This example is for the STM32F745/STM32F746
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate panic_halt;
use nb::block;
use cortex_m_rt::entry;
use stm32f7xx_hal::{
pac,
prelude::*,
serial::{self, Serial},
};
#[... | 20.326923 | 62 | 0.573321 |
d50209fbecbb27116747c64ee315db64e3cddf79 | 1,789 | cfg_sync!(
mod sync_impl;
pub use sync_impl::{MmapFileReader, MmapFileReaderExt};
);
cfg_async! {
macro_rules! declare_and_impl_basic_reader {
() => {
pin_project! {
/// AsyncMmapFileReader helps read data from mmap file
/// like a normal file.
... | 26.701493 | 91 | 0.405254 |
c16d6fabbaf8850111f1cdb222ada7f0d70b8d1f | 9,014 | use raui_core::prelude::*;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[cfg(not(feature = "scalar64"))]
use std::f32::consts::PI;
#[cfg(feature = "scalar64")]
use std::f64::consts::PI;
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum ThemeColor {
Default,
P... | 29.171521 | 92 | 0.639893 |
4b782a0d16eb1621f0cd30ae1347a82ae7b7e9c3 | 15,659 | //! # Serde JSON
//!
//! JSON is a ubiquitous open-standard format that uses human-readable text to
//! transmit data objects consisting of key-value pairs.
//!
//! ```json
//! {
//! "name": "John Doe",
//! "age": 43,
//! "address": {
//! "street": "10 Downing Street",
//! "city": "London"
/... | 33.317021 | 84 | 0.617472 |
e657a457c7f6e4350974c6b47341f018b6665785 | 1,485 | #[doc = "Register `TASKS_RESUME` writer"]
pub struct W(crate::W<TASKS_RESUME_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<TASKS_RESUME_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&... | 32.282609 | 337 | 0.638384 |
8f92eb43149d989c12bf995dd417a9776e857e95 | 3,707 | use druid::widget::{Align, Button, Flex, Label, Padding, TextBox};
use druid::{AppLauncher, Data, Lens, LocalizedString, Widget, WidgetExt, WindowDesc};
const VERTICAL_WIDGET_SPACING: f64 = 20.0;
const HORIZTONAL_WIDGET_SPACING: f64 = 8.0;
const WINDOW_TITLE: LocalizedString<HelloState> = LocalizedString::new("Rakaly"... | 35.990291 | 96 | 0.641759 |
39f07c6ab106382a34958738c6fdcad1f4157cbc | 7,592 | #![allow(unused_imports, non_camel_case_types)]
use crate::models::r5::ConceptMap_Element::ConceptMap_Element;
use crate::models::r5::ConceptMap_Unmapped::ConceptMap_Unmapped;
use crate::models::r5::Extension::Extension;
use serde_json::json;
use serde_json::value::Value;
use std::borrow::Cow;
/// A statement of rela... | 35.148148 | 100 | 0.579557 |
14022978f48124dfdb7509826c36c8b87db3b22c | 1,160 | #![allow(non_snake_case)]
struct Person {
age: i32,
}
impl Person {
fn new(initialAge: i32) -> Person {
// Add some more code to run some checks on initialAge
if initialAge < 0 {
println!("Age is not valid, setting age to 0.");
return Person { age: 0 };
}
... | 20.714286 | 62 | 0.478448 |
fca86218cf4bbc312cc516a067a671c35443fda3 | 953 | use protobuf::Message;
use std::fs::File;
use tract_onnx::pb::{ModelProto, ValueInfoProto};
fn main() {
let input = std::env::args().nth(1).unwrap();
let output = std::env::args().nth(2).unwrap();
let mut model =
protobuf::parse_from_reader::<ModelProto>(&mut File::open(input).unwrap()).unwrap();
... | 32.862069 | 92 | 0.577125 |
26c7280f81fece9e28867cd662a703ce6c3f24f4 | 7,157 | #[cfg(test)]
#[path = "../../tests/unit/validation/vehicles_test.rs"]
mod vehicles_test;
use super::*;
use crate::validation::common::get_time_windows;
use std::ops::Deref;
use vrp_core::models::common::TimeWindow;
/// Checks that fleet has no vehicle with duplicate type ids.
fn check_e1300_no_vehicle_types_with_dupl... | 33.600939 | 118 | 0.54059 |
7abb439d752a153138259cf6afe06bf94f6b0857 | 7,083 | //! Field descriptors used in the schema-based interface.
use std::borrow::Borrow;
use std::marker::PhantomData;
use ekiden_common::serializer::{Deserializable, Serializable};
use super::super::{Database, DatabaseHandle};
/// Descriptor for scalar fields.
pub struct ScalarDescriptor<T> {
namespace: &'static str,... | 33.253521 | 95 | 0.595087 |
33dae34365285503f5ff55fb21ae5824e87d1e55 | 525 | impl Solution {
pub fn second_highest(s: String) -> i32 {
let mut highest = -1;
let mut second_highest = -1;
for c in s.chars() {
if let Some(n) = c.to_digit(10) {
let n = n as i32;
if highest < n {
second_highest = highest;
... | 27.631579 | 61 | 0.411429 |
5dad93da8b851f7c6346f5343c65083ef3a58fba | 1,110 | use rumqtt::{ConnectionMethod, MqttClient, MqttOptions, QoS};
use std::{thread, time::Duration};
fn main() {
pretty_env_logger::init();
let client_id = "tls-test".to_owned();
let ca = include_bytes!("tlsfiles/ca-chain.cert.pem").to_vec();
let client_cert = include_bytes!("tlsfiles/bike1.cert.pem").to_... | 33.636364 | 90 | 0.645045 |
1e0e4d15cab0d75296b701b4a511cb783b69d7e8 | 2,626 | use std::time::Duration;
use std::thread;
use std::path::Path;
use sdl2::event::Event;
use sdl2::init;
use sdl2::ttf;
use utils::vec2i::Vec2i;
use gui::core::gui_application::GUIApplication;
use gui::core::mouse::{MouseClickEvent, MouseDragEvent, MouseMoveEvent};
use gui::core::mouse::MouseButton as APIMouseButton;
use... | 34.103896 | 142 | 0.683168 |
b94e74ada9cefdc9904067da299e433f0ae86423 | 32,577 | // 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... | 28.957333 | 100 | 0.52313 |
339971e4d8e1af2d876ca0760a2f2b12cc04d136 | 1,496 | /// Problem 35 - Project Euler
/// http://projecteuler.net/index.php?section=problems&id=35
extern crate project_euler;
use project_euler::prime::{is_prime, primes};
use std::collections::HashSet;
fn rotate1(x: u32) -> u32 {
if x / 10 == 0 {
return x;
}
let mut xs = x.to_string().chars().collect::... | 22.328358 | 73 | 0.542781 |
28ea13c469453f0ec41f186ccefd8c58d00b8cbb | 409 | #![allow(unused_imports)]
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
#[doc = "The `AttestationConveyancePreference` enum."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `AttestationConveyancePreference`*"]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AttestationConve... | 31.461538 | 110 | 0.706601 |
ff57cf7d748c6b582e45bd3aa9c681ace63124cb | 1,433 | use crate::core::{Cell, InternalVM, RuntimeError, VMInstruction, VirtualMachine};
use algebra::Field;
use r1cs_core::ConstraintSystem;
use zinc_bytecode::instructions::Or;
impl<F, CS> VMInstruction<F, CS> for Or
where
F: Field,
CS: ConstraintSystem<F>,
{
fn execute(&self, vm: &mut VirtualMachine<F, CS>) ->... | 31.152174 | 83 | 0.577111 |
8a1849c01aa2e36e086a36fa582e86f9042e45dd | 11,342 | #![feature(box_syntax)]
#![feature(test)]
#![feature(box_patterns)]
#![feature(specialization)]
extern crate test;
use std::{
env,
fs::{read_dir, File},
io::{self, Read, Write},
path::Path,
sync::{Arc, RwLock},
};
use swc_common::{Fold, FoldWith};
use swc_ecma_ast::*;
use swc_ecma_codegen::{self, ... | 32.039548 | 99 | 0.449921 |
56f3f5fcf45c3ad78e26d99ad6d593bb8af52c3e | 2,759 | use wow_srp::client::SrpClientUser;
use wow_srp::normalized_string::NormalizedString;
use wow_srp::server::SrpVerifier;
use wow_srp::{PublicKey, GENERATOR, LARGE_SAFE_PRIME_LITTLE_ENDIAN};
#[test]
fn authenticate_with_self() {
let username: NormalizedString = NormalizedString::new("A").unwrap();
let password: ... | 32.458824 | 98 | 0.582095 |
3a67f9172105614f78ea3e29899970bbce06f844 | 8,606 | /*
* Copyright 2019 OysterPack 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 applicabl... | 26.318043 | 86 | 0.666279 |
6afaa25c60c25634a9c5fceee3e505b7e6918fb5 | 1,631 | use super::*;
use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, whitelisted_caller};
use frame_system::RawOrigin;
benchmarks! {
create {
let caller = whitelisted_caller();
}: _(RawOrigin::Signed(caller))
breed {
let caller = whitelisted_caller();
let mut kitty = Kitty(Default::defaul... | 32.62 | 119 | 0.670141 |
4acd046d18ce09bef0637bdecbe827c387fc03d0 | 1,398 | //! Cheesy way to easily wrap text in console colors.
//! Example:
//! ```
//! use phd::color;
//! println!("{}Error: {}{}", color::Red, "Something broke.", color::Reset);
//! ```
use std::{
fmt,
sync::atomic::{AtomicBool, Ordering as AtomicOrdering},
};
/// Whether to show colors or not.
/// Defaults to true... | 21.84375 | 76 | 0.56867 |
e8b68224f1fdca07130c01212fe80956a05dc4f8 | 10,261 | // Copyright (c) 2018-2021 Brendan Molloy <brendan@bbqsrc.net>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or d... | 29.656069 | 100 | 0.532794 |
876bbc02d264bd54e07aca754315c615920dc28f | 53 | fn main() {
let i = ~100;
assert *i == 100;
} | 13.25 | 21 | 0.433962 |
6af3cd035bae12cf9af6be5170b0f81cba89b9a4 | 2,874 | extern crate physics2d;
mod testbed;
use physics2d::*;
use physics2d::debug::DebugCollision;
struct CollisionsTestbed {
world: World,
}
impl CollisionsTestbed {
pub fn new(config: &testbed::Config) -> CollisionsTestbed {
let window_width = config.window_width as f32 / config.pixels_per_unit;
... | 29.9375 | 103 | 0.580724 |
1ebeda4276084050d99f6b719acc6495cafdd18f | 696 | /**
* [258] Add Digits
*
* Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.
*
* Example:
*
*
* Input: 38
* Output: 2
* Explanation: The process is like: 3 + 8 = 11, 1 + 1 = 2.
* Since 2 has only one digit, return it.
*
*
* Follow up:<br />
... | 17.846154 | 103 | 0.579023 |
381f11ff1efcc0265fef35d44600c28a503e2918 | 1,097 | // ignore-windows
//
// compile-flags: -g -C no-prepopulate-passes --remap-path-prefix={{cwd}}=/the/cwd --remap-path-prefix={{src-base}}=/the/src
// aux-build:remap_path_prefix_aux.rs
extern crate remap_path_prefix_aux;
// Here we check that submodules and include files are found using the path without
// remapping... | 37.827586 | 128 | 0.724704 |
28b3732ced161d1cee55f2659a89608a54c90143 | 8,066 | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use crate::EventController;
use crate::Gesture;
use crate::GestureSingle;
use crate::PropagationPhase;
use crate::Widget;
use glib::object::Cast;
use glib::object::IsA;
use glib::obj... | 32.135458 | 149 | 0.561741 |
38e6113f46f04f365d298e08d997d98b53b70da8 | 2,554 | use crate::request::prelude::*;
use std::{
error::Error,
fmt::{Display, Formatter, Result as FmtResult},
};
use twilight_model::{
guild::GuildPrune,
id::{GuildId, RoleId},
};
/// The error created when the guild prune count can not be requested as configured.
#[derive(Clone, Debug)]
pub enum GetGuildPr... | 26.604167 | 103 | 0.608066 |
215c2948389ff6644751de05b8236e33c0fe3b0e | 31,180 | //! A library for working with [Apache Avro](https://avro.apache.org/) in Rust.
//!
//! Please check our [documentation](https://docs.rs/avro-rs) for examples, tutorials and API reference.
//!
//! **[Apache Avro](https://avro.apache.org/)** is a data serialization system which provides rich
//! data structures and a co... | 33.599138 | 143 | 0.522963 |
9cd146b1930f38dc3468f33a1a162f4544cb4883 | 41,115 | // Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).
extern crate bazel_protos;
extern crate tempdir;
use std::error::Error;
use std::collections::{BTreeMap, HashSet};
use std::fmt;
use std::os::unix::ffi::OsStrExt;
use std::path::{Path, ... | 29.579137 | 100 | 0.611188 |
e4bbda0a159e037350a39c1eb59cde6127c0749b | 5,429 | use std::io::BufWriter;
use std::io::Write;
use xml::reader::XmlEvent as ReadXmlEvent;
use xml::writer;
use xml::writer::XmlEvent as WriteXmlEvent;
use xml::EmitterConfig;
use xml::ParserConfig;
use crate::android_string::AndroidString;
use crate::constants;
use crate::error::InnerError;
pub fn write<S: Write>(
... | 34.801282 | 162 | 0.596427 |
1ab5c770e5d57c079744ec04dc79ea50ff46eb10 | 8,830 | // Copyright © 2020 Starcat LLC
//
// 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 t... | 33.195489 | 121 | 0.525934 |
725b4f0457baa87e69274a161169eb3a8260ecad | 30,154 | use std::borrow::Cow;
use std::collections::{HashMap, HashSet, VecDeque};
use heck::{CamelCase, SnakeCase};
use indexmap::IndexMap;
use lazy_static::*;
use pest::Parser as _;
use pest_derive::*;
use regex::Regex;
use thiserror::Error;
use crate::templates::motif;
/// Describes errors that occured while parsing proto... | 37.22716 | 104 | 0.443059 |
1c76c31e1a7ff9131311928e181e41bbef1679b0 | 39,936 | use crate::expand::{self, AstFragment, Invocation};
use crate::module::DirectoryOwnership;
use rustc_ast::ptr::P;
use rustc_ast::token;
use rustc_ast::tokenstream::TokenStream;
use rustc_ast::visit::{AssocCtxt, Visitor};
use rustc_ast::{self as ast, Attribute, NodeId, PatKind};
use rustc_attr::{self as attr, Deprecati... | 33.307756 | 99 | 0.58749 |
11c6b88eddc75f86975459db45aa6d780de73699 | 1,412 | //!
//! The semantic analyzer structure type element error.
//!
use zinc_lexical::Location;
///
/// The semantic analyzer structure type element error.
///
#[derive(Debug, PartialEq)]
pub enum Error {
/// A field with the same name occurs for the second time.
DuplicateField {
/// The duplicate field l... | 28.816327 | 69 | 0.616147 |
2f15cca666bb2f5571c7a093caa2a0a412a2e242 | 13,034 | use std::str::FromStr;
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum OpeningQuotes {
AsciiDouble, // "
AsciiSingle, // '
EnglishDouble, // “
EnglishSingle, // ‘
GermanDouble, // „
GermanSingle, // ‚
SwedishDouble, // ”
SwedishSingle, // ’
GuillementsDouble, // «
Guilleme... | 31.559322 | 99 | 0.569741 |
9cceb68b1bc22f939f815314aa579044044c948c | 9,121 | use env_logger;
use log::{debug, warn};
use fnv::FnvHashMap;
use std::{
collections::HashMap,
net::{IpAddr, Ipv4Addr, SocketAddr},
str,
time::{Duration, Instant},
};
use futures::{
prelude::*,
sync::mpsc::{channel, Sender},
};
use tokio::codec::length_delimited::LengthDelimitedCodec;
use tokio... | 30.814189 | 97 | 0.541169 |
fc877509f3c7beb9d49edbd18bebafbd3226fcee | 20,958 | //! HTTP response types.
//!
//! This module contains structs related to HTTP responses, notably the
//! `Response` type itself as well as a builder to create responses. Typically
//! you'll import the `http::Response` type rather than reaching into this
//! module itself.
//!
//! # Examples
//!
//! Creating a `Respons... | 26.596447 | 81 | 0.521281 |
33d62f4674855aa30544d80d11ea44f877c09671 | 2,440 | use anyhow::Result;
use deep_thought::optimizer::Optimizer;
use deep_thought::prelude::*;
use deep_thought_derive::neural_network;
use ndarray::prelude::*;
use num_traits::Float;
// Network size must be known at compile-time
// const _NUM_PARAMETERS: usize = 19;
fn main() -> Result<()> {
neural_network!(
... | 36.969697 | 162 | 0.570902 |
f5641e6f12180ae8be68726f3acf7e3a46b1f2ed | 102,985 | ///! This module contains the gory details of using Diesel to query
///! a database schema that is not known at compile time. The code in this
///! module is mostly concerned with constructing SQL queries and some
///! helpers for serializing and deserializing entities.
///!
///! Code in this module works very hard to ... | 35.353587 | 116 | 0.525717 |
d597be03c4e49d586215de5f3a44118db86b05bc | 7,392 | /// Implementing a custom async UDP socket since tokio::net::UdpSocket has the limitation that
/// on windows, due to sends being a 'start, wait for completion' two-step process,
/// but tokio/mio do not expose a way to poll the completion step, any failing sends are
/// reported as successes.
///
/// The implementatio... | 35.368421 | 100 | 0.552895 |
4adcc394638a2e9c2c833885bcee5ec04dac4388 | 4,723 | use std::collections::HashMap;
#[cfg(feature = "mysql")]
use std::sync::Arc;
#[cfg(feature = "mysql")]
use diesel::mysql::MysqlConnection;
#[cfg(feature = "mysql")]
use diesel::prelude::*;
#[cfg(feature = "mysql")]
use failure::ResultExt;
#[cfg(feature = "mysql")]
use r2d2::Pool;
#[cfg(feature = "mysql")]
use r2d2_die... | 29.51875 | 97 | 0.556003 |
ff262da797d2468152a3a1dc253ddf4a6b94e0cb | 3,031 | //! Manual definition of the stack probe.
//!
//! Rust currently fails to reexport symbols in dynamic libraries. This means that the old way of
//! including an assembly stack probe in the runtime does not work when embedding in C.
//!
//! There is an [issue](https://github.com/rust-lang/rust/issues/36342) tracking thi... | 39.363636 | 140 | 0.576377 |
4a323bffaee1fd17bf9ef27883794466b72a5a70 | 30,519 | use crate::builtins::pystr::{PyStr, PyStrRef};
use crate::builtins::pytype::{PyType, PyTypeRef};
use crate::builtins::singletons::{PyNone, PyNoneRef};
use crate::builtins::traceback::PyTracebackRef;
use crate::builtins::tuple::{PyTuple, PyTupleRef};
use crate::common::lock::PyRwLock;
use crate::function::FuncArgs;
use ... | 37.037621 | 141 | 0.614044 |
c1a7690d5e88e1cc510c3750bc1bf2578d6beb11 | 114,776 | #![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,
... | 51.262171 | 140 | 0.51563 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.