pub struct PrepareContext { /* private fields */ }Expand description
Captures connection settings at statement preparation time for cache invalidation.
This struct is used to detect when a cached prepared statement needs to be recompiled
because relevant connection settings have changed. When matches_connection() returns
false, the statement will be automatically reprepared before execution.
§Adding New Fields
If you add a new setting to Connection that affects statement compilation or execution,
When adding a new connection setting that affects query compilation, you MUST call
bump_prepare_context_generation() in its setter so that prepared statements know
they need to be reprepared.
Implementations§
Source§impl PrepareContext
impl PrepareContext
pub fn from_connection(connection: &Connection) -> Self
pub fn matches_connection(&self, connection: &Connection) -> bool
Trait Implementations§
Source§impl Clone for PrepareContext
impl Clone for PrepareContext
Source§fn clone(&self) -> PrepareContext
fn clone(&self) -> PrepareContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PrepareContext
impl Debug for PrepareContext
Source§impl PartialEq for PrepareContext
impl PartialEq for PrepareContext
Source§fn eq(&self, other: &PrepareContext) -> bool
fn eq(&self, other: &PrepareContext) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for PrepareContext
impl StructuralPartialEq for PrepareContext
Auto Trait Implementations§
impl Freeze for PrepareContext
impl RefUnwindSafe for PrepareContext
impl Send for PrepareContext
impl Sync for PrepareContext
impl Unpin for PrepareContext
impl UnsafeUnpin for PrepareContext
impl UnwindSafe for PrepareContext
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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