Skip to content

XML Improvements#130

Open
Holzhaus wants to merge 7 commits intomainfrom
xml-improvements
Open

XML Improvements#130
Holzhaus wants to merge 7 commits intomainfrom
xml-improvements

Conversation

@Holzhaus
Copy link
Copy Markdown
Owner

@Holzhaus Holzhaus commented Feb 2, 2025

No description provided.

Copy link
Copy Markdown
Collaborator

@Swiftb0y Swiftb0y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

large lgtm, couple thoughts

Comment thread src/main.rs Outdated
Comment thread src/xml.rs
Comment on lines +74 to +95
impl Serialize for Collection {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
#[derive(Serialize)]
struct Value<'a> {
/// Number of TRACK in COLLECTION
#[serde(rename = "@Count")]
entries: usize,
/// Tracks
#[serde(rename = "TRACK")]
tracks: &'a Vec<Track>,
}

let value = Value {
entries: self.tracks.len(),
tracks: &self.tracks,
};

value.serialize(serializer)
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this could be simplified by using #[serde(getter = "tracks.len()")] instead?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this works, looks like getter is meant for another use case and calls the method for a remote type? https://serde.rs/field-attrs.html#getter

Comment thread src/xml.rs Outdated
Comment thread src/xml.rs
Comment thread src/xml.rs
@Holzhaus Holzhaus marked this pull request as ready for review October 18, 2025 22:01
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

Successfully merging this pull request may close these issues.

2 participants