MqttServer

Struct MqttServer 

Source
pub struct MqttServer<St, C, Cn, M = Identity> { /* private fields */ }
Expand description

Mqtt Server

Implementations§

Source§

impl<St, C> MqttServer<St, C, DefaultControlService<St, C::Error>, InFlightService>
where C: ServiceFactory<Handshake, SharedCfg, Response = HandshakeAck<St>>, C::Error: Debug,

Source

pub fn new<F>(handshake: F) -> Self

Create server factory and provide handshake service

Source§

impl<St, C, Cn, M> MqttServer<St, C, Cn, M>
where St: 'static, C: ServiceFactory<Handshake, SharedCfg, Response = HandshakeAck<St>> + 'static, C::Error: Debug, Cn: ServiceFactory<Control<C::Error>, Session<St>, Response = ControlAck> + 'static,

Source

pub fn reset_middlewares(self) -> MqttServer<St, C, Cn, Identity>

Remove all middlewares

Source

pub fn middleware<U>(self, mw: U) -> MqttServer<St, C, Cn, Stack<M, U>>

Registers middleware, in the form of a middleware component (type), that runs during inbound and/or outbound processing in the request lifecycle (request -> response), modifying request/response as necessary, across all requests managed by the Server.

Use middleware when you need to read or modify every request or response in some way.

Source

pub fn control<F, Srv>(self, service: F) -> MqttServer<St, C, Srv, M>
where F: IntoServiceFactory<Srv, Control<C::Error>, Session<St>>, Srv: ServiceFactory<Control<C::Error>, Session<St>, Response = ControlAck> + 'static, C::Error: From<Srv::Error> + From<Srv::InitError>,

Service to handle control packets

All control packets are processed sequentially, max number of buffered control packets is 16.

Source

pub fn publish<F, Srv>( self, publish: F, ) -> MqttServer<Session<St>, impl ServiceFactory<IoBoxed, SharedCfg, Response = (IoBoxed, Rc<MqttShared>, Session<St>, Seconds), Error = MqttError<C::Error>, InitError = C::InitError>, impl ServiceFactory<DispatchItem<Rc<MqttShared>>, (SharedCfg, Session<St>), Response = Option<Encoded>, Error = MqttError<C::Error>, InitError = MqttError<C::Error>>, M, Rc<MqttShared>>
where F: IntoServiceFactory<Srv, Publish, Session<St>>, C::Error: From<Cn::Error> + From<Cn::InitError> + From<Srv::Error> + From<Srv::InitError>, Srv: ServiceFactory<Publish, Session<St>, Response = PublishAck> + 'static, Srv::Error: Debug, PublishAck: TryFrom<Srv::Error, Error = C::Error>,

Set service to handle publish packets and create mqtt server factory and create mqtt server factory

Auto Trait Implementations§

§

impl<St, C, Cn, M> Freeze for MqttServer<St, C, Cn, M>
where C: Freeze, Cn: Freeze, M: Freeze,

§

impl<St, C, Cn, M = Identity> !RefUnwindSafe for MqttServer<St, C, Cn, M>

§

impl<St, C, Cn, M = Identity> !Send for MqttServer<St, C, Cn, M>

§

impl<St, C, Cn, M = Identity> !Sync for MqttServer<St, C, Cn, M>

§

impl<St, C, Cn, M> Unpin for MqttServer<St, C, Cn, M>
where C: Unpin, Cn: Unpin, M: Unpin, St: Unpin,

§

impl<St, C, Cn, M = Identity> !UnwindSafe for MqttServer<St, C, Cn, M>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.