Buttplug sex toy control library
at dev 911 B view raw
1// Buttplug Rust Source Code File - See https://buttplug.io for more info. 2// 3// Copyright 2016-2024 Nonpolynomial Labs LLC. All rights reserved. 4// 5// Licensed under the BSD 3-Clause license. See LICENSE file in the project root 6// for full license information. 7 8//! Protocol message and error definitions. 9 10pub mod connector; 11pub mod errors; 12pub mod message; 13pub mod util; 14 15#[macro_use] 16extern crate buttplug_derive; 17#[macro_use] 18extern crate strum_macros; 19 20use errors::ButtplugError; 21use futures::future::{self, BoxFuture, FutureExt}; 22 23pub type ButtplugResult<T = ()> = Result<T, ButtplugError>; 24pub type ButtplugResultFuture<T = ()> = BoxFuture<'static, ButtplugResult<T>>; 25 26impl<T> From<ButtplugError> for BoxFuture<'static, Result<T, ButtplugError>> 27where 28 T: Send + 'static, 29{ 30 fn from(error: ButtplugError) -> BoxFuture<'static, Result<T, ButtplugError>> { 31 future::ready(Err(error)).boxed() 32 } 33}