text stringlengths 7.05k 33.9k |
|---|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use crate::colors;
use crate::inspector::DenoInspector;
use crate::inspector::InspectorServer;
use crate::js;
use crate::metrics::RuntimeMetrics;
use crate::ops;
use crate::permissions::Permissions;
use crate::tokio_util::create_basic_runtime;
u... |
/*!
# juniper_rocket_async
This repository contains the [Rocket][Rocket] web server integration for
[Juniper][Juniper], a [GraphQL][GraphQL] implementation for Rust.
## Documentation
For documentation, including guides and examples, check out [Juniper][Juniper].
A basic usage example can also be found in the [Api ... |
// This module is only intended to be used internally, hence the semver
// exemption. It probably should be in a HAL or board crate.
#![cfg(feature = "semver-exempt")]
use rp2040::USBCTRL_REGS;
use usb_device::{
endpoint::{EndpointAddress, EndpointType},
UsbDirection,
};
use vcell::VolatileCell;
const DPRAM_LE... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Status And Control"]
pub sc: crate::Reg<sc::SC_SPEC>,
#[doc = "0x04 - Counter"]
pub cnt: crate::Reg<cnt::CNT_SPEC>,
#[doc = "0x08 - Modulo"]
pub mod_: crate::Reg<mod_::MOD_SPEC>,
#[doc = "0x0c - Channel (n) Stat... |
/// Arrow schema as specified in
/// https://arrow.apache.org/docs/python/api/datatypes.html
/// and serialized to bytes using IPC:
/// https://arrow.apache.org/docs/format/Columnar.html#serialization-and-interprocess-communication-ipc
///
/// See code samples on how this message can be deserialized.
#[derive(Clone, Pa... |
//! This module is a hack to get around the lack of the
//! `__truncdfsf2` function in the `compiler_builtins` crate.
//! See this: <https://github.com/rust-lang-nursery/compiler-builtins/pull/262>
//!
//! This code was taken from this commit from above-linked pull request to the compiler_builtins crate:
//! <https://... |
//! Validation implementation for BTreeMap.
use super::{
ArchivedBTreeMap, ClassifiedNode, InnerNode, InnerNodeEntry, LeafNode, LeafNodeEntry, Node,
NodeHeader, MIN_ENTRIES_PER_INNER_NODE, MIN_ENTRIES_PER_LEAF_NODE,
};
use crate::{
rel_ptr::RelPtr,
validation::{ArchiveContext, LayoutRaw},
Archived,... |
//! `autopay`
use anyhow::Error;
use libra_types::{
account_address::AccountAddress,
transaction::{Script, TransactionArgument},
};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::{fs::{self, File}, io::Write, path::PathBuf, process::exit, u64};
// These match Autpay2.move
/// send percen... |
use serde::{Deserialize, Serialize};
use std::fs::File;
use std::io::Write;
use std::path::Path;
use std::path::PathBuf;
use strum_macros::{Display, EnumString, EnumVariantNames};
#[derive(Debug, Serialize, Deserialize, Display, EnumString, EnumVariantNames)]
#[strum(serialize_all = "kebab_case")]
pub enum Template {
... |
//! Colors
use crate::Color;
use crate::math::multiply_u8;
/// Convert an f64 [0,1] component to a u8 [0,255] component
fn cu8(v: f64) -> u8 {
(v * 255.0).round() as u8
}
/// Convert from sRGB to RGB for a single component
fn srgb_to_rgb(x: f64) -> f64 {
if x <= 0.04045 {
x / 12.92
} else {
... |
#![windows_subsystem = "windows"]
use fltk::{
app::{App, AppScheme, channel},
browser::Browser,
button::{Button, CheckButton},
dialog:: {FileChooser, FileChooserType, message},
enums::{Align, Color},
input::{IntInput},
prelude::*,
window::DoubleWindow,
};
use std::{error::Error, fmt, p... |
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
mod api_server_adapter;
mod metrics;
use std::fs::{self, File};
use std::io;
use std::panic;
use std::path::PathBuf;
use std::process;
use std::sync::{Arc, Mutex};
use event_manager::SubscriberOps;
use lo... |
// 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 ... |
// btleplug Source Code File
//
// Copyright 2020 Nonpolynomial Labs LLC. All rights reserved.
//
// Licensed under the BSD 3-Clause license. See LICENSE file in the project root
// for full license information.
//
// Some portions of this file are taken and/or modified from Rumble
// (https://github.com/mwylde/rumble)... |
//! `crypto_box` test vectors
//!
//! Adapted from PHP Sodium Compat's test vectors:
//! <https://www.phpclasses.org/browse/file/122796.html>
use crypto_box::aead::{generic_array::GenericArray, Aead, AeadInPlace, Payload};
use crypto_box::{ChaChaBox, PublicKey, SalsaBox, SecretKey};
use std::any::TypeId;
// Alice's k... |
//! Decode various trunking-related packet fields.
use util::{slice_u16, slice_u24, slice_u32};
/// Options that can be requested/granted by a service.
pub struct ServiceOptions(u8);
impl ServiceOptions {
/// Create a new `ServiceOptions` based on the given byte.
pub fn new(opts: u8) -> ServiceOptions { Serv... |
use super::utils::connect_with_retry;
use std::{
collections::HashSet,
io::prelude::*,
net::TcpStream,
sync::{
atomic::{AtomicBool, AtomicIsize, Ordering},
mpsc::Sender,
Mutex,
},
time::{Duration, Instant},
};
use flate2::read::{DeflateDecoder, GzDecoder};
use log::*;
us... |
// Copyright 2018 Syn Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according ... |
//! [![Build Status]][travis] [![Latest Version]][crates.io]
//!
//! [Build Status]: https://api.travis-ci.org/Boscop/web-view.svg?branch=master
//! [travis]: https://travis-ci.org/Boscop/web-view
//! [Latest Version]: https://img.shields.io/crates/v/web-view.svg
//! [crates.io]: https://crates.io/crates/web-view
//!
/... |
use std::error::Error;
use std::fmt;
use std::string::FromUtf8Error;
use log::*;
use base64;
use bigdecimal::BigDecimal;
use wumn_dao::{
value::Array,
Interval,
Rows
};
use geo::Point;
//use openssl::ssl::{SslConnectorBuilder, SslMethod};
use postgres;
use postgres::{Connection, TlsMode};
//use postgres::tl... |
//! Colored your terminal.
//! You can use this package to make your string colorful in terminal.
//! Platform support:
//! - Linux
//! - macOS
//! <img src="https://github.com/rocketsman/colorful/blob/master/images/1.png?raw=true" width="60%">
/// It is recommended to use `Color` enum item to set foreground color n... |
#![feature(iter_intersperse)]
use std::borrow::Cow;
use std::error::Error;
use std::sync::Arc;
use futures::{stream, FutureExt, StreamExt, TryStreamExt};
use tokio::sync::Semaphore;
use tokio_util::sync::PollSemaphore;
use json_ld_rs::error::{JsonLdError, JsonLdErrorCode};
use json_ld_rs::remote::{default_document_l... |
use std::convert::TryFrom;
use super::*;
use crate::data::ast::{Expr, ExprType, TypeName};
use crate::data::lex::{AssignmentToken, Keyword};
use crate::data::*;
trait UnaryExprFn: FnOnce(Expr) -> ExprType {}
impl<T: FnOnce(Expr) -> ExprType> UnaryExprFn for T {}
#[derive(Copy, Clone, Debug)]
#[rustfmt::skip]
enum Bi... |
mod collector;
mod html;
mod markdown;
mod paragraph;
use std::collections::{BTreeMap, BTreeSet};
use std::mem;
use std::path::{Path, PathBuf};
use std::process;
use anyhow::{anyhow, Context, Error};
use clap::Parser;
use jwalk::WalkDir;
use markdown::DocumentSource;
use rayon::prelude::*;
use collector::{BrokenLink... |
//! Code pertaining to simple MLP-style neural networks
extern crate nalgebra;
extern crate rand;
use nalgebra as na;
use rand::Rng;
use rand::distributions::Normal;
use std::io::Read;
use std::io::Write as w_;
use std::fmt::Write;
#[allow(unused)]
pub fn linear(x: f64) -> f64 {
x
}
#[allow(unused)]
pub fn relu... |
mod utils;
use wasm_bindgen::prelude::*;
use std::collections::{BTreeMap, HashMap, HashSet};
use std::sync::{
atomic::{AtomicUsize, Ordering},
Arc,
RwLock
};
use wasm_bindgen::JsCast;
use web_sys::{ErrorEvent, MessageEvent, WebSocket};
use js_sys::{JSON, Reflect, Object as JsObject, Array as JsArray};
use s... |
use crate::compiler::CodegenContext;
use crate::error::Error;
use crate::heap::HeapSettings;
pub use crate::module::{Exportable, TableElems};
use crate::module::{ModuleInfo, UniqueFuncIndex};
use crate::name::Name;
use crate::runtime::{Runtime, RuntimeFunc};
use crate::table::TABLE_SYM;
use crate::types::to_lucet_signa... |
use std::mem;
use super::constants::*;
#[derive(Debug)]
enum LcdMode {
Hblank,
Vblank,
SearchingOam,
Transfer,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Lcd {
counter: i32,
pub vblank_sync: bool,
pub buffer: Vec<u8>,
last_frame: Vec<u8>,
oam: Vec<u8>,
vram_t... |
use core::fmt::Write;
use itertools::Itertools;
use rustc_lexer::{tokenize, unescape, LiteralKind, TokenKind};
use std::collections::HashMap;
use std::ffi::OsStr;
use std::fs;
use std::path::Path;
use walkdir::WalkDir;
use crate::clippy_project_root;
const GENERATED_FILE_COMMENT: &str = "// This file was generated by... |
//! A collection of signal filters.
//!
//! To filter a bunch of samples, first create the filter and samples.
//!
//! There are two types of filters: stateless, and stateful filters.
//! Stateless filters can be used to convolve samples, while stateful filters transform individual samples.
//!
//! ### Stateless filter... |
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum Table {
P1,
P2,
P3,
P4,
H1,
P5,
}
pub use Table::{H1, P1, P2, P3, P4, P5};
macro_rules! generate_field_getter {
($container_type:ty, $container_data_field:ident, $name:ident, $width:literal... |
//! A debugger library utilizing `ptrace`-syscall.
//!
//! Supported platforms: linux x86_64 and freebsd x86_64.
//! *WARNING*: Only one concurrent instance of `Ptracer` is currently supported!
//!
//! This library is still in early development.
//! There may still be edge cases where things will break.
//!
/... |
//! Implementation of `DoHResponse` for the DoH JSON Protocol.
//!
//! Based on [Serde JSON](https://crates.io/crates/serde_json).
use crate::core::response::DoHResponse;
use crate::dns::protocol::*;
use log::*;
use serde::{ser::{Serializer}, de::{Deserialize, Deserializer}};
use serde_derive::{Serialize, Deserialize... |
use crate::data::primitive::format_primitive;
use crate::prelude::*;
use chrono::{DateTime, Utc};
use chrono_humanize::Humanize;
use derive_new::new;
use indexmap::IndexMap;
use nu_errors::ShellError;
use nu_protocol::{
ColumnPath, Dictionary, Evaluate, Primitive, ShellTypeName, TaggedDictBuilder, UntaggedValue,
... |
//! GraphQL derivations.
use std::collections::HashMap;
use timely::dataflow::operators::Exchange;
use timely::dataflow::scopes::child::Iterative;
use timely::dataflow::{Scope, Stream};
use timely::order::Product;
use timely::progress::Timestamp;
use differential_dataflow::hashable::Hashable;
use differential_datafl... |
use crate::model::*;
use crate::{util::*, Classpath, InvokeType, JniEnv};
use classfile_parser::ClassAccessFlags;
use classfile_parser::{
attribute_info::code_attribute_parser,
field_info::{FieldAccessFlags, FieldInfo},
method_info::{MethodAccessFlags, MethodInfo},
ClassFile,
};
use std::fmt::Write;
use... |
#[cfg(test)]
mod rtp_transceiver_test;
use crate::api::media_engine::MediaEngine;
use crate::error::{Error, Result};
use crate::rtp_transceiver::rtp_codec::*;
use crate::rtp_transceiver::rtp_receiver::{RTCRtpReceiver, RTPReceiverInternal};
use crate::rtp_transceiver::rtp_sender::RTCRtpSender;
use crate::rtp_transceive... |
use proc_macro2::Span;
use quote::{quote_spanned, ToTokens};
use std::iter;
use syn::{
parse::{Parse, ParseStream},
parse2,
punctuated::{Pair, Punctuated},
spanned::Spanned,
token::{Brace, Bracket},
AngleBracketedGenericArguments, AttrStyle, Attribute, Error, ExprPath, Fields, FieldsNamed,
GenericArgument, Gener... |
use crate::pokemon::{
PureType,
Stat,
};
use enumset::EnumSet;
use lazy_static::lazy_static;
use serde::Deserialize;
use serde_repr::Deserialize_repr;
use std::convert::From;
const MOVES_TSV: &[u8] = include_bytes!("../../data/raw/sword_shield_move_info.tsv");
/// Loads a list of moves as a vector. Returns th... |
// TODO: Handle Runtime Errors
extern crate permutate;
extern crate unicode_segmentation;
extern crate calc;
use self::unicode_segmentation::UnicodeSegmentation;
use types::Array;
mod braces;
mod ranges;
mod words;
use glob::glob;
use self::braces::BraceToken;
use self::ranges::parse_range;
pub use self::words::{Word... |
use crate::error::*;
use crate::summary_data::{Region, DataRow};
use crate::json;
use chrono::prelude::*;
use crossbeam_channel::{bounded, tick, TrySendError, RecvError};
use curl::easy::{List, Easy};
use fs2::FileExt;
use log::{error, info};
use regex::Regex;
use std::{cell::RefCell, path, env, process, fs, collectio... |
// Copyright (c) 2020 Ant Financial
// Copyright (C) 2020 Alibaba Cloud. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0
//
//! Dedicated Netlink interfaces for Kata agent protocol handler.
use std::convert::TryFrom;
use protobuf::RepeatedField;
use protocols::types::{ARPNeighbor, IPAddress, IPFamily,... |
//! `PyClass` and related traits.
use crate::{
class::impl_::{fallback_new, tp_dealloc, PyClassImpl},
ffi,
impl_::pyclass::{PyClassDict, PyClassWeakRef},
PyCell, PyErr, PyMethodDefType, PyNativeType, PyResult, PyTypeInfo, Python,
};
use std::{
convert::TryInto,
ffi::{CStr, CString},
os::raw:... |
// Copyright (C) 2020 <NAME> <<EMAIL>>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except acco... |
use std::error::Error;
use std::convert::TryFrom;
use super::*;
/// Error structure containing the available information on a COM error.
#[derive(Debug)]
pub struct ComError {
/// `HRESULT` that triggered the error.
pub hresult : raw::HRESULT,
/// Possible detailed error info.
pub error_info : Opti... |
use std::{
collections::HashMap,
f64::{consts::PI as pi, NAN},
};
use chrono::NaiveDateTime;
use itertools::Itertools;
use pyo3::prelude::*;
use crate::{math, GlickoError};
#[derive(Clone, Copy, Debug)]
struct Constants {
glicko_tau: f64,
multi_slope: f64,
multi_cutoff: u32,
norm_factor: f64,... |
//! # SPIR-Q: Light Weight SPIR-V Query Utility for Graphics.
//!
//! SPIR-Q is a light weight library for SPIR-V pipeline metadata query, which
//! can be very useful for dynamic graphics/compute pipeline construction,
//! shader debugging and so on. SPIR-Q is currently compatible with a subset of
//! SPIR-V 1.5, with... |
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate iron;
extern crate staticfile;
extern crate urlencoded;
extern crate mount;
extern crate clap;
use clap::{Arg, App};
use iron::prelude::*;
use iron::status;
use iron::mime::Mime;
use mount::Mount;
use staticfile::Static;
use std::io::{self... |
// Copyright 2019-2020 Alibnc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//
// Portions Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the THIRD-PARTY file.
use std::collections::Has... |
/// How heap memory/GC works.
/// Everytime a pointer variable is created, an entry in root_references is created.
/// Everytime a heap object is created its reference is pushed to the top of the stack.
/// The first 64bits of the heap object is a reference to its type (usefull infos like size/refs...)
/// An allocator... |
mod utils;
extern crate web_sys;
use wasm_bindgen::prelude::*;
#[macro_use]
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
#[wasm_bindgen]
#[repr(u8)]
#[derive(Clone... |
use std::cell::RefCell;
use std::collections::HashMap;
use std::fmt::Display;
use std::io::{BufRead, BufReader, Write, Error};
use std::net::ToSocketAddrs;
use std::time::{Duration, Instant};
use chrono::prelude::*;
use futures_util::future::FutureExt;
use json::JsonValue;
use rand::{Rng, thread_rng};
use rand::prelu... |
use yaml_rust::yaml::{Array, Hash, Yaml};
use yaml_rust::YamlLoader;
use crate::flatjson::{ContainerType, Index, OptionIndex, Row, Value};
struct YamlParser {
parents: Vec<Index>,
rows: Vec<Row>,
pretty_printed: String,
max_depth: usize,
}
pub fn parse(yaml: String) -> Result<(Vec<Row>, String, usize... |
extern crate serde;
extern crate rltk;
use rltk::{Console, GameState, Rltk, Point};
extern crate specs;
use specs::prelude::*;
use specs::saveload::{SimpleMarker, SimpleMarkerAllocator};
#[macro_use]
extern crate specs_derive;
mod components;
pub use components::*;
mod map;
pub use map::*;
mod player;
use player::*;
mo... |
use super::SQUADMAKER_ROLE_CHECK;
use crate::{
components, data, db,
embeds::*,
log::*,
signup_board::SignupBoard,
status,
utils::{self, *},
};
use serde::ser::{Serialize, SerializeStruct, Serializer};
use serenity::framework::standard::{
macros::{command, group},
ArgError, Args, Command... |
#![cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))]
use {
Api,
ContextError,
CreationError,
GlAttributes,
GlProfile,
GlRequest,
PixelFormat,
PixelFormatRequirements,
ReleaseBehavior,
Robustness,
};
use std::{mem, ptr, slice};... |
//! Asynchronous verification of transactions.
//!
use std::{
collections::HashMap,
future::Future,
iter::FromIterator,
pin::Pin,
sync::Arc,
task::{Context, Poll},
};
use futures::{
stream::{FuturesUnordered, StreamExt},
FutureExt,
};
use tower::{Service, ServiceExt};
use tracing::Instr... |
// Copyright 2017 PingCAP, 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 i... |
use std::time::Duration;
use druid::kurbo::{Line, Rect};
use druid::piet::kurbo::Shape;
use druid::piet::Color;
use druid::piet::TextLayoutBuilder;
use druid::RenderContext;
use druid::{
kurbo::Ellipse, piet::Text, widget::ListIter, BoxConstraints, Data, Env, Event, EventCtx,
LayoutCtx, Lens, LifeCycl... |
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
// Modifications Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// See GitHub history for details.
// ignore-tidy-filelength
use crate::common::RMCFailStep;
use crate::common::{output_base_dir, output_base_name};
use crate::common::{CargoRMC, Expect... |
// Copyright © 2015, skdltmxn
// Licensed under the MIT License <LICENSE.md>
//! Interface for the Windows Property Sheet Pages
pub enum PSP {}
pub type HPROPSHEETPAGE = *mut PSP;
pub type LPFNPSPCALLBACKA = Option<unsafe extern "system" fn(
hwnd: ::HWND, uMsg: ::UINT, ppsp: *mut PROPSHEETPAGEA,
) -> ::UINT>;
pub t... |
//! This file contains structs, traits, and methods associated with the IP layer
//! of the networking stack. This includes the declaration and methods for the
//! IP6Header, IP6Packet, and IP6Payload structs. These methods implement the
//! bulk of the functionality required for manipulating the fields of the
//! IPv6... |
use super::{BackupFile, BackupMemoryInterface};
use bytesize;
use num::FromPrimitive;
use serde::{Deserialize, Serialize};
use std::cell::RefCell;
use std::fs;
use std::path::PathBuf;
#[derive(Debug, Clone, Copy)]
pub enum EepromType {
Eeprom512,
Eeprom8k,
}
#[derive(Debug, Serialize, Deserialize, Copy, Clo... |
mod atlas;
#[cfg(feature = "image_rs")]
mod raster;
#[cfg(feature = "svg")]
mod vector;
use crate::Transformation;
use atlas::Atlas;
use iced_graphics::layer;
use iced_native::Rectangle;
use std::cell::RefCell;
use std::mem;
use bytemuck::{Pod, Zeroable};
#[cfg(feature = "image_rs")]
use iced_native::image;
#[cf... |
use crate::{
network::Recipient,
nodes::NodeCount,
rmc,
rmc::{DoublingDelayScheduler, ReliableMulticast},
signed::{Multisigned, PartialMultisignature, Signable, Signature, Signed, UncheckedSigned},
units::UncheckedSignedUnit,
Data, Hasher, Index, MultiKeychain, NodeIndex, Receiver, Sender, S... |
use ra_syntax::SmolStr;
/// This module takes a (parsed) definition of `macro_rules` invocation, a
/// `tt::TokenTree` representing an argument of macro invocation, and produces a
/// `tt::TokenTree` for the result of the expansion.
use rustc_hash::FxHashMap;
use tt::TokenId;
use crate::tt_cursor::TtCursor;
use crate:... |
use rustc_codegen_ssa::debuginfo::{
type_names::{compute_debuginfo_type_name, cpp_like_debuginfo},
wants_c_like_enum_debuginfo,
};
use rustc_hir::def::CtorKind;
use rustc_index::vec::IndexVec;
use rustc_middle::{
bug,
mir::{Field, GeneratorLayout, GeneratorSavedLocal},
ty::{
self,
la... |
//
// 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 writing, software
// distribu... |
//! An implementation of the Chandy & Misra solution to the classic finite state machine (FSM)
//! concurrency problem known as [Dining Philosophers]
//! (https://en.wikipedia.org/wiki/Dining_philosophers_problem) problem using Maxim.
//!
//! # Demonstrated in this Example:
//! * Basic usage of Actors to solve a clas... |
use diesel::pg::PgConnection;
use diesel::r2d2::ConnectionManager;
use dotenv::dotenv;
use errors::*;
use futures::future;
use futures_cpupool::CpuPool;
use futures::future::{Either, FutureResult};
use futures::{Future, Sink, Stream};
use hyper;
use hyper::{Body, Chunk, Client, Method, StatusCode};
use hyper::client::H... |
//! Definitions and handling routines for CO functions (including methods).
mod clone;
mod signature;
use crate::program::dual::call::Call;
use crate::program::expressions::array_from_elements::ArrayFromElementsExpr;
use crate::program::expressions::field_access::FieldAccessExpr;
use crate::program::expressions::new:... |
//! abstraction over a character and its position within a file.
//!
//! # Doubly Linked List
//!
//! Positon implements a doubly linked list on the positions and therefore
//! characters of a file it was extraced from.
//!
//! # End of File (EOF) Position
//!
//! There is no end of file character. The end of file is m... |
use super::{
pipeconf::Pipeconf,
pure::{new_set_entity_request, table_entry_to_entity},
};
use crate::p4rt::pipeconf::DefaultPipeconf;
use crate::p4rt::pure::adjust_value;
use crate::proto::p4config::P4Info;
use crate::proto::p4runtime::{
stream_message_request, stream_message_response, PacketMetadata, Stre... |
use crate::schema::{
FieldValidator, KindValue, ParsedValue, ValidationError, ValidatorContext, SCHEMA,
};
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use std::{collections::HashMap, convert::TryInto};
use wasm_bindgen::JsCast;
use yew::{
html,
prelude::*,
services::{
keyboa... |
#![allow(non_snake_case)]
use kube_derive::CustomResource;
use semver::Version;
use std::collections::{BTreeMap, BTreeSet};
use crate::teams;
#[allow(unused_imports)] use std::path::{Path, PathBuf};
#[allow(unused_imports)] use super::{Error, Result};
use crate::{
region::{Environment, Region},
states::Confi... |
// (C) Copyright 2019 Hewlett Packard Enterprise Development LP
use std::cell::RefCell;
use std::cmp::{min, max};
use std::collections::BTreeMap;
use std::error::Error;
use std::rc::Rc;
use crossterm::{Terminal, TerminalCursor, ClearType};
use crate::renderer::types::*;
use crate::renderer::common::*;
use crate::sty... |
use std::{
cmp,
collections::{BTreeMap, HashSet},
fs::{self, remove_file},
path::PathBuf,
sync::Arc,
time::{self, Duration},
};
use bytes::Bytes;
use chrono::{DateTime, Utc};
use futures::{
future::{select, Either},
stream, Future, Sink, SinkExt,
};
use indexmap::IndexMap;
use tokio::ti... |
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {anyhow::anyhow, std::convert::TryFrom};
#[derive(PartialEq, Debug)]
pub enum ClientVariable {
// Version of FastBoot protocol supported. It shoul... |
use std::collections::{HashMap, VecDeque};
use crate::theme_definition::{
ThemeDefinition, ImageDefinition, ImageDefinitionKind, WidgetThemeDefinition,
CustomData,
};
use crate::font::{Font, FontSummary, FontSource};
use crate::image::{Image, ImageHandle};
use crate::render::{TextureData, Renderer, Fon... |
use crypto::digest::Digest;
use crypto::sha1::Sha1;
use duct::cmd;
use notify::{DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher};
use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet};
use std::env::current_dir;
use std::fmt;
use std::fs;
use std::io::{LineWriter, Read, Write};
use st... |
//! Implementation of a DataFusion `TableProvider` in terms of `PartitionChunk`s
use std::sync::Arc;
use arrow::{datatypes::SchemaRef as ArrowSchemaRef, error::ArrowError};
use datafusion::{
datasource::{
datasource::{Statistics, TableProviderFilterPushDown},
TableProvider,
},
error::{Data... |
//! Jail Configuration
use std::error::Error;
use std::fs::File;
use std::io::Read;
#[cfg(target_os = "freebsd")]
use std::process::Command;
#[cfg(target_os = "freebsd")]
use errors::GenericError;
use errors::{ValidationError, ValidationErrors};
use config::Config;
use serde_json;
use uuid::Uuid;
use regex::Regex;
u... |
//! Use a time picker as an input element for picking times.
//!
//! *This API requires the following crate features to be activated: `time_picker`*
use crate::{
core::renderer::DrawEnvironment, native::overlay::time_picker::Focus,
style::style_state::StyleState,
};
use std::collections::HashMap;
use crate::{
... |
//! USB Client driver.
use core::cell::Cell;
use kernel::common::cells::{OptionalCell, VolatileCell};
use kernel::common::registers::{
register_bitfields, register_structs, LocalRegisterCopy, ReadOnly, ReadWrite, WriteOnly,
};
use kernel::common::StaticRef;
use kernel::debug;
use kernel::hil;
use kernel::hil::usb:... |
pub(crate) mod cli;
pub(crate) mod neovim;
pub(crate) mod context;
use neovim_lib::neovim_api;
fn main() {
init_logger();
let cli_ctx = context::page_spawned::enter();
issue_warnings(&cli_ctx);
begin_neovim_connection_usage(cli_ctx);
}
pub fn init_logger() {
let rust_log = std::env::var("RUST_LO... |
/// Parse a FAT directory table
/// This doesn't include any support for VFAT long filenames or other newer features
use log::debug;
use nom::bytes::complete::take;
use nom::number::complete::{le_u16, le_u32, le_u8};
use nom::IResult;
use time::{Date, Month, Time};
use std::{
collections::HashMap,
fmt::{Displa... |
use crate::command::Command;
use crate::config::Config;
use crate::id::{Dot, DotGen, ProcessId, ShardId};
use crate::protocol::{ProtocolMetrics, ProtocolMetricsKind};
use crate::trace;
use crate::{HashMap, HashSet};
use std::iter::FromIterator;
// a `BaseProcess` has all functionalities shared by Atlas, Tempo, ...
#[d... |
#[macro_use]
extern crate anyhow;
use std::collections::HashMap;
use std::future::Future;
use std::prelude::rust_2021::TryInto;
use std::sync::Arc;
use std::time::Duration;
use anyhow::Error;
use futures::future::select_all;
use futures::FutureExt;
use tokio::sync::{mpsc, oneshot};
use tokio::sync::mpsc::error::{Send... |
// This file is Copyright its original authors, visible in version control
// history.
//
// This file is 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.
// You may... |
use near_sdk::{
borsh::{self, BorshDeserialize, BorshSerialize},
serde::{ Serialize, Deserialize },
};
// As duas funções a seguir são declaradas para
// termos duas implementações diferentes de uma mesma função "log".
// As mensagens chamadas com essa função log aparecerão
// em testes e na máquina virt... |
use std::collections::VecDeque;
use std::collections::hash_map::{Entry, HashMap};
use std::net::SocketAddr;
use std::fmt;
use std::time::Duration;
use futures::{Async, Future, Poll, Stream};
use futures::sync::mpsc;
use tokio_core::reactor::Handle;
use tower::Service;
use tower_h2::{HttpService, BoxBody, RecvBody};
us... |
mod app_init;
mod commit;
mod end_block;
mod jail_account;
mod query;
mod rewards;
mod slash_accounts;
mod validate_tx;
use abci::*;
use log::info;
pub use self::app_init::{
compute_accounts_root, get_validator_key, init_app_hash, ChainNodeApp, ChainNodeState,
ValidatorState,
};
use crate::enclave_bridge::Enc... |
pub(crate) mod translate_data;
use crate::error::{Error, Result};
use crate::iter::{PageChunks, SplitAtIndex};
use crate::mem::{PhysicalMemory, PhysicalReadData};
use crate::types::{Address, PageType, PhysicalAddress};
use std::convert::TryInto;
use translate_data::{TranslateData, TranslateVec, TranslationChunk};
use... |
// Copyright (c) 2017 mimir developers
//
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. All files in the project carrying such notice may not be copied,
// ... |
// Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors
// SPDX-License-Identifier: MIT
use std::collections::HashSet;
use std::sync::Arc;
use std::{fmt, thread};
use enum_kinds::EnumKind;
use serde::{Deserialize, Serialize};
use crypto::hash::{BlockHash, ChainId, ContextHash, ProtocolHash};
use stor... |
//! Reading a **PBF** file is actually complicated: elements refer to each others using IDs, forcing
//! the parser to go back and forth in the file (unless you have a lot of available RAM!).
//!
//! So for this, we run it in 2 passes:
//! 1. We store all matching objects (filter rules explained below) in a temporary ... |
#![cfg_attr(not(feature = "std"), no_std)]
pub use pallet::*;
mod rng;
#[frame_support::pallet]
pub mod pallet {
use sp_std::prelude::*;
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use frame_support::{
sp_runtime::traits::Hash,
traits::{Randomness, Curren... |
//! This crate contains types and functions for managing playback of frame sequences
//! over time.
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
pub mod aseprite;
use std::collections::hash_map::HashMap;
pub type Delta = f32; // FIXME
#[derive(Serialize, Deserialize, Debug,... |
// Copyright (c) 2017 King's College London
// created by the Software Development Team <http://soft-dev.org/>
//
// The Universal Permissive License (UPL), Version 1.0
//
// Subject to the condition set forth below, permission is hereby granted to any
// person obtaining a copy of this software, associated documentati... |
// Copyright 2018-2022 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.