Open BartMassey opened 1 year ago
I believe this is by design, when a failure occurs Mode::Light
is taken as the fallback mode.
Adding a Result
would over-complicate things in my opinion, as an alternative I would suggest adding an Error
variant to the Mode
enum.
An Error
"mode" means that every match
against mode will need to handle this case. A Result
can be checked for, leaving an actual mode to work with.
If the endpoint uses Result<Mode, Error>
one can get the old behavior by
detect().unwrap_or(Mode::Light)
if desired.
@frewsxcv What do you think? I think I brought this up at some point.
Having it return a Result
seems reasonable to me
Right now if something goes wrong — can't detect mode, error happens during detection attempt —
detect()
returnsMode::Light
. Would be a lot better to provide some version of this that could return aResult
.