pub enum MessageStreamEvent {
MessageStartEvent(MessageStartEvent),
ContentBlockStartEvent(ContentBlockStartEvent),
ContentBlockDeltaEvent(ContentBlockDeltaEvent),
ContentBlockStopEvent(ContentBlockStopEvent),
MessageDeltaEvent(MessageDeltaEvent),
MessageStopEvent(MessageStopEvent),
PingEvent(PingEvent),
ErrorEvent(ErrorEvent),
}Expand description
Anthropic SSE 流的单个事件载荷(去掉 SSE 框架后的 JSON)。所有
变体共享 type 字段做 discriminator。客户端必须能容忍未知
type(按 versioning policy,未来会新增)。
Variants§
MessageStartEvent(MessageStartEvent)
ContentBlockStartEvent(ContentBlockStartEvent)
ContentBlockDeltaEvent(ContentBlockDeltaEvent)
ContentBlockStopEvent(ContentBlockStopEvent)
MessageDeltaEvent(MessageDeltaEvent)
MessageStopEvent(MessageStopEvent)
PingEvent(PingEvent)
ErrorEvent(ErrorEvent)
Trait Implementations§
Source§impl Clone for MessageStreamEvent
impl Clone for MessageStreamEvent
Source§fn clone(&self) -> MessageStreamEvent
fn clone(&self) -> MessageStreamEvent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MessageStreamEvent
impl Debug for MessageStreamEvent
Source§impl<'de> Deserialize<'de> for MessageStreamEvent
impl<'de> Deserialize<'de> for MessageStreamEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<ContentBlockDeltaEvent> for MessageStreamEvent
impl From<ContentBlockDeltaEvent> for MessageStreamEvent
Source§fn from(value: ContentBlockDeltaEvent) -> Self
fn from(value: ContentBlockDeltaEvent) -> Self
Converts to this type from the input type.
Source§impl From<ContentBlockStartEvent> for MessageStreamEvent
impl From<ContentBlockStartEvent> for MessageStreamEvent
Source§fn from(value: ContentBlockStartEvent) -> Self
fn from(value: ContentBlockStartEvent) -> Self
Converts to this type from the input type.
Source§impl From<ContentBlockStopEvent> for MessageStreamEvent
impl From<ContentBlockStopEvent> for MessageStreamEvent
Source§fn from(value: ContentBlockStopEvent) -> Self
fn from(value: ContentBlockStopEvent) -> Self
Converts to this type from the input type.
Source§impl From<ErrorEvent> for MessageStreamEvent
impl From<ErrorEvent> for MessageStreamEvent
Source§fn from(value: ErrorEvent) -> Self
fn from(value: ErrorEvent) -> Self
Converts to this type from the input type.
Source§impl From<MessageDeltaEvent> for MessageStreamEvent
impl From<MessageDeltaEvent> for MessageStreamEvent
Source§fn from(value: MessageDeltaEvent) -> Self
fn from(value: MessageDeltaEvent) -> Self
Converts to this type from the input type.
Source§impl From<MessageStartEvent> for MessageStreamEvent
impl From<MessageStartEvent> for MessageStreamEvent
Source§fn from(value: MessageStartEvent) -> Self
fn from(value: MessageStartEvent) -> Self
Converts to this type from the input type.
Source§impl From<MessageStopEvent> for MessageStreamEvent
impl From<MessageStopEvent> for MessageStreamEvent
Source§fn from(value: MessageStopEvent) -> Self
fn from(value: MessageStopEvent) -> Self
Converts to this type from the input type.
Source§impl From<PingEvent> for MessageStreamEvent
impl From<PingEvent> for MessageStreamEvent
Source§impl PartialEq for MessageStreamEvent
impl PartialEq for MessageStreamEvent
Source§fn eq(&self, other: &MessageStreamEvent) -> bool
fn eq(&self, other: &MessageStreamEvent) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for MessageStreamEvent
impl Serialize for MessageStreamEvent
impl StructuralPartialEq for MessageStreamEvent
Source§impl TryFrom<MessageStreamEvent> for MessageStopEvent
impl TryFrom<MessageStreamEvent> for MessageStopEvent
Source§impl TryFrom<MessageStreamEvent> for PingEvent
impl TryFrom<MessageStreamEvent> for PingEvent
Source§impl TryFrom<MessageStreamEvent> for ErrorEvent
impl TryFrom<MessageStreamEvent> for ErrorEvent
Auto Trait Implementations§
impl Freeze for MessageStreamEvent
impl RefUnwindSafe for MessageStreamEvent
impl Send for MessageStreamEvent
impl Sync for MessageStreamEvent
impl Unpin for MessageStreamEvent
impl UnsafeUnpin for MessageStreamEvent
impl UnwindSafe for MessageStreamEvent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.