text stringlengths 8 4.13M |
|---|
#![allow(clippy::type_complexity)]
use crate::resources::globals::Globals;
use oxygengine::prelude::*;
pub struct CameraControlSystem;
impl<'s> System<'s> for CameraControlSystem {
type SystemData = (
ReadExpect<'s, WebCompositeRenderer>,
Read<'s, Globals>,
ReadStorage<'s, CompositeCamera... |
use jservice_rs::{model::Clue, JServiceRequester};
use serenity::collector::message_collector::MessageCollectorBuilder;
use serenity::framework::standard::{macros::command, Args, CommandResult};
use serenity::model::prelude::*;
use serenity::prelude::*;
use std::time::Duration;
use tokio::stream::StreamExt;
use crate:... |
use std::{cmp, fmt, hash, panic};
use std::ops::{Deref, DerefMut};
use std::sync::atomic::{AtomicBool, Ordering};
#[cfg(not(test))]
use std::process;
#[cfg(not(test))]
fn abort_on_panic<F: FnOnce() -> R, R>(f: F) -> R {
panic::catch_unwind(panic::AssertUnwindSafe(f))
.unwrap_or_else(|_| process::abort())
}... |
#[macro_use]
extern crate log;
extern crate url;
extern crate bufstream;
extern crate capnp;
mod yak_capnp;
use std::net::{TcpStream,ToSocketAddrs};
use bufstream::BufStream;
use std::io::{self,BufRead,Write};
use std::fmt;
use std::error::Error;
use std::sync::atomic::{AtomicUsize, Ordering};
use capnp::serialize_pa... |
//! Meshes and Materials
use bevy::prelude::*;
/// Meshes and Materials
pub struct Data {
pub cube_mesh: Handle<Mesh>,
pub cube_material: Handle<StandardMaterial>,
}
|
/// Indentation-aware printing.
mod error;
mod newline;
#[macro_use] mod styles;
mod stringify;
pub use crate::styles::{Style, Styles};
pub use crate::newline::Newline;
use std::collections::{HashMap};
use std::hash::Hash;
pub trait Stringify {
/// Stringify a datum. To achieve this, there are a number of
/... |
/*
chapter 4
syntax and semantics
ending iteration early
*/
fn main() {
for n in 0..10 {
if n % 2 == 0 { continue; }
println!("{}", n);
}
}
// output should be:
/*
1
3
5
7
9
*/
|
//Started script log at Wed 10 Jul 2013 15:10:43 CEST
addBody(86, '{"awake":true,"type":"dynamic"}');
getBody(86).setPosition(0,0);
getBody(86).setPosition(0,0);getBody(86).delete();
|
use failure::ResultExt;
use crate::{
link::{nlas::LinkNla, LinkBuffer, LinkHeader},
traits::{Emitable, Parseable, ParseableParametrized},
DecodeError,
};
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct LinkMessage {
pub header: LinkHeader,
pub nlas: Vec<LinkNla>,
}
impl Default for LinkMessage ... |
mod helpers;
use jsonprima;
// Empty document.
test!(test_0, "", vec![("E100", 0, 1)]);
// Start with plus sign (+).
test!(test_1, "+1", vec![("E106", 0, 1)]);
// Positive Infinity.
test!(test_2, "Infinity", vec![("E106", 0, 1)]);
// Negative Infinity.
test!(test_3, "-Infinity", vec![("E110", 0, 2)]);
// Positive... |
fn main() {
proconio::input! {
n: String
}
let cs: Vec<char> = n.chars().rev().collect();
// println!("{:?}", cs);
let mut com: Vec<char> = vec![];
let mut zero_flag = true;
for i in 0..(cs.len()) {
let c = cs[i];
if c == '0' && zero_flag {
// 末尾に続く0を無視... |
use axum::{
extract::{ConnectInfo, Path, State},
response::IntoResponse,
Json, Router,
};
use hyper::StatusCode;
use rand::{distributions::Alphanumeric, prelude::Distribution, thread_rng};
use serde::Deserialize;
use serde_json::json;
use std::net::SocketAddr;
use super::model::DBPost;
use crate::{
_entry::sta... |
use std::io::{BufWriter, Write};
use std::fs::{File};
extern crate clap;
use clap::{Arg, App, ArgMatches};
extern crate blobber;
fn main() {
let matches = get_matches();
let size_str = matches.value_of("size").unwrap_or("1m");
let size = parse_file_size(size_str);
let path = matches.value_of("outfile"... |
use chrono::{DateTime, Utc};
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Default)]
pub struct Clicks {
pub amount: u32,
pub last_click_ts: DateTime<Utc>,
} |
use crate::ray::Ray;
use crate::vec3::{Point3, Vector3};
use crate::Num;
use rand::{random, thread_rng, Rng};
use std::ops::Range;
use std::time::Duration;
pub struct Camera {
pub origin: Point3,
pub viewport: Viewport,
pub horizontal: Vector3,
pub vertical: Vector3,
pub u: Vector3,
pub v: Vect... |
use ansi_term::{ANSIString, Style};
use std::fmt;
/// A segment is a single configurable element in a module. This will usually
/// contain a data point to provide context for the prompt's user
/// (e.g. The version that software is running).
#[derive(Clone)]
pub struct Segment {
/// The segment's style. If None, ... |
use std::rc::Rc;
use std::sync::{Arc};
use lazy_static::lazy_static;
use dominator::{Dom, class, html};
use crate::parent::{Parent};
pub struct App {
parent: Arc<Parent>,
}
impl App {
pub fn new() -> Rc<Self> {
Rc::new(Self {
parent: Parent::new(),
})
}
pub fn render(ap... |
use crate::services::set_token;
use yew::prelude::*;
pub struct AuthPage;
impl Component for AuthPage {
type Message = ();
type Properties = ();
fn create(_: Self::Properties, _link: ComponentLink<Self>) -> Self {
set_token(None);
Self
}
fn update(&mut self, _msg: Self::Message) -... |
use std;
use libc;
use ffi;
pub fn get_ipv4byname(name: &str) -> std::io::Result<std::net::Ipv4Addr> {
let mut ifni = ffi::ifreq_addr::new();
ifni.ifr_name.set(name);
unsafe {
let fd: libc::c_int = libc::socket(libc::AF_INET, libc::SOCK_DGRAM, libc::IPPROTO_IP);
if fd < 0 {
retu... |
#![deny(unused_imports)]
extern crate image;
extern crate num;
extern crate num_cpus;
extern crate rand;
extern crate rustc_serialize;
extern crate threadpool;
extern crate time;
use std::fs::File;
use std::io::{self, Read, Write};
use std::env;
use std::process;
use std::sync::Arc;
use rustc_serialize::json;
use rus... |
#[doc = "Register `HWCFGR2` reader"]
pub type R = crate::R<HWCFGR2_SPEC>;
#[doc = "Register `HWCFGR2` writer"]
pub type W = crate::W<HWCFGR2_SPEC>;
#[doc = "Field `CFG1` reader - LUART hardware configuration 1"]
pub type CFG1_R = crate::FieldReader;
#[doc = "Field `CFG1` writer - LUART hardware configuration 1"]
pub ty... |
use std::sync::Once;
/// setup env_logger for test.
pub fn setup_test_logger() {
static INIT: Once = Once::new();
INIT.call_once(|| {
let _ = env_logger::builder()
.is_test(false) // To enable color. Logs are not captured by test framework.
.try_init();
});
log::info!(... |
#[derive(Debug)]
pub enum XError {
OpenDisplayError,
BadAtom,
BadProperty,
UnknownEventType,
BadKeyCode,
BadKeyString
}
|
extern crate proc_macro;
use proc_macro::TokenStream;
use quote::ToTokens;
use std::convert::{TryFrom, TryInto};
use syn::spanned::Spanned;
// _ __
// __ _____ _ __(_)/ _|_ _
// \ \ / / _ \ '__| | |_| | | |
// \ V / __/ | | | _| |_| |
// \_/ \___|_| |_|_| \__, |
// |_... |
use crypto_api_chachapoly::{ ChachaPolyError, ChachaPolyIetf };
include!("read_test_vectors.rs");
#[derive(Debug)]
pub struct TestVector {
line: usize,
key___: Vec<u8>,
nonce_: Vec<u8>,
ad____: Vec<u8>,
input_: Vec<u8>,
output: Vec<u8>
}
impl TestVector {
pub fn test(&self) {
match self.ad____.is_empty() {
... |
#[doc = "Reader of register DDRCTRL_DERATEEN"]
pub type R = crate::R<u32, super::DDRCTRL_DERATEEN>;
#[doc = "Writer for register DDRCTRL_DERATEEN"]
pub type W = crate::W<u32, super::DDRCTRL_DERATEEN>;
#[doc = "Register DDRCTRL_DERATEEN `reset()`'s with value 0"]
impl crate::ResetValue for super::DDRCTRL_DERATEEN {
... |
use alloc::vec::Vec;
use core::marker::PhantomData;
use necsim_core_bond::{NonNegativeF64, PositiveF64};
use necsim_core::{
cogs::{
Backup, CoalescenceRngSample, EmigrationExit, Habitat, LineageReference,
LocallyCoherentLineageStore, RngCore,
},
landscape::{IndexedLocation, Location},
l... |
#[cfg(unix)]
pub use self::unix::*;
#[cfg(windows)]
pub use self::windows::*;
#[cfg(unix)]
mod unix {
use std::fs::File;
use std::io;
use std::os::unix::fs::FileExt;
#[inline]
pub fn read_offset(file: &File, buf: &mut [u8], offset: u64) -> io::Result<usize> {
file.read_at(buf, offset)
... |
use std::env;
use std::process;
use common::load_file;
use std::collections::HashSet;
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() != 2 {
println!("day3 <file>");
process::exit(1);
}
let rows = load_file(&args[1]);
// 1000 x 1000
let mut state = [... |
extern crate time;
use byteorder::{ReadBytesExt, WriteBytesExt, BigEndian};
use self::time::Timespec;
use std::io::prelude::*;
use Result;
use types::{Type, FromSql, ToSql, IsNull, SessionInfo};
const USEC_PER_SEC: i64 = 1_000_000;
const NSEC_PER_USEC: i64 = 1_000;
// Number of seconds from 1970-01-01 to 2000-01-01... |
#[doc = "Reader of register ADV_ACCADDR_H"]
pub type R = crate::R<u32, super::ADV_ACCADDR_H>;
#[doc = "Writer for register ADV_ACCADDR_H"]
pub type W = crate::W<u32, super::ADV_ACCADDR_H>;
#[doc = "Register ADV_ACCADDR_H `reset()`'s with value 0x8e89"]
impl crate::ResetValue for super::ADV_ACCADDR_H {
type Type = u... |
use std::{time, thread};
fn main() {
let mut i = 0;
loop {
println!("hello world");
thread::sleep(time::Duration::from_secs(5));
i += 1;
if i > 3 { std::process::exit(42) }
}
}
|
#![feature(plugin)]
#![plugin(rocket_codegen)]
extern crate todomvc;
extern crate rocket;
extern crate rocket_contrib;
extern crate core;
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate serde_json;
#[macro_use]
extern crate diesel;
extern crate dotenv;
#[macro_use] extern crate dotenv_codege... |
mod text;
mod reexport;
mod summary;
mod mark;
mod document;
mod implementation;
pub use text::*;
pub use reexport::*;
pub use summary::*;
pub use mark::*;
pub use document::*;
pub use implementation::*;
pub type Code = String;
#[derive(Debug)]
pub struct SimpleItem {
declaration: Code,
mark: Mark,
descr... |
use log::error;
use std::{ffi::c_void, panic};
use wayland_sys::{
ffi_dispatch,
server::{wl_display, wl_event_source},
};
use wlroots_sys::WAYLAND_SERVER_HANDLE;
type Callback = extern "C" fn(*mut c_void) -> i32;
/// Unpack a Rust closure, extracting a `void*` pointer to the data and a
/// trampoline function whi... |
#[cfg(feature = "extern")]
pub mod ex;
#[cfg(feature = "python")]
pub mod py;
mod test;
use std::f64::consts::PI;
use crate::physics::
{
PLANCK_CONSTANT,
BOLTZMANN_CONSTANT
};
use crate::physics::single_chain::ZERO;
/// The structure of the thermodynamics of the FJC model in the modified can... |
// Copyright (C) 2020 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
use super::HeaderName;
pub const ACCEPT: HeaderName = HeaderName::from_static_str_unchecked("Accept");
pub const ACCEPT_CREDENTIALS: HeaderName =
Hea... |
// #![windows_subsystem = "windows"]
extern crate find_folder;
extern crate piston_window;
extern crate rand;
extern crate tetris_lib;
use piston_window::*;
use rand::{thread_rng, Rng};
use tetris_lib::game::*;
fn main() {
let mut window: PistonWindow = WindowSettings::new("tetris", [500, 500])
.exit_on... |
use crate::config;
use crate::state;
use futures::lock;
use std::sync;
const SHIP_TEXTURE_WIDTH: f64 = 36.0;
const SHIP_TEXTURE_HEIGHT: f64 = 36.0;
const ENERGY_BAR_WIDTH: f64 = 40.0;
const ENERGY_BAR_HEIGHT: f64 = 6.0;
pub async fn run(state: sync::Arc<lock::Mutex<state::State>>) -> Result<(), failure::Error> {
... |
use crate::part::Part;
use std::fs::File;
use std::io::{BufRead, BufReader};
fn part1(ns: &[i64], target: i64) -> Option<i64> {
let mut l = 0;
let mut r = ns.len() - 1;
while l < r {
if ns[l] + ns[r] == target {
return Some(ns[l] * ns[r]);
} else if target - ns[r] > ns[l] {
... |
use super::super::rocket;
use rocket::local::Client;
use rocket::http::{Status, ContentType};
#[test]
fn index() {
let client = Client::new(rocket()).expect("valid rocket instance");
let response = client.get("/").dispatch();
assert_eq!(response.status(), Status::Ok);
assert_eq!(response.content_type()... |
use std::collections::HashMap;
use std::io::prelude::*;
use std::fs::File;
use yaml_rust::{YamlLoader, Yaml};
pub type Inventory = HashMap<String, Vec<String>>;
#[derive(Debug, RustcEncodable)]
pub struct Property {
pub name: String,
pub module: String,
pub params: HashMap<String, String>,
}
#[derive(Deb... |
pub mod workdir;
|
$NetBSD: patch-third__party_rust_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs,v 1.1 2020/10/07 11:10:35 wiz Exp $
Based on: https://bugzilla.mozilla.org/show_bug.cgi?id=1594342
--- third_party/rust/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig 2020-01-03 18:58:20.000000000 +0000
+++ third_party/rust/libc/src/unix/bsd... |
use crate::ast::main::AST;
use super::{
expressions::expr_identifier,
types::{
ASTNode, AssignVariableStmt, BlockStmt, ClassStmt, ConditionStmt, Extendable, ForStmt,
FunctionParam, FunctionStmt, GlobalBlockStmt, GlobalNode, Identifier, InterfaceMember,
InterfaceStmt, ReturnStmt, ... |
// module sb::poker::rank
use std::cmp::Ordering;
//--- card ------------------------------------------------------------------------------------------
#[derive(Debug,Copy,Clone)]
pub struct Card {
rank : u8,
suit : u8,
}
impl PartialEq for Card
{
fn eq(&self, other: &Self) -> bool {
self.rank... |
// https://zhuanlan.zhihu.com/p/78333162
fn main() {
let mut flock = DuckFlock::new(33);
{
let thread: &mut dyn Thread = &mut flock;
thread.kill(10);
}
{
let flock: &mut dyn Flock = &mut flock;
flock.kill(10);
}
{
let thread: &mut dyn Thread = &mut flock... |
use std::mem;
use std::ptr;
use messages::Message;
use libc::{c_char, size_t};
use assets::AssetBundle;
use capi::common::*;
use transactions::delete_assets::DeleteAssetsWrapper;
use error::{Error, ErrorKind};
ffi_fn! {
fn dmbc_tx_delete_assets_create(
public_key: *const c_char,
seed: u64,
... |
pub mod cssom;
pub mod dom;
pub mod error;
pub mod font_list;
pub mod layout;
pub mod painter;
pub mod parser;
pub mod str;
pub mod style;
pub mod window;
|
// This is a comment, and is ignored by the compiler
// You can test this code by clicking the "Run" button over there ->// This is a comment, and is ignored by the compiler
// You can test this code by clicking the "Run" button over there ->
// or if you prefer to use your keyboard, you can use the "Ctrl + Enter" shor... |
use gl;
use std;
use std::ffi::CString;
use std::fs::File;
use std::io::Read;
use std::ops::Drop;
#[derive(Debug, Copy, Clone)]
pub enum ShaderType {
Vertex,
Fragment,
Geometry,
Compute,
}
#[derive(Debug, Default)]
pub struct Shader {
source_file: String,
gl_handle: u32,
shader_type: Sha... |
use std::io::Error;
use bincode::rustc_serialize::DecodingError;
use std::convert::From;
#[derive(Debug)]
pub enum IterError {
IO(Error),
Decode(DecodingError),
}
impl From<Error> for IterError {
fn from(e: Error) -> Self {
IterError::IO(e)
}
}
impl From<DecodingError> for IterError {
fn ... |
mod nand;
mod not;
mod and;
mod or;
mod xor;
mod nor;
pub use self::nand::NANDGate;
pub use self::not::NOTGate;
pub use self::and::ANDGate;
pub use self::or::ORGate;
pub use self::xor::XORGate;
pub use self::nor::NORGate;
mod gates {}
|
use serde_bytes::{ByteBuf, Bytes};
use serde_derive::{Deserialize, Serialize};
use std::borrow::Cow;
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct Test<'a> {
#[serde(with = "serde_bytes")]
slice: &'a [u8],
#[serde(with = "serde_bytes")]
vec: Vec<u8>,
#[serde(with = "serde_bytes")]
... |
//! Errors in leetcode-cli
use crate::cmds::{Command, DataCommand};
use colored::Colorize;
use std::{fmt, string::FromUtf8Error};
// fixme: use this_error
/// Error enum
pub enum Error {
MatchError,
DownloadError(String),
NetworkError(String),
ParseError(String),
CacheError(String),
FeatureErro... |
use crate::FifoWindow;
use alga::general::AbstractMonoid;
use alga::general::Operator;
use std::marker::PhantomData;
#[derive(Debug)]
struct Item<Value: Clone> {
agg: Value,
val: Value,
}
impl<Value: Clone> Item<Value> {
fn new(agg: Value, val: Value) -> Item<Value> {
Item { agg, val }
}
}
#[... |
use std::mem;
#[derive(Clone, Copy, Debug, Default, PartialEq)]
struct TestRead {
a: u8,
b: u16,
c: u8,
}
#[test]
fn mem_size_test() {
assert_eq!(4, mem::size_of::<i32>());
// 结构体size: u8 + u16 + u8 = 1 + 2 + 1 = 4
assert_eq!(4, mem::size_of::<TestRead>());
let orig = TestRead {
... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::schema::pending_transaction_schema::PendingTransactionSchema;
use crate::schema_db::SchemaDB;
use anyhow::Result;
use schemadb::SchemaBatch;
use sgtypes::pending_txn::PendingTransaction;
#[derive(Debug, Clone)]
pub struct... |
extern crate testing;
fn main() {
assert_eq!(4, testing::mult_two(2));
}
|
use regex::Regex;
use std::collections::{BTreeMap, HashSet};
const INITIAL_STATE: &str = "#.#..#..###.###.#..###.#####...########.#...#####...##.#....#.####.#.#..#..#.#..###...#..#.#....##";
//const INITIAL_STATE: &str = "#..#.#..##......###...###";
const FIVE_DIGITS: usize = 1 << 5;
const FINAL_GENERATION: i64 = 5000... |
pub const WORDLIST: &'static [&'static str] = &[
"abbinare",
"abbonato",
"abisso",
"abitare",
"abominio",
"accadere",
"accesso",
"acciaio",
"accordo",
"accumulo",
"acido",
"acqua",
"acrobata",
"acustico",
"adattare",
"addetto",
"addio",
"addome",
... |
use std::fs::File;
use std::io::{BufReader, BufRead, Result};
use std::collections::{HashMap};
fn main() -> Result<()> {
let path = "numbers.txt";
let input = File::open(path)?;
let buffered = BufReader::new(input);
let mut vector: Vec<i32> = vec![];
for line in buffered.lines() {
match li... |
// Copyright (c) 2017 The Noise-rs Developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT
// or http://opensource.org/licenses/MIT>, at your option. All files in the
// project carrying such notice may not be cop... |
use sqlx::MySqlPool;
use crate::db::entities::{Candidate, Vote};
use serenity::prelude::TypeMapKey;
use std::sync::Arc;
pub struct Db{
pool: MySqlPool
}
impl Db{
pub async fn new(url: &str) -> sqlx::Result<Self>{
Ok(
Self{
pool: MySqlPool::connect(url).await?
}... |
/// # Description
/// Takes two unsigned 8-bit integers and concatenates them into an unsigned 16-bit integer
///
/// # Arguments
/// * `first` - an unsigned 8-bit integer
/// * `second` - an unsigned 8-bit integer
///
/// # Example
/// let first = 0xab;
/// let second = 0xcd;
/// let together = convert_types... |
#[doc = "Register `MTLISR` reader"]
pub type R = crate::R<MTLISR_SPEC>;
#[doc = "Field `Q0IS` reader - Queue interrupt status"]
pub type Q0IS_R = crate::BitReader;
impl R {
#[doc = "Bit 0 - Queue interrupt status"]
#[inline(always)]
pub fn q0is(&self) -> Q0IS_R {
Q0IS_R::new((self.bits & 1) != 0)
... |
// Copyright 2020 Shift Cryptosecurity AG
//
// 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 ... |
use mongodb::{ Document};
use mongodb::{Client, ThreadedClient};
use mongodb::db::{ThreadedDatabase};
// use mongodb::coll::Collection;
use crate::analyze_result::AnalyzeResult;
use crate::config::DBConfig;
#[derive(Clone)]
pub struct DBase {
// mongodb 客户端
pub client: Client,
// // 数据集
// pub collecti... |
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
use crate::store::{State, ObjectCache};
use crate::object;
struct Entry {
next: usize,
prev: usize,
state: Rc<RefCell<State>>
}
pub struct SimpleCache {
max_entries: usize,
least_recently_used: usize,
most_recently_used: ... |
use super::*;
pub fn expression() -> Expression {
Expression {
boostrap_compiler: boostrap_compiler,
typecheck: typecheck,
codegen: codegen,
}
}
fn boostrap_compiler(compiler: &mut Compiler) {
add_function_to_compiler(compiler, "print", Type::None, &vec![Type::Int], "print_int");
... |
use std::fs::File;
use std::io::{self, BufRead};
use std::path::Path;
use regex::Regex;
use std::collections::HashMap;
use std::collections::HashSet;
fn parse_line(s: &str) -> (String, Vec<(u32, String)>) {
let mut iter = s.split(" bags contain ");
let bag_color = iter.next().unwrap().to_string();
let re ... |
use num::BigInt;
pub struct PrimorialPi {
index: BigInt,
}
impl PrimorialPi {
pub fn new<T>(i: T) -> PrimorialPi
where
BigInt: From<T>,
{
let int = BigInt::from(i);
PrimorialPi { index: int }
}
}
|
use amethyst::{
core::{
cgmath::Vector3,
transform::{GlobalTransform, Transform},
},
ecs::prelude::{Component,VecStorage},
prelude::*,
renderer::{SpriteRender, SpriteSheetHandle,ScreenDimensions},
};
use rand;
use rand::Rng;
pub struct Snake {
pub last_head_pos: Vector3<f32>,
... |
fn main() {
let mut config = prost_build::Config::new();
config
.compile_protos(
&[
"secret/v1/secret.proto",
"secret/v1/state.proto",
"secret/v1/keys.proto",
"secret/v1/encrypted.proto",
"secret/v1/messages.prot... |
//! Timetoken type.
use std::time::{SystemTime, SystemTimeError};
/// # PubNub Timetoken
///
/// This is the timetoken structure that PubNub uses as a stream index.
/// It allows clients to resume streaming from where they left off for added
/// resiliency.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Copy)]
pub struc... |
use eval::Expr;
use gc::Gc;
use rnix::types::Wrapper;
use scope::Scope;
use std::borrow::Borrow;
use value::NixValue;
use crate::static_analysis;
#[cfg(test)]
use maplit::hashmap;
#[cfg(test)]
use serde_json::json;
#[cfg(test)]
use std::time::Duration;
#[cfg(test)]
use stoppable_thread::*;
#[cfg(test)]
use crate::erro... |
use super::{Context, Module, RootModuleConfig};
use crate::configs::nodejs::NodejsConfig;
use crate::formatter::StringFormatter;
use crate::utils;
/// Creates a module with the current Node.js version
///
/// Will display the Node.js version if any of the following criteria are met:
/// - Current directory contai... |
use std::fmt::Display;
use serde::{Deserialize, Serialize};
/// Key to find RecordPos from a record / row.
///
/// Represented in a string either like "(prefix).(attr)" or "(attr)".
#[derive(
Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default, Serialize, Deserialize, new,
)]
pub struct SchemaIndex {
... |
use std::collections::HashMap;
use std::pin::Pin;
use std::sync::Arc;
use futures::{
future::{poll_fn, select},
pin_mut, FutureExt, Sink,
};
use crate::{
client::{watch_for_client_state_change, Client, ClientState, ClientTaskTracker},
error::WampError,
proto::TxMessage,
transport::Transport,
... |
use std::{io::Write, env};
use std::fs::File;
use std::path::Path;
use std::io::{self, prelude::*, BufReader};
use mp3_duration;
fn main() {
let args: Vec<String> = env::args().collect();
let filename = &args[1];
let audio = &args[2];
print!("reading... ");
let contents = File::open(filename).exp... |
#![cfg_attr(not(feature = "std"), no_std)]
pub mod rewards;
pub mod inflation;
pub mod weights;
#[cfg(test)]
mod mock;
#[cfg(test)]
mod tests;
#[cfg(feature = "runtime-benchmarks")]
pub mod benchmarking;
use frame_support::traits::{Currency, OnUnbalanced, Get, EnsureOrigin};
use frame_support::{
decl_event, dec... |
use iron::error::HttpError;
use iron::headers::{parsing, Header, HeaderFormat};
use iron::{Chain, Request, Response, IronResult, BeforeMiddleware, AfterMiddleware, typemap, status};
use router::Router;
use std::fmt;
use std::io::Read;
use std::sync::Mutex;
use std::ascii::AsciiExt;
use std::sync::mpsc::Sender;
use ... |
use std::cmp;
use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;
struct Ingredient {
name: String,
capacity: i32,
durability: i32,
flavor: i32,
texture: i32,
calories: i32,
}
impl Ingredient {
fn mult(&self, x: i32) -> Ingredient {
Ingredient {
name: se... |
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// https://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT o... |
use std::cmp;
use nalgebra::{Scalar, Vector3};
/// Helper trait for computing minimum and maximum values for types. This is used in conjunction
/// with `PrimitiveType` to enable min/max computations even for vector types
pub trait MinMax {
/// Computes the infimum of this value and `other`. For scalar types, the... |
pub mod title;
pub mod game;
pub mod game_end; |
use bevy::math::vec3;
use bevy::prelude::*;
use bevy::math::f32::Vec2;
use bevy::sprite::collide_aabb;
use bevy_prototype_debug_lines::*;
use crate::player::Player;
pub enum Team {
Player,
Enemy,
}
pub struct Hurtbox {
pub team: Team,
pub size: Vec2,
pub health: u64,
pub is_hit: bool,
pu... |
mod identity;
pub use identity::*;
mod user;
pub use user::*;
mod post;
pub use post::*;
|
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
mod client {
pub struct clt {
name:String,
}
impl clt {
fn new(srv_name:String) {
}
fn send(data:String) {
}
fn send_async(data:String) {
}
f... |
#[doc = "Reader of register LUT_SEL[%s]"]
pub type R = crate::R<u32, super::LUT_SEL>;
#[doc = "Writer for register LUT_SEL[%s]"]
pub type W = crate::W<u32, super::LUT_SEL>;
#[doc = "Register LUT_SEL[%s] `reset()`'s with value 0"]
impl crate::ResetValue for super::LUT_SEL {
type Type = u32;
#[inline(always)]
... |
#[doc = "Register `LCKR` reader"]
pub type R = crate::R<LCKR_SPEC>;
#[doc = "Register `LCKR` writer"]
pub type W = crate::W<LCKR_SPEC>;
#[doc = "Field `LCK0` reader - Port x lock bit y (y= 0..15)"]
pub type LCK0_R = crate::BitReader<LCK0_A>;
#[doc = "Port x lock bit y (y= 0..15)\n\nValue on reset: 0"]
#[derive(Clone, C... |
use std::io::{Result, Write};
use pulldown_cmark::{Tag, Event};
use crate::gen::{State, States, Generator, Document};
#[derive(Debug)]
pub struct InlineEmphasis;
impl<'a> State<'a> for InlineEmphasis {
fn new(tag: Tag<'a>, gen: &mut Generator<'a, impl Document<'a>, impl Write>) -> Result<Self> {
write!(... |
use x86_64::structures::idt::InterruptDescriptorTable;
pub fn interrupts_callback(table: &mut InterruptDescriptorTable) {
} |
extern crate bincode;
#[macro_use]
extern crate clap;
extern crate colored;
#[cfg(feature = "tensorflow")]
extern crate conform;
extern crate dot;
#[macro_use]
extern crate error_chain;
extern crate insideout;
extern crate itertools;
#[macro_use]
extern crate log;
extern crate ndarray;
#[macro_use]
extern crate prettyt... |
use std::any::Any;
use std::cmp::Ordering;
use std::fmt;
use std::hash::{self, Hash};
use std::marker::PhantomData;
use std::mem::{self, MaybeUninit};
use std::ops;
use std::ptr;
use ::alloc::alloc::{self, Layout};
#[cfg(feature = "coerce")]
use std::marker::Unsize;
#[cfg(feature = "coerce")]
use std::ops::CoerceUnsi... |
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate rocket;
pub mod utils;
pub mod api;
use api::deploy;
fn main() {
rocket::ignite().mount("/api", routes![deploy::create]).launch();
} |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
use std::sync::atomic::AtomicU64;
use std::sync::atomic::Ordering;
use clap::Parser;
use reverie::... |
mod application;
mod queue;
pub mod shared_res;
mod vertex;
mod window;
pub use application::GliumApplication;
|
// Copyright 2015 The GeoRust 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 agreed... |
#[doc = "Reader of register RSLV_LIST_PEER_RPA_BASE_ADDR"]
pub type R = crate::R<u32, super::RSLV_LIST_PEER_RPA_BASE_ADDR>;
#[doc = "Writer for register RSLV_LIST_PEER_RPA_BASE_ADDR"]
pub type W = crate::W<u32, super::RSLV_LIST_PEER_RPA_BASE_ADDR>;
#[doc = "Register RSLV_LIST_PEER_RPA_BASE_ADDR `reset()`'s with value 0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.