Assertions
timkurvers opened this issue · 2 comments
timkurvers commented
Would it be convenient to have some sort of assertion type?
new r.Struct(
version: new r.Assert(uint8, 3, 'Only version 3.x is supported')
)
Or should that be handled in userland for structs using the postProcess
hook?
devongovett commented
If you use versioned structs you'll get an error for unsupported versions.
timkurvers commented
Ah yes, of course! What about verifying a signature?
GIF = new r.Struct(
signature: new r.Assert(new r.String(3), 'GIF')
# ...
)