Trait naia_shared::ProtocolType
source · [−]pub trait ProtocolType: Sized + Sync + Send + 'static {
type Kind: ProtocolKindType;
fn kind_of<R: ReplicateSafe<Self>>() -> Self::Kind;
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: Replicate<Self>>(self) -> Option<R>;
fn cast_ref<R: ReplicateSafe<Self>>(&self) -> Option<&R>;
fn cast_mut<R: ReplicateSafe<Self>>(&mut self) -> Option<&mut R>;
fn extract_and_insert<N, X: ProtocolInserter<Self, N>>(
&self,
entity: &N,
inserter: &mut X
);
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: ReplicateSafe<Self>>() -> Self::Kind
fn kind_of<R: ReplicateSafe<Self>>() -> Self::Kind
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: ReplicateSafe<Self>>(&self) -> Option<&R>
fn cast_ref<R: ReplicateSafe<Self>>(&self) -> Option<&R>
Cast to a typed immutable reference to the inner Component/Message
fn cast_mut<R: ReplicateSafe<Self>>(&mut self) -> Option<&mut R>
fn cast_mut<R: ReplicateSafe<Self>>(&mut self) -> Option<&mut R>
Cast to a typed mutable reference to the inner Component/Message
fn extract_and_insert<N, X: ProtocolInserter<Self, N>>(
&self,
entity: &N,
inserter: &mut X
)
fn extract_and_insert<N, X: ProtocolInserter<Self, N>>(
&self,
entity: &N,
inserter: &mut X
)
Extract an inner ReplicateSafe impl from the ProtocolType into a ProtocolInserter impl