pub struct Articles { /* private fields */ }
Expand description
Articles contain the contract and all related codex and API information for interacting with it.
§Invariance
The structure provides the following invariance guarantees:
- all the API codex matches the codex under which the contract was issued;
- all the API ids are unique;
- all custom APIs have unique names;
- the signature, if present, is a valid sig over the
ArticlesId
.
Implementations§
Source§impl Articles
impl Articles
Sourcepub fn with<E>(
semantics: Semantics,
issue: Issue,
sig: Option<SigBlob>,
sig_validator: impl FnOnce(StrictHash, &Identity, &SigBlob) -> Result<(), E>,
) -> Result<Self, SemanticError>
pub fn with<E>( semantics: Semantics, issue: Issue, sig: Option<SigBlob>, sig_validator: impl FnOnce(StrictHash, &Identity, &SigBlob) -> Result<(), E>, ) -> Result<Self, SemanticError>
Construct articles from a signed contract semantic and the contract issue under that semantics.
Sourcepub fn articles_id(&self) -> ArticlesId
pub fn articles_id(&self) -> ArticlesId
Compute an article id, which includes information about the contract id, API version and checksum.
Sourcepub fn contract_id(&self) -> ContractId
pub fn contract_id(&self) -> ContractId
Compute a contract id.
Sourcepub fn genesis_opid(&self) -> Opid
pub fn genesis_opid(&self) -> Opid
Compute a genesis opid.
Sourcepub fn default_api(&self) -> &Api
pub fn default_api(&self) -> &Api
Get a reference to the default API.
Sourcepub fn custom_apis(&self) -> impl Iterator<Item = (&TypeName, &Api)>
pub fn custom_apis(&self) -> impl Iterator<Item = (&TypeName, &Api)>
Get an iterator over the custom APIs.
Sourcepub fn types(&self) -> &TypeSystem
pub fn types(&self) -> &TypeSystem
Get a reference to the type system.
Sourcepub fn apis(&self) -> impl Iterator<Item = &Api>
pub fn apis(&self) -> impl Iterator<Item = &Api>
Iterates over all APIs, including the default and the named ones.
Sourcepub fn codex_libs(&self) -> impl Iterator<Item = &Lib>
pub fn codex_libs(&self) -> impl Iterator<Item = &Lib>
Iterates over all codex libraries.
Sourcepub fn contract_meta(&self) -> &ContractMeta
pub fn contract_meta(&self) -> &ContractMeta
Get a reference to the contract meta-information.
Sourcepub fn contract_name(&self) -> &ContractName
pub fn contract_name(&self) -> &ContractName
Get a reference to the contract name.
Sourcepub fn sig(&self) -> &Option<SigBlob>
pub fn sig(&self) -> &Option<SigBlob>
Get a reference to a signature over the contract semantics.
Sourcepub fn upgrade_apis(&mut self, other: Self) -> Result<bool, SemanticError>
pub fn upgrade_apis(&mut self, other: Self) -> Result<bool, SemanticError>
Upgrades contract APIs if a newer version is available.
§Returns
Whether the upgrade has happened, i.e. other
represents a valid later version of the APIs.
Trait Implementations§
Source§impl StrictDumb for Articles
impl StrictDumb for Articles
fn strict_dumb() -> Self
Source§impl StrictEncode for Articles
impl StrictEncode for Articles
fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
Source§impl StrictStruct for Articles
impl StrictStruct for Articles
const ALL_FIELDS: &'static [&'static str]
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
Source§impl StrictType for Articles
impl StrictType for Articles
const STRICT_LIB_NAME: &'static str = LIB_NAME_SONIC
fn strict_name() -> Option<TypeName>
impl Eq for Articles
impl StrictProduct for Articles
impl StructuralPartialEq for Articles
Auto Trait Implementations§
impl Freeze for Articles
impl RefUnwindSafe for Articles
impl Send for Articles
impl Sync for Articles
impl Unpin for Articles
impl UnwindSafe for Articles
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.