use crate::mode::Mode;
#[must_use]
#[derive(Debug)]
#[derive_const(Clone, Default)]
pub struct Builder {
pub sample_depth: Option<u32>,
pub channel_count: Option<u32>,
pub width: Option<u32>,
pub height: Option<u32>,
pub duration: Option<u64>,
}
impl Builder {
#[inline]
pub const fn new() -> Self {
Default::default()
}
#[inline]
pub const fn sample_depth(mut self, sample_depth: u32) -> Self {
assert!(
self.sample_depth.is_none(),
"sampling depth is already specified",
);
self.sample_depth = Some(sample_depth);
self
}
#[inline]
pub const fn channel_count(mut self, channel_count: u32) -> Self {
assert!(
self.channel_count.is_none(),
"channel count is already specified",
);
self.channel_count = Some(channel_count);
self
}
#[inline]
pub const fn width(mut self, width: u32) -> Self {
assert!(
self.width.is_none(),
"frame width is already specified",
);
self.width = Some(width);
self
}
#[inline]
pub const fn height(mut self, height: u32) -> Self {
assert!(
self.height.is_none(),
"frame height is already specified",
);
self.height = Some(height);
self
}
#[inline]
pub const fn duration(mut self, duration: u64) -> Self {
assert!(
self.duration.is_none(),
"frame height is already specified",
);
self.duration = Some(duration);
self
}
#[inline]
#[must_use]
pub const fn build(self) -> Mode {
Mode::from_builder(self)
}
}