Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

Commit 7321bc8

Browse files
authored
Merge pull request #168 from bluss/serialize-array-0
Implement serialization of [T; 0]
2 parents 63c9ef6 + db7befd commit 7321bc8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/serialize.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,8 +1273,8 @@ macro_rules! tuple {
12731273
tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, }
12741274

12751275
macro_rules! array {
1276-
($zero:expr) => ();
1277-
($len:expr, $($idx:expr),*) => {
1276+
() => ();
1277+
($len:expr, $($idx:expr,)*) => {
12781278
impl<T:Decodable> Decodable for [T; $len] {
12791279
fn decode<D: Decoder>(d: &mut D) -> Result<[T; $len], D::Error> {
12801280
d.read_seq(|d, len| {
@@ -1284,7 +1284,7 @@ macro_rules! array {
12841284
Ok([$(
12851285
try!(d.read_seq_elt($len - $idx - 1,
12861286
|d| Decodable::decode(d)))
1287-
),+])
1287+
),*])
12881288
})
12891289
}
12901290
}
@@ -1299,13 +1299,13 @@ macro_rules! array {
12991299
})
13001300
}
13011301
}
1302-
array! { $($idx),* }
1302+
array! { $($idx,)* }
13031303
}
13041304
}
13051305

13061306
array! {
13071307
32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16,
1308-
15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
1308+
15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
13091309
}
13101310

13111311
impl Encodable for path::Path {

0 commit comments

Comments
 (0)