Struct Chain
pub struct Chain<T, U> { /* private fields */ }
A Chain sequences two buffers.
Chain is an adapter that links two underlying buffers and provides a
continuous view across both buffers. It is able to sequence either immutable
buffers (Buf values) or mutable buffers (BufMut values).
This struct is generally created by calling Buf::chain. Please see that
function's documentation for more detail.
Examples
use ;
let mut buf =
.chain;
let full: Bytes = buf.copy_to_bytes;
assert_eq!;
Implementations
impl<T, U> Chain<T, U>
fn first_ref(&self) -> &TGets a reference to the first underlying
Buf.Examples
use Buf; let buf = .chain; assert_eq!;fn first_mut(&mut self) -> &mut TGets a mutable reference to the first underlying
Buf.Examples
use Buf; let mut buf = .chain; buf.first_mut.advance; let full = buf.copy_to_bytes; assert_eq!;fn last_ref(&self) -> &UGets a reference to the last underlying
Buf.Examples
use Buf; let buf = .chain; assert_eq!;fn last_mut(&mut self) -> &mut UGets a mutable reference to the last underlying
Buf.Examples
use Buf; let mut buf = .chain; buf.last_mut.advance; let full = buf.copy_to_bytes; assert_eq!;fn into_inner(self) -> (T, U)Consumes this
Chain, returning the underlying values.Examples
use Buf; let chain = .chain; let = chain.into_inner; assert_eq!; assert_eq!;
Trait Implementations
impl<T, U> Buf for Chain<T, U>
where
T: Buf,
U: Buf,
fn remaining(&self) -> usizefn chunk(&self) -> &[u8]fn advance(&mut self, cnt: usize)fn chunks_vectored<'a>(&'a self, dst: &mut [IoSlice<'a>]) -> usizefn copy_to_bytes(&mut self, len: usize) -> Bytes
impl<T, U> BufMut for Chain<T, U>
where
T: BufMut,
U: BufMut,
fn remaining_mut(&self) -> usizefn chunk_mut(&mut self) -> &mut UninitSliceunsafe fn advance_mut(&mut self, cnt: usize)
impl<T, U> IntoIterator for Chain<T, U>
where
T: Buf,
U: Buf,
type Item = u8;type IntoIter = IntoIter<Chain<T, U>>;fn into_iter(self) -> Self::IntoIter
impl<T: Debug, U: Debug> Debug for Chain<T, U>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<T, U> Freeze for Chain<T, U>
where
T: Freeze,
U: Freeze,
impl<T, U> RefUnwindSafe for Chain<T, U>
where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for Chain<T, U>
where
T: Send,
U: Send,
impl<T, U> Sync for Chain<T, U>
where
T: Sync,
U: Sync,
impl<T, U> Unpin for Chain<T, U>
where
T: Unpin,
U: Unpin,
impl<T, U> UnsafeUnpin for Chain<T, U>
where
T: UnsafeUnpin,
U: UnsafeUnpin,
impl<T, U> UnwindSafe for Chain<T, U>
where
T: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
impl<T> Any for Chain<T, U>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Chain<T, U>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Chain<T, U>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Chain<T, U>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for Chain<T, U>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Chain<T, U>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Chain<T, U>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>