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

Serialization and deserialization errors #177

Open
bahetiai opened this issue Jun 30, 2022 · 0 comments
Open

Serialization and deserialization errors #177

bahetiai opened this issue Jun 30, 2022 · 0 comments

Comments

@bahetiai
Copy link

Code:

use serde;
use serde::{Deserialize, Serialize};
use serde_xml_rs::{from_str, to_string};

#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct Item {
    name: String,
    source: String,
}

fn main() {
    let src = r#"<Item name="Banana"><source>Store</source></Item>"#;
    let item:Item = from_str(&src).unwrap();
    let item = to_string(&item).unwrap();
    assert_eq!(src,item);
}

but i got error

thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `"<Item name=\"Banana\"><source>Store</source></Item>"`,
 right: `"<Item><name>Banana</name><source>Store</source></Item>"`', src/main.rs:15:5
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