sprs icon indicating copy to clipboard operation
sprs copied to clipboard

Why does `outer_view` return `Option` instead of `Result`?

Open roek-pnnl opened this issue 1 year ago • 1 comments

I'm building an application that uses sprs for sparse matrices, and I've been debating how to handle errors when the user asks for a row or column that is out of bounds. sprs handles this with an option, but I would have expected a Result, for error handling. I'm inclined to use Result in downstream parts of my own application, but if there's a compelling reason why sprs uses Option instead then I might stick to that for consistency with your package! Thank you!

roek-pnnl avatar May 22 '24 21:05 roek-pnnl

Guess this is just an oversight or old API which deserves an upgrade. I would suggest for your crate to create a new error type wrapping the None from sprs (see Option::ok_or_else for a simple way of doing this].

mulimoen avatar May 23 '24 18:05 mulimoen