#[non_exhaustive]pub enum Caption<'a> {
Numbered {
kind: CaptionKind,
label: Cow<'a, str>,
number: Option<NonZeroU32>,
},
Custom(Cow<'a, str>),
Unnumbered,
}Expand description
The caption a titled block takes.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Numbered
A type-specific caption and its document-wide ordinal.
kind names the counter the ordinal came from. number is Some only for a block that
had a title when ordinals were assigned; such a block consumed one ordinal from that
counter. It is None for a block that had no title, which consumed nothing — a consumer
that adds a title later either supplies its own ordinal or calls
Document::renumber_captions.
Fields
kind: CaptionKindThe counter this caption draws its ordinal from.
number: Option<NonZeroU32>The document-wide ordinal, or None when the block had no title. Kept narrow
because it sits on every block’s metadata.
Custom(Cow<'a, str>)
An explicit prefix, which takes no ordinal.
Unnumbered
Caption-capable, but no prefix applies.
Implementations§
Source§impl<'a> Caption<'a>
impl<'a> Caption<'a>
Sourcepub fn resolve(
metadata: &BlockMetadata<'a>,
attributes: &DocumentAttributes<'a>,
kind: CaptionKind,
) -> Self
pub fn resolve( metadata: &BlockMetadata<'a>, attributes: &DocumentAttributes<'a>, kind: CaptionKind, ) -> Self
Resolve caption behavior from the block’s own attributes and the document attributes in effect at the block’s source position. Sets no ordinal.
Source§impl Caption<'static>
impl Caption<'static>
Sourcepub fn resolve_owned(
metadata: &BlockMetadata<'_>,
attributes: &DocumentAttributes<'_>,
kind: CaptionKind,
) -> Self
pub fn resolve_owned( metadata: &BlockMetadata<'_>, attributes: &DocumentAttributes<'_>, kind: CaptionKind, ) -> Self
Caption::resolve for metadata and attributes whose lifetimes are unrelated, as a
converter’s are: its stored attributes are independent of the borrowed document. Owns its
strings, and sets no ordinal.