use super::BindError;
use crate::identity::encode_bytes;
impl BindError {
#[must_use]
pub fn canonical_bytes(&self) -> Vec<u8> {
let (bound, carried): (&[u8; 32], &[u8; 32]) = match self {
Self::ClosureProvedAgainstAnotherPlan { planned, proved } => {
(planned.as_bytes(), proved.as_bytes())
}
Self::ExplanationAnsweredOverAnotherPlan { planned, answered } => {
(planned.as_bytes(), answered.as_bytes())
}
Self::ExplanationAnsweredOverAnotherClosure { proved, answered } => {
(proved.as_bytes(), answered.as_bytes())
}
};
let mut material = vec![self.slot()];
encode_bytes(bound, &mut material);
encode_bytes(carried, &mut material);
material
}
}