Fix some things being strings

This commit is contained in:
Alexander Rosenberg 2024-04-26 21:22:19 -07:00
parent 43a6cef421
commit 0adf3df830
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

View File

@ -68,7 +68,22 @@ impl Env {
}
}
impl serde::Serialize for Env {
impl Serialize for Tags {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let mut seq = serializer.serialize_seq(Some(self.0.count_ones() as usize))?;
for i in 0..32 {
if self.0 >> i & 1 == 1 {
seq.serialize_element(&(i + 1))?;
}
}
seq.end()
}
}
impl Serialize for Env {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer {
let mut state = serializer.serialize_struct("Env", 6)?;
@ -370,18 +385,3 @@ fn configuration() -> Flags {
}
default
}
impl Serialize for Tags {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let mut seq = serializer.serialize_seq(Some(self.0.count_ones() as usize))?;
for i in 0..32 {
if self.0 >> i & 1 == 1 {
seq.serialize_element(&format!("{}", i + 1))?;
}
}
seq.end()
}
}