pub struct WriteCursor<'a> { /* private fields */ }
Expand description
A cursor for writing bytes to a buffer.
Implementations§
Source§impl<'a> WriteCursor<'a>
impl<'a> WriteCursor<'a>
Sourcepub fn new(bytes: &'a mut [u8]) -> Self
pub fn new(bytes: &'a mut [u8]) -> Self
Create a new WriteCursor
from a mutable slice of bytes.
Sourcepub fn remaining_mut(&mut self) -> &mut [u8]
pub fn remaining_mut(&mut self) -> &mut [u8]
Returns a mutable slice of the remaining bytes.
Sourcepub fn write_array<const N: usize>(&mut self, array: [u8; N])
pub fn write_array<const N: usize>(&mut self, array: [u8; N])
Write an array of bytes to the buffer.
Sourcepub fn write_slice(&mut self, slice: &[u8])
pub fn write_slice(&mut self, slice: &[u8])
Write a slice of bytes to the buffer.
Sourcepub fn write_u16_be(&mut self, value: u16)
pub fn write_u16_be(&mut self, value: u16)
Write a big-endian u16
to the buffer.
Sourcepub fn write_i16_be(&mut self, value: i16)
pub fn write_i16_be(&mut self, value: i16)
Write a signed big-endian i16
to the buffer.
Sourcepub fn write_u32_be(&mut self, value: u32)
pub fn write_u32_be(&mut self, value: u32)
Write a big-endian u32
to the buffer.
Sourcepub fn write_u64_be(&mut self, value: u64)
pub fn write_u64_be(&mut self, value: u64)
Write a big-endian u64
to the buffer.
Sourcepub fn write_i64_be(&mut self, value: i64)
pub fn write_i64_be(&mut self, value: i64)
Write a signed big-endian i64
to the buffer.
Sourcepub fn write_u128(&mut self, value: u128)
pub fn write_u128(&mut self, value: u128)
Write a little-endian u128
to the buffer.
Sourcepub fn write_u128_be(&mut self, value: u128)
pub fn write_u128_be(&mut self, value: u128)
Write a big-endian u128
to the buffer.
Sourcepub fn advanced(&'a mut self, len: usize) -> WriteCursor<'a>
pub fn advanced(&'a mut self, len: usize) -> WriteCursor<'a>
Returns a new cursor advanced by len
bytes.
Sourcepub fn rewinded(&'a mut self, len: usize) -> WriteCursor<'a>
pub fn rewinded(&'a mut self, len: usize) -> WriteCursor<'a>
Returns a new cursor rewinded by len
bytes.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for WriteCursor<'a>
impl<'a> RefUnwindSafe for WriteCursor<'a>
impl<'a> Send for WriteCursor<'a>
impl<'a> Sync for WriteCursor<'a>
impl<'a> Unpin for WriteCursor<'a>
impl<'a> !UnwindSafe for WriteCursor<'a>
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