Skip to main content

oxilean_codegen/lua_backend/
luatablefield_traits.rs

1//! # LuaTableField - Trait Implementations
2//!
3//! This module contains trait implementations for `LuaTableField`.
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::LuaTableField;
14use std::fmt;
15
16impl fmt::Display for LuaTableField {
17    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18        match self {
19            LuaTableField::ArrayItem(expr) => write!(f, "{}", expr),
20            LuaTableField::NamedField(key, val) => write!(f, "{} = {}", key, val),
21            LuaTableField::IndexedField(key, val) => write!(f, "[{}] = {}", key, val),
22        }
23    }
24}