Rust: Move QL doc into annotations.py

This commit is contained in:
Tom Hvitved
2025-01-10 14:27:53 +01:00
parent 166f8916cc
commit 0795c244e9
19 changed files with 125 additions and 29 deletions

View File

@@ -1878,9 +1878,30 @@ class Format(Locatable):
"""
parent: FormatArgsExpr
index: int
argument_ref: optional["FormatArgument"] | child
width_argument: optional["FormatArgument"] | child
precision_argument: optional["FormatArgument"] | child
argument_ref: optional["FormatArgument"] | child | desc("""
For example `name` and `0` in:
```rust
let name = "Alice";
println!("{name} in wonderland");
println!("{0} in wonderland", name);
```
""")
width_argument: optional["FormatArgument"] | child | desc("""
For example `width` and `1` in:
```rust
let width = 6;
println!("{:width$}", PI);
println!("{:1$}", PI, width);
```
""")
precision_argument: optional["FormatArgument"] | child | desc("""
For example `prec` and `1` in:
```rust
let prec = 6;
println!("{:.prec$}", PI);
println!("{:.1$}", PI, prec);
```
""")
@synth.on_arguments(parent=FormatArgsExpr, index=int, kind=int, name=string, positional=boolean, offset=int)