summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-02-03 02:38:20 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-02-03 02:38:20 +0100
commitc9abe25d3167bb12d935e3a095160a897dd98176 (patch)
treef48b310a3739df3effcb183d7747a5f59ba6914c /core
parentc83809adb907498ba2a573ec9fb50936601ac8fc (diff)
downloadiced-c9abe25d3167bb12d935e3a095160a897dd98176.tar.gz
iced-c9abe25d3167bb12d935e3a095160a897dd98176.tar.bz2
iced-c9abe25d3167bb12d935e3a095160a897dd98176.zip
Use `text::Span::new` in `window_manager`
Diffstat (limited to 'core')
-rw-r--r--core/src/text.rs44
1 files changed, 18 insertions, 26 deletions
diff --git a/core/src/text.rs b/core/src/text.rs
index 8dde9e21..a7e1f281 100644
--- a/core/src/text.rs
+++ b/core/src/text.rs
@@ -270,23 +270,6 @@ pub struct Span<'a, Link = (), Font = crate::Font> {
pub strikethrough: bool,
}
-impl<Link, Font> Default for Span<'_, Link, Font> {
- fn default() -> Self {
- Self {
- text: Cow::default(),
- size: None,
- line_height: None,
- font: None,
- color: None,
- link: None,
- highlight: None,
- padding: Padding::default(),
- underline: false,
- strikethrough: false,
- }
- }
-}
-
/// A text highlight.
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Highlight {
@@ -301,15 +284,7 @@ impl<'a, Link, Font> Span<'a, Link, Font> {
pub fn new(fragment: impl IntoFragment<'a>) -> Self {
Self {
text: fragment.into_fragment(),
- size: None,
- line_height: None,
- font: None,
- color: None,
- highlight: None,
- link: None,
- padding: Padding::ZERO,
- underline: false,
- strikethrough: false,
+ ..Self::default()
}
}
@@ -457,6 +432,23 @@ impl<'a, Link, Font> Span<'a, Link, Font> {
}
}
+impl<Link, Font> Default for Span<'_, Link, Font> {
+ fn default() -> Self {
+ Self {
+ text: Cow::default(),
+ size: None,
+ line_height: None,
+ font: None,
+ color: None,
+ link: None,
+ highlight: None,
+ padding: Padding::default(),
+ underline: false,
+ strikethrough: false,
+ }
+ }
+}
+
impl<'a, Link, Font> From<&'a str> for Span<'a, Link, Font> {
fn from(value: &'a str) -> Self {
Span::new(value)