Skip to main content

Client

Struct Client 

Source
pub struct Client<Connector = (), Tls = ClientTlsPolicy, Authentication = TrustClientAuthentication, Middleware = IdentityHandler> { /* private fields */ }
Expand description

Reusable client-role component.

Implementations§

Source§

impl Client<()>

Source

pub fn builder() -> ClientBuilder

Starts client-role configuration.

Source§

impl<Connector, Tls, Authentication, Middleware, Work, Transport, Error> Client<Connector, Tls, Authentication, Middleware>
where Connector: Fn(&ConnectTarget) -> Work, Work: Future<Output = Result<Transport, Error>>, Transport: AsyncRead + AsyncWrite + Unpin, Authentication: ClientAuthentication, Tls: ClientTlsConfiguration, Middleware: MiddlewareFactory<ClientInitialContext>,

Source

pub async fn connect<State>( &self, target: ConnectTarget, overrides: StartupParameters, state: State, ) -> Result<ClientConnection<ClientTransport<Transport>, State, ConnectionClean, Authentication::Evidence, <Middleware as MiddlewareFactory<ClientInitialContext>>::Handler>, ConnectError<Error, ClientTlsError<<Tls::Provider as ClientTlsProvider>::Error>, ClientAuthenticationError<Authentication::Error>>>

Establishes transport, startup, and configured authentication before returning.

Per-call startup values explicitly override component defaults.

§Errors

Returns a connection-time error for connector, startup, framing, authentication, or readiness failures.

Source§

impl<Connector, Tls, Authentication, Middleware, Work, Transport, Error> Client<Connector, Tls, Authentication, Middleware>
where Connector: Fn(&ConnectTarget) -> Work, Work: Future<Output = Result<Transport, Error>>, Transport: AsyncWrite + Unpin,

Source

pub async fn cancel( &self, target: &ConnectTarget, key: &CancelKey, ) -> Result<(), CancelError<Error>>

Opens a fresh transport and writes exactly one raw cancellation packet.

Cancellation deliberately performs neither TLS negotiation nor startup authentication, as required by PostgreSQL’s out-of-band protocol.

§Errors

Returns the connector’s typed error or a cancellation encode/write error.

Trait Implementations§

Source§

impl<Connector: Clone, Tls: Clone, Authentication: Clone, Middleware: Clone> Clone for Client<Connector, Tls, Authentication, Middleware>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Connector, Tls: Debug, Authentication: Debug, Middleware> Debug for Client<Connector, Tls, Authentication, Middleware>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Connector, Tls, Authentication, Middleware> Freeze for Client<Connector, Tls, Authentication, Middleware>
where Connector: Freeze, Tls: Freeze, Authentication: Freeze, Middleware: Freeze,

§

impl<Connector, Tls, Authentication, Middleware> RefUnwindSafe for Client<Connector, Tls, Authentication, Middleware>
where Connector: RefUnwindSafe, Tls: RefUnwindSafe, Authentication: RefUnwindSafe, Middleware: RefUnwindSafe,

§

impl<Connector, Tls, Authentication, Middleware> Send for Client<Connector, Tls, Authentication, Middleware>
where Connector: Send, Tls: Send, Authentication: Send, Middleware: Send,

§

impl<Connector, Tls, Authentication, Middleware> Sync for Client<Connector, Tls, Authentication, Middleware>
where Connector: Sync, Tls: Sync, Authentication: Sync, Middleware: Sync,

§

impl<Connector, Tls, Authentication, Middleware> Unpin for Client<Connector, Tls, Authentication, Middleware>
where Connector: Unpin, Tls: Unpin, Authentication: Unpin, Middleware: Unpin,

§

impl<Connector, Tls, Authentication, Middleware> UnsafeUnpin for Client<Connector, Tls, Authentication, Middleware>
where Connector: UnsafeUnpin, Tls: UnsafeUnpin, Authentication: UnsafeUnpin, Middleware: UnsafeUnpin,

§

impl<Connector, Tls, Authentication, Middleware> UnwindSafe for Client<Connector, Tls, Authentication, Middleware>
where Connector: UnwindSafe, Tls: UnwindSafe, Authentication: UnwindSafe, Middleware: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.