EngineBuilder

Struct EngineBuilder 

Source
pub struct EngineBuilder<T, M, R>
where T: Uniplate, R: Rule<T, M>,
{ /* private fields */ }
Expand description

A builder type for constructing and configuring Engine instances.

Implementations§

Source§

impl<T, M, R> EngineBuilder<T, M, R>
where T: Uniplate, R: Rule<T, M>,

Source

pub fn new() -> Self

Creates a new builder instance with the default select_first selector.

Source

pub fn build(self) -> Engine<T, M, R>

Consumes the builder and returns the constructed Engine instance.

Source

pub fn add_rule_group(self, rules: Vec<R>) -> Self

Adds a collection of rules with the same priority.

These rules will have a lower priority than previously added groups.

Source

pub fn add_rule(self, rule: R) -> Self

Adds a single rule in a group by itself.

This is a special case of add_rule_group.

Source

pub fn append_rule_groups(self, groups: Vec<Vec<R>>) -> Self

Adds a collection of rule groups to the existing one.

Rule groups maintain the same order and will be lower priority than existing groups.

Source

pub fn add_before_up(self, handler: fn(&T, &mut M)) -> Self

Register an event handler to be called before moving $dir in the tree.

Source

pub fn add_after_up(self, handler: fn(&T, &mut M)) -> Self

Register an event handler to be called after moving $dir one node in the tree.

Source

pub fn add_before_down(self, handler: fn(&T, &mut M)) -> Self

Register an event handler to be called before moving $dir in the tree.

Source

pub fn add_after_down(self, handler: fn(&T, &mut M)) -> Self

Register an event handler to be called after moving $dir one node in the tree.

Source

pub fn add_before_right(self, handler: fn(&T, &mut M)) -> Self

Register an event handler to be called before moving $dir in the tree.

Source

pub fn add_after_right(self, handler: fn(&T, &mut M)) -> Self

Register an event handler to be called after moving $dir one node in the tree.

Source

pub fn set_selector(self, selector: SelectorFn<T, M, R>) -> Self

Sets the selector function to be used when multiple rules are applicable to the same node.

See the morph method of the Engine type for more information.

Trait Implementations§

Source§

impl<T, M, R> Default for EngineBuilder<T, M, R>
where T: Uniplate, R: Rule<T, M>,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T, M, R> From<EngineBuilder<T, M, R>> for Engine<T, M, R>
where T: Uniplate, R: Rule<T, M>,

Source§

fn from(val: EngineBuilder<T, M, R>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T, M, R> Freeze for EngineBuilder<T, M, R>

§

impl<T, M, R> RefUnwindSafe for EngineBuilder<T, M, R>
where R: RefUnwindSafe,

§

impl<T, M, R> Send for EngineBuilder<T, M, R>
where R: Send,

§

impl<T, M, R> Sync for EngineBuilder<T, M, R>
where R: Sync,

§

impl<T, M, R> Unpin for EngineBuilder<T, M, R>
where R: Unpin,

§

impl<T, M, R> UnwindSafe for EngineBuilder<T, M, R>
where R: UnwindSafe,

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 176 bytes