use strum_macros::{Display, EnumMessage};
use super::*;
#[derive(EnumMessage, Debug, Clone, Copy, Display, PartialEq)]
#[cfg_attr(feature = "python-bindings", pyclass)]
pub enum StreamStatus {
#[strum(message = "NotRunning", detailed_message = "Stream is not running")]
NotRunning {},
#[strum(message = "Running", detailed_message = "Stream is running")]
Running {},
#[strum(
message = "Error",
detailed_message = "An error occured with the stream"
)]
Error {
e: StreamError,
},
}
#[cfg(feature = "python-bindings")]
#[cfg_attr(feature = "python-bindings", pymethods)]
impl StreamStatus {
fn __eq__(&self, other: &Self) -> bool {
self == other
}
fn hasError(&self) -> bool {
matches!(self, StreamStatus::Error { .. })
}
fn getError(&self) -> Option<StreamError> {
use StreamStatus::*;
if let Error { e } = self {
return Some(*e);
}
None
}
}