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 passthrough_wire(&self) -> Option<WireProtocol> { ... }
fn render_terminal_event(
&self,
event: &CanonicalEvent,
snapshot: &CanonicalResponse,
model: &str,
) -> Option<Bytes> { ... }
fn streaming_content_type(&self) -> &'static str { ... }
}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§
Sourcefn passthrough_wire(&self) -> Option<WireProtocol>
fn passthrough_wire(&self) -> Option<WireProtocol>
A rebuild from CanonicalRequest silently drops beta-gated fields
(context_management, output_config, …) that clients pair with an
anthropic-beta header, so a same-protocol route forwards the original
bytes instead.
Sourcefn render_terminal_event(
&self,
event: &CanonicalEvent,
snapshot: &CanonicalResponse,
model: &str,
) -> Option<Bytes>
fn render_terminal_event( &self, event: &CanonicalEvent, snapshot: &CanonicalResponse, model: &str, ) -> Option<Bytes>
For wires whose terminal frame must embed fully-accumulated content the
per-event CanonicalEvent does not carry; None falls back to
InboundAdapter::render_event.
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".