pub struct Connection<T> { /* private fields */ }Expand description
Connection tied to the Client’s pool.
When dropped without a .into_inner() call,
the connection managed by this Connection will be returned to the connection pool.
Implementations§
Source§impl<T: AsyncRead + AsyncWrite + Unpin> Connection<T>
impl<T: AsyncRead + AsyncWrite + Unpin> Connection<T>
Sourcepub async fn raw_command<'de, Req: Serialize, Resp: Deserialize<'de>>(
&'de mut self,
request: Req,
) -> Result<Resp, Error>
pub async fn raw_command<'de, Req: Serialize, Resp: Deserialize<'de>>( &'de mut self, request: Req, ) -> Result<Resp, Error>
Sends any command and get a response.
Both command and response are serialized/deserialized using serde.
See CommandSerializer
and Deserializer for details.
Returned response may contain a reference to the connection’s internal receive buffer.
Source§impl<T> Connection<T>
impl<T> Connection<T>
Sourcepub fn get(&self) -> &RawConnection<T>
pub fn get(&self) -> &RawConnection<T>
Gets a shared reference to the underlying raw connection.
Sourcepub fn get_mut(&mut self) -> &mut RawConnection<T>
pub fn get_mut(&mut self) -> &mut RawConnection<T>
Gets a mutable reference to the underlying raw connection.
Sourcepub fn into_inner(self) -> RawConnection<T>
pub fn into_inner(self) -> RawConnection<T>
Detach the connection from the pool and returns the underlying raw connection. It will reduce the connection count of the pool by 1.
Trait Implementations§
Source§impl<T: Debug> Debug for Connection<T>
impl<T: Debug> Debug for Connection<T>
Source§impl<T> Drop for Connection<T>
impl<T> Drop for Connection<T>
Source§impl<T: AsyncRead + AsyncWrite + Send + Unpin> RawCommandMut for Connection<T>
impl<T: AsyncRead + AsyncWrite + Send + Unpin> RawCommandMut for Connection<T>
Auto Trait Implementations§
impl<T> Freeze for Connection<T>where
T: Freeze,
impl<T> RefUnwindSafe for Connection<T>where
T: RefUnwindSafe,
impl<T> Send for Connection<T>where
T: Send,
impl<T> Sync for Connection<T>
impl<T> Unpin for Connection<T>where
T: Unpin,
impl<T> UnsafeUnpin for Connection<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Connection<T>where
T: UnwindSafe,
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