#[non_exhaustive]pub enum PhosttError {
ModelLoad(String),
Inference(String),
InvalidAudio(String),
Io(Error),
}Expand description
Errors returned by phostt public API methods.
This enum covers the main failure categories:
- Model loading failures (
ModelLoad) - Runtime inference errors (
Inference) - Invalid audio input (
InvalidAudio) - Filesystem / I/O errors (
Io)
§Matching on errors
ⓘ
use phostt::error::PhosttError;
match err {
PhosttError::ModelLoad(msg) => eprintln!("Model problem: {msg}"),
PhosttError::Inference(msg) => eprintln!("Inference failed: {msg}"),
PhosttError::InvalidAudio(msg) => eprintln!("Bad audio: {msg}"),
PhosttError::Io(e) => eprintln!("I/O error: {e}"),
_ => eprintln!("Other error"),
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
ModelLoad(String)
Model files not found or failed to load ONNX sessions.
Inference(String)
ONNX inference failed during encode, decode, or join.
InvalidAudio(String)
Invalid audio input (unsupported format, excessive duration, corrupt data).
Io(Error)
Filesystem or I/O error.
Trait Implementations§
Source§impl Debug for PhosttError
impl Debug for PhosttError
Source§impl Display for PhosttError
impl Display for PhosttError
Source§impl Error for PhosttError
impl Error for PhosttError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for PhosttError
impl !UnwindSafe for PhosttError
impl Freeze for PhosttError
impl Send for PhosttError
impl Sync for PhosttError
impl Unpin for PhosttError
impl UnsafeUnpin for PhosttError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more