Skip to content

Commit

Permalink
Inline to_bytes and to_bits
Browse files Browse the repository at this point in the history
  • Loading branch information
wcampbell0x2a committed Dec 28, 2023
1 parent 6610a40 commit ee48236
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ pub trait DekuContainerWrite: DekuWriter<()> {
/// let bytes = s.to_bytes().unwrap();
/// assert_eq!(bytes, [0x01, 0x02, 0x00, 0x03, 0x00, 0x00, 0x00]);
/// ````
#[inline(always)]
fn to_bytes(&self) -> Result<Vec<u8>, DekuError> {
let mut out_buf = Vec::new();
let mut __deku_writer = Writer::new(&mut out_buf);
Expand Down Expand Up @@ -501,6 +502,7 @@ pub trait DekuContainerWrite: DekuWriter<()> {
/// let bits = test.to_bits().unwrap();
/// assert_eq!(deku::bitvec::bitvec![1, 1, 1, 1, 0, 0, 0, 1, 1], bits);
/// ```
#[inline(always)]
fn to_bits(&self) -> Result<bitvec::BitVec<u8, bitvec::Msb0>, DekuError> {
let mut out_buf = Vec::new();
let mut __deku_writer = Writer::new(&mut out_buf);
Expand Down

0 comments on commit ee48236

Please sign in to comment.