Struct casper_types::ContractPackage
source · [−]pub struct ContractPackage { /* private fields */ }
Expand description
Contract definition, metadata, and security container.
Implementations
sourceimpl 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 groups_mut(&mut self) -> &mut Groups
pub fn groups_mut(&mut self) -> &mut Groups
Get the mutable group definitions for this contract.
sourcepub fn add_group(&mut self, group: Group, urefs: BTreeSet<URef>)
pub fn add_group(&mut self, group: Group, urefs: BTreeSet<URef>)
Adds new group to this contract.
sourcepub fn lookup_contract_hash(
&self,
contract_version_key: ContractVersionKey
) -> Option<&ContractHash>
pub fn lookup_contract_hash(
&self,
contract_version_key: ContractVersionKey
) -> Option<&ContractHash>
Lookup the contract hash for a given contract version (if present)
sourcepub fn is_version_enabled(
&self,
contract_version_key: ContractVersionKey
) -> bool
pub fn is_version_enabled(
&self,
contract_version_key: ContractVersionKey
) -> bool
Checks if the given contract version exists and is available for use.
sourcepub fn insert_contract_version(
&mut self,
protocol_version_major: ProtocolVersionMajor,
contract_hash: ContractHash
) -> ContractVersionKey
pub fn insert_contract_version(
&mut self,
protocol_version_major: ProtocolVersionMajor,
contract_hash: ContractHash
) -> ContractVersionKey
Insert a new contract version; the next sequential version number will be issued.
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 versions(&self) -> &ContractVersions
pub fn versions(&self) -> &ContractVersions
Returns reference to all of this contract’s versions.
sourcepub fn enabled_versions(&self) -> ContractVersions
pub fn enabled_versions(&self) -> ContractVersions
Returns all of this contract’s enabled contract 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 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 remove_group(&mut self, group: &Group) -> bool
pub fn remove_group(&mut self, group: &Group) -> bool
Removes a group from this contract (if it exists).
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.
sourcepub fn get_lock_status(&self) -> ContractPackageStatus
pub fn get_lock_status(&self) -> ContractPackageStatus
Return the package status itself
Trait Implementations
sourceimpl Clone for ContractPackage
impl Clone for ContractPackage
sourcefn clone(&self) -> ContractPackage
fn clone(&self) -> ContractPackage
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ContractPackage
impl Debug for ContractPackage
sourceimpl Default for ContractPackage
impl Default for ContractPackage
sourcefn default() -> ContractPackage
fn default() -> ContractPackage
Returns the “default value” for a type. Read more
sourceimpl From<ContractPackage> for StoredValue
impl From<ContractPackage> for StoredValue
sourcefn from(value: ContractPackage) -> StoredValue
fn from(value: ContractPackage) -> StoredValue
Converts to this type from the input type.
sourceimpl FromBytes for ContractPackage
impl FromBytes for ContractPackage
sourceimpl PartialEq<ContractPackage> for ContractPackage
impl PartialEq<ContractPackage> for ContractPackage
sourcefn eq(&self, other: &ContractPackage) -> bool
fn eq(&self, other: &ContractPackage) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ContractPackage) -> bool
fn ne(&self, other: &ContractPackage) -> bool
This method tests for !=
.
sourceimpl Serialize for ContractPackage
impl Serialize for ContractPackage
sourceimpl ToBytes for ContractPackage
impl ToBytes for ContractPackage
sourcefn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Returns the length of the 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. Read more
sourceimpl TryFrom<StoredValue> for ContractPackage
impl TryFrom<StoredValue> for ContractPackage
type Error = TypeMismatch
type Error = TypeMismatch
The type returned in the event of a conversion error.
sourcefn try_from(stored_value: StoredValue) -> Result<Self, Self::Error>
fn try_from(stored_value: StoredValue) -> Result<Self, Self::Error>
Performs the conversion.
impl Eq for ContractPackage
impl StructuralEq for ContractPackage
impl StructuralPartialEq for ContractPackage
Auto Trait Implementations
impl RefUnwindSafe for ContractPackage
impl Send for ContractPackage
impl Sync for ContractPackage
impl Unpin for ContractPackage
impl UnwindSafe for ContractPackage
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> FmtForward for T
impl<T> FmtForward for T
fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
Causes self
to use its Binary
implementation when Debug
-formatted.
fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
Causes self
to use its Display
implementation when
Debug
-formatted. Read more
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
Causes self
to use its LowerExp
implementation when
Debug
-formatted. Read more
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
Causes self
to use its LowerHex
implementation when
Debug
-formatted. Read more
fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
Causes self
to use its Octal
implementation when Debug
-formatted.
fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
Causes self
to use its Pointer
implementation when
Debug
-formatted. Read more
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
Causes self
to use its UpperExp
implementation when
Debug
-formatted. Read more
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
Causes self
to use its UpperHex
implementation when
Debug
-formatted. Read more
impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: AsRef<T>,
T: 'a,
R: 'a,
fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: AsRef<T>,
T: 'a,
R: 'a,
Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R where
Self: AsMut<T>,
T: 'a,
R: 'a,
fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R where
Self: AsMut<T>,
T: 'a,
R: 'a,
Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more
impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Borrow<T>,
T: 'a,
R: 'a,
fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Borrow<T>,
T: 'a,
R: 'a,
Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_borrow_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: BorrowMut<T>,
T: 'a,
R: 'a,
fn pipe_borrow_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: BorrowMut<T>,
T: 'a,
R: 'a,
Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more
impl<T> PipeDeref for T
impl<T> PipeDeref for T
fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> R where
Self: Deref,
R: 'a,
fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> R where
Self: Deref,
R: 'a,
Pipes a dereference into a function that cannot normally be called in suffix position. Read more
fn pipe_deref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
Self: DerefMut,
R: 'a,
fn pipe_deref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
Self: DerefMut,
R: 'a,
Pipes a mutable dereference into a function that cannot normally be called in suffix position. Read more
impl<T> PipeRef for T
impl<T> PipeRef for T
impl<T> Tap for T
impl<T> Tap for T
fn tap<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
fn tap<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
Provides immutable access for inspection. Read more
fn tap_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
fn tap_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
Calls tap
in debug builds, and does nothing in release builds.
fn tap_mut<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
fn tap_mut<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
Provides mutable access for modification. Read more
fn tap_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
fn tap_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
Calls tap_mut
in debug builds, and does nothing in release builds.
impl<T, U> TapAsRef<U> for T where
U: ?Sized,
impl<T, U> TapAsRef<U> for T where
U: ?Sized,
fn tap_ref<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
Provides immutable access to the reference for inspection.
fn tap_ref_dbg<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref_dbg<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
Calls tap_ref
in debug builds, and does nothing in release builds.
fn tap_ref_mut<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
Provides mutable access to the reference for modification.
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
Calls tap_ref_mut
in debug builds, and does nothing in release builds.
impl<T, U> TapBorrow<U> for T where
U: ?Sized,
impl<T, U> TapBorrow<U> for T where
U: ?Sized,
fn tap_borrow<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
Provides immutable access to the borrow for inspection. Read more
fn tap_borrow_dbg<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow_dbg<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
Calls tap_borrow
in debug builds, and does nothing in release builds.
fn tap_borrow_mut<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
Provides mutable access to the borrow for modification.
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
Calls tap_borrow_mut
in debug builds, and does nothing in release
builds. Read more
impl<T> TapDeref for T
impl<T> TapDeref for T
fn tap_deref<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
Immutably dereferences self
for inspection.
fn tap_deref_dbg<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref_dbg<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
Calls tap_deref
in debug builds, and does nothing in release builds.
fn tap_deref_mut<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
Mutably dereferences self
for modification.
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
Calls tap_deref_mut
in debug builds, and does nothing in release
builds. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more