Skip to content

Upgrade plist to 0.3 and take advantage of serde integration #181

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

Merged
merged 1 commit into from
Jun 29, 2018

Conversation

robinst
Copy link
Collaborator

@robinst robinst commented Jun 28, 2018

I noticed that plist comes with serde integration now, so we can just directly deserialize into the serde_json Value types using the magic of serde :).

Output of cargo update:

    Updating registry `https://github.com/rust-lang/crates.io-index`
    Updating base64 v0.8.0 -> v0.9.2
      Adding humantime v1.1.1
    Updating plist v0.2.4 -> v0.3.0

Plist::Integer(value) => Settings::Number(value.into()),
Plist::String(s) => Settings::String(s),
}
let settings = deserialize(reader)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or just:

Ok(deserialize(reader)?)

(okay either way obviously, just riffing)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, had that before, but then decided that having an extra variable reads a bit nicer because it removes the )?) 🤷‍♂️.

Copy link
Owner

@trishume trishume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎

@robinst robinst merged commit 99e4f73 into master Jun 29, 2018
@robinst robinst deleted the upgrade-plist branch June 29, 2018 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants