pub enum Hyperlink {
External(String),
Internal(String),
}Expand description
A hyperlink attached to a run (w:hyperlink, CT_Hyperlink): either a link to an external URL,
or a link to a bookmark elsewhere in the same document.
Strictly, in the underlying XML, a hyperlink is not a run property: <w:hyperlink> wraps its
own nested run(s) (CT_Hyperlink’s content is EG_PContent, the very same group w:p itself
uses), making it a sibling of <w:r> in a paragraph’s content, much like Field’s
<w:fldSimple>. It is modeled here as a property on Run instead (alongside style_id,
bold..) for a simpler, more consistent public API — the run’s own text/formatting still apply
normally, the hyperlink just adds link behavior on top. When several consecutive runs each set a
hyperlink, every one of them is written as its own separate <w:hyperlink> (and, for an
external link, its own OPC relationship, even when two runs happen to share the same URL) rather
than merged into a single wrapper — simpler and safer than trying to detect and dedupe repeated
URLs across runs.
Variants§
External(String)
A link to an external URL (r:id, an OPC relationship with TargetMode="External" — the
target is never resolved or validated as a package part, unlike an image’s r:embed).
Internal(String)
A link to a bookmark elsewhere in the same document (w:anchor), with no relationship at
all. The anchor name is meant to match a Bookmark::name set via Run.bookmarks
somewhere in the document, but this is not validated when writing — an Internal hyperlink
to a name that isn’t actually bookmarked anywhere still produces a well-formed .docx, just
a dead link in Word.
Trait Implementations§
impl Eq for Hyperlink
impl StructuralPartialEq for Hyperlink
Auto Trait Implementations§
impl Freeze for Hyperlink
impl RefUnwindSafe for Hyperlink
impl Send for Hyperlink
impl Sync for Hyperlink
impl Unpin for Hyperlink
impl UnsafeUnpin for Hyperlink
impl UnwindSafe for Hyperlink
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.