referrerpolicy=no-referrer-when-downgrade

Trait Inspect

Source
pub trait Inspect<AccountId> {
    type ItemId: Parameter;

    // Required method
    fn owner(item: &Self::ItemId) -> Option<AccountId>;

    // Provided methods
    fn attribute(_item: &Self::ItemId, _key: &[u8]) -> Option<Vec<u8>> { ... }
    fn custom_attribute(
        _account: &AccountId,
        _item: &Self::ItemId,
        _key: &[u8],
    ) -> Option<Vec<u8>> { ... }
    fn system_attribute(_item: &Self::ItemId, _key: &[u8]) -> Option<Vec<u8>> { ... }
    fn typed_attribute<K: Encode, V: Decode>(
        item: &Self::ItemId,
        key: &K,
    ) -> Option<V> { ... }
    fn typed_custom_attribute<K: Encode, V: Decode>(
        account: &AccountId,
        item: &Self::ItemId,
        key: &K,
    ) -> Option<V> { ... }
    fn typed_system_attribute<K: Encode, V: Decode>(
        item: &Self::ItemId,
        key: &K,
    ) -> Option<V> { ... }
    fn can_transfer(_item: &Self::ItemId) -> bool { ... }
}
Expand description

Trait for providing an interface to a read-only NFT-like item.

Required Associated Types§

Source

type ItemId: Parameter

Type for identifying an item.

Required Methods§

Source

fn owner(item: &Self::ItemId) -> Option<AccountId>

Returns the owner of item, or None if the item doesn’t exist or has no owner.

Provided Methods§

Source

fn attribute(_item: &Self::ItemId, _key: &[u8]) -> Option<Vec<u8>>

Returns the attribute value of item corresponding to key.

By default this is None; no attributes are defined.

Source

fn custom_attribute( _account: &AccountId, _item: &Self::ItemId, _key: &[u8], ) -> Option<Vec<u8>>

Returns the custom attribute value of item corresponding to key.

By default this is None; no attributes are defined.

Source

fn system_attribute(_item: &Self::ItemId, _key: &[u8]) -> Option<Vec<u8>>

Returns the system attribute value of item corresponding to key.

By default this is None; no attributes are defined.

Source

fn typed_attribute<K: Encode, V: Decode>( item: &Self::ItemId, key: &K, ) -> Option<V>

Returns the strongly-typed attribute value of item corresponding to key.

By default this just attempts to use attribute.

Source

fn typed_custom_attribute<K: Encode, V: Decode>( account: &AccountId, item: &Self::ItemId, key: &K, ) -> Option<V>

Returns the strongly-typed custom attribute value of item corresponding to key.

By default this just attempts to use custom_attribute.

Source

fn typed_system_attribute<K: Encode, V: Decode>( item: &Self::ItemId, key: &K, ) -> Option<V>

Returns the strongly-typed system attribute value of item corresponding to key.

By default this just attempts to use system_attribute.

Source

fn can_transfer(_item: &Self::ItemId) -> bool

Returns true if the item may be transferred.

Default implementation is that all items are transferable.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<F: Inspect<AccountId>, A: Get<<F as Inspect<AccountId>>::CollectionId>, AccountId> Inspect<AccountId> for ItemOf<F, A, AccountId>

Source§

type ItemId = <F as Inspect<AccountId>>::ItemId