Skip to content

Commit

Permalink
Add Constructed::remaining_len.
Browse files Browse the repository at this point in the history
  • Loading branch information
partim committed Dec 30, 2024
1 parent 1b8852f commit c0a55dc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/decode/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,14 @@ impl<'a, S: Source + 'a> Constructed<'a, S> {
pub fn set_mode(&mut self, mode: Mode) {
self.mode = mode
}

/// Returns the remaining length of the value if it is available.
///
/// A constructed value may be of indefinite length, in which case this
/// method returns `None`.
pub fn remaining_len(&self) -> Option<usize> {
self.source.limit()
}
}

impl<'a, S: Source + 'a> Constructed<'a, S> {
Expand Down

0 comments on commit c0a55dc

Please sign in to comment.