pub struct MessageUninitBuilder<'_wincode_inner, WincodeConfig: Config> { /* 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, WincodeConfig: Config> MessageUninitBuilder<'_wincode_inner, WincodeConfig>
impl<'_wincode_inner, WincodeConfig: Config> MessageUninitBuilder<'_wincode_inner, WincodeConfig>
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 unsafe fn into_assume_init_mut(self) -> &'_wincode_inner mut Message
pub 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, WincodeConfig: Config> MessageUninitBuilder<'_wincode_inner, WincodeConfig>
impl<'_wincode_inner, WincodeConfig: Config> MessageUninitBuilder<'_wincode_inner, WincodeConfig>
Sourcepub const fn uninit_header_mut(
&mut self,
) -> &mut MaybeUninit<<MessageHeader as SchemaRead<'_, WincodeConfig>>::Dst>
pub const fn uninit_header_mut( &mut self, ) -> &mut MaybeUninit<<MessageHeader as SchemaRead<'_, WincodeConfig>>::Dst>
Get a mutable reference to the maybe uninitialized field.
Sourcepub fn write_header(
&mut self,
val: <MessageHeader as SchemaRead<'_, WincodeConfig>>::Dst,
) -> &mut Self
pub fn write_header( &mut self, val: <MessageHeader as SchemaRead<'_, WincodeConfig>>::Dst, ) -> &mut Self
Write a value to the maybe uninitialized field.
Sourcepub fn read_header<'de>(
&mut self,
reader: impl Reader<'de>,
) -> ReadResult<&mut Self>
pub fn read_header<'de>( &mut self, reader: 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 as SchemaRead<'_, WincodeConfig>>::Dst>) -> ReadResult<()>,
) -> ReadResult<&mut Self>
pub unsafe fn init_header_with( &mut self, initializer: impl FnMut(&mut MaybeUninit<<MessageHeader as SchemaRead<'_, WincodeConfig>>::Dst>) -> 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> as SchemaRead<'_, WincodeConfig>>::Dst>
pub const fn uninit_account_keys_mut( &mut self, ) -> &mut MaybeUninit<<Vec<Address> as SchemaRead<'_, WincodeConfig>>::Dst>
Get a mutable reference to the maybe uninitialized field.
Sourcepub fn write_account_keys(
&mut self,
val: <Vec<Address> as SchemaRead<'_, WincodeConfig>>::Dst,
) -> &mut Self
pub fn write_account_keys( &mut self, val: <Vec<Address> as SchemaRead<'_, WincodeConfig>>::Dst, ) -> &mut Self
Write a value to the maybe uninitialized field.
Sourcepub fn read_account_keys<'de>(
&mut self,
reader: impl Reader<'de>,
) -> ReadResult<&mut Self>
pub fn read_account_keys<'de>( &mut self, reader: 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> as SchemaRead<'_, WincodeConfig>>::Dst>) -> ReadResult<()>,
) -> ReadResult<&mut Self>
pub unsafe fn init_account_keys_with( &mut self, initializer: impl FnMut(&mut MaybeUninit<<Vec<Address> as SchemaRead<'_, WincodeConfig>>::Dst>) -> 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 as SchemaRead<'_, WincodeConfig>>::Dst>
pub const fn uninit_recent_blockhash_mut( &mut self, ) -> &mut MaybeUninit<<Hash as SchemaRead<'_, WincodeConfig>>::Dst>
Get a mutable reference to the maybe uninitialized field.
Sourcepub fn write_recent_blockhash(
&mut self,
val: <Hash as SchemaRead<'_, WincodeConfig>>::Dst,
) -> &mut Self
pub fn write_recent_blockhash( &mut self, val: <Hash as SchemaRead<'_, WincodeConfig>>::Dst, ) -> &mut Self
Write a value to the maybe uninitialized field.
Sourcepub fn read_recent_blockhash<'de>(
&mut self,
reader: impl Reader<'de>,
) -> ReadResult<&mut Self>
pub fn read_recent_blockhash<'de>( &mut self, reader: 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 as SchemaRead<'_, WincodeConfig>>::Dst>) -> ReadResult<()>,
) -> ReadResult<&mut Self>
pub unsafe fn init_recent_blockhash_with( &mut self, initializer: impl FnMut(&mut MaybeUninit<<Hash as SchemaRead<'_, WincodeConfig>>::Dst>) -> 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> as SchemaRead<'_, WincodeConfig>>::Dst>
pub const fn uninit_instructions_mut( &mut self, ) -> &mut MaybeUninit<<Vec<CompiledInstruction> as SchemaRead<'_, WincodeConfig>>::Dst>
Get a mutable reference to the maybe uninitialized field.
Sourcepub fn write_instructions(
&mut self,
val: <Vec<CompiledInstruction> as SchemaRead<'_, WincodeConfig>>::Dst,
) -> &mut Self
pub fn write_instructions( &mut self, val: <Vec<CompiledInstruction> as SchemaRead<'_, WincodeConfig>>::Dst, ) -> &mut Self
Write a value to the maybe uninitialized field.
Sourcepub fn read_instructions<'de>(
&mut self,
reader: impl Reader<'de>,
) -> ReadResult<&mut Self>
pub fn read_instructions<'de>( &mut self, reader: 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> as SchemaRead<'_, WincodeConfig>>::Dst>) -> ReadResult<()>,
) -> ReadResult<&mut Self>
pub unsafe fn init_instructions_with( &mut self, initializer: impl FnMut(&mut MaybeUninit<<Vec<CompiledInstruction> as SchemaRead<'_, WincodeConfig>>::Dst>) -> 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, WincodeConfig> Freeze for MessageUninitBuilder<'_wincode_inner, WincodeConfig>
impl<'_wincode_inner, WincodeConfig> RefUnwindSafe for MessageUninitBuilder<'_wincode_inner, WincodeConfig>where
WincodeConfig: RefUnwindSafe,
impl<'_wincode_inner, WincodeConfig> Send for MessageUninitBuilder<'_wincode_inner, WincodeConfig>where
WincodeConfig: Send,
impl<'_wincode_inner, WincodeConfig> Sync for MessageUninitBuilder<'_wincode_inner, WincodeConfig>where
WincodeConfig: Sync,
impl<'_wincode_inner, WincodeConfig> Unpin for MessageUninitBuilder<'_wincode_inner, WincodeConfig>where
WincodeConfig: Unpin,
impl<'_wincode_inner, WincodeConfig> UnsafeUnpin for MessageUninitBuilder<'_wincode_inner, WincodeConfig>
impl<'_wincode_inner, WincodeConfig> !UnwindSafe for MessageUninitBuilder<'_wincode_inner, WincodeConfig>
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