-
Notifications
You must be signed in to change notification settings - Fork 4
Description
ParseError is a nom error that contains Span, which itself has a borrow on the byte slice used for parsing. This is problematic because you can't return borrowed values from functions, which means a function where you load a file into a buffer, attempt to parse it, and return a ParseError on failure will not compile because the error borrows the buffer that was created inside the function.
Need to think a bit about better error handling here. It's nice returning the Span in development because it contains context about the binary chunk that was being parsed when the failure happened, but it's kinda unnecessary for any consumers of the library to care about that level of granular detail. Perhaps a wrapper error class that pulls some of that data but discards the slice being parsed is the way to go, but will need to do a bit of research.