Struct xitca_postgres::statement::StatementGuarded

source ·
pub struct StatementGuarded<'a, C>
where C: Prepare,
{ /* private fields */ }
Expand description

a statement guard contains a prepared postgres statement. the guard can be dereferenced or borrowed as Statement which can be used for query apis.

the guard would cancel it’s statement when dropped. generic C type must be a client type impl Prepare trait to instruct the cancellation.

Implementations§

source§

impl<C> StatementGuarded<'_, C>
where C: Prepare,

source

pub fn leak(self) -> Statement

Leak the statement and it would not be cancelled for current connection. does not cause memory leak.

Methods from Deref<Target = Statement>§

source

pub fn params(&self) -> &[Type]

Returns the expected types of the statement’s parameters.

source

pub fn columns(&self) -> &[Column]

Returns information about the columns returned when the statement is queried.

Trait Implementations§

source§

impl<C> AsRef<Statement> for StatementGuarded<'_, C>
where C: Prepare,

source§

fn as_ref(&self) -> &Statement

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<C> Deref for StatementGuarded<'_, C>
where C: Prepare,

source§

type Target = Statement

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<C> Drop for StatementGuarded<'_, C>
where C: Prepare,

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<C> Encode for &StatementGuarded<'_, C>
where C: Prepare,

source§

fn encode<I, const SYNC_MODE: bool>( self, params: I, buf: &mut BytesMut, ) -> Result<(), Error>
where I: AsParams,

Auto Trait Implementations§

§

impl<'a, C> Freeze for StatementGuarded<'a, C>

§

impl<'a, C> RefUnwindSafe for StatementGuarded<'a, C>
where C: RefUnwindSafe,

§

impl<'a, C> Send for StatementGuarded<'a, C>

§

impl<'a, C> Sync for StatementGuarded<'a, C>

§

impl<'a, C> Unpin for StatementGuarded<'a, C>

§

impl<'a, C> UnwindSafe for StatementGuarded<'a, C>
where C: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

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

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more