pub enum Role {
System,
User,
Assistant,
Tool,
}Variants§
Implementations§
Source§impl Role
impl Role
Sourcepub const fn as_wire_str(self) -> &'static str
pub const fn as_wire_str(self) -> &'static str
Canonical wire string. Single source of truth for any code path that talks to an LLM HTTP API or persists messages.
Sourcepub fn from_wire_str(s: &str) -> Option<Self>
pub fn from_wire_str(s: &str) -> Option<Self>
Parse the canonical wire string back into a Role. Returns
None for unknown values — callers must decide whether to error
or default; we deliberately do NOT silently coerce.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Role
impl<'de> Deserialize<'de> for Role
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
impl Copy for Role
impl Eq for Role
impl StructuralPartialEq for Role
Auto Trait Implementations§
impl Freeze for Role
impl RefUnwindSafe for Role
impl Send for Role
impl Sync for Role
impl Unpin for Role
impl UnsafeUnpin for Role
impl UnwindSafe for Role
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