Skip to main content

oxilean_codegen/wasm_backend/
wasmglobal_traits.rs

1//! # WasmGlobal - Trait Implementations
2//!
3//! This module contains trait implementations for `WasmGlobal`.
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::WasmGlobal;
14use std::fmt;
15
16impl fmt::Display for WasmGlobal {
17    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18        if self.mutable {
19            write!(
20                f,
21                "  (global ${} (mut {}) ({}.const {}))",
22                self.name, self.ty, self.ty, self.init_value
23            )
24        } else {
25            write!(
26                f,
27                "  (global ${} {} ({}.const {}))",
28                self.name, self.ty, self.ty, self.init_value
29            )
30        }
31    }
32}