seal Cloner* traits

This commit is contained in:
bendn 2023-09-25 17:18:35 +07:00
parent 214f25bbab
commit 5293fe3d77
No known key found for this signature in database
GPG key ID: 0D9D3A2A3B2A93D6
2 changed files with 11 additions and 3 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "fimg" name = "fimg"
version = "0.4.5" version = "0.4.6"
authors = ["bend-n <bend.n@outlook.com>"] authors = ["bend-n <bend.n@outlook.com>"]
license = "MIT" license = "MIT"
edition = "2021" edition = "2021"

View file

@ -15,8 +15,16 @@ pub trait OverlayAt<W> {
unsafe fn overlay_at(&mut self, with: &W, x: u32, y: u32) -> &mut Self; 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 /// [`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. /// Overlay with => self at coordinates x, y, without blending, and returning a new image.
/// # Safety /// # Safety
/// ///
@ -35,7 +43,7 @@ pub trait Overlay<W> {
} }
/// [`Overlay`] but owned /// [`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) /// Overlay with => self (does not blend)
/// # Safety /// # Safety
/// ///