Fix some things being strings
This commit is contained in:
parent
43a6cef421
commit
0adf3df830
32
src/main.rs
32
src/main.rs
@ -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>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where S: Serializer {
|
where S: Serializer {
|
||||||
let mut state = serializer.serialize_struct("Env", 6)?;
|
let mut state = serializer.serialize_struct("Env", 6)?;
|
||||||
@ -370,18 +385,3 @@ fn configuration() -> Flags {
|
|||||||
}
|
}
|
||||||
default
|
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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user