diff options
author | 2025-02-05 02:20:36 +0100 | |
---|---|---|
committer | 2025-02-05 02:20:36 +0100 | |
commit | 4bbb5cbc1f8b2a0ee8e09be18071368df3ba5bbd (patch) | |
tree | 076d5bcebcc1686c069d79375357ef013de16cc3 /core/src | |
parent | 1f9723a9296082ea06b7280833c60e8f2e547cb5 (diff) | |
parent | ef25dfb7331c7ab5446e9b771c9bca8aff231957 (diff) | |
download | iced-4bbb5cbc1f8b2a0ee8e09be18071368df3ba5bbd.tar.gz iced-4bbb5cbc1f8b2a0ee8e09be18071368df3ba5bbd.tar.bz2 iced-4bbb5cbc1f8b2a0ee8e09be18071368df3ba5bbd.zip |
Merge pull request #2786 from iced-rs/customizable-markdown
Customizable Markdown Rendering and Image Support
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/lib.rs | 9 | ||||
-rw-r--r-- | core/src/padding.rs | 6 | ||||
-rw-r--r-- | core/src/pixels.rs | 8 |
3 files changed, 23 insertions, 0 deletions
diff --git a/core/src/lib.rs b/core/src/lib.rs index c31a8da7..d5c221ac 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -84,3 +84,12 @@ pub use vector::Vector; pub use widget::Widget; pub use smol_str::SmolStr; + +/// A function that can _never_ be called. +/// +/// This is useful to turn generic types into anything +/// you want by coercing them into a type with no possible +/// values. +pub fn never<T>(never: std::convert::Infallible) -> T { + match never {} +} diff --git a/core/src/padding.rs b/core/src/padding.rs index e26cdd9b..9ec02e6d 100644 --- a/core/src/padding.rs +++ b/core/src/padding.rs @@ -202,3 +202,9 @@ impl From<Padding> for Size { Self::new(padding.horizontal(), padding.vertical()) } } + +impl From<Pixels> for Padding { + fn from(pixels: Pixels) -> Self { + Self::from(pixels.0) + } +} diff --git a/core/src/pixels.rs b/core/src/pixels.rs index a1ea0f15..7d6267cf 100644 --- a/core/src/pixels.rs +++ b/core/src/pixels.rs @@ -79,3 +79,11 @@ impl std::ops::Div<f32> for Pixels { Pixels(self.0 / rhs) } } + +impl std::ops::Div<u32> for Pixels { + type Output = Pixels; + + fn div(self, rhs: u32) -> Self { + Pixels(self.0 / rhs as f32) + } +} |