use std::{error, fmt};
pub fn check_debug_marker_color(color: [f32; 4]) -> Result<(), CheckColorError> {
if color.iter().any(|x| !(0f32..=1f32).contains(x)) {
return Err(CheckColorError);
}
Ok(())
}
#[derive(Debug, Copy, Clone)]
pub struct CheckColorError;
impl error::Error for CheckColorError {}
impl fmt::Display for CheckColorError {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(
fmt,
"{}",
match *self {
CheckColorError => "color parameter does contains values out of 0.0 to 1.0 range",
}
)
}
}