Add null driver
This commit is contained in:
parent
4ed1cd3182
commit
07d3322c5a
7 changed files with 58 additions and 28 deletions
emgauwa-controller/src
|
@ -2,8 +2,9 @@ use serde::{Deserialize, Deserializer};
|
|||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum Driver {
|
||||
Null,
|
||||
Gpio,
|
||||
Piface,
|
||||
PiFace,
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for Driver {
|
||||
|
@ -12,8 +13,9 @@ impl<'de> Deserialize<'de> for Driver {
|
|||
D: Deserializer<'de>,
|
||||
{
|
||||
match String::deserialize(deserializer)?.as_str() {
|
||||
"null" => Ok(Driver::Null),
|
||||
"gpio" => Ok(Driver::Gpio),
|
||||
"piface" => Ok(Driver::Piface),
|
||||
"piface" => Ok(Driver::PiFace),
|
||||
_ => Err(serde::de::Error::custom("invalid driver")),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue