Struct CopyOptimization
pub struct CopyOptimization<T, U>(/* private fields */)
where
T: ?Sized,
U: ?Sized;
Expand description
An optimization hint about whether the conversion from T
to U
is equivalent to copying the
raw bytes of T
.
Implementations§
§impl<T, U> CopyOptimization<T, U>
impl<T, U> CopyOptimization<T, U>
pub const unsafe fn enable() -> CopyOptimization<T, U>
pub const unsafe fn enable() -> CopyOptimization<T, U>
Returns a CopyOptimization
hint with the optimization enabled.
§Safety
T
and U
must be the same size and must not have any uninit bytes (e.g. padding).
pub const unsafe fn enable_if(value: bool) -> CopyOptimization<T, U>
pub const unsafe fn enable_if(value: bool) -> CopyOptimization<T, U>
Returns a CopyOptimization
hint with the optimization enabled if value
is true
.
§Safety
T
and U
must be the same size and must not have any uninit bytes (e.g. padding) if
value
is true
.
pub const fn disable() -> CopyOptimization<T, U>
pub const fn disable() -> CopyOptimization<T, U>
Returns a CopyOptimization
hint with the optimization disabled.
pub const fn is_enabled(&self) -> bool
pub const fn is_enabled(&self) -> bool
Returns whether the optimization is enabled.
pub const fn infer_array<const N: usize>(
&self,
) -> CopyOptimization<[T; N], [U; N]>
pub const fn infer_array<const N: usize>( &self, ) -> CopyOptimization<[T; N], [U; N]>
Infers whether the conversion from [T; N]
to [U; N]
is copy-optimizable based on the
conversion from T
to U
.
pub const fn infer_slice(&self) -> CopyOptimization<[T], [U]>
pub const fn infer_slice(&self) -> CopyOptimization<[T], [U]>
Infers whether the conversion from [T]
to [U]
is copy-optimizable based on the
conversion from T
to U
.
§impl<T> CopyOptimization<T, T>where
T: ?Sized,
impl<T> CopyOptimization<T, T>where
T: ?Sized,
pub const fn identity() -> CopyOptimization<T, T>
pub const fn identity() -> CopyOptimization<T, T>
Returns an enabled CopyOptimization
, as copy optimization is always enabled from a type to
itself.
§impl CopyOptimization<(), ()>
impl CopyOptimization<(), ()>
pub const PRIMITIVE: CopyOptimization<(), ()>
pub const PRIMITIVE: CopyOptimization<(), ()>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<bool, bool>
impl CopyOptimization<bool, bool>
pub const PRIMITIVE: CopyOptimization<bool, bool>
pub const PRIMITIVE: CopyOptimization<bool, bool>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<i8, i8>
impl CopyOptimization<i8, i8>
pub const PRIMITIVE: CopyOptimization<i8, i8>
pub const PRIMITIVE: CopyOptimization<i8, i8>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<WireI16, WireI16>
impl CopyOptimization<WireI16, WireI16>
pub const PRIMITIVE: CopyOptimization<WireI16, WireI16>
pub const PRIMITIVE: CopyOptimization<WireI16, WireI16>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<i16, WireI16>
impl CopyOptimization<i16, WireI16>
pub const PRIMITIVE: CopyOptimization<i16, WireI16>
pub const PRIMITIVE: CopyOptimization<i16, WireI16>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<WireI16, i16>
impl CopyOptimization<WireI16, i16>
pub const PRIMITIVE: CopyOptimization<WireI16, i16>
pub const PRIMITIVE: CopyOptimization<WireI16, i16>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<WireI32, WireI32>
impl CopyOptimization<WireI32, WireI32>
pub const PRIMITIVE: CopyOptimization<WireI32, WireI32>
pub const PRIMITIVE: CopyOptimization<WireI32, WireI32>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<i32, WireI32>
impl CopyOptimization<i32, WireI32>
pub const PRIMITIVE: CopyOptimization<i32, WireI32>
pub const PRIMITIVE: CopyOptimization<i32, WireI32>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<WireI32, i32>
impl CopyOptimization<WireI32, i32>
pub const PRIMITIVE: CopyOptimization<WireI32, i32>
pub const PRIMITIVE: CopyOptimization<WireI32, i32>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<WireI64, WireI64>
impl CopyOptimization<WireI64, WireI64>
pub const PRIMITIVE: CopyOptimization<WireI64, WireI64>
pub const PRIMITIVE: CopyOptimization<WireI64, WireI64>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<i64, WireI64>
impl CopyOptimization<i64, WireI64>
pub const PRIMITIVE: CopyOptimization<i64, WireI64>
pub const PRIMITIVE: CopyOptimization<i64, WireI64>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<WireI64, i64>
impl CopyOptimization<WireI64, i64>
pub const PRIMITIVE: CopyOptimization<WireI64, i64>
pub const PRIMITIVE: CopyOptimization<WireI64, i64>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<u8, u8>
impl CopyOptimization<u8, u8>
pub const PRIMITIVE: CopyOptimization<u8, u8>
pub const PRIMITIVE: CopyOptimization<u8, u8>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<WireU16, WireU16>
impl CopyOptimization<WireU16, WireU16>
pub const PRIMITIVE: CopyOptimization<WireU16, WireU16>
pub const PRIMITIVE: CopyOptimization<WireU16, WireU16>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<u16, WireU16>
impl CopyOptimization<u16, WireU16>
pub const PRIMITIVE: CopyOptimization<u16, WireU16>
pub const PRIMITIVE: CopyOptimization<u16, WireU16>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<WireU16, u16>
impl CopyOptimization<WireU16, u16>
pub const PRIMITIVE: CopyOptimization<WireU16, u16>
pub const PRIMITIVE: CopyOptimization<WireU16, u16>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<WireU32, WireU32>
impl CopyOptimization<WireU32, WireU32>
pub const PRIMITIVE: CopyOptimization<WireU32, WireU32>
pub const PRIMITIVE: CopyOptimization<WireU32, WireU32>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<u32, WireU32>
impl CopyOptimization<u32, WireU32>
pub const PRIMITIVE: CopyOptimization<u32, WireU32>
pub const PRIMITIVE: CopyOptimization<u32, WireU32>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<WireU32, u32>
impl CopyOptimization<WireU32, u32>
pub const PRIMITIVE: CopyOptimization<WireU32, u32>
pub const PRIMITIVE: CopyOptimization<WireU32, u32>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<WireU64, WireU64>
impl CopyOptimization<WireU64, WireU64>
pub const PRIMITIVE: CopyOptimization<WireU64, WireU64>
pub const PRIMITIVE: CopyOptimization<WireU64, WireU64>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<u64, WireU64>
impl CopyOptimization<u64, WireU64>
pub const PRIMITIVE: CopyOptimization<u64, WireU64>
pub const PRIMITIVE: CopyOptimization<u64, WireU64>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<WireU64, u64>
impl CopyOptimization<WireU64, u64>
pub const PRIMITIVE: CopyOptimization<WireU64, u64>
pub const PRIMITIVE: CopyOptimization<WireU64, u64>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<WireF32, WireF32>
impl CopyOptimization<WireF32, WireF32>
pub const PRIMITIVE: CopyOptimization<WireF32, WireF32>
pub const PRIMITIVE: CopyOptimization<WireF32, WireF32>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<f32, WireF32>
impl CopyOptimization<f32, WireF32>
pub const PRIMITIVE: CopyOptimization<f32, WireF32>
pub const PRIMITIVE: CopyOptimization<f32, WireF32>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<WireF32, f32>
impl CopyOptimization<WireF32, f32>
pub const PRIMITIVE: CopyOptimization<WireF32, f32>
pub const PRIMITIVE: CopyOptimization<WireF32, f32>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<WireF64, WireF64>
impl CopyOptimization<WireF64, WireF64>
pub const PRIMITIVE: CopyOptimization<WireF64, WireF64>
pub const PRIMITIVE: CopyOptimization<WireF64, WireF64>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<f64, WireF64>
impl CopyOptimization<f64, WireF64>
pub const PRIMITIVE: CopyOptimization<f64, WireF64>
pub const PRIMITIVE: CopyOptimization<f64, WireF64>
Whether copy optimization between the two primitive types is enabled.
§impl CopyOptimization<WireF64, f64>
impl CopyOptimization<WireF64, f64>
pub const PRIMITIVE: CopyOptimization<WireF64, f64>
pub const PRIMITIVE: CopyOptimization<WireF64, f64>
Whether copy optimization between the two primitive types is enabled.