Struct ink_metadata::TypeSpec [−][src]
Expand description
A type specification.
This contains the actual type as well as an optional compile-time known displayed representation of the type. This is useful for cases where the type is used through a type alias in order to provide information about the alias name.
Examples
Consider the following Rust function:
fn is_sorted(input: &[i32], pred: Predicate) -> bool;
In this above example input
would have no displayable name,
pred
s display name is Predicate
and the display name of
the return type is simply bool
. Note that Predicate
could
simply be a type alias to fn(i32, i32) -> Ordering
.
Implementations
pub fn with_name_segs<T, S>(segments: S) -> Self where
T: TypeInfo + 'static,
S: IntoIterator<Item = &'static str>,
pub fn with_name_segs<T, S>(segments: S) -> Self where
T: TypeInfo + 'static,
S: IntoIterator<Item = &'static str>,
Returns the compile-time known displayed representation of the type.
Trait Implementations
impl<'de, F: Form> Deserialize<'de> for TypeSpec<F> where
F::Type: DeserializeOwned,
F::String: DeserializeOwned,
impl<'de, F: Form> Deserialize<'de> for TypeSpec<F> where
F::Type: DeserializeOwned,
F::String: DeserializeOwned,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
type Output = TypeSpec<PortableForm>
type Output = TypeSpec<PortableForm>
The portable version of Self
.
Convert self
to the portable form by using the registry for caching.