#[non_exhaustive]pub struct XdgEnv { /* private fields */ }Expand description
Snapshot of the env vars the XDG cascade reads. Only xdg and
home matter; the cascade has no other inputs.
Fields are OsString (not String) because Unix paths are
byte-strings — a user with XDG_CACHE_HOME=/srv/café-bin in a
non-UTF-8 locale must not silently lose their setting. None and
empty-string both count as “not set” — the cascade treats them
the same. The XdgEnv::from_process_env factory normalizes at
the boundary so each call site doesn’t have to.
Implementations§
Source§impl XdgEnv
impl XdgEnv
Sourcepub fn from_process_env() -> Self
pub fn from_process_env() -> Self
Snapshot the three env vars from the running process, treating
empty strings as unset per the XDG spec. Non-UTF-8 values are
preserved; Option<OsString> carries them through to the
cascade unchanged.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for XdgEnv
impl RefUnwindSafe for XdgEnv
impl Send for XdgEnv
impl Sync for XdgEnv
impl Unpin for XdgEnv
impl UnsafeUnpin for XdgEnv
impl UnwindSafe for XdgEnv
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more