mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-24 00:00:11 +02:00
util: add more get_{ref,mut,pin_mut} methods (#3364)
This commit adds: - Framed::get_pin_mut - FramedRead::get_pin_mut - FramedWrite::get_pin_mut - StreamReader::get_ref - StreamReader::get_mut - StreamReader::get_pin_mut - StreamReader::into_inner
This commit is contained in:
@@ -170,6 +170,16 @@ impl<T, U> Framed<T, U> {
|
||||
&mut self.inner.inner
|
||||
}
|
||||
|
||||
/// Returns a pinned mutable reference to the underlying I/O stream wrapped by
|
||||
/// `Framed`.
|
||||
///
|
||||
/// Note that care should be taken to not tamper with the underlying stream
|
||||
/// of data coming in as it may corrupt the stream of frames otherwise
|
||||
/// being worked with.
|
||||
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T> {
|
||||
self.project().inner.project().inner
|
||||
}
|
||||
|
||||
/// Returns a reference to the underlying codec wrapped by
|
||||
/// `Framed`.
|
||||
///
|
||||
|
||||
@@ -78,6 +78,16 @@ impl<T, D> FramedRead<T, D> {
|
||||
&mut self.inner.inner
|
||||
}
|
||||
|
||||
/// Returns a pinned mutable reference to the underlying I/O stream wrapped by
|
||||
/// `FramedRead`.
|
||||
///
|
||||
/// Note that care should be taken to not tamper with the underlying stream
|
||||
/// of data coming in as it may corrupt the stream of frames otherwise
|
||||
/// being worked with.
|
||||
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T> {
|
||||
self.project().inner.project().inner
|
||||
}
|
||||
|
||||
/// Consumes the `FramedRead`, returning its underlying I/O stream.
|
||||
///
|
||||
/// Note that care should be taken to not tamper with the underlying stream
|
||||
|
||||
@@ -58,6 +58,16 @@ impl<T, E> FramedWrite<T, E> {
|
||||
&mut self.inner.inner
|
||||
}
|
||||
|
||||
/// Returns a pinned mutable reference to the underlying I/O stream wrapped by
|
||||
/// `FramedWrite`.
|
||||
///
|
||||
/// Note that care should be taken to not tamper with the underlying stream
|
||||
/// of data coming in as it may corrupt the stream of frames otherwise
|
||||
/// being worked with.
|
||||
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T> {
|
||||
self.project().inner.project().inner
|
||||
}
|
||||
|
||||
/// Consumes the `FramedWrite`, returning its underlying I/O stream.
|
||||
///
|
||||
/// Note that care should be taken to not tamper with the underlying stream
|
||||
|
||||
Reference in New Issue
Block a user