Struct InstanceHolder
pub struct InstanceHolder {
pub partial_instance: Arc<RwLock<RawRwLock, PartialInstance>>,
pub instance: Arc<RwLock<RawRwLock, Instance>>,
}
Expand description
A component that keeps strong references to our PartialInstance
and
Instance
for local players.
This can also act as a convenience for accessing the player’s Instance since
the alternative is to look up the player’s InstanceName
in the
InstanceContainer
.
Fields§
§partial_instance: Arc<RwLock<RawRwLock, PartialInstance>>
The partial instance is the world this client currently has loaded. It has a limited render distance.
instance: Arc<RwLock<RawRwLock, Instance>>
The world is the combined PartialInstance
s of all clients in the
same world.
This is only relevant if you’re using a shared world (i.e. a swarm).
Implementations§
§impl InstanceHolder
impl InstanceHolder
pub fn new(
entity: Entity,
instance: Arc<RwLock<RawRwLock, Instance>>,
) -> InstanceHolder
pub fn new( entity: Entity, instance: Arc<RwLock<RawRwLock, Instance>>, ) -> InstanceHolder
Create a new InstanceHolder
for the given entity.
The partial instance will be created for you. The render distance will be set to a default value, which you can change by creating a new partial_instance.
pub fn reset(&mut self)
pub fn reset(&mut self)
Reset the Instance
to a new reference to an empty instance, but with
the same registries as the current one.
This is used by Azalea when entering the config state.
Trait Implementations§
§impl Clone for InstanceHolder
impl Clone for InstanceHolder
§fn clone(&self) -> InstanceHolder
fn clone(&self) -> InstanceHolder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Component for InstanceHolder
impl Component for InstanceHolder
§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>
,
while immutable components will instead have Component<Mutability = Immutable>
. Read more§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
§fn on_replace() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_replace() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
Auto Trait Implementations§
impl Freeze for InstanceHolder
impl !RefUnwindSafe for InstanceHolder
impl Send for InstanceHolder
impl Sync for InstanceHolder
impl Unpin for InstanceHolder
impl !UnwindSafe for InstanceHolder
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
§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ids: &mut impl FnMut(ComponentId), )
§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>),
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>), )
Bundle
]’s component ids. This will be None
if the component has not been registered.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.