rust-libp2p icon indicating copy to clipboard operation
rust-libp2p copied to clipboard

*: Replace implementations of `Display` and `Error` on errors with `thiserror`

Open mxinden opened this issue 4 years ago • 7 comments

I would argue that a generated implementation of Display and Error via thiserror is faster to write and easier to maintain. Thus I advocate for using thiserror for most of not all libp2p error types.

mxinden avatar Feb 11 '22 14:02 mxinden

I got this

demfabris avatar Feb 12 '22 20:02 demfabris

This means adding another error related dependency, that has no no_std support. :/

Ref https://github.com/dtolnay/thiserror/pull/64

dignifiedquire avatar Feb 14 '22 14:02 dignifiedquire

@mxinden thoughts?

demfabris avatar Feb 14 '22 20:02 demfabris

This means adding another error related dependency, that has no no_std support. :/

We already depend on thiserror in most libp2p-xxx crates, e.g. libp2p-swarm and libp2p-core. In addition, in case we ever decide to be no_std compatible, I don't think it is particularly hard to revert this change, in the sense that it would not be particularly interwoven with other functionality.

I don't have much experience with no_std. With the discussions in https://github.com/libp2p/rust-libp2p/issues/627 in mind, I wonder whether this is a goal we can achieve in the first place. @dignifiedquire do you think no_std is a goal worth striving for?

mxinden avatar Feb 16 '22 14:02 mxinden

if we already depend on it, then nvm in regards to this specific instance

dignifiedquire avatar Feb 16 '22 20:02 dignifiedquire

@demfabris still want to tackle this one? :innocent:

mxinden avatar Feb 18 '22 17:02 mxinden

Yep @mxinden 👍🏻

demfabris avatar Feb 19 '22 01:02 demfabris

I'll close this as stale. I don't think it worth having an issue around to track this.

thomaseizinger avatar Sep 12 '23 01:09 thomaseizinger