text stringlengths 8 4.13M |
|---|
mod model;
mod context;
mod hook;
use self::context::{CommandError, JobContext};
pub(crate) use self::model::*;
use self::hook::{Hook, Hooks};
use crate::config::{Config, Project};
use crate::fs::{get_job_archive_file, get_telegram_chat_id};
use crate::status;
use crate::time::now;
use std::fmt;
use std::io;
use std:... |
use darling::{util::Flag, FromDeriveInput, FromField, FromVariant};
use proc_macro2::TokenStream;
use quote::{format_ident, quote, quote_spanned};
use syn::{DeriveInput, Ident, Index, Member, Path};
use crate::generators::{self as gen, CodedVariant};
#[derive(FromDeriveInput)]
#[darling(supports(enum_any), attributes... |
use chamomile::prelude::SendMessage;
use smol::channel::{SendError, Sender};
use tdn_types::{
group::GroupId,
message::{ReceiveMessage, RecvType, SendType},
primitive::{DeliveryType, PeerAddr, Result, StreamType},
};
#[inline]
pub(crate) async fn layer_handle_send(
fgid: GroupId,
tgid: GroupId,
... |
use super::*;
use super::BinaryTree;
#[test]
fn test_len() {
let vec: Vec<i32> = vec![8; 8];
assert!(vec.len() == 8);
}
#[test]
fn test_sequential_search() {
let vec = vec![1, 2, 5, 6, 7, 9, 20];
let assert_value = Some(2);
let search_value = 5;
let result_value = vec.sequential_search(search_... |
// Temporary
//#![allow(dead_code)]
use crate::credentials::generate_mqtt_hash;
use crate::mqtt_broker_manager::{QOS, TOPICS, NEUTRONCOMMUNICATOR_TOPIC, REGISTERED_TOPIC};
use crate::nodes::{Node, Element};
use crate::settings::{NeutronCommunicator, SettingsDatabase, SettingsWebInterface};
use crate::external_interfac... |
#[macro_use]
extern crate rbatis_macro_driver;
use std::os::raw::c_char;
use async_std::task::block_on;
use rbatis::rbatis::Rbatis;
use rbatis::crud::{CRUD, CRUDTable};
use chrono::NaiveDateTime;
use rbatis_core::value::DateTimeNow;
use std::ops::Add;
use serde::{Deserialize, Serialize};
use shared::to_str;
#[derive(... |
/*
* Given an integer, write a function to determine if it is a power of two.
*
* Examples:
* ----------
* Input: 1
* Output: true
*
* Input: 16
* Output: true
*
* Input: 218
* Output: false
*/
pub fn is_power_of_two(n: i32) -> bool {
if n <= 0 {
return false
}
return (n & (n-1)) == 0... |
extern crate specs;
use specs::{Component, VecStorage};
#[derive(Debug)]
struct Position {
x: f32,
y: f32
}
impl Component for Position {
type Storage = VecStorage<Self>;
}
#[macro_use]
extern crate specs_derive;
#[derive(Debug, Component)]
#[component(VecStorage)]
struct Velocity {
x: f32,
y: ... |
use bigneon_db::dev::TestProject;
use bigneon_db::models::{
DisplayTicket, EventEditableAttributes, Order, RedeemResults, TicketInstance, Wallet,
};
use chrono::prelude::*;
use chrono::NaiveDateTime;
use diesel;
use diesel::result::Error;
use diesel::sql_types;
use diesel::Connection;
use diesel::RunQueryDsl;
use t... |
use std::io::Cursor;
use std::sync::Arc;
use lightning::ln::msgs::NetAddress;
use lightning::util::ser::Writeable;
use lightning::{
routing::gossip::{NodeId, NodeInfo},
util::ser::Readable,
};
use serde::Deserialize;
use tokio::runtime::Handle;
use crate::{error::Error, hex_utils, node::NetworkGraph};
use su... |
#![allow(unused_imports)]
use legion::{system, systems::CommandBuffer, Entity};
#[system(par_for_each)]
fn for_each(_: &Entity, _: &mut CommandBuffer) {}
fn main() {}
|
#[allow(unused_imports)]
use proconio::{
input, fastout,
};
fn solve(a: i64, b: i64, c: i64, d: i64) -> usize {
if a == c && b == d {
0
} else if a + b == c + d
|| a - b == c - d
|| (a - c).abs() + (b - d).abs() <= 3
{
1
} else if (a + b + c + d) % 2 == 0
||... |
use super::{vertex, Vertex};
use super::opengl::{VertexArray, BufferUsage, Buffer, VertexBuffer, ElementBuffer, PrimitiveType};
use crate::error::{GameError, GameResult};
use glow::Context;
use std::rc::Rc;
pub struct Renderer {
vertex_array: VertexArray,
vertex_buffer: VertexBuffer,
vertex_size: usize,
... |
pub struct ProconReader<R: std::io::Read> {
reader: R,
}
impl<R: std::io::Read> ProconReader<R> {
pub fn new(reader: R) -> Self {
Self { reader }
}
pub fn get<T: std::str::FromStr>(&mut self) -> T {
use std::io::Read;
let buf = self
.reader
.by_ref()
... |
///
/// Creates a retina map that can be used to simulate glaucoma.
///
/// # Arguments
///
/// - `res` - resolution of the returned retina map
/// - `severity` - the severity of the disease, value between 0 and 100
///
pub fn generate_simple(
res: (u32, u32),
severity: u8,
) -> image::ImageBuffer<image::R... |
// 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 ... |
#[doc = r"Value read from the register"]
pub struct R {
bits: u16,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u16,
}
impl super::RXIE {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w... |
use mysql::{PooledConn, Pool};
use mysql::prelude::*;
use mysql::params;
use csv::Reader;
use serde::{Deserialize, Serialize};
use serde_json::{Result};
use std::fs::{OpenOptions};
use std::io::Write;
#[derive(Debug, Deserialize, Serialize)]
struct Example {
name: String
}
#[derive(Clone, Debug, Deserialize, Seri... |
use std::convert::TryFrom;
use super::component_prelude::*;
use crate::level_manager::Level;
#[derive(Default, Clone, PartialEq, Eq, Hash, Deserialize)]
pub struct MenuSelection(pub Level);
impl MenuSelection {
#[rustfmt::skip]
pub fn next(&mut self) {
self.0 = match self.0 {
Level::VeryE... |
#[macro_use]
extern crate log;
extern crate lapin;
extern crate tokio;
extern crate tokio_amqp;
use dotenv::dotenv;
use std::env;
use lapin::{Connection, ConnectionProperties, BasicProperties, types::FieldTable};
use lapin::options::{QueueDeclareOptions, BasicConsumeOptions, BasicPublishOptions, BasicAckOptions};
use ... |
// Copyright 2021 Datafuse Labs.
//
// 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 ... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub const FACILITY_PINT_STATUS_CODE: u32 = 240u32;
pub const FACILITY_RTC_INTERFACE: u32 = 238u32;
pub const FACILITY_SIP_STATUS_CODE: u32 = 239u32;
pub type IN... |
use criterion::{criterion_group, criterion_main, Benchmark, Criterion, Throughput};
use futures::compat::Future01CompatExt;
use rand::{distributions::Alphanumeric, rngs::SmallRng, thread_rng, Rng, SeedableRng};
use tempfile::tempdir;
use vector::test_util::{
next_addr, runtime, send_lines, shutdown_on_idle, wait_f... |
use crate::decode::Decode;
use crate::encode::Encode;
use crate::postgres::protocol::TypeId;
use crate::postgres::{PgData, PgRawBuffer, PgTypeInfo, PgValue, Postgres};
use crate::types::Type;
impl Type<Postgres> for bool {
fn type_info() -> PgTypeInfo {
PgTypeInfo::new(TypeId::BOOL, "BOOL")
}
}
impl T... |
mod client;
mod pipe;
mod server;
mod session;
mod traits;
pub use tokio;
pub use tokio_rustls::rustls;
pub use tokio_rustls::webpki;
pub use client::Client;
pub use server::Server;
|
use super::class;
use super::name;
use super::network;
use super::qtype;
pub struct Question {
pub RawName: Vec<u8>,
pub name: String,
pub qtype: qtype::Type,
pub class: class::Class,
}
impl std::fmt::Display for Question {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
... |
extern crate lazy_static;
extern crate rhai;
extern crate serde;
extern crate serde_json;
use lazy_static::lazy_static;
use regex::{Captures, Match, Regex};
use serde::Serialize;
use std::cmp::{max, min, PartialEq};
use std::str;
const BOM: &str = "\u{FEFF}";
const NO_INDENT: &str = "expected indent regext to be init... |
mod utilities;
mod logger;
mod mazo;
mod jugador;
mod juego;
mod sinc;
use std::thread;
use std::sync::{Arc, Barrier};
use std::sync::mpsc::{channel, Receiver, Sender};
use rand::prelude::*;
fn main() {
let config = utilities::parse_parameters(std::env::args().collect());
let n_jugadores = config.player_count... |
// Copyright 2018 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 ... |
/* Core
* The core module provides functionality that will be common to the server
* and client. This will include color, cards, and mana.
*/
pub mod color;
pub mod mana;
|
use crate::{cvars::Config, physics::*, render::GameGraphics};
use ::resources::Resources;
use gvfs::filesystem::Filesystem;
use hecs::World;
pub mod components;
mod main;
pub mod physics;
pub mod systems;
pub struct GameState {
pub world: World,
pub resources: Resources,
pub filesystem: Filesystem,
pu... |
use glam::Vec3;
use serde::{Serialize, Deserialize};
use crate::structure::*;
use crate::triangle::Triangle;
#[derive(Default, Serialize, Deserialize, Clone, Copy)]
pub struct Bbox {
min: Vec3,
max: Vec3,
}
impl Bbox {
pub fn expand(&mut self, triangle: &Triangle) {
self.min = self.min.min(triangl... |
#![feature(unboxed_closures)]
#![feature(fn_traits)]
mod operator;
mod closure;
mod arena;
|
//! Network Sockets example.
//!
//! This example showcases the use of network sockets via the `Soc` service and the standard library's implementations.
use ctru::prelude::*;
use std::io::{self, Read, Write};
use std::net::{Shutdown, TcpListener};
use std::time::Duration;
fn main() {
ctru::use_panic_handler();
... |
extern crate core;
use std::collections::HashMap;
use std::str::FromStr;
fn part1(input: &str) -> String {
let (instructions, mut stacks) = get_stacks_and_instructions(input);
parse_command_and_execute(perform_action_part1, instructions, &mut stacks);
calculate_output(stacks)
}
fn part2(input: &str) -> S... |
mod basic_literal;
mod identifier;
mod binary_op;
mod func_call;
mod func_literal;
mod symbol_bound_literal;
pub use self::basic_literal::BasicLiteral;
pub use self::binary_op::BinaryOp;
pub use self::func_call::{FuncCall, FuncParam};
pub use self::identifier::Identifier;
pub use self::symbol_bound_literal::SymbolBoun... |
type SigmoidFunc = fn(f64) -> f64;
#[derive(Debug, Clone)]
pub struct Sigmoid {
upper_bound: f64,
lower_bound: f64,
function: SigmoidFunc,
derivative: SigmoidFunc, // derivative function
}
impl Sigmoid {
#[allow(dead_code)]
pub fn log() -> Sigmoid {
Sigmoid {
upper_bound: 1... |
//! Equijoin expression plan.
use timely::dataflow::scopes::child::Iterative;
use timely::dataflow::Scope;
use timely::order::Product;
use timely::progress::Timestamp;
use differential_dataflow::lattice::Lattice;
use differential_dataflow::operators::arrange::{Arrange, Arranged};
use differential_dataflow::operators:... |
#![feature(plugin, decl_macro, custom_attribute, proc_macro_hygiene)]
#![recursion_limit="256"]
#[macro_use] extern crate rocket;
#[macro_use] extern crate rocket_contrib;
#[macro_use] extern crate diesel;
extern crate serde;
#[macro_use] extern crate serde_derive;
extern crate regex;
extern crate bcrypt;
extern crate... |
extern crate rocket;
use rocket::Rocket;
pub mod model;
pub mod dao;
pub mod service;
pub mod route;
pub fn init() -> Rocket {
rocket::ignite()
.mount("/client", route::client_route::routes())
.mount("/user", route::user_route::routes())
} |
use super::expf;
/* k is such that k*ln2 has minimal relative error and x - kln2 > log(FLT_MIN) */
const K: i32 = 235;
/* expf(x)/2 for x >= log(FLT_MAX), slightly better than 0.5f*expf(x/2)*expf(x/2) */
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub(crate) fn k_expo2f(x: f32) -> f32 {
let k_ln2 ... |
fn main() {
println!("{} days", 3);
println!("{0}, this {1}. {1}, this is {0}", "Alice", "Bob");
println!("{subject} {verb} {object}",
object="t-shirt",
subject="people",
verb="using");
println!("{} dari {:b} orang tahu angka biner, setengahnya tidak tahu", 1, 2);
println!("{number:>width$}", number=... |
use clippy_utils::diagnostics::{span_lint_and_note, span_lint_and_then};
use clippy_utils::source::{first_line_of_span, indent_of, reindent_multiline, snippet, snippet_opt};
use clippy_utils::{
both, count_eq, eq_expr_value, get_enclosing_block, get_parent_expr, if_sequence, is_else_clause, is_lint_allowed,
sea... |
#[derive(Debug)]
pub enum Error {
FixnumParsing,
BooleanParsing,
UnknownToken,
EmptyValues,
MismatchedTypes
}
|
//! Utilities for parsing from byte streams
mod buffer;
mod parser;
pub(crate) use self::buffer::Buffer;
pub(crate) use self::parser::Parser;
use std::io;
use thiserror::Error;
use crate::object::ParseIdError;
#[derive(Debug, Error)]
pub(crate) enum Error {
#[error("unexpected end of file")]
UnexpectedEof... |
extern crate websocket;
extern crate mount;
extern crate staticfile;
extern crate iron;
mod server;
mod page;
mod board;
fn main() {
server::start();
page::serve();
} |
#[test]
fn test_basic_closure() {
let plus_one = |x: i32| x + 1;
assert_eq!(2, plus_one(1));
}
#[test]
fn test_longer_closure() {
let plus_two = |x| {
let mut result: i32 = x;
result += 1;
result += 1;
result
};
assert_eq!(4, plus_two(2));
}
#[test]
fn test_basic_cl... |
use crate::Counter;
use num_traits::Zero;
use std::collections::HashMap;
use std::hash::Hash;
impl<T, N> Counter<T, N>
where
T: Hash + Eq,
N: Zero,
{
/// Create a new, empty `Counter`
pub fn new() -> Self {
Counter {
map: HashMap::new(),
zero: N::zero(),
}
... |
use std::{env, path::PathBuf};
fn main() {
let config_src = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
.join("mc_randomx")
.join("MerosConfiguration")
.join("configuration.h");
let config_dst = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
.join("RandomX")
... |
extern crate proc_macro;
use proc_macro::TokenStream;
use proc_macro2::Span;
use quote::quote;
use syn::{
parse::{Parse, ParseStream, Result},
Ident, LitInt, Token,
};
struct BoundedInt {
name: Ident,
lower: LitInt,
upper: LitInt,
}
impl Parse for BoundedInt {
fn parse(input: ParseStream) ->... |
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(feature = "std")]
use std::fmt;
#[cfg(not(feature = "std"))]
use core::fmt;
use embedded_hal::blocking::i2c;
/// A wrapper around an embedded_hal bus peripheral that traces each
/// read and write call and prints the raw bytes that were sent or
/// received. It will al... |
// Copyright 2019. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[derive(:: core :: clone :: Clone)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct CMD_ENTRY {
pub pwszCmdToken: super::super::Foundation::PWSTR,
pub pfnCmdHandler: ::cor... |
// 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::addable_directory::AddableDirectory,
crate::model::*,
cm_rust::{CapabilityPath, ComponentDecl, ExposeDecl, UseDecl, UseStor... |
use crate::headers::{Error, Header, HeaderName, HeaderValue};
use hyper::http::header;
use std::fmt;
use std::iter;
use std::str::FromStr;
const BASIC_REALM_PREAMBLE: &str = "Basic realm=";
static WWW_AUTHENTICATE: &HeaderName = &header::WWW_AUTHENTICATE;
#[derive(Clone, Debug, PartialEq)]
pub struct WWWAuthenticate(... |
use ggez::graphics::*;
use ggez::*;
use tiled;
use sprite::*;
use util;
#[derive(Debug)]
pub struct Map {
// pixel location of top left of map
pub(crate) pos: Point2,
pub(crate) camera: Rect,
// layer index to use
pub(crate) layer_index: usize,
// tileset to use
pub(crate) tile_set: usize... |
// Install:
//
// cargo install --git https://github.com/BurntSushi/dotfiles find-invalid-utf8
//
// Usage:
//
// find-invalid-utf8
// find-invalid-utf8 path/to/directory-or-file
//
// To parallelize, use 'xargs':
//
// find ./ -print0 | xargs -0 -n1 -P8 find-invalid-utf8
use std::{ffi::OsString, fs::File, io:... |
pub fn raindrops(num: usize) -> String {
let factors = rain_factors(num);
let mut rain = String::new();
for factor in factors {
match factor {
3 => rain.push_str("Pling"),
5 => rain.push_str("Plang"),
7 => rain.push_str("Plong"),
_ => continue,
... |
#![feature(phase)]
#[phase(plugin)]
extern crate rustful_macros;
extern crate rustful;
use std::sync::RWLock;
use rustful::{Server, TreeRouter, Request, Response, RequestPlugin, ResponsePlugin};
use rustful::RequestAction;
use rustful::RequestAction::Continue;
use rustful::{ResponseAction, ResponseData};
use rustful... |
use std;
#[test]
fn test() { let x = std::option::some[int](10); } |
mod models;
mod views;
mod controllers;
mod tests;
|
use std::collections::HashMap;
use std::fs;
use colored::*;
use log::*;
use serde::Deserialize;
use serde_json::Value;
#[derive(Deserialize, Debug)]
#[serde(untagged)]
pub enum AWSService {
Lambda {
runtime: String,
handler: String,
#[serde(default)]
env_file: String,
#[ser... |
// Copyright 2019 The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// dis... |
#[test]
fn repr_rust_struct() {
use std::mem::size_of;
struct MyStructRust {
_a: usize,
_b: String,
}
assert_eq!(
size_of::<usize>() + size_of::<String>(),
size_of::<MyStructRust>()
);
}
#[test]
fn repr_c_struct() {
use std::mem::size_of;
#[repr(C)]
str... |
//! A library for interacting with audio devices.
//!
//! The sole aim of this crate is to provide idiomatic *low level* audio
//! interface drivers that can be used independently. If all you need is WASAPI
//! or ALSA, then that is all you pay for and you should have a decent
//! Rust-idiomatic programming experience.... |
use clap::Clap;
use nlprule::{rules::Rules, tokenizer::Tokenizer};
#[derive(Clap)]
#[clap(
version = "1.0",
author = "Benjamin Minixhofer <bminixhofer@gmail.com>"
)]
struct Opts {
text: String,
#[clap(long, short)]
tokenizer: String,
#[clap(long, short)]
rules: String,
}
fn main() {
en... |
// Copyright 2019. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
use std::io::{Read};
use serde::de::{Deserialize};
use serde_json::Number;
fn number_to_string<'de, D: serde::Deserializer<'de>>(d: D) -> Result<String, D::Error> {
let n: Number = Deserialize::deserialize(d)?;
Ok(n.to_string())
}
#[derive(Deserialize)]
pub struct Config {
pub name: String,
pub passw... |
mod common;
mod matrix;
use common::get_rng;
use failure::Error;
use matrix::{Cell, Matrix};
use rand::prelude::*;
use sdl2::event::Event;
use sdl2::gfx::framerate::FPSManager;
use sdl2::gfx::primitives::DrawRenderer;
use sdl2::pixels::Color;
use std::f64;
use std::sync::{Arc, RwLock};
use std::thread;
use structopt::... |
//! # Rights Management Pallet
#![cfg_attr(not(feature = "std"), no_std)]
use codec::{Decode, Encode};
use core::result::Result;
use frame_support::{decl_module, decl_storage, decl_event, decl_error, dispatch, ensure,
sp_std::prelude::*};
use frame_system::ensure_signed;
pub use sp_std::vec::Vec;
#[cfg(test)]
mod... |
//! ```elixir
//! case Lumen.Web.HTMLFormElement.element(html_form_element, "input-name") do
//! {:ok, html_input_element} -> ...
//! :error -> ...
//! end
//! ```
use wasm_bindgen::JsCast;
use web_sys::HtmlInputElement;
use liblumen_alloc::atom;
use liblumen_alloc::erts::exception;
use liblumen_alloc::erts::pro... |
/// Tokens from the textual representation of constraints.
use crate::ir;
#[derive(Debug, Clone, PartialEq)]
pub enum Token {
ValueIdent(String),
ChoiceIdent(String),
Var(String),
Doc(String),
CmpOp(ir::CmpOp),
Code(String),
CounterKind(ir::CounterKind),
Bool(bool),
CounterVisibilit... |
fn sample1() {
fn a1() -> fn(i32) -> i32 {
|x| x * 2
}
println!("a1 = {}", a1()(11));
fn b1() -> impl Fn(i32) -> i32 {
|x| x * 2
}
println!("b1 = {}", b1()(12));
fn c1() -> Box<dyn Fn(i32) -> i32> {
Box::new(|x| x * 2)
}
println!("c1 = {}", c1()(13));
}... |
use ::Access;
use na::{BaseFloat, Norm, Vector3};
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
use std::convert::Into;
/// East North Up vector
///
/// This struct represents a vector in the ENU coordinate system.
/// See: [ENU](https://en.wikipedia.org/wiki/Axes_conventions) for a g... |
pub mod data;
use std::collections::{BTreeMap, HashMap, HashSet, LinkedList};
// TODO: try doing recursively
//
fn path(node: &str, target: &str, children: &HashMap<String, Vec<String>>) -> Option<LinkedList<String>> {
if node == target {
let mut l = LinkedList::new();
l.push_back(target.to_string());
return ... |
use amethyst::input::BindingTypes;
#[derive(Debug, PartialEq, Eq, Hash, Default)]
pub struct IngameBindings;
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum IngameAxisBinding {
None,
PlayerX,
PlayerY,
PlayerAltX,
PlayerAltY,
}
impl Default for IngameAxisBinding {
... |
//!
//! ms.rs
//!
//! Created by Mitchell Nordine at 08:22PM on November 02, 2014.
//!
//!
use num::{FromPrimitive, ToPrimitive};
use std::ops::{Add, Sub, Mul, Div, Rem, Neg,
AddAssign, SubAssign, MulAssign, DivAssign, RemAssign};
use super::calc;
use super::{
Bars,
Beats,
Bpm,
Ppqn,
... |
use {
core::fmt,
log::{self, Level, LevelFilter, Log, Metadata, Record},
};
pub fn init(level: &str) {
static LOGGER: SimpleLogger = SimpleLogger;
log::set_logger(&LOGGER).unwrap();
log::set_max_level(match level {
"error" => LevelFilter::Error,
"warn" => LevelFilter::Warn,
... |
//! # kdtree-na
//!
//! K-dimensional tree for Rust (bucket point-region implementation)
//!
//! ## Usage
//!
//! ```
//! extern crate nalgebra;
//!
//! use nalgebra::{vector, Vector2};
//! use kdtree_na::{norm::EuclideanNormSquared, KdTree};
//!
//! let a: (Vector2<f64>, usize) = (vector![0f64, 0f64], 0);
//! let b: (... |
// Copyright 2022 Datafuse Labs.
//
// 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 ... |
mod websocket;
use lazy_static::lazy_static;
use parking_lot::RwLock;
use rayon::{ThreadPool, ThreadPoolBuilder};
use serde::Serialize;
use std::sync::{
atomic::{AtomicBool, AtomicU32, Ordering},
Arc, Weak,
};
use crate::dprintln;
use self::websocket::{TransactionMessage, TransactionServer};
lazy_static! {
stati... |
use crate::*;
use crate::{
composite_collections::{SmallCompositeVec as CompositeVec, SmallStartLen as StartLen},
impl_interfacetype::impl_interfacetype_tokenizer,
lifetimes::LifetimeIndex,
literals_constructors::{rslice_tokenizer, rstr_tokenizer},
};
use as_derive_utils::{
datastructure::{DataStr... |
use crate::Span;
/// A comment.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[cfg_attr(
feature = "serde-1",
derive(serde_derive::Serialize, serde_derive::Deserialize)
)]
pub struct Comment<'input> {
/// The comment itself.
pub value: &'input str,
/// Where the comment is located in the original s... |
use crate::ast;
use crate::error::{GraphError, Result};
use crate::graph::{ToValues, Values, Variables};
use inflector::Inflector;
#[derive(Clone, Default, Debug)]
pub struct Vars {
pub inner: Variables,
}
#[derive(Clone)]
pub struct Query<'a> {
pub name: &'a str,
pub description: &'a str,
pub ty: as... |
use serde::{Deserialize, Serialize};
/// Describes the scores that the two players have. Players each begin with 20 points, and loses when all the points are lost.
/// /両プレイヤーが持つ得点を表す型。双方20点スタートであり、点が0点になると敗北。
#[derive(Clone, Debug, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct Scores {
ia: i32,
... |
#![allow(non_snake_case)]
use core::convert::TryInto;
use test_winrt_signatures::*;
use windows::core::*;
use Component::Signatures::*;
#[implement(Component::Signatures::ITestSingle)]
struct RustTest();
impl RustTest {
fn SignatureSingle(&self, a: f32, b: &mut f32) -> Result<f32> {
*b = a;
Ok(a)... |
use crate::{AsReg, Reg};
use failure::{bail, Error};
use hashbrown::HashSet;
use std::fmt;
#[derive(Debug, Default)]
pub struct Registers {
registers: [Reg; 6],
/// Written to registers.
written: HashSet<usize>,
/// Read from registers.
read: HashSet<usize>,
/// Last instruction that was execut... |
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize)]
pub struct Req {
verb: String
} |
//! Services and MakeServices
//!
//! - A [`Service`](service::Service) is a trait representing an asynchronous
//! function of a request to a response. It's similar to
//! `async fn(Request) -> Result<Response, Error>`.
//! - A [`MakeService`](service::MakeService) is a trait creating specific
//! instances of a... |
//! Task notification
cfg_target_has_atomic! {
#[cfg(feature = "alloc")]
mod arc_wake;
#[cfg(feature = "alloc")]
pub use self::arc_wake::ArcWake;
#[cfg(feature = "alloc")]
mod waker;
#[cfg(feature = "alloc")]
pub use self::waker::waker;
#[cfg(feature = "alloc")]
mod waker_ref;... |
#![deny(
clippy::all,
clippy::pedantic,
clippy::nursery,
// TODO(thlorenz): prepare toml to publish
// clippy::cargo
)]
// clippy::restriction,
#![deny(
clippy::as_conversions,
clippy::clone_on_ref_ptr,
clippy::create_dir,
clippy::dbg_macro,
clippy::decimal_literal_representation... |
use std::collections::HashSet;
use ocl::{self, builders::KernelBuilder};
use crate::{Push, filter::Filter};
/// Filter that doesn't change picture. Used as a placeholder.
#[derive(Default)]
pub struct IdentityFilter {}
impl IdentityFilter {
pub fn new() -> Self {
Self {}
}
}
impl Filter for Identity... |
use super::{Dispatch, NodeId, QueryId, ShardId, State};
use crate::{NodeQueue, NodeQueueEntry, NodeStatus, NodeThreadPool};
use std::cell::RefCell;
use std::collections::HashSet;
use rand_chacha::{rand_core::SeedableRng, ChaChaRng};
use simrs::{Key, QueueId};
/// Always selects the node with the fewer requests in th... |
#[macro_use]
mod common;
use common::util::*;
static UTIL_NAME: &'static str = "sum";
#[test]
fn test_bsd_single_file() {
let (at, mut ucmd) = testing(UTIL_NAME);
let result = ucmd.arg("lorem_ipsum.txt").run();
assert_empty_stderr!(result);
assert!(result.success);
assert_eq!(result.stdout, at.r... |
use input_i_scanner::InputIScanner;
fn main() {
let stdin = std::io::stdin();
let mut _i_i = InputIScanner::from(stdin.lock());
macro_rules! scan {
(($($t: ty),+)) => {
($(scan!($t)),+)
};
($t: ty) => {
_i_i.scan::<$t>() as $t
};
(($($t: ty),... |
#[path = "with_atom_module/with_atom_function.rs"]
mod with_atom_function;
// `without_atom_function_errors_badarg` in unit tests
|
#[doc = r"Value read from the register"]
pub struct R {
bits: u16,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u16,
}
impl super::DMACTL3 {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, ... |
use bigdecimal::BigDecimal;
use crate::decode::Decode;
use crate::encode::Encode;
use crate::io::Buf;
use crate::mysql::protocol::TypeId;
use crate::mysql::{MySql, MySqlData, MySqlTypeInfo, MySqlValue};
use crate::types::Type;
use crate::Error;
use std::str::FromStr;
impl Type<MySql> for BigDecimal {
fn type_info... |
/// Implement the trait IntoTab
///
use core::Core;
pub trait IntoTab {
fn into_tab(&self) -> Vec<Vec<Core>>;
}
impl IntoTab for Vec<Core> {
fn into_tab(&self) -> Vec<Vec<Core>> {
let mut res = Vec::new();
res.push(self.to_vec());
res
}
}
impl IntoTab for Vec<Vec<Core>> {
fn i... |
use shipyard::*;
use derive_deref::{Deref, DerefMut};
use shipyard_scenegraph::prelude::*;
use crate::mainloop::UpdateTick;
use nalgebra::{Unit, UnitQuaternion, Vector3};
#[derive(Component, Clone, Deref, DerefMut)]
pub struct Spin(pub f64);
pub fn spin_sys(
tick: UniqueView<UpdateTick>,
mut rotations: ViewMu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.