1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use aldrin_core::channel::{Bounded, Disconnected, Unbounded};
use aldrin_core::transport::AsyncTransport;
use std::fmt::Debug;

/// Asynchronous transport used for connections between test brokers and clients.
///
/// This trait is sealed and cannot be implemented for types outside of this crate. The transports
/// used in this crate are always based on the channels available in [`aldrin_core::channel`]. The
/// actual transport type used in this crate is `Box<dyn TestTransport>`.
pub trait TestTransport:
    Sealed + AsyncTransport<Error = Disconnected> + Debug + Unpin + Send + Sync
{
}

impl TestTransport for Bounded {}
impl TestTransport for Unbounded {}

pub trait Sealed {}

impl Sealed for Bounded {}
impl Sealed for Unbounded {}