ExternalizedSingletonInverseVariableSupply

Struct ExternalizedSingletonInverseVariableSupply 

Source
pub struct ExternalizedSingletonInverseVariableSupply<V, E>
where V: Eq + Hash + Clone + Send + Sync + 'static, E: Clone + Send + Sync + 'static,
{ /* private fields */ }
Expand description

Hash-based implementation of inverse variable supply.

Uses a HashMap internally for O(1) average-case lookups. Thread-safe via RwLock.

Implementations§

Source§

impl<V, E> ExternalizedSingletonInverseVariableSupply<V, E>
where V: Eq + Hash + Clone + Send + Sync + 'static, E: Clone + Send + Sync + 'static,

Source

pub fn new(variable_name: impl Into<String>) -> Self

Creates a new externalized inverse variable supply.

Source

pub fn variable_name(&self) -> &str

Returns the variable name this supply tracks.

Trait Implementations§

Source§

impl<V, E> Debug for ExternalizedSingletonInverseVariableSupply<V, E>
where V: Eq + Hash + Clone + Send + Sync + 'static, E: Clone + Send + Sync + 'static,

Source§

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

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

impl<V, E> SingletonInverseVariableSupply<V, E> for ExternalizedSingletonInverseVariableSupply<V, E>
where V: Eq + Hash + Clone + Send + Sync + 'static, E: Clone + Send + Sync + 'static,

Source§

fn get_inverse_singleton(&self, value: &V) -> Option<E>

Gets the entity that points to the given value, if any. Read more
Source§

fn insert(&self, value: V, entity: E)

Registers that an entity now points to a value. Read more
Source§

fn remove(&self, value: &V) -> Option<E>

Removes the mapping for a value. Read more
Source§

fn clear(&self)

Clears all mappings.
Source§

fn len(&self) -> usize

Returns the number of tracked mappings.
Source§

fn update(&self, old_value: Option<&V>, new_value: V, entity: E)

Updates the mapping: removes old value mapping, adds new.
Source§

fn is_empty(&self) -> bool

Returns true if no mappings exist.
Source§

impl<V, E> Supply for ExternalizedSingletonInverseVariableSupply<V, E>
where V: Eq + Hash + Clone + Send + Sync + 'static, E: Clone + Send + Sync + 'static,

Source§

fn supply_type_id(&self) -> TypeId

Returns the type ID of this supply for registration purposes.

Auto Trait Implementations§

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