leptess
                                
                                
                                
                                    leptess copied to clipboard
                            
                            
                            
                        More idiomatic return values (Option or Result instead of bool)
In LepTess::set_image, bool is used as a return value to indicate success or failure. Booleans are not a good choice for a return value for this use case. Better is Option<()> or Result<(), ()> (I personally think Option<()> is nicer, but Result<(), ()> objectively makes more sense)
As a side-effect of this, the code inside the functions can become much more concise and idiomatic:
https://github.com/kangalioo/leptess/commit/786a7519f904e7a6eafa9be18f8a5f201bff9120
Good idea. I don't know what @houqp's opinion on changing the API is. Leptess hasn't had its 1.0.0 release, so API changes should be ok.
I suppose another alternative would be to return something like this
Result<(), Leptess::Error>
Where Error is an enum with a PixReadError variant
:+1: on this breaking change, If there is extra error context we can pass back to caller, we should use Result, otherwise, Option would be better.