Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypedStore should .unwrap() the return value from C::decode #153

Open
rnbguy opened this issue Jan 26, 2024 · 0 comments
Open

TypedStore should .unwrap() the return value from C::decode #153

rnbguy opened this issue Jan 26, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@rnbguy
Copy link
Member

rnbguy commented Jan 26, 2024

The following Options (indicates failure to decode) are subsumed by parent Option from .set/.get ` (indicates unset path in the store)

.map(|prev_val| prev_val.and_then(|v| C::decode(&v)))

.and_then(|v| C::decode(&v))

The C::encode calls are correctly .unwrap-ed in the same file.

C::encode(&value).unwrap().as_ref().to_vec(),

.set(path.to_string().into(), NullCodec::encode(&()).unwrap())

The best solution is to return Result from C::encode and C::decode as outlined in #152 and appropriately handle them in TypedStore - probably return Option<Result<_, _>>.

@rnbguy rnbguy changed the title TypedStore should .unwrap() the result from C::decode TypedStore should .unwrap() the return value from C::decode Jan 26, 2024
@rnbguy rnbguy added the bug Something isn't working label Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant