Skip to content

Commit 2ec9f6a

Browse files
NanamiNakanoVeykril
authored andcommitted
Rename ${length()} to ${len()}
1 parent 1ea26ad commit 2ec9f6a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/decl-macros/macros-methodical.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ The following expressions are available with `ident` being the name of a bound m
257257
- `${count(ident, depth)}`: The number of times `$ident` repeats in the repetition at `depth`.
258258
- `${index()}`: The current repetition index of the inner-most repetition. This is equivalent to `${index(0)}`.
259259
- `${index(depth)}`: The current index of the repetition at `depth`, counting outwards.
260-
- `${length()}`: The number of times the inner-most repetition will repeat for. This is equivalent to `${length(0)}`.
261-
- `${length(depth)}`: The number of times the repetition at `depth` will repeat for, counting outwards.
260+
- `${len()}`: The number of times the inner-most repetition will repeat for. This is equivalent to `${len(0)}`.
261+
- `${len(depth)}`: The number of times the repetition at `depth` will repeat for, counting outwards.
262262
- `${ignore(ident)}`: Binds `$ident` for repetition, while expanding to nothing.
263263
- `$$`: Expands to a single `$`, effectively escaping the `$` token so it won't be transcribed.
264264

src/decl-macros/minutiae/metavar-expr.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This chapter will introduce them more in-depth together with usage examples.
1313
- [Dollar Dollar (`$$`)](#dollar-dollar-)
1414
- [`count($ident, depth)`](#countident-depth)
1515
- [`index(depth)`](#indexdepth)
16-
- [`length(depth)`](#lengthdepth)
16+
- [`len(depth)`](#lengthdepth)
1717
- [`ignore($ident)`](#ignoreident)
1818

1919
## Dollar Dollar (`$$`)
@@ -128,14 +128,14 @@ fn main() {
128128
```
129129

130130

131-
## `length(depth)`
131+
## `len(depth)`
132132

133-
The `length(depth)` metavariable expression expands to the iteration count of the repetition at the given depth.
133+
The `len(depth)` metavariable expression expands to the iteration count of the repetition at the given depth.
134134

135135
- The `depth` argument targets the repetition at `depth` counting outwards from the inner-most repetition where the expression is invoked.
136136
- The expression expands to an unsuffixed integer literal token.
137137

138-
The `length()` expression defaults `depth` to `0`, making it a shorthand for `length(0)`.
138+
The `len()` expression defaults `depth` to `0`, making it a shorthand for `len(0)`.
139139

140140

141141
```rust,ignore
@@ -148,8 +148,8 @@ macro_rules! lets_count {
148148
$(
149149
println!(
150150
"'{}' in inner iteration {}/{} with '{}' in outer iteration {}/{} ",
151-
stringify!($inner), ${index()}, ${length()},
152-
stringify!($outer), ${index(1)}, ${length(1)},
151+
stringify!($inner), ${index()}, ${len()},
152+
stringify!($outer), ${index(1)}, ${len(1)},
153153
);
154154
)*
155155
)*

0 commit comments

Comments
 (0)