Designing Error Types in Rust Libraries

16 points by skeptrune


rjzak

a library consumer will have to depend on sqlx and reqwest crates to use these error variants, even if they never use the database or network functionality directly.

But sqlx and reqwest libraries will be compiled in to the binary, so those dependencies are already present. So what’s the fuss? And such a binary is is a database or network/web app at this point anyway.

schneems

re-exporting these error types

This is one of the biggest pains with the rust crate ecosystem in general. I recently hit an issue with two crates with compatible types that refused to play nice because one was silently “cargo lock”-d to a different sub dependency version https://github.com/rust-lang/cargo/issues/15591.