Skip to main content

Fragment

Struct Fragment 

Source
pub struct Fragment {
    pub concept: Concept,
    pub key: &'static str,
    pub variant: Variant,
    pub depth: Depth,
    pub locale: &'static str,
    pub audience: Option<Audience>,
    pub rank: u8,
    pub title: Option<&'static str>,
    pub body: &'static str,
}
Expand description

A unit of content, addressed by (concept, key, variant, locale).

Fields§

§concept: Concept

Concept this fragment belongs to.

§key: &'static str

Sub-topic within the concept, e.g. "no-word-splitting".

§variant: Variant

How this fragment renders its idea.

§depth: Depth

Summary fragments always show; Reference only at reference depth.

§locale: &'static str

BCP-47 locale tag. English ("en") is the canonical-complete base.

§audience: Option<Audience>

None = shared (default); Some(_) = audience-specific divergence.

§rank: u8

Importance rank for the always-on onboarding block: 0 is the most important, and composition renders fragments in ascending rank so the client model meets the critical rules first even under skimming or truncation. Fragments at UNRANKED (the default) keep registry order. The rank is a property of the (concept, key, variant) slot, so it is locale-agnostic — a translation of a fragment inherits the same rank.

§title: Option<&'static str>

Optional section heading for reference rendering (e.g. "Quoting"). None for inline fragments (the Foundations spine renders under its concept header instead). Used by render_syntax_reference.

§body: &'static str

Markdown body.

Implementations§

Source§

impl Fragment

Source

pub const fn ranked(self, rank: u8) -> Fragment

Attach an importance rank (0 = most important) to a fragment, for the always-on onboarding block. const so it composes in the static registry: en(...).ranked(2).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.