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§
Source§impl ServerMessage
impl ServerMessage
Sourcepub fn parse(text: &str) -> Result<ServerMessage, Error>
pub fn parse(text: &str) -> Result<ServerMessage, Error>
Parse a server message from a JSON text frame.
One serde pass: known messages are discriminated by their single
top-level key; frames with no known key fall back to a raw-value parse
and surface as ServerMessage::Unknown (forward compatibility).
Trait Implementations§
Source§impl Clone for ServerMessage
impl Clone for ServerMessage
Source§fn clone(&self) -> ServerMessage
fn clone(&self) -> ServerMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].