Skip to main content

Product

Struct Product 

Source
pub struct Product<A, B>(pub A, pub B);
Expand description

Intersection product of two bottom-up automata.

Product(a, b) accepts exactly the trees accepted by both component automata. Its state is a pair (state_from_a, state_from_b).

The generic BottomUpTa implementation asks both sides for possible parent states and emits their cartesian product. When both components are deterministic, Product also implements DetBottomUpTa and avoids that result-set enumeration. If both components implement IndexedBottomUpTa, the product also supports indexed rule joins for sibling-finder-style parsing algorithms.

Tuple Fields§

§0: A§1: B

Trait Implementations§

Source§

impl<A, B> BottomUpTa for Product<A, B>
where A: BottomUpTa, B: BottomUpTa,

Source§

type State = (<A as BottomUpTa>::State, <B as BottomUpTa>::State)

State type carried by the automaton. Read more
Source§

fn step( &self, f: Symbol, children: &[Self::State], out: &mut dyn FnMut(Self::State), )

Report all possible parent states for f(children...). Read more
Source§

fn is_accepting(&self, q: &Self::State) -> bool

Return whether q is an accepting state. Read more
Source§

impl<A: Clone, B: Clone> Clone for Product<A, B>

Source§

fn clone(&self) -> Product<A, B>

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<A: Copy, B: Copy> Copy for Product<A, B>

Source§

impl<A: Debug, B: Debug> Debug for Product<A, B>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<A: Default, B: Default> Default for Product<A, B>

Source§

fn default() -> Product<A, B>

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

impl<A, B> DetBottomUpTa for Product<A, B>

Source§

fn step_det(&self, f: Symbol, children: &[Self::State]) -> Option<Self::State>

Return the unique result state, or None if no transition exists. Read more
Source§

fn det_group(&self, f: Symbol) -> u32

Group key for symbols that share a transition function. Read more
Source§

impl<A: Eq, B: Eq> Eq for Product<A, B>

Source§

impl<A, B> IndexedBottomUpTa for Product<A, B>

Source§

fn step_partial( &self, f: Symbol, position: usize, state_at_position: &Self::State, out: &mut dyn FnMut(&[Self::State], Self::State), )

Report every rule f(children...) -> q where children[position] equals state_at_position. Read more
Source§

impl<A: PartialEq, B: PartialEq> PartialEq for Product<A, B>

Source§

fn eq(&self, other: &Product<A, B>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<A: PartialEq, B: PartialEq> StructuralPartialEq for Product<A, B>

Source§

impl<A, B> TopDownTa for Product<A, B>
where A: TopDownTa, B: TopDownTa,

Source§

fn step_topdown( &self, parent: &Self::State, out: &mut dyn FnMut(Symbol, &[Self::State]), )

Report every rule f(children...) -> parent. Read more
Source§

fn initial_states(&self, out: &mut dyn FnMut(Self::State))

Report the initial states of the top-down view. Read more

Auto Trait Implementations§

§

impl<A, B> Freeze for Product<A, B>
where A: Freeze, B: Freeze,

§

impl<A, B> RefUnwindSafe for Product<A, B>

§

impl<A, B> Send for Product<A, B>
where A: Send, B: Send,

§

impl<A, B> Sync for Product<A, B>
where A: Sync, B: Sync,

§

impl<A, B> Unpin for Product<A, B>
where A: Unpin, B: Unpin,

§

impl<A, B> UnsafeUnpin for Product<A, B>
where A: UnsafeUnpin, B: UnsafeUnpin,

§

impl<A, B> UnwindSafe for Product<A, B>
where A: UnwindSafe, B: 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> 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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 = 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.