Skip to main content

oxilean_codegen/futhark_backend/
futharkconst_traits.rs

1//! # FutharkConst - Trait Implementations
2//!
3//! This module contains trait implementations for `FutharkConst`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Display`
8//!
9//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
10
11use super::types::FutharkConst;
12use std::fmt;
13
14impl std::fmt::Display for FutharkConst {
15    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16        match self {
17            FutharkConst::I8(v) => write!(f, "{}i8", v),
18            FutharkConst::I16(v) => write!(f, "{}i16", v),
19            FutharkConst::I32(v) => write!(f, "{}i32", v),
20            FutharkConst::I64(v) => write!(f, "{}i64", v),
21            FutharkConst::U8(v) => write!(f, "{}u8", v),
22            FutharkConst::U16(v) => write!(f, "{}u16", v),
23            FutharkConst::U32(v) => write!(f, "{}u32", v),
24            FutharkConst::U64(v) => write!(f, "{}u64", v),
25            FutharkConst::F16(v) => write!(f, "{}f16", v),
26            FutharkConst::F32(v) => write!(f, "{}f32", v),
27            FutharkConst::F64(v) => write!(f, "{}f64", v),
28            FutharkConst::Bool(v) => write!(f, "{}", if *v { "true" } else { "false" }),
29        }
30    }
31}