Skip to main content

oxilean_codegen/futhark_backend/
futharksliceexpr_traits.rs

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