indy-data-types 0.7.1

Common data types for Hyperledger Indy (https://www.hyperledger.org/projects), which provides a distributed-ledger-based foundation for self-sovereign identity (https://sovrin.org).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::error::ValidationError;

/// Macro to return a new `ValidationError` with an optional message
#[macro_export]
macro_rules! invalid {
    () => { $crate::ValidationError::from(None) };
    ($($arg:tt)+) => {
        $crate::ValidationError::from(format!($($arg)+))
    };
}

/// Trait for data types which need validation after being loaded from external sources
pub trait Validatable {
    fn validate(&self) -> Result<(), ValidationError> {
        Ok(())
    }
}