[][src]Struct sqlx::postgres::PgListener

pub struct PgListener { /* fields omitted */ }
This is supported on feature="postgres" only.

A stream of asynchronous notifications from Postgres.

This listener will auto-reconnect. If the active connection being used ever dies, this listener will detect that event, create a new connection, will re-subscribe to all of the originally specified channels, and will resume operations as normal.

Methods

impl PgListener[src]

pub async fn new(url: &'_ str) -> Result<PgListener, Error>[src]

This is supported on feature="postgres" only.

pub async fn from_pool(
    pool: &'_ Pool<PgConnection>
) -> Result<PgListener, Error>
[src]

This is supported on feature="postgres" only.

pub async fn listen(&'_ mut self, channel: &'_ str) -> Result<(), Error>[src]

This is supported on feature="postgres" only.

Starts listening for notifications on a channel.

pub async fn listen_all<'_>(
    &'_ mut self,
    channels: impl IntoIterator<Item = &'_ str>
) -> Result<(), Error>
[src]

This is supported on feature="postgres" only.

Starts listening for notifications on all channels.

pub async fn unlisten(&'_ mut self, channel: &'_ str) -> Result<(), Error>[src]

This is supported on feature="postgres" only.

Stops listening for notifications on a channel.

pub async fn unlisten_all(&'_ mut self) -> Result<(), Error>[src]

This is supported on feature="postgres" only.

Stops listening for notifications on all channels.

pub async fn recv(&'_ mut self) -> Result<PgNotification<'_>, Error>[src]

This is supported on feature="postgres" only.

Receives the next notification available from any of the subscribed channels.

pub fn into_stream(
    self
) -> impl Unpin + Stream<Item = Result<PgNotification<'static>, Error>>
[src]

This is supported on feature="postgres" only.

Consume this listener, returning a Stream of notifications.

Trait Implementations

impl Executor for PgListener[src]

type Database = Postgres

The specific database that this type is implemented for.

impl<'c> RefExecutor<'c> for &'c mut PgListener[src]

type Database = Postgres

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,