std/sys/env/
common.rs

1use crate::ffi::OsString;
2use crate::{fmt, vec};
3
4pub struct Env {
5    iter: vec::IntoIter<(OsString, OsString)>,
6}
7
8impl Env {
9    pub(super) fn new(env: Vec<(OsString, OsString)>) -> Self {
10        Env { iter: env.into_iter() }
11    }
12}
13
14impl fmt::Debug for Env {
15    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16        f.debug_list().entries(self.iter.as_slice()).finish()
17    }
18}
19
20impl !Send for Env {}
21impl !Sync for Env {}
22
23impl Iterator for Env {
24    type Item = (OsString, OsString);
25    fn next(&mut self) -> Option<(OsString, OsString)> {
26        self.iter.next()
27    }
28    fn size_hint(&self) -> (usize, Option<usize>) {
29        self.iter.size_hint()
30    }
31}