//! `KindMismatch` — the wiring-time guard error for a wrong-kind edge push (C7).

use crate::scalar::ScalarKind;

/// Returned by [`crate::AnyColumn::push`] when a `Scalar`'s kind does not match
/// the column's kind; the column is left untouched.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct KindMismatch {
    /// The kind the column holds.
    pub expected: ScalarKind,
    /// The kind of the value that was offered.
    pub got: ScalarKind,
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn kind_mismatch_is_a_plain_value() {
        let e = KindMismatch { expected: ScalarKind::I64, got: ScalarKind::F64 };
        assert_eq!(e, KindMismatch { expected: ScalarKind::I64, got: ScalarKind::F64 });
        assert_ne!(e, KindMismatch { expected: ScalarKind::F64, got: ScalarKind::I64 });
    }
}
