diff --git a/Cargo.toml b/Cargo.toml index 21a9af8..da0a8aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fimg" -version = "0.4.14" +version = "0.4.15" authors = ["bend-n "] license = "MIT" edition = "2021" diff --git a/src/lib.rs b/src/lib.rs index d59f652..1427562 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -251,6 +251,13 @@ impl Image<[u8; N], CHANNELS> { } } +impl Image<&[u8], CHANNELS> { + /// Box this image. + pub fn boxed(self) -> Image, CHANNELS> { + unsafe { Image::new(self.width, self.height, self.buffer.into()) } + } +} + impl Image, CHANNELS> { /// Box this owned image. pub fn boxed(self) -> Image, CHANNELS> {