Working with typetag for xs:choice / variant types?
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 20/100
Línea de trabajo
Start by reading quick-xml's Serde deserialization support for $value and how it handles element names and attributes, then compare that behavior with typetag's deserialization model. The issue provides no target file or test; first determine whether this combination is supported and what behavior should be added. Done means a documented answer or a concrete supported approach for deserializing varying element types.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
This is a question, rather than an issue.
I'd like to use typetag or a similar crate along with quick-xml, to deserialize a sequence of varying elements without hardcoding all the possible variants in an enum.
<Data>
<Foo a="abc" />
<Foo a="def" />
<Bar b="123" c="456">
<BarChild />
</Bar>
<!-- other typetag'd elements can appear here -->
</Data>
Is there some way to make this work with typetag and quick-xml?
I tried:
#[derive(Deserialize)]
pub struct Document {
#[serde(rename = "$value")]
pub items: Vec<Box<dyn SceneLoadable>>,
}
#[typetag::deserialize]
pub(crate) trait SceneLoadable {}
But after encountering an element, it proceeds to try and interpret the attributes on that tag as type info, e.g.: Unknown variant @id, expected one of ..... (Edit: my apologies to the github user with username id, I mentioned them by mistake. Oops!)
- Lenguaje dominante
- Rust
- Estrellas
- 1.6k
- Forks
- 299
- Merge medio
- 2 d 4 h
- PR fusionados (30 d)
- 9
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de tafia/quick-xml
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
DecodingReader::set_encoding panics when the XML declaration is longer than 64 bytesPosiblemente ocupada @emschwartz la tomó hace 4 días. Abiertobug encoding
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
tafia/quick-xml#1040 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
encoding optimization
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
tafia/quick-xml#1039 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
optimization question
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 4/5 1-2 días Aptitud para principiantes 53/100
tafia/quick-xml#1035 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de tafia/quick-xml
Issues similares
-
priority: medium ready
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
TusanHomichi/PSIV#646 ·
Los mantenedores suelen responder en 1 día
-
bug lab rust-mcp
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
area:cli good first issue help wanted needs translation priority:P2 type:documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
SpecterAoD/pqkeep#226 ·
Los mantenedores suelen responder en 1 día
-
Flaky on Windows: scenario_j_zero_refresh_after_triggers_background_refresh times out at 5 sAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
haowjy/mars-agents#381 ·
Los mantenedores suelen responder en 1 día
-
[Bug]: opencode_go chat route drops reasoning_effort (even 'none'), while the same endpoint honors it via custom_llm_provider=openaiPosiblemente ocupada @arvindkumar-ship-it la tomó hoy. Abiertollm translation
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
BerriAI/litellm#51871 · 1 comentario ·
Los mantenedores suelen responder en 1 día