pub struct NotificationSubscription { /* private fields */ }Expand description
An idle listener independent of the query session that created it. Close every retained handle before replacing a database file.
Implementations§
Source§impl NotificationSubscription
impl NotificationSubscription
pub fn identity(&self) -> &NotificationIdentity
Sourcepub fn poll(
&self,
) -> Result<Poll<Option<NotificationEvent>>, NotificationSubscriptionError>
pub fn poll( &self, ) -> Result<Poll<Option<NotificationEvent>>, NotificationSubscriptionError>
No database read, SQL execution or blocking receive is performed by this poll.
Sourcepub fn wait(
&self,
timeout: Duration,
) -> Result<NotificationWait, NotificationSubscriptionError>
pub fn wait( &self, timeout: Duration, ) -> Result<NotificationWait, NotificationSubscriptionError>
Receive without the caller’s transaction or SQL timeout. Timeout leaves this listener registered.
Sourcepub fn poll_with<T, E: From<NotificationSubscriptionError>>(
&self,
prepare: impl FnOnce(&SQLNotification) -> Result<T, E>,
) -> Result<NotificationReceive<T>, E>
pub fn poll_with<T, E: From<NotificationSubscriptionError>>( &self, prepare: impl FnOnce(&SQLNotification) -> Result<T, E>, ) -> Result<NotificationReceive<T>, E>
Poll with fallible destination admission under the inbox lock. prepare runs at most once,
only for a present event, and must not reenter this inbox or Engine. It may reserve storage;
it must not invoke host callbacks. Failure or unwinding preserves the event and sequence.
Sourcepub fn wait_with<T, E: From<NotificationSubscriptionError>>(
&self,
timeout: Duration,
prepare: impl FnOnce(&SQLNotification) -> Result<T, E>,
) -> Result<NotificationReceive<T>, E>
pub fn wait_with<T, E: From<NotificationSubscriptionError>>( &self, timeout: Duration, prepare: impl FnOnce(&SQLNotification) -> Result<T, E>, ) -> Result<NotificationReceive<T>, E>
Wait with the same admission contract as Self::poll_with. Timeout and closure do not
invoke prepare; all ordinary native receive and retained-failure semantics remain intact.
Sourcepub async fn next_event(
&self,
) -> Result<Option<NotificationEvent>, NotificationSubscriptionError>
pub async fn next_event( &self, ) -> Result<Option<NotificationEvent>, NotificationSubscriptionError>
Receive without blocking a thread or requiring a particular async runtime. At most one asynchronous receive may be pending; another returns InvalidRequest. Dropping a pending receive releases its wake slot without consuming an event or closing the listener.
pub fn is_closed(&self) -> bool
Sourcepub fn role_identity(&self) -> RoleIdentity
pub fn role_identity(&self) -> RoleIdentity
Preserve the exact effective SQL role selected at registration, including its incarnation.
Sourcepub fn stop_delivery(&self)
pub fn stop_delivery(&self)
End delivery and wake receivers without provider I/O. Runtime adapters must still call close off their event-loop worker and wait for it to finish; this signal retains registration resources and admission until that cleanup completes.
Trait Implementations§
Source§impl Drop for NotificationSubscription
impl Drop for NotificationSubscription
Auto Trait Implementations§
impl !Freeze for NotificationSubscription
impl !RefUnwindSafe for NotificationSubscription
impl !UnwindSafe for NotificationSubscription
impl Send for NotificationSubscription
impl Sync for NotificationSubscription
impl Unpin for NotificationSubscription
impl UnsafeUnpin for NotificationSubscription
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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