Struct BinaryStream

Source
pub struct BinaryStream {
    pub mode: BinaryStreamMode,
    /* private fields */
}

Fields§

§mode: BinaryStreamMode

Implementations§

Source§

impl BinaryStream

Source

pub fn new() -> BinaryStream

Source

pub fn with_capacity(expected_size: usize) -> BinaryStream

Source

pub fn from_buffer(buffer: VecDeque<u8>) -> BinaryStream

Source

pub fn from_bytes(bytes: &[u8]) -> BinaryStream

Source

pub fn size(&self) -> usize

Source

pub fn get_buffer(self) -> VecDeque<u8>

Source

pub fn get_buffer_vec(self) -> Vec<u8>

Source

pub fn get_buffer_clone(&self) -> VecDeque<u8>

Source

pub fn get_buffer_vec_clone(&self) -> Vec<u8>

Source

pub fn write_bool(&mut self, val: bool) -> Result<()>

Source

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

Source

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

Source

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

Source

pub fn write_u128(&mut self, val: u128) -> Result<()>

Source

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

Source

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

Source

pub fn write_string(&mut self, val: &String) -> Result<()>

Source

pub fn write_byte_vec(&mut self, val: &Vec<u8>) -> Result<()>

Source

pub fn write_vec<T: Serializable>(&mut self, val: &Vec<T>) -> Result<()>

Source

pub fn write_packet_type<T: PacketType>(&mut self, val: T) -> Result<()>

Source

pub fn write_buffer_size(&mut self) -> Result<()>

Source

pub fn read_bool(&mut self) -> Result<bool>

Source

pub fn read_u16(&mut self) -> Result<u16>

Source

pub fn read_u32(&mut self) -> Result<u32>

Source

pub fn read_u64(&mut self) -> Result<u64>

Source

pub fn read_u128(&mut self) -> Result<u128>

Source

pub fn read_i64(&mut self) -> Result<i64>

Source

pub fn read_f32(&mut self) -> Result<f32>

Source

pub fn read_string(&mut self) -> Result<String>

Source

pub fn read_byte_vec(&mut self) -> Result<Vec<u8>>

Source

pub fn read_vec<T: Serializable>(&mut self) -> Result<Vec<T>>

Source

pub fn read_packet_type<T: PacketType>(&mut self) -> Result<T>

Source

pub fn read_buffer_size(&mut self) -> Result<u32>

Source

pub fn write_buffer_single(&mut self, byte: u8) -> Result<()>

Source

pub fn write_buffer(&mut self, bytes: &Vec<u8>) -> Result<()>

Source

pub fn write_buffer_slice(&mut self, bytes: &[u8]) -> Result<()>

Source

pub fn read_buffer_single(&mut self) -> Result<u8>

Source

pub fn read_buffer(&mut self, count: usize) -> Result<Vec<u8>>

Auto Trait Implementations§

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.