pub struct Selector<Err, InitErr> { /* private fields */ }
Expand description
Mqtt server selector
Selector allows to choose different mqtt server impls depends on connectt packet.
Implementations
sourceimpl<Err, InitErr> Selector<Err, InitErr> where
Err: 'static,
InitErr: 'static,
impl<Err, InitErr> Selector<Err, InitErr> where
Err: 'static,
InitErr: 'static,
sourcepub fn handshake_timeout(self, timeout: Seconds) -> Self
pub fn handshake_timeout(self, timeout: Seconds) -> Self
Set handshake timeout.
Handshake includes connect
packet and response connect-ack
.
By default handshake timeuot is 10 seconds.
sourcepub fn max_size(self, size: u32) -> Self
pub fn max_size(self, size: u32) -> 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 variant<F, R, St, C, Cn, P>(
self,
check: F,
server: MqttServer<St, C, Cn, P>
) -> Self where
F: Fn(&Handshake) -> R + 'static,
R: Future<Output = Result<bool, Err>> + 'static,
St: 'static,
C: ServiceFactory<Handshake, Response = HandshakeAck<St>, Error = Err, InitError = InitErr> + 'static,
Cn: ServiceFactory<ControlMessage<Err>, Session<St>, Response = ControlResult> + 'static,
P: ServiceFactory<Publish, Session<St>, Response = ()> + 'static,
C::Error: From<Cn::Error> + From<Cn::InitError> + From<P::Error> + From<P::InitError> + Debug,
pub fn variant<F, R, St, C, Cn, P>(
self,
check: F,
server: MqttServer<St, C, Cn, P>
) -> Self where
F: Fn(&Handshake) -> R + 'static,
R: Future<Output = Result<bool, Err>> + 'static,
St: 'static,
C: ServiceFactory<Handshake, Response = HandshakeAck<St>, Error = Err, InitError = InitErr> + 'static,
Cn: ServiceFactory<ControlMessage<Err>, Session<St>, Response = ControlResult> + 'static,
P: ServiceFactory<Publish, Session<St>, Response = ()> + 'static,
C::Error: From<Cn::Error> + From<Cn::InitError> + From<P::Error> + From<P::InitError> + Debug,
Add server variant
Trait Implementations
sourceimpl<Err, InitErr> ServiceFactory<(IoBoxed, Deadline), ()> for Selector<Err, InitErr> where
Err: 'static,
InitErr: 'static,
impl<Err, InitErr> ServiceFactory<(IoBoxed, Deadline), ()> for Selector<Err, InitErr> where
Err: 'static,
InitErr: 'static,
type InitError = InitErr
type InitError = InitErr
Errors produced while building a service.
type Service = SelectorService<Err>
type Service = SelectorService<Err>
The Service
value created by this factory
type Future = Pin<Box<dyn Future<Output = Result<Self::Service, Self::InitError>>>>
type Future = Pin<Box<dyn Future<Output = Result<Self::Service, Self::InitError>>>>
The future of the ServiceFactory
instance.
sourcefn new_service(&self, _: ()) -> Self::Future
fn new_service(&self, _: ()) -> Self::Future
Create and return a new service value asynchronously.
fn map<F, Res>(self, f: F) -> MapServiceFactory<Self, F, Req, Res, Cfg> where
F: FnMut(Self::Response) -> Res + Clone,
fn map<F, Res>(self, f: F) -> MapServiceFactory<Self, F, Req, Res, Cfg> where
F: FnMut(Self::Response) -> Res + Clone,
Map this service’s output to a different type, returning a new service of the resulting type. Read more
fn map_err<F, E>(self, f: F) -> MapErrServiceFactory<Self, Req, Cfg, F, E> where
F: Fn(Self::Error) -> E + Clone,
fn map_err<F, E>(self, f: F) -> MapErrServiceFactory<Self, Req, Cfg, F, E> where
F: Fn(Self::Error) -> E + Clone,
Map this service’s error to a different error, returning a new service.
fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, Req, Cfg, F, E> where
F: Fn(Self::InitError) -> E + Clone,
fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, Req, Cfg, F, E> where
F: Fn(Self::InitError) -> E + Clone,
Map this factory’s init error to a different error, returning a new service.
sourceimpl<F, Err, InitErr> ServiceFactory<Io<F>, ()> for Selector<Err, InitErr> where
F: Filter,
Err: 'static,
InitErr: 'static,
impl<F, Err, InitErr> ServiceFactory<Io<F>, ()> for Selector<Err, InitErr> where
F: Filter,
Err: 'static,
InitErr: 'static,
type InitError = InitErr
type InitError = InitErr
Errors produced while building a service.
type Service = SelectorService<Err>
type Service = SelectorService<Err>
The Service
value created by this factory
type Future = Pin<Box<dyn Future<Output = Result<Self::Service, Self::InitError>>>>
type Future = Pin<Box<dyn Future<Output = Result<Self::Service, Self::InitError>>>>
The future of the ServiceFactory
instance.
sourcefn new_service(&self, _: ()) -> Self::Future
fn new_service(&self, _: ()) -> Self::Future
Create and return a new service value asynchronously.
fn map<F, Res>(self, f: F) -> MapServiceFactory<Self, F, Req, Res, Cfg> where
F: FnMut(Self::Response) -> Res + Clone,
fn map<F, Res>(self, f: F) -> MapServiceFactory<Self, F, Req, Res, Cfg> where
F: FnMut(Self::Response) -> Res + Clone,
Map this service’s output to a different type, returning a new service of the resulting type. Read more
fn map_err<F, E>(self, f: F) -> MapErrServiceFactory<Self, Req, Cfg, F, E> where
F: Fn(Self::Error) -> E + Clone,
fn map_err<F, E>(self, f: F) -> MapErrServiceFactory<Self, Req, Cfg, F, E> where
F: Fn(Self::Error) -> E + Clone,
Map this service’s error to a different error, returning a new service.
fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, Req, Cfg, F, E> where
F: Fn(Self::InitError) -> E + Clone,
fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, Req, Cfg, F, E> where
F: Fn(Self::InitError) -> E + Clone,
Map this factory’s init error to a different error, returning a new service.
sourceimpl<Err, InitErr> ServiceFactory<IoBoxed, ()> for Selector<Err, InitErr> where
Err: 'static,
InitErr: 'static,
impl<Err, InitErr> ServiceFactory<IoBoxed, ()> for Selector<Err, InitErr> where
Err: 'static,
InitErr: 'static,
type InitError = InitErr
type InitError = InitErr
Errors produced while building a service.
type Service = SelectorService<Err>
type Service = SelectorService<Err>
The Service
value created by this factory
type Future = Pin<Box<dyn Future<Output = Result<Self::Service, Self::InitError>>>>
type Future = Pin<Box<dyn Future<Output = Result<Self::Service, Self::InitError>>>>
The future of the ServiceFactory
instance.
sourcefn new_service(&self, _: ()) -> Self::Future
fn new_service(&self, _: ()) -> Self::Future
Create and return a new service value asynchronously.
fn map<F, Res>(self, f: F) -> MapServiceFactory<Self, F, Req, Res, Cfg> where
F: FnMut(Self::Response) -> Res + Clone,
fn map<F, Res>(self, f: F) -> MapServiceFactory<Self, F, Req, Res, Cfg> where
F: FnMut(Self::Response) -> Res + Clone,
Map this service’s output to a different type, returning a new service of the resulting type. Read more
fn map_err<F, E>(self, f: F) -> MapErrServiceFactory<Self, Req, Cfg, F, E> where
F: Fn(Self::Error) -> E + Clone,
fn map_err<F, E>(self, f: F) -> MapErrServiceFactory<Self, Req, Cfg, F, E> where
F: Fn(Self::Error) -> E + Clone,
Map this service’s error to a different error, returning a new service.
fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, Req, Cfg, F, E> where
F: Fn(Self::InitError) -> E + Clone,
fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, Req, Cfg, F, E> where
F: Fn(Self::InitError) -> E + Clone,
Map this factory’s init error to a different error, returning a new service.
Auto Trait Implementations
impl<Err, InitErr> !RefUnwindSafe for Selector<Err, InitErr>
impl<Err, InitErr> !Send for Selector<Err, InitErr>
impl<Err, InitErr> !Sync for Selector<Err, InitErr>
impl<Err, InitErr> Unpin for Selector<Err, InitErr> where
Err: Unpin,
InitErr: Unpin,
impl<Err, InitErr> !UnwindSafe for Selector<Err, InitErr>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T, Req, Cfg> IntoServiceFactory<T, Req, Cfg> for T where
T: ServiceFactory<Req, Cfg>,
impl<T, Req, Cfg> IntoServiceFactory<T, Req, Cfg> for T where
T: ServiceFactory<Req, Cfg>,
fn into_factory(self) -> T
fn into_factory(self) -> T
Convert Self
to a ServiceFactory
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more