Debian Codegraph @

.cargo/vendor/onenote_parser/src/fsshttpb/data/cell_id.rs

raw
1 use crate::errors::Result;
2 use crate::fsshttpb::data::compact_u64::CompactU64;
3 use crate::fsshttpb::data::exguid::ExGuid;
4 use crate::Reader;
5
6 /// A FSSHTTP cell identifier.
7 ///
8 /// See [\[MS-FSSHTTPB\] 2.2.1.10] and [\[MS-FSSHTTPB\] 2.2.1.11].
9 ///
10 /// [\[MS-FSSHTTPB\] 2.2.1.10]: https://docs.microsoft.com/en-us/openspecs/sharepoint_protocols/ms-fsshttpb/75bf8297-ef9c-458a-95a3-ad6265bfa864
11 /// [\[MS-FSSHTTPB\] 2.2.1.11]: https://docs.microsoft.com/en-us/openspecs/sharepoint_protocols/ms-fsshttpb/d3f4d22d-6fb4-4032-8587-f3eb9c256e45
12 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
13 pub struct CellId(pub ExGuid, pub ExGuid);
14
15 impl CellId {
16 pub(crate) fn parse(reader: Reader) -> Result<CellId> {
17 let first = ExGuid::parse(reader)?;
18 let second = ExGuid::parse(reader)?;
19
20 Ok(CellId(first, second))
21 }
22
23 pub(crate) fn parse_array(reader: Reader) -> Result<Vec<CellId>> {
24 let mut values = vec![];
25
26 let count = CompactU64::parse(reader)?.value();
27 for _ in 0..count {
28 values.push(CellId::parse(reader)?);
29 }
30
31 Ok(values)
32 }
33 }