1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
// import needed libraries use std::fmt; // define common lib's errors for end user pub enum Error { TooManyGradientPointsRequested } // make sure the user can use .unwrap command impl fmt::Debug for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", match self { Error::TooManyGradientPointsRequested => "You asked for a noise with too many gradient points compared to the width of the picture 🤕" }) } }