Skip to content

Commit

Permalink
Add AnyPtr::null() const helper
Browse files Browse the repository at this point in the history
  • Loading branch information
ObsidianMinor committed Oct 13, 2024
1 parent 9b4a5a1 commit 06f004f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion recapn/src/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ impl<'a, T: Table> ty::FromPtr<PtrReader<'a, T>> for AnyPtr {
}
}

impl PtrReader<'_, Empty> {
#[inline]
pub const fn null() -> Self {
Self(ptr::PtrReader::null())
}
}

impl<'a, T: Table> PtrReader<'a, T> {
#[inline]
pub fn target_size(&self) -> Result<MessageSize> {
Expand Down Expand Up @@ -248,7 +255,7 @@ impl<'a, T: CapTable + BreakableCapSystem> PtrReader<'a, T> {
impl<'a> Default for PtrReader<'a, Empty> {
#[inline]
fn default() -> Self {
AnyPtr::from(ptr::PtrReader::null())
AnyPtr::null()
}
}

Expand Down

0 comments on commit 06f004f

Please sign in to comment.