Debian Codegraph @

.cargo/vendor/onenote_parser/src/onenote/iframe.rs

raw
1 use crate::errors::{ErrorKind, Result};
2 use crate::fsshttpb::data::exguid::ExGuid;
3 use crate::one::property_set::iframe_node;
4 use crate::onestore::object_space::ObjectSpace;
5
6 /// An embedded iframe.
7 #[derive(Clone, PartialEq, PartialOrd, Debug)]
8 pub struct IFrame {
9 pub(crate) embed_type: Option<u32>,
10 pub(crate) source_url: String,
11 }
12
13 impl IFrame {
14 pub fn embed_type(&self) -> Option<u32> {
15 self.embed_type
16 }
17 pub fn source_url(&self) -> &str {
18 &self.source_url
19 }
20 }
21
22 pub(crate) fn parse_iframe(iframe_id: ExGuid, space: &ObjectSpace) -> Result<IFrame> {
23 let object = space
24 .get_object(iframe_id)
25 .ok_or_else(|| ErrorKind::MalformedOneNoteData("image is missing".into()))?;
26 let data = iframe_node::parse(object)?;
27
28 Ok(IFrame {
29 embed_type: data.embed_type,
30 source_url: data.source_url,
31 })
32 }