Skip to content

Commit

Permalink
fixup: firmware: minor convenience functions
Browse files Browse the repository at this point in the history
Adds convenience functions to `FirmwareRam` for getting information
about the backing buffer.
  • Loading branch information
ssp-rs committed Dec 22, 2023
1 parent 0185ee2 commit c13f577
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/types/firmware/ram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ impl FirmwareRam {
pub const fn index(&self) -> usize {
self.index
}

/// Gets the length of the [FirmwareRam] buffer.
pub fn len(&self) -> usize {
self.block.len()
}

/// Gets whether the [FirmwareRam] buffer is empty.
pub fn is_empty(&self) -> bool {
self.block.is_empty()
}
}

impl TryFrom<&[u8]> for FirmwareRam {
Expand Down

0 comments on commit c13f577

Please sign in to comment.