pub struct BinaryWriter<T: Write> { /* private fields */ }Expand description
Analagous to the System.IO.BinaryWriter C# Class.
Writes to any Write implementor.
Implementations§
Source§impl<T> BinaryWriter<T>where
T: Write,
impl<T> BinaryWriter<T>where
T: Write,
Sourcepub fn new(output: T) -> Self
pub fn new(output: T) -> Self
Creates a new BinaryWriter which will write data to the provided Writer
Sourcepub fn num_bytes_written(&self) -> u64
pub fn num_bytes_written(&self) -> u64
Returns the total number of bytes written to the underlying Writer
Sourcepub fn write_byte(&mut self, data: u8) -> Result<usize>
pub fn write_byte(&mut self, data: u8) -> Result<usize>
Equivalent to the Write method in C# called with an argument of type Byte.
Sourcepub fn write_bytes(&mut self, data: &[u8]) -> Result<usize>
pub fn write_bytes(&mut self, data: &[u8]) -> Result<usize>
Equivalent to the Write method in C# called with an argument of type Byte[].
Sourcepub fn write_7_bit_encoded_int(&mut self, data: i32) -> Result<usize>
pub fn write_7_bit_encoded_int(&mut self, data: i32) -> Result<usize>
Equivalent to the Write7BitEncodedInt method in C#.
Sourcepub fn write_7_bit_encoded_int64(&mut self, data: i64) -> Result<usize>
pub fn write_7_bit_encoded_int64(&mut self, data: i64) -> Result<usize>
Equivalent to the Write7BitEncodedInt64 method in C#.
Sourcepub fn write_boolean(&mut self, data: bool) -> Result<usize>
pub fn write_boolean(&mut self, data: bool) -> Result<usize>
Equivalent to the Write method in C# called with an argument of type Boolean.
Sourcepub fn write_f32(&mut self, data: f32) -> Result<usize>
pub fn write_f32(&mut self, data: f32) -> Result<usize>
Equivalent to the Write method in C# called with an argument of type Single
Sourcepub fn write_f64(&mut self, data: f64) -> Result<usize>
pub fn write_f64(&mut self, data: f64) -> Result<usize>
Equivalent to the Write method in C# called with an argument of type Double
Sourcepub fn write_f16(&mut self, data: f16) -> Result<usize>
Available on crate feature f16 only.
pub fn write_f16(&mut self, data: f16) -> Result<usize>
f16 only.Equivalent to the Write method in C# called with an argument of type Half
Sourcepub fn write_string(&mut self, data: &str) -> Result<usize>
pub fn write_string(&mut self, data: &str) -> Result<usize>
Equivalent to the Write method in C# called with an argument of type String
Sourcepub fn write_i8(&mut self, data: i8) -> Result<usize>
pub fn write_i8(&mut self, data: i8) -> Result<usize>
Equivalent to the Write method in C# called with an argument of type SByte
Sourcepub fn write_i16(&mut self, data: i16) -> Result<usize>
pub fn write_i16(&mut self, data: i16) -> Result<usize>
Equivalent to the Write method in C# called with an argument of type Int16
Sourcepub fn write_i32(&mut self, data: i32) -> Result<usize>
pub fn write_i32(&mut self, data: i32) -> Result<usize>
Equivalent to the Write method in C# called with an argument of type Int32
Sourcepub fn write_i64(&mut self, data: i64) -> Result<usize>
pub fn write_i64(&mut self, data: i64) -> Result<usize>
Equivalent to the Write method in C# called with an argument of type Int64
Sourcepub fn write_u16(&mut self, data: u16) -> Result<usize>
pub fn write_u16(&mut self, data: u16) -> Result<usize>
Equivalent to the Write method in C# called with an argument of type UInt16
Sourcepub fn write_u32(&mut self, data: u32) -> Result<usize>
pub fn write_u32(&mut self, data: u32) -> Result<usize>
Equivalent to the Write method in C# called with an argument of type UInt32
Sourcepub fn write_u64(&mut self, data: u64) -> Result<usize>
pub fn write_u64(&mut self, data: u64) -> Result<usize>
Equivalent to the Write method in C# called with an argument of type UInt64
Sourcepub fn write_char(&mut self, data: char) -> Result<usize>
pub fn write_char(&mut self, data: char) -> Result<usize>
Equivalent to the Write method in C# called with an argument of type Char