Struct Server

Source
pub struct Server<Io, St, Cn: ServiceFactory> { /* private fields */ }
Expand description

Server dispatcher factory

Implementations§

Source§

impl<Io, St, Cn> Server<Io, St, Cn>
where St: 'static, Io: AsyncRead + AsyncWrite + 'static, Cn: ServiceFactory<Config = (), Request = Either<Connect<Io>, Sasl<Io>>, Response = ConnectAck<Io, St>> + 'static,

Source

pub fn new<F>(connect: F) -> Self
where F: IntoServiceFactory<Cn>,

Create server factory and provide connect service

Source

pub fn config(self, config: Configuration) -> Self

Provide connection configuration

Source

pub fn max_size(self, size: usize) -> Self

Set max inbound frame size.

If max size is set to 0, size is unlimited. By default max size is set to 0

Source

pub fn handshake_timeout(self, timeout: u64) -> Self

Set handshake timeout in millis.

By default handshake timeuot is disabled.

Source

pub fn control<F, S>(self, f: F) -> Self
where F: IntoServiceFactory<S>, S: ServiceFactory<Config = (), Request = ControlFrame<St>, Response = (), InitError = ()> + 'static, S::Error: Into<LinkError>,

Service to call with control frames

Source

pub fn disconnect<F, Out>(self, disconnect: F) -> Self
where F: Fn(&mut St, Option<&ServerError<Cn::Error>>) -> Out + 'static, Out: Future + 'static,

Callback to execute on disconnect

Second parameter indicates error occured during disconnect.

Source

pub fn finish<F, Pb>( self, service: F, ) -> impl ServiceFactory<Config = (), Request = Io, Response = (), Error = ServerError<Cn::Error>>
where F: IntoServiceFactory<Pb>, Pb: ServiceFactory<Config = State<St>, Request = Link<St>, Response = ()> + 'static, Pb::Error: Display + Into<Error>, Pb::InitError: Display + Into<Error>,

Set service to execute for incoming links and create service factory

Auto Trait Implementations§

§

impl<Io, St, Cn> !Freeze for Server<Io, St, Cn>

§

impl<Io, St, Cn> !RefUnwindSafe for Server<Io, St, Cn>

§

impl<Io, St, Cn> !Send for Server<Io, St, Cn>

§

impl<Io, St, Cn> !Sync for Server<Io, St, Cn>

§

impl<Io, St, Cn> Unpin for Server<Io, St, Cn>
where Cn: Unpin, Io: Unpin, St: Unpin,

§

impl<Io, St, Cn> !UnwindSafe for Server<Io, St, Cn>

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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> ErasedDestructor for T
where T: 'static,