Skip to main content

InboundAdapter

Trait InboundAdapter 

Source
pub trait InboundAdapter:
    Send
    + Sync
    + Debug {
    // Required methods
    fn wire_name(&self) -> &'static str;
    fn parse_request(
        &self,
        raw: &Bytes,
    ) -> Result<CanonicalRequest, InboundParseError>;
    fn render_response(&self, response: &CanonicalResponse) -> Bytes;
    fn render_event(&self, event: &CanonicalEvent, model: &str) -> Option<Bytes>;
    fn render_error(&self, status: StatusCode, message: &str) -> Bytes;

    // Provided methods
    fn render_terminal_event(
        &self,
        event: &CanonicalEvent,
        snapshot: &CanonicalResponse,
        model: &str,
    ) -> Option<Bytes> { ... }
    fn streaming_content_type(&self) -> &'static str { ... }
}

Required Methods§

Source

fn wire_name(&self) -> &'static str

Source

fn parse_request( &self, raw: &Bytes, ) -> Result<CanonicalRequest, InboundParseError>

Source

fn render_response(&self, response: &CanonicalResponse) -> Bytes

Source

fn render_event(&self, event: &CanonicalEvent, model: &str) -> Option<Bytes>

Source

fn render_error(&self, status: StatusCode, message: &str) -> Bytes

Provided Methods§

Source

fn render_terminal_event( &self, event: &CanonicalEvent, snapshot: &CanonicalResponse, model: &str, ) -> Option<Bytes>

Render a terminal streaming event whose wire form must embed fully-accumulated item content — the complete tool-call arguments and the output list — which the per-event CanonicalEvent alone does not carry. Returns None for wires that finalize correctly from per-event deltas (the caller then falls back to InboundAdapter::render_event).

Source

fn streaming_content_type(&self) -> &'static str

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§