Struct stack_graphs::partial::PartialSymbolStack
source · #[repr(C)]pub struct PartialSymbolStack { /* private fields */ }Expand description
A pattern that might match against a symbol stack. Consists of a (possibly empty) list of partial scoped symbols, along with an optional symbol stack variable.
Implementations§
source§impl PartialSymbolStack
impl PartialSymbolStack
sourcepub fn can_match_empty(&self) -> bool
pub fn can_match_empty(&self) -> bool
Returns whether this partial symbol stack can match the empty symbol stack.
sourcepub fn can_only_match_empty(&self) -> bool
pub fn can_only_match_empty(&self) -> bool
Returns whether this partial symbol stack can only match the empty symbol stack.
sourcepub fn contains_symbols(&self) -> bool
pub fn contains_symbols(&self) -> bool
Returns whether this partial symbol stack contains any symbols.
sourcepub fn has_variable(&self) -> bool
pub fn has_variable(&self) -> bool
Returns whether this partial symbol stack has a symbol stack variable.
pub fn len(&self) -> usize
sourcepub fn empty() -> PartialSymbolStack
pub fn empty() -> PartialSymbolStack
Returns an empty partial symbol stack.
sourcepub fn from_variable(variable: SymbolStackVariable) -> PartialSymbolStack
pub fn from_variable(variable: SymbolStackVariable) -> PartialSymbolStack
Returns a partial symbol stack containing only a symbol stack variable.
sourcepub fn have_reversal(&self, partials: &PartialPaths) -> bool
pub fn have_reversal(&self, partials: &PartialPaths) -> bool
Returns whether this partial symbol stack is iterable in both directions without needing mutable access to the arena.
sourcepub fn with_offset(
self,
partials: &mut PartialPaths,
symbol_variable_offset: u32,
scope_variable_offset: u32
) -> PartialSymbolStack
pub fn with_offset( self, partials: &mut PartialPaths, symbol_variable_offset: u32, scope_variable_offset: u32 ) -> PartialSymbolStack
Applies an offset to this partial symbol stack.
When concatenating partial paths, we have to ensure that the left- and right-hand sides have non-overlapping sets of variables. To do this, we find the maximum value of any variable on the left-hand side, and add this “offset” to the values of all of the variables on the right-hand side.
sourcepub fn push_front(
&mut self,
partials: &mut PartialPaths,
symbol: PartialScopedSymbol
)
pub fn push_front( &mut self, partials: &mut PartialPaths, symbol: PartialScopedSymbol )
Pushes a new PartialScopedSymbol onto the front of this partial symbol stack.
sourcepub fn push_back(
&mut self,
partials: &mut PartialPaths,
symbol: PartialScopedSymbol
)
pub fn push_back( &mut self, partials: &mut PartialPaths, symbol: PartialScopedSymbol )
Pushes a new PartialScopedSymbol onto the back of this partial symbol stack.
sourcepub fn pop_front(
&mut self,
partials: &mut PartialPaths
) -> Option<PartialScopedSymbol>
pub fn pop_front( &mut self, partials: &mut PartialPaths ) -> Option<PartialScopedSymbol>
Removes and returns the PartialScopedSymbol at the front of this partial symbol
stack. If the stack is empty, returns None.
sourcepub fn pop_back(
&mut self,
partials: &mut PartialPaths
) -> Option<PartialScopedSymbol>
pub fn pop_back( &mut self, partials: &mut PartialPaths ) -> Option<PartialScopedSymbol>
Removes and returns the PartialScopedSymbol at the back of this partial symbol stack.
If the stack is empty, returns None.
pub fn display<'a>( self, graph: &'a StackGraph, partials: &'a mut PartialPaths ) -> impl Display + 'a
sourcepub fn matches(
self,
partials: &mut PartialPaths,
other: PartialSymbolStack
) -> bool
pub fn matches( self, partials: &mut PartialPaths, other: PartialSymbolStack ) -> bool
Returns whether two partial symbol stacks “match”. They must be the same length, and each respective partial scoped symbol must match.
sourcepub fn apply_partial_bindings(
self,
partials: &mut PartialPaths,
symbol_bindings: &PartialSymbolStackBindings,
scope_bindings: &PartialScopeStackBindings
) -> Result<PartialSymbolStack, PathResolutionError>
pub fn apply_partial_bindings( self, partials: &mut PartialPaths, symbol_bindings: &PartialSymbolStackBindings, scope_bindings: &PartialScopeStackBindings ) -> Result<PartialSymbolStack, PathResolutionError>
Applies a set of bindings to this partial symbol stack, producing a new partial symbol stack.
sourcepub fn unify(
self,
partials: &mut PartialPaths,
rhs: PartialSymbolStack,
symbol_bindings: &mut PartialSymbolStackBindings,
scope_bindings: &mut PartialScopeStackBindings
) -> Result<PartialSymbolStack, PathResolutionError>
pub fn unify( self, partials: &mut PartialPaths, rhs: PartialSymbolStack, symbol_bindings: &mut PartialSymbolStackBindings, scope_bindings: &mut PartialScopeStackBindings ) -> Result<PartialSymbolStack, PathResolutionError>
Given two partial symbol stacks, returns the largest possible partial symbol stack such that any symbol stack that satisfies the result also satisfies both inputs. This takes into account any existing variable assignments, and updates those variable assignments with whatever constraints are necessary to produce a correct result.
Note that this operation is commutative. (Concatenating partial paths, defined in
PartialPath::concatenate, is not.)
pub fn equals( self, partials: &mut PartialPaths, other: PartialSymbolStack ) -> bool
pub fn cmp( self, graph: &StackGraph, partials: &mut PartialPaths, other: PartialSymbolStack ) -> Ordering
sourcepub fn iter<'a>(
&self,
partials: &'a mut PartialPaths
) -> impl Iterator<Item = PartialScopedSymbol> + 'a
pub fn iter<'a>( &self, partials: &'a mut PartialPaths ) -> impl Iterator<Item = PartialScopedSymbol> + 'a
Returns an iterator over the contents of this partial symbol stack.
sourcepub fn iter_unordered<'a>(
&self,
partials: &'a PartialPaths
) -> impl Iterator<Item = PartialScopedSymbol> + 'a
pub fn iter_unordered<'a>( &self, partials: &'a PartialPaths ) -> impl Iterator<Item = PartialScopedSymbol> + 'a
Returns an iterator over the contents of this partial symbol stack, with no guarantee about the ordering of the elements.
pub fn variable(&self) -> Option<SymbolStackVariable>
sourcepub fn largest_symbol_stack_variable(&self) -> u32
pub fn largest_symbol_stack_variable(&self) -> u32
Returns the largest value of any symbol stack variable in this partial symbol stack.
sourcepub fn largest_scope_stack_variable(&self, partials: &PartialPaths) -> u32
pub fn largest_scope_stack_variable(&self, partials: &PartialPaths) -> u32
Returns the largest value of any scope stack variable in this partial symbol stack.
Trait Implementations§
source§impl Clone for PartialSymbolStack
impl Clone for PartialSymbolStack
source§fn clone(&self) -> PartialSymbolStack
fn clone(&self) -> PartialSymbolStack
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl From<PartialSymbolStack> for sg_partial_symbol_stack
impl From<PartialSymbolStack> for sg_partial_symbol_stack
source§fn from(stack: PartialSymbolStack) -> sg_partial_symbol_stack
fn from(stack: PartialSymbolStack) -> sg_partial_symbol_stack
source§impl Niche for PartialSymbolStackwhere
Deque<PartialScopedSymbol>: Niche,
impl Niche for PartialSymbolStackwhere Deque<PartialScopedSymbol>: Niche,
§type Output = MaybeUninit<PartialSymbolStack>
type Output = MaybeUninit<PartialSymbolStack>
Self inside of a ControlledOption. This might
be Self itself, if your niche is a valid instance of the type, but which violates some
runtime constraint. But if you cannot easily create your niche as an instance of Self,
you can use some other type, you can use some other type instead. Read moresource§fn none() -> Self::Output
fn none() -> Self::Output
None for a
ControlledOption.source§fn is_none(value: &Self::Output) -> bool
fn is_none(value: &Self::Output) -> bool
impl Copy for PartialSymbolStack
Auto Trait Implementations§
impl !RefUnwindSafe for PartialSymbolStack
impl Send for PartialSymbolStack
impl Sync for PartialSymbolStack
impl Unpin for PartialSymbolStack
impl UnwindSafe for PartialSymbolStack
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<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where &'a Self: for<'a> IntoIterator,
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere Self: Borrow<B>, B: 'a + ?Sized, R: 'a,
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> Rwhere Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere Self: AsRef<U>, U: 'a + ?Sized, R: 'a,
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere Self: AsMut<U>, U: 'a + ?Sized, R: 'a,
self, then passes self.as_mut() into the pipe
function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
.tap_ref_mut() only in debug builds, and is erased in release
builds.