diff --git a/imgui/src/input/keyboard.rs b/imgui/src/input/keyboard.rs index 204e435..bab12f4 100644 --- a/imgui/src/input/keyboard.rs +++ b/imgui/src/input/keyboard.rs @@ -110,7 +110,7 @@ impl<'ui> Ui<'ui> { self.is_key_index_down(key_index) } - /// Same as [`is_key_down`] but takes a key index. The meaning of + /// Same as [`is_key_down`](Self::is_key_down) but takes a key index. The meaning of /// index is defined by your backend implementation. #[inline] #[doc(alias = "IsKeyDown")] @@ -128,7 +128,7 @@ impl<'ui> Ui<'ui> { self.is_key_index_pressed(key_index) } - /// Same as [`is_key_pressed`] but takes a key index. + /// Same as [`is_key_pressed`](Self::is_key_pressed) but takes a key index. /// /// The meaning of index is defined by your backend /// implementation. @@ -148,7 +148,8 @@ impl<'ui> Ui<'ui> { self.is_key_index_pressed_no_repeat(key_index) } - /// Same as [`is_key_pressed_no_repeat`] but takes a key index. + /// Same as [`is_key_pressed_no_repeat`](Self::is_key_pressed_no_repeat) + /// but takes a key index. /// /// The meaning of index is defined by your backend /// implementation. @@ -166,7 +167,7 @@ impl<'ui> Ui<'ui> { self.is_key_index_released(key_index) } - /// Same as [`is_key_released`] but takes a key index. + /// Same as [`is_key_released`](Self::is_key_released) but takes a key index. /// /// The meaning of index is defined by your backend /// implementation. diff --git a/imgui/src/input_widget.rs b/imgui/src/input_widget.rs index 9969558..764bdbb 100644 --- a/imgui/src/input_widget.rs +++ b/imgui/src/input_widget.rs @@ -552,7 +552,7 @@ pub trait TextCallbackHandler { /// during this callback (for some reason). /// /// To make ImGui run this callback, use [InputTextCallback::CHAR_FILTER] or - /// [InputTextMultilineCallback::CALLBACK]. + /// [InputTextMultilineCallback::CHAR_FILTER]. fn char_filter(&mut self, c: char) -> Option { Some(c) } @@ -590,8 +590,8 @@ pub enum HistoryDirection { } /// This struct provides methods to edit the underlying text buffer that -/// Dear ImGui manipulates. Primarily, it gives [remove_chars], [insert_chars], -/// and mutable access to what text is selected. +/// Dear ImGui manipulates. Primarily, it gives [remove_chars](Self::remove_chars), +/// [insert_chars](Self::insert_chars), and mutable access to what text is selected. pub struct TextCallbackData<'a>(&'a mut sys::ImGuiInputTextCallbackData); impl<'a> TextCallbackData<'a> { @@ -625,6 +625,11 @@ impl<'a> TextCallbackData<'a> { /// /// This function should have highly limited usage, but could be for /// editing certain characters in the buffer based on some external condition. + /// + /// [remove_chars]: Self::remove_chars + /// [set_dirty]: Self::set_dirty + /// [insert_chars]: Self::insert_chars + /// [push_str]: Self::push_str pub unsafe fn str_as_bytes_mut(&mut self) -> &mut [u8] { let str = std::str::from_utf8_mut(std::slice::from_raw_parts_mut( self.0.Buf as *const _ as *mut _, @@ -638,19 +643,23 @@ impl<'a> TextCallbackData<'a> { /// Sets the dirty flag on the text to imgui, indicating that /// it should reapply this string to its internal state. /// - /// **NB:** You only need to use this method if you're using `[buf_mut]`. + /// **NB:** You only need to use this method if you're using `[str_as_bytes_mut]`. /// If you use the helper methods [remove_chars] and [insert_chars], /// this will be set for you. However, this is no downside to setting /// the dirty flag spuriously except the minor CPU time imgui will spend. + /// + /// [str_as_bytes_mut]: Self::str_as_bytes_mut + /// [remove_chars]: Self::remove_chars + /// [insert_chars]: Self::insert_chars pub fn set_dirty(&mut self) { self.0.BufDirty = true; } - /// Gets a range of the selected text. See [selection_start_mut] and - /// [selection_end_mut] to mutably edit these values. + /// Gets a range of the selected text. See [selection_start_mut](Self::selection_start_mut) + /// and [selection_end_mut](Self::selection_end_mut) to mutably edit these values. /// /// This Range is given in `usize` so that it might be used in indexing - /// operations more easily. To quickly grab the selected text, use [selected]. + /// operations more easily. To quickly grab the selected text, use [selected](Self::selected). pub fn selection(&self) -> Range { self.0.SelectionStart as usize..self.0.SelectionEnd as usize } @@ -661,16 +670,14 @@ impl<'a> TextCallbackData<'a> { &self.str()[self.selection()] } - /// Sets the cursor to select all. This is always a valid operation, - /// and so it takes an `&self`. + /// Sets the cursor to select all. pub fn select_all(&mut self) { unsafe { sys::ImGuiInputTextCallbackData_SelectAll(self.0); } } - /// Clears the selection. This is always a valid operation, - /// and so it takes an `&self`. + /// Clears the selection. pub fn clear_selection(&mut self) { unsafe { sys::ImGuiInputTextCallbackData_ClearSelection(self.0); @@ -683,8 +690,8 @@ impl<'a> TextCallbackData<'a> { } /// Pushes the given str to the end of this buffer. If this - /// would require the String to resize, it will be resized by calling the - /// `CALLBACK_RESIZE` callback. This is automatically handled. + /// would require the String to resize, it will be resized. + /// This is automatically handled. pub fn push_str(&mut self, s: &str) { // this is safe because the ench of a self.str is a char_boundary. unsafe { @@ -693,8 +700,8 @@ impl<'a> TextCallbackData<'a> { } /// Inserts the given string at the given position. If this - /// would require the String to resize, it will be resized by calling the - /// `CALLBACK_RESIZE` callback. This is automatically handled. + /// would require the String to resize, it will be resized + /// automatically. /// /// ## Panics /// Panics if the `pos` is not a char_boundary. @@ -706,13 +713,13 @@ impl<'a> TextCallbackData<'a> { } /// Inserts the given string at the given position, unsafely. If this - /// would require the String to resize, it will be resized by calling the - /// Callback_Resize callback. This is automatically handled. + /// would require the String to resize, it will be resized automatically. /// /// ## Safety /// /// It is up to the caller to confirm that the `pos` is a valid byte - /// position, or use [insert_chars] which will panic if it isn't. + /// position, or use [insert_chars](Self::insert_chars) which will panic + /// if it isn't. pub unsafe fn insert_chars_unsafe(&mut self, pos: usize, s: &str) { let start = s.as_ptr(); let end = start.add(s.len()); @@ -752,8 +759,8 @@ impl<'a> TextCallbackData<'a> { } /// Removes the given number of bytes from the string starting - /// at some byte pos, without checking for utf8 validity. Use [remove_chars] - /// for a safe variant. + /// at some byte pos, without checking for utf8 validity. Use + /// [remove_chars](Self::remove_chars) for a safe variant. /// /// ## Safety /// diff --git a/imgui/src/popups.rs b/imgui/src/popups.rs index 701cc3a..ca30b10 100644 --- a/imgui/src/popups.rs +++ b/imgui/src/popups.rs @@ -134,8 +134,8 @@ impl<'p> PopupModal<'p> { /// Consume and draw the PopupModal. /// Construct a popup that can have any kind of content. /// - /// This should be called *per frame*, whereas [`open_popup`](Self::open_popup) should be called *once* - /// when you want to actual create the popup. + /// This should be called *per frame*, whereas [`Ui::open_popup`] + /// should be called *once* when you want to actual create the popup. #[doc(alias = "BeginPopupModal")] pub fn begin_popup<'ui>(self, ui: &Ui<'ui>) -> Option> { let render = unsafe { @@ -159,7 +159,7 @@ impl<'p> PopupModal<'p> { // Widgets: Popups impl<'ui> Ui<'ui> { /// Instructs ImGui to open a popup, which must be began with either [`begin_popup`](Self::begin_popup) - /// or [`popup`](Self::popup). You also use this function to begin [ModalPopups]. + /// or [`popup`](Self::popup). You also use this function to begin [PopupModal]. /// /// The confusing aspect to popups is that ImGui holds "control" over the popup fundamentally, so that ImGui /// can also force close a popup when a user clicks outside a popup. If you do not want users to be diff --git a/imgui/src/widget/tree.rs b/imgui/src/widget/tree.rs index 37037f1..1c42ebc 100644 --- a/imgui/src/widget/tree.rs +++ b/imgui/src/widget/tree.rs @@ -391,7 +391,7 @@ impl<'a> CollapsingHeader<'a> { /// /// Returns true if the collapsing header is open and content should be rendered. /// - /// This is the same as [build] but is provided for consistent naming. + /// This is the same as [build](Self::build) but is provided for consistent naming. #[must_use] pub fn begin(self, ui: &Ui) -> bool { self.build(ui) @@ -401,7 +401,8 @@ impl<'a> CollapsingHeader<'a> { /// /// Returns true if the collapsing header is open and content should be rendered. /// - /// This is the same as [build_with_close_button] but is provided for consistent naming. + /// This is the same as [build_with_close_button](Self::build_with_close_button) + /// but is provided for consistent naming. #[must_use] pub fn begin_with_close_button(self, ui: &Ui, opened: &mut bool) -> bool { self.build_with_close_button(ui, opened)