use std::ffi::OsString; use crate::{Session, State}; pub struct HostName(OsString); impl HostName { pub fn get() -> Result { hostname::get().map(Self) } } impl IntoIterator for HostName { type Item = Session; type IntoIter = std::option::IntoIter; fn into_iter(self) -> Self::IntoIter { Some(Session { name: self.0.to_string_lossy().into(), state: State::LocalHost, }) .into_iter() } }