Skip to main content

LocalEntityMap

Struct LocalEntityMap 

Source
pub struct LocalEntityMap { /* private fields */ }
Expand description

Bidirectional lookup table between GlobalEntity identifiers and their connection-local HostEntity or RemoteEntity counterparts.

Implementations§

Source§

impl LocalEntityMap

Source

pub fn new(host_type: HostType) -> LocalEntityMap

Creates an empty map for the given host_type side of a connection.

Source

pub fn host_type(&self) -> HostType

Returns whether this map belongs to a server or client side.

Source

pub fn insert_with_host_entity( &mut self, global_entity: GlobalEntity, host_entity: HostEntity, )

Registers a host-owned mapping from global_entity to host_entity, panicking on duplicate keys.

Source

pub fn insert_with_static_host_entity( &mut self, global_entity: GlobalEntity, host_entity: HostEntity, )

Registers a static host-owned mapping from global_entity to host_entity, panicking on duplicate keys.

Source

pub fn insert_with_remote_entity( &mut self, global_entity: GlobalEntity, remote_entity: RemoteEntity, )

Registers a remote-owned mapping from global_entity to remote_entity, panicking on duplicate keys.

Source

pub fn global_entity_from_remote( &self, remote_entity: &RemoteEntity, ) -> Option<&GlobalEntity>

Returns the GlobalEntity mapped from remote_entity, if one exists.

Source

pub fn global_entity_from_host( &self, host_entity: &HostEntity, ) -> Option<&GlobalEntity>

Returns the GlobalEntity mapped from host_entity, if one exists.

Source

pub fn remove_by_global_entity( &mut self, global_entity: &GlobalEntity, ) -> Option<LocalEntityRecord>

Removes the record for global_entity and cleans up the reverse index, returning the record if it existed.

Source

pub fn contains_global_entity(&self, global_entity: &GlobalEntity) -> bool

Returns true if global_entity is currently registered in the map.

Source

pub fn contains_host_entity(&self, host_entity: &HostEntity) -> bool

Returns true if host_entity is currently registered in the map.

Source

pub fn contains_remote_entity(&self, remote_entity: &RemoteEntity) -> bool

Returns true if remote_entity is currently registered in the map.

Source

pub fn iter(&self) -> impl Iterator<Item = (&GlobalEntity, &LocalEntityRecord)>

Iterates over all (GlobalEntity, LocalEntityRecord) pairs currently in the map.

Source

pub fn entity_converter(&self) -> &dyn LocalEntityAndGlobalEntityConverter

Returns self as a read-only LocalEntityAndGlobalEntityConverter reference.

Source

pub fn install_entity_redirect( &mut self, old_entity: OwnedLocalEntity, new_entity: OwnedLocalEntity, )

Installs a redirect so that lookups of old_entity transparently return new_entity for a TTL period.

Trait Implementations§

Source§

impl LocalEntityAndGlobalEntityConverter for LocalEntityMap

Source§

fn global_entity_to_host_entity( &self, global_entity: &GlobalEntity, ) -> Result<HostEntity, EntityDoesNotExistError>

Returns the HostEntity for global_entity if one is registered, or an error otherwise.
Source§

fn global_entity_to_remote_entity( &self, global_entity: &GlobalEntity, ) -> Result<RemoteEntity, EntityDoesNotExistError>

Returns the RemoteEntity for global_entity if one is registered, or an error otherwise.
Source§

fn global_entity_to_owned_entity( &self, global_entity: &GlobalEntity, ) -> Result<OwnedLocalEntity, EntityDoesNotExistError>

Returns the OwnedLocalEntity (host or remote) for global_entity, or an error if not found.
Source§

fn host_entity_to_global_entity( &self, host_entity: &HostEntity, ) -> Result<GlobalEntity, EntityDoesNotExistError>

Returns the GlobalEntity for a dynamic host_entity, or an error if not found.
Source§

fn static_host_entity_to_global_entity( &self, host_entity: &HostEntity, ) -> Result<GlobalEntity, EntityDoesNotExistError>

Returns the GlobalEntity for a static host_entity, or an error if not found.
Source§

fn remote_entity_to_global_entity( &self, remote_entity: &RemoteEntity, ) -> Result<GlobalEntity, EntityDoesNotExistError>

Returns the GlobalEntity for remote_entity, or an error if not found.
Source§

fn apply_entity_redirect(&self, entity: &OwnedLocalEntity) -> OwnedLocalEntity

Returns the current redirect target for entity, or entity unchanged if no redirect is installed.
Source§

fn owned_entity_to_global_entity( &self, owned_entity: &OwnedLocalEntity, ) -> Result<GlobalEntity, EntityDoesNotExistError>

Returns the GlobalEntity for owned_entity, dispatching to the appropriate host or remote lookup.

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
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> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> ConditionalSend for T
where T: Send,