Struct bitbuffer::BitWriteStream[][src]

pub struct BitWriteStream<'a, E> where
    E: Endianness
{ /* fields omitted */ }
Expand description

Stream that provides an a way to write non bit aligned adata

Examples

use bitbuffer::{BitWriteStream, LittleEndian};

let mut data = Vec::new();
let mut stream = BitWriteStream::new(&mut data, LittleEndian);

stream.write_bool(false)?;
stream.write_int(123u16, 15)?;

Implementations

Create a new write stream

Examples

use bitbuffer::{BitWriteStream, LittleEndian};

let mut data = Vec::new();
let mut stream = BitWriteStream::new(&mut data, LittleEndian);

The number of written bits in the buffer

The number of written bytes in the buffer

Write a boolean into the buffer

Examples


let mut data = Vec::new();
let mut stream = BitWriteStream::new(&mut data, LittleEndian);
stream.write_bool(true)?;

Write an integer into the buffer

Examples


let mut data = Vec::new();
let mut stream = BitWriteStream::new(&mut data, LittleEndian);
stream.write_int(123u16, 15)?;

Write a float into the buffer

Examples


let mut data = Vec::new();
let mut stream = BitWriteStream::new(&mut data, LittleEndian);
stream.write_float(123.15f32)?;

Write a number of bytes into the buffer

Examples


let mut data = Vec::new();
let mut stream = BitWriteStream::new(&mut data, LittleEndian);
stream.write_bytes(&[0, 1, 2 ,3])?;

Write bits from a read stream into the buffer

Write a string into the buffer

Examples


let mut data = Vec::new();
let mut stream = BitWriteStream::new(&mut data, LittleEndian);
stream.write_string("zero terminated string", None)?;
stream.write_string("fixed size string, zero padded", Some(64))?;

Write the type to stream

Write the type to stream

Write the length of a section before the section

Write the length in bytes of a section before the section, the section will be 0 padded to an even byte length

Reserve the length to write an integer

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.