[−][src]Struct xaynet::services::messages::PetMessageService
A service that processes requests from the beginning to the end.
The processing is divided in three phases:
-
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 -
The message is passed to the
PreProcessor
, which depending on the message type performs some additional checks. ThePreProcessor
may also discard the message -
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]
MP: Service<Traced<MessageParserRequest>, Response = MessageParserResponse>,
PP: Service<Traced<PreProcessorRequest>, Response = PreProcessorResponse>,
SM: Service<Traced<StateMachineRequest>, Response = StateMachineResponse>,
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]
fn clone(&self) -> PetMessageService<MessageParser, PreProcessor, StateMachine>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[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]
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>>,
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.
fn poll_ready(&mut self, cx: &mut Context) -> Poll<Result<(), Self::Error>>
[src]
fn call(&mut self, req: Traced<MessageParserRequest>) -> Self::Future
[src]
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]
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>>,
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.
fn poll_ready(&mut self, cx: &mut Context) -> Poll<Result<(), Self::Error>>
[src]
fn call(&mut self, req: Traced<PreProcessorRequest>) -> Self::Future
[src]
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]
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>>,
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.
fn poll_ready(&mut self, cx: &mut Context) -> Poll<Result<(), Self::Error>>
[src]
fn call(&mut self, req: Traced<StateMachineRequest>) -> Self::Future
[src]
Auto Trait Implementations
impl<MessageParser, PreProcessor, StateMachine> RefUnwindSafe for PetMessageService<MessageParser, PreProcessor, StateMachine> where
MessageParser: RefUnwindSafe,
PreProcessor: RefUnwindSafe,
StateMachine: RefUnwindSafe,
MessageParser: RefUnwindSafe,
PreProcessor: RefUnwindSafe,
StateMachine: RefUnwindSafe,
impl<MessageParser, PreProcessor, StateMachine> Send for PetMessageService<MessageParser, PreProcessor, StateMachine> where
MessageParser: Send,
PreProcessor: Send,
StateMachine: Send,
MessageParser: Send,
PreProcessor: Send,
StateMachine: Send,
impl<MessageParser, PreProcessor, StateMachine> Sync for PetMessageService<MessageParser, PreProcessor, StateMachine> where
MessageParser: Sync,
PreProcessor: Sync,
StateMachine: Sync,
MessageParser: Sync,
PreProcessor: Sync,
StateMachine: Sync,
impl<MessageParser, PreProcessor, StateMachine> Unpin for PetMessageService<MessageParser, PreProcessor, StateMachine> where
MessageParser: Unpin,
PreProcessor: Unpin,
StateMachine: Unpin,
MessageParser: Unpin,
PreProcessor: Unpin,
StateMachine: Unpin,
impl<MessageParser, PreProcessor, StateMachine> UnwindSafe for PetMessageService<MessageParser, PreProcessor, StateMachine> where
MessageParser: UnwindSafe,
PreProcessor: UnwindSafe,
StateMachine: UnwindSafe,
MessageParser: UnwindSafe,
PreProcessor: UnwindSafe,
StateMachine: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<M, T, Target, Request> MakeTransport<Target, Request> for M where
M: Service<Target, Response = T>,
T: TryStream + Sink<Request>,
[src]
M: Service<Target, Response = T>,
T: TryStream + Sink<Request>,
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.
fn poll_ready(
&mut self,
cx: &mut Context
) -> Poll<Result<(), <M as MakeTransport<Target, Request>>::MakeError>>
[src]
&mut self,
cx: &mut Context
) -> Poll<Result<(), <M as MakeTransport<Target, Request>>::MakeError>>
fn make_transport(
&mut self,
target: Target
) -> <M as MakeTransport<Target, Request>>::Future
[src]
&mut self,
target: Target
) -> <M as MakeTransport<Target, Request>>::Future
impl<T> PetMessageHandler for T where
T: _PetMessageHandler + Sync,
[src]
T: _PetMessageHandler + Sync,
fn handle_message<'life0, 'async_trait>(
&'life0 Self,
Vec<u8>
) -> Pin<Box<dyn Future<Output = Result<(), PetMessageError>> + 'async_trait + Send>> where
'life0: 'async_trait,
T: 'async_trait,
[src]
&'life0 Self,
Vec<u8>
) -> Pin<Box<dyn Future<Output = Result<(), PetMessageError>> + 'async_trait + Send>> where
'life0: 'async_trait,
T: 'async_trait,
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]
T: Service<Request> + ?Sized,
fn ready(&mut self) -> Ready<Self, Request>
[src]
fn ready_and(&mut self) -> ReadyAnd<Self, Request>
[src]
fn ready_oneshot(self) -> ReadyOneshot<Self, Request>
[src]
fn oneshot(self, req: Request) -> Oneshot<Self, Request>
[src]
fn call_all<S>(self, reqs: S) -> CallAll<Self, S> where
S: Stream<Item = Request>,
Self::Error: Into<Box<dyn Error + 'static + Sync + Send>>,
[src]
S: Stream<Item = Request>,
Self::Error: Into<Box<dyn Error + 'static + Sync + Send>>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
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>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
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>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,