Commit Graph

7 Commits

Author SHA1 Message Date
Arthur Baars
a9423f4bdb Rust: codegen 2024-09-20 15:50:59 +02:00
Arthur Baars
80d32a2333 Rust: re-generate code 2024-09-19 13:00:46 +02:00
Tom Hvitved
4dd3059f16 Rust: Run code generator 2024-09-16 13:39:55 +02:00
Arthur Baars
7572546efa Improve handling of unimplemented nodes 2024-09-12 22:17:39 +02:00
Paolo Tranquilli
18c423eb55 Rust: fix formatting of code snippet in docstring 2024-09-06 14:27:57 +02:00
Paolo Tranquilli
6111a7497d Rust: remove accidental schema annotation 2024-09-06 14:26:36 +02:00
Paolo Tranquilli
8c5cc2efdc Rust: generate test code from schema docstrings
This generates test source files from code blocks in class docstrings.

By default the test code is generated as is, but it can optionally:
* be wrapped in a function providing an adequate context using
  `@rust.doc_test_function(name, *, lifetimes=(), return_type="()", **kwargs)`,
  with `kwargs` providing both generic and normal params depending on
  capitalization
* be skipped altogether using `@rust.skip_doc_test`

So for example an annotation like
```python
@rust.doc_test_function("foo",
                        lifetimes=("a",),
                        T="Eq",
                        x="&'a T",
                        y="&'a T",
                        return_type="&'a T")
```
will result in the following wrapper:
```rust
fn foo<'a, T: Eq>(x: &'a T, y: &'a T) -> &'a T {
    // example code here
}
```
2024-09-06 14:24:42 +02:00