aphorisme / aphorisme/packs-rs

Allow `struct` to be packed as Dictionary

Abierto
#5 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Rust
Estrellas
0
Forks
0
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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?

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.