summaryrefslogtreecommitdiff
path: root/library/src/shared
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-12-02 15:41:39 +0100
committerLaurenz <laurmaedje@gmail.com>2022-12-02 15:45:18 +0100
commit9bc90c371fb41a2d6dc08eb4673e5be15f829514 (patch)
tree454a47ce82c2229e79a139a8bdeaed9add1e0a14 /library/src/shared
parent5110a41de1ca2236739ace2d37a1af912bb029f1 (diff)
Introspection
Diffstat (limited to 'library/src/shared')
-rw-r--r--library/src/shared/ext.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/library/src/shared/ext.rs b/library/src/shared/ext.rs
index 2d2dc751..4fd1f161 100644
--- a/library/src/shared/ext.rs
+++ b/library/src/shared/ext.rs
@@ -13,6 +13,9 @@ pub trait ContentExt {
/// Underline this content.
fn underlined(self) -> Self;
+ /// Link the content to a destination.
+ fn linked(self, dest: Destination) -> Self;
+
/// Force a size for this content.
fn boxed(self, sizing: Axes<Option<Rel<Length>>>) -> Self;
@@ -45,6 +48,10 @@ impl ContentExt for Content {
crate::text::DecoNode::<{ crate::text::UNDERLINE }>(self).pack()
}
+ fn linked(self, dest: Destination) -> Self {
+ self.styled(Meta::DATA, vec![Meta::Link(dest.clone())])
+ }
+
fn boxed(self, sizing: Axes<Option<Rel<Length>>>) -> Self {
crate::layout::BoxNode { sizing, child: self }.pack()
}