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 rustdoc to connect crate #1455

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from

Conversation

photovoltex
Copy link
Member

@photovoltex photovoltex commented Jan 21, 2025

I think I initially tried to enforce rustdoc on the whole project, but that just is in insane task at this stage.

Well anyhow... I got around to add rustdoc for the connect crate and additionally a cleanup of the exposed items, so that only the necessary are exposed.

I also had to change up the CHANGELOG.md as some previous entries where are out of that with the cleanup changes.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 11 changed files in this pull request and generated 1 comment.

Files not reviewed (6)
  • CHANGELOG.md: Evaluated as low risk
  • connect/README.md: Evaluated as low risk
  • connect/src/lib.rs: Evaluated as low risk
  • connect/src/model.rs: Evaluated as low risk
  • connect/src/state/metadata.rs: Evaluated as low risk
  • src/main.rs: Evaluated as low risk

core/src/session.rs Outdated Show resolved Hide resolved
Copy link
Member

@roderickvd roderickvd left a comment

Choose a reason for hiding this comment

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

Quite the effort to get everything documented!

/// Represent an internal identifier from spotify.
///
/// ## Remarks:
/// Is not intended for usage, but required for parsing of some connect messages.
Copy link
Member

Choose a reason for hiding this comment

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

This one could then use a little more explanation on how/when/why to use SpotifyId instead.
Or maybe you can #[no_doc] this particular one? Don't know if that works.

Copy link
Member Author

@photovoltex photovoltex Jan 22, 2025

Choose a reason for hiding this comment

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

I think I could improve the docs a bit to explicitly lay out that this should never used by the user as it's not an id that can be acquired anyways. No documentation is probably not helpful when using it, as you could use it in the wrong way, I could look into if I maybe find a way to hide the exposed Uid part tho...


So from what I understand is a uid are separate identifier to a uri and the id of a item (usually the third part of the uri). It's only used by the clients of spotify and never retrievable by public endpoints. Mobile uses it extensively and it's determines the fancy visual what track currently plays.

That's the background. I think I also documented something about it in docs/dealer.md.

SpotifyId itself is at most part's not inclusive enough, there are some URI's I found that you can't really parse with the current implementation of SpotifyId such as the user collection or the search (both require strings to be saved). But that's related to #1266 so maybe we could tackle that part at some point.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added #[doc(hidden)] to the variant and improved the documentation anyways, so that it still make some sense to other devs later down the line :D

connect/src/spirc.rs Show resolved Hide resolved

/// Resumes the playback
///
/// ## Remarks:
Copy link
Member

Choose a reason for hiding this comment

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

I don't think "Remarks" is an idiomatic Rustdoc paragraph? For me you could just drop the paragraph title and keep the paragraph text underneath it as-is.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, I think I will do some research how to write better rustdoc and adjust the comments accordingly. The "Remarks" originates from a different language where you have separate section and it seems to fit as hint, but it could also be just a paragraph yeah :D

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed the "Remarks" sections and flattened it so that the remarks appear as paragraphs. There doesn't seem to be any real way to do it, besides the example sections which seemed to be pushed quite a bit.

@roderickvd roderickvd assigned photovoltex and unassigned roderickvd Jan 22, 2025
@roderickvd
Copy link
Member

When you're looking for anyone's review, you can specifically request / add them as reviewers and keep the assignee as yourself.

@photovoltex
Copy link
Member Author

When you're looking for anyone's review, you can specifically request / add them as reviewers and keep the assignee as yourself.

Okay will do! You just said in another message that I should assigning you, but I suppose I mistook assigning to the PR with review assigning.

@photovoltex
Copy link
Member Author

Oh and big thanks for the review @roderickvd :D

@photovoltex photovoltex force-pushed the connect-docs branch 2 times, most recently from fd6de96 to bed00a6 Compare January 23, 2025 20:56
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