Skip to main content

PacketSender

Trait PacketSender 

Source
pub trait PacketSender:
    PacketSenderClone
    + Send
    + Sync {
    // Required methods
    fn send(&self, payload: &[u8]) -> Result<(), NaiaClientSocketError>;
    fn server_addr(&self) -> ServerAddr;
    fn connected(&self) -> bool;
    fn disconnect(&mut self);
}
Expand description

Used to send packets from the Client Socket

Required Methods§

Source

fn send(&self, payload: &[u8]) -> Result<(), NaiaClientSocketError>

Sends a packet from the Client Socket

Source

fn server_addr(&self) -> ServerAddr

Get the Server’s Socket address

Source

fn connected(&self) -> bool

Get whether the Client Socket is connected

Source

fn disconnect(&mut self)

Disconnect the Client Socket

Trait Implementations§

Source§

impl Clone for Box<dyn PacketSender>

Source§

fn clone(&self) -> Box<dyn PacketSender>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementors§