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 = %x00 address
owner-object = %x01 object-id
owner-shared = %x02 u64
owner-immutable = %x03Variants§
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
pub fn is_immutable(&self) -> bool
pub fn is_address(&self) -> bool
pub fn as_address(&self) -> &Address
pub fn as_address_opt(&self) -> Option<&Address>
pub fn into_address_opt(self) -> Option<Address>
pub fn into_address(self) -> Address
pub fn is_object(&self) -> bool
pub fn as_object(&self) -> &ObjectId
pub fn as_object_opt(&self) -> Option<&ObjectId>
pub fn into_object_opt(self) -> Option<ObjectId>
pub fn into_object(self) -> ObjectId
Trait Implementations§
Source§impl Arbitrary for Owner
impl Arbitrary for Owner
Source§type Parameters = ()
type Parameters = ()
The type of parameters that
arbitrary_with accepts for configuration
of the generated Strategy. Parameters must implement Default.Source§type Strategy = BoxedStrategy<Owner>
type Strategy = BoxedStrategy<Owner>
The type of
Strategy used to generate values of type Self.Source§fn arbitrary_with(args: <Self as Arbitrary>::Parameters) -> Self::Strategy
fn arbitrary_with(args: <Self as Arbitrary>::Parameters) -> Self::Strategy
Source§impl<'de> Deserialize<'de> for Owner
impl<'de> Deserialize<'de> for Owner
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 JsonSchema for Owner
impl JsonSchema for Owner
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moreSource§impl Ord for Owner
impl Ord for Owner
Source§impl PartialOrd for Owner
impl PartialOrd for Owner
impl Copy for Owner
impl Eq for Owner
impl StructuralPartialEq for Owner
Auto Trait Implementations§
impl Freeze for Owner
impl RefUnwindSafe for Owner
impl Send for Owner
impl Sync for Owner
impl Unpin for Owner
impl UnwindSafe for Owner
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