summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index ebf3274..2b5e3ac 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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