Skip to main content

ToJsonValue

Trait ToJsonValue 

Source
pub trait ToJsonValue<V>
where V: JsonValue,
{ // Required method fn to_json_value(&self) -> V; }
Available on crate feature expandable only.
Expand description

Convert a leaf field value to the chosen JsonValue backend.

Generated code calls this for fields that should land in a {"@value": ...} object (i.e. anything not marked nested / coerce / container).

Required Methods§

Source

fn to_json_value(&self) -> V

Converts this value into the chosen JSON backend V.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<V, K, T, S> ToJsonValue<V> for HashMap<K, T, S>
where V: JsonValue, K: AsRef<str>, T: ToJsonValue<V>,

Source§

fn to_json_value(&self) -> V

Source§

impl<V, K, T> ToJsonValue<V> for BTreeMap<K, T>
where V: JsonValue, K: AsRef<str>, T: ToJsonValue<V>,

Source§

fn to_json_value(&self) -> V

Source§

impl<V, T> ToJsonValue<V> for &T
where V: JsonValue, T: ToJsonValue<V> + ?Sized,

Source§

fn to_json_value(&self) -> V

Source§

impl<V, T> ToJsonValue<V> for Option<T>
where V: JsonValue, T: ToJsonValue<V>,

Source§

fn to_json_value(&self) -> V

Source§

impl<V, T> ToJsonValue<V> for Vec<T>
where V: JsonValue, T: ToJsonValue<V>,

Source§

fn to_json_value(&self) -> V

Source§

impl<V, T> ToJsonValue<V> for [T]
where V: JsonValue, T: ToJsonValue<V>,

Source§

fn to_json_value(&self) -> V

Source§

impl<V, Tz> ToJsonValue<V> for DateTime<Tz>
where V: JsonValue, Tz: TimeZone, <Tz as TimeZone>::Offset: Display,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for NaiveDate
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for NaiveDateTime
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for NaiveTime
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for String
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for Value
where V: JsonValue,

Recursively translate a serde_json::Value into the chosen JsonValue backend. Lets fields whose type is serde_json::Value participate in generic expansion without forcing the backend to be serde_json.

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for bool
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for f32
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for f64
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for i8
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for i16
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for i32
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for i64
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for isize
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for str
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for u8
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for u16
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for u32
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for u64
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Source§

impl<V> ToJsonValue<V> for usize
where V: JsonValue,

Source§

fn to_json_value(&self) -> V

Implementors§