BinaryWriter

Struct BinaryWriter 

Source
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,

Source

pub fn new(output: T) -> Self

Creates a new BinaryWriter which will write data to the provided Writer

Source

pub fn num_bytes_written(&self) -> u64

Returns the total number of bytes written to the underlying Writer

Source

pub fn write_byte(&mut self, data: u8) -> Result<usize>

Equivalent to the Write method in C# called with an argument of type Byte.

Source

pub fn write_bytes(&mut self, data: &[u8]) -> Result<usize>

Equivalent to the Write method in C# called with an argument of type Byte[].

Source

pub fn write_7_bit_encoded_int(&mut self, data: i32) -> Result<usize>

Equivalent to the Write7BitEncodedInt method in C#.

Source

pub fn write_7_bit_encoded_int64(&mut self, data: i64) -> Result<usize>

Equivalent to the Write7BitEncodedInt64 method in C#.

Source

pub fn write_boolean(&mut self, data: bool) -> Result<usize>

Equivalent to the Write method in C# called with an argument of type Boolean.

Source

pub fn write_f32(&mut self, data: f32) -> Result<usize>

Equivalent to the Write method in C# called with an argument of type Single

Source

pub fn write_f64(&mut self, data: f64) -> Result<usize>

Equivalent to the Write method in C# called with an argument of type Double

Source

pub fn write_f16(&mut self, data: f16) -> Result<usize>

Available on crate feature f16 only.

Equivalent to the Write method in C# called with an argument of type Half

Source

pub fn write_string(&mut self, data: &str) -> Result<usize>

Equivalent to the Write method in C# called with an argument of type String

Source

pub fn write_i8(&mut self, data: i8) -> Result<usize>

Equivalent to the Write method in C# called with an argument of type SByte

Source

pub fn write_i16(&mut self, data: i16) -> Result<usize>

Equivalent to the Write method in C# called with an argument of type Int16

Source

pub fn write_i32(&mut self, data: i32) -> Result<usize>

Equivalent to the Write method in C# called with an argument of type Int32

Source

pub fn write_i64(&mut self, data: i64) -> Result<usize>

Equivalent to the Write method in C# called with an argument of type Int64

Source

pub fn write_u16(&mut self, data: u16) -> Result<usize>

Equivalent to the Write method in C# called with an argument of type UInt16

Source

pub fn write_u32(&mut self, data: u32) -> Result<usize>

Equivalent to the Write method in C# called with an argument of type UInt32

Source

pub fn write_u64(&mut self, data: u64) -> Result<usize>

Equivalent to the Write method in C# called with an argument of type UInt64

Source

pub fn write_char(&mut self, data: char) -> Result<usize>

Equivalent to the Write method in C# called with an argument of type Char

Auto Trait Implementations§

§

impl<T> Freeze for BinaryWriter<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for BinaryWriter<T>
where T: RefUnwindSafe,

§

impl<T> Send for BinaryWriter<T>
where T: Send,

§

impl<T> Sync for BinaryWriter<T>
where T: Sync,

§

impl<T> Unpin for BinaryWriter<T>
where T: Unpin,

§

impl<T> UnwindSafe for BinaryWriter<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.