summaryrefslogtreecommitdiffstats
path: root/src/error.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-03-14 10:29:39 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-11-21 12:20:18 +0100
commitf4424668191d1ae421127770eda1ad894dd01802 (patch)
treedc3e184343acf2c40ae1daae2c7f9ef94ef342a8 /src/error.rs
parente8cc94aaf6d44ad69cafe75d9a4a3944959103fe (diff)
Add support for different sized integers
This also enables support for 128 bit integers. Nothing is tested, though. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/error.rs b/src/error.rs
index 9778649..6751e05 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -8,7 +8,11 @@ use serde::ser;
#[derive(Debug)]
pub enum Unexpected {
Bool(bool),
- Integer(i64),
+ I8(i8),
+ I16(i16),
+ I32(i32),
+ I64(i64),
+ I128(i128),
Float(f64),
Str(String),
Unit,
@@ -20,7 +24,11 @@ impl fmt::Display for Unexpected {
fn fmt(&self, f: &mut fmt::Formatter) -> result::Result<(), fmt::Error> {
match *self {
Unexpected::Bool(b) => write!(f, "boolean `{}`", b),
- Unexpected::Integer(i) => write!(f, "integer `{}`", i),
+ Unexpected::I8(i) => write!(f, "integer 8 bit `{}`", i),
+ Unexpected::I16(i) => write!(f, "integer 16 bit `{}`", i),
+ Unexpected::I32(i) => write!(f, "integer 32 bit `{}`", i),
+ Unexpected::I64(i) => write!(f, "integer 64 bit `{}`", i),
+ Unexpected::I128(i) => write!(f, "integer 128 bit `{}`", i),
Unexpected::Float(v) => write!(f, "floating point `{}`", v),
Unexpected::Str(ref s) => write!(f, "string {:?}", s),
Unexpected::Unit => write!(f, "unit value"),