mirror of
https://github.com/bend-n/fimg.git
synced 2024-12-22 10:28:21 -06:00
impl boxed for &[u8]
This commit is contained in:
parent
1c218cd1a9
commit
06fc71d4bc
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "fimg"
|
name = "fimg"
|
||||||
version = "0.4.14"
|
version = "0.4.15"
|
||||||
authors = ["bend-n <bend.n@outlook.com>"]
|
authors = ["bend-n <bend.n@outlook.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
|
@ -251,6 +251,13 @@ impl<const CHANNELS: usize, const N: usize> Image<[u8; N], CHANNELS> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<const CHANNELS: usize> Image<&[u8], CHANNELS> {
|
||||||
|
/// Box this image.
|
||||||
|
pub fn boxed(self) -> Image<Box<[u8]>, CHANNELS> {
|
||||||
|
unsafe { Image::new(self.width, self.height, self.buffer.into()) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<const CHANNELS: usize> Image<Vec<u8>, CHANNELS> {
|
impl<const CHANNELS: usize> Image<Vec<u8>, CHANNELS> {
|
||||||
/// Box this owned image.
|
/// Box this owned image.
|
||||||
pub fn boxed(self) -> Image<Box<[u8]>, CHANNELS> {
|
pub fn boxed(self) -> Image<Box<[u8]>, CHANNELS> {
|
||||||
|
|
Loading…
Reference in a new issue