Skip to content

Commit a72fbd2

Browse files
committed
Add Title to encodable output
1 parent 655d8ce commit a72fbd2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/song.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,12 @@ pub struct Song {
115115

116116
impl Encodable for Song {
117117
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
118-
e.emit_struct("Song", 7, |e| {
118+
e.emit_struct("Song", 8, |e| {
119119
e.emit_struct_field("file", 0, |e| self.file.encode(e))
120120
.and_then(|_| e.emit_struct_field("name", 1, |e| self.name.encode(e)))
121+
.and_then(|_| e.emit_struct_field("title", 2, |e| self.title.encode(e)))
121122
.and_then(|_| {
122-
e.emit_struct_field("last_mod", 2, |e| {
123+
e.emit_struct_field("last_mod", 3, |e| {
123124
e.emit_option(|e| {
124125
self.last_mod
125126
.as_ref()
@@ -129,7 +130,7 @@ impl Encodable for Song {
129130
})
130131
})
131132
.and_then(|_| {
132-
e.emit_struct_field("duration", 3, |e| {
133+
e.emit_struct_field("duration", 4, |e| {
133134
e.emit_option(|e| {
134135
self.duration
135136
.as_ref()
@@ -138,9 +139,9 @@ impl Encodable for Song {
138139
})
139140
})
140141
})
141-
.and_then(|_| e.emit_struct_field("place", 4, |e| self.place.encode(e)))
142-
.and_then(|_| e.emit_struct_field("range", 5, |e| self.range.encode(e)))
143-
.and_then(|_| e.emit_struct_field("tags", 6, |e| self.tags.encode(e)))
142+
.and_then(|_| e.emit_struct_field("place", 5, |e| self.place.encode(e)))
143+
.and_then(|_| e.emit_struct_field("range", 6, |e| self.range.encode(e)))
144+
.and_then(|_| e.emit_struct_field("tags", 7, |e| self.tags.encode(e)))
144145
})
145146
}
146147
}

0 commit comments

Comments
 (0)