Skip to main content

ResourceConnection

Struct ResourceConnection 

Source
pub struct ResourceConnection<'id, S, P, C> { /* private fields */ }
Expand description

A connection paired with its generative statement and portal namespace.

Implementations§

Source§

impl<'id, S, P, C> ResourceConnection<'id, S, P, C>

Source

pub const fn connection(&self) -> &Conn<S, P, C>

Borrows the typed connection for transport-only operations such as buffering a frame returned by this wrapper.

Source

pub const fn connection_mut(&mut self) -> &mut Conn<S, P, C>

Mutably borrows the typed connection for transport-only operations such as buffering and flushing returned frames.

Source

pub fn statement_is_live(&self, statement: &PreparedStatement<'id>) -> bool

Reports whether a prepared-statement token is still live in this connection’s namespace.

Source

pub fn portal_is_live(&self, portal: &Portal<'id>) -> bool

Reports whether a portal token is still live in this connection’s namespace.

Source

pub fn into_connection(self) -> Conn<S, P, C>

Deliberately leaves resource-aware handling while retaining typestate.

Source§

impl<'id, S, C> ResourceConnection<'id, S, Building, C>

Source

pub fn prepare( self, client_name: Bytes, upstream_name: Bytes, query: Bytes, parameter_types: Vec<u32>, ) -> PrepareResult<'id, S>

Creates and sends a branded prepared statement on this connection.

§Errors

Returns namespace or wire reconstruction errors.

Source

pub fn bind( self, statement: &PreparedStatement<'id>, client_name: Bytes, upstream_name: Bytes, parameter_formats: Vec<i16>, parameters: Vec<Option<Bytes>>, result_formats: Vec<i16>, ) -> BindResult<'id, S>

Creates and sends a branded portal on this connection.

§Errors

Returns namespace or wire reconstruction errors.

Source

pub fn describe_statement( self, statement: &PreparedStatement<'id>, ) -> Result<(Self, Frame), ResourceProtocolError>

Describes only a live statement from this connection.

§Errors

Returns an error for a stale statement or invalid wire value.

Source

pub fn close_statement( self, statement: PreparedStatement<'id>, ) -> Result<(Self, Frame), ResourceProtocolError>

Closes a live statement and invalidates its token.

§Errors

Returns an error for a stale statement or invalid wire value.

Source

pub fn close_portal( self, portal: Portal<'id>, ) -> Result<(Self, Frame), ResourceProtocolError>

Closes a live portal and invalidates its token.

§Errors

Returns an error for a stale portal or invalid wire value.

Source

pub fn flush(self) -> (Self, Frame)

Emits Flush without changing resource or phase evidence.

Source

pub fn sync(self) -> (ResourceConnection<'id, S, AwaitingReady, C>, Frame)

Emits Sync while retaining the namespace through response consumption.

Source§

impl<'id, S, C> ResourceConnection<'id, S, Ready, C>

Source

pub fn begin_extended(self) -> ResourceConnection<'id, S, Building, C>

Begins another extended-query cycle with the same resource namespace.

Source

pub fn query( self, query: &[u8], ) -> Result<(ResourceConnection<'id, S, SimpleQuery, Dirty>, Frame), ResourceProtocolError>

Begins a simple query and invalidates the unnamed prepared statement.

§Errors

Returns an error if the query cannot be reconstructed on the wire.

Source§

impl<'id, S, C> ResourceConnection<'id, S, BoundBuilding, C>

Source

pub fn prepare( self, client_name: Bytes, upstream_name: Bytes, query: Bytes, parameter_types: Vec<u32>, ) -> BoundPrepareResult<'id, S>

Creates another prepared statement while retaining executable portals.

§Errors

Returns namespace or wire reconstruction errors.

Source

pub fn bind( self, statement: &PreparedStatement<'id>, client_name: Bytes, upstream_name: Bytes, parameter_formats: Vec<i16>, parameters: Vec<Option<Bytes>>, result_formats: Vec<i16>, ) -> RebindResult<'id, S>

Creates another portal while retaining prior live portals.

§Errors

Returns namespace or wire reconstruction errors.

Source

pub fn describe_statement( self, statement: &PreparedStatement<'id>, ) -> Result<(Self, Frame), ResourceProtocolError>

Describes only a live statement from this connection.

§Errors

Returns an error for a stale statement or invalid wire value.

Source

pub fn describe_portal( self, portal: &Portal<'id>, ) -> Result<(Self, Frame), ResourceProtocolError>

Describes only a live portal from this connection.

§Errors

Returns an error for a stale portal or invalid wire value.

Source

pub fn execute( self, portal: &Portal<'id>, max_rows: i32, ) -> Result<(Self, Frame), ResourceProtocolError>

Sends an execute which can name only a live portal from this connection.

§Errors

Returns an error for a stale portal or invalid wire value.

Source

pub fn close_statement( self, statement: PreparedStatement<'id>, ) -> Result<(Self, Frame), ResourceProtocolError>

Closes a live statement and invalidates its token.

§Errors

Returns an error for a stale statement or invalid wire value.

Source

pub fn close_portal( self, portal: Portal<'id>, ) -> Result<(Self, Frame), ResourceProtocolError>

Closes a live portal and invalidates its token.

§Errors

Returns an error for a stale portal or invalid wire value.

Source

pub fn flush(self) -> (Self, Frame)

Emits Flush without changing resource or phase evidence.

Source

pub fn sync(self) -> (ResourceConnection<'id, S, AwaitingReady, C>, Frame)

Emits Sync while retaining the namespace through response consumption.

Source§

impl<'id, S, C> ResourceConnection<'id, S, AwaitingReady, C>

Source

pub fn offer(self, item: SessionItem) -> ResourceAwaitingTransition<'id, S, C>

Consumes one backend response while retaining the branded namespace.

Source§

impl<'id, S, C> ResourceConnection<'id, S, Draining, C>

Source

pub fn offer(self, item: SessionItem) -> ResourceDrainingTransition<'id, S, C>

Drains one backend response after an error while retaining resources.

Trait Implementations§

Source§

impl<'id, S: Debug, P: Debug, C: Debug> Debug for ResourceConnection<'id, S, P, C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'id, S, P, C> !RefUnwindSafe for ResourceConnection<'id, S, P, C>

§

impl<'id, S, P, C> !Sync for ResourceConnection<'id, S, P, C>

§

impl<'id, S, P, C> Freeze for ResourceConnection<'id, S, P, C>
where S: Freeze,

§

impl<'id, S, P, C> Send for ResourceConnection<'id, S, P, C>
where S: Send, P: Send, C: Send,

§

impl<'id, S, P, C> Unpin for ResourceConnection<'id, S, P, C>
where S: Unpin, P: Unpin, C: Unpin,

§

impl<'id, S, P, C> UnsafeUnpin for ResourceConnection<'id, S, P, C>
where S: UnsafeUnpin,

§

impl<'id, S, P, C> UnwindSafe for ResourceConnection<'id, S, P, C>
where S: UnwindSafe, P: UnwindSafe, C: UnwindSafe,

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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, 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.