pub struct TypeDefPhantom<T: Form = MetaForm> { /* private fields */ }
Expand description
A type describing a PhantomData<T>
type.
In the context of SCALE encoded types, including PhantomData<T>
types in
the type info might seem surprising. The reason to include this information
is that there could be situations where it’s useful and because removing
PhantomData
items from the derive input quickly becomes a messy
syntax-level hack (see PR https://github.com/tetcoin/tetsy-scale-info/pull/31).
Instead we take the same approach as tetsy-scale-codec
where users are
required to explicitly skip fields that cannot be represented in SCALE
encoding, using the #[codec(skip)]
attribute.
Implementations§
Source§impl<T> TypeDefPhantom<T>where
T: Form,
impl<T> TypeDefPhantom<T>where
T: Form,
Sourcepub fn type_param(&self) -> &T::Type
pub fn type_param(&self) -> &T::Type
Returns the type parameter type of the phantom type.
Trait Implementations§
Source§impl<T: Clone + Form> Clone for TypeDefPhantom<T>
impl<T: Clone + Form> Clone for TypeDefPhantom<T>
Source§fn clone(&self) -> TypeDefPhantom<T>
fn clone(&self) -> TypeDefPhantom<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T: Form> Decode for TypeDefPhantom<T>
impl<T: Form> Decode for TypeDefPhantom<T>
Source§impl<T: Form> Encode for TypeDefPhantom<T>
impl<T: Form> Encode for TypeDefPhantom<T>
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Convert self to a slice and append it to the destination.
Source§fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
Source§impl<T: Form> From<TypeDefPhantom<T>> for TypeDef<T>
impl<T: Form> From<TypeDefPhantom<T>> for TypeDef<T>
Source§fn from(original: TypeDefPhantom<T>) -> TypeDef<T>
fn from(original: TypeDefPhantom<T>) -> TypeDef<T>
Converts to this type from the input type.
Source§impl From<TypeDefPhantom> for Type
impl From<TypeDefPhantom> for Type
Source§fn from(phantom: TypeDefPhantom) -> Self
fn from(phantom: TypeDefPhantom) -> Self
Converts to this type from the input type.
Source§impl IntoPortable for TypeDefPhantom
impl IntoPortable for TypeDefPhantom
Source§type Output = TypeDefPhantom<PortableForm>
type Output = TypeDefPhantom<PortableForm>
The portable version of
Self
.Source§fn into_portable(self, registry: &mut Registry) -> Self::Output
fn into_portable(self, registry: &mut Registry) -> Self::Output
Convert
self
to the portable form by using the registry for caching.Source§impl<T: Ord + Form> Ord for TypeDefPhantom<T>
impl<T: Ord + Form> Ord for TypeDefPhantom<T>
Source§fn cmp(&self, other: &TypeDefPhantom<T>) -> Ordering
fn cmp(&self, other: &TypeDefPhantom<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd + Form> PartialOrd for TypeDefPhantom<T>where
T::Type: PartialOrd,
impl<T: PartialOrd + Form> PartialOrd for TypeDefPhantom<T>where
T::Type: PartialOrd,
impl<T: Form> EncodeLike for TypeDefPhantom<T>
impl<T: Eq + Form> Eq for TypeDefPhantom<T>
impl<T: Form> StructuralPartialEq for TypeDefPhantom<T>
Auto Trait Implementations§
impl<T> Freeze for TypeDefPhantom<T>
impl<T> RefUnwindSafe for TypeDefPhantom<T>
impl<T> Send for TypeDefPhantom<T>
impl<T> Sync for TypeDefPhantom<T>
impl<T> Unpin for TypeDefPhantom<T>
impl<T> UnwindSafe for TypeDefPhantom<T>
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