Skip to content

Commit

Permalink
Add more logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeandudey committed Jan 7, 2025
1 parent 613ec13 commit df39e2e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions nom-embedded-storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ impl<S, const N: usize> InputLength for Bytes<S, N> {

impl<S, const N: usize> InputTake for Bytes<S, N> {
fn take(&self, count: usize) -> Self {
log::trace!("take {count} bytes, length is {}", self.len());

if count > self.len() {
panic!("tried to take {count}, but the length is {}", self.len());
}
Expand All @@ -279,6 +281,8 @@ impl<S, const N: usize> InputTake for Bytes<S, N> {
}

fn take_split(&self, count: usize) -> (Self, Self) {
log::trace!("split {count} bytes, length is {}", self.len());

if count > self.len() {
panic!("tried to take {count}, but the length is {}", self.len());
}
Expand All @@ -297,6 +301,8 @@ impl<S, const N: usize> InputTake for Bytes<S, N> {
buffer: RefCell::new(Vec::new()),
};

log::trace!("prefix length {}, suffix length {}", prefix.len(), suffix.len());

(prefix, suffix)
}
}
Expand Down Expand Up @@ -325,6 +331,8 @@ where
}

fn slice_index(&self, count: usize) -> Result<usize, Needed> {
log::trace!("slice index {count}");

if self.len() >= count {
Ok(count)
} else {
Expand Down

0 comments on commit df39e2e

Please sign in to comment.