pub struct NoticeQueue { /* private fields */ }Expand description
The notices a session queues for its client, in the order they arrive. A notice below the session’s client_min_messages is dropped as it arrives, as PostgreSQL decides whether a report reaches the client when it raises it (errstart), so a level that a function sets for its own body silences only the notices raised there.
Implementations§
Source§impl NoticeQueue
impl NoticeQueue
Sourcepub fn new(client_level: Arc<AtomicU8>) -> Self
pub fn new(client_level: Arc<AtomicU8>) -> Self
A queue that reads the session’s client_min_messages from client_level.
Sourcepub fn push(&self, notice: SQLNotice)
pub fn push(&self, notice: SQLNotice)
Queue notice after the notices queued before it, unless its level does not reach the client.
Sourcepub fn try_take_with<T, E>(
&self,
prepare: impl FnOnce(&SQLNotice) -> Result<T, E>,
) -> Result<Option<(SQLNotice, T)>, E>
pub fn try_take_with<T, E>( &self, prepare: impl FnOnce(&SQLNotice) -> Result<T, E>, ) -> Result<Option<(SQLNotice, T)>, E>
Admit one transfer before removing the oldest notice. Rejection or unwinding leaves the
queue unchanged. prepare runs under the queue lock and must not reenter the queue or
execute statements that can emit notices. Success moves the original notice without
copying its fields or shifting the remaining queue.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for NoticeQueue
impl !RefUnwindSafe for NoticeQueue
impl Send for NoticeQueue
impl Sync for NoticeQueue
impl Unpin for NoticeQueue
impl UnsafeUnpin for NoticeQueue
impl UnwindSafe for NoticeQueue
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