pub struct BackendDef {
pub name: BackendName,
pub native: Vec<ElementName>,
pub lowering: Arc<dyn Stage>,
pub emit: Arc<dyn Stage>,
pub final_stage: Arc<dyn Stage>,
pub docs: String,
}Expand description
A backend declaration. A backend is the registration bundle for one output format: the elements its emitter writes natively, a lowering stage, an emit stage and a final stage.
The three stages are ordinary stages of the declaring feature, scheduled like any other; this declaration groups them so that a plan recognizes them as one backend:
- the lowering stage rewrites the frozen trees into presentation trees,
made of the elements this backend writes, and writes them to the table
flm.lowered.<backend>(see backends, lowering, and outputs); - the emit stage turns the presentation trees into the output’s bytes,
in the table
flm.output.<backend>; - the final stage (see output regions and the final stage) assembles the artifact set the caller receives.
The native set (native) lists the elements the emit stage writes
directly. Lowering rules turn every other element into these. When a plan
is built, an element that may occur in a document and that no chain of
lowering rules leads into the native set is refused, unless the plan
request accepts it as unrenderable (for a workflow, with
WorkflowDef::unsupported). The native set must also satisfy every
native-set implication of the registry (an element
every backend must write natively, or one a backend must write natively
because of another element it writes natively); otherwise the registry
build fails with BuildError::NativeSetIncomplete.
Register the declaration with
FeatureBuilder::backend. See
OutputDef for how a caller asks for what a backend produces.
Fields§
§name: BackendNameThe backend’s name; it is also the last segment of the names of its
tables (flm.lowered.<backend>, flm.output.<backend>).
native: Vec<ElementName>The native set: the elements this backend’s emit stage writes directly, namely the presentation elements it understands and the structural elements it writes without a lowering rule.
lowering: Arc<dyn Stage>The lowering stage, which builds the presentation trees.
emit: Arc<dyn Stage>The emit stage, which turns the presentation trees into bytes.
final_stage: Arc<dyn Stage>The final stage, which assembles the artifact set.
docs: StringDocumentation prose.
Implementations§
Source§impl BackendDef
impl BackendDef
Sourcepub fn new(
name: impl Into<BackendName>,
native: impl IntoIterator<Item = impl Into<ElementName>>,
lowering: Arc<dyn Stage>,
emit: Arc<dyn Stage>,
final_stage: Arc<dyn Stage>,
) -> BackendDef
pub fn new( name: impl Into<BackendName>, native: impl IntoIterator<Item = impl Into<ElementName>>, lowering: Arc<dyn Stage>, emit: Arc<dyn Stage>, final_stage: Arc<dyn Stage>, ) -> BackendDef
A backend called name, whose emit stage writes the elements of
native directly, with its lowering, emit and final stages, and with
no documentation.
Sourcepub fn docs(self, docs: impl Into<String>) -> BackendDef
pub fn docs(self, docs: impl Into<String>) -> BackendDef
Sets the documentation prose. Returns self, for chaining.
Trait Implementations§
Source§impl Clone for BackendDef
impl Clone for BackendDef
Auto Trait Implementations§
impl !RefUnwindSafe for BackendDef
impl !UnwindSafe for BackendDef
impl Forget for BackendDef
impl Freeze for BackendDefwhere
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<ElementName>: Freeze,
*const ArcInner<dyn Stage> is !null: Freeze,
PhantomData<ArcInner<dyn Stage>>: Freeze,
PhantomData<u8>: Freeze,
impl Move for BackendDef
impl Send for BackendDef
impl Sync for BackendDef
impl Unpin for BackendDef
impl UnsafeUnpin for BackendDefwhere
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<ElementName>: UnsafeUnpin,
*const ArcInner<dyn Stage> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Stage>>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more