[−][src]Struct sqlx::postgres::PgListener
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]
feature="postgres"
only.pub async fn from_pool(
pool: &'_ Pool<PgConnection>
) -> Result<PgListener, Error>
[src]
pool: &'_ Pool<PgConnection>
) -> Result<PgListener, Error>
feature="postgres"
only.pub async fn listen(&'_ mut self, channel: &'_ str) -> Result<(), Error>
[src]
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]
&'_ mut self,
channels: impl IntoIterator<Item = &'_ str>
) -> Result<(), Error>
feature="postgres"
only.Starts listening for notifications on all channels.
pub async fn unlisten(&'_ mut self, channel: &'_ str) -> Result<(), Error>
[src]
feature="postgres"
only.Stops listening for notifications on a channel.
pub async fn unlisten_all(&'_ mut self) -> Result<(), Error>
[src]
feature="postgres"
only.Stops listening for notifications on all channels.
pub async fn recv(&'_ mut self) -> Result<PgNotification<'_>, Error>
[src]
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]
self
) -> impl Unpin + Stream<Item = Result<PgNotification<'static>, Error>>
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.
fn execute<'e, 'q, 'c, E>(
&'c mut self,
query: E
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'e + Send>> where
'q: 'e,
'c: 'e,
E: 'e + Execute<'q, <PgListener as Executor>::Database>,
[src]
&'c mut self,
query: E
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'e + Send>> where
'q: 'e,
'c: 'e,
E: 'e + Execute<'q, <PgListener as Executor>::Database>,
fn fetch<'q, E>(&mut self, query: E) -> PgCursor<'q> where
E: Execute<'q, <PgListener as Executor>::Database>,
[src]
E: Execute<'q, <PgListener as Executor>::Database>,
impl<'c> RefExecutor<'c> for &'c mut PgListener
[src]
type Database = Postgres
fn fetch_by_ref<'q, E>(self, query: E) -> PgCursor<'c, 'q> where
E: Execute<'q, <&'c mut PgListener as RefExecutor<'c>>::Database>,
[src]
E: Execute<'q, <&'c mut PgListener as RefExecutor<'c>>::Database>,
Auto Trait Implementations
impl !RefUnwindSafe for PgListener
impl Send for PgListener
impl Sync for PgListener
impl Unpin for PgListener
impl !UnwindSafe for PgListener
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,