aphorisme / aphorisme/packs-rs
Allow `struct` to be packed as Dictionary
- Langage dominant
- Rust
- Étoiles
- 0
- Forks
- 0
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
Deriving `Pack` for any `struct Foo` treats `Foo` as a `Structure` in the sense of PackStream. Especially for the bolt protocol though, it would be better to have the option to treat them as `Dictionary`. I.e.
```Rust
struct Foo {
tx_timeout: Option,
bookmarks: Option>,
}
```
gets packed as if it was a `Dictionary` with the keys `"tx_timeout"` and `"bookmarks"`.
There are some things to be considered here:
- how to differentiate from the default packing as Structure? (using `#[dict]` instead of `#[tag = u8]`?
- Fields can be optional, so they have to be wrapped into `Option`?
- Is unpacking supported? If so, how does it deal with missing elements?
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.