Struct ink_metadata::TypeSpec
source · [−]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
sourceimpl TypeSpec
impl TypeSpec
sourcepub fn with_name_str<T>(display_name: &'static str) -> Self where
T: TypeInfo + 'static,
pub fn with_name_str<T>(display_name: &'static str) -> Self where
T: TypeInfo + 'static,
sourcepub 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>,
sourceimpl<F> TypeSpec<F> where
F: Form,
impl<F> TypeSpec<F> where
F: Form,
sourcepub fn display_name(&self) -> &DisplayName<F>
pub fn display_name(&self) -> &DisplayName<F>
Returns the compile-time known displayed representation of the type.
Trait Implementations
sourceimpl<'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,
sourcefn 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
sourceimpl IntoPortable for TypeSpec
impl IntoPortable for TypeSpec
type Output = TypeSpec<PortableForm>
type Output = TypeSpec<PortableForm>
The portable version of Self
.
sourcefn 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.
impl<F: Eq + Form> Eq for TypeSpec<F> where
F::Type: Eq,
impl<F: Form> StructuralEq for TypeSpec<F>
impl<F: Form> StructuralPartialEq for TypeSpec<F>
Auto Trait Implementations
impl<F> RefUnwindSafe for TypeSpec<F> where
<F as Form>::String: RefUnwindSafe,
<F as Form>::Type: RefUnwindSafe,
impl<F> Send for TypeSpec<F> where
<F as Form>::String: Send,
<F as Form>::Type: Send,
impl<F> Sync for TypeSpec<F> where
<F as Form>::String: Sync,
<F as Form>::Type: Sync,
impl<F> Unpin for TypeSpec<F> where
<F as Form>::String: Unpin,
<F as Form>::Type: Unpin,
impl<F> UnwindSafe for TypeSpec<F> where
<F as Form>::String: UnwindSafe,
<F as Form>::Type: UnwindSafe,
Blanket Implementations
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