Skip to main content

ProtocolHandler

Trait ProtocolHandler 

Source
pub trait ProtocolHandler: Send + Sync {
    // Required methods
    fn parse_request(&self, buf: &[u8]) -> Option<String>;
    fn parse_response(&self, buf: &[u8]) -> Option<String>;

    // Provided methods
    fn extract_full_command(&self, buf: &[u8]) -> Option<String> { ... }
    fn format_response_detail(&self, buf: &[u8]) -> Option<String> { ... }
    fn to_replay_command(&self, ev: &ProxyEvent) -> String { ... }
    fn needs_request_buffering(&self) -> bool { ... }
    fn needs_response_buffering(&self) -> bool { ... }
    fn request_complete(&self, _buf: &[u8]) -> bool { ... }
    fn response_complete(&self, _buf: &[u8]) -> bool { ... }
    fn is_frame_based(&self) -> bool { ... }
}
Expand description

Trait that each protocol implements for parsing and display.

Required Methods§

Source

fn parse_request(&self, buf: &[u8]) -> Option<String>

Parse request bytes → summary for event list

Source

fn parse_response(&self, buf: &[u8]) -> Option<String>

Parse response bytes → short summary

Provided Methods§

Source

fn extract_full_command(&self, buf: &[u8]) -> Option<String>

Extract full command from request (for Detail panel, copy, edit)

Source

fn format_response_detail(&self, buf: &[u8]) -> Option<String>

Format response detail (for Detail panel)

Source

fn to_replay_command(&self, ev: &ProxyEvent) -> String

Generate a replayable command string (for yank/copy)

Source

fn needs_request_buffering(&self) -> bool

Does this protocol need request buffering across reads?

Source

fn needs_response_buffering(&self) -> bool

Does this protocol need response buffering across reads?

Source

fn request_complete(&self, _buf: &[u8]) -> bool

Is the request buffer complete?

Source

fn response_complete(&self, _buf: &[u8]) -> bool

Is the response buffer complete?

Source

fn is_frame_based(&self) -> bool

Is this a frame-based protocol with custom proxy logic? (AMQP)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§