Skip to content

rust library to write integer types of any bit length into a buffer - from `i1` to `i64`.

License

Notifications You must be signed in to change notification settings

Danaozhong/rust-bitwriter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-bitwriter

rust-bitwriter is a rust crate to write data into a bit stream.

tests

This example shows how to write a bool, an u28 and an i28 into a byte vector:

    let mut writer = BitWriter::new();

    writer.write_bool(true).expect("failed to write bool");
    writer.write_u32(178956970, 28).expect("failed to write u28");
    writer.write_i32(-22369622, 28).expect("failed to write i28");
    
    writer.close().expect("failed to close byte vector");
    let buffer = writer.data();

You can write signed and unsigned integers with 1-64 bit length.

It is intended to complement irauta/bitreader with a writer component.

This is my first rust project, so there might be some issues. If you have some suggestions or improvements, please feel welcomed to raise a PR!

License

Licensed under the Apache License, Version 2.0 or the MIT license, at your option.

About

rust library to write integer types of any bit length into a buffer - from `i1` to `i64`.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages