use std::{borrow::Cow, io};
use crate::{Entry, IoStreamError, format::Format};
pub trait SampledFormat: Format {
fn format_with_sample_rate(
&mut self,
entry: &impl Entry,
output: &mut impl io::Write,
rate: f32,
) -> Result<(), IoStreamError>;
}
#[diagnostic::on_unimplemented(
message = "`{Self}` cannot be used as a sample group",
note = "sample groups must implement `SampleGroup`",
note = "consider using `&'static str` instead of `String`, or make a new type that implements `SampleGroup`"
)]
pub trait SampleGroup {
fn as_sample_group(&self) -> Cow<'static, str>;
}
impl SampleGroup for &'static str {
fn as_sample_group(&self) -> Cow<'static, str> {
Cow::Borrowed(self)
}
}