Skip to main content

oxilean_runtime/bytecode_interp/
stackvalue_traits.rs

1//! # StackValue - Trait Implementations
2//!
3//! This module contains trait implementations for `StackValue`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Display`
8//!
9//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
10
11use super::types::StackValue;
12use std::fmt;
13
14impl std::fmt::Display for StackValue {
15    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16        match self {
17            StackValue::Nat(n) => write!(f, "{}", n),
18            StackValue::Int(i) => write!(f, "{}", i),
19            StackValue::Bool(b) => write!(f, "{}", b),
20            StackValue::Str(s) => write!(f, "{:?}", s),
21            StackValue::Closure { .. } => write!(f, "<closure>"),
22            StackValue::Nil => write!(f, "nil"),
23        }
24    }
25}