Skip to content

Commit f3f0c02

Browse files
VecView: Implement serialize
1 parent f3aa0df commit f3f0c02

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/ser.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use core::hash::{BuildHasher, Hash};
22

33
use crate::{
44
binary_heap::Kind as BinaryHeapKind, BinaryHeap, Deque, IndexMap, IndexSet, LinearMap, String,
5-
Vec,
5+
Vec, VecView,
66
};
77
use serde::ser::{Serialize, SerializeMap, SerializeSeq, Serializer};
88

@@ -43,6 +43,18 @@ where
4343
}
4444

4545
impl<T, const N: usize> Serialize for Vec<T, N>
46+
where
47+
T: Serialize,
48+
{
49+
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
50+
where
51+
S: Serializer,
52+
{
53+
self.as_view().serialize(serializer)
54+
}
55+
}
56+
57+
impl<T> Serialize for VecView<T>
4658
where
4759
T: Serialize,
4860
{

0 commit comments

Comments
 (0)