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)
10
11#[allow(unused_imports)]
12use super::functions::*;
13use super::types::GpuError;
14
15impl std::fmt::Display for GpuError {
16    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17        match self {
18            GpuError::InvalidBuffer(id) => write!(f, "invalid buffer id: {}", id.0),
19            GpuError::SizeMismatch { expected, got } => {
20                write!(f, "size mismatch: expected {expected}, got {got}")
21            }
22            GpuError::EmptyBuffer => write!(f, "reduction on empty buffer"),
23            GpuError::NotFound(name) => write!(f, "not found: {name}"),
24        }
25    }
26}