[][src]Struct scale_info::TypeDefPhantom

pub struct TypeDefPhantom<T: Form = MetaForm> { /* fields omitted */ }

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/paritytech/scale-info/pull/31). Instead we take the same approach as parity-scale-codec where users are required to explicitly skip fields that cannot be represented in SCALE encoding, using the #[codec(skip)] attribute.

Implementations

impl TypeDefPhantom[src]

pub fn new(type_param: MetaType) -> Self[src]

Creates a new phantom type definition.

impl<T> TypeDefPhantom<T> where
    T: Form
[src]

pub fn type_param(&self) -> &T::Type[src]

Returns the type parameter type of the phantom type.

Trait Implementations

impl<T: Clone + Form> Clone for TypeDefPhantom<T> where
    T::Type: Clone
[src]

impl<T: Debug + Form> Debug for TypeDefPhantom<T> where
    T::Type: Debug
[src]

impl<T: Form> Decode for TypeDefPhantom<T> where
    T::Type: Decode,
    T::Type: Decode
[src]

impl<T: Form> Encode for TypeDefPhantom<T> where
    T::Type: Encode,
    T::Type: Encode
[src]

impl<T: Form> EncodeLike<TypeDefPhantom<T>> for TypeDefPhantom<T> where
    T::Type: Encode,
    T::Type: Encode
[src]

impl<T: Eq + Form> Eq for TypeDefPhantom<T> where
    T::Type: Eq
[src]

impl From<TypeDefPhantom<MetaForm>> for Type[src]

impl<T: Form> From<TypeDefPhantom<T>> for TypeDef<T>[src]

impl IntoPortable for TypeDefPhantom[src]

type Output = TypeDefPhantom<PortableForm>

The portable version of Self.

impl<T: Ord + Form> Ord for TypeDefPhantom<T> where
    T::Type: Ord
[src]

impl<T: PartialEq + Form> PartialEq<TypeDefPhantom<T>> for TypeDefPhantom<T> where
    T::Type: PartialEq
[src]

impl<T: PartialOrd + Form> PartialOrd<TypeDefPhantom<T>> for TypeDefPhantom<T> where
    T::Type: PartialOrd
[src]

impl<T: Form> StructuralEq for TypeDefPhantom<T>[src]

impl<T: Form> StructuralPartialEq for TypeDefPhantom<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for TypeDefPhantom<T> where
    <T as Form>::Type: RefUnwindSafe
[src]

impl<T> Send for TypeDefPhantom<T> where
    <T as Form>::Type: Send
[src]

impl<T> Sync for TypeDefPhantom<T> where
    <T as Form>::Type: Sync
[src]

impl<T> Unpin for TypeDefPhantom<T> where
    <T as Form>::Type: Unpin
[src]

impl<T> UnwindSafe for TypeDefPhantom<T> where
    <T as Form>::Type: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<S> Codec for S where
    S: Encode + Decode
[src]

impl<T> DecodeAll for T where
    T: Decode
[src]

impl<T> DecodeLimit for T where
    T: Decode
[src]

impl<'_, '_, T> EncodeLike<&'_ &'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ mut T> for T where
    T: Encode
[src]

impl<T> EncodeLike<Arc<T>> for T where
    T: Encode
[src]

impl<T> EncodeLike<Box<T, Global>> for T where
    T: Encode
[src]

impl<'a, T> EncodeLike<Cow<'a, T>> for T where
    T: Encode + ToOwned
[src]

impl<T> EncodeLike<Rc<T>> for T where
    T: Encode
[src]

impl<T> From<T> for T[src]

impl<S> FullCodec for S where
    S: Decode + FullEncode
[src]

impl<S> FullEncode for S where
    S: Encode + EncodeLike<S>, 
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> KeyedVec for T where
    T: Codec
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.