text stringlengths 8 4.13M |
|---|
use core::ops::{Deref, DerefMut};
use rust_cuda::{rustacuda_core::DeviceCopy, utils::exchange::buffer::CudaExchangeBuffer};
#[derive(rust_cuda::common::RustToCuda, rust_cuda::host::LendToCuda)]
#[allow(clippy::module_name_repetitions)]
pub struct ValueBuffer<T: Clone + DeviceCopy> {
#[r2cEmbed]
buffer: CudaEx... |
#[doc = "Reader of register SPINLOCK2"]
pub type R = crate::R<u32, super::SPINLOCK2>;
impl R {}
|
use dirac::checks::*;
static CHECK_SUITE_YAML: &'static str = r##"
---
- inventory:
all:
- fritz.box
- esel.fritz.box
fritz_box:
- fritz.box
esel:
- esel.fritz.box
- hosts: all
properties:
- name: Check SSH
ssh: { port: 22, version: 2.0, software: "OpenSSH.*" }
- hos... |
#[derive(Clone, Debug)]
pub struct PluginMap {}
impl PluginMap {
pub fn new() -> Self {
Self {}
}
}
|
use components::*;
use eos::*;
use prelude::*;
use scatter::*;
use stdweb::traits::IEvent;
pub struct DonationForm {
amount: f32,
submitting: bool,
context: Context,
scatter_agent: Box<Bridge<ScatterAgent>>,
scatter_connected: Option<Result<(), ScatterError>>,
scatter_identity: Option<Result<Sc... |
//! This module contains the following indicators :
//! - RSI (Relative Strenght Index)
pub mod rsi;
|
#![feature(test)]
extern crate byte;
extern crate byteorder;
extern crate test;
use byte::ctx::*;
use byte::*;
use byteorder::*;
use test::black_box;
#[bench]
fn bench_byteorder(b: &mut test::Bencher) {
b.iter(|| black_box(LittleEndian::read_u16(&black_box([1, 2]))));
b.bytes = 2;
}
#[bench]
fn bench_read_n... |
use super::*;
use crate::process::PId;
use crate::{
arch::{self},
process::process::PROCESSES,
};
use alloc::sync::Arc;
use core::mem::{self};
/// Yields execution to another thread.
pub fn switch() {
let prev = current_process().clone();
let prev_pid = prev.pid();
let prev_state = prev.state();
... |
// read the data file
// split the string to gather password policy
// check if we have the character within the bounds
// if we do, add to a sum
// else continue
use std::fs;
fn main() -> std::io::Result<()> {
let file = fs::read_to_string("data.txt")?;
let mut valid_passwords = 0;
for line in file.line... |
use std::io::{Stdout, Write};
use termion::cursor::Goto;
use termion::raw::RawTerminal;
use termion::{color, style};
use crate::{
models::{Attack, AttackResult, Coordinates},
views::utils::translate_game_coords_to_board_coords,
};
pub struct AttackView {
origin: Coordinates,
model: Attack,
}
impl Att... |
use std::net::{Ipv4Addr, Ipv6Addr};
use regex::Regex;
use serde_json::Value;
use chrono::prelude::*;
use url::Url;
use util::{JsonType, JsonValueExt};
use schema::{Context, Schema, SchemaBase};
use errors::{ErrorKind, ValidationError};
#[allow(unused)]
mod regex_serde {
use serde::{self, Deserialize, Deserialize... |
fn main() {
cc::Build::new()
.file("src/drat-trim.c")
.opt_level(2)
.compile("drat-trim");
}
|
use std::io::{Error, ErrorKind};
use std::str;
use std::str::FromStr;
use tokio::io::Interest;
use tokio::net::{UnixListener, UnixStream};
use tokio::sync::{mpsc, mpsc::Receiver};
use tokio::task;
use crate::api::{Downloads, NxmUrl};
use crate::Messages;
// Listens for downloads to add
struct NxmListener {
listen... |
//! Top-level example.
/*
extern crate bitintr;
use bitintr::x86::bmi2::*;
fn main() {
// Intrinsics can be used as methods:
let method_call = 1.pdep(0);
// And as free function calls:
let free_call = pdep(1, 0);
assert_eq!(method_call, free_call);
}
*/
fn main() {}
|
use std::fmt;
use std::option::Option;
use std::iter::Sum;
use std::ops::{Add, Mul};
pub trait ComputeNorm {
fn compute_norm(&self) -> u64;
}
#[derive(Debug)]
pub struct LinkedList<T> {
head: Option<Box<Node<T>>>,
size: usize,
}
#[derive(Debug, Clone, PartialEq)]
struct Node<T> {
value: T,
next:... |
use secstr::SecUtf8;
use crate::Store;
use anyhow::{anyhow, Result};
use secret_service::{EncryptionType, SecretService};
#[derive(Debug)]
pub struct KeychainStore;
impl KeychainStore {
pub async fn new() -> Result<Self> {
Ok(Self)
}
}
impl Store for KeychainStore {
fn put(
&self,
namespace: impl ... |
#![feature(vec_into_raw_parts)]
#[macro_use]
extern crate whack;
extern crate libc;
extern crate byteorder;
#[macro_use] extern crate log;
extern crate fern;
extern crate chrono;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate quick_error;
extern crate bincode;
extern crate flate2;
extern crate serde... |
extern crate rshellitems;
extern crate serde_json;
extern crate env_logger;
use std::io::Cursor;
use rshellitems::shellitem::{ShellItem};
fn example_0x1f_001(){
let buffer: &[u8] = &[
0x14,0x00,0x1F,0x48,0xBA,0x8F,0x0D,0x45,0x25,0xAD,0xD0,0x11,0x98,0xA8,0x08,0x00,
0x36,0x1B,0x11,0x03
];
ma... |
use specs::Join;
pub struct ReducerSystem;
impl<'a> ::specs::System<'a> for ReducerSystem {
type SystemData = (
::specs::WriteStorage<'a, ::component::Reducer>,
::specs::Fetch<'a, ::resource::UpdateTime>,
::specs::Entities<'a>,
);
fn run(&mut self, (mut reducers, update_time, enti... |
extern crate hidapi;
use std::thread;
mod seneye_reader;
fn main() {
let api = hidapi::HidApi::new().unwrap();
let seneye_controller = seneye_reader::SeneyeController::new(&api).unwrap();
// start a timer loop to get periodic updates from the device
loop {
// let res = device.read(&mut read... |
use crate::headers::from_headers::*;
use crate::resources::Attachment;
use crate::ResourceQuota;
use azure_core::headers::{
continuation_token_from_headers_optional, item_count_from_headers, session_token_from_headers,
};
use azure_core::SessionToken;
use chrono::{DateTime, Utc};
use http::response::Response;
#[de... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use crate::models::*;
use reqwest::StatusCode;
use snafu::{ResultExt, Snafu};
pub mod operations {
use crate::models::*;
use reqwest::StatusCode;
use snafu::{ResultExt, Snafu};
pub async f... |
#[doc = "Register `RCC_APB5RSTCLRR` reader"]
pub type R = crate::R<RCC_APB5RSTCLRR_SPEC>;
#[doc = "Register `RCC_APB5RSTCLRR` writer"]
pub type W = crate::W<RCC_APB5RSTCLRR_SPEC>;
#[doc = "Field `SPI6RST` reader - SPI6RST"]
pub type SPI6RST_R = crate::BitReader;
#[doc = "Field `SPI6RST` writer - SPI6RST"]
pub type SPI6... |
//! Various utility functions.
use std::{
collections::HashMap,
path::{Path, PathBuf},
};
use color_eyre::owo_colors::OwoColorize;
use color_eyre::Result;
use log::Level;
use punktf_lib::visit::deploy::deployment::{Deployment, DeploymentStatus, ItemStatus};
/// Retrieves the target path for the deployment by readi... |
use core::fmt;
use std::{fmt::Debug, path::PathBuf};
#[derive(Debug)]
pub enum ProcessingError {
Glob(globset::Error),
InvalidDirectoryName(PathBuf),
IO(std::io::Error),
Json(serde_json::Error),
}
impl From<globset::Error> for ProcessingError {
fn from(e: globset::Error) -> Self {
Processi... |
use matasano_crypto_challenges::bitwise::base64;
use matasano_crypto_challenges::bitwise::hex_rep::ToHexRep;
use matasano_crypto_challenges::set1::challenge1::CHALLENGE1;
use matasano_crypto_challenges::set1::challenge2::CHALLENGE2;
use matasano_crypto_challenges::set1::challenge3::CHALLENGE3;
use matasano_crypto_chall... |
fn main() {
cc::Build::new()
// 设置c文件
.file("src/hello.c")
// 设置宏
// .define("APP_NAME", "\"foo\"")
// .define("VERSION", format!("\"{}\"", env!("CARGO_PKG_VERSION")).as_str())
// .define("WELCOME", None)
// 设置输出文件
.compile("hello"); // 输出 `libhello.a`... |
pub mod module {
use std::io::Write;
use std::fs::File;
use crate::types::module::*;
pub fn write_ppm(img: &Image, path: &str) -> std::io::Result<()> {
let num_rows = img.len();
let num_cols = img[0].len();
let mut file = File::create(path)?;
file.write(b"P3\n")?;
file.write(format!("{} {}\n", ... |
use syn;
use syn::Token;
use syn::parse::{Parse, ParseStream};
use syn::parse::Result as ParseResult;
use syn::spanned::Spanned;
use quote::ToTokens;
use proc_macro2::{self, TokenStream, TokenTree, Delimiter};
use std;
#[derive(Debug, Clone)]
pub struct BindingDep {
pub inst_name: Option<syn::Ident>,
pub prop_path: ... |
use crate::utils::file2vec;
pub fn day20(filename: &String){
let contents = file2vec::<String>(filename);
let contents:Vec<String> = contents.iter().map(|x| x.to_owned().unwrap()).collect();
let mut tiles = Vec::new();
let mut tile:Vec<Vec<char>> = Vec::new();
let mut id = String::from("");
fo... |
use super::name::*;
use super::*;
use std::collections::HashMap;
use std::fmt;
use util::Error;
// A question is a DNS query.
#[derive(Default, Debug, PartialEq, Clone)]
pub struct Question {
pub name: Name,
pub typ: DnsType,
pub class: DnsClass,
}
impl fmt::Display for Question {
fn fmt(&self, f: &... |
// Methods, Implementation, static methods
struct Point {
x: f64,
y: f64,
}
//Implementation of Point
impl Point {
//Two static methods to create a new Point instance
fn origin() -> Point {
Point { x: 0.0, y: 0.0 }
}
//Another static method to create apoint from two args
fn... |
use core::future::Future;
pub trait Delay {
type DelayFuture<'a>: Future<Output = ()> + 'a;
/// Future that completes after now + millis
fn delay_ms<'a>(&'a mut self, millis: u64) -> Self::DelayFuture<'a>;
/// Future that completes after now + micros
fn delay_us<'a>(&'a mut self, micros: u64) -> ... |
use fnum::Fnum;
pub struct FnumBuf<T: Fnum> {
vec: Vec<u8>,
t: std::marker::PhantomData<T>,
}
impl<T: Fnum> FnumBuf<T> {
pub fn new() -> Self {
FnumBuf {
vec: Vec::new(),
t: Default::default(),
}
}
pub fn push(&mut self, e: T) {
let size = T::size_o... |
use anyhow::{bail, Result};
use crate::fzf;
use crate::kubeconfig::Installed;
use crate::kubectl;
pub mod context;
pub mod delete;
pub mod edit;
pub mod exec;
pub mod info;
pub mod lint;
pub mod meta;
pub mod namespace;
pub mod update;
pub enum SelectResult {
Cancelled,
Listed,
Selected(String),
}
pub f... |
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// 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>,... |
use diesel::backend::Backend;
use diesel::deserialize::{self, FromSql};
use diesel::serialize::{self, Output, ToSql};
use diesel::sql_types::*;
use serde::{Deserialize, Serialize};
use std::io;
use chain_core::tx::data::Tx;
use crate::schema::orders;
#[derive(Debug, Serialize, Deserialize, Queryable, Insertable)]
#[... |
use std::rc::Rc;
use byteorder::{LittleEndian, WriteBytesExt};
use failure::Error;
use crate::{
chunks::TOKEN_XML_END_NAMESPACE,
model::{
owned::OwnedBuf,
{NamespaceEnd, StringTable},
},
};
#[derive(Debug, Copy, Clone)]
pub struct XmlNamespaceEndBuf {
line: u32,
prefix_index: u32,... |
use std::ops::{Mul, MulAssign, Div, DivAssign};
use alga::general::{ClosedAdd, ClosedSub};
use core::Scalar;
use core::dimension::{DimName, U1};
use core::constraint::{ShapeConstraint, SameNumberOfRows, SameNumberOfColumns};
use core::storage::{OwnedStorage, Storage};
use core::allocator::{OwnedAllocator, SameShapeAl... |
struct S {
i: i32,
b: bool
}
fn print_bool(b: bool) {
if b { print!("true") } else { print!("false") }
}
fn print_int(x: i32) {
if x < 0 { print!("-") }
else if x > 0 { print!("+") }
else { print!("0") }
}
fn print_s(s: &S) {
print!("[ ");
print_int(s.i);
print!(", ");
print_bo... |
use inkwell::builder::Builder;
use inkwell::context::Context;
use inkwell::module::Module;
use std::path;
use crate::emitter::environment::Environment;
use crate::parser::node::Node;
pub struct Emitter {
pub context: Context,
pub builder: Builder,
pub module: Module,
pub environment: Environment,
}
i... |
use sdl2::event::{Event, WindowEvent};
use sdl2::keyboard::Keycode;
use sdl2::pixels::Color;
use sdl2::rect::Rect;
use std::net::SocketAddr;
use std::slice::Iter;
use std::sync::atomic::Ordering;
use std::time::{SystemTime, UNIX_EPOCH};
use crate::ai::DumbAI;
use crate::brick::CELL_SIZE;
use crate::grid::Grid;
use cr... |
use aoc2019::intcpu;
fn main() -> Result<(), std::io::Error> {
let orig_mem: Vec<u32> = intcpu::read_intcode("inputs/02.txt");
for a in 0 .. 99 {
for b in 0 .. 99 {
let mut mem = orig_mem.clone();
mem[1] = a;
mem[2] = b;
intcpu::execute_to_end(&mut mem);
... |
// use std::net::{SocketAddr, ToSocketAddrs, TcpStream};
// use std::thread;
use std::collections::HashMap;
use std::net::SocketAddr;
use std::time::Instant;
use netcanv_protocol::client as cl;
use netcanv_protocol::matchmaker as mm;
use skulpin::skia_safe::{Color, Color4f, Point};
use crate::net::socket::Remote;
us... |
use std::cmp::PartialEq;
use std::{fmt,fmt::Display};
use std::hash::{Hash,Hasher};
#[derive(Clone,Debug,Default,Eq)]
pub struct FileInfo {
pub ftype: FileType,
pub path: String,
pub md5: Option<String>,
pub mtime: Option<u64>,
pub executable: bool,
pub full_hash: bool
}
impl Display for FileI... |
use std::collections::VecDeque;
use std::fmt::Debug;
#[derive(Debug)]
pub struct BoundedSet<T: Debug + Clone> {
data: VecDeque<T>,
max: usize,
}
impl<T> BoundedSet<T>
where
T: Debug + Clone + PartialEq,
{
pub fn new(max: usize) -> Self {
Self {
data: VecDeque::with_capacity(max),
... |
/*!
```rudra-poc
[target]
crate = "v9"
version = "0.1.41"
[report]
issue_url = "https://github.com/purpleposeidon/v9/issues/1"
issue_date = 2020-12-18
rustsec_url = "https://github.com/RustSec/advisory-db/pull/707"
rustsec_id = "RUSTSEC-2020-0127"
[[bugs]]
analyzer = "SendSyncVariance"
bug_class = "SendSyncVariance"
... |
use super::{load_file, Compiler, GenericError};
// for now, we can emulate a standard library
// by just loading a lib file before executing the file in question.
pub const LIB_FILE: &'static str = "lib.ds";
// load the standard library
// pub fn load_stdlib(vm: &mut VM) -> Result<(), DispError> {
// exec_file(vm... |
#![allow(dead_code)]
use std::env;
use std::path::Path;
use std::fs::{File};
use std::io::Read;
mod lib;
// Find a file {{f}} in directory {{d}} and print it's contents:
// cargo run {{d}} {{f}}
fn main() {
let args: Vec<String> = env::args().collect();
match lib::find(Path::new(&args[1]), &args[2], &|d| {
... |
//!
//! # Actions Template
//!
//! Template to enable chaining actions in a list.
//! Operations supported:
//! * push, count compare, traverse(iter.)
//!
use std::collections::vec_deque::Iter;
use std::collections::vec_deque::IntoIter;
use std::collections::VecDeque;
/// queue of Action
#[derive(Debug,Clone)]
pub st... |
mod color_config;
mod nu_style;
mod shape_color;
pub use color_config::*;
pub use nu_style::*;
pub use shape_color::*;
|
/* 泛型
*
* 泛型使用一个标记(T, U...)代指某种类型
*
* 初始化泛型变量的时候指定类型;
*
* 之后的修改要和初始化类型相一致.
*/
#[derive(Debug, PartialEq)]
struct Point<T, U> {
x: T,
y: U,
}
fn main() {
let integer = Point { x: 5, y: 10 };
assert_eq!(integer, Point { x: 5, y: 10 });
// 后面(mut) integer.x只能指定成i32类型, 其他类型
// 导致编译报错
l... |
use std::rc::Rc;
use std::hash::Hash;
use std::mem;
use std::collections::{HashMap, hash_map::Entry};
use super::environment::{AtomID, Type};
use super::{LocalContext, ElabError, Result, Environment,
SortID, TermID, ThmID, ExprNode, ProofNode, DeclKey};
use super::lisp::{LispVal, LispKind, Uncons, InferTarget, print:... |
// Copyright (c) 2017 Anatoly Ikorsky
//
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. All files in the project carrying such notice may not be copied,
// m... |
//! 第四章:Rust 异步 Web 框架实战
//!
//! 本章至下而上的方式来带领大家理解异步编程:
//!
//! 1. 异步 Web 框架比较
//! 2. 自制异步 Web 框架设计
//! 3. 实现 自制 Web 框架
pub mod s1_frameworkers;
|
use skyscraper::html::{DocumentNode, HtmlNode};
use skyscraper::{html, xpath};
static HTML: &'static str = include_str!("samples/James-LG_Skyscraper.html");
#[test]
fn xpath_github_sample1() {
// arrange
let text: String = HTML.parse().unwrap();
let document = html::parse(&text).unwrap();
let xpath =... |
use hyper::header::Cookie;
use serde_json;
use std::fs::File;
use std::io::Read;
const COOKIE_FILE: &str = "cookies.json";
error_chain!{
foreign_links {
Io(::std::io::Error);
Json(serde_json::Error);
}
}
pub fn get_cookies() -> Result<Cookie> {
|| -> Result<_> {
let mut file = Fil... |
use std::env;
use std::process;
use std::fs;
mod days;
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() < 3 {
println!("Missing required argument: please call with number of day to run & part 1 or 2");
process::exit(1)
}
let num_day: usize = args[1].clone().parse... |
// Copyright 2020 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
#![allow(dead_code)]
use wasmlib::*;
pub const SC_NAME: &str = "fairroulette";
pub const SC_HNAME: ScHname = ScHname(0xdf79d138);
pub const PARAM_NUMBER: &str = "number";
pub const PARAM_PLAY_PERIOD: &str = "playPeriod";
pub const VAR_BETS: &st... |
/// Bound checking
pub fn boundsAdds(a: i64, b: i64, c: i64, d: i64) -> (i64, i64) {
let mut s = a + c;
let mut t = b + d;
let u = a & c & !s & !(b & d & !t);
let v = ((a ^ c) | !(a ^ s)) & (!b & !d & t);
if (u | v) < 0 {
s = 0x80000000;
t = 0x7FFFFFFF;
}
(s, t)
}
#[cfg_attr... |
use core::cell::UnsafeCell;
use core::mem;
use core::mem::MaybeUninit;
use crate::util::*;
/// Utility to call a closure across tasks.
pub struct Portal<T> {
state: UnsafeCell<State<T>>,
}
enum State<T> {
None,
Running,
Waiting(*mut dyn FnMut(T)),
}
impl<T> Portal<T> {
pub const fn new() -> Self... |
/*!
```rudra-poc
[target]
crate = "ordnung"
version = "0.0.1"
[report]
issue_url = "https://github.com/maciejhirsz/ordnung/issues/8"
issue_date = 2020-09-03
rustsec_url = "https://github.com/RustSec/advisory-db/pull/374"
rustsec_id = "RUSTSEC-2020-0038"
[[bugs]]
analyzer = "Manual"
guide = "UnsafeDestructor"
bug_clas... |
//! Contains methods for interacting with the pointer
//! and keyboard of wlc.
use super::types::{KeyMod, Point};
#[link(name = "wlc")]
extern "C" {
//fn wlc_keyboard_get_current_keys(out_memb: *const size_t) -> *const u32;
fn wlc_keyboard_get_keysym_for_key(key: u32, modifiers: &KeyMod) -> u32;
fn wlc_... |
use std::io::Error as IOError;
use failure::Fail;
/// An error type for errors while generating config struct modules.
///
/// Errors can either occur during IO (when reading or creating files) or during
/// the generation itself.
#[derive(Debug, Fail)]
pub enum Error {
#[fail(display = "Generation error: {}", _0... |
use super::responses::BroadcastTransactionsResponse;
use crate::utils::input_validator;
use crate::Result;
use reqwest::Client;
/// Broadcast a list of transactions to all neighbors.
/// The input trytes for this call are provided by attachToTangle.
pub async fn broadcast_transactions(
client: Client,
uri: Str... |
use super::*;
use crate::objects::{Metadata, Object};
#[derive(Clone)]
pub struct ResumableSession(pub http::Uri);
impl From<ResumableSession> for http::Uri {
fn from(rs: ResumableSession) -> Self {
rs.0
}
}
/// The response from an [`Object::init_resumable_insert`] request is the
/// `session_uri`.
... |
fn main() {
println!("Welcome to ownership!");
}
|
#![allow(dead_code)]
#![allow(unused_variables)]
/* 返回trait类型对象
*
* RUST规定函数的返回值需要明确知道空间大小.
*/
trait Trait {}
// 断言trait对象(i32), 不需要实现任何方法
impl Trait for i32 {}
// get_trait_object() 返回一个box trait类型
//
// 返回的trait类型必须加上`dyn`前缀. 否则爆出编译警告:
//
// trait objects without an explicit `dyn` are deprecated
fn get_trait_o... |
use self::super::Size;
/// Gets the current terminal size
pub fn get() -> Option<Size> {
use winapi::um::{
handleapi::INVALID_HANDLE_VALUE, processenv::GetStdHandle,
winbase::STD_OUTPUT_HANDLE, wincon::GetConsoleScreenBufferInfo,
};
let handle = unsafe { GetStdHandle(STD_OUTPUT_HANDLE) };
... |
#[doc = "Register `CCR` reader"]
pub type R = crate::R<CCR_SPEC>;
#[doc = "Register `CCR` writer"]
pub type W = crate::W<CCR_SPEC>;
#[doc = "Field `PRESC` reader - ADC prescaler Set and cleared by software to select the frequency of the clock to the ADC. Other: Reserved Note: Software is allowed to write these bits onl... |
#[doc = "Register `CIFR` reader"]
pub type R = crate::R<CIFR_SPEC>;
#[doc = "Field `LSIRDYF` reader - LSI ready interrupt flag"]
pub type LSIRDYF_R = crate::BitReader<LSIRDYFR_A>;
#[doc = "LSI ready interrupt flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LSIRDYFR_A {
#[doc = "0: ... |
const SUBKEY_GEN_ROUNDS: usize = 3;
/// # Description
/// Takes an unsigned 64-bit key block, performs operations on it, and uses an integer to pick out 8 bits to be used for subkey generation
///
/// # Arguments
/// * `x` - A pointer-sized integer. This value is determined by the round number and key number and... |
use stremio_core::types::addons::{ResourceRef, ManifestResource, ParseResourceErr, ResourceResponse, Manifest};
use stremio_core::addon_transport::AddonInterface;
use stremio_core::state_types::EnvFuture;
use futures::{future, Future};
use std::error::Error;
use std::str::FromStr;
use std::sync::Arc;
type Handler = dy... |
use std::path::Path;
use std::path::PathBuf;
use std::fs;
use std::io::{self, BufRead, Write};
use std::collections::HashMap;
#[derive(Default)]
struct M {
outbase: PathBuf,
includes: Vec<String>,
visited: HashMap<PathBuf, PathBuf>,
}
pub fn mergecc(includes: &Vec<String>, outbase: &P... |
use world::World;
use world::designer;
use tile;
use std::path::Path;
#[test]
fn empty_creation(){
let width = 4;
let height = 12;
let test_world = World::new(width,height).unwrap();
assert!(test_world.height() == height, "The Height of the world is not set correctly\n\texpected: {}\n\tactual: {}\n", height, test_w... |
extern crate flame;
use std::fs::File;
use std::{thread,time};
fn a() {
flame::start("fn a");
let t = time::Duration::from_millis(1000);
thread::sleep(t);
b();
b();
b();
flame::end("fn a");
}
fn b() {
flame::start("fn b");
let t = time::Duration::from_millis(1000);
thread::sleep(t);
... |
use crate::{BlockId, BlockKind};
impl BlockId {
#[doc = "Determines whether or not a block has the `age_0_15` property."]
pub fn has_age_0_15(self) -> bool {
match self.kind() {
BlockKind::Fire | BlockKind::Cactus | BlockKind::SugarCane => true,
_ => false,
}
}
#[... |
use anyhow::Result;
use clap::ArgMatches;
use colored::*;
use crate::cli::cfg::get_cfg;
use crate::cli::settings::Settings;
use crate::cli::terminal::message::{bad_info, good_info};
pub const DEFAULT_SHOW_FORMAT: &'static str = "[{setup}:{env}]";
fn cfg() -> Result<Settings> {
let mut cfg = get_cfg()?;
cfg.s... |
pub mod root;
pub mod stems;
pub mod leaves; |
use std::convert::TryInto;
use std::str::FromStr;
use crate::errors::Error;
#[derive(Debug, Clone, Copy)]
pub struct RGB {
pub vals: [u8; 3],
}
impl RGB {
pub fn r(&self) -> u8 {
self.vals[0]
}
pub fn g(&self) -> u8 {
self.vals[1]
}
pub fn b(&self) -> u8 {
self.vals[2]... |
use cudd::*;
use libc::{c_int, c_void};
use std::ptr::null_mut;
static mut CALLED: bool = false;
extern "C" fn termination_handler(_data: *const c_void) -> c_int {
unsafe {
CALLED = true;
}
0
}
#[test]
pub fn basic_functionality_test() {
unsafe {
let cudd = Cudd_Init(0, 0, CUDD_UNIQUE... |
mod component;
mod current_installation;
pub mod hub;
mod installation;
pub mod urls;
mod version;
mod localization;
pub mod project;
pub mod v2 {
pub use super::version::manifest::v2::Manifest;
}
use core::iter::FromIterator;
pub use self::component::Component;
pub use self::component::Category;
pub use self::loc... |
//! Instruction visiting.
//!
//! # Operands
//! nnn - A 12-bit value, the lowest 12 bits of the instruction
//! n - A 4-bit value, the lowest 4 bits of the instruction
//! x - A 4-bit value, the lower 4 bits of the high byte of the instruction
//! y - A 4-bit value, the upper 4 bits of the low byte of the instruction
... |
#![deny(missing_docs)]
//!
//! Allows users to listen to events emitted by libunftp.
//!
//! To listen for changes in data implement the [`DataListener`](crate::notification::DataListener)
//! trait and use the [`Server::notify_data`](crate::Server::notify_data) method
//! to make libunftp notify it.
//!
//! To listen ... |
#[doc = r"Register block"]
#[repr(C)]
pub struct TX {
#[doc = "0x00 - TX mailbox identifier register"]
pub tir: TIR,
#[doc = "0x04 - mailbox data length control and time stamp register"]
pub tdtr: TDTR,
#[doc = "0x08 - mailbox data low register"]
pub tdlr: TDLR,
#[doc = "0x0c - mailbox data ... |
pub mod scene;
pub mod types;
pub mod spawns;
pub mod example;
pub use crate::scene::*;
pub use crate::types::*;
pub struct Ecs<E: Entity> {
scene: Scene<E>,
systems: Vec<Box::<dyn System<E>>>,
}
impl<E: Entity> Ecs<E> {
pub fn update(&mut self) {
for sys in &mut self.systems {
fo... |
#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::OUTCFG1 {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w m... |
use crate::geometry::*;
use crate::shell::layer::{LayerSurface, LayerSurfaceEventManager};
use crate::shell::xdg::{XdgSurface, XdgSurfaceEventManager};
use crate::shell::xwayland::{XwaylandSurface, XwaylandSurfaceEventManager};
use std::pin::Pin;
use wlroots_sys::*;
#[derive(Debug, PartialEq, Eq)]
pub enum Surface {
... |
use crate::util::side_metadata::*;
use crate::util::ObjectReference;
use crate::vm::ObjectModel;
use crate::vm::VMBinding;
use std::sync::atomic::{AtomicU8, Ordering};
use super::constants;
const SIDE_GC_BYTE_SPEC: SideMetadataSpec = SideMetadataSpec {
scope: SideMetadataScope::Global,
offset: 0,
log_num_... |
use std::fmt;
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct EdgePiece {
pub color : Color,
pub face_orientation : FaceOrientation,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Edge {
pub side1 : EdgePiece,
pub side2 : EdgePiece,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Color... |
#[macro_export]
macro_rules! inject {
($comp:path: $($profile:path),*) => {
{
$(
if profile_name::<$profile>().eq(&inexor_rgf_core_di::APP_PROFILE.as_str()) {
inexor_rgf_core_di::Provider::<$comp>::create(&mut inexor_rgf_core_di::Container::<$profile>::new())
... |
pub trait Databus {
fn read(&self, address: u16) -> u8;
fn read_u16(&self, address: u16) -> u16;
fn write(&mut self, address: u16, data: u8);
} |
use std::borrow::Cow;
use std::fs::{self, create_dir_all};
use std::io::{self, Write};
use std::path::{Path, PathBuf};
use serde::Serialize;
use typed_builder::TypedBuilder;
use url::Url;
use pahkat_types::{
repo::{Agent, Index, RepoUrl, RepoUrlError, RepositoryData},
LangTagMap,
};
#[non_exhaustive]
#[deriv... |
/*
* YNAB API Endpoints
*
* Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
*
* The ve... |
use chrono::Duration;
use rego_domain::{
access_token::{AccessToken, AccessTokenBody},
cred::Cred,
};
use uuid::Uuid;
pub struct Admin {
pub id: AdminId,
pub email: String,
pub cred: Cred,
}
#[derive(Serialize, Deserialize, Clone, Copy)]
pub struct AdminId(pub Uuid);
#[derive(Error, Debug)]
pub e... |
#[doc = "Register `DDRCTRL_CRCPARSTAT` reader"]
pub type R = crate::R<DDRCTRL_CRCPARSTAT_SPEC>;
#[doc = "Field `DFI_ALERT_ERR_CNT` reader - DFI_ALERT_ERR_CNT"]
pub type DFI_ALERT_ERR_CNT_R = crate::FieldReader<u16>;
#[doc = "Field `DFI_ALERT_ERR_INT` reader - DFI_ALERT_ERR_INT"]
pub type DFI_ALERT_ERR_INT_R = crate::Bi... |
//! Docker
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate serde_json;
// declare modules
pub mod container;
mod docker;
pub mod event;
pub mod filesystem;
pub mod image;
pub mod network;
pub mod process;
pub mod stats;
pub mod system;
mod test;
pub mod version;
// publicly re-export
pub use... |
struct Burger {
patty_count: i32,
vegetarian: bool,
cheese: bool,
bacon: bool,
salad: bool
}
impl Burger {
fn print(&self) {
let pretty_patties =
match self.patty_count {
1 => "patty",
_ => "patties"
};
let pretty_bool = |... |
#[doc = "Reader of register CH2_DBG_TCR"]
pub type R = crate::R<u32, super::CH2_DBG_TCR>;
impl R {}
|
/// A value bounded by a minimum and a maximum
///
/// If input is less than min then this returns min.
/// If input is greater than max then this returns max.
/// Otherwise this returns input.
///
/// **Panics** in debug mode if `!(min <= max)`.
///
/// Original implementation from num-traits licensed as MIT
pub fn... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.