use crate::engine::Engine;
#[derive(Clone, Debug)]
pub struct EngineBuilder {
app_id: Option<Box<str>>,
app_name: Option<Box<str>>,
}
impl EngineBuilder {
#[inline]
#[must_use]
pub(super) const fn new() -> Self {
Self {
app_id: None,
app_name: None,
}
}
#[inline]
#[must_use]
pub fn with_app_id(mut self, app_id: &str) -> Self {
self.app_id = Some(app_id.into());
self
}
#[inline]
#[must_use]
pub fn with_app_name(mut self, app_name: &str) -> Self {
self.app_name = Some(app_name.into());
self
}
#[inline]
#[must_use]
pub fn build(self) -> Engine {
let app_id = self
.app_id
.expect("cannot construct engine without application identifier");
let app_name = self
.app_name
.expect("cannot construct engine without application name");
Engine {
app_id,
app_name,
graphics: Default::default(),
}
}
}
impl Default for EngineBuilder {
#[inline]
fn default() -> Self {
Self::new()
}
}