homework: add method to retrieve device to house and implement From trait for PowerSocket and Thermometer

This commit is contained in:
5 changed files with 68 additions and 10 deletions

View File

@@ -30,6 +30,18 @@ impl Device {
}
}
impl From<super::Thermometer> for Device {
fn from(value: super::Thermometer) -> Self {
Device::Thermometer(value)
}
}
impl From<super::PowerSocket> for Device {
fn from(value: super::PowerSocket) -> Self {
Device::PowerSocket(value)
}
}
#[cfg(test)]
mod tests {
use super::*;