pub enum StreamFormat {
Text,
Json,
StreamJson,
}
Expand description
Output format for Claude CLI responses
Controls how the Claude CLI formats its output, affecting both parsing and the amount of metadata available in responses.
§Examples
use claude_sdk_rs_core::StreamFormat;
// For simple text responses (default)
let format = StreamFormat::Text;
// For structured responses with metadata
let format = StreamFormat::Json;
// For streaming applications with line-delimited JSON
let format = StreamFormat::StreamJson;
Variants§
Text
Plain text output without metadata
This is the default format. Claude CLI returns only the text content of the response, making it simple to use but without access to metadata like costs, session IDs, or token usage.
Json
Structured JSON output with full metadata
Claude CLI returns a complete JSON object containing the response text along with metadata such as:
- Session ID
- Cost information
- Token usage statistics
- Timing information
StreamJson
Line-delimited JSON messages for streaming
Each line contains a separate JSON message, allowing for real-time processing of the response as it’s generated. Useful for implementing streaming interfaces or progress indicators.
Trait Implementations§
Source§impl Clone for StreamFormat
impl Clone for StreamFormat
Source§fn clone(&self) -> StreamFormat
fn clone(&self) -> StreamFormat
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 moreSource§impl Debug for StreamFormat
impl Debug for StreamFormat
Source§impl Default for StreamFormat
impl Default for StreamFormat
Source§fn default() -> StreamFormat
fn default() -> StreamFormat
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for StreamFormat
impl<'de> Deserialize<'de> for StreamFormat
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 PartialEq for StreamFormat
impl PartialEq for StreamFormat
Source§impl Serialize for StreamFormat
impl Serialize for StreamFormat
impl Copy for StreamFormat
impl StructuralPartialEq for StreamFormat
Auto Trait Implementations§
impl Freeze for StreamFormat
impl RefUnwindSafe for StreamFormat
impl Send for StreamFormat
impl Sync for StreamFormat
impl Unpin for StreamFormat
impl UnwindSafe for StreamFormat
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,
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 more