pub struct Interchange<Rq, Rp, const N: usize> { /* private fields */ }Expand description
Set of N channels
Channels can be claimed with claim()
static interchange: Interchange<Request, Response,10> = Interchange::new();
for i in 0..10 {
    let rq: Requester<'_, Request, Response>;
    let rp: Responder<'_, Request, Response>;
    (rq, rp) = interchange.claim().unwrap() ;
}Implementations§
Source§impl<Rq, Rp, const N: usize> Interchange<Rq, Rp, N>
 
impl<Rq, Rp, const N: usize> Interchange<Rq, Rp, N>
Sourcepub fn claim(&self) -> Option<(Requester<'_, Rq, Rp>, Responder<'_, Rq, Rp>)>
 
pub fn claim(&self) -> Option<(Requester<'_, Rq, Rp>, Responder<'_, Rq, Rp>)>
Claim one of the channels of the interchange. Returns None if called more than N times.
Sourcepub const fn as_interchange_ref(&self) -> InterchangeRef<'_, Rq, Rp>
 
pub const fn as_interchange_ref(&self) -> InterchangeRef<'_, Rq, Rp>
Returns a reference to the interchange with the N const-generic removed.
This can avoid the requirement to have const N: usize everywhere
static INTERCHANGE_INNER: Interchange<Request, Response, 1> = Interchange::new();
// The size of the interchange is absent from the type
static INTERCHANGE: InterchangeRef<'static, Request, Response> = INTERCHANGE_INNER.as_interchange_ref();
let (mut rq, mut rp) = INTERCHANGE.claim().unwrap();Trait Implementations§
Auto Trait Implementations§
impl<Rq, Rp, const N: usize> !Freeze for Interchange<Rq, Rp, N>
impl<Rq, Rp, const N: usize> !RefUnwindSafe for Interchange<Rq, Rp, N>
impl<Rq, Rp, const N: usize> Send for Interchange<Rq, Rp, N>
impl<Rq, Rp, const N: usize> Sync for Interchange<Rq, Rp, N>
impl<Rq, Rp, const N: usize> Unpin for Interchange<Rq, Rp, N>
impl<Rq, Rp, const N: usize> UnwindSafe for Interchange<Rq, Rp, N>where
    Rq: UnwindSafe,
    Rp: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more