Skip to main content

oxilean_codegen/mlir_backend/
mlirblock_traits.rs

1//! # MlirBlock - Trait Implementations
2//!
3//! This module contains trait implementations for `MlirBlock`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Display`
8//!
9//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
10
11use super::types::MlirBlock;
12use std::fmt;
13
14impl fmt::Display for MlirBlock {
15    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16        if let Some(lbl) = &self.label {
17            write!(f, "^{}", lbl)?;
18            if !self.arguments.is_empty() {
19                write!(f, "(")?;
20                for (i, arg) in self.arguments.iter().enumerate() {
21                    if i > 0 {
22                        write!(f, ", ")?;
23                    }
24                    write!(f, "{}: {}", arg, arg.ty)?;
25                }
26                write!(f, ")")?;
27            }
28            writeln!(f, ":")?;
29        } else if !self.arguments.is_empty() {
30        }
31        for op in &self.body {
32            writeln!(f, "    {}", op)?;
33        }
34        Ok(())
35    }
36}