pub struct Connection<Req, ReqMulti> { /* private fields */ }
Expand description
A connection to a single stream transport.
Implementations§
source§impl<Req, ReqMulti> Connection<Req, ReqMulti>
impl<Req, ReqMulti> Connection<Req, ReqMulti>
sourcepub fn new<Stream>(stream: Stream) -> (Self, Transport<Stream, Req, ReqMulti>)
pub fn new<Stream>(stream: Stream) -> (Self, Transport<Stream, Req, ReqMulti>)
Creates a new stream transport with default configuration.
Returns a connection and a future that drives the transport using the provided stream. This future needs to be run while any queries are active. This is most easly achieved by spawning it into a runtime. It terminates when the last connection is dropped.
sourcepub fn with_config<Stream>(
stream: Stream,
config: Config,
) -> (Self, Transport<Stream, Req, ReqMulti>)
pub fn with_config<Stream>( stream: Stream, config: Config, ) -> (Self, Transport<Stream, Req, ReqMulti>)
Creates a new stream transport with the given configuration.
Returns a connection and a future that drives the transport using the provided stream. This future needs to be run while any queries are active. This is most easly achieved by spawning it into a runtime. It terminates when the last connection is dropped.
source§impl<Req, ReqMulti> Connection<Req, ReqMulti>where
Req: ComposeRequest + 'static,
ReqMulti: ComposeRequestMulti + 'static,
impl<Req, ReqMulti> Connection<Req, ReqMulti>where
Req: ComposeRequest + 'static,
ReqMulti: ComposeRequestMulti + 'static,
sourcepub fn get_request(&self, request_msg: Req) -> Request
pub fn get_request(&self, request_msg: Req) -> Request
Returns a request handler for a request.
Trait Implementations§
source§impl<Req, ReqMulti> Clone for Connection<Req, ReqMulti>
impl<Req, ReqMulti> Clone for Connection<Req, ReqMulti>
source§impl<Req, ReqMulti> SendRequest<Req> for Connection<Req, ReqMulti>
impl<Req, ReqMulti> SendRequest<Req> for Connection<Req, ReqMulti>
source§fn send_request(&self, request_msg: Req) -> Box<dyn GetResponse + Send + Sync>
fn send_request(&self, request_msg: Req) -> Box<dyn GetResponse + Send + Sync>
Request function that takes a ComposeRequest type.
source§impl<Req, ReqMulti> SendRequestMulti<ReqMulti> for Connection<Req, ReqMulti>
impl<Req, ReqMulti> SendRequestMulti<ReqMulti> for Connection<Req, ReqMulti>
source§fn send_request(
&self,
request_msg: ReqMulti,
) -> Box<dyn GetResponseMulti + Send + Sync>
fn send_request( &self, request_msg: ReqMulti, ) -> Box<dyn GetResponseMulti + Send + Sync>
Request function that takes a ComposeRequestMulti type.
Auto Trait Implementations§
impl<Req, ReqMulti> Freeze for Connection<Req, ReqMulti>
impl<Req, ReqMulti> RefUnwindSafe for Connection<Req, ReqMulti>
impl<Req, ReqMulti> Send for Connection<Req, ReqMulti>
impl<Req, ReqMulti> Sync for Connection<Req, ReqMulti>
impl<Req, ReqMulti> Unpin for Connection<Req, ReqMulti>
impl<Req, ReqMulti> UnwindSafe for Connection<Req, ReqMulti>
Blanket Implementations§
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
source§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
Performs the conversion.
source§fn octets_into(self) -> Target
fn octets_into(self) -> Target
Performs an infallible conversion.