use std::collections::{BTreeMap, HashMap};
use std::ffi::OsString;
use wildmatch::WildMatch;
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub(super) struct CaseFoldedText(pub(super) Vec<Vec<char>>);
#[derive(Debug, Clone)]
pub struct EnvironmentSpec {
pub(super) base: EnvironmentBase,
pub(super) overrides: BTreeMap<OsString, EnvironmentOverride>,
pub(super) override_names: HashMap<EnvironmentNameKey, OsString>,
pub(super) filters: BTreeMap<EnvironmentPattern, EnvironmentFilterAction>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct EnvironmentInput {
pub(super) base: EnvironmentBase,
pub(super) variables: BTreeMap<OsString, OsString>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CoreEnvironment {
pub(super) variables: BTreeMap<OsString, OsString>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum EnvironmentOverride {
Set(OsString),
Remove,
}
#[derive(Debug, Clone)]
pub struct EnvironmentPattern {
pub(super) original: String,
pub(super) canonical: CaseFoldedText,
pub(super) matcher: WildMatch,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct EnvironmentNameKey(pub(super) EnvironmentNameIdentity);
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub(super) enum EnvironmentNameIdentity {
Folded(CaseFoldedText),
#[cfg(unix)]
NativeBytes(Vec<u8>),
#[cfg(windows)]
NativeWide(Vec<u16>),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum EnvironmentFilterAction {
Include,
Exclude,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum EnvironmentBase {
All,
Core,
None,
}