pub struct TranscriptFile {
pub meta: TranscriptMeta,
pub messages: Vec<Message>,
}Fields§
§meta: TranscriptMeta§messages: Vec<Message>Implementations§
Source§impl TranscriptFile
impl TranscriptFile
pub fn new(messages: Vec<Message>, steps: usize, model: Option<String>) -> Self
Sourcepub fn to_json(&self) -> Result<String, Error>
pub fn to_json(&self) -> Result<String, Error>
Pretty-printed JSON. Stable enough to be diffed across runs.
pub fn write_to(&self, path: &Path) -> Result<()>
pub fn read_from(path: &Path) -> Result<Self>
Sourcepub fn pretty(&self) -> String
pub fn pretty(&self) -> String
Render the transcript as a human-readable string suitable for piping to a pager.
Sourcepub fn pretty_tail(&self, n: usize) -> String
pub fn pretty_tail(&self, n: usize) -> String
Render the last n messages as a human-readable string.
If n is less than the total, prepends a “skipped” notice.
Sourcepub fn pretty_head(&self, n: usize) -> String
pub fn pretty_head(&self, n: usize) -> String
Render the first n messages as a human-readable string.
If n is less than the total, appends a “skipped” notice.
Sourcepub fn take_first_n(&self, n: usize) -> Option<&[Message]>
pub fn take_first_n(&self, n: usize) -> Option<&[Message]>
Return the first n messages (None if n exceeds the count).
n == 0 returns an empty slice, useful for “start fresh but
preserve nothing” callers.
Trait Implementations§
Source§impl Clone for TranscriptFile
impl Clone for TranscriptFile
Source§fn clone(&self) -> TranscriptFile
fn clone(&self) -> TranscriptFile
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 TranscriptFile
impl Debug for TranscriptFile
Source§impl<'de> Deserialize<'de> for TranscriptFile
impl<'de> Deserialize<'de> for TranscriptFile
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
Auto Trait Implementations§
impl Freeze for TranscriptFile
impl RefUnwindSafe for TranscriptFile
impl Send for TranscriptFile
impl Sync for TranscriptFile
impl Unpin for TranscriptFile
impl UnsafeUnpin for TranscriptFile
impl UnwindSafe for TranscriptFile
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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