use std::path::{Path, PathBuf};
#[derive(Clone, Debug, Hash)]
pub struct QmlFile {
path: PathBuf,
singleton: bool,
version: Option<(usize, usize)>,
}
impl<T: AsRef<Path>> From<T> for QmlFile {
fn from(path: T) -> Self {
Self {
path: path.as_ref().to_path_buf(),
singleton: false,
version: None,
}
}
}
impl QmlFile {
pub fn singleton(mut self, singleton: bool) -> Self {
self.singleton = singleton;
self
}
pub fn is_singleton(&self) -> bool {
self.singleton
}
pub fn get_path(&self) -> &Path {
&self.path
}
pub fn version(mut self, major: usize, minor: usize) -> Self {
self.version = Some((major, minor));
self
}
pub fn get_version(&self) -> Option<(usize, usize)> {
self.version
}
}