Struct instance_chart::Notify
source · pub struct Notify<const N: usize, T: Debug + Clone>(_);Expand description
Wait for notifications of new discoveries, buffering up to 16 discoveries, created using
Chart::notify().
Implementations§
source§impl<T: Debug + Clone> Notify<1, T>
impl<T: Debug + Clone> Notify<1, T>
sourcepub async fn recv_one(&mut self) -> Result<(Id, IpAddr, T), RecvError>
pub async fn recv_one(&mut self) -> Result<(Id, IpAddr, T), RecvError>
await the next discovered instance. Returns the id and custom messag for new node when it is discovered.
Note
Can only be called on a
Notify for a chart created with ChartBuilder::custom_msg()
Errors
If more the 16 discoveries have been made since this was called this returns
RecvError::Lagged
source§impl<const N: usize, T: Debug + Clone> Notify<N, T>
impl<const N: usize, T: Debug + Clone> Notify<N, T>
sourcepub async fn recv(&mut self) -> Result<(Id, IpAddr, [T; N]), RecvError>
pub async fn recv(&mut self) -> Result<(Id, IpAddr, [T; N]), RecvError>
await the next discovered instance. Returns the id and custom messages for new node when it is discovered.
Note
Can only be called on a
Notify for a chart created with ChartBuilder::custom_msg()
Errors
If more the 16 discoveries have been made since this was called this returns
RecvError::Lagged
sourcepub async fn recv_nth<const IDX: usize>(
&mut self
) -> Result<(Id, IpAddr, T), RecvError>
pub async fn recv_nth<const IDX: usize>( &mut self ) -> Result<(Id, IpAddr, T), RecvError>
await the next discovered instance. Returns the id and nth custom messages for new node when it is discovered.
Note
Can only be called on a
Notify for a chart created with ChartBuilder::custom_msg()
Errors
If more the 16 discoveries have been made since this was called this returns
RecvError::Lagged
source§impl Notify<1, u16>
impl Notify<1, u16>
sourcepub async fn recv_addr(&mut self) -> Result<(Id, SocketAddr), RecvError>
pub async fn recv_addr(&mut self) -> Result<(Id, SocketAddr), RecvError>
await the next discovered instance. Returns the id and service adresses for new node when it is discovered.
Note
Can only be called on a
Notify for a chart created with ChartBuilder::finish()
that had as single service port set.
Errors
If more the 16 discoveries have been made since this was called this returns
RecvError::Lagged
source§impl<const N: usize> Notify<N, u16>
impl<const N: usize> Notify<N, u16>
sourcepub async fn recv_addresses(
&mut self
) -> Result<(Id, [SocketAddr; N]), RecvError>
pub async fn recv_addresses( &mut self ) -> Result<(Id, [SocketAddr; N]), RecvError>
await the next discovered instance. Buffers up to 16 discoveries. Returns the id and service adresseses for new node when it is discovered.
Note
Can only be called on a
Notify for a chart created with ChartBuilder::finish()
that had multiple service ports set.
Errors
If more the 16 discoveries have been made since this was called this returns
RecvError::Lagged
sourcepub async fn recv_nth_addr<const IDX: usize>(
&mut self
) -> Result<(Id, SocketAddr), RecvError>
pub async fn recv_nth_addr<const IDX: usize>( &mut self ) -> Result<(Id, SocketAddr), RecvError>
await the next discovered instance. Buffers up to 16 discoveries. Returns the id and nth service adresses for new node when it is discovered.
Note
Can only be called on a
Notify for a chart created with ChartBuilder::finish()
that had multiple service ports set.
Errors
If more the 16 discoveries have been made since this was called this returns
RecvError::Lagged