kjson 0.0.8

A lightweight JSON parser intended for educational use and learning purposes.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::fmt::Display;

#[derive(Debug, PartialEq)]
pub enum Number {
    Int(i64),
    Float(f64),
}

impl Display for Number {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Number::Int(n) => n.fmt(f),
            Number::Float(n) => n.fmt(f),
        }
    }
}