Skip to main content

oxilean_codegen/swift_backend/
swiftparam_traits.rs

1//! # SwiftParam - Trait Implementations
2//!
3//! This module contains trait implementations for `SwiftParam`.
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::SwiftParam;
14use std::fmt;
15
16impl fmt::Display for SwiftParam {
17    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18        if !self.label.is_empty() && self.label != self.name {
19            write!(f, "{} ", self.label)?;
20        }
21        if self.inout {
22            write!(f, "inout ")?;
23        }
24        write!(f, "{}: {}", self.name, self.ty)?;
25        if self.variadic {
26            write!(f, "...")?;
27        }
28        if let Some(ref default) = self.default {
29            write!(f, " = {}", default)?;
30        }
31        Ok(())
32    }
33}