use std::collections::HashMap;
use std::path::PathBuf;
#[derive(Debug, Clone)]
pub struct ParseOptions {
pub resolve_substitutions: bool,
pub origin_description: Option<String>,
pub(crate) base_dir: Option<PathBuf>,
pub(crate) env: Option<HashMap<String, String>>,
}
impl ParseOptions {
pub fn defaults() -> Self {
ParseOptions {
resolve_substitutions: true,
origin_description: None,
base_dir: None,
env: None,
}
}
pub fn with_resolve_substitutions(mut self, b: bool) -> Self {
self.resolve_substitutions = b;
self
}
pub fn with_origin_description(mut self, s: String) -> Self {
self.origin_description = Some(s);
self
}
pub fn with_base_dir(mut self, p: PathBuf) -> Self {
self.base_dir = Some(p);
self
}
pub fn with_env(mut self, env: HashMap<String, String>) -> Self {
self.env = Some(env);
self
}
}
#[derive(Debug, Clone)]
pub struct ResolveOptions {
pub use_system_environment: bool,
pub allow_unresolved: bool,
}
impl ResolveOptions {
pub fn defaults() -> Self {
ResolveOptions {
use_system_environment: true,
allow_unresolved: false,
}
}
pub fn with_use_system_environment(mut self, b: bool) -> Self {
self.use_system_environment = b;
self
}
pub fn with_allow_unresolved(mut self, b: bool) -> Self {
self.allow_unresolved = b;
self
}
}