Skip to main content

TurnView

Trait TurnView 

Source
pub trait TurnView:
    Debug
    + Send
    + Sync {
    // Required methods
    fn role(&self) -> TurnRole;
    fn item_count(&self) -> usize;
    fn item_at(&self, index: usize) -> Option<&dyn ItemView>;
    fn as_any(&self) -> &dyn Any;
}
Expand description

Read-only view of a committed turn in the session transcript.

Object-safe: items are accessed by index so no generic iterators are needed.

Required Methods§

Source

fn role(&self) -> TurnRole

Role or category of this turn.

Source

fn item_count(&self) -> usize

Number of items in this turn.

Source

fn item_at(&self, index: usize) -> Option<&dyn ItemView>

Returns a reference to the item at index, or None if out of bounds.

Source

fn as_any(&self) -> &dyn Any

Returns this turn as Any for adapter-specific downcasting.

Implementations§

Source§

impl dyn TurnView

Source

pub fn downcast_ref<T: TurnView + 'static>(&self) -> Option<&T>

Implementors§