Skip to main content

oxiphysics_gpu/compute/
gpuerror_traits.rs

1//! # GpuError - Trait Implementations
2//!
3//! This module contains trait implementations for `GpuError`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Display`
8//!
9//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
10use super::types::GpuError;
11
12impl std::fmt::Display for GpuError {
13    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14        match self {
15            GpuError::InvalidBuffer(id) => write!(f, "invalid buffer id: {}", id.0),
16            GpuError::SizeMismatch { expected, got } => {
17                write!(f, "size mismatch: expected {expected}, got {got}")
18            }
19            GpuError::EmptyBuffer => write!(f, "reduction on empty buffer"),
20            GpuError::NotFound(name) => write!(f, "not found: {name}"),
21        }
22    }
23}