Skip to main content

ConstructorBuilder

Struct ConstructorBuilder 

Source
pub struct ConstructorBuilder { /* private fields */ }
Expand description

Accumulates a constructor definition and installs it via def_constructor.

Implementations§

Source§

impl ConstructorBuilder

Source

pub fn new(proto: &str) -> Result<Self>

Parse the prototype (shared with the macro path via parse_prototype).

Source

pub fn replacement(self, repl: ReplacementClosure) -> Self

Set the XML replacement (template- or closure-derived; built by the caller).

Source

pub fn set_option(self, key: &str, value: OptionValue) -> Result<Self>

Apply a scalar option by name (see apply_scalar_option, the single-source key→field map shared with EnvironmentBuilder).

Source

pub fn after_digest(self, hook: DigestionClosure) -> Self

Push an afterDigest hook (constructor: after digestion; environment: runs on the \end whatsit — Perl semantics).

Source

pub fn after_digest_begin(self, hook: DigestionClosure) -> Self

Push an afterDigestBegin hook (environments: runs on the \begin whatsit right after its arguments digest).

Source

pub fn after_digest_body(self, hook: DigestionClosure) -> Self

Push an afterDigestBody hook (environments / box constructors: runs on the whatsit after the captured body digests — Perl’s afterDigestBody).

Source

pub fn before_digest(self, hook: BeforeDigestClosure) -> Self

Push a beforeDigest hook (runs before the arguments are digested — Perl’s beforeDigest => sub {…}, e.g. \footnote’s neutralize_font).

Source

pub fn before_digest_end(self, hook: BeforeDigestClosure) -> Self

Push a beforeDigestEnd hook (environments: before \end{…} digests).

Source

pub fn before_construct(self, hook: ConstructionClosure) -> Self

Push a beforeConstruct hook (runs before the replacement absorbs).

Source

pub fn after_construct(self, hook: ConstructionClosure) -> Self

Push an afterConstruct hook (runs after the replacement absorbs).

Source

pub fn properties(self, props: PropertiesClosure) -> Self

Set the properties closure (computes the whatsit’s property map from the digested args — Perl’s properties => sub {…} / properties => {…}).

Source

pub fn reversion(self, rev: Reversion) -> Self

Set the reversion (reversion => "…" token form or a closure).

Source

pub fn font(self, font: FontDirective) -> Self

Set the font directive (font => { family => …, … }).

Source

pub fn sizer(self, sizer: SizingClosure) -> Self

Set the sizer (sizer => sub {…} computing (width, height, depth)).

Source

pub fn install(self) -> Result<()>

Install the accumulated definition.

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.