pub struct CopyOptimization<T: ?Sized, U: ?Sized>(/* private fields */);Expand description
An optimization hint about whether the conversion from T to U is equivalent to copying the
raw bytes of T.
Implementations§
Source§impl<T: ?Sized, U: ?Sized> CopyOptimization<T, U>
 
impl<T: ?Sized, U: ?Sized> CopyOptimization<T, U>
Sourcepub const unsafe fn enable() -> Self
 
pub const unsafe fn enable() -> Self
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).
Sourcepub const unsafe fn enable_if(value: bool) -> Self
 
pub const unsafe fn enable_if(value: bool) -> Self
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.
Sourcepub const fn is_enabled(&self) -> bool
 
pub const fn is_enabled(&self) -> bool
Returns whether the optimization is enabled.
Sourcepub 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.
Sourcepub 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.
Source§impl<T: ?Sized> CopyOptimization<T, T>
 
impl<T: ?Sized> CopyOptimization<T, T>
Source§impl CopyOptimization<(), ()>
 
impl CopyOptimization<(), ()>
Source§impl CopyOptimization<bool, bool>
 
impl CopyOptimization<bool, bool>
Source§impl CopyOptimization<i8, i8>
 
impl CopyOptimization<i8, i8>
Source§impl CopyOptimization<i16, WireI16>
 
impl CopyOptimization<i16, WireI16>
Source§impl CopyOptimization<WireI16, i16>
 
impl CopyOptimization<WireI16, i16>
Source§impl CopyOptimization<i32, WireI32>
 
impl CopyOptimization<i32, WireI32>
Source§impl CopyOptimization<WireI32, i32>
 
impl CopyOptimization<WireI32, i32>
Source§impl CopyOptimization<i64, WireI64>
 
impl CopyOptimization<i64, WireI64>
Source§impl CopyOptimization<WireI64, i64>
 
impl CopyOptimization<WireI64, i64>
Source§impl CopyOptimization<u8, u8>
 
impl CopyOptimization<u8, u8>
Source§impl CopyOptimization<u16, WireU16>
 
impl CopyOptimization<u16, WireU16>
Source§impl CopyOptimization<WireU16, u16>
 
impl CopyOptimization<WireU16, u16>
Source§impl CopyOptimization<u32, WireU32>
 
impl CopyOptimization<u32, WireU32>
Source§impl CopyOptimization<WireU32, u32>
 
impl CopyOptimization<WireU32, u32>
Source§impl CopyOptimization<u64, WireU64>
 
impl CopyOptimization<u64, WireU64>
Source§impl CopyOptimization<WireU64, u64>
 
impl CopyOptimization<WireU64, u64>
Source§impl CopyOptimization<f32, WireF32>
 
impl CopyOptimization<f32, WireF32>
Source§impl CopyOptimization<WireF32, f32>
 
impl CopyOptimization<WireF32, f32>
Source§impl CopyOptimization<f64, WireF64>
 
impl CopyOptimization<f64, WireF64>
Auto Trait Implementations§
impl<T, U> Freeze for CopyOptimization<T, U>
impl<T, U> RefUnwindSafe for CopyOptimization<T, U>
impl<T, U> !Send for CopyOptimization<T, U>
impl<T, U> !Sync for CopyOptimization<T, U>
impl<T, U> Unpin for CopyOptimization<T, U>
impl<T, U> UnwindSafe for CopyOptimization<T, U>
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
Mutably borrows from an owned value. Read more