[][src]Trait seamless::body::ApiBody

pub trait ApiBody {
    pub fn api_body_type() -> ApiBodyType;

    pub fn to_json_vec(&self) -> Vec<u8>
    where
        Self: Serialize
, { ... }
pub fn to_json_value(&self) -> Value
    where
        Self: Serialize
, { ... }
pub fn from_json_slice(bytes: &[u8]) -> Result<Self>
    where
        Self: DeserializeOwned
, { ... }
pub fn from_json_value(value: Value) -> Result<Self>
    where
        Self: DeserializeOwned
, { ... } }

Any type that implements this trait can be described in terms of ApiBodyType, and can potentially also be serialized or deserizlied from JSON.

This type should not be manually implemented in most cases; instead the ApiBody macro should be relied on to ensure that the description and shape of the type are consistent with how it will be serialized.

In some cases however, it is necessary to manually implement this for a type (for example, an external type).

Required methods

pub fn api_body_type() -> ApiBodyType[src]

This returns information about the shape of the type and description of parts of it.

Loading content...

Provided methods

pub fn to_json_vec(&self) -> Vec<u8> where
    Self: Serialize
[src]

Serialize the type to JSON.

pub fn to_json_value(&self) -> Value where
    Self: Serialize
[src]

Serialize the type to a serde_json::Value.

pub fn from_json_slice(bytes: &[u8]) -> Result<Self> where
    Self: DeserializeOwned
[src]

Deserialize from bytes containing a JSON value.

pub fn from_json_value(value: Value) -> Result<Self> where
    Self: DeserializeOwned
[src]

Deserialize from a serde_json::Value.

Loading content...

Implementations on Foreign Types

impl<T: ApiBody> ApiBody for Vec<T>[src]

impl<T: ApiBody> ApiBody for HashMap<String, T>[src]

impl<T: ApiBody> ApiBody for Option<T>[src]

impl ApiBody for i8[src]

impl ApiBody for i16[src]

impl ApiBody for i32[src]

impl ApiBody for i64[src]

impl ApiBody for isize[src]

impl ApiBody for u8[src]

impl ApiBody for u16[src]

impl ApiBody for u32[src]

impl ApiBody for u64[src]

impl ApiBody for usize[src]

impl ApiBody for f32[src]

impl ApiBody for f64[src]

impl ApiBody for AtomicI8[src]

impl ApiBody for AtomicI16[src]

impl ApiBody for AtomicI32[src]

impl ApiBody for AtomicI64[src]

impl ApiBody for AtomicIsize[src]

impl ApiBody for AtomicU8[src]

impl ApiBody for AtomicU16[src]

impl ApiBody for AtomicU32[src]

impl ApiBody for AtomicU64[src]

impl ApiBody for AtomicUsize[src]

impl ApiBody for bool[src]

impl ApiBody for AtomicBool[src]

impl ApiBody for String[src]

impl<'a> ApiBody for &'a str[src]

impl ApiBody for ()[src]

impl<A: ApiBody> ApiBody for (A,)[src]

impl<A: ApiBody, B: ApiBody> ApiBody for (A, B)[src]

impl<A: ApiBody, B: ApiBody, C: ApiBody> ApiBody for (A, B, C)[src]

impl<A: ApiBody, B: ApiBody, C: ApiBody, D: ApiBody> ApiBody for (A, B, C, D)[src]

impl<A: ApiBody, B: ApiBody, C: ApiBody, D: ApiBody, E: ApiBody> ApiBody for (A, B, C, D, E)[src]

impl<A: ApiBody, B: ApiBody, C: ApiBody, D: ApiBody, E: ApiBody, F: ApiBody> ApiBody for (A, B, C, D, E, F)[src]

impl<A: ApiBody, B: ApiBody, C: ApiBody, D: ApiBody, E: ApiBody, F: ApiBody, G: ApiBody> ApiBody for (A, B, C, D, E, F, G)[src]

impl<A: ApiBody, B: ApiBody, C: ApiBody, D: ApiBody, E: ApiBody, F: ApiBody, G: ApiBody, H: ApiBody> ApiBody for (A, B, C, D, E, F, G, H)[src]

impl<A: ApiBody, B: ApiBody, C: ApiBody, D: ApiBody, E: ApiBody, F: ApiBody, G: ApiBody, H: ApiBody, I: ApiBody> ApiBody for (A, B, C, D, E, F, G, H, I)[src]

impl<A: ApiBody, B: ApiBody, C: ApiBody, D: ApiBody, E: ApiBody, F: ApiBody, G: ApiBody, H: ApiBody, I: ApiBody, J: ApiBody> ApiBody for (A, B, C, D, E, F, G, H, I, J)[src]

impl ApiBody for Value[src]

impl ApiBody for Uuid[src]

impl ApiBody for NaiveDateTime[src]

Loading content...

Implementors

impl ApiBody for Binary[src]

impl<T> ApiBody for Json<T> where
    T: ApiBody
[src]

Loading content...