Rust: define Format and FormatArgument in schema

This commit is contained in:
Arthur Baars
2024-10-18 10:11:35 +02:00
parent d4b2dc3711
commit 8d2236b6d6

View File

@@ -1760,3 +1760,32 @@ class _:
@synth.on_arguments(parent="FormatArgsExpr", index=int, kind=int)
class ImplicitVariableAccess(Expr):
pass
@qltest.skip
@synth.on_arguments(parent=FormatArgsExpr, index=int)
class Format(Locatable):
"""
A format element in a formatting template. For example the `{}` in:
```rust
println!("Hello {}", "world");
```
"""
parent: FormatArgsExpr
index: int
@qltest.skip
@synth.on_arguments(parent=FormatArgsExpr, index=int, kind=int)
class FormatArgument(Locatable):
"""
An argument in a format element in a formatting template. For example the `width`, `precision`, and `value` in:
```rust
println!("Value {value:#width$.precision$}");
```
or the `0`, `1` and `2` in:
```rust
println!("Value {0:#1$.2$}", value, width, precision);
```
"""
parent: Format