[][src]Trait maybe_serde::MaybeSer

pub trait MaybeSer {
    const IMPL_SERIALIZE: bool;

    fn maybe_serialize<S>(
        &self,
        serializer: S
    ) -> Option<Result<S::Ok, S::Error>>
    where
        S: Serializer
; }

Maybe implement Serialize

This trait is impl for all types

If type implement Serialize then maybe_serialize return Serialize::serialize value with Some

Otherwise if type doesn't implement Serialize then maybe_serialize return just None

Associated Constants

const IMPL_SERIALIZE: bool

true if implement serde::Serialize

Loading content...

Required methods

fn maybe_serialize<S>(&self, serializer: S) -> Option<Result<S::Ok, S::Error>> where
    S: Serializer

Loading content...

Implementors

impl<T> MaybeSer for T[src]

Always return None

const IMPL_SERIALIZE: bool[src]

Always return false

impl<T> MaybeSer for T where
    T: Serialize
[src]

Always return Some

const IMPL_SERIALIZE: bool[src]

Always return true

Loading content...