From 5293fe3d77b33ee4ad31f2b20005d940dddc41e7 Mon Sep 17 00:00:00 2001 From: bendn Date: Mon, 25 Sep 2023 17:18:35 +0700 Subject: [PATCH] seal Cloner* traits --- Cargo.toml | 2 +- src/overlay.rs | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 98203fd..4b07cc9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fimg" -version = "0.4.5" +version = "0.4.6" authors = ["bend-n "] license = "MIT" edition = "2021" diff --git a/src/overlay.rs b/src/overlay.rs index eb7ac29..9c63c41 100644 --- a/src/overlay.rs +++ b/src/overlay.rs @@ -15,8 +15,16 @@ pub trait OverlayAt { unsafe fn overlay_at(&mut self, with: &W, x: u32, y: u32) -> &mut Self; } +/// Sealant module +mod sealed { + /// Seals the cloner traits + pub trait Sealed {} +} +use sealed::Sealed; +impl Sealed for ImageCloner<'_, N> {} + /// [`OverlayAt`] but owned -pub trait ClonerOverlayAt { +pub trait ClonerOverlayAt: Sealed { /// Overlay with => self at coordinates x, y, without blending, and returning a new image. /// # Safety /// @@ -35,7 +43,7 @@ pub trait Overlay { } /// [`Overlay`] but owned -pub trait ClonerOverlay { +pub trait ClonerOverlay: Sealed { /// Overlay with => self (does not blend) /// # Safety ///