Skip to main content

oxilean_codegen/evm_backend/
yulfunction_traits.rs

1//! # YulFunction - Trait Implementations
2//!
3//! This module contains trait implementations for `YulFunction`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Display`
8//!
9//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
10
11use super::types::YulFunction;
12use std::fmt;
13
14impl std::fmt::Display for YulFunction {
15    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16        let params = self.params.join(", ");
17        let returns = if self.returns.is_empty() {
18            String::new()
19        } else {
20            format!(" -> {}", self.returns.join(", "))
21        };
22        write!(f, "function {}({}){}", self.name, params, returns)?;
23        write!(f, " {{")?;
24        for stmt in &self.body {
25            write!(f, "\n  {}", stmt)?;
26        }
27        write!(f, "\n}}")
28    }
29}