aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorPolesznyák Márk <contact@pml68.dev>2025-10-18 01:43:15 +0200
committerPolesznyák Márk <contact@pml68.dev>2025-10-18 02:48:55 +0200
commitd8b724701dde52a17daf9874e8bbcf2a64ac7d7a (patch)
tree7f0b587613473376a3d88e3794ceb2391cff4b65 /src/lib.rs
downloadiced_selection-d8b724701dde52a17daf9874e8bbcf2a64ac7d7a.tar.gz
feat: initial commit
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 0000000..d103b63
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,29 @@
+//! A text selection API built around `iced`'s [`Paragraph`].
+//!
+//! [`Paragraph`]: https://docs.iced.rs/iced_graphics/text/paragraph/struct.Paragraph.html
+
+pub mod selection;
+
+pub mod text;
+
+use iced_widget::core;
+pub use text::Text;
+
+/// Creates a new [`Text`] widget with the provided content.
+#[macro_export]
+macro_rules! text {
+ ($($arg:tt)*) => {
+ $crate::Text::new(format!($($arg)*))
+ };
+}
+
+/// Creates a new [`Text`] widget with the provided content.
+pub fn text<'a, Theme, Renderer>(
+ text: impl core::text::IntoFragment<'a>,
+) -> Text<'a, Theme, Renderer>
+where
+ Theme: text::Catalog + 'a,
+ Renderer: core::text::Renderer,
+{
+ Text::new(text)
+}