naia-server 0.24.0

A server that uses either UDP or WebRTC communication to send/receive messages to/from connected clients, and syncs registered Entities/Components to clients to whom they are in-scope.
Documentation
use crate::UserKey;

#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum EntityOwner {
    Server,
    Client(UserKey),
    ClientWaiting(UserKey),
    ClientPublic(UserKey),
    Local,
}

impl EntityOwner {
    pub fn is_server(&self) -> bool {
        match self {
            EntityOwner::Server => true,
            _ => false,
        }
    }

    pub fn is_client(&self) -> bool {
        match self {
            EntityOwner::Client(_)
            | EntityOwner::ClientPublic(_)
            | EntityOwner::ClientWaiting(_) => true,
            _ => false,
        }
    }

    pub fn is_public(&self) -> bool {
        match self {
            EntityOwner::ClientPublic(_) | EntityOwner::Server => true,
            _ => false,
        }
    }
}