Skip to main content

ItemView

Trait ItemView 

Source
pub trait ItemView {
    // Required methods
    fn as_text(&self) -> Option<&str>;
    fn as_reasoning(&self) -> Option<&str>;
    fn as_refusal(&self) -> Option<&str>;
    fn as_tool_call(&self) -> Option<ToolCallItemView<'_>>;
    fn as_tool_result(&self) -> Option<ToolResultItemView<'_>>;
}
Expand description

Read-only view of a single item within a committed turn.

Implementations should return Some for exactly one accessor that matches the item’s kind, and None for all others.

Required Methods§

Source

fn as_text(&self) -> Option<&str>

Returns the text content of this item, if it is a text item.

Source

fn as_reasoning(&self) -> Option<&str>

Returns reasoning text, if this is a reasoning item.

Source

fn as_refusal(&self) -> Option<&str>

Returns refusal text, if this is a refusal item.

Source

fn as_tool_call(&self) -> Option<ToolCallItemView<'_>>

Returns tool-call details, if this is a tool-call item.

Source

fn as_tool_result(&self) -> Option<ToolResultItemView<'_>>

Returns tool-result details, if this is a tool-result item.

Implementors§