diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib.rs | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -1,9 +1,26 @@ use std::cell::RefCell; use libc::malloc; +use std::fmt::{Result, Display, Formatter}; -pub mod error; pub mod parse; +#[derive(Clone, Debug)] +pub enum PissError { + InvalidSuffix(String), + InvalidNumber(String), + NumberNotPositive +} + +impl Display for PissError { + fn fmt(&self, f: &mut Formatter<'_>) -> Result { + match self { + Self::InvalidSuffix(s) => write!(f, "I cannot piss the suffix {s:?}"), + Self::InvalidNumber(s) => write!(f, "I cannot piss the invalid number {s:?}"), + Self::NumberNotPositive => write!(f, "I cannot piss nonexistent memory") + } + } +} + #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] pub struct PissAmount { to_piss: u128 |