1use serde::{
4 Deserialize,
5 Serialize,
6};
7use snafu::prelude::*;
8use verifiable::types::{
9 VerifiableWithDiffs,
10 VerificationContext,
11};
12
13pub use verifiable;
15
16#[cfg(any(test, feature = "test-helpers"))]
18pub mod example;
19mod macros;
21
22#[derive(Debug, Snafu)]
24#[snafu(display("Local laws validation failed: {reason}"))]
25pub struct LocalLawsError {
26 reason: String,
28}
29
30impl LocalLawsError {
31 pub fn new(reason: impl Into<String>) -> Self {
33 Self {
34 reason: reason.into(),
35 }
36 }
37}
38
39pub trait LocalLaws {
41 type Input<'a>: Serialize + Deserialize<'a>;
43
44 fn validate<'a>(
46 verifiables: &[VerifiableWithDiffs],
47 verification_context: &VerificationContext,
48 input: &Self::Input<'a>,
49 ) -> Result<(), LocalLawsError>;
50}