Trait slog::SerdeValue [] [src]

pub trait SerdeValue: Serialize + Value {
    fn as_serde(&self) -> &Serialize;
fn to_sendable(&self) -> Box<SerdeValue + Send + 'static>; fn serialize_fallback(
        _key: Key,
        _serializer: &mut Serializer
    ) -> Result<()> { ... } }

A value that can be serialized via serde

This is useful for implementing nested values, like sequences or structures.

Required Methods

Convert to erased_serialize::Serialize of the underlying value, so slog::Serializers can use it to serialize via serde.

Convert to a boxed value that can be sent across threads

This enables functionality like slog-async and similar.

Provided Methods

Serialize the value in a way that is compatible with slog::Serializers that do not support serde.

The implementation should not call slog::Serialize::serialize on itself, as it will lead to infinite recursion.

Default implementation is provided, but it returns error, so use it only for internal types in systems and libraries where serde is always enabled.