Enum Role Copy item path Source pub enum Role {
User,
Assistant,
System,
Developer,
InterruptedAssistant,
Unrecognized(String ),
}Expand description Who authored a message in a transcript.
Unrecognized is deliberately part of the type: it is what lets a
transcript written by a future build round-trip through this one. It
carries no trust and grants no placement of its own — see the wire
adapters’ placement table for what each dialect does with it.
Input authored by the human operator or by the harness on their behalf.
Output authored by the model.
Harness-authored context injected into the transcript body — compaction
summaries, branch summaries, sub-agent framing.
Provider-supported instruction content embedded at a transcript
position. Unlike the top-level system prompt, this role is load-bearing
history and must retain its position on wires that support it.
Assistant text that was visible before the turn was interrupted. Kept
distinct from Role::Assistant so replay can mark it as incomplete.
A role string this build does not know. Preserved verbatim so loading
and re-saving a transcript is lossless.
The exact wire/persisted string for this role.
This is the serialization; do not let it drift from Serialize .
True for roles the model itself authored, interrupted output included.
Performs copy-assignment from
source.
Read more Formats the value using the given formatter.
Read more Deserialize this value from the given Serde deserializer.
Read more Formats the value using the given formatter.
Read more Converts to this type from the input type.
Converts to this type from the input type.
Serialize this value into the given Serde serializer.
Read more Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more 🔬 This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From <T> for U chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more Uses borrowed data to replace owned data, usually by cloning.
Read more Converts the given value to a
String.
Read more The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.