#[cfg(feature = "frontend")]
use crate::SharedFiles;
use buildsrs_database::AnyMetadata;
use buildsrs_storage::AnyStorage;
#[derive(Clone, Debug)]
pub struct Backend {
database: AnyMetadata,
storage: AnyStorage,
#[cfg(feature = "frontend")]
frontend: SharedFiles,
}
impl Backend {
pub fn new(database: AnyMetadata, storage: AnyStorage) -> Self {
Backend {
database,
storage,
#[cfg(feature = "frontend")]
frontend: Default::default(),
}
}
#[cfg(feature = "frontend")]
#[must_use]
pub fn with_frontend(self, frontend: SharedFiles) -> Self {
Self { frontend, ..self }
}
#[cfg(feature = "frontend")]
pub fn frontend(&self) -> &SharedFiles {
&self.frontend
}
pub fn database(&self) -> &AnyMetadata {
&self.database
}
pub fn storage(&self) -> &AnyStorage {
&self.storage
}
}