schema_analysis 0.7.0

Analyze the schema of any self describing format
Documentation
#![allow(missing_docs)]

use serde::{Deserialize, Serialize};

use crate::{traits::Aggregate, traits::Coalesce};

use super::{Counter, shared::MinMax};

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct SequenceContext {
    pub count: Counter,
    pub length: MinMax<usize>,
}
impl Aggregate<usize> for SequenceContext {
    fn aggregate(&mut self, value: &usize) {
        self.count.aggregate(value);
        self.length.aggregate(value);
    }
}
impl Coalesce for SequenceContext {
    fn coalesce(&mut self, other: Self) {
        self.count.coalesce(other.count);
        self.length.coalesce(other.length);
    }
}
impl PartialEq for SequenceContext {
    fn eq(&self, other: &Self) -> bool {
        self.count == other.count && self.length == other.length
    }
}