Struct core_extensions::phantom::AndPhantomCov
source · [−]#[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
impl<T> RefUnwindSafe for AndPhantomCov<T> where
T: RefUnwindSafe,
impl<T> Send for AndPhantomCov<T> where
T: Send,
impl<T> Sync for AndPhantomCov<T> where
T: Sync,
impl<T> Unpin for AndPhantomCov<T> where
T: Unpin,
impl<T> UnwindSafe for AndPhantomCov<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> AsPhantomData for T where
T: ?Sized,
impl<T> AsPhantomData for T where
T: ?Sized,
sourcefn as_phantom(&self) -> PhantomData<Self>
fn as_phantom(&self) -> PhantomData<Self>
Available on crate feature
phantom
only.Gets a PhantomData<Self>
. Read more
sourcefn as_phantom_covariant(&self) -> PhantomData<fn() -> Self>
fn as_phantom_covariant(&self) -> PhantomData<fn() -> Self>
Available on crate feature
phantom
only.Gets a PhantomData<fn() -> Self>
, a covariant PhantomData
.
sourcefn as_phantom_contra(&self) -> PhantomData<fn(_: Self)>
fn as_phantom_contra(&self) -> PhantomData<fn(_: Self)>
Available on crate feature
phantom
only.Gets a PhantomData<fn(Self)>
, a contravariant PhantomData
.
sourcefn as_phantom_invariant(&self) -> PhantomData<fn(_: Self) -> Self>
fn as_phantom_invariant(&self) -> PhantomData<fn(_: Self) -> Self>
Available on crate feature
phantom
only.Gets a PhantomData<fn(Self) -> Self>
, an invariant PhantomData
.
sourceconst PHANTOM: PhantomData<Self> = PhantomData
const PHANTOM: PhantomData<Self> = PhantomData
Available on crate feature
phantom
only.Gets a PhantomData<Self>
. Read more
sourceconst PHANTOM_COVARIANT: PhantomData<fn() -> Self> = PhantomData
const PHANTOM_COVARIANT: PhantomData<fn() -> Self> = PhantomData
Available on crate feature
phantom
only.Constructs a PhantomData<fn() -> T>
, a covariant PhantomData
. Read more
sourceconst PHANTOM_CONTRA: PhantomData<fn(_: Self)> = PhantomData
const PHANTOM_CONTRA: PhantomData<fn(_: Self)> = PhantomData
Available on crate feature
phantom
only.Gets a PhantomData<fn(Self)>
, a contravariant PhantomData
. Read more
sourceconst PHANTOM_INVARIANT: PhantomData<fn(_: Self) -> Self> = PhantomData
const PHANTOM_INVARIANT: PhantomData<fn(_: Self) -> Self> = PhantomData
Available on crate feature
phantom
only.Gets a PhantomData<fn(Self) -> Self>
, an invariant PhantomData
. Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CallExt for T where
T: ?Sized,
impl<T> CallExt for T where
T: ?Sized,
sourcefn ref_call<P>(&self, params: P) -> Self::Returns where
Self: CallRef<P>,
fn ref_call<P>(&self, params: P) -> Self::Returns where
Self: CallRef<P>,
Available on crate feature
callable
only.For calling CallRef::ref_call_
,
with the ability to specify the types of the arguments.. Read more