Enum ServerMessage
pub enum ServerMessage {
SetupComplete(SetupCompleteMessage),
ServerContent(Box<ServerContentMessage>),
ToolCall(ToolCallMessage),
ToolCallCancellation(ToolCallCancellationMessage),
GoAway(GoAwayMessage),
SessionResumptionUpdate(SessionResumptionUpdateMessage),
VoiceActivity(VoiceActivityMessage),
Unknown(Value),
}Expand description
Unified server message enum — parsed from incoming WebSocket text frames.
We use manual dispatch instead of #[serde(untagged)] for performance:
untagged tries every variant in order. String-contains + targeted parse
is O(1) routing.
Variants§
SetupComplete(SetupCompleteMessage)
Setup handshake completed successfully.
ServerContent(Box<ServerContentMessage>)
Model output content (text, audio, transcription, etc.).
ToolCall(ToolCallMessage)
Model requested one or more tool/function calls.
ToolCallCancellation(ToolCallCancellationMessage)
Server cancelled previously requested tool calls.
GoAway(GoAwayMessage)
Server requesting graceful disconnect.
SessionResumptionUpdate(SessionResumptionUpdateMessage)
Updated session resumption handle.
VoiceActivity(VoiceActivityMessage)
Server-side voice activity detection event.
Unknown(Value)
Unrecognized message type (forward compatibility).
Implementations§
§impl ServerMessage
impl ServerMessage
pub fn parse(text: &str) -> Result<ServerMessage, Error>
pub fn parse(text: &str) -> Result<ServerMessage, Error>
Parse a server message from a JSON text frame.
Uses string-contains routing for O(1) dispatch instead of serde(untagged)’s O(N) try-all-variants approach.
Trait Implementations§
§impl Clone for ServerMessage
impl Clone for ServerMessage
§fn clone(&self) -> ServerMessage
fn clone(&self) -> ServerMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ServerMessage
impl RefUnwindSafe for ServerMessage
impl Send for ServerMessage
impl Sync for ServerMessage
impl Unpin for ServerMessage
impl UnwindSafe for ServerMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more