Skip to main content

oxiphysics_core/control_systems/
complex_traits.rs

1//! # Complex - Trait Implementations
2//!
3//! This module contains trait implementations for `Complex`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Display`
8//!
9//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
10
11#[allow(unused_imports)]
12use super::functions::*;
13use super::types::Complex;
14
15impl std::fmt::Display for Complex {
16    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17        if self.im >= 0.0 {
18            write!(f, "{:.4} + {:.4}j", self.re, self.im)
19        } else {
20            write!(f, "{:.4} - {:.4}j", self.re, -self.im)
21        }
22    }
23}