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

ndk: Add missing API levels, use intra-links in AAudio docs #108

Merged
merged 5 commits into from
Jan 9, 2021

Conversation

MarijnS95
Copy link
Member

@MarijnS95 MarijnS95 commented Jan 8, 2021

Following the removal of set_callback in #107 this re-introduces the "proper" doc (according to NDK docs) to AudioStreamDataCallback. At the same time the rest of the docs have been upgraded to use intra links (it is hard to resist: start cleaning up one line, but the rest can't be left behind; that'd be inconsistent).

Some names were broken or renamed in Rust, again signifying the relevance of proper doc links. Not only is it useful for readers to click through to a reference, it also ensures that reference is valid at build time making sure the documentation is useful at all times (yeah - you always end up grepping for that one function in the docs, frustrated that it doesn't seem to exist anywhere).

More importantly this adds missing features for API level 25, 27 and 28. 28 is used by AAudio and had me wonder why certain functions didn't show up in the docs even with all... 😬

Final note: Links are a bit inconsistent; some use the name of an enum variant (ie. [`Variant`](EnumType::Variant)), others use the full path including type (ie. [`EnumType::Variant`]). That should probably be cleaned up.

A bunch of AAudio functions use api-level-28 but this feature did not
exist.

For convenience add the missing 27 and 25 as well, in case new wrappers
are introduced that may also carry a bunch of functions introduced on
these levels. Now the supported list is linear.
@MarijnS95
Copy link
Member Author

it also ensures that reference is valid at build time

This is not the case currently. cargo check doesn't do it, and -D warnings cannot be passed to cargo doc. Any suggestions?

@msiglreith
Copy link
Contributor

This seems to be rust-lang/rust#79792
I guess we just keep it as is for now assuming this will be fixed in near future

This prevents ie. broken_intra_doc_links from ending up in the main
branch.
@MarijnS95
Copy link
Member Author

MarijnS95 commented Jan 9, 2021

@msiglreith Thanks! I wasn't aware of RUSTDOCFLAGS, but -Dwarnings catch broken_intra_doc_links just fine. We can leave this enabled and have more warnings (none of which are there currently 😬) be turned to errors over time.

Should we add more documentation checking to the CI? I guess ndk and ndk-glue are the most interesting for crate users, the latter which seems to contain no documentation whatsoever, not even on pub functions and types.

Nightly rustdoc warns/errors that these links are not converted to
hyperlinks (and thus not clickable in the web pages).

Note that the link to AudioTrack#write is broken; rustdoc rightfully
converts `[]` to `%5B%5D`, but android.com does not resolve that to the
right anchor.
@@ -92,7 +92,7 @@ pub enum AAudioFormat {
/// Values outside that range may be clipped.
///
/// See also 'floatData' at
/// https://developer.android.com/reference/android/media/AudioTrack#write(float[],%20int,%20int,%20int)
/// <https://developer.android.com/reference/android/media/AudioTrack#write(float[],%20int,%20int,%20int)>
Copy link
Member Author

Choose a reason for hiding this comment

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

Note that this link is broken; rustdoc rightfully converts [] to %5B%5D, but android.com does not resolve that to the right anchor.

@MarijnS95
Copy link
Member Author

Some flukes in the CI, GH actions' virtual environments are still at 1.48 and actions-rs/toolchain updates it to 1.49 on every job.

Copy link
Contributor

@msiglreith msiglreith left a comment

Choose a reason for hiding this comment

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

Thanks again!
CI support is nice and intra-doc links are really nice feature

@msiglreith msiglreith merged commit 7eb7f63 into rust-mobile:master Jan 9, 2021
@MarijnS95 MarijnS95 deleted the ndk-docs branch January 9, 2021 15:49
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