pub struct Content(/* private fields */);Expand description
Free-form JSON that Jev reads as content: a string, an object, an array, or null.
The API accepts this shape for a request’s state, for a question’s instructions, and for
every criteria value. Field names inside an object (question, focus, examples, …) are
not reserved: the model sees them as labels.
Deserialisation is deliberately permissive. A number or a boolean parses successfully so that offline validation can report it with a useful message instead of a parse error; the generated JSON Schema is the precise contract. Object key order is preserved, so content is sent to the API exactly as it was written.
use jev_client::Content;
let text = Content::from("Help! My payouts have been failing for 3 days.");
assert_eq!(text.as_str(), Some("Help! My payouts have been failing for 3 days."));
let structured = Content::from(serde_json::json!({ "ticket": { "plan": "pro" } }));
assert_eq!(structured.as_str(), None);Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Content
impl<'de> Deserialize<'de> for Content
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 JsonSchema for Content
impl JsonSchema for Content
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(_: &mut SchemaGenerator) -> Schema
fn json_schema(_: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
impl StructuralPartialEq for Content
Auto Trait Implementations§
impl Forget for Content
impl Freeze for Content
impl Move for Content
impl RefUnwindSafe for Content
impl Send for Content
impl Sync for Content
impl Unpin for Content
impl UnsafeUnpin for Content
impl UnwindSafe for Content
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