[][src]Struct naia_shared::Manifest

pub struct Manifest<T: EventType, U: ActorType> { /* fields omitted */ }

Contains the shared protocol between Client & Server, with a data that is able to map Event/Actor TypeIds to their representation within specified enums. Also is able to create new Event/Actors using registered Builders, given a specific TypeId.

Implementations

impl<T: EventType, U: ActorType> Manifest<T, U>[src]

pub fn new() -> Self[src]

Create a new Manifest

pub fn register_event(&mut self, event_builder: Box<dyn EventBuilder<T>>)[src]

Register an EventBuilder to handle the creation of Event instances

pub fn get_event_naia_id(&self, type_id: &TypeId) -> u16[src]

Given an Event's TypeId, get a NaiaId (that can be written/read from packets)

pub fn create_event(
    &self,
    naia_id: u16,
    reader: &mut PacketReader<'_>
) -> Option<T>
[src]

Creates an Event instance, given a NaiaId and a payload, typically from an incoming packet

pub fn register_actor(&mut self, actor_builder: Box<dyn ActorBuilder<U>>)[src]

Register an ActorBuilder to handle the creation of Actor instances

pub fn get_actor_naia_id(&self, type_id: &TypeId) -> u16[src]

Given an Actor's TypeId, get a NaiaId (that can be written/read from packets)

pub fn create_actor(
    &self,
    naia_id: u16,
    reader: &mut PacketReader<'_>
) -> Option<U>
[src]

Creates an Event instance, given a NaiaId and a payload, typically from an incoming packet

pub fn register_pawn(
    &mut self,
    actor_builder: Box<dyn ActorBuilder<U>>,
    event_builder: Box<dyn EventBuilder<T>>
)
[src]

Register both an ActorBuilder and an EventBuilder to handle the creation of both as a Pawn & Command, respectively. Pawns & Commands should be used for any player-controlled actor that requires clientside prediction

Trait Implementations

impl<T: Debug + EventType, U: Debug + ActorType> Debug for Manifest<T, U>[src]

Auto Trait Implementations

impl<T, U> !RefUnwindSafe for Manifest<T, U>

impl<T, U> !Send for Manifest<T, U>

impl<T, U> !Sync for Manifest<T, U>

impl<T, U> Unpin for Manifest<T, U>

impl<T, U> !UnwindSafe for Manifest<T, U>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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