#[repr(transparent)]pub struct Inline<T>(pub T);Expand description
A ProtoBox that stores the message inline (no heap allocation).
MessageField<T, Inline<T>> is laid out as Option<T> — set values live
directly in the parent struct. This eliminates the per-field allocation of
the default Box<T> pointer at the cost of inflating the parent’s size by
size_of::<T>() even when the field is unset.
Codegen uses this by default via PointerRepr::Inline, which is
recursion-aware: a field that would form an infinite-size cycle is silently
kept on Box. Opt out per-field with box_type_in(PointerRepr::Box, …).
Tuple Fields§
§0: TTrait Implementations§
impl<T: Eq> Eq for Inline<T>
Source§impl<T> From<T> for Inline<T>
Convenience mirror of Box’s From<T>; codegen and MessageField::some
use ProtoBox::new instead.
impl<T> From<T> for Inline<T>
Convenience mirror of Box’s From<T>; codegen and MessageField::some
use ProtoBox::new instead.
Source§impl<T> ProtoBox<T> for Inline<T>
impl<T> ProtoBox<T> for Inline<T>
Source§fn into_inner(self) -> T
fn into_inner(self) -> T
Unwrap the pointer, returning the owned message value (the
take / into_option
path).impl<T: PartialEq> StructuralPartialEq for Inline<T>
Auto Trait Implementations§
impl<T> Freeze for Inline<T>where
T: Freeze,
impl<T> RefUnwindSafe for Inline<T>where
T: RefUnwindSafe,
impl<T> Send for Inline<T>where
T: Send,
impl<T> Sync for Inline<T>where
T: Sync,
impl<T> Unpin for Inline<T>where
T: Unpin,
impl<T> UnsafeUnpin for Inline<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Inline<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more