#[non_exhaustive]pub enum Owner {
Address(Address),
Object(ObjectId),
Shared(Version),
Immutable,
}Expand description
Enum of different types of ownership for an object.
§BCS
The BCS serialized form for this type is defined by the following ABNF:
owner = owner-address / owner-object / owner-shared / owner-immutable
owner-address = %d00 address
owner-object = %d01 object-id
owner-shared = %d02 u64
owner-immutable = %d03Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Address(Address)
Object is exclusively owned by a single address, and is mutable.
Object(ObjectId)
Object is exclusively owned by a single object, and is mutable.
Object is shared, can be used by any address, and is mutable.
Immutable
Object is immutable, and hence ownership doesn’t matter.
Implementations§
Source§impl Owner
impl Owner
Sourcepub fn is_immutable(&self) -> bool
pub fn is_immutable(&self) -> bool
Checks if this is a immutable variant.
Sourcepub fn is_address(&self) -> bool
pub fn is_address(&self) -> bool
Checks if this is a address variant.
Sourcepub fn as_address(&self) -> &Address
pub fn as_address(&self) -> &Address
Converts this into a address if it is a address variant, or panics otherwise.
Sourcepub fn as_mut_address(&mut self) -> &mut Address
pub fn as_mut_address(&mut self) -> &mut Address
Converts this into a mut address if it is a address variant, or panics otherwise.
Sourcepub fn as_opt_address(&self) -> Option<&Address>
pub fn as_opt_address(&self) -> Option<&Address>
Converts this into a address if it is a address variant, or returns None otherwise.
Sourcepub fn as_opt_mut_address(&mut self) -> Option<&mut Address>
pub fn as_opt_mut_address(&mut self) -> Option<&mut Address>
Converts this into a mut address if it is a address variant, or returns None otherwise.
Sourcepub fn into_opt_address(self) -> Option<Address>
pub fn into_opt_address(self) -> Option<Address>
Converts this into a address if it is a address variant, or returns None otherwise.
Sourcepub fn into_address(self) -> Address
pub fn into_address(self) -> Address
Converts this into a address if it is a address variant, or panics otherwise.
Sourcepub fn as_object(&self) -> &ObjectId
pub fn as_object(&self) -> &ObjectId
Converts this into a object if it is a object variant, or panics otherwise.
Sourcepub fn as_mut_object(&mut self) -> &mut ObjectId
pub fn as_mut_object(&mut self) -> &mut ObjectId
Converts this into a mut object if it is a object variant, or panics otherwise.
Sourcepub fn as_opt_object(&self) -> Option<&ObjectId>
pub fn as_opt_object(&self) -> Option<&ObjectId>
Converts this into a object if it is a object variant, or returns None otherwise.
Sourcepub fn as_opt_mut_object(&mut self) -> Option<&mut ObjectId>
pub fn as_opt_mut_object(&mut self) -> Option<&mut ObjectId>
Converts this into a mut object if it is a object variant, or returns None otherwise.
Sourcepub fn into_opt_object(self) -> Option<ObjectId>
pub fn into_opt_object(self) -> Option<ObjectId>
Converts this into a object if it is a object variant, or returns None otherwise.
Sourcepub fn into_object(self) -> ObjectId
pub fn into_object(self) -> ObjectId
Converts this into a object if it is a object variant, or panics otherwise.
Checks if this is a shared variant.
Converts this into a shared if it is a shared variant, or panics otherwise.
Converts this into a mut shared if it is a shared variant, or panics otherwise.
Converts this into a shared if it is a shared variant, or returns None otherwise.
Converts this into a mut shared if it is a shared variant, or returns None otherwise.
Converts this into a shared if it is a shared variant, or returns None otherwise.
Converts this into a shared if it is a shared variant, or panics otherwise.
Sourcepub fn address_or_object(&self) -> Option<&Address>
pub fn address_or_object(&self) -> Option<&Address>
Returns an Address if this object is owned by an address or
object, and None if it is shared or immutable.
Trait Implementations§
Source§impl Arbitrary for Owner
Available on crate feature proptest only.
impl Arbitrary for Owner
proptest only.Source§type Parameters = ()
type Parameters = ()
arbitrary_with accepts for configuration
of the generated Strategy. Parameters must implement Default.Source§type Strategy = BoxedStrategy<Owner>
type Strategy = BoxedStrategy<Owner>
Strategy used to generate values of type Self.Source§fn arbitrary_with(
args_shared: <Self as Arbitrary>::Parameters,
) -> Self::Strategy
fn arbitrary_with( args_shared: <Self as Arbitrary>::Parameters, ) -> Self::Strategy
impl Copy for Owner
Source§impl<'de> Deserialize<'de> for Owner
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Owner
serde only.