pub struct Entity<T>(pub MorphAddr, pub T)
where
T: Clone;Expand description
A distinct state within the context of a life-cycle
A MorphAddr and its entry content represent a chain in the entity’s life-cycle.
§Example: Basic Usage
ActionHash, TryFrom,
};
Entity, MorphAddr,
};
#[derive(Clone)]
struct Content {
pub message: String,
}
let identity_addr = "uhCkkrVjqWkvcFoq2Aw4LOSe6Yx9OgQLMNG-DiXqtT0nLx8uIM2j7";
let revision_addr = "uhCkknDrZjzEgzf8iIQ6aEzbqEYrYBBg1pv_iTNUGAFJovhxOJqu0";
Entity::<Content>(
MorphAddr(
ActionHash::try_from(identity_addr).unwrap(),
ActionHash::try_from(revision_addr).unwrap(),
),
Content {
message: String::from("Hello world"),
}
);Tuple Fields§
§0: MorphAddrThe Metamorphic address relevant to T (the content)
1: TThe content that belong’s to the MorphAddr’s revision address
Implementations§
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Entity<T>where
T: Clone + Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Entity<T>where
T: Clone + Deserialize<'de>,
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
Auto Trait Implementations§
impl<T> Freeze for Entity<T>where
T: Freeze,
impl<T> RefUnwindSafe for Entity<T>where
T: RefUnwindSafe,
impl<T> Send for Entity<T>where
T: Send,
impl<T> Sync for Entity<T>where
T: Sync,
impl<T> Unpin for Entity<T>where
T: Unpin,
impl<T> UnwindSafe for Entity<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