pub struct Listener { /* private fields */ }Expand description
A live LISTEN on the app’s queue channel.
Implementations§
Source§impl Listener
impl Listener
Sourcepub async fn connect(url: &str, channel: &str) -> Result<Self, QueueError>
pub async fn connect(url: &str, channel: &str) -> Result<Self, QueueError>
Open a dedicated connection and subscribe to channel.
Fails when the database is unreachable right now, which the caller
should treat as “run without notifications” rather than as a reason not
to start: a subscriber that polls every poll_secs still handles every
message, just later.
Sourcepub async fn recv(&mut self) -> Result<String, QueueError>
pub async fn recv(&mut self) -> Result<String, QueueError>
Wait for the next notification and return the topic it names.
The topic is a hint, not an instruction: the caller sweeps for whatever is claimable rather than trusting it, because a notification can be coalesced, arrive twice, or be for a topic whose row another replica has already taken. Treating it as data to act on would make the queue’s correctness depend on the one part of it that is allowed to be lost.
Auto Trait Implementations§
impl !RefUnwindSafe for Listener
impl !UnwindSafe for Listener
impl Freeze for Listener
impl Send for Listener
impl Sync for Listener
impl Unpin for Listener
impl UnsafeUnpin for Listener
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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