## WildcardState

# Struct WildcardState

Source

    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: u16`

How many of this node’s direct children have `max_local_access()==Write`.

§`child_reads: u16`

How many of this node’s direct children have `max_local_access()>=Read`.

§`max_foreign_access: WildcardAccessLevel`

The 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: WildcardAccessLevel`

At what access level this node itself is exposed.

## Implementations§

Source§

### impl WildcardState

Source

#### fn max_local_access(&self) -> WildcardAccessLevel

The maximum access level that could happen from an exposed node that is local to this node.

Source

#### pub fn access_relatedness( &self, kind: AccessKind, ) -> Option<WildcardAccessRelatedness>

From where relative to the node with this wildcard info a read or write access could happen.

Source

#### fn read_access_relatedness(&self) -> Option<WildcardAccessRelatedness>

From where relative to the node with this wildcard info a read access could happen.

Source

#### fn write_access_relatedness(&self) -> Option<WildcardAccessRelatedness>

From where relative to the node with this wildcard info a write access could happen.

Source

#### 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.

Source

#### 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. `children` doesn’t necessarily have to contain all children of parent, but can just be a subset.

- `child_reads`, `child_writes`: How many of `children` have `max_local_access()` of at least `read`/`write`

- `new_foreign_access`, `old_foreign_access`: The max possible access level that is foreign to all `children` (i.e., it is not local to any of them). This can be calculated as the max of the parent’s `exposed_as()`, `max_foreign_access` and of all `max_local_access()` of any nodes with the same parent that are not listed in `children`.

  This access level changed from `old` to `new`, which is why we need to update `children`.

Source

#### 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

Source§

#### fn clone(&self) -> WildcardState

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from `source`. Read more
Source§

### impl Debug for WildcardState

Source§

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

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

### impl Default for WildcardState

Source§

#### fn default() -> WildcardState

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

### impl PartialEq for WildcardState

Source§

#### fn eq(&self, other: &WildcardState) -> bool

Tests for `self` and `other` values to be equal, and is used by `==`.
1.0.0 · 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 Eq for WildcardState

Source§

### 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> 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> Same for T

Source§

#### type Output = T

Should always be `Self`
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.
§

### impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

#### fn vzip(self) -> V

## 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