Struct cw721_base::Ownership

source ·
pub struct Ownership<T>where
    T: AddressLike,{
    pub owner: Option<T>,
    pub pending_owner: Option<T>,
    pub pending_expiry: Option<Expiration>,
}
Expand description

The contract’s ownership info

Fields§

§owner: Option<T>

The contract’s current owner. None if the ownership has been renounced.

§pending_owner: Option<T>

The account who has been proposed to take over the ownership. None if there isn’t a pending ownership transfer.

§pending_expiry: Option<Expiration>

The deadline for the pending owner to accept the ownership. None if there isn’t a pending ownership transfer, or if a transfer exists and it doesn’t have a deadline.

Implementations§

source§

impl<T> Ownership<T>where T: AddressLike,

source

pub fn into_attributes(self) -> Vec<Attribute, Global>

Serializes the current ownership state as attributes which may be used in a message response. Serialization is done according to the std::fmt::Display implementation for T and cosmwasm_std::Expiration (for pending_expiry). If an ownership field has no value, "none" will be serialized.

Attribute keys used:

  • owner
  • pending_owner
  • pending_expiry

Callers should take care not to use these keys elsewhere in their response as CosmWasm will override reused attribute keys.

Example
use cw_utils::Expiration;

assert_eq!(
    Ownership {
        owner: Some("blue"),
        pending_owner: None,
        pending_expiry: Some(Expiration::Never {})
    }
    .into_attributes(),
    vec![
        Attribute::new("owner", "blue"),
        Attribute::new("pending_owner", "none"),
        Attribute::new("pending_expiry", "expiration: never")
    ],
)

Trait Implementations§

source§

impl<T> Clone for Ownership<T>where T: Clone + AddressLike,

source§

fn clone(&self) -> Ownership<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for Ownership<T>where T: Debug + AddressLike,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'de, T> Deserialize<'de> for Ownership<T>where T: AddressLike + Deserialize<'de>,

source§

fn deserialize<__D>( __deserializer: __D ) -> Result<Ownership<T>, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T> JsonSchema for Ownership<T>where T: AddressLike + JsonSchema,

source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
source§

fn json_schema(gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
source§

impl<T> PartialEq<Ownership<T>> for Ownership<T>where T: PartialEq<T> + AddressLike,

source§

fn eq(&self, other: &Ownership<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Serialize for Ownership<T>where T: AddressLike + Serialize,

source§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T> StructuralPartialEq for Ownership<T>where T: AddressLike,

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Ownership<T>where T: RefUnwindSafe,

§

impl<T> Send for Ownership<T>where T: Send,

§

impl<T> Sync for Ownership<T>where T: Sync,

§

impl<T> Unpin for Ownership<T>where T: Unpin,

§

impl<T> UnwindSafe for Ownership<T>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,