summaryrefslogtreecommitdiffstats
path: root/src/localhost.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/localhost.rs')
-rw-r--r--src/localhost.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/localhost.rs b/src/localhost.rs
index 45b14de..2115465 100644
--- a/src/localhost.rs
+++ b/src/localhost.rs
@@ -10,16 +10,21 @@ impl HostName {
}
}
+impl From<HostName> for Session {
+ fn from(value: HostName) -> Self {
+ Session {
+ name: value.0.to_string_lossy().into(),
+ state: State::LocalHost,
+ }
+ }
+}
+
impl IntoIterator for HostName {
type Item = Session;
type IntoIter = std::option::IntoIter<Session>;
fn into_iter(self) -> Self::IntoIter {
- Some(Session {
- name: self.0.to_string_lossy().into(),
- state: State::LocalHost,
- })
- .into_iter()
+ Some(self.into()).into_iter()
}
}