Skip to main content

oxilean_codegen/c_backend/
cunaryop_traits.rs

1//! # CUnaryOp - Trait Implementations
2//!
3//! This module contains trait implementations for `CUnaryOp`.
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::CUnaryOp;
14use std::fmt;
15
16impl fmt::Display for CUnaryOp {
17    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18        match self {
19            CUnaryOp::Neg => write!(f, "-"),
20            CUnaryOp::Not => write!(f, "!"),
21            CUnaryOp::BitNot => write!(f, "~"),
22            CUnaryOp::Deref => write!(f, "*"),
23            CUnaryOp::AddrOf => write!(f, "&"),
24        }
25    }
26}