Skip to main content

RuleSpec

Struct RuleSpec 

Source
pub struct RuleSpec {
Show 19 fields pub name: String, pub open: Vec<AltSpec>, pub close: Vec<AltSpec>, pub bo: Vec<String>, pub ao: Vec<String>, pub bc: Vec<String>, pub ac: Vec<String>, pub bo_fns: Vec<ContextAction>, pub ao_fns: Vec<ContextAction>, pub bc_fns: Vec<ContextAction>, pub ac_fns: Vec<ContextAction>, pub bo_state_fns: Vec<StateAction>, pub ao_state_fns: Vec<StateAction>, pub bc_state_fns: Vec<StateAction>, pub ac_state_fns: Vec<StateAction>, pub bo_order: Vec<ActionBinding>, pub ao_order: Vec<ActionBinding>, pub bc_order: Vec<ActionBinding>, pub ac_order: Vec<ActionBinding>,
}

Fields§

§name: String§open: Vec<AltSpec>§close: Vec<AltSpec>§bo: Vec<String>§ao: Vec<String>§bc: Vec<String>§ac: Vec<String>§bo_fns: Vec<ContextAction>

Imperative lifecycle callbacks, parallel to the named serialized callback lists above.

§ao_fns: Vec<ContextAction>§bc_fns: Vec<ContextAction>§ac_fns: Vec<ContextAction>§bo_state_fns: Vec<StateAction>§ao_state_fns: Vec<StateAction>§bc_state_fns: Vec<StateAction>§ac_state_fns: Vec<StateAction>§bo_order: Vec<ActionBinding>§ao_order: Vec<ActionBinding>§bc_order: Vec<ActionBinding>§ac_order: Vec<ActionBinding>

Implementations§

Source§

impl RuleSpec

Source

pub fn new(name: impl Into<String>) -> Self

Source

pub fn clear(&mut self) -> &mut Self

Remove all alternates and lifecycle actions from this rule.

Source

pub fn add_open(&mut self, alt: AltSpec) -> &mut Self

Source

pub fn prepend_open(&mut self, alt: AltSpec) -> &mut Self

Source

pub fn add_close(&mut self, alt: AltSpec) -> &mut Self

Source

pub fn prepend_close(&mut self, alt: AltSpec) -> &mut Self

Source

pub fn clear_open(&mut self) -> &mut Self

Source

pub fn clear_close(&mut self) -> &mut Self

Source

pub fn modify_open(&mut self, mods: &ListMods<AltSpec>) -> &mut Self

Delete then move entries using the same signed-index rules as the serialized grammar inject object.

Source

pub fn modify_close(&mut self, mods: &ListMods<AltSpec>) -> &mut Self

Source

pub fn add_bo( &mut self, action: impl Fn(&mut Rule, &mut Context) + Send + Sync + 'static, ) -> &mut Self

Source

pub fn prepend_bo( &mut self, action: impl Fn(&mut Rule, &mut Context) + Send + Sync + 'static, ) -> &mut Self

Source

pub fn add_ao( &mut self, action: impl Fn(&mut Rule, &mut Context) + Send + Sync + 'static, ) -> &mut Self

Source

pub fn prepend_ao( &mut self, action: impl Fn(&mut Rule, &mut Context) + Send + Sync + 'static, ) -> &mut Self

Source

pub fn add_bc( &mut self, action: impl Fn(&mut Rule, &mut Context) + Send + Sync + 'static, ) -> &mut Self

Source

pub fn prepend_bc( &mut self, action: impl Fn(&mut Rule, &mut Context) + Send + Sync + 'static, ) -> &mut Self

Source

pub fn add_ac( &mut self, action: impl Fn(&mut Rule, &mut Context) + Send + Sync + 'static, ) -> &mut Self

Source

pub fn prepend_ac( &mut self, action: impl Fn(&mut Rule, &mut Context) + Send + Sync + 'static, ) -> &mut Self

Source

pub fn add_bo_result(&mut self, action: ContextAction) -> &mut Self

Source

pub fn add_ao_result(&mut self, action: ContextAction) -> &mut Self

Source

pub fn add_bc_result(&mut self, action: ContextAction) -> &mut Self

Source

pub fn add_ac_result(&mut self, action: ContextAction) -> &mut Self

Source

pub fn add_bo_with_state(&mut self, action: StateAction) -> &mut Self

Source

pub fn prepend_bo_with_state(&mut self, action: StateAction) -> &mut Self

Source

pub fn add_ao_with_state(&mut self, action: StateAction) -> &mut Self

Source

pub fn prepend_ao_with_state(&mut self, action: StateAction) -> &mut Self

Source

pub fn add_bc_with_state(&mut self, action: StateAction) -> &mut Self

Source

pub fn prepend_bc_with_state(&mut self, action: StateAction) -> &mut Self

Source

pub fn add_ac_with_state(&mut self, action: StateAction) -> &mut Self

Source

pub fn prepend_ac_with_state(&mut self, action: StateAction) -> &mut Self

Source

pub fn add_bo_ref(&mut self, action: impl Into<String>) -> &mut Self

Source

pub fn prepend_bo_ref(&mut self, action: impl Into<String>) -> &mut Self

Source

pub fn add_ao_ref(&mut self, action: impl Into<String>) -> &mut Self

Source

pub fn prepend_ao_ref(&mut self, action: impl Into<String>) -> &mut Self

Source

pub fn add_bc_ref(&mut self, action: impl Into<String>) -> &mut Self

Source

pub fn prepend_bc_ref(&mut self, action: impl Into<String>) -> &mut Self

Source

pub fn add_ac_ref(&mut self, action: impl Into<String>) -> &mut Self

Source

pub fn prepend_ac_ref(&mut self, action: impl Into<String>) -> &mut Self

Source

pub fn clear_actions(&mut self, phases: &[&str]) -> &mut Self

Clear named and imperative lifecycle actions. An empty phase slice clears all four; otherwise accepted phase names are bo, ao, bc, and ac.

Trait Implementations§

Source§

impl Clone for RuleSpec

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RuleSpec

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.