homework: add method to retrieve device to house and implement From trait for PowerSocket and Thermometer
This commit is contained in:
@@ -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::*;
|
||||
|
||||
Reference in New Issue
Block a user