+1 for #1. In general, I would recommend providing non-async alternative APIs, with the async runtime as an option rather than assumed default. Not all of us drink the kool-aid there. And no, I don't mean just providing a "sync" API that uses "block_on" behind the scenes but still uses tokio...
Also, for async don't mandate tokio, use the "agnostic" crate to abstract it so people can use alternative runtimes.
And yes, don't use anyhow in a library like this. Anyhow is for your internal code, not public libraries/crates. Define a set of error enums, or use thiserror for it if you have to.
Yup, I am planning to use thiserror and error-stack for this in the future updates. But, anyhow provides an insanely easy interface for the person using this library, and keeps their mind off the error handling and rather in managing the domain stuff.
cmrdporcupine|1 year ago
Also, for async don't mandate tokio, use the "agnostic" crate to abstract it so people can use alternative runtimes.
And yes, don't use anyhow in a library like this. Anyhow is for your internal code, not public libraries/crates. Define a set of error enums, or use thiserror for it if you have to.
cat-whisperer|1 year ago
dhon_|1 year ago