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 post on the #![doc = include_str!("")] pattern #55

Merged
merged 6 commits into from
Jun 28, 2024

Conversation

DJMcNab
Copy link
Member

@DJMcNab DJMcNab commented Jun 14, 2024

This is a trick I invented? discovered? stumbled upon? whilst creating Android Trace, and thought it was worth documenting; I believe that we should use this throughout our crates. It's currently used in Android Trace and Xilem Core

Depends on linebender/android_trace#11 because of the example; I want to wait until I have done a patch release of Android Trace before publishing

Unblocked

@PoignardAzur
Copy link
Contributor

It's a neat trick, but I'm not super comfortable with the amount of workarounds it introduces.

I'd rather copy-paste the same doc twice, and maybe use some sort of automated tool to check that the README and the root doc match.

@DJMcNab
Copy link
Member Author

DJMcNab commented Jun 18, 2024

As in my conclusion, my point with this pattern is not that it's necessarily the best possible status quo; maintaining docs tailored for each is best. But, I think:

  • If you're copying and pasting docs, they are inevitably not going to keep in sync
  • unless you have that being validated, which requires tooling that we don't have

And so for the stage in their lifecycle that our projects are at (and which I would argue many projects are at), I believe these workarounds are worthwhile. That is, the status quo is not ideal, and I think that this is an easy way to get to a better set of tradeoffs.

Copy link

@Philipp-M Philipp-M left a comment

Choose a reason for hiding this comment

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

Sorry that this hasn't got attention, IIRC there wasn't really reluctance in previous office hours, so I'll just approve it.

The pattern is obviously not perfect, but I like having to maintain only a single source of truth (with a few gotchas). And I've actually used it now in xilem_web too.

Copy link

@Philipp-M Philipp-M left a comment

Choose a reason for hiding this comment

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

Still LGTM with the new changes.

@DJMcNab DJMcNab changed the title Add post on our #![doc = include_str!("")] pattern Add post on the #![doc = include_str!("")] pattern Jun 28, 2024
@DJMcNab
Copy link
Member Author

DJMcNab commented Jun 28, 2024

I'm merging. This isn't a commitment for us to use this pattern, and I'd happily move to something better. But I think it's a pattern which is worth publicizing

@DJMcNab DJMcNab merged commit bb07001 into linebender:main Jun 28, 2024
1 check passed
@DJMcNab DJMcNab deleted the includoc branch June 28, 2024 12:40
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