#[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> Freeze for AndPhantomCov<T>where
T: Freeze,
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§
Source§impl<T> AsPhantomData for Twhere
T: ?Sized,
impl<T> AsPhantomData for Twhere
T: ?Sized,
Source§fn as_phantom(&self) -> PhantomData<Self>
fn as_phantom(&self) -> PhantomData<Self>
Available on crate feature
phantom
only.Gets a
PhantomData<Self>
. Read moreSource§fn 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
.Source§fn 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
.Source§fn 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
.Source§const PHANTOM: PhantomData<Self> = PhantomData
const PHANTOM: PhantomData<Self> = PhantomData
Available on crate feature
phantom
only.Gets a
PhantomData<Self>
. Read moreSource§const PHANTOM_COVARIANT: PhantomData<fn() -> Self> = PhantomData
const PHANTOM_COVARIANT: PhantomData<fn() -> Self> = PhantomData
Available on crate feature
phantom
only.Source§const PHANTOM_CONTRA: PhantomData<fn(Self)> = PhantomData
const PHANTOM_CONTRA: PhantomData<fn(Self)> = PhantomData
Available on crate feature
phantom
only.Source§const PHANTOM_INVARIANT: PhantomData<fn(Self) -> Self> = PhantomData
const PHANTOM_INVARIANT: PhantomData<fn(Self) -> Self> = PhantomData
Available on crate feature
phantom
only.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
Source§impl<T> CallExt for Twhere
T: ?Sized,
impl<T> CallExt for Twhere
T: ?Sized,
Source§fn ref_call<P>(&self, params: P) -> Self::Returnswhere
Self: CallRef<P>,
fn ref_call<P>(&self, params: P) -> Self::Returnswhere
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 moreSource§impl<T> SelfOps for Twhere
T: ?Sized,
impl<T> SelfOps for Twhere
T: ?Sized,
Source§fn piped<F, U>(self, f: F) -> U
fn piped<F, U>(self, f: F) -> U
Available on crate feature
self_ops
only.Emulates the pipeline operator, allowing method syntax in more places. Read more
Source§fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
Available on crate feature
self_ops
only.The same as
piped
except that the function takes &Self
Useful for functions that take &Self
instead of Self
. Read moreSource§fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
Available on crate feature
self_ops
only.The same as
piped
, except that the function takes &mut Self
.
Useful for functions that take &mut Self
instead of Self
.Source§fn mutated<F>(self, f: F) -> Self
fn mutated<F>(self, f: F) -> Self
Available on crate feature
self_ops
only.Mutates self using a closure taking self by mutable reference,
passing it along the method chain. Read more
Source§fn observe<F>(self, f: F) -> Self
fn observe<F>(self, f: F) -> Self
Available on crate feature
self_ops
only.Observes the value of self, passing it along unmodified.
Useful in long method chains. Read more
Source§fn as_ref_<T: ?Sized>(&self) -> &Twhere
Self: AsRef<T>,
fn as_ref_<T: ?Sized>(&self) -> &Twhere
Self: AsRef<T>,
Available on crate feature
self_ops
only.Performs a reference to reference conversion with
AsRef
,
using the turbofish .as_ref_::<_>()
syntax. Read moreSource§impl<T> TypeIdentity for Twhere
T: ?Sized,
impl<T> TypeIdentity for Twhere
T: ?Sized,
Source§fn into_type(self) -> Self::Type
fn into_type(self) -> Self::Type
Available on crate feature
type_identity
only.Converts a value back to the original type.
Source§fn as_type(&self) -> &Self::Type
fn as_type(&self) -> &Self::Type
Available on crate feature
type_identity
only.Converts a reference back to the original type.
Source§fn as_type_mut(&mut self) -> &mut Self::Type
fn as_type_mut(&mut self) -> &mut Self::Type
Available on crate feature
type_identity
only.Converts a mutable reference back to the original type.
Source§fn into_type_box(self: Box<Self>) -> Box<Self::Type>
fn into_type_box(self: Box<Self>) -> Box<Self::Type>
Available on crate features
type_identity
and alloc
only.Converts a box back to the original type.
Source§fn into_type_arc(self: Arc<Self>) -> Arc<Self::Type>
fn into_type_arc(self: Arc<Self>) -> Arc<Self::Type>
Available on crate features
type_identity
and alloc
only.Converts an Arc back to the original type. Read more
Source§fn into_type_rc(self: Rc<Self>) -> Rc<Self::Type>
fn into_type_rc(self: Rc<Self>) -> Rc<Self::Type>
Available on crate features
type_identity
and alloc
only.Converts an Rc back to the original type. Read more
Source§fn from_type(this: Self::Type) -> Self
fn from_type(this: Self::Type) -> Self
Available on crate feature
type_identity
only.Converts a value back to the original type.
Source§fn from_type_ref(this: &Self::Type) -> &Self
fn from_type_ref(this: &Self::Type) -> &Self
Available on crate feature
type_identity
only.Converts a reference back to the original type.
Source§fn from_type_mut(this: &mut Self::Type) -> &mut Self
fn from_type_mut(this: &mut Self::Type) -> &mut Self
Available on crate feature
type_identity
only.Converts a mutable reference back to the original type.
Source§fn from_type_box(this: Box<Self::Type>) -> Box<Self>
fn from_type_box(this: Box<Self::Type>) -> Box<Self>
Available on crate features
type_identity
and alloc
only.Converts a box back to the original type.