pub struct TurnId {
pub owner: String,
pub number: i64,
}Expand description
Identifies a turn in the conversation (e.g., “u1”, “a1”, “u2”, “a2”)
Fields§
§owner: StringOwner of the turn: “u” for user, “a” for assistant
number: i64Turn number
Implementations§
Source§impl TurnId
impl TurnId
Sourcepub fn new_user_turn(n: i64) -> TurnId
pub fn new_user_turn(n: i64) -> TurnId
Creates a new user turn with the given number
Sourcepub fn new_assistant_turn(n: i64) -> TurnId
pub fn new_assistant_turn(n: i64) -> TurnId
Creates a new assistant turn with the given number
Sourcepub fn parse(s: &str) -> Result<TurnId, String>
pub fn parse(s: &str) -> Result<TurnId, String>
Parses a turn ID from a string (e.g., “u1”, “a5”)
Sourcepub fn next_user_turn(&self) -> TurnId
pub fn next_user_turn(&self) -> TurnId
Returns the next user turn (increments number)
Sourcepub fn next_assistant_turn(&self) -> TurnId
pub fn next_assistant_turn(&self) -> TurnId
Returns the next assistant turn (same number as current)
Sourcepub fn is_user_turn(&self) -> bool
pub fn is_user_turn(&self) -> bool
Returns true if this is a user turn
Sourcepub fn is_assistant_turn(&self) -> bool
pub fn is_assistant_turn(&self) -> bool
Returns true if this is an assistant turn
Trait Implementations§
impl Eq for TurnId
impl StructuralPartialEq for TurnId
Auto Trait Implementations§
impl Freeze for TurnId
impl RefUnwindSafe for TurnId
impl Send for TurnId
impl Sync for TurnId
impl Unpin for TurnId
impl UnwindSafe for TurnId
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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 moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more