pub enum OutputValue {
Text(String),
Json(Value),
Media(Vec<OutputMedia>),
}Expand description
Parsed final output value.
Variants§
Text(String)
Plain text output.
Json(Value)
Structured JSON output.
Media(Vec<OutputMedia>)
Media/file outputs.
Implementations§
Source§impl OutputValue
impl OutputValue
Sourcepub const fn as_json(&self) -> Option<&Value>
pub const fn as_json(&self) -> Option<&Value>
Return JSON output when this value is structured.
Sourcepub fn parse<T>(&self) -> OutputValidationResult<T>where
T: DeserializeOwned,
pub fn parse<T>(&self) -> OutputValidationResult<T>where
T: DeserializeOwned,
Parse this output value into a Rust type.
§Errors
Returns an error when text is not valid JSON or deserialization fails.
Trait Implementations§
Source§impl Clone for OutputValue
impl Clone for OutputValue
Source§fn clone(&self) -> OutputValue
fn clone(&self) -> OutputValue
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 OutputValue
impl Debug for OutputValue
Source§impl<'de> Deserialize<'de> for OutputValue
impl<'de> Deserialize<'de> for OutputValue
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 Eq for OutputValue
Source§impl PartialEq for OutputValue
impl PartialEq for OutputValue
Source§impl Serialize for OutputValue
impl Serialize for OutputValue
impl StructuralPartialEq for OutputValue
Auto Trait Implementations§
impl Freeze for OutputValue
impl RefUnwindSafe for OutputValue
impl Send for OutputValue
impl Sync for OutputValue
impl Unpin for OutputValue
impl UnsafeUnpin for OutputValue
impl UnwindSafe for OutputValue
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