#[non_exhaustive]pub enum PgListenerEvent {
Notification(PgNotification),
#[non_exhaustive] Disconnected {
error: String,
},
Reconnected,
#[non_exhaustive] Lagged {
dropped: u64,
},
#[non_exhaustive] ChannelsDropped {
channels: Vec<String>,
},
}Expand description
An event delivered by PgListener::recv.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Notification(PgNotification)
A notification on a channel this listener is subscribed to.
#[non_exhaustive]Disconnected
The connection was lost and the listener is reconnecting (only with
PgListenerOptions::reconnect enabled). Notifications sent while
it is disconnected are missed until the
Reconnected that follows. Reported once per
outage, as soon as the loss is detected, so an application can react
while reconnecting is still failing; if reconnecting gives up,
PgListener::recv returns the error instead of a Reconnected.
Not reported when the listener is dropped.
Notifications the lost connection had already received can still
be returned after this event (when the loss was detected by an
unanswered ping or command, the old connection’s buffered messages
may be decoded and queued while its driver task is being stopped).
They always come before the Reconnected.
Fields
This variant is marked as non-exhaustive
Reconnected
The connection was lost and re-established; notifications sent in between were missed. Resynchronise any state derived from them.
#[non_exhaustive]Lagged
The notification queue overflowed and dropped notifications were
discarded. Resynchronise any state derived from them.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]ChannelsDropped
After a reconnect, the server refused to subscribe these channels
again (for example names its encoding cannot represent); they are no
longer tracked and receive nothing until listened to again. Reported
right before the Reconnected of that
reconnect.
Fields
This variant is marked as non-exhaustive
Implementations§
Source§impl PgListenerEvent
Constructors for the #[non_exhaustive] variants, for tests and fakes of
code that consumes PgListenerEvents (like PgNotification::new).
impl PgListenerEvent
Constructors for the #[non_exhaustive] variants, for tests and fakes of
code that consumes PgListenerEvents (like PgNotification::new).
Sourcepub fn disconnected(error: impl Into<String>) -> Self
pub fn disconnected(error: impl Into<String>) -> Self
A Disconnected event with this cause.
Sourcepub fn channels_dropped<I, S>(channels: I) -> Self
pub fn channels_dropped<I, S>(channels: I) -> Self
A ChannelsDropped event for channels.
Trait Implementations§
Source§impl Clone for PgListenerEvent
impl Clone for PgListenerEvent
Source§impl Debug for PgListenerEvent
impl Debug for PgListenerEvent
impl Eq for PgListenerEvent
Source§impl PartialEq for PgListenerEvent
impl PartialEq for PgListenerEvent
impl StructuralPartialEq for PgListenerEvent
Auto Trait Implementations§
impl Forget for PgListenerEvent
impl Freeze for PgListenerEvent
impl Move for PgListenerEvent
impl RefUnwindSafe for PgListenerEvent
impl Send for PgListenerEvent
impl Sync for PgListenerEvent
impl Unpin for PgListenerEvent
impl UnsafeUnpin for PgListenerEvent
impl UnwindSafe for PgListenerEvent
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.