Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected Error on Deserialization #277

Closed
HTGAzureX1212 opened this issue Mar 12, 2021 · 2 comments
Closed

Unexpected Error on Deserialization #277

HTGAzureX1212 opened this issue Mar 12, 2021 · 2 comments

Comments

@HTGAzureX1212
Copy link

HTGAzureX1212 commented Mar 12, 2021

I currently have the following XML for deserialization:

<Levels>
    <CensorshipLevel Level="0" />
</Levels>

Which I wrote the following Rust code for it:

extern crate serde;
extern crate quick_xml;

#[derive(Debug, Clone, Serialize, Deserialize)]
crate struct CensorshipLevel {
    #[serde(rename = "Level")]
    crate level: u8
}

However, when I attempt to deserialize it, I see this in my logs:

[src\system\event_handler.rs:266] quick_xml::de::from_str::<BotConfig>(&config_string) = Err(
    Custom(
        "missing field `Level`",
    ),
)

Saying that the field Level is missing.

How can I fix this issue?

@HTGAzureX1212
Copy link
Author

Typically the code that handles the XML deserialization is located here:

https://github.com/HT-Studios/HarTex-rust-discord-bot/tree/infdev/src/xml_deserialization

Just in case additional information on my implementation is required.

@HTGAzureX1212
Copy link
Author

Any help is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant