Commit graph

9 commits

Author SHA1 Message Date
Jonas Schäfer
3a680d4738 parsers: re-arrange data_forms validation implementation
This is more in line with how we handle closely coupled specifications
already. While there are subdirectories for "large" specifications (such
as MUC and PubSub), those only refer to a single XEP document. When
there are multiple separate XEP documents, we have separate modules for
that.
2024-06-30 11:25:45 +02:00
Jonas Schäfer
cfbd58c1cd parsers: fix warnings in doc build 2024-06-30 09:00:21 +00:00
Jonas Schäfer
cb09ab865c parsers: use built-in string quoting instead of manual quoting
There is at least one branch of the FromStr implementation which passes
user input right into the error struct, so we cannot assume that `'` is
not part of that value.
2024-06-30 09:00:21 +00:00
Jonas Schäfer
8d8f3fea37 parsers: fix accidental MSRV bump
The previous code didn't build with 1.78:

```
error[E0716]: temporary value dropped while borrowed
   --> parsers/src/data_forms/validate.rs:394:46
    |
380 |         let value = match self {
    |             ----- borrow later stored here
...
394 |             Datatype::UserDefined(value) => &format!("x:{value}"),
    |                                              ^^^^^^^^^^^^^^^^^^^-
    |                                              |                  |
    |                                              |                  temporary value is freed at the end of this statement
    |                                              creates a temporary value which is freed while still in use
    |
    = note: consider using a `let` binding to create a longer lived value
    = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0716]: temporary value dropped while borrowed
   --> parsers/src/data_forms/validate.rs:395:51
    |
380 |         let value = match self {
    |             ----- borrow later stored here
...
395 |             Datatype::Other { prefix, value } => &format!("{prefix}:{value}"),
    |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^-
    |                                                   |                         |
    |                                                   |                         temporary value is freed at the end of this statement
    |                                                   creates a temporary value which is freed while still in use
    |
    = note: consider using a `let` binding to create a longer lived value
    = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0716`.
```

This seems like a silly reason to pull up the compiler version
requirements, so I fixed it with a trivial modification.
2024-06-30 09:00:21 +00:00
mb
a7fe743850
Add DatatypeError 2024-06-24 17:45:22 +02:00
mb
1d99e9a298
Fix datatype validation to be case-sensitive 2024-06-24 15:59:17 +02:00
mb
8c7e9fab85
Convert comment to module doc comment 2024-06-24 15:59:16 +02:00
mb
5c129d5285
Adapt to xso change 2024-06-24 15:24:19 +02:00
mb
ffd0c3c719
Add support for XEP-0122: Data Forms Validation 2024-06-24 15:15:02 +02:00