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

Proper unit and newtype_variant support #2

Closed
du-toit opened this issue Apr 21, 2022 · 1 comment · Fixed by #13
Closed

Proper unit and newtype_variant support #2

du-toit opened this issue Apr 21, 2022 · 1 comment · Fixed by #13
Labels
bug Unintended or undesired behavior.

Comments

@du-toit
Copy link
Owner

du-toit commented Apr 21, 2022

As of now, the library does not properly serialize or deserialize unit structs, unit variants, new type structs or new type variants:

fn serialize_unit_struct(
    self,
    _: &'static str,
) -> Result<Self::Ok, Self::Error> {
    Ok(())
}

fn serialize_unit_variant(
    self,
    _: &'static str,
    _: u32,
    _: &'static str,
) -> Result<Self::Ok, Self::Error> {
    Ok(())
}

fn serialize_newtype_struct<T: ?Sized>(
    self,
    _: &'static str,
    _: &T,
) -> Result<Self::Ok, Self::Error>
where
    T: serde::Serialize,
{
    Ok(())
}

fn serialize_newtype_variant<T: ?Sized>(
    self,
    _: &'static str,
    _: u32,
    _: &'static str,
    _: &T,
) -> Result<Self::Ok, Self::Error>
where
    T: serde::Serialize,
{
    Ok(())
}

This is considered a bug and should be fixed accordingly.

@du-toit du-toit added the bug Unintended or undesired behavior. label Apr 21, 2022
@du-toit
Copy link
Owner Author

du-toit commented Apr 21, 2022

#4 Fixes both serialize_unit_struct and serialize_newtype_struct but the other two will be fixed when we have enum support, so I'm keeping this issue open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unintended or undesired behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant