Enum EndpointEvent

Source
pub enum EndpointEvent {
    ConnectionFailed {
        peer_id: PeerId,
    },
    ConnectionRequested {
        peer_id: PeerId,
        socket_addr: SocketAddr,
        is_client: bool,
    },
    Disconnected {
        peer_id: PeerId,
        reason: Option<String>,
    },
    ReceivedDatagram {
        peer_id: PeerId,
        bytes: Bytes,
    },
    ReceivedMessage {
        peer_id: PeerId,
        bytes: Bytes,
    },
}
Expand description

An event raised on the endpoint.

Variants§

§

ConnectionFailed

A connection initiated by this endpoint has failed.

Fields

§peer_id: PeerId

Associated peer id.

§

ConnectionRequested

A new connection has been requested by a peer.

You can use this to filter connections, limit player counts, etc. Either accept or reject a connection using RivetsEndpoint::accept and RivetsEndpoint::reject.

Fields

§peer_id: PeerId

Associated peer id.

§socket_addr: SocketAddr

The socket address of the connecting peer.

§is_client: bool

If true, the endpoint that has been connected to is a client.

§

Disconnected

An accepted connection got disconnected.

This will always be raised regardless of if the peer’s request was accepted or not, because this could happen before the game loop gets to processing the request.

Fields

§peer_id: PeerId

Associated peer id.

§reason: Option<String>

An optional reason for the disconnection, None if the connection was closed by the local endpoint.

§

ReceivedDatagram

A datagram was received from a peer.

Fields

§peer_id: PeerId

Associated peer id.

§bytes: Bytes

Datagram data as bytes.

§

ReceivedMessage

A reliable message was received from a peer.

Fields

§peer_id: PeerId

Associated peer id.

§bytes: Bytes

Message data as bytes.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V