pub struct ContractPackage { /* private fields */ }
Expand description
Contract definition, metadata, and security container.
Implementations§
Source§impl ContractPackage
impl ContractPackage
Sourcepub fn new(
access_key: URef,
versions: ContractVersions,
disabled_versions: DisabledVersions,
groups: Groups,
lock_status: ContractPackageStatus,
) -> Self
pub fn new( access_key: URef, versions: ContractVersions, disabled_versions: DisabledVersions, groups: Groups, lock_status: ContractPackageStatus, ) -> Self
Create new ContractPackage
(with no versions) from given access key.
Sourcepub fn access_key(&self) -> URef
pub fn access_key(&self) -> URef
Get the access key for this contract.
Sourcepub fn versions(&self) -> &ContractVersions
pub fn versions(&self) -> &ContractVersions
Returns reference to all of this contract’s versions.
Sourcepub fn versions_mut(&mut self) -> &mut ContractVersions
pub fn versions_mut(&mut self) -> &mut ContractVersions
Returns mutable reference to all of this contract’s versions (enabled and disabled).
Sourcepub fn take_versions(self) -> ContractVersions
pub fn take_versions(self) -> ContractVersions
Consumes the object and returns all of this contract’s versions (enabled and disabled).
Sourcepub fn take_groups(self) -> Groups
pub fn take_groups(self) -> Groups
Consumes the object and returns all the groups of the contract package.
Sourcepub fn disabled_versions(&self) -> &DisabledVersions
pub fn disabled_versions(&self) -> &DisabledVersions
Returns all of this contract’s disabled versions.
Sourcepub fn disabled_versions_mut(&mut self) -> &mut DisabledVersions
pub fn disabled_versions_mut(&mut self) -> &mut DisabledVersions
Returns mut reference to all of this contract’s disabled versions.
Sourcepub fn lock_status(&self) -> ContractPackageStatus
pub fn lock_status(&self) -> ContractPackageStatus
Returns lock_status of the contract package.
pub fn is_locked(&self) -> bool
Sourcepub fn disable_contract_version(
&mut self,
contract_hash: ContractHash,
) -> Result<(), Error>
pub fn disable_contract_version( &mut self, contract_hash: ContractHash, ) -> Result<(), Error>
Disable the contract version corresponding to the given hash (if it exists).
Sourcepub fn enable_contract_version(
&mut self,
contract_hash: ContractHash,
) -> Result<(), Error>
pub fn enable_contract_version( &mut self, contract_hash: ContractHash, ) -> Result<(), Error>
Enable the contract version corresponding to the given hash (if it exists).
Sourcepub fn remove_group(&mut self, group: &Group) -> bool
pub fn remove_group(&mut self, group: &Group) -> bool
Removes a group from this entity (if it exists).
Sourcepub fn is_version_enabled(
&self,
contract_version_key: ContractVersionKey,
) -> bool
pub fn is_version_enabled( &self, contract_version_key: ContractVersionKey, ) -> bool
Returns true
if the given contract version exists and is enabled.
Sourcepub fn enabled_versions(&self) -> ContractVersions
pub fn enabled_versions(&self) -> ContractVersions
Returns all of this contract’s enabled contract versions.
Sourcepub fn current_contract_version(&self) -> Option<ContractVersionKey>
pub fn current_contract_version(&self) -> Option<ContractVersionKey>
Return the contract version key for the newest enabled contract version.
Sourcepub fn current_contract_hash(&self) -> Option<ContractHash>
pub fn current_contract_hash(&self) -> Option<ContractHash>
Return the contract hash for the newest enabled contract version.
pub fn insert_contract_version( &mut self, protocol_version_major: ProtocolVersionMajor, contract_hash: ContractHash, ) -> ContractVersionKey
pub fn groups_mut(&mut self) -> &mut Groups
Trait Implementations§
Source§impl Clone for ContractPackage
impl Clone for ContractPackage
Source§fn clone(&self) -> ContractPackage
fn clone(&self) -> ContractPackage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl DataSize for ContractPackage
impl DataSize for ContractPackage
Source§const IS_DYNAMIC: bool = true
const IS_DYNAMIC: bool = true
true
, the type has a heap size that can vary at runtime, depending on the actual value.Source§const STATIC_HEAP_SIZE: usize = 0usize
const STATIC_HEAP_SIZE: usize = 0usize
IS_DYNAMIC
is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.Source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
Source§impl Debug for ContractPackage
impl Debug for ContractPackage
Source§impl Default for ContractPackage
impl Default for ContractPackage
Source§fn default() -> ContractPackage
fn default() -> ContractPackage
Source§impl<'de> Deserialize<'de> for ContractPackage
impl<'de> Deserialize<'de> for ContractPackage
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl From<ContractPackage> for Package
impl From<ContractPackage> for Package
Source§fn from(value: ContractPackage) -> Self
fn from(value: ContractPackage) -> Self
Source§impl From<ContractPackage> for StoredValue
impl From<ContractPackage> for StoredValue
Source§fn from(value: ContractPackage) -> Self
fn from(value: ContractPackage) -> Self
Source§impl FromBytes for ContractPackage
impl FromBytes for ContractPackage
Source§impl JsonSchema for ContractPackage
impl JsonSchema for ContractPackage
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moreSource§impl PartialEq for ContractPackage
impl PartialEq for ContractPackage
Source§impl Serialize for ContractPackage
impl Serialize for ContractPackage
Source§impl ToBytes for ContractPackage
impl ToBytes for ContractPackage
Source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.Source§impl TryFrom<StoredValue> for ContractPackage
impl TryFrom<StoredValue> for ContractPackage
Source§type Error = TypeMismatch
type Error = TypeMismatch
impl Eq for ContractPackage
impl StructuralPartialEq for ContractPackage
Auto Trait Implementations§
impl Freeze for ContractPackage
impl RefUnwindSafe for ContractPackage
impl Send for ContractPackage
impl Sync for ContractPackage
impl Unpin for ContractPackage
impl UnwindSafe for ContractPackage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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