use crate::ffi::OsString;
use crate::fmt;
use crate::mem::size_of;
use crate::str::FromStr;

#[allow(dead_code)]
#[derive(Clone)]
pub struct Args {
    iter: crate::slice::Iter<'static, &'static str>,
}

pub fn args() -> Args {
    unsafe { Args { iter: super::ARGS.assume_init_ref().iter() } }
}

impl fmt::Debug for Args {
    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
        todo!()
    }
}

impl Iterator for Args {
    type Item = OsString;

    fn next(&mut self) -> Option<Self::Item> {
        let item = self.iter.next()?;
        let os_str = OsString::from_str(item).unwrap();
        Some(os_str)
    }
}

impl ExactSizeIterator for Args {
    fn len(&self) -> usize {
        self.iter.len()
    }
}

impl DoubleEndedIterator for Args {
    fn next_back(&mut self) -> Option<Self::Item> {
        todo!()
    }
}
