pub struct CommandNotifications { /* private fields */ }Expand description
Notifications of new commands and posted named events (Postgres only): a dedicated
connection listening on COMMANDS_CHANNEL and EVENTS_CHANNEL.
Implementations§
Source§impl CommandNotifications
impl CommandNotifications
Sourcepub async fn next(&mut self) -> Result<Notified, DbError>
pub async fn next(&mut self) -> Result<Notified, DbError>
Waits for the next notification. A lost connection is re-established (a notification sent meanwhile is lost; polling picks the command up, the probe the event).
§Errors
DbError::Sqlx if the connection fails and can’t be re-established.
Sourcepub async fn skip_arrived(&mut self) -> bool
pub async fn skip_arrived(&mut self) -> bool
Takes the notifications that already arrived, without waiting: one tick handles every pending command, so a burst needs one tick, not one per command. Returns whether an event was among them.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CommandNotifications
impl !UnwindSafe for CommandNotifications
impl Freeze for CommandNotifications
impl Send for CommandNotifications
impl Sync for CommandNotifications
impl Unpin for CommandNotifications
impl UnsafeUnpin for CommandNotifications
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
Converts
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> ⓘ
Converts
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