pub struct Builder<A>where
A: Allocator,{ /* private fields */ }Expand description
A container used to build a message.
Implementations§
Source§impl<A> Builder<A>where
A: Allocator,
impl<A> Builder<A>where
A: Allocator,
pub fn new(allocator: A) -> Self
Sourcepub fn init_root<'a, T: FromPointerBuilder<'a>>(&'a mut self) -> T
pub fn init_root<'a, T: FromPointerBuilder<'a>>(&'a mut self) -> T
Initializes the root as a value of the given type.
Sourcepub fn initn_root<'a, T: FromPointerBuilder<'a>>(&'a mut self, length: u32) -> T
pub fn initn_root<'a, T: FromPointerBuilder<'a>>(&'a mut self, length: u32) -> T
Initializes the root as a value of the given list type, with the given length.
Sourcepub fn get_root<'a, T: FromPointerBuilder<'a>>(&'a mut self) -> Result<T>
pub fn get_root<'a, T: FromPointerBuilder<'a>>(&'a mut self) -> Result<T>
Gets the root, interpreting it as the given type.
pub fn get_root_as_reader<'a, T: FromPointerReader<'a>>(&'a self) -> Result<T>
Sourcepub fn set_root<T: Owned>(&mut self, value: impl SetterInput<T>) -> Result<()>
pub fn set_root<T: Owned>(&mut self, value: impl SetterInput<T>) -> Result<()>
Sets the root to a deep copy of the given value.
Sourcepub fn set_root_canonical<T: Owned>(
&mut self,
value: impl SetterInput<T>,
) -> Result<()>
pub fn set_root_canonical<T: Owned>( &mut self, value: impl SetterInput<T>, ) -> Result<()>
Sets the root to a canonicalized version of value. If this was the first action taken
on this Builder, then a subsequent call to get_segments_for_output() should return
a single segment, containing the full canonicalized message.
pub fn get_segments_for_output(&self) -> OutputSegments<'_>
pub fn into_reader(self) -> Reader<Self>
pub fn into_typed<T: Owned>(self) -> TypedBuilder<T, A>
Sourcepub fn into_allocator(self) -> A
pub fn into_allocator(self) -> A
Retrieves the underlying Allocator, deallocating all currently-allocated
segments.
pub fn size_in_words(&self) -> usize
Source§impl Builder<HeapAllocator>
impl Builder<HeapAllocator>
Sourcepub fn new_default() -> Self
pub fn new_default() -> Self
Constructs a new message::Builder<HeapAllocator> whose first segment has length
SUGGESTED_FIRST_SEGMENT_WORDS.
Trait Implementations§
Source§impl Default for Builder<HeapAllocator>
Available on crate feature alloc only.
impl Default for Builder<HeapAllocator>
Available on crate feature
alloc only.Source§impl<T, A> From<Builder<A>> for TypedBuilder<T, A>
impl<T, A> From<Builder<A>> for TypedBuilder<T, A>
Auto Trait Implementations§
impl<A> Freeze for Builder<A>where
BuilderArenaImpl<A>: Freeze,
impl<A> RefUnwindSafe for Builder<A>where
BuilderArenaImpl<A>: RefUnwindSafe,
impl<A> Send for Builder<A>where
BuilderArenaImpl<A>: Send,
impl<A> Sync for Builder<A>where
BuilderArenaImpl<A>: Sync,
impl<A> Unpin for Builder<A>where
BuilderArenaImpl<A>: Unpin,
impl<A> UnsafeUnpin for Builder<A>where
BuilderArenaImpl<A>: UnsafeUnpin,
impl<A> UnwindSafe for Builder<A>where
BuilderArenaImpl<A>: 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