Struct binary_rw::BinaryWriter
source · [−]pub struct BinaryWriter<'a> { /* private fields */ }
Expand description
Write to a stream.
Implementations
sourceimpl<'a> BinaryWriter<'a>
impl<'a> BinaryWriter<'a>
sourcepub fn new(stream: &'a mut impl Stream, endian: Endian) -> Self
pub fn new(stream: &'a mut impl Stream, endian: Endian) -> Self
Create a binary writer with the given endianness.
sourcepub fn write_string<S: AsRef<str>>(&mut self, value: S) -> Result<usize>
pub fn write_string<S: AsRef<str>>(&mut self, value: S) -> Result<usize>
Write a length-prefixed String
to the stream.
The length of the String
is written as a usize
unless the wasm32
feature is enabled
in which case the length is a u32
.
sourcepub fn write_char(&mut self, v: char) -> Result<usize>
pub fn write_char(&mut self, v: char) -> Result<usize>
Write a character to the stream.
sourcepub fn write_bool(&mut self, value: bool) -> Result<usize>
pub fn write_bool(&mut self, value: bool) -> Result<usize>
Write a bool
to the stream.
sourcepub fn write_isize(&mut self, value: isize) -> Result<usize>
pub fn write_isize(&mut self, value: isize) -> Result<usize>
Write an isize
to the stream.
sourcepub fn write_usize(&mut self, value: usize) -> Result<usize>
pub fn write_usize(&mut self, value: usize) -> Result<usize>
Write a usize
to the stream.
Auto Trait Implementations
impl<'a> !RefUnwindSafe for BinaryWriter<'a>
impl<'a> !Send for BinaryWriter<'a>
impl<'a> !Sync for BinaryWriter<'a>
impl<'a> Unpin for BinaryWriter<'a>
impl<'a> !UnwindSafe for BinaryWriter<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more