Skip to main content

RUMServer

Struct RUMServer 

Source
pub struct RUMServer { /* private fields */ }
Expand description

This is the Server primitive that listens for incoming connections and manages “low-level” messages.

This struct tracks accepting new clients via RUMServer::handle_accept, incoming messages via [RUMServer::handle_receive] and message dispatchs via [RUMServer::handle_send].

All key methods are async and shall be run exclusively in the async context. We provide a set of tools that allow you to interact with this struct from sync code. One such tool is RUMServerHandle.

The [RUMServer::run] method orchestrate a series of steps that allows starting server management. The result is that the server will check for connections and messages autonomously. You want to call this method in a non blocking manner from the sync context, so that the server can handle the transactions in the background

Implementations§

Source§

impl RUMServer

Source

pub async fn new(ip: &str, port: u16) -> RUMResult<RUMServer>

Constructs a server and binds the port on interface denoted by ip. The server management is not started until you invoke [Self::run].

Source

pub async fn handle_accept(listener: SafeListener, clients: RUMNetClients)

Contains basic logic for listening for incoming connections.

Source

pub async fn _handle_accept( listener: &SafeListener, clients: &RUMNetClients, ) -> RUMResult<()>

Source

pub async fn receive( &self, client_id: &RUMString, blocking: bool, ) -> RUMResult<RUMNetMessage>

Source

pub async fn send( &self, client_id: &RUMString, msg: &RUMNetMessage, ) -> RUMResult<()>

Source

pub async fn disconnect(client: &RUMNetClient)

Source

pub async fn get_client(&self, client: &RUMString) -> RUMResult<RUMNetClient>

Source

pub async fn get_client_ids(&self) -> ClientIDList

Return client id list.

Source

pub async fn get_client_id(client: &RUMNetClient) -> RUMString

Source

pub async fn get_clients(&self) -> ClientList

Return list of clients.

Source

pub async fn get_address_info(&self) -> Option<RUMString>

Get the Address:Port info for this socket.

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

Source§

impl<T> Ungil for T
where T: Send,