fieldmasker 0.0.1

A utility for selecting and filtering response fields via field masks.
Documentation
//! Schema description and the [`MaskSpec`] trait.
//!
//! The serializer needs a structural **schema** to validate and apply field masks safely.
//! Provide that schema by implementing [`MaskSpec`] for your types, typically via the
//! `derive` feature, or (discouraged) manually using the [`Node`] builder APIs.

mod impls;
mod node;

/// Provides a static schema for a type used by field masking.
///
/// Implementations should return a `'static` reference to a schema [`Node`]. Most users
/// should rely on the `derive` feature to generate this automatically.
///
/// # Contract
/// * The schema must reflect the shape of the serialized form.
/// * The returned reference must live for the duration of the program.
///
/// # See also
/// - [`Node`] for constructing schemas manually.
pub trait MaskSpec {
    /// Returns the static schema node describing `Self`.
    fn mask_spec() -> &'static Node;
}

pub(crate) use node::Kind;
pub use node::Node;