[][src]Struct xaynet::services::messages::PetMessageService

pub struct PetMessageService<MessageParser, PreProcessor, StateMachine> { /* fields omitted */ }

A service that processes requests from the beginning to the end.

The processing is divided in three phases:

  1. The raw request (which is just a vector of bytes represented an encrypted message) goes through the MessageParser service, which decrypt the message, validates it, and parses it

  2. The message is passed to the PreProcessor, which depending on the message type performs some additional checks. The PreProcessor may also discard the message

  3. Finally, the message is handled by the StateMachine service.

Implementations

impl<MP, PP, SM> PetMessageService<Service<MP, Traced<MessageParserRequest>, fn(_: &Traced<MessageParserRequest>) -> Span>, Service<PP, Traced<PreProcessorRequest>, fn(_: &Traced<PreProcessorRequest>) -> Span>, Service<SM, Traced<StateMachineRequest>, fn(_: &Traced<StateMachineRequest>) -> Span>> where
    MP: Service<Traced<MessageParserRequest>, Response = MessageParserResponse>,
    PP: Service<Traced<PreProcessorRequest>, Response = PreProcessorResponse>,
    SM: Service<Traced<StateMachineRequest>, Response = StateMachineResponse>, 
[src]

pub fn new(message_parser: MP, pre_processor: PP, state_machine: SM) -> Self[src]

Instantiate a new PetMessageService with the given sub-services

Trait Implementations

impl<MessageParser: Clone, PreProcessor: Clone, StateMachine: Clone> Clone for PetMessageService<MessageParser, PreProcessor, StateMachine>[src]

impl<MP, PP, SM> Service<Traced<MessageParserRequest>> for PetMessageService<MP, PP, SM> where
    MP: Service<Traced<MessageParserRequest>, Response = MessageParserResponse> + Clone + Send + 'static,
    <MP as Service<Traced<MessageParserRequest>>>::Future: Send + 'static,
    <MP as Service<Traced<MessageParserRequest>>>::Error: Into<Box<dyn Error + Sync + Send + 'static>>, 
[src]

type Response = MessageParserResponse

Responses given by the service.

type Error = Box<dyn Error + Send + Sync + 'static>

Errors produced by the service.

type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'static>>

The future response value.

impl<MP, PP, SM> Service<Traced<PreProcessorRequest>> for PetMessageService<MP, PP, SM> where
    PP: Service<Traced<PreProcessorRequest>, Response = PreProcessorResponse> + Clone + Send + 'static,
    <PP as Service<Traced<PreProcessorRequest>>>::Future: Send + 'static,
    <PP as Service<Traced<PreProcessorRequest>>>::Error: Into<Box<dyn Error + Send + Sync + 'static>>, 
[src]

type Response = PreProcessorResponse

Responses given by the service.

type Error = Box<dyn Error + Send + Sync + 'static>

Errors produced by the service.

type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'static>>

The future response value.

impl<MP, PP, SM> Service<Traced<StateMachineRequest>> for PetMessageService<MP, PP, SM> where
    SM: Service<Traced<StateMachineRequest>, Response = StateMachineResponse> + Clone + Send + 'static,
    <SM as Service<Traced<StateMachineRequest>>>::Future: Send + 'static,
    <SM as Service<Traced<StateMachineRequest>>>::Error: Into<Box<dyn Error + Send + Sync + 'static>>, 
[src]

type Response = StateMachineResponse

Responses given by the service.

type Error = Box<dyn Error + Send + Sync + 'static>

Errors produced by the service.

type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'static>>

The future response value.

Auto Trait Implementations

impl<MessageParser, PreProcessor, StateMachine> RefUnwindSafe for PetMessageService<MessageParser, PreProcessor, StateMachine> where
    MessageParser: RefUnwindSafe,
    PreProcessor: RefUnwindSafe,
    StateMachine: RefUnwindSafe

impl<MessageParser, PreProcessor, StateMachine> Send for PetMessageService<MessageParser, PreProcessor, StateMachine> where
    MessageParser: Send,
    PreProcessor: Send,
    StateMachine: Send

impl<MessageParser, PreProcessor, StateMachine> Sync for PetMessageService<MessageParser, PreProcessor, StateMachine> where
    MessageParser: Sync,
    PreProcessor: Sync,
    StateMachine: Sync

impl<MessageParser, PreProcessor, StateMachine> Unpin for PetMessageService<MessageParser, PreProcessor, StateMachine> where
    MessageParser: Unpin,
    PreProcessor: Unpin,
    StateMachine: Unpin

impl<MessageParser, PreProcessor, StateMachine> UnwindSafe for PetMessageService<MessageParser, PreProcessor, StateMachine> where
    MessageParser: UnwindSafe,
    PreProcessor: UnwindSafe,
    StateMachine: UnwindSafe

Blanket Implementations

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

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

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

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

impl<T> Instrument for T[src]

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

impl<M, T, Target, Request> MakeTransport<Target, Request> for M where
    M: Service<Target, Response = T>,
    T: TryStream + Sink<Request>, 
[src]

type Item = <T as TryStream>::Ok

Items produced by the transport

type Error = <T as TryStream>::Error

Errors produced when receiving from the transport

type SinkError = <T as Sink<Request>>::Error

Errors produced when sending to the transport

type Transport = T

The Sink + Stream implementation created by this factory

type MakeError = <M as Service<Target>>::Error

Errors produced while building a transport.

type Future = <M as Service<Target>>::Future

The future of the Service instance.

impl<T> PetMessageHandler for T where
    T: _PetMessageHandler + Sync
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, Request> ServiceExt<Request> for T where
    T: Service<Request> + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]