text stringlengths 3.09k 13.9k |
|---|
use std::collections::VecDeque;
// tag::cavemap[]
/// Map of Caves
///
/// Each cave has a unique ID: the position of it's name in the [CaveMap::caves] field.
/// The adjacents of the cave are stored in the list at the same position in the [CaveMap::adjacents] field.
///
/// The IDs of the start and end cave are store... |
//
//! Copyright 2020 Alibaba Group Holding Limited.
//!
//! 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 ... |
use crate::rust_kernel_rdma_base::*;
use crate::rust_kernel_rdma_base::linux_kernel_module;
use linux_kernel_module::{Error, println};
use alloc::sync::Arc;
use alloc::boxed::Box;
use crate::mem::pa_to_va;
pub struct RecvHelper<const N: usize> {
pub wrs: Box<[core::mem::MaybeUninit<ib_recv_wr>], VmallocAllocator>... |
use anyhow::{bail, ensure, Result};
use crate::strings::countable::Countable;
use super::keys::{Key, KeyItem, RecordId};
struct KeyColumns {
original: Vec<Option<usize>>,
sorted: Vec<usize>,
}
#[non_exhaustive]
pub struct SheetRow<'a> {
sheet: &'a Sheet,
id: RecordId,
}
#[non_exhaustive]
pub struct... |
//! two_layer_net
//!
//! two-layer net
use crate::prelude::*;
use ndarray::prelude::*;
use ndarray_stats::QuantileExt;
pub trait Model<T> {
// fn train(&self);
fn predict_prob(&mut self, x: &Array2<T>) -> Array2<T>;
fn predict(&mut self, x: &Array2<T>) -> Array2<T>;
fn loss(&mut self, x: &Array2<T>, ... |
//! Defines the adjacency array graph representation.
//!
//! This is a compact static graph representation that is often the most efficient solution if updates to the topology are rare.
use crate::{
adjacencyarray::iterators::{AdjacencyArrayEdgeIdIterator, AdjacencyArrayNodeIdIterator},
graph::{EdgeRef, Graph... |
use lycaon::booster::Booster;
use lycaon::booster::LPBoost;
use lycaon::base_learner::DStump;
use lycaon::read_csv;
use lycaon::data_type::Sample;
use std::time::Instant;
use std::fs::OpenOptions;
use std::io::Write;
pub mod stump;
pub mod average;
// pub mod zdd_softboosting;
// use zdd_softboosting::*;
use stump... |
use async_trait::async_trait;
use futures::future::BoxFuture;
use tokio::sync::Semaphore;
#[async_trait]
pub trait PartitionProvider<Event, PartitionData>
where
Event: Send,
PartitionData: Send + Sync,
{
type ProviderErr: std::error::Error + Send;
async fn fetch_events_with_range(
&self,
... |
/*!
Iterators types for the [`Tree`]
*/
use std::iter;
use derivative::Derivative;
use super::*;
/// Debug-only validation
#[cfg(debug_assertions)]
macro_rules! validate_slot {
($tree:expr, $slot:expr) => {{
let entry = $tree.nodes.entries.get($slot.to_usize()).unwrap();
let node = entry.data.as... |
// Copyright © 2017-2018 Mozilla Foundation
//
// This program is made available under an ISC-style license. See the
// accompanying file LICENSE for details.
use ffi;
bitflags! {
/// Some common layout definitions
pub struct ChannelLayout: ffi::cubeb_channel_layout {
///
const FRONT_LEFT = f... |
use super::FastValue;
use crate::common::bitpacker::BitUnpacker;
use crate::common::compute_num_bits;
use crate::common::BinarySerializable;
use crate::common::CompositeFile;
use crate::directory::ReadOnlySource;
use crate::directory::{Directory, RAMDirectory, WritePtr};
use crate::fastfield::{FastFieldSerializer, Fast... |
extern crate iptables;
use std::panic;
#[test]
fn test_new() {
nat(iptables::new(false).unwrap(), "NATNEW", "NATNEW2");
filter(iptables::new(false).unwrap(), "FILTERNEW");
}
#[test]
fn test_old() {
nat(iptables::IPTables{
cmd: "iptables",
has_wait: false,
has_check: false,
}, ... |
// Copyright 2018 The Grin Developers
//
// 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 agree... |
//! Code to save/load the dep-graph from files.
use rustc_data_structures::fx::FxHashMap;
use rustc::dep_graph::{PreviousDepGraph, SerializedDepGraph, WorkProduct, WorkProductId};
use rustc::session::Session;
use rustc::ty::TyCtxt;
use rustc::ty::query::OnDiskCache;
use rustc::util::common::time_ext;
use rustc_seriali... |
//! Contains all serverbound packets
//!
//! See the Serverbound sections on http://wiki.vg/Protocol for information
//! about each of the packets.
use connection::Packet;
use errors::Result;
use read::*;
use write::*;
use {ClientState, utils};
use std::fmt;
use std::io::Read;
use openssl::rsa::Rsa;
use openssl::pke... |
//! A type for abstracting over the concept of a RealSense "device"
//!
//! A device in librealsense2 refers to a complete set of sensors that comprise e.g. a D400 / L500
//! / T200 unit. A D435 or D435i, for example, is a device, whereas the individual parts that
//! comprise that device (IR cameras, depth camera, col... |
#[derive(Debug)]
pub struct Transaction {
pub id: String,
pub date: String,
pub amount: i64,
pub memo: Option<String>,
pub cleared: ynab_api::models::transaction_summary::Cleared,
pub approved: bool,
pub flag_color: Option<ynab_api::models::transaction_summary::FlagColor>,
pub account_id... |
mod directories;
mod templates_list;
mod templates;
use std::io::prelude::*;
use std::fs::{create_dir, DirBuilder, File};
use std::path::{Path, PathBuf};
use std::collections::hash_map::Iter;
use new::Setting;
use self::templates_list::*;
use self::directories::DIRECTORIES;
use tera::Tera;
use tera::Context;
pub fn ... |
extern crate libc;
use std::mem;
use std::sync::atomic;
mod mmap;
mod extfn;
#[macro_use] pub mod x64asm;
use crate::mmap::MemChunk;
use crate::extfn::ExtFn;
extern {
fn atomic_write16(p: *mut u16, v: u16);
}
trait InstCopy {
#[inline]
fn instcopy<'a>(&mut self, src: impl Iterator<Item=&'a [u8]>);
}
im... |
use std::io::prelude::*;
use std::net::{TcpStream};
use sha2::{Sha256, Digest};
use std::sync::mpsc;
use std::thread;
use std::time::Duration;
#[derive(Debug, Hash, Clone, PartialEq, Eq)]
pub struct ConnAddr {
pub host: String,
pub port: u16,
}
pub struct GetRequest {
pub path: String,
pub client_head... |
use crate::Error;
use misskey_api::model::{
drive::DriveFile,
page::Page,
query::Query,
user::{User, UserField},
};
use misskey_api::{endpoint, EntityRef};
use misskey_core::Client;
/// Conversion to fields in users' profile.
///
/// The purpose of this trait is to specify the type that the [`set_fiel... |
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use std::{collections::BTreeSet, sync::Arc};
use crate::authority::AuthorityTemporaryStore;
use move_core_types::language_storage::ModuleId;
use move_vm_runtime::{move_vm::MoveVM, native_functions::NativeFunctionTable};
use sui_adapter::a... |
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
crate::{deprecated_fidl_server::*, table::*},
anyhow::{format_err, Error},
fuchsia_async as fasync,
fuchsia_component::server::Servic... |
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use fidl_fuchsia_io as io;
/// Set of all rights that are valid to use with the conformance test harness.
const ALL_RIGHTS_FLAGS: u32 =
io::OPEN_RIGHT... |
//! Keychain support.
use core_foundation::base::{Boolean, TCFType};
use std::os::raw::c_void;
use security_framework_sys::base::SecKeychainRef;
use security_framework_sys::keychain::*;
use std::ffi::CString;
use std::os::unix::ffi::OsStrExt;
use std::path::Path;
use std::ptr;
use base::Result;
use cvt;
use os::macos... |
use crate::config::Config;
use crate::lang::Language;
use crate::problem::Problem;
use crate::StdErr;
use crate::CFG as cfg;
use clap::ArgMatches;
use colored::Colorize;
use std::env;
use std::fs;
use std::io::{self, Read, Write};
use std::path::Path;
use zip::ZipArchive;
pub async fn get(cmd: &ArgMatches<'_>) -> Resu... |
// 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 LICENSE file.
use std;
use std::fmt::{self, Display};
use std::fs::File;
use std::io;
use std::os::unix::io::{AsRawFd, RawFd};
use std::sync::atomic::{AtomicUsize, O... |
// Copyright 2020 <NAME>
//
// 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,... |
use crate::ingredient::{Ingredient, Steep, Skim, Pour};
use std::sync::{mpsc, Arc, Mutex, RwLock};
use std::thread;
use std::time::Instant;
/// Types of instructions that can be sent to Brewers.
enum OrderTea {
NewOrder(Order),
Terminate
}
/// Wrapper to allow sent function in Box to be invokable.
trait FnBo... |
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
use serde::{Serialize, Deserialize};
/// Information about a plugin.
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct PluginInfo {
/// The name of the plugin.
pub name: String,
/// The version of the plugin.
pub version: String,
/// Gets the p... |
//! Error struct and methods
use std::{io, result, sync::Arc};
use thiserror::Error;
pub type Result<T> = result::Result<T, Error>;
#[derive(Debug, Error)]
pub enum Error {
#[error(transparent)]
Io(#[from] io::Error),
#[cfg(feature = "security")]
#[error(transparent)]
Ssl(#[from] openssl::ssl::E... |
use super::park::{park, unpark_all, unpark_one, UnparkToken};
use lock_api::RawMutex as LRawMutex;
use std::sync::atomic::{AtomicBool, AtomicU8, Ordering};
const LOCKED_BIT: u8 = 0b01;
const PARKED_BIT: u8 = 0b10;
/// Raw mutex type.
pub struct RawMutex {
locked: AtomicU8,
}
impl RawMutex {
#[cold]
fn lo... |
//
// Sysinfo
//
// Copyright (c) 2018 <NAME>
//
use libc::{c_char, c_int, c_void};
use std::mem;
use sys::ffi;
use ComponentExt;
pub(crate) const COMPONENTS_TEMPERATURE_IDS: &[(&str, &[i8])] = &[
("CPU", &['T' as i8, 'C' as i8, '0' as i8, 'F' as i8]), // CPU Die "TC0F"
(
"CPU Proximity",
&['T... |
use super::*;
use bitcoin::{
formatter::{Formattable, TryFormattable},
types::{
BlockBuilder, RawBlockHeader, TransactionBuilder, TransactionInputBuilder, TransactionInputSource,
TransactionOutput,
},
};
use btc_relay::{BtcAddress, BtcPublicKey};
use frame_benchmarking::{account, benchmarks,... |
use std::time::Duration;
use bevy::{core::FixedTimestep, prelude::*};
use crate::{ldtk_map::LdtkMap, map::CurrentMap, markers::Markers, MainLdtk, GRID_SIZE};
pub struct MovementPlugin;
#[derive(Debug, Hash, PartialEq, PartialOrd, Eq, Ord, StageLabel, Clone)]
pub enum MovementStages {
Movement,
PostMovement,... |
#[cfg(test)]
mod signature_hash_algorithm_test;
use std::fmt;
use crate::crypto::*;
use crate::errors::*;
use util::Error;
// HashAlgorithm is used to indicate the hash algorithm used
// https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-18
// Supported hash hash algorithms
#[derive... |
use super::*;
use embedded_graphics::{
fonts::{Font6x8, Text},
pixelcolor::BinaryColor,
style::TextStyleBuilder,
};
use crate::dispatcher::leds::{Action, Mode};
use crate::multi::{Multi, Multi::*};
#[rustfmt::skip]
const MENU : &[&[MenuItem]] = &[
&[i("ping", Message::Ping), sm("display", 1), sm("led... |
use sprs::{CsMat, TriMatBase};
use sprs::{DontCheckSymmetry, FillInReduction::ReverseCuthillMcKee};
use sprs_ldl::Ldl;
use tokio::runtime::{self};
use tokio::task::JoinHandle;
pub fn multiple_whittakers(
y_input_ptr: *mut f64,
weights_input_ptr: *mut f64,
input_indices_ptr: *mut usize,
input_indices_s... |
//! This file handles the VGA text mode, allowing to easily write text on the
//! screen.
//! This module doesn't support concurrency. It is the callers' reponsibility to handle it.
//!
//! Note: The VGA text mode runs only when booting with a Legacy BIOS.
use crate::io;
use crate::memory::vmem;
use crate::memory;
//... |
use alloc::boxed::Box;
use alloc::string::String;
use alloc::vec::Vec;
use core::any::Any;
use crate::rsp::rsp::RSP;
use crate::rsp::rsp_assembler::{E, Element, GPR, RSPAssembler, VR, VSARAccumulator};
use crate::rsp::spmem::SPMEM;
use crate::tests::{Level, Test};
use crate::tests::soft_asserts::soft_assert_eq;
fn ru... |
//! Ballista executor process
#[macro_use]
extern crate log;
use crate::proto::{server, ExecuteRequest, ExecuteResponse, TableMeta};
use std::sync::Arc;
use futures::{future, Future, Stream};
use log::error;
use tokio::net::TcpListener;
use tower_grpc::{Request, Response};
use tower_hyper::server::{Http, Server};
... |
// font-kit/src/outline.rs
//
// Copyright © 2020 The Pathfinder Project 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 c... |
//! Solutions for https://adventofcode.com/2018/day/16
use std::collections::HashMap;
use std::collections::HashSet;
use regex::Regex;
use utils::data::load_data;
use utils::data::non_empty_lines;
use utils::elfcode::Instruction;
use utils::elfcode::parse_instruction;
use utils::elfcode::parse_program;
use utils::elf... |
use na::{DVector, RealField};
use std::ops::Range;
use crate::joint::JointConstraint;
use crate::math::{Point, Vector, DIM};
use crate::object::{BodyHandle, BodyPartHandle, BodySet};
use crate::solver::helper;
use crate::solver::{
GenericNonlinearConstraint, IntegrationParameters, LinearConstraints,
NonlinearC... |
use crate::file_gen::config::{LogTarget, Variant};
use governor::state::direct::{self, InsufficientCapacity};
use governor::{clock, state, Quota, RateLimiter};
use lading_common::block::{self, chunk_bytes, construct_block_cache, Block};
use lading_common::payload;
use metrics::{counter, gauge};
use rand::prelude::StdRn... |
//! An example on how to create Sync RADIUS Client from generic RADIUS Client which is provided in
//! this crate
//!
//! ```bash
//! cargo run --example sync_radius_client
//! ```
use radius_rust::client::{ client::Client, SyncClientTrait };
use radius_rust::protocol::dictionary::Dictionary;
use radius_rust::protoco... |
extern crate proc_macro;
use quote::quote;
use syn;
use syn::{parse_macro_input, DeriveInput};
use proc_macro2::TokenTree;
#[proc_macro_derive(VppMessage, attributes(message_name_and_crc))]
pub fn derive_message(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let input = parse_macro_input!(input as D... |
//! A `Compilation` contains the compiled function bodies for a WebAssembly
//! module
use super::module::Module;
use super::instance::Instance;
use super::{Relocations, Relocation, DataInitializer};
use cretonne::{self, result::CtonError, isa::TargetIsa};
use super::RelocSink;
use super::abi::ABI_MAP;
use ... |
//! Handles dynamic library loading for proc macro
use std::{
convert::TryInto,
fmt,
fs::File,
io,
path::{Path, PathBuf},
};
use libloading::Library;
use memmap2::Mmap;
use object::Object;
use paths::AbsPath;
use proc_macro_api::{read_dylib_info, ProcMacroKind};
use super::abis::Abi;
const NEW_R... |
use regex::Regex;
use std::ffi::OsStr;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
use walkdir::{DirEntry, WalkDir};
use crate::{
addon::{Addon, RepositoryIdentifiers},
error::ClientError,
Result,
};
/// Return a `Vec<Addon>` parsed from TOC files in the given directory.
pub... |
extern crate chrono;
extern crate ini;
use self::chrono::{DateTime, Duration, Utc};
use self::ini::Ini;
use awsudo::credentials::Credentials;
use awsudo::fetcher::Fetcher;
use std::fs;
use std::path::PathBuf;
pub struct Cache {
pub dir: PathBuf,
pub file: String,
}
impl Cache {
pub fn new(dir: PathBuf, ... |
use std::fs::File;
use std::io::Write;
use colored::*;
pub fn show_result(
chainid_list : &Vec<&str>,
resseq_list : &Vec<usize>,
resname_list : &Vec<&str>,
asa_list : &Vec<f64>,
rsa_list : &Vec<f64>,
state_list : &Vec<&str>,
arg_c : &String
) {
println!( "\nResult : \n" );
if ( *arg_c ) ... |
/*
* Copyright (c) 2017 <NAME> <<EMAIL>>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, pu... |
use crate::frustum_culling::collect_visible_objects;
use crate::geometry::{BoundingSphere, Transform};
use crate::internal::VisibilityWorldInternal;
use crate::Projection;
use crossbeam_channel::{unbounded, Receiver, Sender};
use glam::Vec3;
use slotmap::new_key_type;
use std::hash::Hash;
pub type VisibleObjects = Vec... |
#![deny(warnings)]
use actix_cors::Cors;
use actix_web::{middleware, web, App, Error, HttpRequest, HttpResponse, HttpServer};
use futures::Stream;
use juniper::{DefaultScalarValue, FieldError, RootNode};
use juniper_actix::{
graphiql_handler as gqli_handler, graphql_handler, playground_handler as play_handler,
... |
// Copyright 2020 Contributors to the Parsec project.
// SPDX-License-Identifier: Apache-2.0
use super::generated_ops::psa_aead_decrypt::{Operation as OperationProto, Result as ResultProto};
use crate::operations::psa_aead_decrypt::{Operation, Result};
use crate::requests::ResponseStatus;
use log::error;
use std::conve... |
use std::fmt::Display;
use std::io::Cursor;
use std::str::FromStr;
use ogg::reading::PacketReader;
use reqwest::StatusCode;
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
#[derive(Clone)]
pub struct GoogleCloudConfig {
pub voice: VoiceKind,
pub key: String,
}
#[derive(Serialize, Debug)]
... |
use std::sync::{Arc, RwLock};
use std::time::{Duration, Instant};
use super::*;
use input;
use res;
use sched;
use video;
type Result<T> = ::std::result::Result<T, ::failure::Error>;
#[derive(Default, Copy, Clone)]
struct ContextData {
shutdown: bool,
}
/// The context of sub-systems that could be accessed from... |
// makes configuration easier
#![allow(unused_macros)]
use compiler_builtins::float::Float;
use testcrate::*;
/// Make sure that the the edge case tester and randomized tester don't break, and list examples of
/// fuzz values for documentation purposes.
#[test]
fn fuzz_values() {
const VALS: [u16; 47] = [
... |
// SPDX-License-Identifier: Apache-2.0
#[cfg(feature = "backend-kvm")]
pub mod kvm;
#[cfg(feature = "backend-sev")]
pub mod sev;
#[cfg(feature = "backend-sgx")]
pub mod sgx;
mod binary;
mod probe;
use binary::Binary;
use std::convert::TryFrom;
use std::sync::Arc;
use anyhow::{Error, Result};
use libc::c_int;
use... |
#[macro_use]
extern crate lazy_static;
use actix_cors::Cors;
use actix_web::{web, App, HttpResponse, HttpServer, Responder};
use futures::{lock::Mutex, StreamExt};
use lru::LruCache;
use serde::Serialize;
use std::fmt;
use structopt::StructOpt;
use vchain::acc;
use vchain::chain::*;
static mut API_ADDRESS: Option<Str... |
use crate::{
constants,
interface::{NetworkRequest, NetworkResponse},
Peer, PeerError,
};
use futures::{
channel::{mpsc, oneshot},
future,
stream::{FuturesUnordered, StreamExt},
};
use shared::{u256, Block, BlockHash, Transaction, TxID};
use std::{
collections::{HashMap, HashSet},
future... |
use crate::{
prelude::*,
user_buffer::{UserBufReader, UserBufWriter},
};
use core::sync::atomic::{AtomicUsize, Ordering};
use super::{
file_system::FileSystem,
inode::{DirEntry, Directory, FileLike, FileType, INode, INodeNo},
opened_file::OpenOptions,
stat::{FileMode, Stat, S_IFDIR, S_IFREG},
}... |
/*
* Copyright 2020 Fluence Labs Limited
*
* 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 a... |
use std::cmp;
use raytracing::{Canvas, Color, RayTracer};
pub struct RayTracingRenderer<T: RayTracer> {
canvas: Canvas,
sequence: Sequence,
ray_tracer: T,
image_buffer: Vec<Vec<Color>>,
_output_filename: Option<String>,
is_fully_renderered: bool,
}
impl<T> RayTracingRenderer<T> where T: RayTr... |
use std::net::SocketAddr;
use std::str::FromStr;
use std::sync::Arc;
use anyhow::{Context, Result};
use openssl::x509::X509;
use serde::Deserialize;
use warp::Filter;
use fdo_data_formats::{
enhanced_types::X5Bag,
publickey::PublicKey,
types::{COSESign, Guid},
};
use fdo_store::{Store, StoreDriver};
mod ... |
use crate::back::device::Device;
use crate::back::connect::disconnect;
use std::process::{Command};
use std::path::Path;
use crate::back::dialog::launch_windows_save_dialog;
use directories::UserDirs;
use std::time::Duration;
use std::io::{Write};
pub const VERSION: &'static str = env!("CARGO_PKG_VERSION");
pub const ... |
//! # bulk-gcd
//!
//! This crate computes GCD of each integer in moduli list with the product of
//! all integers in the same list using [fast algorithm][bernstein] by
//! <NAME>.
//!
//! See: [this paper][that paper] for more details and motivation.
//!
//! Usage example:
//! ```rust
//! extern crate bulk_gcd;
//! ex... |
use bitflags::bitflags;
use std::convert::{TryFrom, TryInto};
use std::{ffi, fmt, mem, str};
use crate::v4l_sys::*;
/// Control data type
#[allow(clippy::unreadable_literal)]
#[rustfmt::skip]
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum Type {
Integer = 1,
Boolean = 2,
Me... |
use rand::*;
use crate::command;
use command::Command;
use command::CompassDirection;
use crate::component;
use component::position::Position;
//use crate::entity;
//use entity::Entity;
use crate::game;
use game::Game;
use crate::species;
use species::Species;
/// Something that can act autonomously.
#[derive(Clone, C... |
//! Parse a regular expression into a pattern
use crate::builder::Pattern;
use regex_syntax::ast::{
parse::Parser, Alternation, Assertion, AssertionKind, Ast, Class, ClassPerl, ClassPerlKind,
ClassUnicode, ClassUnicodeKind, Concat, Error, Group, GroupKind, Literal, Repetition, RepetitionKind,
RepetitionOp,... |
use num::bigint::ToBigInt;
use num::BigInt;
use num::ToPrimitive;
use franklin_crypto::bellman::pairing::ff::PrimeField;
use franklin_crypto::bellman::pairing::ff::PrimeFieldRepr;
use crate::core::contract::storage::leaf::Leaf;
use crate::core::contract::storage::leaf::LeafInput;
use crate::core::contract::storage::l... |
use std::{
sync::Arc,
time::{Duration, Instant},
};
use anyhow::{anyhow, Result};
use log::{error, info};
use rumqttc::{
AsyncClient, ConnAck, Event, LastWill, MqttOptions, Outgoing, Packet, QoS, TlsConfiguration,
Transport,
};
use crate::settings::{MqttTransport, Settings};
pub struct MqttHandle {
... |
use crate::ml;
use crate::utils;
use gtk::prelude::*;
use ndarray::prelude::*;
use plotters::prelude::*;
use polars::prelude::DataFrame;
use std::cell::RefCell;
use std::rc::Rc;
pub fn render_page(window: >k::ApplicationWindow, df_cell: Rc<RefCell<Option<DataFrame>>>) {
let (train_set, test_set) = ml::split(df_... |
use crate::{DockerBuildArgs, Dockerfile, GitLocation};
use anyhow::{anyhow, Result};
use log;
use std::{env, fmt, fs, path::Path, path::PathBuf, str::FromStr};
// Retrieve a built engine library for running benchmarks; the returned value is a path to the built
// engine's dylib. This function will attempt to build the... |
// 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
// distributed ... |
// 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... |
use nom::character::complete::{alphanumeric1, multispace0, multispace1};
use common::{integer_literal, sql_identifier, string_literal, ws_sep_comma, ws_sep_equals};
use nom::branch::alt;
use nom::bytes::complete::{tag, tag_no_case};
use nom::combinator::{map, opt};
use nom::multi::separated_list;
use nom::sequence::tu... |
extern crate clap;
use clap::{App, Arg};
use itertools::Itertools;
use rand::{rngs::StdRng, Rng, SeedableRng};
use regex::Regex;
use std::collections::HashSet;
use std::error::Error;
use std::fs;
use std::io;
type MyResult<T> = Result<T, Box<dyn Error>>;
#[derive(Debug)]
pub struct Config {
word: String,
max... |
use std::time::Duration;
use temporal_sdk_core_protos::coresdk::{
child_workflow::ChildWorkflowCancellationType,
common::{Payload, RetryPolicy},
workflow_commands::{
ActivityCancellationType, ScheduleActivity, ScheduleLocalActivity,
StartChildWorkflowExecution,
},
};
// TODO: Before rel... |
// https://en.wikibooks.org/wiki/Serial_Programming/8250_UART_Programming#UART_Registers
pub const UART: u64 = 0x10000000;
pub const THR: u64 = UART;
pub const RBR: u64 = UART;
// pub const DLL: u64 = UART;
pub const IER: u64 = UART + 1;
// pub const DLH: u64 = UART + 1;
pub const IIR: u64 = UART + 2;
pub const FCR: u... |
//! Universally Unique Identifiers or UUIDs.
use crate::ConversionError;
use core::convert::TryFrom;
use core::convert::TryInto;
use core::fmt::{Display, Error, Formatter};
type UUIDBytes = [u8; 16];
#[cfg_attr(feature = "serde-1", derive(serde::Serialize, serde::Deserialize))]
#[derive(Copy, Clone, Ord, PartialOrd, ... |
use crate::{
network::p2p::Address,
settings::logging::{LogFormat, LogOutput},
settings::LOG_FILTER_LEVEL_POSSIBLE_VALUES,
topology::QuarantineConfig,
};
pub use jormungandr_lib::interfaces::{Cors, LayersConfig, Rest, Tls, TrustedPeer};
use jormungandr_lib::{interfaces::Mempool, time::Duration};
use mu... |
//! Environment Mapping
#![cfg_attr(feature = "cargo-clippy", allow(use_self))]
#![feature(try_from)]
#[macro_use]
extern crate derive_builder;
#[macro_use]
extern crate error_chain;
#[macro_use]
extern crate getset;
extern crate dirs;
mod error;
pub use error::{Error, ErrorKind, Result};
use std::collections::HashM... |
// Copyright (c) 2016 Chef Software Inc. and/or applicable contributors
//
// 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 r... |
use std::fmt;
use std::path::PathBuf;
use serde_derive::{Deserialize, Serialize};
#[cfg(feature = "distributed")]
use zmq::Message;
use crate::coordinator::Submission;
#[cfg(feature = "metrics")]
use crate::metrics::Metrics;
/// An Message sent from the runtime server to a runtime_client
#[derive(Serialize, Deserial... |
use llog::Level;
use fast_log::appender::{FastLogRecord, LogAppender, RecordFormat};
use yansi::Paint;
use crate::config::{Settings, ExplorerLog};
use fast_log::error::LogError;
use fast_log::wait::FastLogWaitGroup;
use fast_log::consts::LogSize;
use fast_log::plugin::file_split::{RollingType, FileSplitAppender};
use s... |
use std::collections::HashMap;
use failure::Error;
use itertools::Itertools;
use petgraph::stable_graph::NodeIndex;
use petgraph::visit::EdgeRef;
use std::fmt;
use std::str::FromStr;
use t_ba9c::SuffixTree;
use t_ba9d::LongestRepeat;
use utility;
/// Find the Longest Substring Shared by Two Strings
///
/// Given: St... |
mod apu;
mod cartridge;
mod cpu;
mod joypad;
mod memory;
mod ppu;
mod printer;
mod save_error;
mod serial;
mod timer;
#[cfg(test)]
mod tests;
use std::cell::RefCell;
use std::fs::File;
use std::io::{Cursor, Read, Seek, SeekFrom, Write};
use std::path::Path;
use std::rc::Rc;
use save_state::Savable;
pub use joypad::... |
use crate::authenticator_delegate::{AuthenticatorDelegate, Retry};
use crate::refresh::RefreshFlow;
use crate::storage::{hash_scopes, DiskTokenStorage, MemoryStorage, TokenStorage};
use crate::types::{ApplicationSecret, GetToken, RefreshResult, RequestError, Token};
use futures::{future, prelude::*};
use tokio_timer;
... |
use nom::multi::count;
use nom::IResult;
use crate::error::{context, context_from, error, MapMshError, MshParserError, MshParserErrorKind};
use crate::mshfile::{Curve, Entities, MshFloatT, MshIntT, MshUsizeT, Point, Surface, Volume};
use crate::parsers::count_indexed;
use crate::parsers::num_parser_traits::{
float... |
// subset of CSS selectors
// x to support CSS-in-JS libs
// - specificity (TODO, u32-only)
// x no first/last/nth/siblings
// x universal
// x local name
// x id
// x class
// x child
// x descendant
// x multiple (div, span)
// x combination
// x decoupled from other systems
use super::parser::{selector, tokenize, P... |
use async_channel::Sender;
use log::{Level, LevelFilter, Log, Metadata, Record};
use crate::{api::*, components::ComponentUpdate};
static mut LOGGER: EspHomeLogger = EspHomeLogger { send: None };
pub struct EspHomeLogger {
send: Option<Sender<ComponentUpdate>>,
}
unsafe impl Send for EspHomeLogger {}
unsafe imp... |
use std::fmt::Display;
use std::fmt::Formatter;
use std::fmt::Result as FmtResult;
use std::fmt::Write;
use std::ops::Deref;
use std::ops::DerefMut;
use std::str::FromStr;
use fastobo_derive_internal::FromStr;
use pest::iterators::Pair;
use crate::ast::*;
use crate::error::SyntaxError;
use crate::parser::FromPair;
... |
use std::{path::PathBuf, process::Command, str};
use rbx_api::models::{CreatorType, DEFAULT_PLACE_NAME};
use yansi::Paint;
use super::{
config::{
Config, EnvironmentConfig, ExperienceTargetConfig, ExperienceTargetConfigurationConfig,
OwnerConfig, PaymentsConfig, PlaceTargetConfigurationConfig, Pla... |
use super::JniFunc;
use crate::errors::{self, Result};
use crate::interop::ReentrantLock;
use crate::store::StoreData;
use crate::{interop, utils, wtrap, wval};
use jni::objects::{JClass, JObject};
use jni::sys::{jint, jlong, jobjectArray};
use jni::{JNIEnv, JavaVM};
use wasmtime::{Caller, Func, FuncType, Store, Trap, ... |
#[macro_use]
extern crate failure;
use colored::*;
use failure::{Error, ResultExt};
use rayon_cond::CondIterator;
use regex::Regex;
use std::borrow::Cow::*;
use std::fs;
use std::path::{Path, PathBuf};
use structopt::StructOpt;
use walkdir::WalkDir;
#[derive(Debug, StructOpt)]
#[structopt(
about = "Replace text i... |
use crate::errors::DotcopterError;
use clap::{App, AppSettings, Arg, SubCommand};
use slog::{Drain, Level, LevelFilter, Logger};
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;
use std::process::exit;
use yaml_rust::YamlLoader;
use yaml_rust::{Yaml, YamlEmitter};
#[cfg(test)]
extern crate spectral;
u... |
// Copyright 2022 OpenSt<NAME>
// Licensed under the MIT license. See LICENSE file in the project root for
// full license text.
use anyhow::Result;
use axum::{
AddExtensionLayer, Json, Router,
body,
extract::{Extension, Path, ws},
http::{StatusCode, Response, header::CONTENT_TYPE},
response::IntoR... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.