Struct ump_ng::Server

source ·
pub struct Server<P, S, R, E>(/* private fields */);
Expand description

Representation of a server object.

Each instantiation of a Server object represents an end-point which will be used to receive messages from connected Client objects.

Implementations§

source§

impl<P, S, R, E> Server<P, S, R, E>
where P: 'static + Send, S: 'static + Send, R: 'static + Send, E: 'static + Send,

source

pub fn wait(&self) -> Result<MsgType<P, S, R, E>, Error<E>>

Block and wait, indefinitely, for an incoming message from a Client.

Returns the message sent by the client and a reply context. The server must call ReplyContext::reply() on the reply context to pass a return value to the client.

source

pub fn try_pop(&self) -> Result<Option<MsgType<P, S, R, E>>, Error<E>>

Take next next message off queue or return None is queue is empty.

source

pub async fn async_wait(&self) -> Result<MsgType<P, S, R, E>, Error<E>>

Same as Server::wait(), but for use in an async context.

source

pub fn was_empty(&self) -> bool

Returns a boolean indicating whether the queue is/was empty. This isn’t really useful unless used in very specific situations. It mostly exists for test cases.

Auto Trait Implementations§

§

impl<P, S, R, E> !RefUnwindSafe for Server<P, S, R, E>

§

impl<P, S, R, E> Send for Server<P, S, R, E>
where E: Send, P: Send, R: Send, S: Send,

§

impl<P, S, R, E> Sync for Server<P, S, R, E>
where E: Send, P: Send, R: Send, S: Send,

§

impl<P, S, R, E> Unpin for Server<P, S, R, E>

§

impl<P, S, R, E> !UnwindSafe for Server<P, S, R, E>

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>,

§

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>,

§

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.