pub struct MessageUninitBuilder<'_wincode_inner> { /* private fields */ }Expand description
A helper struct that provides convenience methods for reading and writing to a MaybeUninit struct
with a bit-set tracking the initialization state of the fields.
The builder will drop all initialized fields in reverse order on drop. When the struct is fully initialized,
you must call finish or into_assume_init_mut to forget the builder. Otherwise, all the
initialized fields will be dropped when the builder is dropped.
Implementations§
Source§impl<'_wincode_inner> MessageUninitBuilder<'_wincode_inner>
impl<'_wincode_inner> MessageUninitBuilder<'_wincode_inner>
pub const fn from_maybe_uninit_mut( inner: &'_wincode_inner mut MaybeUninit<Message>, ) -> Self
Sourcepub const fn is_init(&self) -> bool
pub const fn is_init(&self) -> bool
Check if the builder is fully initialized.
This will check if all field initialization bits are set.
Sourcepub const unsafe fn into_assume_init_mut(self) -> &'_wincode_inner mut Message
pub const unsafe fn into_assume_init_mut(self) -> &'_wincode_inner mut Message
Assume the builder is fully initialized, and return a mutable reference to the inner MaybeUninit struct.
The builder will be forgotten, so the drop logic will not longer run.
§Safety
Calling this when the content is not yet fully initialized causes undefined behavior: it is up to the caller
to guarantee that the MaybeUninit<T> really is in an initialized state.
Source§impl<'_wincode_inner> MessageUninitBuilder<'_wincode_inner>
impl<'_wincode_inner> MessageUninitBuilder<'_wincode_inner>
Sourcepub const fn uninit_header_mut(&mut self) -> &mut MaybeUninit<MessageHeader>
pub const fn uninit_header_mut(&mut self) -> &mut MaybeUninit<MessageHeader>
Get a mutable reference to the maybe uninitialized field.
Sourcepub const fn write_header(&mut self, val: MessageHeader) -> &mut Self
pub const fn write_header(&mut self, val: MessageHeader) -> &mut Self
Write a value to the maybe uninitialized field.
Sourcepub fn read_header<'de>(
&mut self,
reader: &mut impl Reader<'de>,
) -> ReadResult<&mut Self>
pub fn read_header<'de>( &mut self, reader: &mut impl Reader<'de>, ) -> ReadResult<&mut Self>
Read a value from the reader into the maybe uninitialized field.
Sourcepub unsafe fn init_header_with(
&mut self,
initializer: impl FnMut(&mut MaybeUninit<MessageHeader>) -> ReadResult<()>,
) -> ReadResult<&mut Self>
pub unsafe fn init_header_with( &mut self, initializer: impl FnMut(&mut MaybeUninit<MessageHeader>) -> ReadResult<()>, ) -> ReadResult<&mut Self>
Initialize the field with a given initializer function.
§Safety
The caller must guarantee that the initializer function fully initializes the field.
Sourcepub const unsafe fn assume_init_header(&mut self) -> &mut Self
pub const unsafe fn assume_init_header(&mut self) -> &mut Self
Mark the field as initialized.
§Safety
Caller must guarantee the field has been fully initialized prior to calling this.
Sourcepub const fn uninit_account_keys_mut(
&mut self,
) -> &mut MaybeUninit<Vec<Address, ShortU16Len>>
pub const fn uninit_account_keys_mut( &mut self, ) -> &mut MaybeUninit<Vec<Address, ShortU16Len>>
Get a mutable reference to the maybe uninitialized field.
Sourcepub const fn write_account_keys(
&mut self,
val: Vec<Address, ShortU16Len>,
) -> &mut Self
pub const fn write_account_keys( &mut self, val: Vec<Address, ShortU16Len>, ) -> &mut Self
Write a value to the maybe uninitialized field.
Sourcepub fn read_account_keys<'de>(
&mut self,
reader: &mut impl Reader<'de>,
) -> ReadResult<&mut Self>
pub fn read_account_keys<'de>( &mut self, reader: &mut impl Reader<'de>, ) -> ReadResult<&mut Self>
Read a value from the reader into the maybe uninitialized field.
Sourcepub unsafe fn init_account_keys_with(
&mut self,
initializer: impl FnMut(&mut MaybeUninit<Vec<Address, ShortU16Len>>) -> ReadResult<()>,
) -> ReadResult<&mut Self>
pub unsafe fn init_account_keys_with( &mut self, initializer: impl FnMut(&mut MaybeUninit<Vec<Address, ShortU16Len>>) -> ReadResult<()>, ) -> ReadResult<&mut Self>
Initialize the field with a given initializer function.
§Safety
The caller must guarantee that the initializer function fully initializes the field.
Sourcepub const unsafe fn assume_init_account_keys(&mut self) -> &mut Self
pub const unsafe fn assume_init_account_keys(&mut self) -> &mut Self
Mark the field as initialized.
§Safety
Caller must guarantee the field has been fully initialized prior to calling this.
Sourcepub const fn uninit_recent_blockhash_mut(&mut self) -> &mut MaybeUninit<Hash>
pub const fn uninit_recent_blockhash_mut(&mut self) -> &mut MaybeUninit<Hash>
Get a mutable reference to the maybe uninitialized field.
Sourcepub const fn write_recent_blockhash(&mut self, val: Hash) -> &mut Self
pub const fn write_recent_blockhash(&mut self, val: Hash) -> &mut Self
Write a value to the maybe uninitialized field.
Sourcepub fn read_recent_blockhash<'de>(
&mut self,
reader: &mut impl Reader<'de>,
) -> ReadResult<&mut Self>
pub fn read_recent_blockhash<'de>( &mut self, reader: &mut impl Reader<'de>, ) -> ReadResult<&mut Self>
Read a value from the reader into the maybe uninitialized field.
Sourcepub unsafe fn init_recent_blockhash_with(
&mut self,
initializer: impl FnMut(&mut MaybeUninit<Hash>) -> ReadResult<()>,
) -> ReadResult<&mut Self>
pub unsafe fn init_recent_blockhash_with( &mut self, initializer: impl FnMut(&mut MaybeUninit<Hash>) -> ReadResult<()>, ) -> ReadResult<&mut Self>
Initialize the field with a given initializer function.
§Safety
The caller must guarantee that the initializer function fully initializes the field.
Sourcepub const unsafe fn assume_init_recent_blockhash(&mut self) -> &mut Self
pub const unsafe fn assume_init_recent_blockhash(&mut self) -> &mut Self
Mark the field as initialized.
§Safety
Caller must guarantee the field has been fully initialized prior to calling this.
Sourcepub const fn uninit_instructions_mut(
&mut self,
) -> &mut MaybeUninit<Vec<CompiledInstruction, ShortU16Len>>
pub const fn uninit_instructions_mut( &mut self, ) -> &mut MaybeUninit<Vec<CompiledInstruction, ShortU16Len>>
Get a mutable reference to the maybe uninitialized field.
Sourcepub const fn write_instructions(
&mut self,
val: Vec<CompiledInstruction, ShortU16Len>,
) -> &mut Self
pub const fn write_instructions( &mut self, val: Vec<CompiledInstruction, ShortU16Len>, ) -> &mut Self
Write a value to the maybe uninitialized field.
Sourcepub fn read_instructions<'de>(
&mut self,
reader: &mut impl Reader<'de>,
) -> ReadResult<&mut Self>
pub fn read_instructions<'de>( &mut self, reader: &mut impl Reader<'de>, ) -> ReadResult<&mut Self>
Read a value from the reader into the maybe uninitialized field.
Sourcepub unsafe fn init_instructions_with(
&mut self,
initializer: impl FnMut(&mut MaybeUninit<Vec<CompiledInstruction, ShortU16Len>>) -> ReadResult<()>,
) -> ReadResult<&mut Self>
pub unsafe fn init_instructions_with( &mut self, initializer: impl FnMut(&mut MaybeUninit<Vec<CompiledInstruction, ShortU16Len>>) -> ReadResult<()>, ) -> ReadResult<&mut Self>
Initialize the field with a given initializer function.
§Safety
The caller must guarantee that the initializer function fully initializes the field.
Sourcepub const unsafe fn assume_init_instructions(&mut self) -> &mut Self
pub const unsafe fn assume_init_instructions(&mut self) -> &mut Self
Mark the field as initialized.
§Safety
Caller must guarantee the field has been fully initialized prior to calling this.
Trait Implementations§
Auto Trait Implementations§
impl<'_wincode_inner> Freeze for MessageUninitBuilder<'_wincode_inner>
impl<'_wincode_inner> RefUnwindSafe for MessageUninitBuilder<'_wincode_inner>
impl<'_wincode_inner> Send for MessageUninitBuilder<'_wincode_inner>
impl<'_wincode_inner> Sync for MessageUninitBuilder<'_wincode_inner>
impl<'_wincode_inner> Unpin for MessageUninitBuilder<'_wincode_inner>
impl<'_wincode_inner> !UnwindSafe for MessageUninitBuilder<'_wincode_inner>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more