cbor: allow user to control nesting (#329)
* cbor: allow user to control nesting
- Make the default read/write entrypoints allow infinite nesting.
- Add {read,write}_nested() entrypoints that allow the crate user to
control the depth of nesting that's allowed.
- Along the way, convert the write[_nested] variants to return a
`Result<(), EncoderError>` rather than a bool. This exposes
more failure information (and forces the caller to take notice
of those tailures), and allows use of the ? operator.
* fixup: transmute error
Co-authored-by: kaczmarczyck <43844792+kaczmarczyck@users.noreply.github.com>
This commit is contained in:
@@ -8,7 +8,7 @@ use sk_cbor as cbor;
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
if let Ok(value) = cbor::read(data) {
|
||||
let mut result = Vec::new();
|
||||
assert!(cbor::write(value, &mut result));
|
||||
assert!(cbor::write(value, &mut result).is_ok());
|
||||
assert_eq!(result, data);
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user