pub struct Display<T: MoveType> {
pub id: UID,
pub fields: VecMap<String, String>,
pub version: u16,
/* private fields */
}
Expand description
The Display<T>
object. Defines the way a T instance should be
displayed. Display object can only be created and modified with
a PublisherCap, making sure that the rules are set by the owner
of the type.
Each of the display properties should support patterns outside of the system, making it simpler to customize Display based on the property values of an Object.
// Example of a display object
Display<0x...::capy::Capy> {
fields:
<name, "Capy { genes }">
<link, "https://capy.art/capy/{ id }">
<image, "https://api.capy.art/capy/{ id }/svg">
<description, "Lovely Capy, one of many">
}
Uses only String type due to external-facing nature of the object, the property names have a priority over their types.
Fields§
§id: UID
§fields: VecMap<String, String>
Contains fields for display. Currently supported fields are: name, link, image and description.
version: u16
Version that can only be updated manually by the Publisher.
Implementations§
Source§impl<T: MoveType> Display<T>
impl<T: MoveType> Display<T>
pub fn move_instance(self, t: <T as MoveType>::TypeTag) -> MoveInstance<Self>
pub fn type_(t: <T as MoveType>::TypeTag) -> DisplayTypeTag<T>
Trait Implementations§
Source§impl<'de, T: MoveType> Deserialize<'de> for Display<T>
impl<'de, T: MoveType> Deserialize<'de> for Display<T>
Source§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
Source§impl<T: MoveType> MoveStruct for Display<T>
impl<T: MoveType> MoveStruct for Display<T>
type StructTag = DisplayTypeTag<T>
Source§impl<T: MoveType> MoveType for Display<T>
impl<T: MoveType> MoveType for Display<T>
Source§impl<T: MoveType> StaticModule for Display<T>
impl<T: MoveType> StaticModule for Display<T>
fn module() -> Identifier
Source§impl<T: MoveType> StaticName for Display<T>
impl<T: MoveType> StaticName for Display<T>
fn name() -> Identifier
Source§impl<T: MoveType + StaticTypeTag> StaticTypeParams for Display<T>
impl<T: MoveType + StaticTypeTag> StaticTypeParams for Display<T>
fn type_params() -> Vec<TypeTag>
impl<T: Eq + MoveType> Eq for Display<T>
impl<T: MoveType> StructuralPartialEq for Display<T>
Auto Trait Implementations§
impl<T> Freeze for Display<T>
impl<T> RefUnwindSafe for Display<T>where
T: RefUnwindSafe,
impl<T> Send for Display<T>where
T: Send,
impl<T> Sync for Display<T>where
T: Sync,
impl<T> Unpin for Display<T>where
T: Unpin,
impl<T> UnwindSafe for Display<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more