Struct TransparentPad

Source
#[repr(C)]
pub struct TransparentPad<T, const PAD: usize>(pub T, _);
Expand description

This type adds some const PAD number of “explicit” or “manual” padding bytes to the end of a struct.

This is useful to make a type not have real padding bytes, and therefore be able to be marked as bytemuck::NoUninit. Specifically, it’s used in the ark_api_macros::ffi_union macro to equalize the size of all fields of a union and therefore remove any “real” padding bytes from the union, making it safe to store in WASM memory and pass through the ark module host memory utility functions. It may also be useful in other places.

Tuple Fields§

§0: T

Implementations§

Source§

impl<T, const PAD: usize> TransparentPad<T, PAD>

Source

pub fn new(inner: T) -> Self

Trait Implementations§

Source§

impl<T, const PAD: usize> AsMut<T> for TransparentPad<T, PAD>

Source§

fn as_mut(&mut self) -> &mut T

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T, const PAD: usize> AsRef<T> for TransparentPad<T, PAD>

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<const PAD: usize> CheckedBitPattern for TransparentPad<AnimateValue, PAD>

Source§

type Bits = TransparentPad<<AnimateValue as CheckedBitPattern>::Bits, PAD>

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(bits: &Self::Bits) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<const PAD: usize> CheckedBitPattern for TransparentPad<AnimationReply, PAD>

Source§

type Bits = TransparentPad<<AnimationReply as CheckedBitPattern>::Bits, PAD>

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(bits: &Self::Bits) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<const PAD: usize> CheckedBitPattern for TransparentPad<AxisInput, PAD>

Source§

type Bits = TransparentPad<<AxisInput as CheckedBitPattern>::Bits, PAD>

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(bits: &Self::Bits) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<const PAD: usize> CheckedBitPattern for TransparentPad<CollisionMatrixRow, PAD>

Source§

type Bits = TransparentPad<<CollisionMatrixRow as CheckedBitPattern>::Bits, PAD>

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(bits: &Self::Bits) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<const PAD: usize> CheckedBitPattern for TransparentPad<GamepadButtonInput, PAD>

Source§

type Bits = TransparentPad<<GamepadButtonInput as CheckedBitPattern>::Bits, PAD>

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(bits: &Self::Bits) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<const PAD: usize> CheckedBitPattern for TransparentPad<KeyInput, PAD>

Source§

type Bits = TransparentPad<<KeyInput as CheckedBitPattern>::Bits, PAD>

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(bits: &Self::Bits) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<const PAD: usize> CheckedBitPattern for TransparentPad<MouseInput, PAD>

Source§

type Bits = TransparentPad<<MouseInput as CheckedBitPattern>::Bits, PAD>

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(bits: &Self::Bits) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<const PAD: usize> CheckedBitPattern for TransparentPad<OnTrigger, PAD>

Source§

type Bits = TransparentPad<<OnTrigger as CheckedBitPattern>::Bits, PAD>

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(bits: &Self::Bits) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<const PAD: usize> CheckedBitPattern for TransparentPad<PhysicsForceRequest, PAD>

Source§

type Bits = TransparentPad<<PhysicsForceRequest as CheckedBitPattern>::Bits, PAD>

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(bits: &Self::Bits) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<const PAD: usize> CheckedBitPattern for TransparentPad<PhysicsForceRequest2, PAD>

Source§

type Bits = TransparentPad<<PhysicsForceRequest2 as CheckedBitPattern>::Bits, PAD>

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(bits: &Self::Bits) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<const PAD: usize> CheckedBitPattern for TransparentPad<RawMidiInput, PAD>

Source§

type Bits = TransparentPad<<RawMidiInput as CheckedBitPattern>::Bits, PAD>

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(bits: &Self::Bits) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<const PAD: usize> CheckedBitPattern for TransparentPad<SetActive, PAD>

Source§

type Bits = TransparentPad<<SetActive as CheckedBitPattern>::Bits, PAD>

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(bits: &Self::Bits) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<const PAD: usize> CheckedBitPattern for TransparentPad<SetActiveForPlayer, PAD>

Source§

type Bits = TransparentPad<<SetActiveForPlayer as CheckedBitPattern>::Bits, PAD>

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(bits: &Self::Bits) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<const PAD: usize> CheckedBitPattern for TransparentPad<SetValue, PAD>

Source§

type Bits = TransparentPad<<SetValue as CheckedBitPattern>::Bits, PAD>

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(bits: &Self::Bits) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<const PAD: usize> CheckedBitPattern for TransparentPad<TouchInput, PAD>

Source§

type Bits = TransparentPad<<TouchInput as CheckedBitPattern>::Bits, PAD>

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(bits: &Self::Bits) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T: Clone, const PAD: usize> Clone for TransparentPad<T, PAD>

Source§

fn clone(&self) -> TransparentPad<T, PAD>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T, const PAD: usize> Deref for TransparentPad<T, PAD>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T, const PAD: usize> DerefMut for TransparentPad<T, PAD>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T: Zeroable, const PAD: usize> Zeroable for TransparentPad<T, PAD>

