Skip to main content

native_implications

Function native_implications 

Source
pub fn native_implications() -> Vec<NativeImplication>
Expand description

The two native-set implications the lowering driver relies on, which this feature declares so that the registry build checks every backend against them.

A backend’s native set is the list of elements its emit stage writes directly (BackendDef::native). The driver (super::driver) stages two presentation elements on its own, with no lowering rule declaring that it produces them, so plan construction cannot see that a backend needs them:

  1. A backend whose native set holds any element carrying the Decoration aspect must hold flm.pres.deco-mark too: the driver moves such a decoration out of a content slot into an attached slot and leaves that mark at its former position.
  2. Every backend must hold flm.pres.unsupported: the driver stages it for a node of an accepted unrenderable element, for a node whose rule failed, and for a node no rule lowers.

A backend missing one fails the registry build with BuildError::NativeSetIncomplete instead of failing at lowering.

§Examples

use flm_core::core::registry::NativeImplicationKind;
use flm_core::stdlib::backends::{lowering, pres};

let implications = lowering::native_implications();
assert_eq!(implications[0].must_claim, pres::DECO_MARK);
assert_eq!(implications[1].must_claim, pres::UNSUPPORTED);
assert_eq!(implications[1].kind, NativeImplicationKind::Always);