#[repr(C)]pub struct ContractSpecId {
pub crate_name: StringM,
pub major: StringM,
pub module_path: StringM,
pub declared: StringM,
}Expand description
The identity of a user-defined type or event.
Every spec-named item — a #[contract_type], a #[contract_exception], a
#[derive(Event)] — is named by one of these, and every reference to one
resolves through it. A bare identifier cannot tell two of them apart: two
crates, two modules of one crate, or two major versions of one crate may
each declare a Transfer, and a spec naming both could not say which is
which.
The segments are carried apart rather than joined into
CRATE@MAJOR::module::path::Name, because the joined form cannot be split
back. name = "..." on a spec-named item substitutes its value verbatim —
a value carrying :: spells its own segments and nothing rejects it — so
the boundary between the module path and the declared name is not
recoverable from the string. Consumers that need a display name or a
target-language identifier read declared directly; how an id is shortened
for display stays each codegen’s business.
Fields§
§crate_name: StringM§major: StringM§module_path: StringM§declared: StringMTrait Implementations§
Source§impl Clone for ContractSpecId
impl Clone for ContractSpecId
Source§fn clone(&self) -> ContractSpecId
fn clone(&self) -> ContractSpecId
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ConstMaxSize for ContractSpecId
impl ConstMaxSize for ContractSpecId
Source§impl ConstMaxSize for ContractSpecId
impl ConstMaxSize for ContractSpecId
Source§impl Debug for ContractSpecId
impl Debug for ContractSpecId
Source§impl<'de> Deserialize<'de> for ContractSpecId
impl<'de> Deserialize<'de> for ContractSpecId
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ContractSpecId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ContractSpecId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for ContractSpecId
module_path::declared (crate_name@major): an id the way a person reading
a diagnostic wants it.
impl Display for ContractSpecId
module_path::declared (crate_name@major): an id the way a person reading
a diagnostic wants it.
Not the joined CRATE@MAJOR::module::path::Name form: a reader wants to
see which segment is which, and module_path already leads with the crate,
so the crate and major trail in parentheses rather than doubling up in the
path.
Only for messages. The rendering is one-way – declared may itself carry
::, so where the module path ends cannot be recovered from the text –
and ids are compared and keyed whole, never by this.
Lossy: nothing on the wire makes a segment UTF-8, and a diagnostic is the
wrong place to fail, so an invalid sequence renders as U+FFFD, exactly as
String::from_utf8_lossy has it. Segments are decoded rather than written
through ContractSpecString’s own Display, which hex-escapes every
non-ASCII byte, because a Rust identifier may be non-ASCII. Validate the
segments first wherever their bytes matter.
impl EncodesAs<ContractSpecId> for ContractSpecId
impl Eq for ContractSpecId
Source§impl From<ContractSpecIdView<'_>> for ContractSpecId
Available on crate feature owned-model only.
impl From<ContractSpecIdView<'_>> for ContractSpecId
owned-model only.Source§fn from(value: ContractSpecIdView<'_>) -> Self
fn from(value: ContractSpecIdView<'_>) -> Self
Source§impl Hash for ContractSpecId
impl Hash for ContractSpecId
Source§impl Ord for ContractSpecId
impl Ord for ContractSpecId
Source§fn cmp(&self, other: &ContractSpecId) -> Ordering
fn cmp(&self, other: &ContractSpecId) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ContractSpecId
impl PartialEq for ContractSpecId
Source§impl PartialOrd for ContractSpecId
impl PartialOrd for ContractSpecId
Source§impl<'_r> ReadXDR<'_r> for ContractSpecId
impl<'_r> ReadXDR<'_r> for ContractSpecId
Source§fn read_xdr<R>(r: &mut R) -> Result<ContractSpecId, ReadError>where
R: Reader<'_r>,
fn read_xdr<R>(r: &mut R) -> Result<ContractSpecId, ReadError>where
R: Reader<'_r>,
Source§fn read_xdr_in_place<R, '__xdrs_s>(
r: &mut R,
__xdrs_slot: Slot<'__xdrs_s, ContractSpecId>,
) -> Result<Init<'__xdrs_s, ContractSpecId>, ReadError>where
R: Reader<'_r>,
fn read_xdr_in_place<R, '__xdrs_s>(
r: &mut R,
__xdrs_slot: Slot<'__xdrs_s, ContractSpecId>,
) -> Result<Init<'__xdrs_s, ContractSpecId>, ReadError>where
R: Reader<'_r>,
slot, without first building it
on the stack. Read more