Skip to main content

oxilean_codegen/native_backend/
nativevalue_traits.rs

1//! # NativeValue - Trait Implementations
2//!
3//! This module contains trait implementations for `NativeValue`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Display`
8//!
9//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
10
11use crate::lcnf::*;
12
13use super::types::NativeValue;
14use std::fmt;
15
16impl fmt::Display for NativeValue {
17    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18        match self {
19            NativeValue::Reg(r) => write!(f, "{}", r),
20            NativeValue::Imm(n) => write!(f, "#{}", n),
21            NativeValue::FRef(name) => write!(f, "@{}", name),
22            NativeValue::StackSlot(slot) => write!(f, "ss{}", slot),
23            NativeValue::UImm(n) => write!(f, "#{}u", n),
24            NativeValue::StrRef(s) => write!(f, "{:?}", s),
25        }
26    }
27}