Struct CoreLocalAdapter

Source
pub struct CoreLocalAdapter<E> { /* private fields */ }
Expand description

The default adapter. Store the state in memory.

Implementations§

Source§

impl<E: SocketEmitter> CoreLocalAdapter<E>

Source

pub fn new(emitter: E) -> Self

Create a new local adapter with the given sockets interface.

Source

pub fn close(&self)

Clears all the rooms and sockets.

Source

pub fn add_all(&self, sid: Sid, rooms: impl RoomParam)

Adds the socket to all the rooms.

Source

pub fn del(&self, sid: Sid, rooms: impl RoomParam)

Removes the socket from the rooms.

Source

pub fn del_all(&self, sid: Sid)

Removes the socket from all the rooms.

Source

pub fn broadcast( &self, packet: Packet, opts: BroadcastOptions, ) -> Result<(), Vec<SocketError>>

Broadcasts the packet to the sockets that match the BroadcastOptions.

Source

pub fn broadcast_with_ack( &self, packet: Packet, opts: BroadcastOptions, timeout: Option<Duration>, ) -> (E::AckStream, u32)

Broadcasts the packet to the sockets that match the BroadcastOptions and return a stream of ack responses. Also returns the number of local expected aknowledgements to know when to stop waiting.

Source

pub fn sockets(&self, opts: BroadcastOptions) -> Vec<Sid>

Returns the sockets ids that match the BroadcastOptions.

Source

pub fn fetch_sockets(&self, opts: BroadcastOptions) -> Vec<RemoteSocketData>

Returns the sockets ids that match the BroadcastOptions.

Source

pub fn socket_rooms(&self, sid: Sid) -> HashSet<Room>

Returns the rooms of the socket.

Source

pub fn add_sockets(&self, opts: BroadcastOptions, rooms: impl RoomParam)

Adds the sockets that match the BroadcastOptions to the rooms.

Source

pub fn del_sockets(&self, opts: BroadcastOptions, rooms: impl RoomParam)

Removes the sockets that match the BroadcastOptions from the rooms.

Source

pub fn disconnect_socket( &self, opts: BroadcastOptions, ) -> Result<(), Vec<SocketError>>

Disconnects the sockets that match the BroadcastOptions.

Source

pub fn rooms(&self, opts: BroadcastOptions) -> HashSet<Room>

Returns all the matching rooms

Source

pub fn path(&self) -> &Str

Get the namespace path.

Source

pub fn parser(&self) -> impl Parse + '_

Get the parser of the namespace.

Source

pub fn server_id(&self) -> Uid

Get the unique server identifier

Auto Trait Implementations§

§

impl<E> !Freeze for CoreLocalAdapter<E>

§

impl<E> RefUnwindSafe for CoreLocalAdapter<E>
where E: RefUnwindSafe,

§

impl<E> Send for CoreLocalAdapter<E>
where E: Send,

§

impl<E> Sync for CoreLocalAdapter<E>
where E: Sync,

§

impl<E> Unpin for CoreLocalAdapter<E>
where E: Unpin,

§

impl<E> UnwindSafe for CoreLocalAdapter<E>
where E: UnwindSafe,

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