pub enum CoercionFlag {
StrippedMarkdown,
FixedTrailingComma,
FixedQuotes,
FuzzyFieldMatch {
expected: String,
found: String,
},
TypeCoercion {
from: String,
to: String,
},
UsedDefaultValue {
field: String,
},
TruncatedJson,
FixedUnquotedKeys,
FixedControlCharacters,
RemovedBom,
}Expand description
Flag indicating a specific coercion/healing operation.
These flags provide full transparency into how a response was modified to make it parseable or conform to expected types.
Variants§
StrippedMarkdown
Stripped markdown code fences
FixedTrailingComma
Fixed trailing comma in JSON
FixedQuotes
Fixed mismatched quotes
FuzzyFieldMatch
Matched field name using fuzzy matching
TypeCoercion
Coerced value from one type to another
UsedDefaultValue
Used default value for missing field
TruncatedJson
Truncated malformed JSON
FixedUnquotedKeys
Fixed unquoted object keys
FixedControlCharacters
Fixed control characters
RemovedBom
Removed BOM (byte order mark)
Implementations§
Source§impl CoercionFlag
impl CoercionFlag
Sourcepub fn description(&self) -> String
pub fn description(&self) -> String
Get a human-readable description of this coercion.
§Example
use simple_agent_type::coercion::CoercionFlag;
let flag = CoercionFlag::StrippedMarkdown;
assert_eq!(flag.description(), "Stripped markdown code fences");
let flag = CoercionFlag::TypeCoercion {
from: "string".to_string(),
to: "number".to_string(),
};
assert!(flag.description().contains("string"));
assert!(flag.description().contains("number"));Trait Implementations§
Source§impl Clone for CoercionFlag
impl Clone for CoercionFlag
Source§fn clone(&self) -> CoercionFlag
fn clone(&self) -> CoercionFlag
Returns a duplicate of the value. Read more
1.0.0 · 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 CoercionFlag
impl Debug for CoercionFlag
Source§impl<'de> Deserialize<'de> for CoercionFlag
impl<'de> Deserialize<'de> for CoercionFlag
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
Source§impl Hash for CoercionFlag
impl Hash for CoercionFlag
Source§impl PartialEq for CoercionFlag
impl PartialEq for CoercionFlag
Source§impl Serialize for CoercionFlag
impl Serialize for CoercionFlag
impl Eq for CoercionFlag
impl StructuralPartialEq for CoercionFlag
Auto Trait Implementations§
impl Freeze for CoercionFlag
impl RefUnwindSafe for CoercionFlag
impl Send for CoercionFlag
impl Sync for CoercionFlag
impl Unpin for CoercionFlag
impl UnwindSafe for CoercionFlag
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