From 9bc90c371fb41a2d6dc08eb4673e5be15f829514 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 2 Dec 2022 15:41:39 +0100 Subject: Introspection --- library/src/shared/ext.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'library/src/shared') 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>>) -> 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>>) -> Self { crate::layout::BoxNode { sizing, child: self }.pack() } -- cgit v1.2.3