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,
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,
Sourcepub fn new<F>(connect: F) -> Selfwhere
F: IntoServiceFactory<Cn>,
pub fn new<F>(connect: F) -> Selfwhere
F: IntoServiceFactory<Cn>,
Create server factory and provide connect service
Sourcepub fn config(self, config: Configuration) -> Self
pub fn config(self, config: Configuration) -> Self
Provide connection configuration
Sourcepub fn max_size(self, size: usize) -> Self
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
Sourcepub fn handshake_timeout(self, timeout: u64) -> Self
pub fn handshake_timeout(self, timeout: u64) -> Self
Set handshake timeout in millis.
By default handshake timeuot is disabled.
Sourcepub fn control<F, S>(self, f: F) -> Selfwhere
F: IntoServiceFactory<S>,
S: ServiceFactory<Config = (), Request = ControlFrame<St>, Response = (), InitError = ()> + 'static,
S::Error: Into<LinkError>,
pub fn control<F, S>(self, f: F) -> Selfwhere
F: IntoServiceFactory<S>,
S: ServiceFactory<Config = (), Request = ControlFrame<St>, Response = (), InitError = ()> + 'static,
S::Error: Into<LinkError>,
Service to call with control frames
Sourcepub fn disconnect<F, Out>(self, disconnect: F) -> Self
pub fn disconnect<F, Out>(self, disconnect: F) -> Self
Callback to execute on disconnect
Second parameter indicates error occured during disconnect.
Sourcepub fn finish<F, Pb>(
self,
service: F,
) -> impl ServiceFactory<Config = (), Request = Io, Response = (), Error = ServerError<Cn::Error>>
pub fn finish<F, Pb>( self, service: F, ) -> impl ServiceFactory<Config = (), Request = Io, Response = (), Error = ServerError<Cn::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>
impl<Io, St, Cn> !UnwindSafe for Server<Io, St, Cn>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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