Skip to main content

ContractFamily

Trait ContractFamily 

Source
pub trait ContractFamily:
    Send
    + Sync
    + Sized
    + 'static {
    type Category: EntityCategory;
    type LinkExtractor: LinkExtractor<Family = Self> + Send + Sync;
    type CompanionStrategy: CompanionStrategy + Send + Sync;

Show 15 methods // Required methods fn name(&self) -> &'static str; fn fence_language(&self) -> &'static str; fn default_title(&self) -> &'static str; fn default_markdown_root(&self) -> &'static str; fn extensions(&self) -> &'static [&'static str]; fn companion_strategy(&self) -> &Self::CompanionStrategy; fn category_names(&self) -> &'static [&'static str]; fn detect_version(&self, raw: &RawDoc) -> Option<SpecVersion>; fn supported_versions(&self) -> &'static [SupportedVersion]; fn link_extractor(&self) -> &Self::LinkExtractor; // Provided methods fn companion_extensions(&self) -> &'static [&'static str] { ... } fn meta_schema(&self, version: &SpecVersion) -> Option<&'static [u8]> { ... } fn supported_protocols(&self) -> &'static [&'static str] { ... } fn default_protocol(&self) -> &'static str { ... } fn extra_option_tokens(&self) -> &'static [&'static str] { ... }
}
Expand description

Identity and capability metadata for one contract family.

Each parser crate provides a zero-sized or lightweight implementor describing OpenAPI, Protobuf, AsyncAPI, etc. Associated types wire up family-specific link extraction and companion discovery.

Required Associated Types§

Source

type Category: EntityCategory

Entity category enum or newtype for this family.

Source

type LinkExtractor: LinkExtractor<Family = Self> + Send + Sync

Family-specific LinkExtractor implementation.

Source

type CompanionStrategy: CompanionStrategy + Send + Sync

Family-specific CompanionStrategy implementation.

Required Methods§

Source

fn name(&self) -> &'static str

Short family name (e.g. "openapi", "protobuf").

Source

fn fence_language(&self) -> &'static str

Default fenced-code language tag for this family’s entities.

Source

fn default_title(&self) -> &'static str

Default manual title when the input does not specify one.

Source

fn default_markdown_root(&self) -> &'static str

Default markdown output root relative to the book root.

Source

fn extensions(&self) -> &'static [&'static str]

Filename extensions recognized for contract inputs (e.g. ["yaml", "yml"]).

Source

fn companion_strategy(&self) -> &Self::CompanionStrategy

Returns the companion discovery strategy for this family.

Source

fn category_names(&self) -> &'static [&'static str]

All category slug strings this family emits.

Source

fn detect_version(&self, raw: &RawDoc) -> Option<SpecVersion>

Detects the spec version from raw bytes, when possible.

Source

fn supported_versions(&self) -> &'static [SupportedVersion]

Supported spec versions and their lifecycle status.

Returns the link extractor instance for this family.

Provided Methods§

Source

fn companion_extensions(&self) -> &'static [&'static str]

Filename extensions searched for companion documents.

Defaults to Self::extensions when companions share input extensions.

Source

fn meta_schema(&self, version: &SpecVersion) -> Option<&'static [u8]>

Returns optional meta-schema bytes for validation at version, when available.

Source

fn supported_protocols(&self) -> &'static [&'static str]

Protocol slugs this family may attach during populate.

Source

fn default_protocol(&self) -> &'static str

Default protocol slug for this family when populate attaches one binding.

Source

fn extra_option_tokens(&self) -> &'static [&'static str]

Additional CLI or config option tokens understood by this family’s tooling.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§