Skip to content

Commit 52bb10f

Browse files
author
maxtremblay
committed
Implement serde
1 parent 14b61de commit 52bb10f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/vector/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,14 @@ impl<T: Deref<Target = [usize]>> SparseBinVecBase<T> {
388388
.collect();
389389
Ok(SparseBinVec::new_unchecked(self.len(), positions))
390390
}
391+
392+
/// Returns a json string for the vector.
393+
pub fn as_json(&self) -> Result<String, serde_json::Error>
394+
where
395+
T: Serialize,
396+
{
397+
serde_json::to_string(self)
398+
}
391399
}
392400

393401
impl<S, T> Add<&SparseBinVecBase<S>> for &SparseBinVecBase<T>

0 commit comments

Comments
 (0)