EBML: Derive Default for VInt

This commit is contained in:
Serial 2024-08-10 11:52:39 -04:00
parent 0e99b36973
commit 1031dabc00
No known key found for this signature in database
GPG key ID: DA95198DC17C4568

View file

@ -12,7 +12,7 @@ use byteorder::{ReadBytesExt, WriteBytesExt};
///
/// To ensure safe construction of `VInt`s, users must create them through [`VInt::parse`] or [`VInt::from_u64`].
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default)]
pub struct VInt(pub(crate) u64);
impl VInt {
@ -256,7 +256,8 @@ impl VInt {
Ok(ret)
}
pub(crate) fn saturating_sub(&self, other: u64) -> Self {
#[inline]
pub(crate) fn saturating_sub(self, other: u64) -> Self {
Self(self.0.saturating_sub(other))
}
}