-
Notifications
You must be signed in to change notification settings - Fork 86
feat: bump nim-libp2p to v2.0.0 #3929
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
Changes from all commits
5498342
3dfc862
d9592dc
5eed0f2
b76556e
93d4b3c
69e4d95
1f5f4c2
5aebe3d
4038769
0f6e479
96fc569
79716ba
ab19ffc
0767187
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import logos_delivery/waku/compat/option_valueor | ||
| import std/[net, options] | ||
|
|
||
| import results | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| ## Polyfill: `valueOr` / `withValue` templates for `std/options.Option[T]`. | ||
| ## | ||
| ## Previously provided transitively by `libp2p/utility`, removed in | ||
| ## nim-libp2p PR #2162 (commit 8a9943145). logos-delivery uses these | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can avoid having that file by only using
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think swapping Option for Opt everywhere is going to be its own Issue/PR yep
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes good idea thanks. #3955 |
||
| ## templates pervasively on `Option[T]`. | ||
|
|
||
| {.push raises: [].} | ||
|
|
||
| import std/[macros, options] | ||
|
|
||
| template valueOr*[T](self: Option[T], body: untyped): untyped = | ||
| let temp = (self) | ||
| if temp.isSome: | ||
| temp.get() | ||
| else: | ||
| body | ||
|
|
||
| template withValue*[T](self: Option[T], value, body: untyped): untyped = | ||
| let temp = (self) | ||
| if temp.isSome: | ||
| let `value` {.inject.} = temp.get() | ||
| body | ||
|
|
||
| macro withValue*[T](self: Option[T], value, body, elseStmt: untyped): untyped = | ||
| let elseBody = elseStmt[0] | ||
| quote: | ||
| let temp = (`self`) | ||
| if temp.isSome: | ||
| let `value` {.inject.} = temp.get() | ||
| `body` | ||
| else: | ||
| `elseBody` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this line in particular should go for QUIC adoption. Not a big deal, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right; I don't think "libp2p without quic" is a thing that makes much sense, we want it enabled always so I rolled this into the bump.