Trait naia_client::ProtocolType
source · [−]pub trait ProtocolType: 'static + Sync + Send {
type Kind: ProtocolKindType;
fn kind_of<R>() -> Self::Kind
where
R: ReplicateSafe<Self>;
fn type_to_kind(type_id: TypeId) -> Self::Kind;
fn dyn_ref(&self) -> ReplicaDynRef<'_, Self>;
fn dyn_mut(&mut self) -> ReplicaDynMut<'_, Self>;
fn cast<R>(self) -> Option<R>
where
R: Replicate<Self>;
fn cast_ref<R>(&self) -> Option<&R>
where
R: ReplicateSafe<Self>;
fn cast_mut<R>(&mut self) -> Option<&mut R>
where
R: ReplicateSafe<Self>;
fn extract_and_insert<N, X>(&self, entity: &N, inserter: &mut X)
where
X: ProtocolInserter<Self, N>;
fn clone(&self) -> Self;
}
Expand description
An Enum with a variant for every Component/Message that can be sent between Client/Host
Associated Types
type Kind: ProtocolKindType
Required methods
fn kind_of<R>() -> Self::Kind where
R: ReplicateSafe<Self>,
fn kind_of<R>() -> Self::Kind where
R: ReplicateSafe<Self>,
Get kind of ReplicateSafe type
fn type_to_kind(type_id: TypeId) -> Self::Kind
fn type_to_kind(type_id: TypeId) -> Self::Kind
Get kind from a type_id
fn dyn_ref(&self) -> ReplicaDynRef<'_, Self>
fn dyn_ref(&self) -> ReplicaDynRef<'_, Self>
Get an immutable reference to the inner Component/Message as a ReplicateSafe trait object
fn dyn_mut(&mut self) -> ReplicaDynMut<'_, Self>
fn dyn_mut(&mut self) -> ReplicaDynMut<'_, Self>
Get an mutable reference to the inner Component/Message as a ReplicateSafe trait object
fn cast_ref<R>(&self) -> Option<&R> where
R: ReplicateSafe<Self>,
fn cast_ref<R>(&self) -> Option<&R> where
R: ReplicateSafe<Self>,
Cast to a typed immutable reference to the inner Component/Message
fn cast_mut<R>(&mut self) -> Option<&mut R> where
R: ReplicateSafe<Self>,
fn cast_mut<R>(&mut self) -> Option<&mut R> where
R: ReplicateSafe<Self>,
Cast to a typed mutable reference to the inner Component/Message
fn extract_and_insert<N, X>(&self, entity: &N, inserter: &mut X) where
X: ProtocolInserter<Self, N>,
fn extract_and_insert<N, X>(&self, entity: &N, inserter: &mut X) where
X: ProtocolInserter<Self, N>,
Extract an inner ReplicateSafe impl from the ProtocolType into a ProtocolInserter impl