Struct OutBuffer
struct OutBuffer<'a, C: WriteBuf + ?Sized> { ... }
Wrapper around an output buffer.
C is usually either [u8] or Vec<u8>.
Bytes will be written starting at dst[pos].
pos will be updated after writing.
Invariant
pos <= dst.capacity()
Implementations
impl<'a, C: WriteBuf + ?Sized> OutBuffer<'a, C>
fn around(dst: &'a mut C) -> SelfReturns a new
OutBufferaround the given slice.Starts with
pos = 0.fn around_pos(dst: &'a mut C, pos: usize) -> SelfReturns a new
OutBufferaround the given slice, starting at the given position.Panics
If
pos > dst.capacity().fn pos(self: &Self) -> usizeReturns the current cursor position.
Guaranteed to be <= self.capacity()
fn capacity(self: &Self) -> usizeReturns the capacity of the underlying buffer.
unsafe fn set_pos(self: &mut Self, pos: usize)Sets the new cursor position.
Panics
If
pos > self.dst.capacity().Safety
Data up to
posmust have actually been written to.fn as_slice<'b>(self: &'b Self) -> &'a [u8] where 'b: 'aReturns the part of this buffer that was written to.
fn as_mut_ptr(self: &mut Self) -> *mut u8Returns a pointer to the start of this buffer.
impl<'a, C> Freeze for OutBuffer<'a, C>
impl<'a, C> RefUnwindSafe for OutBuffer<'a, C>
impl<'a, C> Send for OutBuffer<'a, C>
impl<'a, C> Sync for OutBuffer<'a, C>
impl<'a, C> Unpin for OutBuffer<'a, C>
impl<'a, C> UnsafeUnpin for OutBuffer<'a, C>
impl<'a, C> UnwindSafe for OutBuffer<'a, C>
impl<'a, C: $crate::fmt::Debug + WriteBuf + ?Sized> Debug for OutBuffer<'a, C>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T> Any for OutBuffer<'a, C>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for OutBuffer<'a, C>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for OutBuffer<'a, C>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for OutBuffer<'a, C>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into for OutBuffer<'a, C>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for OutBuffer<'a, C>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for OutBuffer<'a, C>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>