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

Add standalone derive example #15

Merged
merged 1 commit into from
Aug 29, 2023
Merged

Conversation

Gordon01
Copy link
Contributor

@Gordon01 Gordon01 commented Aug 28, 2023

Description

Since it's a serialization library, an example of how to use it to produce String is important.
serde_json has this:

    // Some data structure.
    let address = Address {
        street: "10 Downing Street".to_owned(),
        city: "London".to_owned(),
    };

    // Serialize it to a JSON string.
    let j = serde_json::to_string(&address)?;

    // Print, write to a file, or send to an HTTP server.
    println!("{}", j);

This PR adds such an example. As a bonus, this crate can now be used without Client for anything, that implements std::io::Write.

Related Issues

No previous issues reported.

Checklist

  • Code compiles correctly
  • Created tests which fail without the change (if possible)
  • All tests passing
  • This is a documentation

Clean example

Fixes

Add standalone derive example
@maxmindlin
Copy link
Owner

Thanks for the contribution! The linting error is unrelated to your changes.

@maxmindlin maxmindlin merged commit 9ef4507 into maxmindlin:master Aug 29, 2023
2 of 3 checks passed
@Gordon01
Copy link
Contributor Author

Thanks for a quick merge!

@Gordon01 Gordon01 mentioned this pull request Sep 5, 2023
6 tasks
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.

2 participants