oh_my_toml 0.1.0

Awesome TOML configuration derive macro
Documentation
//! Deserialize traits

use nonempty::NonEmpty;

use crate::{DeserializeErrors, Error, Key, Value};

/// Types that can be deserialized from a [`toml_edit::Value`]
pub trait DeserializeValue<'de>: Sized {
    /// Error that should be reported
    type Error: Error;

    /// Deserialize this [`toml_edit::Value`] into the type
    ///
    /// # Errors
    ///
    /// When at least 1 error is encountered. [`DeserializeErrors`] *may* contain a value
    /// that has been recovered, even despite the errors
    fn deserialize_value<'k>(
        key: Key<'k>,
        value: Value<'de>,
    ) -> Result<Self, DeserializeErrors<Self, NonEmpty<Self::Error>>>;
}

/// Types that can be deserialized from a [`toml_edit::Table`]
pub trait DeserializeTable<'de>: Sized {
    /// Error that should be reported
    type Error: Error;

    /// Deserialize this [`toml_edit::Table`] into the type
    ///
    /// # Errors
    ///
    /// When at least 1 error is encountered. [`DeserializeErrors`] *may* contain a value
    /// that has been recovered, even despite the errors
    fn deserialize_table(
        table: toml::Spanned<toml::de::DeTable<'de>>,
    ) -> Result<Self, DeserializeErrors<Self, NonEmpty<Self::Error>>>;
}