Struct SimpleMux

Source
pub struct SimpleMux<P: IOProtocol> { /* private fields */ }
Expand description

Simple server implementation that creates one AF_INET/SOCK_STREAM socket and uses it to bind/listen at the specified address. It instantiates one epoll to accept new connections and one instance per cpu left to perform I/O.

TODO rename to something more interesting TODO think about how to support request pipelining

Events are handled synchronously TODO explain why useful for RPC or protocols that support request/message pipelining

New connections are load balanced from the connections epoll to the rest in a round-robin fashion.

Implementations§

Source§

impl<P> SimpleMux<P>
where P: IOProtocol,

Source

pub fn new(config: SimpleMuxConfig, protocol: P) -> Result<SimpleMux<P>>

Trait Implementations§

Source§

impl<P> Drop for SimpleMux<P>
where P: IOProtocol,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<P> Handler<EpollEvent> for SimpleMux<P>
where P: IOProtocol,

Source§

fn is_terminated(&self) -> bool

Source§

fn ready(&mut self, _: &EpollEvent)

Source§

impl<P> ServerImpl for SimpleMux<P>
where P: IOProtocol + 'static,

Source§

fn get_loop_ms(&self) -> isize

Source§

fn stop(&mut self)

Source§

fn bind(self, mask: SigSet) -> Result<()>

Auto Trait Implementations§

§

impl<P> Freeze for SimpleMux<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for SimpleMux<P>
where P: RefUnwindSafe,

§

impl<P> Send for SimpleMux<P>

§

impl<P> Sync for SimpleMux<P>
where P: Sync,

§

impl<P> Unpin for SimpleMux<P>
where P: Unpin,

§

impl<P> UnwindSafe for SimpleMux<P>
where P: 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.