Skip to content

Commit cba058f

Browse files
committed
Add decoding into boxed slices
1 parent e3115f3 commit cba058f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/serialize.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,13 @@ impl< T: Decodable> Decodable for Box<T> {
417417
}
418418
}
419419

420+
impl< T: Decodable> Decodable for Box<[T]> {
421+
fn decode<D: Decoder>(d: &mut D) -> Result<Box<[T]>, D::Error> {
422+
let v: Vec<T> = try!(Decodable::decode(d));
423+
Ok(v.into_boxed_slice())
424+
}
425+
}
426+
420427
impl<T:Encodable> Encodable for Rc<T> {
421428
#[inline]
422429
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {

0 commit comments

Comments
 (0)