Struct stack_graphs::partial::PartialScopeStack
source · [−]#[repr(C)]pub struct PartialScopeStack { /* private fields */ }
Expand description
A pattern that might match against a scope stack. Consists of a (possibly empty) list of exported scopes, along with an optional scope stack variable.
Implementations
sourceimpl PartialScopeStack
impl PartialScopeStack
sourcepub fn can_match_empty(&self) -> bool
pub fn can_match_empty(&self) -> bool
Returns whether this partial scope stack can match the empty scope stack.
sourcepub fn can_only_match_empty(&self) -> bool
pub fn can_only_match_empty(&self) -> bool
Returns whether this partial scope stack can only match the empty scope stack.
sourcepub fn contains_scopes(&self) -> bool
pub fn contains_scopes(&self) -> bool
Returns whether this partial scope stack contains any scopes.
pub fn len(&self) -> usize
sourcepub fn empty() -> PartialScopeStack
pub fn empty() -> PartialScopeStack
Returns an empty partial scope stack.
sourcepub fn from_variable(variable: ScopeStackVariable) -> PartialScopeStack
pub fn from_variable(variable: ScopeStackVariable) -> PartialScopeStack
Returns a partial scope stack containing only a scope stack variable.
sourcepub fn have_reversal(&self, partials: &PartialPaths) -> bool
pub fn have_reversal(&self, partials: &PartialPaths) -> bool
Returns whether this partial scope stack is iterable in both directions without needing mutable access to the arena.
sourcepub fn with_offset(self, scope_variable_offset: u32) -> PartialScopeStack
pub fn with_offset(self, scope_variable_offset: u32) -> PartialScopeStack
Applies an offset to this partial scope 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 match_stack(
&self,
stack: ScopeStack,
bindings: &mut ScopeStackBindings
) -> Result<(), PathResolutionError>
pub fn match_stack(
&self,
stack: ScopeStack,
bindings: &mut ScopeStackBindings
) -> Result<(), PathResolutionError>
Matches this partial scope stack against a scope stack, unifying any scope stack variables with an existing set of bindings.
sourcepub fn matches(
self,
partials: &mut PartialPaths,
other: PartialScopeStack
) -> bool
pub fn matches(
self,
partials: &mut PartialPaths,
other: PartialScopeStack
) -> bool
Returns whether two partial scope stacks match exactly the same set of scope stacks.
sourcepub fn apply_bindings(
self,
paths: &mut Paths,
partials: &mut PartialPaths,
bindings: &ScopeStackBindings
) -> Result<ScopeStack, PathResolutionError>
pub fn apply_bindings(
self,
paths: &mut Paths,
partials: &mut PartialPaths,
bindings: &ScopeStackBindings
) -> Result<ScopeStack, PathResolutionError>
Applies a set of scope stack bindings to this partial scope stack, producing a new scope stack.
sourcepub fn apply_partial_bindings(
self,
partials: &mut PartialPaths,
scope_bindings: &PartialScopeStackBindings
) -> Result<PartialScopeStack, PathResolutionError>
pub fn apply_partial_bindings(
self,
partials: &mut PartialPaths,
scope_bindings: &PartialScopeStackBindings
) -> Result<PartialScopeStack, PathResolutionError>
Applies a set of partial scope stack bindings to this partial scope stack, producing a new partial scope stack.
sourcepub fn unify(
self,
partials: &mut PartialPaths,
rhs: PartialScopeStack,
bindings: &mut PartialScopeStackBindings
) -> Result<PartialScopeStack, PathResolutionError>
pub fn unify(
self,
partials: &mut PartialPaths,
rhs: PartialScopeStack,
bindings: &mut PartialScopeStackBindings
) -> Result<PartialScopeStack, PathResolutionError>
Given two partial scope stacks, returns the largest possible partial scope stack such that any scope 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.)
sourcepub fn push_front(&mut self, partials: &mut PartialPaths, node: Handle<Node>)
pub fn push_front(&mut self, partials: &mut PartialPaths, node: Handle<Node>)
Pushes a new Node
onto the front of this partial scope stack. The node must be an
exported scope node.
sourcepub fn push_back(&mut self, partials: &mut PartialPaths, node: Handle<Node>)
pub fn push_back(&mut self, partials: &mut PartialPaths, node: Handle<Node>)
Pushes a new Node
onto the back of this partial scope stack. The node must be an
exported scope node.
sourcepub fn pop_front(&mut self, partials: &mut PartialPaths) -> Option<Handle<Node>>
pub fn pop_front(&mut self, partials: &mut PartialPaths) -> Option<Handle<Node>>
Removes and returns the Node
at the front of this partial scope stack. If the stack
does not contain any exported scope nodes, returns None
.
sourcepub fn pop_back(&mut self, partials: &mut PartialPaths) -> Option<Handle<Node>>
pub fn pop_back(&mut self, partials: &mut PartialPaths) -> Option<Handle<Node>>
Removes and returns the Node
at the back of this partial scope stack. If the stack
does not contain any exported scope nodes, returns None
.
sourcepub fn variable(&self) -> Option<ScopeStackVariable>
pub fn variable(&self) -> Option<ScopeStackVariable>
Returns the scope stack variable at the end of this partial scope stack. If the stack does
not contain a scope stack variable, returns None
.
pub fn equals(self, partials: &mut PartialPaths, other: PartialScopeStack) -> bool
pub fn cmp(
self,
partials: &mut PartialPaths,
other: PartialScopeStack
) -> Ordering
sourcepub fn iter_scopes<'a>(
&self,
partials: &'a mut PartialPaths
) -> impl Iterator<Item = Handle<Node>> + 'a
pub fn iter_scopes<'a>(
&self,
partials: &'a mut PartialPaths
) -> impl Iterator<Item = Handle<Node>> + 'a
Returns an iterator over the scopes in this partial scope stack.
sourcepub fn iter_unordered<'a>(
&self,
partials: &'a PartialPaths
) -> impl Iterator<Item = Handle<Node>> + 'a
pub fn iter_unordered<'a>(
&self,
partials: &'a PartialPaths
) -> impl Iterator<Item = Handle<Node>> + 'a
Returns an iterator over the contents of this partial scope stack, with no guarantee about the ordering of the elements.
pub fn display<'a>(
self,
graph: &'a StackGraph,
partials: &'a mut PartialPaths
) -> impl Display + 'a
Trait Implementations
sourceimpl Clone for PartialScopeStack
impl Clone for PartialScopeStack
sourcefn clone(&self) -> PartialScopeStack
fn clone(&self) -> PartialScopeStack
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl From<PartialScopeStack> for sg_partial_scope_stack
impl From<PartialScopeStack> for sg_partial_scope_stack
sourcefn from(stack: PartialScopeStack) -> sg_partial_scope_stack
fn from(stack: PartialScopeStack) -> sg_partial_scope_stack
Converts to this type from the input type.
sourceimpl Niche for PartialScopeStackwhere
Deque<Handle<Node>>: Niche,
impl Niche for PartialScopeStackwhere
Deque<Handle<Node>>: Niche,
type Output = MaybeUninit<PartialScopeStack>
type Output = MaybeUninit<PartialScopeStack>
The type that is used to store values of 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 more
sourcefn none() -> Self::Output
fn none() -> Self::Output
Returns the niche value for this type that should be used to represent None
for a
ControlledOption
. Read more
sourcefn is_none(value: &Self::Output) -> bool
fn is_none(value: &Self::Output) -> bool
Returns whether value is the niche value for this type.
impl Copy for PartialScopeStack
Auto Trait Implementations
impl !RefUnwindSafe for PartialScopeStack
impl Send for PartialScopeStack
impl Sync for PartialScopeStack
impl Unpin for PartialScopeStack
impl UnwindSafe for PartialScopeStack
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
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,
Causes 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,
Causes self
to use its Display
implementation when
Debug
-formatted. Read more
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes self
to use its LowerExp
implementation when
Debug
-formatted. Read more
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes self
to use its LowerHex
implementation when
Debug
-formatted. Read more
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes 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,
Causes self
to use its Pointer
implementation when
Debug
-formatted. Read more
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes self
to use its UpperExp
implementation when
Debug
-formatted. Read more
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes self
to use its UpperHex
implementation when
Debug
-formatted. Read more
impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
Pipes by value. This is generally the method you want to use. Read more
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,
Borrows 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,
Mutably borrows 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,
Borrows self
, then passes self.borrow()
into the pipe function. Read more
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,
Mutably borrows self
, then passes self.borrow_mut()
into the pipe
function. Read more
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,
Borrows 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,
Mutably borrows self
, then passes self.as_mut()
into the pipe
function. Read more
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
Borrows self
, then passes self.deref()
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,
Immutable access to the 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,
Mutable access to the 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,
Immutable access to the 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,
Mutable access to the 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,
Immutable access to the 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,
Mutable access to the 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
Calls .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
Calls .tap_mut()
only in debug builds, and is erased in release
builds. Read more
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,
Calls .tap_borrow()
only in debug builds, and is erased in release
builds. Read more
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,
Calls .tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more
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,
Calls .tap_ref()
only in debug builds, and is erased in release
builds. Read more
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,
Calls .tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more