pub enum HostError {
Error(Box<dyn Error + 'static>),
Message(&'static str),
}Expand description
A generic, type-erased error type for host-originating errors.
Errors are type-erased because the CLAP API does not support extracting error information from a plugin or host, only that an error happened.
Errors originating from a user-provided host callback implementation are simply logged through
the host’s provided logging facilities if available, or the standard error output (stderr)
if not.
This error can be constructed either from any existing Error type, or from an arbitrary
error message.
§Example
use std::io;
use clack_host::prelude::HostError;
fn foo () -> io::Result<()> {
/* ... */
}
fn perform(valid: bool) -> Result<(), HostError> {
if !valid {
return Err(HostError::Message("Invalid value"))
}
/* ... */
foo()?;
/* ... */
Ok(())
}Variants§
Error(Box<dyn Error + 'static>)
A generic, type-erased error.
Message(&'static str)
A constant string message to be displayed.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for HostError
impl !Send for HostError
impl !Sync for HostError
impl !UnwindSafe for HostError
impl Freeze for HostError
impl Unpin for HostError
impl UnsafeUnpin for HostError
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