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
impl LocalEntityMap
Sourcepub fn new(host_type: HostType) -> LocalEntityMap
pub fn new(host_type: HostType) -> LocalEntityMap
Creates an empty map for the given host_type side of a connection.
Sourcepub fn host_type(&self) -> HostType
pub fn host_type(&self) -> HostType
Returns whether this map belongs to a server or client side.
Sourcepub fn insert_with_host_entity(
&mut self,
global_entity: GlobalEntity,
host_entity: HostEntity,
)
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.
Sourcepub fn insert_with_static_host_entity(
&mut self,
global_entity: GlobalEntity,
host_entity: HostEntity,
)
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.
Sourcepub fn insert_with_remote_entity(
&mut self,
global_entity: GlobalEntity,
remote_entity: RemoteEntity,
)
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.
Sourcepub fn global_entity_from_remote(
&self,
remote_entity: &RemoteEntity,
) -> Option<&GlobalEntity>
pub fn global_entity_from_remote( &self, remote_entity: &RemoteEntity, ) -> Option<&GlobalEntity>
Returns the GlobalEntity mapped from remote_entity, if one exists.
Sourcepub fn global_entity_from_host(
&self,
host_entity: &HostEntity,
) -> Option<&GlobalEntity>
pub fn global_entity_from_host( &self, host_entity: &HostEntity, ) -> Option<&GlobalEntity>
Returns the GlobalEntity mapped from host_entity, if one exists.
Sourcepub fn remove_by_global_entity(
&mut self,
global_entity: &GlobalEntity,
) -> Option<LocalEntityRecord>
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.
Sourcepub fn contains_global_entity(&self, global_entity: &GlobalEntity) -> bool
pub fn contains_global_entity(&self, global_entity: &GlobalEntity) -> bool
Returns true if global_entity is currently registered in the map.
Sourcepub fn contains_host_entity(&self, host_entity: &HostEntity) -> bool
pub fn contains_host_entity(&self, host_entity: &HostEntity) -> bool
Returns true if host_entity is currently registered in the map.
Sourcepub fn contains_remote_entity(&self, remote_entity: &RemoteEntity) -> bool
pub fn contains_remote_entity(&self, remote_entity: &RemoteEntity) -> bool
Returns true if remote_entity is currently registered in the map.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&GlobalEntity, &LocalEntityRecord)>
pub fn iter(&self) -> impl Iterator<Item = (&GlobalEntity, &LocalEntityRecord)>
Iterates over all (GlobalEntity, LocalEntityRecord) pairs currently in the map.
Sourcepub fn entity_converter(&self) -> &dyn LocalEntityAndGlobalEntityConverter
pub fn entity_converter(&self) -> &dyn LocalEntityAndGlobalEntityConverter
Returns self as a read-only LocalEntityAndGlobalEntityConverter reference.
Sourcepub fn install_entity_redirect(
&mut self,
old_entity: OwnedLocalEntity,
new_entity: OwnedLocalEntity,
)
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
impl LocalEntityAndGlobalEntityConverter for LocalEntityMap
Source§fn global_entity_to_host_entity(
&self,
global_entity: &GlobalEntity,
) -> Result<HostEntity, EntityDoesNotExistError>
fn global_entity_to_host_entity( &self, global_entity: &GlobalEntity, ) -> Result<HostEntity, EntityDoesNotExistError>
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>
fn global_entity_to_remote_entity( &self, global_entity: &GlobalEntity, ) -> Result<RemoteEntity, EntityDoesNotExistError>
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>
fn global_entity_to_owned_entity( &self, global_entity: &GlobalEntity, ) -> Result<OwnedLocalEntity, EntityDoesNotExistError>
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>
fn host_entity_to_global_entity( &self, host_entity: &HostEntity, ) -> Result<GlobalEntity, EntityDoesNotExistError>
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>
fn static_host_entity_to_global_entity( &self, host_entity: &HostEntity, ) -> Result<GlobalEntity, EntityDoesNotExistError>
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>
fn remote_entity_to_global_entity( &self, remote_entity: &RemoteEntity, ) -> Result<GlobalEntity, EntityDoesNotExistError>
GlobalEntity for remote_entity, or an error if not found.Source§fn apply_entity_redirect(&self, entity: &OwnedLocalEntity) -> OwnedLocalEntity
fn apply_entity_redirect(&self, entity: &OwnedLocalEntity) -> OwnedLocalEntity
entity, or entity unchanged if no redirect is installed.Source§fn owned_entity_to_global_entity(
&self,
owned_entity: &OwnedLocalEntity,
) -> Result<GlobalEntity, EntityDoesNotExistError>
fn owned_entity_to_global_entity( &self, owned_entity: &OwnedLocalEntity, ) -> Result<GlobalEntity, EntityDoesNotExistError>
GlobalEntity for owned_entity, dispatching to the appropriate host or remote lookup.Auto Trait Implementations§
impl Freeze for LocalEntityMap
impl RefUnwindSafe for LocalEntityMap
impl Send for LocalEntityMap
impl Sync for LocalEntityMap
impl Unpin for LocalEntityMap
impl UnsafeUnpin for LocalEntityMap
impl UnwindSafe for LocalEntityMap
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.