pub const fn as_covariant_phantom<T: ?Sized>(_: &T) -> CovariantPhantomData<T>
Available on crate feature phantom only.
Expand description

Gets the PhantomData<fn() -> T> of the passed in T.

Example

use core_extensions::{AndPhantomCov, ConstDefault, as_covariant_phantom};

const SLICE: &[u8] = {
   let array = [0, 1, 2];
    
   // phantom is a PhantomData<fn() -> [i32; 3]>;
   let phantom = as_covariant_phantom(&array).0;
    
   &AndPhantomCov(phantom, ConstDefault::DEFAULT).1
};


assert_eq!(SLICE, [0, 0, 0]);