Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serde.rs: fix serialize_struct field counts #1070

Merged
merged 1 commit into from
Sep 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl Serialize for crate::Cpu {
where
S: Serializer,
{
let mut state = serializer.serialize_struct("Cpu", 1)?;
let mut state = serializer.serialize_struct("Cpu", 5)?;

state.serialize_field("cpu_usage", &self.cpu_usage())?;
state.serialize_field("name", &self.name())?;
Expand All @@ -90,7 +90,7 @@ impl serde::Serialize for crate::System {
where
S: serde::Serializer,
{
let mut state = serializer.serialize_struct("System", 27)?;
let mut state = serializer.serialize_struct("System", 23)?;

state.serialize_field("IS_SUPPORTED", &<Self as SystemExt>::IS_SUPPORTED)?;
state.serialize_field("SUPPORTED_SIGNALS", <Self as SystemExt>::SUPPORTED_SIGNALS)?;
Expand Down Expand Up @@ -226,7 +226,7 @@ impl Serialize for crate::NetworkData {
where
S: Serializer,
{
let mut state = serializer.serialize_struct("NetworkData", 1)?;
let mut state = serializer.serialize_struct("NetworkData", 13)?;

state.serialize_field("received", &self.received())?;
state.serialize_field("total_received", &self.total_received())?;
Expand Down Expand Up @@ -273,7 +273,7 @@ impl Serialize for crate::User {
where
S: Serializer,
{
let mut state = serializer.serialize_struct("User", 1)?;
let mut state = serializer.serialize_struct("User", 4)?;

state.serialize_field("id", &self.id().to_string())?;

Expand All @@ -292,7 +292,7 @@ impl Serialize for crate::Group {
where
S: Serializer,
{
let mut state = serializer.serialize_struct("Group", 1)?;
let mut state = serializer.serialize_struct("Group", 2)?;

state.serialize_field("id", &self.id().to_string())?;
state.serialize_field("name", &self.name())?;
Expand Down