pub struct ContractSpecIdView<'a> {
pub crate_name: &'a str,
pub major: &'a str,
pub module_path: &'a str,
pub declared: &'a str,
}Expand description
Const-friendly view of a ContractSpecId: what a user-defined type or
event is called in a spec.
The segments are carried apart because every segment is something the
declaring macro already holds whole, so nothing here is parsed out of
anything. Nor could a joined CRATE@MAJOR::module::path::Name form be
relied on to split back: the SDK’s macros refuse :: in name = "...",
but nothing stops a hand-written ContractTypeName impl from putting one
in declared.
Fields§
§crate_name: &'a strDeclaring crate, as Cargo names the package: hyphenated.
major: &'a strLeftmost non-zero component of the declaring crate’s semver, or of the
item’s own pinned version = "...".
module_path: &'a strmodule_path!() at the declaration, verbatim, leading crate segment
and all – so its spelling of the crate is the underscored Rust ident,
not crate_name’s.
declared: &'a strThe declared name, verbatim. The SDK’s macros never put :: in it,
but a hand-written ContractTypeName impl may.
Implementations§
Source§impl<'a> ContractSpecIdView<'a>
impl<'a> ContractSpecIdView<'a>
pub const fn const_write_cxs<const __N: usize>(&self, w: &mut ConstWriter<__N>)
pub const fn const_write_txs<const __N: usize>(&self, w: &mut ConstWriter<__N>)
Sourcepub const fn const_cxs_size(&self) -> usize
pub const fn const_cxs_size(&self) -> usize
Returns the CXS encoded size of this value in bytes.
Sourcepub const fn const_txs_size(&self) -> usize
pub const fn const_txs_size(&self) -> usize
Returns the TXS encoded size of this value in bytes.
Trait Implementations§
Source§impl<'a> Clone for ContractSpecIdView<'a>
impl<'a> Clone for ContractSpecIdView<'a>
impl<'a> Copy for ContractSpecIdView<'a>
Source§impl<'a> Debug for ContractSpecIdView<'a>
impl<'a> Debug for ContractSpecIdView<'a>
impl<'a> EncodesAs<ContractSpecIdView<'a>> for ContractSpecIdView<'a>
impl<'a> Eq for ContractSpecIdView<'a>
Source§impl From<ContractSpecIdView<'_>> for ContractSpecId
Available on crate feature owned-model only.
impl From<ContractSpecIdView<'_>> for ContractSpecId
owned-model only.