mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-02 05:23:14 +00:00
add validation to s9pks
This commit is contained in:
committed by
Aiden McClelland
parent
2c17038b19
commit
08770567d2
@@ -1,5 +1,6 @@
|
||||
use std::borrow::{Borrow, Cow};
|
||||
use std::fmt::Debug;
|
||||
use std::str::FromStr;
|
||||
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
|
||||
@@ -158,6 +159,12 @@ impl<S: AsRef<str>> ImageId<S> {
|
||||
)
|
||||
}
|
||||
}
|
||||
impl FromStr for ImageId {
|
||||
type Err = InvalidId;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
Ok(ImageId(Id::try_from(s.to_owned())?))
|
||||
}
|
||||
}
|
||||
impl<'de, S> Deserialize<'de> for ImageId<S>
|
||||
where
|
||||
S: AsRef<str>,
|
||||
|
||||
Reference in New Issue
Block a user