pub struct __BindgenUnionField<T>(/* private fields */);Expand description
Zero-sized marker for one member of a bindgen-emulated C union.
The containing record provides the backing bytes shared by all union members. Constructing a marker alone does not allocate or initialize storage for T.
Implementations§
Source§impl<T> __BindgenUnionField<T>
impl<T> __BindgenUnionField<T>
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates the zero-sized field marker without initializing any union storage.
Sourcepub unsafe fn as_ref(&self) -> &T
pub unsafe fn as_ref(&self) -> &T
Borrows the backing union bytes as this member type.
§Safety
The marker address must identify backing storage of at least size_of::<T>() bytes, aligned for T, that contains a valid initialized T. The bytes must remain readable and must not be mutated for the returned reference lifetime, except through interior mutability permitted by T.
Sourcepub unsafe fn as_mut(&mut self) -> &mut T
pub unsafe fn as_mut(&mut self) -> &mut T
Borrows the backing union bytes mutably as this member type.
§Safety
The marker address must identify backing storage of at least size_of::<T>() bytes, aligned for T, that contains a valid initialized T. The caller must hold exclusive access to all bytes covered by the returned reference for its lifetime, including storage shared with other union members.