mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 18:31:52 +00:00
fix for volumeid serializer
This commit is contained in:
committed by
Aiden McClelland
parent
1f48fcfb97
commit
a8db75099b
@@ -17,10 +17,8 @@ pub mod disk;
|
||||
pub const PKG_VOLUME_DIR: &'static str = "/mnt/embassy-os/volumes/package-data";
|
||||
pub const BACKUP_DIR: &'static str = "/mnt/embassy-os-backups/EmbassyBackups";
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize)]
|
||||
#[serde(untagged)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum VolumeId<S: AsRef<str> = String> {
|
||||
#[serde(rename = "BACKUP")]
|
||||
Backup,
|
||||
Custom(Id<S>),
|
||||
}
|
||||
@@ -66,6 +64,14 @@ where
|
||||
})
|
||||
}
|
||||
}
|
||||
impl<S: AsRef<str>> Serialize for VolumeId<S> {
|
||||
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
|
||||
where
|
||||
Ser: serde::Serializer,
|
||||
{
|
||||
serializer.serialize_str(self.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
pub struct Volumes(IndexMap<VolumeId, Volume>);
|
||||
|
||||
Reference in New Issue
Block a user