pub struct UnboundedMailbox<T>(/* private fields */);Expand description
A mailbox wraps an unbounded sender for messages of type T.
Implementations§
Source§impl<C: PublicKey> UnboundedMailbox<Message<C>>
impl<C: PublicKey> UnboundedMailbox<Message<C>>
Sourcepub async fn connect(&mut self, public_key: C, dialer: bool) -> Option<Info<C>>
pub async fn connect(&mut self, public_key: C, dialer: bool) -> Option<Info<C>>
Send a Connect message to the tracker and receive the greeting info.
Returns Some(info) if the peer is eligible, None if the channel was
dropped (peer not eligible or tracker shut down).
Sourcepub fn construct(&mut self, public_key: C, peer: Mailbox<Message<C>>)
pub fn construct(&mut self, public_key: C, peer: Mailbox<Message<C>>)
Send a Construct message to the tracker.
Sourcepub fn bit_vec(&mut self, bit_vec: BitVec, peer: Mailbox<Message<C>>)
pub fn bit_vec(&mut self, bit_vec: BitVec, peer: Mailbox<Message<C>>)
Send a BitVec message to the tracker.
Sourcepub async fn dialable(&mut self) -> Vec<C>
pub async fn dialable(&mut self) -> Vec<C>
Request a list of dialable peers from the tracker.
Returns an empty list if the tracker is shut down.
Sourcepub async fn dial(&mut self, public_key: C) -> Option<Reservation<C>>
pub async fn dial(&mut self, public_key: C) -> Option<Reservation<C>>
Send a Dial message to the tracker.
Returns None if the tracker is shut down.
Sourcepub async fn acceptable(&mut self, public_key: C) -> bool
pub async fn acceptable(&mut self, public_key: C) -> bool
Send an Acceptable message to the tracker.
Returns false if the tracker is shut down.
Source§impl<C: PublicKey> UnboundedMailbox<Message<C>>
impl<C: PublicKey> UnboundedMailbox<Message<C>>
Sourcepub fn connect(&mut self, public_key: C, peer: Mailbox<Message>)
pub fn connect(&mut self, public_key: C, peer: Mailbox<Message>)
Send a Connect message to the tracker.
Sourcepub async fn dialable(&mut self) -> Vec<C>
pub async fn dialable(&mut self) -> Vec<C>
Request a list of dialable peers from the tracker.
Returns an empty list if the tracker is shut down.
Sourcepub async fn dial(&mut self, public_key: C) -> Option<(Reservation<C>, Ingress)>
pub async fn dial(&mut self, public_key: C) -> Option<(Reservation<C>, Ingress)>
Send a Dial message to the tracker.
Returns None if the tracker is shut down.
Sourcepub async fn acceptable(&mut self, public_key: C, source_ip: IpAddr) -> bool
pub async fn acceptable(&mut self, public_key: C, source_ip: IpAddr) -> bool
Send an Acceptable message to the tracker.
Returns false if the tracker is shut down.
Source§impl<T> UnboundedMailbox<T>
impl<T> UnboundedMailbox<T>
Sourcepub fn new() -> (Self, UnboundedReceiver<T>)
pub fn new() -> (Self, UnboundedReceiver<T>)
Returns a new mailbox with the given sender.
Trait Implementations§
Source§impl<T> Clone for UnboundedMailbox<T>
impl<T> Clone for UnboundedMailbox<T>
Auto Trait Implementations§
impl<T> Freeze for UnboundedMailbox<T>
impl<T> !RefUnwindSafe for UnboundedMailbox<T>
impl<T> Send for UnboundedMailbox<T>where
T: Send,
impl<T> Sync for UnboundedMailbox<T>where
T: Send,
impl<T> Unpin for UnboundedMailbox<T>
impl<T> !UnwindSafe for UnboundedMailbox<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more