pub struct Versioned {
pub id: UID,
pub version: u64,
}
Expand description
A wrapper type that supports versioning of the inner type. The inner type is a dynamic field of the Versioned object, and is keyed using version. User of this type could load the inner object using corresponding type based on the version. You can also upgrade the inner object to a new type version. If you want to support lazy upgrade of the inner type, one caveat is that all APIs would have to use mutable reference even if it’s a read-only API.
Fields§
§id: UID
§version: u64
Implementations§
Source§impl Versioned
impl Versioned
pub fn move_instance(self) -> MoveInstance<Self>
pub fn type_() -> VersionedTypeTag
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Versioned
impl<'de> Deserialize<'de> for Versioned
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 MoveStruct for Versioned
impl MoveStruct for Versioned
type StructTag = VersionedTypeTag
Source§impl MoveType for Versioned
impl MoveType for Versioned
Source§impl StaticModule for Versioned
impl StaticModule for Versioned
fn module() -> Identifier
Source§impl StaticName for Versioned
impl StaticName for Versioned
fn name() -> Identifier
Source§impl StaticTypeParams for Versioned
impl StaticTypeParams for Versioned
fn type_params() -> Vec<TypeTag>
impl Eq for Versioned
impl StructuralPartialEq for Versioned
Auto Trait Implementations§
impl Freeze for Versioned
impl RefUnwindSafe for Versioned
impl Send for Versioned
impl Sync for Versioned
impl Unpin for Versioned
impl UnwindSafe for Versioned
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