From 898069692d7cc8af7c679f0a166c35826a40be70 Mon Sep 17 00:00:00 2001 From: meh Date: Tue, 4 Aug 2015 15:31:05 +0200 Subject: [PATCH] frame/video: make Component unsafe --- src/util/frame/video.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/util/frame/video.rs b/src/util/frame/video.rs index 33d3bd4..af68247 100644 --- a/src/util/frame/video.rs +++ b/src/util/frame/video.rs @@ -290,44 +290,44 @@ impl Clone for Video { } } -pub trait Component { +pub unsafe trait Component { fn is_valid(format: format::Pixel) -> bool; } #[cfg(feature = "image")] -impl Component for ::image::Luma { +unsafe impl Component for ::image::Luma { fn is_valid(format: format::Pixel) -> bool { format == format::Pixel::GRAY8 } } #[cfg(feature = "image")] -impl Component for ::image::Rgb { +unsafe impl Component for ::image::Rgb { fn is_valid(format: format::Pixel) -> bool { format == format::Pixel::RGB24 } } #[cfg(feature = "image")] -impl Component for ::image::Rgba { +unsafe impl Component for ::image::Rgba { fn is_valid(format: format::Pixel) -> bool { format == format::Pixel::RGBA } } -impl Component for [u8; 3] { +unsafe impl Component for [u8; 3] { fn is_valid(format: format::Pixel) -> bool { format == format::Pixel::RGB24 || format == format::Pixel::BGR24 } } -impl Component for (u8, u8, u8) { +unsafe impl Component for (u8, u8, u8) { fn is_valid(format: format::Pixel) -> bool { format == format::Pixel::RGB24 || format == format::Pixel::BGR24 } } -impl Component for [u8; 4] { +unsafe impl Component for [u8; 4] { fn is_valid(format: format::Pixel) -> bool { format == format::Pixel::RGBA || format == format::Pixel::BGRA || format == format::Pixel::ARGB || format == format::Pixel::ABGR || @@ -336,7 +336,7 @@ impl Component for [u8; 4] { } } -impl Component for (u8, u8, u8, u8) { +unsafe impl Component for (u8, u8, u8, u8) { fn is_valid(format: format::Pixel) -> bool { format == format::Pixel::RGBA || format == format::Pixel::BGRA || format == format::Pixel::ARGB || format == format::Pixel::ABGR ||