Skip to content

Commit a456b78

Browse files
committed
serde serialization of indptr
1 parent 5f2a1f8 commit a456b78

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/sparse.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ where
9494
storage: CompressedStorage,
9595
nrows: usize,
9696
ncols: usize,
97+
#[cfg_attr(feature = "serde", serde(flatten))]
9798
indptr: IndPtrBase<Iptr, IptrStorage>,
9899
indices: IndStorage,
99100
data: DataStorage,

src/sparse/indptr.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
66
use crate::errors::SprsError;
77
use crate::indexing::SpIndex;
8+
#[cfg(feature = "serde")]
9+
use serde::{Deserialize, Serialize};
810
use std::ops::Range;
911
use std::ops::{Deref, DerefMut};
1012

1113
#[derive(Eq, PartialEq, Debug, Copy, Clone, Hash)]
14+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
1215
pub struct IndPtrBase<Iptr, Storage>
1316
where
1417
Iptr: SpIndex,

0 commit comments

Comments
 (0)