serde_hooks 0.1.1

Runtime hooks for serde
Documentation
/// Inspect serializer information before serialization begins.
///
/// See [`Hooks::on_start`](crate::ser::Hooks::on_start).
pub struct StartScope {
    is_human_readable: bool,
}

impl StartScope {
    pub(crate) fn new(is_human_readable: bool) -> Self {
        Self { is_human_readable }
    }

    /// Returns `true` if used serializer is expected to produce a human-readable format.
    ///
    /// See [`serde::ser::Serializer::is_human_readable`] for more info.
    pub fn is_format_human_readable(&self) -> bool {
        self.is_human_readable
    }
}