1 //! Defines the Result type and HCI errors 2 3 use futures::channel::oneshot; 4 use std::fmt::Debug; 5 use thiserror::Error; 6 use tokio::sync::mpsc::error::SendError; 7 use tokio::sync::oneshot::error::RecvError; 8 9 /// Result type 10 pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>; 11 12 /// HCI errors 13 #[derive(Error, Debug)] 14 pub enum HciError<T: Debug + 'static> { 15 /// Error when sending on a bounded channel 16 #[error("Error sending: {0}")] 17 BoundedSendError(#[from] SendError<T>), 18 /// Error when sending on a oneshot channel 19 #[error("Error sending: {0}")] 20 OneshotSendError(#[from] oneshot::Canceled), 21 /// Error receiving from a channel 22 #[error("Error receiving: {0}")] 23 ChannelRecvError(#[from] RecvError), 24 } 25