-
Notifications
You must be signed in to change notification settings - Fork 544
Description
I've been working with/reviewing the AssignedCell
API. And there's one thing that it's a bit annoying.
When you need the value of the Cell
as V, you can call AssignedCell::value
, and that's great.
The problem is that it returns an Option<V>
which then requires to do something like .ok_or_else(ERR_HANDLING)?;
After discussing with @therealyingtong different aproaches, like MaybeUninit
etc.. I suggested one that seemed to be Ok:
Maybe value returning an Error where internally you handle the ok_or_else and so you can unify the error type returned.
Something likeError::CellNotAssigned
.
So that when calling value you either get this or the value directly and match over the err as a user.
After that, the suggested err variant was Error::Synthesis
.
I think that would help in cases where we need to do some extra stuff with the value and we don't want to end up with a bunch of ok_or_else
or unwraps/expects in the code.