text stringlengths 3.09k 13.9k |
|---|
use crate::resources::{AudioSettings, UiHandles, UiType};
use crate::states::window_event_handler;
use amethyst::core::ecs::{Read, World, WriteStorage};
use amethyst::ui::UiText;
use amethyst::{
ecs::prelude::{Entity, WorldExt},
input::{is_close_requested, is_key_down, VirtualKeyCode},
ui::{UiEvent, UiEvent... |
// Copyright (c) SimpleStaking and Tezedge Contributors
// SPDX-License-Identifier: MIT
use std::path::Path;
use std::sync::{Arc, RwLock};
use derive_builder::Builder;
use rocksdb::{BlockBasedOptions, Cache, ColumnFamilyDescriptor, Options, DB};
pub use codec::{BincodeEncoded, Codec, Decoder, Encoder, SchemaError};
... |
#![warn(missing_docs)]
#![warn(missing_debug_implementations)]
//! A tiny library to measure resource usage of the process it's used in.
//! Currently it measures:
//!
//! * Memory Usage
//! * CPU Usage with breakdown by each thread
//! * Disk Usage
//!
//! More metrics might be added later. Currently, library supports... |
#![allow(missing_docs)] // don't publish a crate with this!
#![warn(clippy::pedantic)]
#![deny(rust_2018_idioms)]
#![deny(clippy::too_many_arguments)]
#![deny(clippy::complexity)]
#![deny(clippy::perf)]
#![forbid(unsafe_code)]
use std::{cmp::max, path::PathBuf};
use clap::{crate_version, value_t, App, AppSettings, Ar... |
use super::*;
use std::ops::Deref;
use num::{FromPrimitive, ToPrimitive};
use std::str::FromStr;
use serde::de::{self, Deserialize, Deserializer, Unexpected, Visitor};
use serde::ser::{Serialize, Serializer};
use std::fmt;
/// error codes
///
/// Error codes as returned as part of a response from the service in the... |
use std::sync::{RwLock, RwLockWriteGuard};
use iron::headers::ContentType;
use iron::modifier::Modifier;
use iron::prelude::*;
use iron::status;
use iron::{typemap, AfterMiddleware};
use plugin::Plugin as PluginFor;
use handlebars::{to_json, Handlebars, TemplateRenderError};
use serde::ser::Serialize as ToJson;
use s... |
use std::io;
use std::process;
#[macro_use]
extern crate log;
pub type Error = io::Error;
pub type Result<T> = io::Result<T>;
fn err_other<T>(s: &str) -> Result<T> {
Err(Error::new(io::ErrorKind::Other, s.to_owned()))
}
/// `Protoc --lang_out...` args
#[derive(Default)]
pub struct Args<'a> {
/// `LANG` p... |
use super::error::DnaError;
use crate::prelude::*;
use holo_hash::*;
use holochain_zome_types::ZomeName;
use std::collections::BTreeMap;
/// Wasms need to be an ordered map from WasmHash to a wasm::DnaWasm
#[derive(
Clone,
Debug,
PartialEq,
Eq,
serde::Serialize,
serde::Deserialize,
derive_m... |
//! Input
//!
//! Here we multiplex all the hardware inputs (3) to create a series of
//! unique output combinations (7)
use crate::types::InputEvent;
use crate::types::{LeftButton, MiddleButton, RightButton, TouchSenseController};
use crate::types::hal::tsc::Event as TscEvent;
pub const LEFT: u8 = 1;
pub const MIDD... |
use crate::hash::Merge;
use std::collections::VecDeque;
/// Merkle tree is a tree in which every leaf node is labelled with the hash of a data block and
/// every non-leaf node is labelled with the cryptographic hash of the labels of its child nodes.
///
/// [Article on Wikipedia](https://en.wikipedia.org/wiki/Merkle_... |
#![allow(dead_code)]
use crate::location;
use rand::Rng;
use std::cmp::max;
/// This trait exposes functions to deal with any element of the game that
/// needs to incorporate randomness.
/// It basically wraps all calls to the rand crate, allowing to replace it with a
/// noop implementation in tests to make the log... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Power Reset Control and Status"]
pub pwr_rst_ctrl: crate::Reg<pwr_rst_ctrl::PWR_RST_CTRL_SPEC>,
#[doc = "0x04 - Interrupt Flags"]
pub intfl: crate::Reg<intfl::INTFL_SPEC>,
#[doc = "0x08 - Interrupt Enable/Disable Contro... |
#[doc = "Reader of register BREQUEST"]
pub type R = crate::R<u32, super::BREQUEST>;
#[doc = "SETUP data, byte 1, bRequest. Values provided for standard requests only, user must implement class and vendor values.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BREQUEST_A {
#[doc = "0: Standa... |
// MIT License
//
// Copyright (c) 2021 <NAME> All Rights Reserved.
// Distributed under the terms of the MIT License.
//
//
#[derive(Copy, Clone)]
pub enum SolfegeTokens {
Do = 0,
DoSharp = 1,
Di,
Re,
ReSharp,
Ri,
Mi,
MiSharp,
Fa,
FaSharp,
Fi,
Sol,
SolSharp,
... |
use crate::io::AsyncRead;
use std::future::Future;
use std::io;
use std::mem::{self, MaybeUninit};
use std::pin::Pin;
use std::task::{Context, Poll};
#[derive(Debug)]
#[must_use = "futures do nothing unless you `.await` or poll them"]
#[cfg_attr(docsrs, doc(cfg(feature = "io-util")))]
pub struct ReadToEnd<'a, R: ?Siz... |
use crate::base::Transport;
use crate::{Error, ErrorKind, PollRecv, PollSend, Result};
use bytecodec::{Decode, DecodeExt, Encode, EncodeExt};
use fibers::net::futures::{RecvFrom, SendTo};
use fibers::net::UdpSocket;
use futures::Poll;
use futures::{Async, Future};
use std::collections::VecDeque;
use std::net::SocketAdd... |
use std::cmp::max;
use std::fs;
use std::iter;
#[derive(Debug, PartialEq)]
struct Item {
name: String,
cost: i16,
damage: i16,
armour: i16,
}
#[derive(Clone, Debug)]
struct Attacker {
hit_points: i16,
damage: i16,
armour: i16,
}
#[derive(Debug)]
struct Outcome {
cost: i16,
win: bo... |
use super::{
structs::{rollingupdate::RollingUpdate, ResourceRequirements},
Manifest, Result,
};
/// Total resource usage for a Manifest
///
/// Accounting for workers, replicas, sidecars, and autoscaling policies for these.
#[derive(Serialize, Default)]
pub struct ResourceTotals {
/// Sum of basic resourc... |
extern crate regex;
use std::env;
use std::fs;
use regex::Regex;
use std::collections::{HashMap, HashSet};
#[derive(Eq, Clone, Hash, PartialEq)]
struct Tile {
left: i16,
top: i16,
right: i16,
bottom: i16,
}
impl Tile {
fn print_debug(&self) {
for i in 0..10 {
if (self.top & 1... |
use crate::extensions::{create_typed_actor_groups, MultiDimensionalCapacity};
use crate::format::coord_index::CoordIndex;
use crate::format::problem::reader::{add_skills, ApiProblem, ProblemProperties};
use crate::format::problem::Matrix;
use crate::parse_time;
use std::collections::{HashMap, HashSet};
use std::sync::A... |
//! API for the CTimer peripheral
//!
//! Currently, only PWM output functionality is implemented.
//!
//! # Example
//!
//! ```no_run
//! use lpc8xx_hal::{
//! delay::Delay,
//! prelude::*,
//! Peripherals,
//! pac::CorePeripherals,
//! };
//!
//! let cp = CorePeripherals::take().unwrap();
//! let p = ... |
use crate::commands;
use crate::lib;
use crate::lib::settings::SettingsHandler;
use serenity::client::bridge::gateway::ShardManager;
use serenity::framework::standard::*;
use serenity::model::prelude::*;
use serenity::prelude::*;
use std::collections::{HashMap, HashSet};
use std::env;
use std::sync::Arc;
use threadpool... |
use std::collections::HashMap;
//This needs a lot more documentation
// We could potentially use a vector of tuples (K,V) and have a enum marker to show scope beginning
/*
enum Item {
Marker,
Symbol(K, V)
}
struct Scope<K,V>(Vec<Item>)
We may want this because vector search is more cache friendly when there... |
use crate::{channel::Reply, Error, Promise, PromiseResolver, Result};
use amq_protocol::frame::AMQPFrame;
use parking_lot::Mutex;
use pinky_swear::Cancellable;
use std::{
collections::{HashMap, VecDeque},
fmt,
sync::Arc,
};
use tracing::{level_enabled, trace, Level};
pub(crate) struct ExpectedReply(
pu... |
//
//! 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 by appl... |
use self::filter::FilterError;
use crate::pdf::{object::Name, Bytes, Dictionary, Object};
const FILTER: &[u8] = b"Filter";
const FILTER_PARAM: &[u8] = b"DecodeParms";
#[derive(Clone, Debug, PartialEq)]
pub struct Stream {
pub dictionary: Dictionary,
pub data: Bytes,
}
impl Stream {
pub fn filters(&self)... |
use crate::payout_curve::compat::To1DArray;
use crate::payout_curve::compat::ToNAlgebraMatrix;
use crate::payout_curve::Error;
use itertools::Itertools;
use ndarray::prelude::*;
use std::ops::Mul;
/// NOTE:
/// This struct is provided here in this form as nalgebra_sparse
/// is rather embryonic and incluldes (basicall... |
use crate::{hal, Channel, Error, Pca9685, Register};
impl<I2C, E> Pca9685<I2C>
where
I2C: hal::blocking::i2c::Write<Error = E> + hal::blocking::i2c::WriteRead<Error = E>,
{
/// Set double register to specific value not touching `full ON/OFF` flag.
fn set_double_register_without_flag(&mut self, register: u8... |
// Copyright (c) 2021-2021 <NAME> and others
//
// 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,... |
use crate::CompactInt;
use bytes::Buf;
use std::error::Error;
use std::net::SocketAddr;
use std::{fmt, io};
#[derive(Debug)]
pub enum DeserializationError {
Io(io::Error),
Parse(String),
}
impl DeserializationError {
pub fn parse(source: &[u8], into: &str) -> DeserializationError {
DeserializationE... |
use std::collections::HashSet;
use common::{parse::unsigned_number, prelude::*};
use log::debug;
use nom::{
branch::alt,
bytes::complete::tag,
character::complete::multispace0,
combinator::{all_consuming, into, map},
multi::separated_list1,
sequence::{preceded, separated_pair, terminated},
... |
use std::mem::MaybeUninit;
use std::path::{PathBuf};
use std::collections::hash_map::Entry;
use serde::{Deserialize};
use serde_yaml::Value;
use fnv::FnvHashMap;
use crate::riverdb::config::postgres::PostgresCluster;
use crate::riverdb::{Error, Result};
use crate::riverdb::common::MIN_BUFFER_SPACE;
// Things that a... |
#![no_main]
#![no_std]
use embedded_hal::digital::v2::OutputPin;
use sherline_power_feed::app::App;
use sherline_power_feed::{
self as _, // global logger + panicking-behavior + memory layout
app::MotorState,
};
use embedded_graphics::prelude::*;
use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306};
use st... |
use crate::{Config, ErrChannel, Message, MqttError, PubChannel, SubChannel};
use futures::channel::mpsc;
use futures::{SinkExt, StreamExt};
use rumqttc::{
AsyncClient, ConnectionError, Event, EventLoop, Incoming, Outgoing, Packet, StateError,
};
use std::time::Duration;
use tokio::time::sleep;
/// A connection to ... |
extern crate pkg_config;
use std::collections::HashSet;
use std::env;
use std::ffi::OsString;
use std::path::{Path, PathBuf};
use std::process::Command;
fn main() {
let target = env::var("TARGET").unwrap();
let lib_dir = env::var_os("LIBUSB_LIB_DIR").map(PathBuf::from);
let include_dir = env::var_os("LIB... |
use std::{iter::FromIterator, str::FromStr};
use itertools::iproduct;
use crate::{
direction::{Direction, ParseDirectionError},
point::Point,
segment::Segment,
};
#[derive(Debug)]
pub struct Wire {
segments: Vec<Segment>,
steps: Vec<i32>,
}
impl Wire {
pub fn intersections_with<'a>(&'a self,... |
// This file is part of linux-epoll. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri... |
#![macro_use]
use core::marker::PhantomData;
use core::sync::atomic::{compiler_fence, Ordering};
use core::task::Poll;
use embassy::interrupt::InterruptExt;
use embassy::util::Unborrow;
use embassy::waitqueue::AtomicWaker;
use embassy_hal_common::unborrow;
use futures::future::poll_fn;
use crate::interrupt;
use crate... |
use super::utils::ParseError;
use num::integer::Integer;
use regex::Regex;
use std::fmt;
//#[derive(Clone)]
type Coords = (i64, i64, i64);
#[derive(Debug, Clone)]
pub struct Body {
id: usize,
position: Coords,
velocity: Coords,
}
impl fmt::Display for Body {
fn fmt(&self, f: &mut fmt::Formatter) -> f... |
// "ami" crate - Licensed under the MIT LICENSE
// * Copyright (c) 2017-2018 <NAME> <<EMAIL>>
use std::{ collections::BinaryHeap, cmp::Ordering, ptr::NonNull };
/// Id is a reverse order u32 (0 is bigger than 1).
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct Id(pub u32);
impl PartialOrd for Id {
fn part... |
use itertools::Itertools;
use crate::intcode::{Computer, WireInput, WireOutput, wire, CombinedDevice, OutputSpy, InputDevice, OutputDevice};
use async_std::{
task
};
use futures::join;
use std::future::Future;
// generator: see day7.rs
pub fn generator(input: &str) -> Vec<isize> {
crate::day7::generator(input)... |
use crate::paths::binst_bin_dir;
use crate::repo::error::BinRepoError;
use crate::repo::{BinRepo, MAIN_STREAM};
use crate::utils::{clean_path, get_toml_value_as_string, UtilsError};
use clap::ArgMatches;
use semver::Version;
use std::fs::{self, read_to_string};
use std::path::PathBuf;
use thiserror::Error;
use toml::Va... |
use crate::hal::{
self,
drivers::{
pins::{self, Pin},
SpiMaster,
Timer,
},
Enabled,
peripherals::flexcomm::Spi0,
time::RateExtensions,
typestates::{
pin::{
self,
flexcomm::NoPio,
},
},
};
use fm11nc08::{
FM11NC08, Confi... |
/*!
Traits and types related to loading an abi_stable dynamic library,
as well as functions/modules within.
*/
use std::{
fmt::{self, Display},
io,
marker::PhantomData,
mem,
path::{Path,PathBuf},
sync::atomic,
};
#[allow(unused_imports)]
use core_extensions::prelude::*;
use libloading::{
... |
use std::sync::Arc;
use async_std::task::spawn_blocking;
use indy_api_types::{
domain::wallet::{Config, Credentials, ExportConfig, KeyConfig},
errors::prelude::*,
wallet::*,
WalletHandle,
};
use indy_utils::crypto::{
chacha20poly1305_ietf, chacha20poly1305_ietf::Key as MasterKey, randombytes,
};
... |
use aoc_2019_7::{AsyncIntComputer, ChannelReader, ChannelWriter};
use aoc_common::math::Point;
use std::collections::HashMap;
use std::io;
use std::io::{BufRead, BufReader, ErrorKind};
use std::str::FromStr;
use std::sync::mpsc;
use std::sync::mpsc::SendError;
#[derive(Debug, Copy, Clone)]
pub enum Color {
White,
... |
// Copyright 2017 <NAME>
// Refer to LICENSE-MIT and LICENSE-APACHE files
/// This type is not yet implemented. You are encouraged to submit a pull request.
pub type NotImplemented = *const ();
#[derive(Debug, Clone, PartialEq, Eq)]
#[repr(C)] // align 64-bit
pub struct Guid(pub u64, pub u64);
/// Status code return... |
// SPDX-FileCopyrightText: 2021 <NAME> <<EMAIL>>
// SPDX-License-Identifier: MIT
use proc_macro2::TokenStream;
use proc_macro_error::abort;
use quote::quote;
pub fn impl_variant_type(input: syn::DeriveInput) -> TokenStream {
let crate_path = super::crate_path();
let mut repr_attr = None;
let mut index_att... |
//! Escape sequence parser.
//! エスケープ・シーケンス・パーサー。
use crate::model::layer110::token::tokens_stringify;
use crate::model::layer110::{Token, TokenType};
use crate::parser::phase200::error;
use crate::parser::phase200::error_via;
use crate::parser::phase200::layer210::PositionalNumeralStringP;
use crate::parser::phas... |
#![macro_use]
use std::fmt;
use std::string::String;
use std::collections::{HashMap, HashSet};
use std::cell::RefCell;
#[derive(PartialEq,Eq,Clone,Copy,Hash)]
pub struct Name {
id: usize
}
pub struct Spelling {
// No two different variables have this the same. Tomatoes may have been added:
unique: String... |
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
use std::fs::File;
use std::io::Write;
use std::iter::FromIterator;
use std::process::exit;
use std::{env, fs};
#[derive(Serialize, Deserialize, Debug)]
struct CTSReport {
commit_hash: String,
passing: Vec<String>,
failing: Vec<String>,
}
... |
// Copyright (c) 2015, 2016, 2020 <NAME>
//
// 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, pub... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
#![allow(dead_code)]
use anyhow::{format_err, Result};
use async_trait::async_trait;
use coerce_rt::actor::{
context::ActorHandlerContext,
message::{Handler, Message},
Actor,
};
use futures::channel::oneshot;
use libra_lo... |
use chrono::{NaiveDateTime, Utc};
use diesel::{delete, insert_into, prelude::*, update};
use serde::Serialize;
use super::super::super::{orm::postgresql::Connection, Result};
use super::{
schema::{groups, groups_users, roles_groups},
user::{Dao as UserDao, Item as User},
};
#[derive(Queryable, Serialize)]
#[s... |
use std::error::Error;
use argon2;
use rand::{RngCore, SeedableRng};
use rand_chacha::ChaChaRng;
use rocket::data::ToByteUnit;
use rocket::form::{self, DataField, FromFormField, ValueField};
/// An enum for password handling. At creation the given password is validated and immediately
/// afterwards the plain text pas... |
fn calc_level(serial: i64, x: i64, y: i64) -> i64 {
// Find the fuel cell's rack ID, which is its X coordinate plus 10.
let rack_id = x + 10;
// Begin with a power level of the rack ID times the Y coordinate.
let mut level = y * rack_id;
// Increase the power level by the value of the grid serial ... |
use crate::*;
/// Struct used to run a system function using the world.
/// This struct is also used internally by the `Dispatcher` to create a coherent
/// execution sequence.
pub struct System {
pub initialize: Box<dyn Fn(&mut World) + Send>,
pub lock: Box<dyn Fn(*const World, *mut Vec<Box<dyn RefLifetime>>)... |
//! This example implements the PQC KAT KEM tests.
//! It generates `.req` and `.rsp` files which can be compared
//! to the files generated by the C reference implementation.
use rusty_saber::api::{
CRYPTO_ALGNAME, CRYPTO_BYTES, CRYPTO_CIPHERTEXTBYTES, CRYPTO_PUBLICKEYBYTES,
CRYPTO_SECRETKEYBYTES,
};
use rust... |
use crate::{utils, Error, Result};
use regex::Regex;
use std::{borrow::Cow, fs::File, io::prelude::*};
pub(crate) enum Source {
Stdin,
Files(Vec<String>),
}
impl Source {
pub(crate) fn from(file_paths: Vec<String>) -> Self {
if file_paths.len() == 0 {
return Source::Stdin;
}
... |
// This entire file is license key functionality
use crate::{
agent::{
reporter_server::{Reporter, ReporterServer},
ReporterRequest, ReporterResponse,
},
report::Report,
};
use bytes::BytesMut;
use flate2::write::GzEncoder;
use flate2::Compression;
use prost::Message;
use reqwest::Client;
us... |
#[macro_use]
extern crate idmap;
#[macro_use]
extern crate idmap_derive;
#[allow(unused_extern_crates)]
extern crate serde;
extern crate serde_test;
#[macro_use]
extern crate serde_derive;
extern crate itertools;
use itertools::Itertools;
use serde_test::{Token, assert_tokens};
use idmap::IdSet;
use KnownState::*;
#... |
//! $n^2+1$ 型素数の篩。
use std::fmt::Debug;
/// $n^2+1$ 型素数の篩。
///
/// # Idea
/// $n^2+1$ が素因数 $p < n$ を持つとき、以下が成り立つ。
/// $$ n^2+1 \\equiv 0 \\pmod{p}. $$
/// このとき、各 $k$ に対して以下が成り立つ。
///
/// - $(n+kp)^2+1 \\equiv 0 \\pmod{p}$,
/// - $(kp-n)^2+1 \\equiv 0 \\pmod{p}$.
///
/// # References
/// - <https://inamori.hateblo.jp/... |
// Nearly identical to watercolor1, with tweaks to the color palettes.
// Basically a direct implementation of the technique described by <NAME> in his essay:
// https://tylerxhobbs.com/essays/2017/a-generative-approach-to-simulating-watercolor-paints
//
// The major differences between this an watercolor1 are the way ... |
use std::env;
use std::fs;
use std::io::stdin;
use std::process::Command;
use std::str::FromStr;
use linked_hash_map::LinkedHashMap;
use rusoto_core::Region;
use serde::Deserialize;
use crate::credentials::ProfileName;
#[cfg_attr(test, derive(Debug))]
pub struct Config {
pub main_profile: ProfileName,
pub mf... |
extern crate num;
use num::complex::Complex;
use utils::{ALPHA, to_amp};
use std::f32::consts::PI;
pub trait HexColor {
fn to_rgba(self, norm_only: bool) -> u32;
}
impl HexColor for i32 {
fn to_rgba(self, norm_only: bool) -> u32 {
let mut val: i32 = self >> 22;
if val > 0 {
let r... |
use cosmwasm_std::{
log, to_binary, Api, Binary, CanonicalAddr, CosmosMsg, Env, Extern, HandleResponse, HumanAddr,
InitResponse, LogAttribute, Querier, StdError, StdResult, Storage, Uint128, WasmMsg,
};
use cw20::MinterResponse;
use axelar_gateway_contracts::{
hook::InitHook,
token::InitMsg as TokenIn... |
use core::cell::UnsafeCell;
use core::fmt;
use core::mem::MaybeUninit;
use core::sync::atomic::{spin_loop_hint as cpu_relax, AtomicU8, Ordering};
/// A synchronization primitive which can be used to run a one-time global
/// initialization. Unlike its std equivalent, this is generalized so that the
/// closure returns... |
use crate::MAX_DOC_SIZE;
/// MessagePack Format Markers. For internal use only.
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Marker {
PosFixInt(u8),
FixMap(u8),
FixArray(u8),
FixStr(u8),
Null,
Reserved,
False,
True,
Bin8,
Bin16,
Bin24,
Ext8,
Ext16,
Ext24,
... |
use alloc::vec::Vec;
use core::cmp::Ordering;
use utils::{impl_md_flow, uint_from_bytes, Hash};
use crate::{
consts::{
{f1, f2, f3, f4}, {H128, K128_LEFT, K128_RIGHT, R_LEFT, R_RIGHT, S_LEFT, S_RIGHT},
},
{round_left_128, round_right_128},
};
pub struct Ripemd128 {
status: [u32; 4],
}
impl R... |
use xous::{Message, ScalarMessage};
// NOTE: the use of ComState "verbs" as commands is not meant as a 1:1 mapping of commands
// It's just a convenient abuse of already-defined constants. However, it's intended that
// the COM server on the SoC side abstracts much of the EC bus complexity away.
use com_rs_ref as com_... |
/**
* [381] Insert Delete GetRandom O(1) - Duplicates allowed
*
* Implement the RandomizedCollection class:
*
* RandomizedCollection() Initializes the RandomizedCollection object.
* bool insert(int val) Inserts an item val into the multiset if not present. Returns true if the item was not present, false otherw... |
use std::collections::btree_map::Entry::*;
use std::collections::BTreeMap;
///
///
/// Credit: https://github.com/LazyEmpiricist/text_analysis/blob/main/src/lib.rs
///
#[cfg(test)]
mod tests {
use crate::native::text::*;
use std::collections::HashMap;
#[test]
fn test_text_if_english() {
let ... |
// Copyright 2022 <NAME>
// Copyright 2021 <NAME>
// SPDX-License-Identifier: Apache-2.0
use std::time::SystemTime;
use crate::core::{Actor, ActorError, ActorResult, ChannelBuilder, Rt, SupHandle};
use async_trait::async_trait;
use prometheus::{HistogramOpts, HistogramVec, IntCounter, IntCounterVec, Opts};
use rocket... |
// Require use of WinMain entrypoint so cmd doesn't flash open
// See RFC 1665 for additional details
#![windows_subsystem = "windows"]
use std::process::{Command, exit};
use std::env;
use std::ffi::c_void;
use std::io::Error;
use std::path::{PathBuf, Path};
use std::ptr::null_mut;
use windows::{
Win32::{
... |
use scrivx_reader;
use scrivx_reader::Scrivening;
use drive_operations;
use compiler;
use map_operations::*;
use std::fs::File;
use std::io::Read;
use minidom::Element;
enum PushState {
Initial,
Omit,
Name,
Null
}
#[derive(Debug)]
pub struct BodyText {
id: String,
body: String
}
impl BodyTe... |
use crate::ecs::resources::DeltaTime;
use rand::Rng;
use specs::prelude::*;
use crate::ecs::components::*;
use crate::ecs::player::*;
use crate::ecs::weapon::*;
use crate::vec2::Vec2;
#[derive(Clone, Copy)]
enum Direction {
Right,
Down,
Left,
Up,
}
impl Direction {
fn next(&self) -> Direction {
... |
use clap::{App, AppSettings, Arg};
use std::{
path::PathBuf,
process::{Command, Stdio},
};
use path_slash::PathBufExt;
/// Tool to dump commands for
enum DumpType {
/// `ar` on Linux, `lib` on Windows.
Archiver,
/// `ld` on Linux, `link` on Windows.
Linker,
}
/// Linker command line flavor
#[... |
#![cfg_attr(not(feature = "have_std"), no_std)]
#![feature(never_type)]
#[macro_use]
extern crate derive_more;
pub mod device;
pub mod kobj;
pub mod mutex;
pub mod thread;
mod time;
pub use time::*;
/// Convert a negative error code to a Result
trait NegErr {
fn neg_err(&self) -> Result<u32, u32>;
}
impl NegEr... |
// Copyright (c) 2018 10X Genomics, Inc. All rights reserved.
// This file contains code to make reference data.
//
// ◼ Experiment with building a reference from scratch. This would be a better
// ◼ solution than ad hoc editing of a flawed reference.
//
// ◼ Document reference sequence requirements so that a custome... |
#![allow(non_snake_case)]
#![allow(unused_variables)]
use anyhow::Result;
use bytemuck::{Pod, Zeroable};
use std::time::Duration;
use wgpu::util::DeviceExt;
use winit::event::*;
use Alnilam::*;
#[repr(C)]
#[derive(Copy, Clone, Debug, Pod, Zeroable)]
struct TriangleVertex {
position: [f32; 3],
color: [f32; 3],... |
// Copyright 2020 <NAME>
// Copyright 2020 <NAME>
//
// 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, merg... |
// بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
// This file is part of Setheum.
// Copyright (C) 2019-2021 <NAME>.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as publ... |
//! mlinference Interface
mod mlinference;
pub use mlinference::*;
// flag bit 0 LSB: row-major order (0) column major order (1)
pub const TENSOR_FLAG_ROW_MAJOR: u8 = 0;
pub const TENSOR_FLAG_COLUMN_MAJOR: u8 = 1;
// flag bit 1: little-endian (0) or big endian (2)
pub const TENSOR_FLAG_LITTLE_ENDIAN: u8 = 0;
pub cons... |
use super::types::{Mapping, Node};
use super::SourceMapGenerator;
use std::collections::HashMap;
use types::string_slice::*;
use types::{StringWithSourceMap, StringWithSourceMapGenerator};
#[derive(Clone, Debug)]
pub struct SourceNode {
pub children: Vec<Node>,
pub source_contents: HashMap<i32, i32>,
// (l... |
// most of this code is taken wholesale from this:
// https://github.com/rust-lang/rustup/blob/master/src/cli/self_update/windows.rs
use crate::{Installer, InstallerError};
use std::io;
/// Adds the downloaded binary in Installer to a Windows PATH
pub fn add_binary_to_path(installer: &Installer) -> Result<(), Install... |
// Copyright (c) 2018-2022 Ministerio de Fomento
// Instituto de Ciencias de la Construcción Eduardo Torroja (IETcc-CSIC)
// 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 ... |
use reqwest::{Client, Response, StatusCode};
use chrono::{DateTime, Utc};
use serde::Deserialize;
use lazy_static::lazy_static;
use regex::Regex;
use tokio::{self, task::JoinHandle};
lazy_static! {
static ref RE: Regex = Regex::new(r#"page=(\d*)>; rel="last""#).unwrap();
}
#[derive(Deserialize, Debug)]
pub(crat... |
#![feature(async_await, never_type)]
#![deny(private_in_public, unused_extern_crates)]
#[macro_use(async_handler)] extern crate clacks_rpc;
//#[macro_use] extern crate delegate;
#[macro_use] extern crate failure;
#[macro_use] extern crate serde_derive;
#[macro_use] extern crate slog;
use actix::prelude::*;
use future... |
//! Intel PIT support.
use super::pic::io_apic::IOAPIC;
use super::pic::local_apic;
use super::pic::local_apic::LocalAPIC;
use crate::asm::ports;
use crate::interrupts;
use crate::interrupts::{IRQHandler, InterruptHandlerStatus};
use crate::lock::OnceCell;
use crate::task;
use crate::timer::{update_timers, TICKS_PER_S... |
use std::{
collections::HashMap,
error::Error,
sync::{Arc, Mutex},
time::Duration,
};
use chrono::Local;
use garden_rpc::{
garden_pi_server::{GardenPi, GardenPiServer},
set_valve_state_response, GetModeResponse, GetScheduleResponse, GetValveStateRequest,
GetValveStateResponse, GetValveState... |
use anyhow::Result;
use nom::combinator::all_consuming;
use nom::error::ParseError;
use nom::sequence::tuple;
use nom::{
branch::alt,
bytes::complete::{is_not, tag},
character::complete::{char, multispace0, satisfy},
combinator::{recognize, value},
multi::{many0, separated_list0},
sequence::{del... |
use super::reframer::Reframer;
use derive_more::{From, Into};
use std::collections::{HashMap, HashSet};
use std::time::Duration;
use typed_slab::TypedSlab;
use web_sys::Element;
use yew::services::interval::{IntervalService, IntervalTask};
use yew::services::resize::{ResizeService, ResizeTask};
use yew::worker::{Agent,... |
use std::collections::HashMap;
use crate::class::constant_pool::ConstantPoolInfo;
use crate::class::method::MethodInfo;
use crate::class::Class;
use crate::instruction::Instruction;
use crate::operand_stack::{Item, OperandStack};
#[macro_export]
macro_rules! get_constant_pool {
($cp_pool: expr, $index: expr, $exp... |
// (c) 2016-2017 <NAME> <<EMAIL>>
/// Hue persistence for Philips Hue Lights
extern crate philipshue;
extern crate ssdp;
extern crate syslog;
#[macro_use]
extern crate log;
#[macro_use]
extern crate error_chain;
extern crate clap;
extern crate env_logger;
extern crate futures;
extern crate tokio_timer;
use std::env;... |
#[repr(u32)]
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub enum MouseButton {
Left = 0,
Right,
Middle,
Max,
}
// required for ffi layer
unsafe impl cxx::ExternType for MouseButton {
type Id = cxx::type_id!("BWAPI::MouseButton");
type Kind = cxx... |
// 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.
mod frequency;
mod kalman_filter;
use {
crate::{
diagnostics::{Diagnostics, Event},
enums::Track,
time_source::Sample,
},
... |
use crate::avm1::activation::Activation;
use crate::avm1::error::Error;
use crate::avm1::object::TObject;
use crate::avm1::property::Attribute;
use crate::avm1::Object;
use crate::avm1::{ScriptObject, Value};
use crate::context::UpdateContext;
use gc_arena::MutationContext;
pub fn constructor<'gc>(
activation: &mu... |
use std::time::{Duration, Instant};
use super::system_prelude::*;
struct ActiveDash {
dash_time: u64,
dash_direction: Direction,
}
#[derive(Default)]
pub struct PlayerDashSystem {
active_dash: Option<ActiveDash>,
last_action: Option<(Direction, Instant)>,
}
impl<'a> System<'a> for PlayerDashSys... |
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! System service for managing cellular modems
use {
failure::{Error, Fail, ResultExt},
fidl_fuchsia_telephony_manager::{ManagerRequest, ManagerR... |
#![no_std]
extern crate alloc;
use alloc::{collections::BTreeMap, string::String};
use contract::{
contract_api::{account, runtime, storage, system},
unwrap_or_revert::UnwrapOrRevert,
};
use types::{
account::{PublicKey, PurseId},
ApiError, Key, U512,
};
const DONATION_AMOUNT: u64 = 1;
// Different ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.