use std::time::Duration;
#[cfg(feature = "audio")]
use rodio::{OutputStream, OutputStreamHandle, Sink};
pub type Res<T> = anyhow::Result<T>;
pub type Err = anyhow::Error;
pub type Void = Res<()>;
pub trait HasStaticName {
fn static_name(&self) -> &'static str;
}
pub trait HasName {
fn name(&self) -> String;
}
pub trait HasPreciseName {
fn precise_name(&self) -> String;
}
pub trait HasDescription {
fn description(&self) -> &'static str;
}
pub trait Parsable {
fn parse(symbol: &str) -> Res<Self>
where
Self: Sized;
}
#[cfg(feature = "audio")]
pub struct PlaybackHandle {
_stream: OutputStream,
_stream_handle: OutputStreamHandle,
_sinks: Vec<Sink>,
}
#[cfg(feature = "audio")]
impl PlaybackHandle {
pub fn new(stream: OutputStream, stream_handle: OutputStreamHandle, sinks: Vec<Sink>) -> Self {
Self {
_stream: stream,
_stream_handle: stream_handle,
_sinks: sinks,
}
}
}
#[cfg(feature = "audio")]
pub trait Playable {
#[must_use = "Dropping the PlayableResult will stop the playback."]
fn play(&self, delay: Duration, length: Duration, fade_in: Duration) -> Res<PlaybackHandle>;
}