Skip to content

Documentation addition request #92276

Description

@alper

I'm trying to implement Debug occasionally, then I hit this page:
https://doc.rust-lang.org/stable/core/fmt/trait.Debug.html

The examples on that page do not contain something that uses write! so I usually google my way to the same SO answer: https://stackoverflow.com/a/22243806/102315

Could the documentation there be expanded to add this?

Activity

  1. sfackler commented on Dec 25, 2021

    @sfackler
    Member

    The standard way to implement debug is to use the debug builders fmt.debug_struct(..), which is documented there.

  2. BGR360 commented on Dec 26, 2021

    @BGR360
    Contributor

    I think this is a very reasonable ask. It doesn't make much sense to use the debug builders for very simple implementations of Debug, and for those just starting out, and the importance of using the builders for more complicated Debug impls is minimal.

    @alper you'd be welcome to submit a PR with a proposed example! You just need to edit the rustdoc comment for Debug:

    /// `?` formatting.

    @rustbot label +T-libs A-docs +E-easy

  3. added
    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools
    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
    T-docs-rsRelevant to the docs-rs subteam, which will review and decide on the PR/issue.
    T-libsRelevant to the library team, which will review and decide on the PR/issue.
    and removed
    T-docs-rsRelevant to the docs-rs subteam, which will review and decide on the PR/issue.
    on Dec 26, 2021
  4. alper commented on Dec 27, 2021

    @alper
    Author

    Thanks, @BGR360! My PR is linked above.

  5. added 3 commits that reference this issue on Jan 4, 2022
  6. alper commented on Jan 5, 2022

    @alper
    Author

    Thanks for the prodding. My change has now been merged. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions