#[repr(transparent)]
pub struct AndPhantomCov<T>(pub PhantomData<fn() -> T>, pub T);
Available on crate feature phantom only.
Expand description

A pair of PhantomData<fn() -> T> and T. useful for infering the type of the value from a PhantomData.

Example

use core_extensions::{AndPhantomCov, AsPhantomData};
 
use std::marker::PhantomData;
 
let foo = [0, 1, 2];
 
let mut bar = AndPhantomCov(foo.as_phantom_covariant(), Default::default()).1;
 
bar[0] = 3;
bar[1] = 5;
bar[2] = 8;
 
assert_eq!(bar[..], [3, 5, 8]);

Tuple Fields

0: PhantomData<fn() -> T>1: T

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Available on crate feature phantom only.

Gets a PhantomData<Self>. Read more

Available on crate feature phantom only.

Gets a PhantomData<fn() -> Self>, a covariant PhantomData.

Available on crate feature phantom only.

Gets a PhantomData<fn(Self)>, a contravariant PhantomData.

Available on crate feature phantom only.

Gets a PhantomData<fn(Self) -> Self>, an invariant PhantomData.

Available on crate feature phantom only.

Gets a PhantomData<Self>. Read more

Available on crate feature phantom only.

Constructs a PhantomData<fn() -> T>, a covariant PhantomData. Read more

Available on crate feature phantom only.

Gets a PhantomData<fn(Self)>, a contravariant PhantomData. Read more

Available on crate feature phantom only.

Gets a PhantomData<fn(Self) -> Self>, an invariant PhantomData. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Available on crate feature callable only.

For calling CallRef::ref_call_, with the ability to specify the types of the arguments.. Read more

Available on crate feature callable only.

For calling CallMut::mut_call_, with the ability to specify the types of the arguments.. Read more

Available on crate feature callable only.

For calling CallInto::into_call_, with the ability to specify the types of the arguments.. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.