pub trait TypedMiddleware<Role, Phase, Message, State> {
type Error;
// Required method
async fn intercept_typed(
&mut self,
state: &mut State,
message: Message,
) -> Result<Message, Self::Error>;
}Expand description
Async middleware whose role, protocol phase, and legal message set are type indexed.
Message should be a phase-specific message type generated by
pg_proto_fsm::protocol. Such values can only be obtained after a decoded
wire message has been projected into a legal transition for Phase, so an
implementation cannot return a replacement from another role or phase.
Required Associated Types§
Required Methods§
Sourceasync fn intercept_typed(
&mut self,
state: &mut State,
message: Message,
) -> Result<Message, Self::Error>
async fn intercept_typed( &mut self, state: &mut State, message: Message, ) -> Result<Message, Self::Error>
Observes, mutates, or replaces one phase-legal message and may await while borrowing both the handler and caller-defined state.
§Errors
Returns a policy-defined error to stop message processing.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".