@@ -143,6 +143,7 @@ While I am not at liberty to share the codebase, the former is equivalent to som
143
143
I see on some of our codebases at work.
144
144
145
145
## tap (pipelines)
146
+ [ guide-level-explanation ] : #tap-pipelines
146
147
147
148
While not the intended use of this proposal, [ tap] ( https://crates.io/crates/tap ) is a popular crate to allow more advanced pipeline operations.
148
149
@@ -251,6 +252,8 @@ make the language more flexible such that match statements aren't a hindrance.
251
252
252
253
## Alternatives
253
254
255
+ ### Postfix Macros
256
+
254
257
[ postfix macros] ( https://github.com/rust-lang/rfcs/pull/2442 ) have been an idea for many years now. If they were to land, this feature
255
258
could easily be implemented as a macro (bikeshedding on postfix macro syntax):
256
259
@@ -269,6 +272,19 @@ macro match_! (
269
272
However, after years of discussion and hundreds of thumbs-ups, it feels like we're
270
273
still not close to agreeing on syntax or behaviour.
271
274
275
+ ### Pipes
276
+
277
+ I've already mentioned [ tap] ( #tap-pipelines ) for how we can do prefix-in-postfix,
278
+ so we could promote the use of ` .pipe ` instead. However, using the pipe method makes
279
+ async awkward and control flow impossible.
280
+
281
+ Alternatively we could have a new builtin pipeline operator
282
+ (e.g. ` |> ` <sup >[ 0] </sup > or ` .let x {} ` ><sup >[ 1] </sup >)
283
+ but this is brand new syntax and requires a whole new set of discussions.
284
+
285
+ [ 0 ] : https://internals.rust-lang.org/t/idea-operator-for-postfix-calls-to-macros-and-free-functions/7634
286
+ [ 1 ] : https://internals.rust-lang.org/t/idea-postfix-let-as-basis-for-postfix-macros/12438
287
+
272
288
# Prior art
273
289
[ prior-art ] : #prior-art
274
290
@@ -293,4 +309,4 @@ usecases of match would cause more [subtle bugs](https://fasterthanli.me/article
293
309
# Future possibilities
294
310
[ future-possibilities ] : #future-possibilities
295
311
296
- Eventually more operators could become postfix, such as ` for_each `
312
+ I can't think of anything related to match that could be improved in this area
0 commit comments