chanced / jsonptr

JSON Pointer (RFC 6901) implementation for Rust
Apache License 2.0
43 stars 4 forks source link

Drop error from `Pointer` #2

Closed chanced closed 1 year ago

chanced commented 1 year ago

Pointer currently has an Option<Box<MalformedPointerError>> field for situations where an error occurs during deserialization. This convolutes the API but does allow for deserialization to succeed even if the pointer is malformed. However, any attempt to use the pointer from that point forward returns an error.

An enum like this could be added to account for possibly malformed data:

pub enum MaybePointer {
    Pointer(Pointer),
    Malformed(String)
}