text stringlengths 3.09k 13.9k |
|---|
use super::{Color, HorizontalAlignment, VerticalAlignment, HTML};
use core::fmt::{Display, Error, Formatter};
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct Work {
pub start_year: u32,
pub end_year: u32,
pub position: String,
pub company: String,
pub description: String,
}
#[... |
// 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... |
extern crate getch;
extern crate clap;
extern crate serde;
extern crate serde_json;
#[macro_use]
extern crate serde_derive;
use clap::ArgMatches;
mod args;
mod workspace;
use workspace::{Workspace, WorkspaceList};
mod project;
use project::Project;
use std::path::PathBuf;
macro_rules! try_fatal {
($e:expr) ... |
///! Background thread that will poll the coordinator for signatures
use crate::{
control::{get_presigs, CommunicationError},
database::{
actions::db_update_presigned_tx,
interface::{db_transactions_sig_missing, db_vault},
schema::{DbTransaction, RevaultTx, TransactionType},
Data... |
use std::error::Error as StdError;
use std::fmt;
use crate::body::Payload;
use crate::common::{Future, Poll, task};
use super::Service;
/// An asynchronous constructor of `Service`s.
pub trait MakeService<Target> {
/// The `Payload` body of the `http::Request`.
type ReqBody: Payload;
/// The `Payload` bo... |
// 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::model::resolver::{Resolver, ResolverError, ResolverFut},
anyhow::Error,
cm_fidl_translator::translate,
fidl::endpoints::Client... |
// Copyright 2015-2021 Swim Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
#[macro_use]
extern crate serde_json;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate crossbeam_channel;
#[macro_use]
extern crate diesel;
#[macro_use]
extern crate failure;
#[macro_use]
extern crate log;
#[macro_use]
extern crate observer_attribute;
#[macro_use]
extern crate askama;
#[cfg(any(
al... |
use libc::c_int;
use std::{ffi::CStr, fmt, result, str};
/// An MDBX error kind.
#[derive(Debug)]
pub enum Error {
KeyExist,
NotFound,
NoData,
PageNotFound,
Corrupted,
Panic,
VersionMismatch,
Invalid,
MapFull,
DbsFull,
ReadersFull,
TxnFull,
CursorFull,
PageFull,
... |
use std::{collections::HashMap, fs};
use common::utility::print_solution;
const ARROW: &'static str = " -> ";
fn replace_one_step(formula: &str, insertion_pairs: &HashMap<(char, char), char>) -> String {
let mut result = vec!['_'; formula.len() * 2];
result[0] = formula.chars().nth(0).expect("Unexpected form... |
mod date_fixed_roller;
pub use json::{array, object};
pub use tracing::{init_jaeger, FutureExt, LocalSpan, MercuryTrace, Span, TRACING_SPAN_TX};
pub use tracing_derive::{tracing, tracing_async};
use date_fixed_roller::DateFixedWindowRoller;
use common::Context;
use json::JsonValue;
use log::{Level, LevelFilter};
us... |
mod utils;
use wasm_bindgen::prelude::*;
extern crate fixedbitset;
use fixedbitset::FixedBitSet;
extern crate js_sys;
extern crate web_sys;
macro_rules! log {
( $( $t:tt )* ) => {
web_sys::console::log_1(&format!( $( $t )* ).into());
}
}
// When the `wee_alloc` feature is enabled, use `wee_alloc` a... |
use slab::Slab;
use na::{self, Real};
use world::CollisionWorld;
use object::{BodyHandle, BodyMut, BodySet};
use joint::JointConstraint;
use utils::union_find::UnionFindSet;
use utils::union_find;
/// Structure that monitors island-based activation/deactivation of bodies.
///
/// It is responsible for making objects ... |
/*
* 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... |
#![warn(missing_docs)]
//! This library emulates java try catch using panics and panic handlers in rust.
//!
//! The idea is the user can define custom exceptions that implement the [Exception] trait.
//!
//! Then he can use [throw] to throw those exceptions and [catch] to catch it at any point of the
//! call stack.
/... |
use super::retry::Budget;
use futures::Stream;
use http;
use indexmap::IndexMap;
use linkerd2_addr::NameAddr;
use linkerd2_error::Never;
use regex::Regex;
use std::fmt;
use std::hash::{Hash, Hasher};
use std::iter::FromIterator;
use std::ops::Deref;
use std::sync::Arc;
use std::time::Duration;
pub mod recognize;
/// A... |
#[macro_use]
extern crate parser_comb;
use parser_comb::parser::map::Map;
use parser_comb::parser::{
char, choice, debug_parse, exclude_empty, extract, filter, flatten, identity_map, kind,
kind_ignore, lazy, many, many1, map, opt, regexp, sep, seq, token, trim, type_map, unwrap, wrap,
Node, Parser, ParserCombinat... |
use super::generation::PageGenerator;
use super::config::Config;
use std::io;
use std::io::{Read, Write};
use std::fs;
use std::fs::{DirBuilder, File};
use std::path::Path;
use std::error::Error;
use std::fs::OpenOptions;
use hyper::server::{Request, Response, Server};
use hyper::status::StatusCode;
use hyper::uri::R... |
extern crate cargo_metadata;
extern crate clap;
extern crate console;
extern crate glob;
extern crate proc_macro2;
extern crate quote;
extern crate serde;
extern crate serde_json;
extern crate syn;
mod check;
mod check_source;
mod ext;
mod util;
use clap::{App, Arg, SubCommand};
use console::Emoji;
use std::path::Pat... |
use core::panic;
use std::io::Error;
use hashbrown::HashMap;
use near_account_id::AccountId;
use near_crypto::PublicKey;
use near_jsonrpc_primitives::{errors::RpcError, message::Response};
use near_primitives::{
transaction::Action,
types::{Balance, BlockReference, Finality},
views::{AccessKeyInfoView, Acc... |
// Copyright (c) 2018-2020 MobileCoin Inc.
//! Abstract traits used by Structs which implement key management
pub use digest::Digest;
pub use ed25519::signature::{DigestSigner, DigestVerifier, Signature, Signer, Verifier};
use alloc::{string::String, vec::Vec};
use core::{convert::TryFrom, fmt::Debug, hash::Hash};
u... |
/*
Copyright 2021 Integritee AG and Supercomputing Systems AG
Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
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/l... |
// Copyright 2019 wc_rs Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to t... |
/// Expressions have no side-effects and produce a value
#[derive(Debug, Clone)]
pub enum Expr {
Block(Block),
Call(Call),
Or(Or),
And(And),
Thresh(Thresh),
Ident(Ident),
Array(Array),
ArrayAccess(ArrayAccess),
ChildDerive(ChildDerive),
ScriptFrag(ScriptFrag),
FnExpr(FnExpr),... |
//! The Block Parser function and its dependencies
use mod_common::{ Operator::*, Keyword::*, STATEMENT_KEYWORDS, };
use crate::{
source::{ SourceRegion, },
token::{ Token, TokenData, },
ast::{ Block, StatementData, ConditionalBranch, Conditional, },
};
use super::{ Parser, statement, expression, sy... |
use std::io::Write;
use std::sync::Arc;
use anyhow::Result;
use crossterm::style::Stylize;
use crate::arg_parser::parse_args;
use crate::cache::Cache;
use crate::environment::TestEnvironment;
use crate::plugins::CompilationResult;
use crate::plugins::PluginCache;
use crate::plugins::PluginPools;
use crate::plugins::P... |
#[allow(dead_code)]
#[allow(unused_variables)]
// Import Libraries
use std::mem;
// VARIABLES: primitives
pub fn variables()
{
// VARIABLES TYPES: u8, u16, u32, u64, u128, i8, i16, ...
let a: u8 = 100; // This is a variable declaration for a, which is now stored in memory as an u=unsigned, 8 bits, 0-255 nu... |
//! Flaken is a configurable Snowflake ID generator where the epoch
//! and bitwidths may be adjusted to your liking from the defaults.
//! ID generation from an instantiated generator will always increase in value.
//! If a ID generator is created after a clock moves back from previously
//! created IDs conflicting ID... |
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use gc_representation_rs::shared::{MemoryManager, Stack};
use gc_representation_rs::stop_copy::StopAndCopyHeap;
use gc_representation_rs::{link_heap, make_garbage, mark_compact::*};
use rand::prelude::*;
use rand_pcg::Pcg64;
use std::env;
fn... |
//! A simple IRC connection wrapper.
use std::mem;
use std::time::Duration;
use actix::actors::resolver::{Connect, Resolver, ResolverError};
use actix::dev::ToEnvelope;
use actix::io::{FramedWrite, WriteHandler};
use actix::prelude::*;
use actix::Running;
use futures::sync::mpsc;
use irc::error::IrcError;
use irc::pr... |
use draw::mesh::vertex::IntoPoint;
use draw::properties::spatial::{dimension, orientation, position};
use draw::properties::{
spatial, ColorScalar, Draw, Drawn, IntoDrawn, Primitive, Rgba, SetColor, SetDimensions,
SetOrientation, SetPosition,
};
use draw::{self, Drawing};
use geom::{self, Point3, Vector3};
use ... |
// Check that each Hook variant is called at the expected points
#[macro_use]
extern crate penrose;
use penrose::{
core::{
client::Client,
config::Config,
data_types::Region,
hooks::{Hook, Hooks},
manager::WindowManager,
screen::Screen,
xconnection::{Atom, Pr... |
use evolvable_substrate::{Num, PartitionConfig, PartitionedSpace, Point2, Region};
/// Some test image functions
mod fns {
use super::{Num, Point2};
// Four squares where diagonal squares have the same color.
pub fn four_squares_diag(p: Point2<Num>) -> Num {
if p.x < 0.0 && p.y < 0.0 || p.x > 0.0 ... |
use crate::git::io::writer::GitWriter;
use core::result::Result as CoreResult;
use std::sync::Once;
use actix_web::web::Bytes;
use anyhow::Result;
use git2::{Error as Git2Error, ErrorCode, Reference, Repository as Git2Repository};
use log::{error, warn};
use tracing::instrument;
// TODO: Combine ls_refs and ls_refs_... |
use ssz::TreeHash;
use state_processing::per_block_processing::validate_attestation_without_signature;
use std::collections::{HashMap, HashSet};
use types::*;
const PHASE_0_CUSTODY_BIT: bool = false;
/// Provides the functionality to:
///
/// - Recieve a `FreeAttestation` and aggregate it into an `Attestation` (or c... |
#![allow(non_camel_case_types)]
extern crate libc;
extern crate eina_sys;
use libc::*;
use eina_sys::*;
/* automatically generated by rust-bindgen */
#[repr(C)]
pub struct Ethumb_Version {
pub major: c_int,
pub minor: c_int,
pub micro: c_int,
pub revision: c_int,
}
pub enum Ethumb { }
pub type Ethum... |
extern crate cfg_if;
extern crate wasm_bindgen;
mod utils;
use cfg_if::cfg_if;
use wasm_bindgen::prelude::*;
use std::fmt;
cfg_if! {
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
if #[cfg(feature = "wee_alloc")] {
extern crate wee_alloc;
#[global_... |
//! Error types used in saltyrtc-client.
//!
//! The implementation is done using the
//! [`failure`](https://crates.io/crates/failure) crate.
use std::convert::From;
use std::sync::TryLockError;
use failure::Fail;
use rmp_serde::decode::Error as SerdeDecodeError;
use tokio_timer::TimeoutError;
/// Re-exported [`Er... |
/**
* Write a program to solve a Sudoku puzzle by filling the empty cells.
*
* A sudoku solution must satisfy all of the following rules:
*
* Each of the digits 1-9 must occur exactly once in each row.
* Each of the digits 1-9 must occur exactly once in each column.
* Each of the the digits 1-9 must occur exactl... |
//! GH Auditor: Audit and enforce access permission policy for an organisation.
#![warn(missing_docs)]
mod builder;
mod config;
mod error;
pub use builder::AuditorBuilder;
use std::borrow::Cow;
use hyperx::header::{RelationType, TypedHeaders};
use snafu::{OptionExt, ResultExt};
/// Alias `Result` for convenience.
... |
extern crate structopt;
#[macro_use]
extern crate structopt_derive;
extern crate cargo_metadata;
#[macro_use] extern crate log;
extern crate simple_logger;
extern crate toml;
extern crate xdg;
use std::process::{exit, Command, Stdio};
use std::path::{Path, PathBuf};
use std::fs::File;
use std::io::{Read, Write};
u... |
//! A library for easy serverside internationalization / localization using the
//! [Fluent](https://projectfluent.org) i18n system to parse and apply translations.
//!
//! # Quickstart
//! Create a folder structure at your project root, organized like so:
//! - `i18n`
//! - `en_US`
//! - `greeting.ftl`
//! - `... |
mod hook;
use anyhow::Context as _;
use pico_args::Arguments;
use std::{
env, fs, io,
path::PathBuf,
process::{Command, Stdio},
time::Duration,
};
use wait_timeout::ChildExt as _;
fn main() -> anyhow::Result<()> {
let show_help = || {
eprintln!(
"\
cargo-xtask
Free-form automat... |
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
use common::derive_more::Display;
use jsonrpsee_http_server::types::{CallError, Error};
use serde::{Deserialize, Serialize};
pub type RpcResult<T> = Result<T, Error>;
pub type InnerResult<T> = Result<T, RpcErrorMessage>;
#[derive(Serialize, Deserialize, Clone, Debug, Display, Hash, PartialEq, Eq)]
#[display(fmt = "M... |
/*
* Copyright 2019 The Exonum Team
*
* 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... |
/// Trait that must be implemented by all states that wish to work with the state machine.
/// Needed to pass ggez::event::EventHandler functions to states managed by state manager.
pub trait CustomEventHandler {
// required
/// Used to pass parameters from ggez::event::EventHandler update to state
fn upda... |
//! # debpkg
//!
//! A library to parse binary debian packages
//!
//! This library provides utilties to parse [binary debian
//! packages](https://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html#s-deb-format)
//! abstracted over a reader. This API provides a streaming interface to avoid
//! loading the ent... |
// Copyright 2021 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT
// http://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD
// https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied,
// modified, or di... |
//! Utility methods and constructors for Lua classes
use std::{convert::From, marker::PhantomData, sync::Arc};
use rlua::{self, AnyUserData, Function, Lua, MetaMethod, Table, ToLua, UserData, UserDataMethods,
Value};
use super::{object::{self, Object, ObjectStateType},
property::Property};
pu... |
use std::env;
use std::io;
use std::path::{Path, PathBuf};
use std::time::SystemTime;
use dirs::home_dir;
use tempfile::TempDir;
use tokio::fs::{create_dir_all, metadata};
use which::which;
use crate::process::{Process, ProcessBuilder, ProcessStdio};
/// Operate browser error.
#[derive(Debug, thiserror::Error)]
pub ... |
// Copyright 2021 the Tectonic Project
// Licensed under the MIT License.
use std::{env, path::PathBuf};
use tectonic_cfg_support::*;
fn main() {
let target = env::var("TARGET").unwrap();
// Include paths exported by our internal dependencies.
let xetex_layout_include_path = env::var("DEP_TECTONIC_XETEX... |
use crate::game::{
ball::SpawnBallEvent,
brick::{self, BrickComponent},
paddle::{self, PlayerPaddleComponent},
physics::ColliderComponent,
render::SpriteComponent,
transform::TransformComponent,
Point2f, Vector2d, Vector2f, WORLD_UNIT_RATIO,
};
use gfx::{color::*, renderer::Transparency, spr... |
use std::collections::{HashMap, HashSet, VecDeque};
use std::str::FromStr;
type Point = (usize, usize);
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
enum Species {
Elf,
Goblin,
}
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
struct Creature {
position: Point,
hit_poin... |
/// Collect metrics from `/proc/stat`
use std::path::PathBuf;
use event::{tags, Metric};
use serde::{Deserialize, Serialize};
use tokio::io::AsyncBufReadExt;
use super::Error;
use crate::config::{default_false, default_true, deserialize_regex, serialize_regex};
const USER_HZ: f64 = 100.0;
macro_rules! state_metric ... |
use rand::{thread_rng, Rng};
use std::mem;
use protobuf::Message;
use session_error::SessionError;
use signalling::{S2C_Transition, StationToClient};
const TAPDANCE_PROTOCOL_VERSION: u32 = 1;
pub fn make_simple_proto(msg_type: S2C_Transition) -> StationToClient
{
let mut msg = StationToClient::new();
msg.se... |
//! SQLite Dynamic Type Wrappers
use sqlite3_raw::*;
use std::os::raw::c_void;
use std::string::FromUtf8Error;
use std::slice;
// The following two are for bookkeeping with in-flight Strings taken from Rust
// into SQLite-world
use std::sync::Mutex;
use std::collections::HashMap;
/// Zero cost Wrapper for SQLite Valu... |
use std::borrow::Cow;
use std::collections::HashMap;
use percent_encoding::{percent_decode_str, utf8_percent_encode, NON_ALPHANUMERIC};
use super::error::Result;
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct Options<'a> {
pub schema: Cow<'a, str>,
pub user: Cow<'a, str>,
pub password: Cow<'a... |
#![allow(dead_code)]
use tetra::graphics::{self, Color, DrawParams, Rectangle, Texture};
use tetra::math::Vec2;
use tetra::Context;
const MAX_LAYER: usize = 3;
struct Cell {
x: i32,
y: i32,
glyph: u16,
fg_color: Color,
bg_color: Color,
}
pub struct Terminal {
w: i32,
h: i32,
cell_w: i... |
use crate::material::*;
use crate::shader::parser::*;
use std::ops::IndexMut;
#[derive(Debug, Serialize, Deserialize)]
#[repr(align(16))]
pub struct MaterialParser {
material: MaterialTree,
map: slotmap::SlotMap<MaterialKey, MaterialNode>,
}
impl Default for MaterialParser {
fn default() -> Self {
... |
#![warn(rust_2018_idioms)]
#[macro_use]
extern crate tracing;
use std::collections::hash_map::{Entry, HashMap};
use std::error::Error;
use std::fmt;
use conduit::{box_error, Handler, HandlerResult, Method, RequestExt};
use route_recognizer::{Match, Params, Router};
static UNKNOWN_METHOD: &str = "Invalid method";
st... |
use cargo_snippet::snippet;
use std::cmp::min;
use std::collections::{BTreeSet, VecDeque};
#[snippet("Flow")]
#[allow(dead_code)]
/// Struct for maximum flow problem
pub struct Flow {
/// to, capacity, rev
edges: Vec<Vec<(usize, usize, usize)>>,
}
#[snippet("Flow")]
impl Flow {
#[allow(dead_code)]
pub... |
use std::collections::BTreeMap;
use std::sync::Arc;
use collections::bitset::BitSet;
use crate::partitioner::Partitioner;
use crate::{contribution::AggregatableContribution, identity::Identity};
pub trait ContributionStore: Send + Sync {
type Contribution: AggregatableContribution;
/// Put `signature` into ... |
//! Generate a DOT graph using a poor man's graph generator.
use std::{fs::File, io::Write, path::PathBuf};
use anyhow::{Context, Error};
use hotg_rune_syntax::hir::{HirId, NameTable, Node, Rune, Slot, Type};
use codespan_reporting::term::termcolor::ColorChoice;
use indexmap::IndexMap;
use crate::inspect::Metadata;
... |
#[cfg(not(feature = "rustsbi"))]
use crate::opensbi::{impl_id, impl_version, spec_version};
#[cfg(feature = "rustsbi")]
use crate::rustsbi::{impl_id, impl_version, spec_version};
use crate::{
cpu::hart_id,
dt::{CPU_NUMS, MEM_SIZE, MEM_START, TIMER_FREQ},
timer::get_time,
utils::{micros, time_parts},
};
... |
//! Private module for selective re-export.
use crate::Rewrite;
use crate::util::DenseNatMap;
use std::iter::FromIterator;
use std::ops::Index;
/// A `RewritePlan<R>` is derived from a data structure instance and indicates how values of type
/// `R` (short for "rewritten") should be rewritten. When that plan is recur... |
// 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... |
pub mod paging;
pub mod heap_allocator;
mod bitmap_frame_allocator;
mod stack_allocator;
use self::bitmap_frame_allocator::BitmapFrameAllocator;
use self::paging::{PAGE_SIZE, PhysicalAddress, Page, ActivePageTable};
use self::heap_allocator::{HEAP_START, HEAP_SIZE};
use x86_64::registers::model_specific::{Efer, Ef... |
extern crate gluon_base as base;
use std::ops::Deref;
use base::types::*;
fn type_con<I, T>(s: I, args: Vec<T>) -> Type<I, T>
where I: Deref<Target = str>,
T: From<Type<I, T>>,
{
assert!(s.len() != 0);
match s.parse() {
Ok(b) => Type::Builtin(b),
Err(()) if s.starts_with(char::i... |
use std::marker::PhantomData;
use crate::co;
use crate::kernel::decl::{WinResult, WString};
use crate::msg::lb;
use crate::prelude::{NativeBitflag, UserHwnd};
use crate::user::decl::HWND;
/// Exposes item methods of a [`ListBox`](crate::gui::ListBox) control.
///
/// You cannot directly instantiate this obj... |
use crate::ir::{self, RRC};
use std::collections::HashMap;
use std::rc::Rc;
use super::CloneName;
/// Map to rewrite cell uses. Maps name of the old cell to the new [ir::Cell]
/// instance.
pub type CellRewriteMap = HashMap<ir::Id, RRC<ir::Cell>>;
/// Map to rewrite port uses. Maps the canonical name of an old port ... |
use opencl3::*;
pub struct Context {
pub opencl_context: context::Context,
edge_detect: kernel::Kernel,
sdf_generate: kernel::Kernel,
rgba_to_grayscale: kernel::Kernel,
command_queue: command_queue::CommandQueue,
pub device_name: String
}
impl Context {
pub fn new(device_id: *mut core::ffi... |
use bevy::prelude::*;
use bitflags::bitflags;
use crate::{game::GameTimeDelta, combat::Target};
bitflags! {
#[derive(Default, Component)]
pub struct AgentCategory: u32 {
const FIGHTER = 0b00000001;
const FRIGATE = 0b00000010;
const CRUISER = 0b00000100;
const TURRET = 0b0000100... |
use eth2::{
types::{BeaconCommitteeSubscription, StateId, ValidatorId},
BeaconNodeHttpClient,
};
use serde::{Deserialize, Serialize};
use slog::{error, Logger};
use std::collections::HashMap;
use types::{CommitteeIndex, Epoch, PublicKey, PublicKeyBytes, Slot};
/// This struct is being used as a shim since we d... |
/*
Copyright 2018 <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, software
distributed ... |
//! Simplifies branches and removes empty basic blocks.
//!
//! # Optimizations
//!
//! Branching simplify performs the follow optimizations:
//!
//! - Replaces `brif _ bbI bbI` into `br bbI`.
//!
//! - Replaces `brif 0 bbI bbJ` into `br bbJ`; replaces `brIf x bbI bbJ` into
//! `br bbI` where `x` is an immediate and ... |
// Physical memory layout
// qemu -machine virt is set up like this,
// based on qemu's hw/riscv/virt.c:
//
// 00001000 -- boot ROM, provided by qemu
// 02000000 -- CLINT
// 0C000000 -- PLIC
// 10000000 -- uart0
// 10001000 -- virtio disk
// 80000000 -- boot ROM jumps here in machine mode
// -kernel load... |
// Copyright (c) <2015> <lummax>
// Licensed under MIT (http://opensource.org/licenses/MIT)
#![allow(dead_code)]
use libc::{c_int, c_char, c_void, int32_t, uint32_t};
#[repr(C)]
pub struct WLInterface {
pub name: *const c_char,
pub version: c_int,
pub method_count: c_int,
pub methods: *const WLMessag... |
use serde::Serialize;
use super::consts::*;
const DUR_PREAMBLE: u32 = 4400;
const DUR_ON: u32 = 1582;
const DUR_OFF: u32 = 503;
const DUR_WAIT: u32 = 576;
#[derive(Clone)]
pub enum SignalType {
Invalid,
Preamble,
One,
Zero,
}
#[derive(Clone)]
pub struct Signal {
pub signal_type: SignalType,
... |
use errors::*;
use reqwest;
use std::fs::{remove_dir_all, File, OpenOptions};
use std::io::prelude::*;
use std::path::PathBuf;
use std::process::{Command, Output};
use tests::TestCase;
static CRATES_ALL: &[&str] = &["bare-metal = \"0.1.0\"", "vcell = \"0.1.0\""];
static CRATES_MSP430: &[&str] = &["msp430 = \"0.1.0\""]... |
use crate::{
bdev::nexus::{
instances,
nexus_bdev::{nexus_create, Nexus},
Error,
},
jsonrpc::{jsonrpc_register, Code, JsonRpcError},
};
use futures::{future, FutureExt};
use rpc::mayastor::{
Child,
ChildNexusRequest,
CreateNexusRequest,
DestroyNexusRequest,
ListNe... |
use crate::api::FirestoreApi;
use crate::documents::{GameEntry, LibraryEntry, StoreEntry};
use crate::Status;
use serde::{Deserialize, Serialize};
pub struct LibraryOps {}
impl LibraryOps {
/// Store storefront entries to user's library under unknown entries.
///
/// Writes `StoreEntry` documents under co... |
use std::{fs::File, os::unix::prelude::*};
// Thoroughly inspired by https://github.com/ryanriske/ZenStates-Linux/blob/master/zenstates.py
#[cfg(target_os = "freebsd")]
mod platform {
use super::*;
use capsicum::{self, CapRights, Right};
use nix::{ioctl_readwrite, request_code_readwrite};
use std::mem... |
/// Variable Identifiers
use std::cmp::Ordering;
use std::fmt;
/// this will probably go away in favor of a bitmask at some point
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash, Serialize, Deserialize)]
enum VidEnum {
// How I (eventually) want the ordering, to be (once biggest vars go on top:)
... |
/* Module for reading/writing character to screen
//
// Significant portion of code has been used from <NAME>'s blog
// @ https://os.phil-opp.com/
// Copyright (c) 2019 <NAME>
*/
use core::fmt;
use lazy_static::lazy_static;
use spin::Mutex;
use volatile::Volatile;
lazy_static! {
/// Static Writer instance to ues ... |
use std::collections::HashSet;
use std::fs::File;
use std::io::{self, BufRead};
use std::num::ParseIntError;
use std::path::Path;
use std::str::FromStr;
use std::time::Instant;
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
struct Fold {
horizzontal: bool,
value: usize,
}
impl FromStr for Fold {
type Err = ... |
#[cfg(feature = "renderer")]
mod backend;
#[cfg(feature = "renderer")]
pub use backend::*;
use crate::color::Rgba;
use crate::kit::ZDepth;
use crate::kit::{Repeat, Rgba8};
use crate::math::*;
use crate::rect::Rect;
///////////////////////////////////////////////////////////////////////////
// Vertex
/////////////////... |
use std::{fs, error, path, process, io};
use std::io::Read;
use clap;
use serde::Deserialize;
fn main() {
let matches = clap::App::new("backup")
.arg(
clap::Arg::with_name("configpath")
.long("config")
.short("c")
.value_name("PATH")
... |
mod camera;
mod matrix3x3;
mod mesh;
mod scene;
mod triangle;
mod vec3d;
use camera::Camera;
use mesh::Mesh;
use scene::Scene;
use vec3d::Vec3d;
use ggez::{
self, event, event::KeyCode, graphics, graphics::Vertex, input::keyboard, nalgebra as na,
timer::delta,
};
/// Event Handler for a Mesh
///
/// NOTE: Th... |
extern crate futures;
mod timer;
use std::rc::Rc;
use std::cell::RefCell;
use std::collections::VecDeque;
use std::marker::PhantomData;
use std::time::{Duration, Instant};
use futures::{Async, AsyncSink, Poll};
use futures::future::Future;
use futures::sink::Sink;
use futures::stream::Stream;
use futures::sync::mpsc... |
use web_sys::{Element, HtmlElement, MouseEvent};
use yew::agent::{Dispatched, Dispatcher};
use yew::{html, Bridge, Bridged, Component, ComponentLink, Html, NodeRef, ShouldRender};
use pallet_canvas::PalletCanvas;
use crate::agents::current_color_agent::{CurrentColorAgent, Response};
use crate::agents::hsv_color_agent... |
//! Defines the [Pdfium] struct, a high-level idiomatic Rust wrapper around Pdfium.
use crate::bindings::PdfiumLibraryBindings;
use crate::document::PdfDocument;
use crate::{PdfiumError, PdfiumInternalError};
#[cfg(not(target_arch = "wasm32"))]
use std::ffi::OsString;
#[cfg(not(target_arch = "wasm32"))]
use libloadi... |
use std::fmt;
use random_access_storage::RandomAccess;
use crate::cmd::put::{Put, PutOptions};
use crate::node::{Node, HIDDEN_FLAG};
use crate::{HyperTrie, TrieCommand};
#[derive(Clone, Debug)]
pub struct Delete {
return_closest: bool,
node: Node,
closest: u64,
}
impl Delete {
pub fn new(opts: impl ... |
// 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 {
crate::volume::VolumeConnection,
crate::vslice::{VSliceRange, VSliceRanges},
async_trait::async_trait,
fuchsia_zircon::Status,
lo... |
use std::collections::HashSet;
use anyhow::Result;
use pixels::{Pixels, SurfaceTexture};
use rand::Rng;
use winit::{
dpi::PhysicalSize,
event::{Event, VirtualKeyCode},
event_loop::{ControlFlow, EventLoop},
window::WindowBuilder,
};
use winit_input_helper::WinitInputHelper;
const CELL_SIZE: u32 = 20;
... |
use std::fs;
#[derive(Debug)]
pub struct PowerConsumptionResult {
gamma_rate: isize,
epsilon_rate: isize,
}
#[derive(Debug)]
pub struct LifeSupportResult {
oxygen_generator_rating: isize,
co2_scrubber_rating: isize,
}
pub enum LifeSupportMetric {
OxygenGenerator,
Co2Scrubber,
}
struct Binary... |
use crate::core::{Renderer, MamgaGfx, Color, Vertex2D};
use crate::camera::get_projection_matrix;
use std::sync::Arc;
use vulkano::pipeline::{
GraphicsPipeline,
GraphicsPipelineAbstract
};
use vulkano::framebuffer::Subpass;
use vulkano::buffer::{ CpuAccessibleBuffer, BufferUsage };
use vulkano::image::Immutab... |
//! `WorkQueue` is a purely safe work queue, suitable for fairly distributing
//! work to any number of worker threads from any number of controllers.
use std::sync::{Mutex, Arc};
use std::collections::VecDeque;
use std::thread;
use crate::sync_flag::SyncFlagRx;
/// A generic work queue for any work element that is ... |
use std::{ffi::OsString, mem, os::windows::ffi::OsStringExt};
// source: https://www.unknowncheats.me/forum/general-programming-and-reversing/330583-pure-rust-injectable-dll.html
use std::result::Result as StdResult;
use failure::{Error as FError, Fail};
use getset::Getters;
use winapi::um::{handleapi, memoryapi, proc... |
extern crate gtk;
#[macro_use]
extern crate horrorshow;
use gtk::*;
use std::process;
fn main() {
// Initialize GTK before proceeding.
if gtk::init().is_err() {
eprintln!("failed to initialize GTK Application");
process::exit(1);
}
// Initialize the UI's initial state
let app = Ap... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.