1use std::fmt;
7
8#[repr(C)]
12#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
13pub enum BbxError {
14 Ok = 0,
16 NullPointer = 1,
18 InvalidParameter = 2,
20 InvalidBufferSize = 3,
22 GraphNotPrepared = 4,
24 AllocationFailed = 5,
26}
27
28impl fmt::Display for BbxError {
29 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30 match self {
31 BbxError::Ok => write!(f, "no error"),
32 BbxError::NullPointer => write!(f, "null pointer"),
33 BbxError::InvalidParameter => write!(f, "invalid parameter"),
34 BbxError::InvalidBufferSize => write!(f, "invalid buffer size"),
35 BbxError::GraphNotPrepared => write!(f, "graph not prepared"),
36 BbxError::AllocationFailed => write!(f, "allocation failed"),
37 }
38 }
39}
40
41impl std::error::Error for BbxError {}
42
43pub type Result<T> = std::result::Result<T, BbxError>;