Skip to main content

ResourceScope

Struct ResourceScope 

Source
pub struct ResourceScope<'id> { /* private fields */ }
Expand description

Connection-local statement and portal namespaces.

Implementations§

Source§

impl<'id> ResourceScope<'id>

Source

pub fn simple_query_boundary(&mut self)

Records a simple-query boundary, which destroys the unnamed statement.

Source

pub fn transaction_ended(&mut self)

Records transaction end, which destroys the unnamed portal.

Source

pub fn prepare( &mut self, client_name: Bytes, upstream_name: Bytes, query: Bytes, parameter_types: Vec<u32>, ) -> Result<(PreparedStatement<'id>, Parse), ResourceError>

Allocates a statement token and reconstructable upstream Parse message.

§Errors

Rejects duplicate upstream statement names.

Source

pub fn bind( &mut self, statement: &PreparedStatement<'id>, client_name: Bytes, upstream_name: Bytes, parameter_formats: Vec<i16>, parameters: Vec<Option<Bytes>>, result_formats: Vec<i16>, ) -> Result<(Portal<'id>, Bind), ResourceError>

Binds a branded statement into a rewritten portal namespace.

§Errors

Rejects statements not present in this scope and duplicate portal names.

Source

pub fn close_statement( &mut self, statement: PreparedStatement<'id>, ) -> Result<Close, ResourceError>

Closes a statement and removes its upstream name from this scope.

§Errors

Rejects a token which has already been closed.

Source

pub fn close_portal( &mut self, portal: Portal<'id>, ) -> Result<Close, ResourceError>

Closes a portal and removes its upstream name from this scope.

§Errors

Rejects a token which has already been closed.

Source

pub fn statement(&self, client_name: &[u8]) -> Option<PreparedStatement<'id>>

Resolves a client-visible statement name to its branded upstream token.

Source

pub fn portal(&self, client_name: &[u8]) -> Option<Portal<'id>>

Resolves a client-visible portal name to its branded upstream token.

Trait Implementations§

Source§

impl<'id> Debug for ResourceScope<'id>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'id> !RefUnwindSafe for ResourceScope<'id>

§

impl<'id> !Sync for ResourceScope<'id>

§

impl<'id> Freeze for ResourceScope<'id>

§

impl<'id> Send for ResourceScope<'id>

§

impl<'id> Unpin for ResourceScope<'id>

§

impl<'id> UnsafeUnpin for ResourceScope<'id>

§

impl<'id> UnwindSafe for ResourceScope<'id>

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.