validit
Validate variable internal state when the variable is accessed.
- Implement trait
Validatefor a typeTto define how to validate internal state ofT. - Wrapper struct
Valid<T: Validate>implementsDerefandDerefMuttraits, and validates the internal state when the variable is accessed.
For example, If in your program you have a struct Foo(u64) and you want to make sure
that a is always less than to 5, you can implement Validate trait for Foo and use
less! macro to validate a.
;
Contribution
- 🙌 Questions? Join the Discord channel or start a discussion.