feat: split tx/rx generic in controller

This commit is contained in:
əlemi 2024-10-03 00:24:10 +02:00
parent ddbad59ae2
commit c0bc92e812
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -26,7 +26,11 @@ use crate::errors::ControllerResult;
/// [`crate::ext::select_buffer`] may provide a useful helper for managing multiple controllers. /// [`crate::ext::select_buffer`] may provide a useful helper for managing multiple controllers.
#[allow(async_fn_in_trait)] #[allow(async_fn_in_trait)]
#[cfg_attr(feature = "async-trait", async_trait::async_trait)] #[cfg_attr(feature = "async-trait", async_trait::async_trait)]
pub trait Controller<T : Sized + Send + Sync> : AsyncSender<T> + AsyncReceiver<T> {} pub trait Controller<Tx, Rx = Tx> : AsyncSender<Tx> + AsyncReceiver<Rx>
where
Tx: Sized + Sync + Send,
Rx: Sized + Sync + Send,
{}
/// Asynchronous and thread-safe handle to send data over a stream. /// Asynchronous and thread-safe handle to send data over a stream.
/// See [`Controller`]'s documentation for details. /// See [`Controller`]'s documentation for details.