pub struct Client<Connector = (), Tls = ClientTlsPolicy, Authentication = TrustClientAuthentication, Middleware = IdentityHandler> { /* private fields */ }Expand description
Reusable client-role component.
Implementations§
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>,
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>,
Sourcepub 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>>>where
<Middleware as MiddlewareFactory<ClientInitialContext>>::Handler: ClientMiddleware<State, ClientConnectionContext<Authentication::Evidence>>,
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>>>where
<Middleware as MiddlewareFactory<ClientInitialContext>>::Handler: ClientMiddleware<State, ClientConnectionContext<Authentication::Evidence>>,
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,
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,
Sourcepub async fn cancel(
&self,
target: &ConnectTarget,
key: &CancelKey,
) -> Result<(), CancelError<Error>>
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§
Auto Trait Implementations§
impl<Connector, Tls, Authentication, Middleware> Freeze for Client<Connector, Tls, Authentication, Middleware>
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>
impl<Connector, Tls, Authentication, Middleware> Sync for Client<Connector, Tls, Authentication, Middleware>
impl<Connector, Tls, Authentication, Middleware> Unpin for Client<Connector, Tls, Authentication, Middleware>
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>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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