Struct ntex_mqtt::MqttServer[][src]

pub struct MqttServer<Io, V3, V5, Err, InitErr> { /* fields omitted */ }
Expand description

Mqtt Server

Implementations

impl<Io, Err, InitErr> MqttServer<Io, DefaultProtocolServer<Io, Err, InitErr>, DefaultProtocolServer<Io, Err, InitErr>, Err, InitErr>[src]

pub fn new() -> Self[src]

Create mqtt protocol selector server

impl<Io, V3, V5, Err, InitErr> MqttServer<Io, V3, V5, Err, InitErr>[src]

pub fn handshake_timeout(self, timeout: usize) -> Self[src]

Set handshake timeout in millis.

Handshake includes connect packet. By default handshake timeuot is disabled.

impl<Io, V3, V5, Err, InitErr> MqttServer<Io, V3, V5, Err, InitErr> where
    Io: AsyncRead + AsyncWrite + Unpin + 'static,
    V3: ServiceFactory<Config = (), Request = (Io, State, Option<Pin<Box<Sleep>>>), Response = (), Error = MqttError<Err>, InitError = InitErr>,
    V5: ServiceFactory<Config = (), Request = (Io, State, Option<Pin<Box<Sleep>>>), Response = (), Error = MqttError<Err>, InitError = InitErr>, 
[src]

pub fn v3<St, C, Cn, P>(
    self,
    service: MqttServer<Io, St, C, Cn, P>
) -> MqttServer<Io, impl ServiceFactory<Config = (), Request = (Io, State, Option<Pin<Box<Sleep>>>), Response = (), Error = MqttError<Err>, InitError = InitErr>, V5, Err, InitErr> where
    St: 'static,
    C: ServiceFactory<Config = (), Request = Handshake<Io>, Response = HandshakeAck<Io, St>, Error = Err, InitError = InitErr> + 'static,
    Cn: ServiceFactory<Config = Session<St>, Request = ControlMessage, Response = ControlResult> + 'static,
    P: ServiceFactory<Config = Session<St>, Request = Publish, Response = ()> + 'static,
    C::Error: From<Cn::Error> + From<Cn::InitError> + From<P::Error> + From<P::InitError> + Debug
[src]

Service to handle v3 protocol

pub fn v5<St, C, Cn, P>(
    self,
    service: MqttServer<Io, St, C, Cn, P>
) -> MqttServer<Io, V3, impl ServiceFactory<Config = (), Request = (Io, State, Option<Pin<Box<Sleep>>>), Response = (), Error = MqttError<Err>, InitError = InitErr>, Err, InitErr> where
    St: 'static,
    C: ServiceFactory<Config = (), Request = Handshake<Io>, Response = HandshakeAck<Io, St>, Error = Err, InitError = InitErr> + 'static,
    Cn: ServiceFactory<Config = Session<St>, Request = ControlMessage<C::Error>, Response = ControlResult> + 'static,
    P: ServiceFactory<Config = Session<St>, Request = Publish, Response = PublishAck> + 'static,
    P::Error: Debug,
    C::Error: From<Cn::Error> + From<Cn::InitError> + From<P::Error> + From<P::InitError> + Debug,
    PublishAck: TryFrom<P::Error, Error = C::Error>, 
[src]

Service to handle v5 protocol

Trait Implementations

impl<Io, Err, InitErr> Default for MqttServer<Io, DefaultProtocolServer<Io, Err, InitErr>, DefaultProtocolServer<Io, Err, InitErr>, Err, InitErr>[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

impl<Io, V3, V5, Err, InitErr> ServiceFactory for MqttServer<Io, V3, V5, Err, InitErr> where
    Io: AsyncRead + AsyncWrite + Unpin + 'static,
    V3: ServiceFactory<Config = (), Request = (Io, State, Option<Pin<Box<Sleep>>>), Response = (), Error = MqttError<Err>, InitError = InitErr>,
    V5: ServiceFactory<Config = (), Request = (Io, State, Option<Pin<Box<Sleep>>>), Response = (), Error = MqttError<Err>, InitError = InitErr>,
    V3::Future: 'static,
    V5::Future: 'static, 
[src]

type Config = ()

Service factory configuration

type Request = Io

Requests handled by the service.

type Response = ()

Responses given by the service

type Error = MqttError<Err>

Errors produced by the service

type Service = MqttServerImpl<Io, V3::Service, V5::Service, Err>

The Service value created by this factory

type InitError = InitErr

Errors produced while building a service.

type Future = Pin<Box<dyn Future<Output = Result<MqttServerImpl<Io, V3::Service, V5::Service, Err>, InitErr>>>>

The future of the ServiceFactory instance.

fn new_service(&self, _: ()) -> Self::Future[src]

Create and return a new service value asynchronously.

fn map<F, R>(self, f: F) -> MapServiceFactory<Self, F, R> where
    F: FnMut(Self::Response) -> R + 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, 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, 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<Io, V3, V5, Err, InitErr> RefUnwindSafe for MqttServer<Io, V3, V5, Err, InitErr> where
    Err: RefUnwindSafe,
    InitErr: RefUnwindSafe,
    Io: RefUnwindSafe,
    V3: RefUnwindSafe,
    V5: RefUnwindSafe

impl<Io, V3, V5, Err, InitErr> Send for MqttServer<Io, V3, V5, Err, InitErr> where
    Err: Send,
    InitErr: Send,
    Io: Send,
    V3: Send,
    V5: Send

impl<Io, V3, V5, Err, InitErr> Sync for MqttServer<Io, V3, V5, Err, InitErr> where
    Err: Sync,
    InitErr: Sync,
    Io: Sync,
    V3: Sync,
    V5: Sync

impl<Io, V3, V5, Err, InitErr> Unpin for MqttServer<Io, V3, V5, Err, InitErr> where
    Err: Unpin,
    InitErr: Unpin,
    Io: Unpin,
    V3: Unpin,
    V5: Unpin

impl<Io, V3, V5, Err, InitErr> UnwindSafe for MqttServer<Io, V3, V5, Err, InitErr> where
    Err: UnwindSafe,
    InitErr: UnwindSafe,
    Io: UnwindSafe,
    V3: UnwindSafe,
    V5: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> IntoServiceFactory<T> for T where
    T: ServiceFactory, 

pub fn into_factory(self) -> T

Convert Self to a ServiceFactory

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.