pub struct PgListen { /* private fields */ }
Available on crate feature
postgres
only.Expand description
A listener that listens to Postgres notifications
Implementations§
Source§impl PgListen
impl PgListen
Sourcepub async fn new(pool: PgPool) -> Result<Self, Error>
pub async fn new(pool: PgPool) -> Result<Self, Error>
Build a new listener.
Maintaining a connection can be expensive, its encouraged you only create one PgListen and share it with multiple PostgresStorage
Sourcepub fn subscribe_with<T>(&mut self, storage: &mut PostgresStorage<T>)
pub fn subscribe_with<T>(&mut self, storage: &mut PostgresStorage<T>)
Add a new subscription with a storage
Sourcepub fn subscribe(&mut self, namespace: &str) -> PgSubscription
pub fn subscribe(&mut self, namespace: &str) -> PgSubscription
Add a new subscription
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PgListen
impl !RefUnwindSafe for PgListen
impl Send for PgListen
impl Sync for PgListen
impl Unpin for PgListen
impl !UnwindSafe for PgListen
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
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