use crate::config::{Builder, Format};
use crate::mode::{self, Mode};
#[derive(Debug)]
#[derive_const(Clone)]
pub struct Config {
pub sample_depth: u32,
pub channel_count: u32,
pub width: u32,
pub height: u32,
pub duration: u64,
pub frame_rate: u32,
pub format: Format,
}
impl Config {
#[must_use]
pub const fn from_builder(builder: Builder) -> Self {
let sample_depth = builder.sample_depth
.expect("expected sampling depth");
let channel_count = builder.channel_count
.expect("expected channel count");
let width = builder.width
.expect("expected frame width");
let height = builder.height
.expect("expected frame height");
let duration = builder.duration
.expect("expected render duration");
let frame_rate = builder.frame_rate
.expect("expected frame rate");
let format = builder.format
.expect("expected output format");
Self { sample_depth,channel_count, width, height, duration, frame_rate, format }
}
pub const fn build_mode(&self) -> Mode {
mode::Builder::new()
.sample_depth(self.sample_depth)
.channel_count(self.channel_count)
.width(self.width)
.height(self.height)
.duration(self.duration)
.build()
}
}