pub struct MqttServer<Io, St, C: ServiceFactory, U> { /* private fields */ }
Expand description
Mqtt Server
Implementations§
Source§impl<Io, St, C> MqttServer<Io, St, C, ()>where
St: 'static,
C: ServiceFactory<Config = (), Request = Connect<Io>, Response = ConnectAck<Io, St>> + 'static,
impl<Io, St, C> MqttServer<Io, St, C, ()>where
St: 'static,
C: ServiceFactory<Config = (), Request = Connect<Io>, Response = ConnectAck<Io, St>> + 'static,
Sourcepub fn new<F>(connect: F) -> MqttServer<Io, St, C, impl Fn(St, bool)>where
F: IntoServiceFactory<C>,
pub fn new<F>(connect: F) -> MqttServer<Io, St, C, impl Fn(St, bool)>where
F: IntoServiceFactory<C>,
Create server factory and provide connect service
Source§impl<Io, St, C, U> MqttServer<Io, St, C, U>where
St: Clone + 'static,
U: Fn(St, bool) + 'static,
C: ServiceFactory<Config = (), Request = Connect<Io>, Response = ConnectAck<Io, St>> + 'static,
impl<Io, St, C, U> MqttServer<Io, St, C, U>where
St: Clone + 'static,
U: Fn(St, bool) + 'static,
C: ServiceFactory<Config = (), Request = Connect<Io>, Response = ConnectAck<Io, St>> + 'static,
Sourcepub fn handshake_timeout(self, timeout: u64) -> Self
pub fn handshake_timeout(self, timeout: u64) -> Self
Set handshake timeout in millis.
Handshake includes connect
packet and response connect-ack
.
By default handshake timeuot is disabled.
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 inflight(self, val: usize) -> Self
pub fn inflight(self, val: usize) -> Self
Number of in-flight concurrent messages.
in-flight is set to 15 messages
Sourcepub fn subscribe<F, Srv>(self, subscribe: F) -> Selfwhere
F: IntoServiceFactory<Srv>,
Srv: ServiceFactory<Config = St, Request = Subscribe<St>, Response = SubscribeResult> + 'static,
C::Error: From<Srv::Error> + From<Srv::InitError>,
pub fn subscribe<F, Srv>(self, subscribe: F) -> Selfwhere
F: IntoServiceFactory<Srv>,
Srv: ServiceFactory<Config = St, Request = Subscribe<St>, Response = SubscribeResult> + 'static,
C::Error: From<Srv::Error> + From<Srv::InitError>,
Service to execute for subscribe packet
Sourcepub fn unsubscribe<F, Srv>(self, unsubscribe: F) -> Selfwhere
F: IntoServiceFactory<Srv>,
Srv: ServiceFactory<Config = St, Request = Unsubscribe<St>, Response = ()> + 'static,
C::Error: From<Srv::Error> + From<Srv::InitError>,
pub fn unsubscribe<F, Srv>(self, unsubscribe: F) -> Selfwhere
F: IntoServiceFactory<Srv>,
Srv: ServiceFactory<Config = St, Request = Unsubscribe<St>, Response = ()> + 'static,
C::Error: From<Srv::Error> + From<Srv::InitError>,
Service to execute for unsubscribe packet
Sourcepub fn disconnect<F, Out>(
self,
disconnect: F,
) -> MqttServer<Io, St, C, impl Fn(St, bool)>
pub fn disconnect<F, Out>( self, disconnect: F, ) -> MqttServer<Io, St, C, impl Fn(St, bool)>
Callback to execute on disconnect
Second parameter indicates error occured during disconnect.
Sourcepub fn finish<F, P>(
self,
publish: F,
) -> impl ServiceFactory<Config = (), Request = Io, Response = (), Error = MqttError<C::Error>>where
Io: AsyncRead + AsyncWrite + 'static,
F: IntoServiceFactory<P>,
P: ServiceFactory<Config = St, Request = Publish<St>, Response = ()> + 'static,
C::Error: From<P::Error> + From<P::InitError>,
pub fn finish<F, P>(
self,
publish: F,
) -> impl ServiceFactory<Config = (), Request = Io, Response = (), Error = MqttError<C::Error>>where
Io: AsyncRead + AsyncWrite + 'static,
F: IntoServiceFactory<P>,
P: ServiceFactory<Config = St, Request = Publish<St>, Response = ()> + 'static,
C::Error: From<P::Error> + From<P::InitError>,
Set service to execute for publish packet and create service factory
Auto Trait Implementations§
impl<Io, St, C, U> Freeze for MqttServer<Io, St, C, U>
impl<Io, St, C, U> !RefUnwindSafe for MqttServer<Io, St, C, U>
impl<Io, St, C, U> !Send for MqttServer<Io, St, C, U>
impl<Io, St, C, U> !Sync for MqttServer<Io, St, C, U>
impl<Io, St, C, U> Unpin for MqttServer<Io, St, C, U>
impl<Io, St, C, U> !UnwindSafe for MqttServer<Io, St, C, U>
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