From 243863cfb97eac5191e8d1e1c83423d2fa21c2bf Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Sat, 6 May 2023 18:12:20 +0200 Subject: [PATCH] Fixed wrong type quotations --- ctru-rs/src/console.rs | 2 +- ctru-rs/src/lib.rs | 7 ++-- ctru-rs/src/linear.rs | 2 +- ctru-rs/src/mii.rs | 2 +- ctru-rs/src/services/cam.rs | 60 +++++++++++++++---------------- ctru-rs/src/services/fs.rs | 38 ++++---------------- ctru-rs/src/services/gfx.rs | 15 ++++---- ctru-rs/src/services/ndsp/mod.rs | 26 +++++++------- ctru-rs/src/services/ndsp/wave.rs | 10 +++--- 9 files changed, 69 insertions(+), 93 deletions(-) diff --git a/ctru-rs/src/console.rs b/ctru-rs/src/console.rs index e3ba62e..bad114e 100644 --- a/ctru-rs/src/console.rs +++ b/ctru-rs/src/console.rs @@ -19,7 +19,7 @@ impl<'screen> Console<'screen> { /// /// # Notes /// - /// [Console] automatically takes care of flushing and swapping buffers for its screen when printing. + /// [`Console`] automatically takes care of flushing and swapping buffers for its screen when printing. pub fn new(screen: RefMut<'screen, dyn Screen>) -> Self { let mut context = Box::::default(); diff --git a/ctru-rs/src/lib.rs b/ctru-rs/src/lib.rs index 210d37f..5b0ad40 100644 --- a/ctru-rs/src/lib.rs +++ b/ctru-rs/src/lib.rs @@ -1,3 +1,6 @@ +//! Safe Rust wrapper around `libctru`. +//! +//! This library behaves as the main tool to access system-specific features and feature fixes. #![crate_type = "rlib"] #![crate_name = "ctru"] #![feature(test)] @@ -27,8 +30,8 @@ macro_rules! from_impl { /// Activate the default panic handler. /// -/// With this implementation, the main thread will stop and try to print debug info to an available [console::Console]. -/// In case it fails to find an active [console::Console] the program will just exit. +/// With this implementation, the main thread will stop and try to print debug info to an available [`Console`](console::Console). +/// In case it fails to find an active [`Console`](console::Console) the program will just exit. /// /// # Notes /// diff --git a/ctru-rs/src/linear.rs b/ctru-rs/src/linear.rs index c07ce49..718e975 100644 --- a/ctru-rs/src/linear.rs +++ b/ctru-rs/src/linear.rs @@ -15,7 +15,7 @@ use std::ptr::NonNull; // Sadly the linear memory allocator included in `libctru` doesn't implement `linearRealloc` at the time of these additions, // but the default fallback of the `std` will take care of that for us. -/// [`std::alloc::Allocator`] struct for LINEAR memory +/// [`Allocator`](std::alloc::Allocator) struct for LINEAR memory /// To use this struct the main crate must activate the `allocator_api` unstable feature. #[derive(Copy, Clone, Default, Debug)] pub struct LinearAllocator; diff --git a/ctru-rs/src/mii.rs b/ctru-rs/src/mii.rs index 17cb9bf..a992a2a 100644 --- a/ctru-rs/src/mii.rs +++ b/ctru-rs/src/mii.rs @@ -176,7 +176,7 @@ pub struct MoleDetails { /// Some values are not ordered _like_ the Mii Editor UI. The mapped values can be seen here: /// /// -/// This struct is returned by the [``MiiSelector``](crate::applets::mii_selector::MiiSelector) +/// This struct is returned by the [`MiiSelector`](crate::applets::mii_selector::MiiSelector) #[derive(Clone, Debug)] pub struct MiiData { pub options: MiiDataOptions, diff --git a/ctru-rs/src/services/cam.rs b/ctru-rs/src/services/cam.rs index 4a06421..6ddb37f 100644 --- a/ctru-rs/src/services/cam.rs +++ b/ctru-rs/src/services/cam.rs @@ -20,7 +20,7 @@ pub struct Cam { pub both_outer_cams: BothOutwardCam, } -/// Flag to pass to [Camera::flip_image] +/// Flag to pass to [`Camera::flip_image`] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum FlipMode { @@ -30,7 +30,7 @@ pub enum FlipMode { Reverse = ctru_sys::FLIP_REVERSE, } -/// Flag to pass to [Camera::set_view_size] +/// Flag to pass to [`Camera::set_view_size`] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum ViewSize { @@ -47,7 +47,7 @@ pub enum ViewSize { DSX4 = ctru_sys::SIZE_DS_LCDx4, } -/// Flag to pass to [Camera::set_frame_rate] +/// Flag to pass to [`Camera::set_frame_rate`] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum FrameRate { @@ -66,8 +66,8 @@ pub enum FrameRate { Fps30To10 = ctru_sys::FRAME_RATE_30_TO_10, } -/// Flag to pass to [Camera::set_white_balance] or -/// [Camera::set_white_balance_without_base_up] +/// Flag to pass to [`Camera::set_white_balance`] or +/// [`Camera::set_white_balance_without_base_up`] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum WhiteBalance { @@ -85,7 +85,7 @@ pub enum WhiteBalance { Temp7000K = ctru_sys::WHITE_BALANCE_7000K, } -/// Flag to pass to [Camera::set_photo_mode] +/// Flag to pass to [`Camera::set_photo_mode`] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum PhotoMode { @@ -96,7 +96,7 @@ pub enum PhotoMode { Letter = ctru_sys::PHOTO_MODE_LETTER, } -/// Flag to pass to [Camera::set_effect] +/// Flag to pass to [`Camera::set_effect`] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum Effect { @@ -108,7 +108,7 @@ pub enum Effect { Sepia01 = ctru_sys::EFFECT_SEPIA01, } -/// Flag to pass to [Camera::set_contrast] +/// Flag to pass to [`Camera::set_contrast`] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum Contrast { @@ -120,7 +120,7 @@ pub enum Contrast { High = ctru_sys::CONTRAST_HIGH, } -/// Flag to pass to [Camera::set_lens_correction] +/// Flag to pass to [`Camera::set_lens_correction`] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum LensCorrection { @@ -129,7 +129,7 @@ pub enum LensCorrection { Bright = ctru_sys::LENS_CORRECTION_BRIGHT, } -/// Flag to pass to [Camera::set_output_format] +/// Flag to pass to [`Camera::set_output_format`] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum OutputFormat { @@ -137,7 +137,7 @@ pub enum OutputFormat { Rgb565 = ctru_sys::OUTPUT_RGB_565, } -/// Flag to pass to [Cam::play_shutter_sound] +/// Flag to pass to [`Cam::play_shutter_sound`] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum ShutterSound { @@ -168,7 +168,7 @@ impl TryFrom for FramebufferFormat { } } -/// Struct containing coordinates passed to [Camera::set_trimming_params]. +/// Struct containing coordinates passed to [`Camera::set_trimming_params`]. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct TrimmingParams { x_start: i16, @@ -178,7 +178,7 @@ pub struct TrimmingParams { } impl TrimmingParams { - /// Creates a new [CamTrimmingParams] and guarantees the start coordinates are less than or + /// Creates a new [`TrimmingParams`] and guarantees the start coordinates are less than or /// equal to the end coordinates. /// /// `x_start <= x_end && y_start <= y_end` @@ -296,7 +296,7 @@ pub trait Camera { } /// Sets whether or not the camera should trim the image based on parameters set by - /// [Camera::set_trimming_params] + /// [`Camera::set_trimming_params`] fn set_trimming(&mut self, enabled: bool) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetTrimming(self.port_as_raw(), enabled))?; @@ -313,7 +313,7 @@ pub trait Camera { } } - /// Sets trimming parameters based on coordinates specified inside a [TrimmingParams] + /// Sets trimming parameters based on coordinates specified inside a [`TrimmingParams`] fn set_trimming_params(&mut self, params: TrimmingParams) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetTrimmingParams( @@ -327,7 +327,7 @@ pub trait Camera { } } - /// Returns the [TrimmingParams] set + /// Returns the [`TrimmingParams`] set fn trimming_params(&self) -> crate::Result { unsafe { let mut x_start = 0; @@ -381,7 +381,7 @@ pub trait Camera { } } - /// Sets the white balance mod of the camera based on the passed [WhiteBalance] argument + /// Sets the white balance mod of the camera based on the passed [`WhiteBalance`] argument fn set_white_balance(&mut self, white_balance: WhiteBalance) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetWhiteBalance( @@ -392,7 +392,7 @@ pub trait Camera { } } - /// Sets the white balance mode of the camera based on the passed [WhiteBalance] argument + /// Sets the white balance mode of the camera based on the passed [`WhiteBalance`] argument // TODO: Explain base up fn set_white_balance_without_base_up( &mut self, @@ -461,7 +461,7 @@ pub trait Camera { } } - /// Sets the flip direction of the camera's image based on the passed [FlipMode] argument + /// Sets the flip direction of the camera's image based on the passed [`FlipMode`] argument fn flip_image(&mut self, flip: FlipMode) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_FlipImage( @@ -507,7 +507,7 @@ pub trait Camera { } } - /// Sets the view size of the camera based on the passed [ViewSize] argument. + /// Sets the view size of the camera based on the passed [`ViewSize`] argument. fn set_view_size(&mut self, size: ViewSize) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetSize( @@ -519,7 +519,7 @@ pub trait Camera { } } - /// Sets the frame rate of the camera based on the passed [FrameRate] argument. + /// Sets the frame rate of the camera based on the passed [`FrameRate`] argument. fn set_frame_rate(&mut self, frame_rate: FrameRate) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetFrameRate( @@ -530,7 +530,7 @@ pub trait Camera { } } - /// Sets the photo mode of the camera based on the passed [PhotoMode] argument. + /// Sets the photo mode of the camera based on the passed [`PhotoMode`] argument. fn set_photo_mode(&mut self, photo_mode: PhotoMode) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetPhotoMode( @@ -541,9 +541,9 @@ pub trait Camera { } } - /// Sets the effect of the camera based on the passed [Effect] argument. + /// Sets the effect of the camera based on the passed [`Effect`] argument. /// - /// Multiple effects can be set at once by combining the bitflags of [CamEffect] + /// Multiple effects can be set at once by combining the bitflags of [`Effect`] fn set_effect(&mut self, effect: Effect) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetEffect( @@ -555,7 +555,7 @@ pub trait Camera { } } - /// Sets the contrast of the camera based on the passed [Contrast] argument. + /// Sets the contrast of the camera based on the passed [`Contrast`] argument. fn set_contrast(&mut self, contrast: Contrast) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetContrast( @@ -566,7 +566,7 @@ pub trait Camera { } } - /// Sets the lens correction of the camera based on the passed [LensCorrection] argument. + /// Sets the lens correction of the camera based on the passed [`LensCorrection`] argument. fn set_lens_correction(&mut self, lens_correction: LensCorrection) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetLensCorrection( @@ -577,7 +577,7 @@ pub trait Camera { } } - /// Sets the output format of the camera based on the passed [OutputFormat] argument. + /// Sets the output format of the camera based on the passed [`OutputFormat`] argument. fn set_output_format(&mut self, format: OutputFormat) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetOutputFormat( @@ -652,7 +652,7 @@ pub trait Camera { } /// Sets the image quality calibration data for the camera based on the passed in - /// [ImageQualityCalibrationData] argument + /// [`ImageQualityCalibrationData`] argument fn set_image_quality_calibration_data( &mut self, data: ImageQualityCalibrationData, @@ -663,7 +663,7 @@ pub trait Camera { } } - /// Returns the current [ImageQualityCalibrationData] for the camera + /// Returns the current [`ImageQualityCalibrationData`] for the camera fn image_quality_calibration_data(&self) -> crate::Result { unsafe { let mut data = ImageQualityCalibrationData::default(); @@ -783,7 +783,7 @@ impl Cam { } } - /// Plays the specified sound based on the [ShutterSound] argument + /// Plays the specified sound based on the [`ShutterSound`] argument pub fn play_shutter_sound(&self, sound: ShutterSound) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_PlayShutterSound(sound.into()))?; diff --git a/ctru-rs/src/services/fs.rs b/ctru-rs/src/services/fs.rs index 04e0c1e..faa03e3 100644 --- a/ctru-rs/src/services/fs.rs +++ b/ctru-rs/src/services/fs.rs @@ -183,36 +183,26 @@ pub struct File { /// Metadata information about a file. /// -/// This structure is returned from the [`metadata`] function and +/// This structure is returned from the [`File::metadata`] function and /// represents known metadata about a file. -/// -/// [`metadata`]: fn.metadata.html pub struct Metadata { attributes: u32, size: u64, } /// Options and flags which can be used to configure how a [`File`] is opened. -/// This builder exposes the ability to configure how a `File` is opened +/// This builder exposes the ability to configure how a [`File`] is opened /// and what operations are permitted on the open file. The [`File::open`] /// and [`File::create`] methods are aliases for commonly used options /// using this builder. /// -/// [`File`]: struct.File.html -/// [`File::open`]: struct.File.html#method.open -/// [`File::create`]: struct.File.html#method.create -/// -/// Generally speaking, when using `OpenOptions`, you'll first call [`new()`], -/// then chain calls to methods to set each option, then call [`open()`], +/// Generally speaking, when using [`OpenOptions`], you'll first call [`OpenOptions::new`], +/// then chain calls to methods to set each option, then call [`OpenOptions::open`], /// passing the path of the file you're trying to open. /// /// It is required to also pass a reference to the [`Archive`] that the /// file lives in. /// -/// [`new()`]: struct.OpenOptions.html#method.new -/// [`open()`]: struct.OpenOptions.html#method.open -/// [`Archive`]: struct.Archive.html -/// /// # Examples /// /// Opening a file to read: @@ -257,14 +247,11 @@ pub struct OpenOptions { /// Iterator over the entries in a directory. /// -/// This iterator is returned from the [`read_dir`] function of this module and +/// This iterator is returned from the [`File::read_dir`] function of this module and /// will yield instances of `Result`. Through a [`DirEntry`] /// information like the entry's path and possibly other metadata can be /// learned. /// -/// [`read_dir`]: fn.read_dir.html -/// [`DirEntry`]: struct.DirEntry.html -/// /// # Errors /// /// This Result will return Err if there's some sort of intermittent IO error @@ -277,8 +264,6 @@ pub struct ReadDir<'a> { /// Entries returned by the [`ReadDir`] iterator. /// -/// [`ReadDir`]: struct.ReadDir.html -/// /// An instance of `DirEntry` represents an entry inside of a directory on the /// filesystem. Each entry can be inspected via methods to learn about the full /// path or possibly other metadata. @@ -338,8 +323,6 @@ impl Fs { impl Archive { /// Retrieves an Archive's [`ArchiveID`] - /// - /// [`ArchiveID`]: enum.ArchiveID.html pub fn id(&self) -> ArchiveID { self.id } @@ -355,8 +338,6 @@ impl File { /// This function will return an error if `path` does not already exit. /// Other errors may also be returned accoridng to [`OpenOptions::open`] /// - /// [`OpenOptions::open`]: struct.OpenOptions.html#method.open - /// /// # Examples /// /// ```no_run @@ -382,9 +363,7 @@ impl File { /// # Errors /// /// This function will return an error if `path` does not already exit. - /// Other errors may also be returned accoridng to [`OpenOptions::create`] - /// - /// [`OpenOptions::create`]: struct.OpenOptions.html#method.create + /// Other errors may also be returned accoridng to [`OpenOptions::create`]. /// /// # Examples /// @@ -597,8 +576,6 @@ impl OpenOptions { /// to the `archive` method. /// * Filesystem-level errors (full disk, etc). /// * Invalid combinations of open options. - /// - /// [`Archive`]: struct.Archive.html pub fn open>(&mut self, path: P) -> IoResult { self._open(path.as_ref(), self.open_flags()) } @@ -901,7 +878,6 @@ fn to_utf16(path: &Path) -> WideCString { WideCString::from_str(path).unwrap() } -// Adapted from sys/windows/fs.rs in libstd fn truncate_utf16_at_nul(v: &[u16]) -> &[u16] { match v.iter().position(|c| *c == 0) { // don't include the 0 @@ -910,8 +886,6 @@ fn truncate_utf16_at_nul(v: &[u16]) -> &[u16] { } } -// Copied from sys/common/io.rs in libstd - // Provides read_to_end functionality over an uninitialized buffer. // This function is unsafe because it calls the underlying // read function with a slice into uninitialized memory. The default diff --git a/ctru-rs/src/services/gfx.rs b/ctru-rs/src/services/gfx.rs index 3a5ba37..8c60280 100644 --- a/ctru-rs/src/services/gfx.rs +++ b/ctru-rs/src/services/gfx.rs @@ -90,14 +90,10 @@ pub trait Swap: private::Sealed { /// Swaps the video buffers. /// /// If double buffering is disabled, "swapping" the buffers has the side effect - /// of committing any configuration changes to the buffers (e.g. [`set_wide_mode`], - /// [`set_framebuffer_format`], [`set_double_buffering`]). + /// of committing any configuration changes to the buffers (e.g. [`TopScreen::set_wide_mode`], + /// [`Screen::set_framebuffer_format`], [`Screen::set_double_buffering`]). /// /// This should be called once per frame at most. - /// - /// [`set_wide_mode`]: TopScreen::set_wide_mode - /// [`set_framebuffer_format`]: Screen::set_framebuffer_format - /// [`set_double_buffering`]: Screen::set_double_buffering fn swap_buffers(&mut self); } @@ -213,9 +209,12 @@ pub struct Gfx { static GFX_ACTIVE: Mutex = Mutex::new(0); impl Gfx { - /// Creates a new [Gfx] instance with default init values + /// Creates a new [`Gfx`] instance with default init values /// It's the same as calling: - /// `Gfx::with_formats(FramebufferFormat::Bgr8, FramebufferFormat::Bgr8, false)` + /// + /// ``` + /// Gfx::with_formats(FramebufferFormat::Bgr8, FramebufferFormat::Bgr8, false) + /// ``` pub fn new() -> Result { Gfx::with_formats(FramebufferFormat::Bgr8, FramebufferFormat::Bgr8, false) } diff --git a/ctru-rs/src/services/ndsp/mod.rs b/ctru-rs/src/services/ndsp/mod.rs index 8f67b1b..72e2413 100644 --- a/ctru-rs/src/services/ndsp/mod.rs +++ b/ctru-rs/src/services/ndsp/mod.rs @@ -204,8 +204,8 @@ impl Channel<'_> { /// /// # Warning /// - /// `libctru` expects the user to manually keep the info data (in this case [Wave]) alive during playback. - /// To ensure safety, checks within [Wave] will clear the whole channel queue if any queued [Wave] is dropped prematurely. + /// `libctru` expects the user to manually keep the info data (in this case [`Wave`]) alive during playback. + /// To ensure safety, checks within [`Wave`] will clear the whole channel queue if any queued [`Wave`] is dropped prematurely. pub fn queue_wave(&mut self, wave: &mut Wave) -> std::result::Result<(), NdspError> { match wave.status() { WaveStatus::Playing | WaveStatus::Queued => return Err(NdspError::WaveBusy(self.id)), @@ -222,7 +222,7 @@ impl Channel<'_> { /// Functions to handle audio filtering. /// -/// Refer to [libctru](https://libctru.devkitpro.org/channel_8h.html#a1da3b363c2edfd318c92276b527daae6) for more info. +/// Refer to [`libctru`](https://libctru.devkitpro.org/channel_8h.html#a1da3b363c2edfd318c92276b527daae6) for more info. impl Channel<'_> { /// Enables/disables monopole filters. pub fn iir_mono_set_enabled(&mut self, enable: bool) { @@ -314,7 +314,7 @@ impl AudioFormat { } impl AudioMix { - /// Creates a new [AudioMix] with all volumes set to 0. + /// Creates a new [`AudioMix`] with all volumes set to 0. pub fn zeroed() -> Self { Self { raw: [0.; 12] } } @@ -365,8 +365,8 @@ impl AudioMix { /// /// # Notes /// - /// [Channel] will normalize the mix values to be within 0 and 1. - /// However, an [AudioMix] instance with larger/smaller values is valid. + /// [`Channel`] will normalize the mix values to be within 0 and 1. + /// However, an [`AudioMix`] instance with larger/smaller values is valid. pub fn set_front(&mut self, left: f32, right: f32) { self.raw[0] = left; self.raw[1] = right; @@ -376,8 +376,8 @@ impl AudioMix { /// /// # Notes /// - /// [Channel] will normalize the mix values to be within 0 and 1. - /// However, an [AudioMix] instance with larger/smaller values is valid. + /// [`Channel`] will normalize the mix values to be within 0 and 1. + /// However, an [`AudioMix`] instance with larger/smaller values is valid. pub fn set_back(&mut self, left: f32, right: f32) { self.raw[2] = left; self.raw[3] = right; @@ -387,8 +387,8 @@ impl AudioMix { /// /// # Notes /// - /// [Channel] will normalize the mix values to be within 0 and 1. - /// However, an [AudioMix] instance with larger/smaller values is valid. + /// [`Channel`] will normalize the mix values to be within 0 and 1. + /// However, an [`AudioMix`] instance with larger/smaller values is valid. pub fn set_aux_front(&mut self, left: f32, right: f32, id: usize) { if id > 1 { panic!("invalid auxiliary output device index") @@ -404,8 +404,8 @@ impl AudioMix { /// /// # Notes /// - /// [Channel] will normalize the mix values to be within 0 and 1. - /// However, an [AudioMix] instance with larger/smaller values is valid. + /// [`Channel`] will normalize the mix values to be within 0 and 1. + /// However, an [`AudioMix`] instance with larger/smaller values is valid. pub fn set_aux_back(&mut self, left: f32, right: f32, id: usize) { if id > 1 { panic!("invalid auxiliary output device index") @@ -418,7 +418,7 @@ impl AudioMix { } } -/// Returns an [AudioMix] object with "front left" and "front right" volumes set to 100%, and all other volumes set to 0%. +/// Returns an [`AudioMix`] object with "front left" and "front right" volumes set to 100%, and all other volumes set to 0%. impl Default for AudioMix { fn default() -> Self { let mut mix = AudioMix::zeroed(); diff --git a/ctru-rs/src/services/ndsp/wave.rs b/ctru-rs/src/services/ndsp/wave.rs index feff4cd..6cc5847 100644 --- a/ctru-rs/src/services/ndsp/wave.rs +++ b/ctru-rs/src/services/ndsp/wave.rs @@ -1,7 +1,7 @@ use super::{AudioFormat, NdspError}; use crate::linear::LinearAllocator; -/// Informational struct holding the raw audio data and playback info. This corresponds to [ctru_sys::ndspWaveBuf]. +/// Informational struct holding the raw audio data and playback info. This corresponds to [`ctru_sys::ndspWaveBuf`]. pub struct Wave { /// Data block of the audio wave (and its format information). buffer: Box<[u8], LinearAllocator>, @@ -13,7 +13,7 @@ pub struct Wave { #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u8)] -/// Enum representing the playback status of a [Wave]. +/// Enum representing the playback status of a [`Wave`]. pub enum WaveStatus { Free = ctru_sys::NDSP_WBUF_FREE as u8, Queued = ctru_sys::NDSP_WBUF_QUEUED as u8, @@ -69,7 +69,7 @@ impl Wave { /// /// # Errors /// - /// This function will return an error if the [Wave] is currently busy, + /// This function will return an error if the [`Wave`] is currently busy, /// with the id to the channel in which it's queued. pub fn get_buffer_mut(&mut self) -> Result<&mut [u8], NdspError> { match self.status() { @@ -89,7 +89,7 @@ impl Wave { /// /// # Notes /// - /// This value varies depending on [Self::set_sample_count]. + /// This value varies depending on [`Wave::set_sample_count`]. pub fn sample_count(&self) -> usize { self.raw_data.nsamples as usize } @@ -117,7 +117,7 @@ impl Wave { /// # Errors /// /// This function will return an error if the sample size exceeds the buffer's capacity - /// or if the [Wave] is currently queued. + /// or if the [`Wave`] is currently queued. pub fn set_sample_count(&mut self, sample_count: usize) -> Result<(), NdspError> { match self.status() { WaveStatus::Playing | WaveStatus::Queued => {