use rustc_hash::FxHashSet;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Profile {
pub name: String,
pub debug_info: bool,
pub docs: bool,
pub exclude_attributes: FxHashSet<String>,
}
impl Default for Profile {
fn default() -> Self {
Self::prod()
}
}
impl Profile {
pub fn test() -> Self {
Self {
name: "test".to_string(),
debug_info: true,
docs: false,
exclude_attributes: Default::default(),
}
}
pub fn docs(tests: bool) -> Self {
let mut exclude_attributes = FxHashSet::default();
if !tests { exclude_attributes.insert("test".into()); }
Self {
name: "docs".to_string(),
debug_info: false,
docs: true,
exclude_attributes,
}
}
pub fn prod() -> Self {
let mut exclude_attributes = FxHashSet::default();
exclude_attributes.insert("test".into());
Self {
name: "prod".to_string(),
debug_info: false,
docs: false,
exclude_attributes,
}
}
}