Skip to main content

flash_map/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum FlashMapError {
5    #[error("CUDA initialization failed: {0}")]
6    CudaInit(String),
7
8    #[error("GPU memory allocation failed: {0}")]
9    GpuAlloc(String),
10
11    #[error("kernel launch failed: {0}")]
12    KernelLaunch(String),
13
14    #[error("host-device transfer failed: {0}")]
15    Transfer(String),
16
17    #[error(
18        "table full: {occupied} occupied of {capacity} capacity (load factor {load_factor:.1}%)"
19    )]
20    TableFull {
21        occupied: usize,
22        capacity: usize,
23        load_factor: f64,
24    },
25
26    #[error("capacity must be positive")]
27    ZeroCapacity,
28
29    #[error("no backend available: enable 'cuda' or 'rayon' feature")]
30    NoBackend,
31
32    #[error("device-resident API requires GPU backend (currently using Rayon)")]
33    GpuRequired,
34
35    #[error("internal lock poisoned")]
36    LockPoisoned,
37
38    #[error("async task join failed: {0}")]
39    AsyncJoin(String),
40}