docx_rust/document/
bookmark_start.rs

1use hard_xml::{XmlRead, XmlWrite};
2use std::borrow::Cow;
3
4use crate::{__setter, __xml_test_suites};
5
6/// Beginning of bookmark
7#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
8#[cfg_attr(test, derive(PartialEq))]
9#[xml(tag = "w:bookmarkStart")]
10pub struct BookmarkStart<'a> {
11    /// Specifies a unique identifier for the bookmark.
12    #[xml(attr = "w:id")]
13    pub id: Option<Cow<'a, str>>,
14    /// Specifies the bookmark name.
15    #[xml(attr = "w:name")]
16    pub name: Option<Cow<'a, str>>,
17}
18
19impl<'a> BookmarkStart<'a> {
20    __setter!(id: Option<Cow<'a, str>>);
21    __setter!(name: Option<Cow<'a, str>>);
22}
23
24__xml_test_suites!(
25    BookmarkStart,
26    BookmarkStart::default(),
27    r#"<w:bookmarkStart/>"#,
28    BookmarkStart::default().id("id"),
29    r#"<w:bookmarkStart w:id="id"/>"#,
30    BookmarkStart::default().name("name"),
31    r#"<w:bookmarkStart w:name="name"/>"#,
32);