Skip to content

Commit

Permalink
ndk: Add missing brackets to linkes to functions in doc-comments in n…
Browse files Browse the repository at this point in the history
…dk::midi
  • Loading branch information
paxbun committed Aug 17, 2023
1 parent 802ab4a commit ae23031
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions ndk/src/midi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl MidiDevice {

/// Opens the input port so that the client can send data to it. Note that the returned
/// [`MidiInputPort`] is intentionally `!Send` and `!Sync`; please use
/// [`safe::SafeMidiDevice::open_safe_input_port`] if you need the thread-safe version.
/// [`safe::SafeMidiDevice::open_safe_input_port()`] if you need the thread-safe version.
pub fn open_input_port(&self, port_number: i32) -> Result<MidiInputPort<'_>> {
unsafe {
let input_port =
Expand All @@ -169,7 +169,7 @@ impl MidiDevice {

/// Opens the output port so that the client can receive data from it. Note that the returned
/// [`MidiOutputPort`] is intentionally `!Send` and `!Sync`; please use
/// [`safe::SafeMidiDevice::open_safe_output_port`] if you need the thread-safe version.
/// [`safe::SafeMidiDevice::open_safe_output_port()`] if you need the thread-safe version.
pub fn open_output_port(&self, port_number: i32) -> Result<MidiOutputPort<'_>> {
unsafe {
let output_port =
Expand All @@ -189,7 +189,7 @@ impl Drop for MidiDevice {
}

/// A wrapper over [`ffi::AMidiInputPort`]. Note that [`MidiInputPort`] is intentionally `!Send` and
/// `!Sync`; please use [`safe::SafeMidiDevice::open_safe_input_port`] if you need the thread-safe
/// `!Sync`; please use [`safe::SafeMidiDevice::open_safe_input_port()`] if you need the thread-safe
/// version.
pub struct MidiInputPort<'a> {
ptr: NonNull<ffi::AMidiInputPort>,
Expand Down Expand Up @@ -280,7 +280,7 @@ impl<'a> Drop for MidiInputPort<'a> {
}

/// A wrapper over [`ffi::AMidiOutputPort`]. Note that [`MidiOutputPort`] is intentionally `!Send`
/// and `!Sync`; please use [`safe::SafeMidiDevice::open_safe_output_port`] if you need the
/// and `!Sync`; please use [`safe::SafeMidiDevice::open_safe_output_port()`] if you need the
/// thread-safe version.
pub struct MidiOutputPort<'a> {
ptr: NonNull<ffi::AMidiOutputPort>,
Expand Down
8 changes: 4 additions & 4 deletions ndk/src/midi/safe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
//! the Java VM when being dropped, which is required by [`AMidiDevice_release`]. All other types
//! of this module holds an [`Arc`] of `SafeMidiDeviceBox`.
//!
//! Note that all other functions except for [`AMidiDevice_fromJava`] and [`AMidiDevice_release`]
//! are safe to be called in any thread without the calling thread attached to the Java VM.
//! Note that all other functions except for [`ffi::AMidiDevice_fromJava()`] and
//! [`ffi::AMidiDevice_release()`] are safe to be called in any thread without the calling thread
//! attached to the Java VM.
//!
//! [`AMidiDevice`]: https://developer.android.com/ndk/reference/group/midi#amididevice
//! [`AMidiDevice_release`]: https://developer.android.com/ndk/reference/group/midi#amididevice_release
//! [`AMidiInputPort`]: https://developer.android.com/ndk/reference/group/midi#amidiinputport
//! [`AMidiOutputPort`]: https://developer.android.com/ndk/reference/group/midi#amidioutputport

Expand All @@ -27,7 +27,7 @@ use super::*;
/// [`MidiDevice`] is not dropped while the safe wrappers are alive.
///
/// [`SafeMidiDeviceBox`] also holds a pointer to the current Java VM to attach the calling thread
/// of [`Drop::drop`] to the VM, which is required by [`ffi::AMidiDevice_release`].
/// of [`Drop::drop`] to the VM, which is required by [`ffi::AMidiDevice_release()`].

This comment has been minimized.

Copy link
@MarijnS95

MarijnS95 Aug 17, 2023

Member

Drop::drop()? Or just drop() or just Drop?

This comment has been minimized.

Copy link
@paxbun

paxbun Aug 17, 2023

Author Contributor

As you may already know, it's <SafeMidiDeviceBox as Drop>::drop(), I just don't know how to make a link to that specific implementation, or can I just don't add a hyperlink to it?

This comment has been minimized.

Copy link
@MarijnS95

MarijnS95 Aug 17, 2023

Member

Well, [`SafeMidiDeviceBox::drop()`] should be working, and it is right?

You can test this locally with:

RUSTDOCFLAGS="-Dwarnings --cfg docsrs" cargo +nightly doc --no-deps --workspace --target aarch64-linux-android --all-features --document-private-items --open

Assuming you have

rustup toolchain add nightly --target aarch64-linux-android

This comment has been minimized.

Copy link
@paxbun

paxbun Aug 17, 2023

Author Contributor

Sorry for making you check that little detail; it works.

struct SafeMidiDeviceBox {
midi_device: ManuallyDrop<MidiDevice>,
java_vm: NonNull<jni_sys::JavaVM>,
Expand Down

0 comments on commit ae23031

Please sign in to comment.