fast image operations
seal Cloner* traits
bendn 2023-09-25
parent 214f25b · commit 5293fe3
-rw-r--r--Cargo.toml2
-rw-r--r--src/overlay.rs12
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 <[email protected]>"]
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<W> {
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<const N: usize> Sealed for ImageCloner<'_, N> {}
+
/// [`OverlayAt`] but owned
-pub trait ClonerOverlayAt<const W: usize, const C: usize> {
+pub trait ClonerOverlayAt<const W: usize, const C: usize>: Sealed {
/// Overlay with => self at coordinates x, y, without blending, and returning a new image.
/// # Safety
///
@@ -35,7 +43,7 @@ pub trait Overlay<W> {
}
/// [`Overlay`] but owned
-pub trait ClonerOverlay<const W: usize, const C: usize> {
+pub trait ClonerOverlay<const W: usize, const C: usize>: Sealed {
/// Overlay with => self (does not blend)
/// # Safety
///