pub struct LoweringRule {
pub name: RuleName,
pub element: ElementName,
pub decl: LoweringDecl,
pub rule: Arc<dyn Lower>,
pub default: DefaultMark,
pub docs: String,
}Expand description
A lowering rule: a named registry entity written for one element, which
declares what it requires, reads and produces, and implements Lower,
which stages the element’s presentation for one backend.
The value holds the rule’s name, the element it lowers, its declaration,
its implementation and its default mark. A feature registers it with
FeatureBuilder::lowering_rule.
Rule names are dotted, and no two rules of a registry have the same name;
a plan request that prefers a rule refers to it by this name. The standard
features name a rule <element>.lower.<variant>, such as
flm.cells.cell.lower.default or flm.parbreak.lower.latex-recomposed.
Fields§
§name: RuleNameThe rule’s name, which no other rule of the registry has.
element: ElementNameThe element whose nodes this rule lowers.
decl: LoweringDeclWhat the rule declares that it needs and may build.
rule: Arc<dyn Lower>The implementation that the lowering stage calls.
default: DefaultMarkOn which backends the rule is chosen when no rule is preferred by name.
docs: StringA one-line description of the rule for a person reading the registry.
Implementations§
Source§impl LoweringRule
impl LoweringRule
Sourcepub fn new(
name: impl Into<RuleName>,
element: impl Into<ElementName>,
decl: LoweringDecl,
rule: Arc<dyn Lower>,
default: DefaultMark,
) -> LoweringRule
pub fn new( name: impl Into<RuleName>, element: impl Into<ElementName>, decl: LoweringDecl, rule: Arc<dyn Lower>, default: DefaultMark, ) -> LoweringRule
Returns the rule name, which lowers element through rule, with
the declaration decl, the default mark default and no description.
Sourcepub fn docs(self, docs: impl Into<String>) -> LoweringRule
pub fn docs(self, docs: impl Into<String>) -> LoweringRule
Sets the rule’s one-line description, and returns the rule.
Trait Implementations§
Source§impl Clone for LoweringRule
impl Clone for LoweringRule
Auto Trait Implementations§
impl !RefUnwindSafe for LoweringRule
impl !UnwindSafe for LoweringRule
impl Forget for LoweringRule
impl Freeze for LoweringRule
impl Move for LoweringRule
impl Send for LoweringRule
impl Sync for LoweringRule
impl Unpin for LoweringRule
impl UnsafeUnpin for LoweringRule
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