pub trait Contract: Send + Sync {
type Family: ContractFamily;
type Category: EntityCategory;
// Required methods
fn family(&self) -> &Self::Family;
fn version(&self) -> &SpecVersion;
fn groups(&self) -> &[Group];
fn entities(&self, group: &Group) -> &[Entity<Self::Category>];
fn link_context(&self, opts: &Options) -> LinkContext;
// Provided methods
fn group_overview(&self, group: &Group) -> Option<&str> { ... }
fn companions(&self) -> &[CompanionFile] { ... }
}Expand description
A loaded, resolved contract ready to render or serialize.
Parser crates implement this trait after parsing and resolving references. The sync API supports in-memory traversal during manual assembly.
Required Associated Types§
Sourcetype Family: ContractFamily
type Family: ContractFamily
Contract family metadata and capabilities.
Sourcetype Category: EntityCategory
type Category: EntityCategory
Family-specific entity category type.
Required Methods§
Sourcefn family(&self) -> &Self::Family
fn family(&self) -> &Self::Family
Returns the contract family identity for this loaded instance.
Sourcefn version(&self) -> &SpecVersion
fn version(&self) -> &SpecVersion
Returns the parsed spec version for this contract instance.
Sourcefn groups(&self) -> &[Group]
fn groups(&self) -> &[Group]
Returns all groups in this contract (entities are queried per group).
Sourcefn entities(&self, group: &Group) -> &[Entity<Self::Category>]
fn entities(&self, group: &Group) -> &[Entity<Self::Category>]
Returns entities belonging to group.
Sourcefn link_context(&self, opts: &Options) -> LinkContext
fn link_context(&self, opts: &Options) -> LinkContext
Builds a LinkContext for cross-reference formatting under opts.
Provided Methods§
Sourcefn group_overview(&self, group: &Group) -> Option<&str>
fn group_overview(&self, group: &Group) -> Option<&str>
Returns optional overview prose for group, when the family provides it.
Sourcefn companions(&self) -> &[CompanionFile]
fn companions(&self) -> &[CompanionFile]
Returns parser-side companion files discovered for this contract.
Default empty; families with companion docs override. Convert to wire
Companion via companion_files_to_stored.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".