Source§

fn zeroed() -> Self

Source§

impl<T: AnyBitPattern, const PAD: usize> AnyBitPattern for TransparentPad<T, PAD>

Source§

impl<T: Copy, const PAD: usize> Copy for TransparentPad<T, PAD>

Source§

impl NoUninit for TransparentPad<[f32; 2], __ValueData_data_vec2_PADDING>

Source§

impl NoUninit for TransparentPad<[f32; 3], __ValueData_data_vec3_PADDING>

Source§

impl NoUninit for TransparentPad<[f32; 4], __ValueData_data_vec4_PADDING>

Source§

impl NoUninit for TransparentPad<AnimateValue, __MessagePayload_animate_value_PADDING>

Source§

impl NoUninit for TransparentPad<AnimationReply, __MessagePayload_animation_reply_PADDING>

Source§

impl NoUninit for TransparentPad<AxisInput, __EventUnion_axis_PADDING>

Source§

impl NoUninit for TransparentPad<CollisionMatrixRow, __MessagePayload_collision_matrix_row_PADDING>

Source§

impl NoUninit for TransparentPad<GamepadButtonInput, __EventUnion_gamepad_button_PADDING>

Source§

impl NoUninit for TransparentPad<KeyInput, __EventUnion_key_PADDING>

Source§

impl NoUninit for TransparentPad<MouseInput, __EventUnion_mouse_PADDING>

Source§

impl NoUninit for TransparentPad<OnCollision, __MessagePayload_on_collision_PADDING>

Source§

impl NoUninit for TransparentPad<OnTrigger, __MessagePayload_on_trigger_PADDING>

Source§

impl NoUninit for TransparentPad<PhysicsForceRequest, __MessagePayload_physics_force_request_PADDING>

Source§

impl NoUninit for TransparentPad<PhysicsForceRequest2, __MessagePayload_physics_force_request2_PADDING>

Source§

impl NoUninit for TransparentPad<PodBool, __ValueData_data_bool_PADDING>

Source§

impl NoUninit for TransparentPad<RawMidiInput, __EventUnion_raw_midi_PADDING>

Source§

impl NoUninit for TransparentPad<SetActive, __MessagePayload_set_active_PADDING>

Source§

impl NoUninit for TransparentPad<SetActiveForPlayer, __MessagePayload_set_active_for_player_PADDING>

Source§

impl NoUninit for TransparentPad<SetValue, __MessagePayload_set_value_PADDING>

Source§

impl NoUninit for TransparentPad<SpatialQueryBehindPlane, __MessagePayload_spatial_query_behind_plane_PADDING>

Source§

impl NoUninit for TransparentPad<SpatialQueryBehindPlane2, __MessagePayload_spatial_query_behind_plane2_PADDING>

Source§

impl NoUninit for TransparentPad<SpatialQueryHits, __MessagePayload_spatial_query_hits_PADDING>

Source§

impl NoUninit for TransparentPad<SpatialQueryRaycast, __MessagePayload_spatial_query_raycast_PADDING>

Source§

impl NoUninit for TransparentPad<SpatialQueryRaycast2, __MessagePayload_spatial_query_raycast2_PADDING>

Source§

impl NoUninit for TransparentPad<SpatialQueryResult, __MessagePayload_spatial_query_result_PADDING>

Source§

impl NoUninit for TransparentPad<SpatialQuerySpherecast, __MessagePayload_spatial_query_spherecast_PADDING>

Source§

impl NoUninit for TransparentPad<SpatialQueryWithinSphere, __MessagePayload_spatial_query_within_sphere_PADDING>

Source§

impl NoUninit for TransparentPad<SpatialQueryWithinSphere2, __MessagePayload_spatial_query_within_sphere2_PADDING>

Source§

impl NoUninit for TransparentPad<TouchInput, __EventUnion_touch_PADDING>

Source§

impl NoUninit for TransparentPad<f32, __ValueData_data_f32_PADDING>

Source§

impl NoUninit for TransparentPad<i64, __ValueData_data_i64_PADDING>

Source§

impl NoUninit for TransparentPad<u8, __MessagePayload_empty_PADDING>

Auto Trait Implementations§

§

impl<T, const PAD: usize> Freeze for TransparentPad<T, PAD>
where T: Freeze,

§

impl<T, const PAD: usize> RefUnwindSafe for TransparentPad<T, PAD>
where T: RefUnwindSafe,

§

impl<T, const PAD: usize> Send for TransparentPad<T, PAD>
where T: Send,

§

impl<T, const PAD: usize> Sync for TransparentPad<T, PAD>
where T: Sync,

§

impl<T, const PAD: usize> Unpin for TransparentPad<T, PAD>
where T: Unpin,

§

impl<T, const PAD: usize> UnwindSafe for TransparentPad<T, PAD>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.