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

Implement ToString for ImageIndex, ImageManifest, and ImageConfiguration #109

Merged
merged 2 commits into from
Jul 28, 2022

Conversation

termoshtt
Copy link
Contributor

This PR adds

  • to_string and to_string_pretty for three structs listed on title implementing to_writer
    • We can do same thing like
      let image_manifest = ImageManifest::from_file("manifest.json").unwrap();
      let mut out = String::new();
      image_manifest.to_writer(out.as_bytes_mut()).unwrap();
      but to_string is rather simple like to_file is.
  • Implement ToString for them
    • Although implementing Display is preferred generally, we cannot avoid twice allocating memory when auto-implementing ToString through Display.

Signed-off-by: Toshiki Teramura <toshiki.teramura@gmail.com>
Signed-off-by: Toshiki Teramura <toshiki.teramura@gmail.com>
@termoshtt
Copy link
Contributor Author

Force pushed to fix DCO check.

@codecov-commenter
Copy link

Codecov Report

Merging #109 (9885d3d) into main (a4e74fa) will increase coverage by 0.58%.
The diff coverage is 34.00%.

@@            Coverage Diff             @@
##             main     #109      +/-   ##
==========================================
+ Coverage   23.56%   24.15%   +0.58%     
==========================================
  Files          20       20              
  Lines        1515     1565      +50     
  Branches      741      768      +27     
==========================================
+ Hits          357      378      +21     
- Misses        514      523       +9     
- Partials      644      664      +20     

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

LGTM, @utam0k PTAL

Copy link
Member

@utam0k utam0k left a comment

Choose a reason for hiding this comment

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

@termoshtt 💯 Thanks!

@utam0k utam0k merged commit 407ef28 into containers:main Jul 28, 2022
@termoshtt termoshtt deleted the to_string branch July 28, 2022 13:41
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.

4 participants