mirror of
https://github.com/MorizzG/rlox.git
synced 2025-12-06 04:12:42 +00:00
17 lines
364 B
Rust
17 lines
364 B
Rust
use std::fmt::Display;
|
|
|
|
#[derive(Debug, Default, Clone, PartialEq)]
|
|
pub enum Value {
|
|
#[default]
|
|
Nil,
|
|
Number(f64),
|
|
}
|
|
|
|
impl Display for Value {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
match self {
|
|
Value::Nil => write!(f, "nil"),
|
|
Value::Number(num) => write!(f, "{num}"),
|
|
}
|
|
}
|
|
}
|