-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider relaxing NodeId: Default bound #890
Comments
👋 Thanks for opening this issue! Get help or engage by:
|
I'm afraid removing For your specific scenario, a potential and straightforward solution is to encapsulate struct P2PNodeId(libp2p::PeerId);
impl Default for P2PNodeId {
fn default() -> Self { /* ... */ }
} |
Yes, that's exactly how we're handing it now, it works fine, aside from some additional boilerplate of converting the types back and forth. If there's ever going to be a refactoring/redesign of how you handle |
Glad to hear that the workaround is functioning well for you. Thank you for raising this issue. |
Is your feature request related to a problem? Please describe.
We're currently integrating
libp2p
withopenraft
and having a small issue oflibp2p::PeerId
not implementingDefault
(and conceptually I don't think it should).Describe the solution you'd like
It would be great if you could remove the bound
Describe alternatives you've considered
For now, we're going to use a newtype on top of
libp2p::PeerId
or some intermediary type.Additional context
It seems that the
Default
is being used quite extensively across the codebase. However, I don't think it's actually necessary -Option<T>
should suffice.The text was updated successfully, but these errors were encountered: