pub enum Packet {
Audio(AudioFrame),
Text(Arc<str>),
Transcription(Arc<TranscriptionData>),
Custom(Arc<CustomPacketData>),
Binary {
data: Bytes,
content_type: Option<Cow<'static, str>>,
metadata: Option<PacketMetadata>,
},
}Expand description
A generic container for any type of data that can flow through a pipeline.
Variants§
Audio(AudioFrame)
Text(Arc<str>)
Text payload (Arc-backed to make fan-out cloning cheap).
Transcription(Arc<TranscriptionData>)
Transcription payload (Arc-backed to make fan-out cloning cheap).
Custom(Arc<CustomPacketData>)
Extensible structured payload (Arc-backed to make fan-out cloning cheap).
Binary
Binary data with optional content-type and timing metadata for proper handling of different binary formats (e.g., “audio/ogg”, “application/octet-stream”).
The content_type uses Cow<'static, str> to avoid heap allocations when using
static string literals (e.g., Cow::Borrowed("audio/ogg")), while still supporting
dynamic content types when needed.
Trait Implementations§
Source§impl Serialize for Packet
impl Serialize for Packet
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl !Freeze for Packet
impl RefUnwindSafe for Packet
impl Send for Packet
impl Sync for Packet
impl Unpin for Packet
impl UnwindSafe for Packet
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