agronholm / agronholm/cbor2

Nesting custom tags

Aberta
#252 11 comentários 0 reações 0 responsáveis Ver no GitHub
enhancement
Linguagem predominante
Rust
Estrelas
305
Forks
79
Merge médio
21h 59min
PRs com merge (30d)
2

Descrição

### Things to check first

- [x] I have searched the existing issues and didn't find my feature already requested there

### Feature description

I am working on a project where I'd like to be able to serialize nested custom tags, or collections of custom tags. I have been trying to understand from the documentation the best approach to use, especially if I'd also like to be able to use those tags separately. It feels like it should be possible now, but I can't feel out the right way to do it. I suspect it's just a documentation/user knowledge problem, so if there is an obvious way to do this that I am not understanding, I would be more than happy to take that lesson and write up a self-contained example and paragraph for a documentation PR.

### Use case

As an example, I have an `Interval` type which is a wrapper around a 2-tuple of floats, with operators defined for interval arithmetic. Separately, I have a `Vector[T]` type which is a generic numeric vector (similar to a numpy vector or glm, etc) - one common use case in my project is a `Vector[Interval]` - so while I've defined encoders and decoders that can be passed to `default` and `tag_hook` for the standalone types, I haven't found the right way to handle the case where `Vector` is a collection of `Interval`s (rather than `float` or `int`). Is there a way to do this that I am missing? Any pointers would be much appreciated!

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.