poem_openapi::types

Trait ToJSON

Source
pub trait ToJSON: Type {
    // Required method
    fn to_json(&self) -> Option<Value>;

    // Provided method
    fn to_json_string(&self) -> String { ... }
}
Expand description

Represents a type that can converted to JSON value.

Required Methods§

Source

fn to_json(&self) -> Option<Value>

Convert this value to Value.

Provided Methods§

Source

fn to_json_string(&self) -> String

Convert this value to JSON string.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ToJSON for IpAddr

Source§

impl ToJSON for IpNet

Source§

impl ToJSON for Value

Source§

impl ToJSON for bool

Source§

impl ToJSON for char

Source§

impl ToJSON for f32

Source§

impl ToJSON for f64

Source§

impl ToJSON for i8

Source§

impl ToJSON for i16

Source§

impl ToJSON for i32

Source§

impl ToJSON for i64

Source§

impl ToJSON for u8

Source§

impl ToJSON for u16

Source§

impl ToJSON for u32

Source§

impl ToJSON for u64

Source§

impl ToJSON for usize

Source§

impl ToJSON for String

Source§

impl ToJSON for Ipv4Addr

Source§

impl ToJSON for Ipv6Addr

Source§

impl ToJSON for Duration

Source§

impl ToJSON for ObjectId

Source§

impl ToJSON for DateTime<FixedOffset>

Source§

impl ToJSON for DateTime<Local>

Source§

impl ToJSON for DateTime<Utc>

Source§

impl ToJSON for NaiveDate

Source§

impl ToJSON for NaiveDateTime

Source§

impl ToJSON for NaiveTime

Source§

impl ToJSON for LineString

Source§

impl ToJSON for MultiLineString

Source§

impl ToJSON for MultiPoint

Source§

impl ToJSON for MultiPolygon

Source§

impl ToJSON for Point

Source§

impl ToJSON for Polygon

Source§

impl ToJSON for Uri

Source§

impl ToJSON for Duration

Source§

impl ToJSON for Ipv4Net

Source§

impl ToJSON for Ipv6Net

Source§

impl ToJSON for Struct

Source§

impl ToJSON for Value

Source§

impl ToJSON for Regex

Source§

impl ToJSON for Decimal

Source§

impl ToJSON for Date

Source§

impl ToJSON for OffsetDateTime

Source§

impl ToJSON for PrimitiveDateTime

Source§

impl ToJSON for Time

Source§

impl ToJSON for Url

Source§

impl ToJSON for Uuid

Source§

impl<'a> ToJSON for &'a str

Source§

impl<K, V> ToJSON for BTreeMap<K, V>
where K: ToString + FromStr + Ord + Sync + Send, V: ToJSON,

Source§

impl<K, V, R> ToJSON for HashMap<K, V, R>
where K: ToString + FromStr + Eq + Hash + Sync + Send, V: ToJSON, R: Sync + Send,

Source§

impl<T: ToJSON> ToJSON for &[T]

Source§

impl<T: ToJSON> ToJSON for Option<T>

Source§

impl<T: ToJSON> ToJSON for &T

Source§

impl<T: ToJSON> ToJSON for Box<T>

Source§

impl<T: ToJSON> ToJSON for BTreeSet<T>

Source§

impl<T: ToJSON> ToJSON for Arc<T>

Source§

impl<T: ToJSON> ToJSON for Vec<T>

Source§

impl<T: ToJSON> ToJSON for Json<T>

Source§

impl<T: ToJSON, R: Send + Sync> ToJSON for HashSet<T, R>

Source§

impl<T: ToJSON, const LEN: usize> ToJSON for [T; LEN]

Implementors§