basic_decode_with_nice_error

Function basic_decode_with_nice_error 

Source
pub fn basic_decode_with_nice_error<T>(buf: &[u8]) -> Result<T, String>
Expand description

Decodes a data structure from a byte array.

If an error occurs, the type’s schema is exported and used to give a better error message.

NOTE:

  • The error path runs very slowly. This should only be used where errors are NOT expected.
  • This should not be used where the size of compiled code is an issue, as it will pull in the schema aggregation code which is large.