pub struct WildcardState {
child_writes: u16,
child_reads: u16,
max_foreign_access: WildcardAccessLevel,
exposed_as: WildcardAccessLevel,
}Expand description
State per location per node keeping track of where relative to this node exposed nodes are and what access permissions they have.
Designed to be completely determined by its parent, siblings and direct children’s max_local_access/max_foreign_access.
Fields§
§child_writes: u16How many of this node’s direct children have max_local_access()==Write.
child_reads: u16How many of this node’s direct children have max_local_access()>=Read.
max_foreign_access: WildcardAccessLevelThe maximum access level that could happen from an exposed node that is foreign to this node.
This is calculated as the max() of the parent’s max_foreign_access,
exposed_as and the siblings’ max_local_access().
exposed_as: WildcardAccessLevelAt what access level this node itself is exposed.
Implementations§
Source§impl WildcardState
impl WildcardState
Sourcefn max_local_access(&self) -> WildcardAccessLevel
fn max_local_access(&self) -> WildcardAccessLevel
The maximum access level that could happen from an exposed node that is local to this node.
From where relative to the node with this wildcard info a read or write access could happen.
From where relative to the node with this wildcard info a read access could happen.
From where relative to the node with this wildcard info a write access could happen.
Sourcepub fn for_new_child(&self) -> Self
pub fn for_new_child(&self) -> Self
Gets the access tracking information for a new child node of a parent with this
wildcard info.
The new node doesn’t have any child reads/writes, but calculates max_foreign_access
from its parent.
Sourcefn push_relevant_children(
stack: &mut Vec<(UniIndex, WildcardAccessLevel)>,
new_foreign_access: WildcardAccessLevel,
old_foreign_access: WildcardAccessLevel,
child_reads: u16,
child_writes: u16,
children: impl Iterator<Item = UniIndex>,
wildcard_accesses: &UniValMap<WildcardState>,
)
fn push_relevant_children( stack: &mut Vec<(UniIndex, WildcardAccessLevel)>, new_foreign_access: WildcardAccessLevel, old_foreign_access: WildcardAccessLevel, child_reads: u16, child_writes: u16, children: impl Iterator<Item = UniIndex>, wildcard_accesses: &UniValMap<WildcardState>, )
Pushes the nodes of children onto the stack who’s max_foreign_access
needs to be updated.
-
children: A list of nodes with the same parent.childrendoesn’t necessarily have to contain all children of parent, but can just be a subset. -
child_reads,child_writes: How many ofchildrenhavemax_local_access()of at leastread/write -
new_foreign_access,old_foreign_access: The max possible access level that is foreign to allchildren(i.e., it is not local to any of them). This can be calculated as the max of the parent’sexposed_as(),max_foreign_accessand of allmax_local_access()of any nodes with the same parent that are not listed inchildren.This access level changed from
oldtonew, which is why we need to updatechildren.
Sourcepub fn update_exposure(
id: UniIndex,
new_exposed_as: WildcardAccessLevel,
nodes: &UniValMap<Node>,
wildcard_accesses: &mut UniValMap<WildcardState>,
)
pub fn update_exposure( id: UniIndex, new_exposed_as: WildcardAccessLevel, nodes: &UniValMap<Node>, wildcard_accesses: &mut UniValMap<WildcardState>, )
Update the tracking information of a tree, to reflect that the node specified by id is
now exposed with new_exposed_as.
Propagates the Willard access information over the tree. This needs to be called every time the access level of an exposed node changes, to keep the state in sync with the rest of the tree.
Trait Implementations§
Source§impl Clone for WildcardState
impl Clone for WildcardState
Source§fn clone(&self) -> WildcardState
fn clone(&self) -> WildcardState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WildcardState
impl Debug for WildcardState
Source§impl Default for WildcardState
impl Default for WildcardState
Source§fn default() -> WildcardState
fn default() -> WildcardState
Source§impl PartialEq for WildcardState
impl PartialEq for WildcardState
impl Eq for WildcardState
impl StructuralPartialEq for WildcardState
Auto Trait Implementations§
impl Freeze for WildcardState
impl RefUnwindSafe for WildcardState
impl Send for WildcardState
impl Sync for WildcardState
impl Unpin for WildcardState
impl UnwindSafe for WildcardState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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: 6 bytes