Improve controller endpoint and model

This commit is contained in:
Tobias Reisinger 2023-11-30 01:43:56 +01:00
parent 2f51ebf91e
commit 6400b7745c
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
5 changed files with 103 additions and 7 deletions

View file

@ -67,9 +67,12 @@ impl<'r> Decode<'r, Sqlite> for ControllerUid {
}
}
impl From<&str> for ControllerUid {
fn from(value: &str) -> Self {
Self(Uuid::from_str(value).unwrap())
impl TryFrom<&str> for ControllerUid {
type Error = uuid::Error;
fn try_from(value: &str) -> Result<Self, Self::Error> {
let uuid = Uuid::from_str(value)?;
Ok(Self(uuid))
}
}