Skip to content

Commit 6091370

Browse files
authored
Add more doc-links in docstrings (#1419)
1 parent 861b0e1 commit 6091370

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+257
-257
lines changed

egui/src/containers/area.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Area is a `Ui` that has no parent, it floats on the background.
1+
//! Area is a [`Ui`] that has no parent, it floats on the background.
22
//! It has no frame or own size. It is potentially movable.
33
//! It is the foundation for windows and popups.
44

egui/src/containers/collapsing_header.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,11 @@ pub struct CollapsingHeader {
148148
}
149149

150150
impl CollapsingHeader {
151-
/// The `CollapsingHeader` starts out collapsed unless you call `default_open`.
151+
/// The [`CollapsingHeader`] starts out collapsed unless you call `default_open`.
152152
///
153153
/// The label is used as an [`Id`] source.
154154
/// If the label is unique and static this is fine,
155-
/// but if it changes or there are several `CollapsingHeader` with the same title
155+
/// but if it changes or there are several [`CollapsingHeader`] with the same title
156156
/// you need to provide a unique id source with [`Self::id_source`].
157157
pub fn new(text: impl Into<WidgetText>) -> Self {
158158
let text = text.into();
@@ -170,7 +170,7 @@ impl CollapsingHeader {
170170
}
171171
}
172172

173-
/// By default, the `CollapsingHeader` is collapsed.
173+
/// By default, the [`CollapsingHeader`] is collapsed.
174174
/// Call `.default_open(true)` to change this.
175175
pub fn default_open(mut self, open: bool) -> Self {
176176
self.default_open = open;
@@ -187,29 +187,29 @@ impl CollapsingHeader {
187187
self
188188
}
189189

190-
/// Explicitly set the source of the `Id` of this widget, instead of using title label.
190+
/// Explicitly set the source of the [`Id`] of this widget, instead of using title label.
191191
/// This is useful if the title label is dynamic or not unique.
192192
pub fn id_source(mut self, id_source: impl Hash) -> Self {
193193
self.id_source = Id::new(id_source);
194194
self
195195
}
196196

197-
/// If you set this to `false`, the `CollapsingHeader` will be grayed out and un-clickable.
197+
/// If you set this to `false`, the [`CollapsingHeader`] will be grayed out and un-clickable.
198198
///
199199
/// This is a convenience for [`Ui::set_enabled`].
200200
pub fn enabled(mut self, enabled: bool) -> Self {
201201
self.enabled = enabled;
202202
self
203203
}
204204

205-
/// Can the `CollapsingHeader` be selected by clicking it? Default: `false`.
205+
/// Can the [`CollapsingHeader`] be selected by clicking it? Default: `false`.
206206
///
207207
pub fn selectable(mut self, selectable: bool) -> Self {
208208
self.selectable = selectable;
209209
self
210210
}
211211

212-
/// If you set this to 'true', the `CollapsingHeader` will be shown as selected.
212+
/// If you set this to 'true', the [`CollapsingHeader`] will be shown as selected.
213213
///
214214
/// Example:
215215
/// ```
@@ -229,9 +229,9 @@ impl CollapsingHeader {
229229
self
230230
}
231231

232-
/// Should the `CollapsingHeader` show a background behind it? Default: `false`.
232+
/// Should the [`CollapsingHeader`] show a background behind it? Default: `false`.
233233
///
234-
/// To show it behind all `CollapsingHeader` you can just use:
234+
/// To show it behind all [`CollapsingHeader`] you can just use:
235235
/// ```
236236
/// # egui::__run_test_ui(|ui| {
237237
/// ui.visuals_mut().collapsing_header_frame = true;
@@ -242,8 +242,8 @@ impl CollapsingHeader {
242242
self
243243
}
244244

245-
/// Use the provided function to render a different `CollapsingHeader` icon.
246-
/// Defaults to a triangle that animates as the `CollapsingHeader` opens and closes.
245+
/// Use the provided function to render a different [`CollapsingHeader`] icon.
246+
/// Defaults to a triangle that animates as the [`CollapsingHeader`] opens and closes.
247247
///
248248
/// For example:
249249
/// ```
@@ -397,7 +397,7 @@ impl CollapsingHeader {
397397
add_contents: Box<dyn FnOnce(&mut Ui) -> R + 'c>,
398398
) -> CollapsingResponse<R> {
399399
// Make sure contents are bellow header,
400-
// and make sure it is one unit (necessary for putting a `CollapsingHeader` in a grid).
400+
// and make sure it is one unit (necessary for putting a [`CollapsingHeader`] in a grid).
401401
ui.vertical(|ui| {
402402
ui.set_enabled(self.enabled);
403403

egui/src/containers/combo_box.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{style::WidgetVisuals, *};
22
use epaint::Shape;
33

4-
/// A function that paints the `ComboBox` icon
4+
/// A function that paints the [`ComboBox`] icon
55
pub type IconPainter = Box<dyn FnOnce(&Ui, Rect, &WidgetVisuals, bool)>;
66

77
/// A drop-down selection menu with a descriptive label.
@@ -31,7 +31,7 @@ pub struct ComboBox {
3131
}
3232

3333
impl ComboBox {
34-
/// Create new `ComboBox` with id and label
34+
/// Create new [`ComboBox`] with id and label
3535
pub fn new(id_source: impl std::hash::Hash, label: impl Into<WidgetText>) -> Self {
3636
Self {
3737
id_source: Id::new(id_source),
@@ -77,8 +77,8 @@ impl ComboBox {
7777
self
7878
}
7979

80-
/// Use the provided function to render a different `ComboBox` icon.
81-
/// Defaults to a triangle that expands when the cursor is hovering over the `ComboBox`.
80+
/// Use the provided function to render a different [`ComboBox`] icon.
81+
/// Defaults to a triangle that expands when the cursor is hovering over the [`ComboBox`].
8282
///
8383
/// For example:
8484
/// ```

egui/src/containers/panel.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl PanelState {
3737

3838
// ----------------------------------------------------------------------------
3939

40-
/// `Left` or `Right`
40+
/// [`Left`](Side::Left) or [`Right`](Side::Right)
4141
#[derive(Clone, Copy, Debug, PartialEq)]
4242
pub enum Side {
4343
Left,
@@ -132,7 +132,7 @@ impl SidePanel {
132132
self
133133
}
134134

135-
/// The initial wrapping width of the `SidePanel`.
135+
/// The initial wrapping width of the [`SidePanel`].
136136
pub fn default_width(mut self, default_width: f32) -> Self {
137137
self.default_width = default_width;
138138
self
@@ -162,7 +162,7 @@ impl SidePanel {
162162
}
163163

164164
impl SidePanel {
165-
/// Show the panel inside a `Ui`.
165+
/// Show the panel inside a [`Ui`].
166166
pub fn show_inside<R>(
167167
self,
168168
ui: &mut Ui,
@@ -171,7 +171,7 @@ impl SidePanel {
171171
self.show_inside_dyn(ui, Box::new(add_contents))
172172
}
173173

174-
/// Show the panel inside a `Ui`.
174+
/// Show the panel inside a [`Ui`].
175175
fn show_inside_dyn<'c, R>(
176176
self,
177177
ui: &mut Ui,
@@ -321,7 +321,7 @@ impl SidePanel {
321321

322322
// ----------------------------------------------------------------------------
323323

324-
/// `Top` or `Bottom`
324+
/// [`Top`](TopBottomSide::Top) or [`Bottom`](TopBottomSide::Bottom)
325325
#[derive(Clone, Copy, Debug, PartialEq)]
326326
pub enum TopBottomSide {
327327
Top,
@@ -416,7 +416,7 @@ impl TopBottomPanel {
416416
self
417417
}
418418

419-
/// The initial height of the `SidePanel`.
419+
/// The initial height of the [`SidePanel`].
420420
/// Defaults to [`style::Spacing::interact_size`].y.
421421
pub fn default_height(mut self, default_height: f32) -> Self {
422422
self.default_height = Some(default_height);
@@ -447,7 +447,7 @@ impl TopBottomPanel {
447447
}
448448

449449
impl TopBottomPanel {
450-
/// Show the panel inside a `Ui`.
450+
/// Show the panel inside a [`Ui`].
451451
pub fn show_inside<R>(
452452
self,
453453
ui: &mut Ui,
@@ -456,7 +456,7 @@ impl TopBottomPanel {
456456
self.show_inside_dyn(ui, Box::new(add_contents))
457457
}
458458

459-
/// Show the panel inside a `Ui`.
459+
/// Show the panel inside a [`Ui`].
460460
fn show_inside_dyn<'c, R>(
461461
self,
462462
ui: &mut Ui,
@@ -615,9 +615,9 @@ impl TopBottomPanel {
615615
/// A panel that covers the remainder of the screen,
616616
/// i.e. whatever area is left after adding other panels.
617617
///
618-
/// `CentralPanel` must be added after all other panels.
618+
/// [`CentralPanel`] must be added after all other panels.
619619
///
620-
/// NOTE: Any [`Window`]s and [`Area`]s will cover the top-level `CentralPanel`.
620+
/// NOTE: Any [`Window`]s and [`Area`]s will cover the top-level [`CentralPanel`].
621621
///
622622
/// See the [module level docs](crate::containers::panel) for more details.
623623
///
@@ -643,7 +643,7 @@ impl CentralPanel {
643643
}
644644

645645
impl CentralPanel {
646-
/// Show the panel inside a `Ui`.
646+
/// Show the panel inside a [`Ui`].
647647
pub fn show_inside<R>(
648648
self,
649649
ui: &mut Ui,
@@ -652,7 +652,7 @@ impl CentralPanel {
652652
self.show_inside_dyn(ui, Box::new(add_contents))
653653
}
654654

655-
/// Show the panel inside a `Ui`.
655+
/// Show the panel inside a [`Ui`].
656656
fn show_inside_dyn<'c, R>(
657657
self,
658658
ui: &mut Ui,

egui/src/containers/resize.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl Default for Resize {
5252
resizable: true,
5353
min_size: Vec2::splat(16.0),
5454
max_size: Vec2::splat(f32::INFINITY),
55-
default_size: vec2(320.0, 128.0), // TODO: preferred size of `Resize` area.
55+
default_size: vec2(320.0, 128.0), // TODO: preferred size of [`Resize`] area.
5656
with_stroke: true,
5757
}
5858
}
@@ -65,7 +65,7 @@ impl Resize {
6565
self
6666
}
6767

68-
/// A source for the unique `Id`, e.g. `.id_source("second_resize_area")` or `.id_source(loop_index)`.
68+
/// A source for the unique [`Id`], e.g. `.id_source("second_resize_area")` or `.id_source(loop_index)`.
6969
pub fn id_source(mut self, id_source: impl std::hash::Hash) -> Self {
7070
self.id_source = Some(Id::new(id_source));
7171
self
@@ -85,7 +85,7 @@ impl Resize {
8585
/// Preferred / suggested height. Actual height will depend on contents.
8686
///
8787
/// Examples:
88-
/// * if the contents is a `ScrollArea` then this decides the maximum size.
88+
/// * if the contents is a [`ScrollArea`] then this decides the maximum size.
8989
/// * if the contents is a canvas, this decides the height of it,
9090
/// * if the contents is text and buttons, then the `default_height` is ignored
9191
/// and the height is picked automatically..
@@ -217,7 +217,7 @@ impl Resize {
217217
} else {
218218
// We are not being actively resized, so auto-expand to include size of last frame.
219219
// This prevents auto-shrinking if the contents contain width-filling widgets (separators etc)
220-
// but it makes a lot of interactions with `Window`s nicer.
220+
// but it makes a lot of interactions with [`Window`]s nicer.
221221
state.desired_size = state.desired_size.max(state.last_content_size);
222222
}
223223

egui/src/containers/scroll_area.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub struct ScrollAreaOutput<R> {
5555
/// What the user closure returned.
5656
pub inner: R,
5757

58-
/// `Id` of the `ScrollArea`.
58+
/// [`Id`] of the [`ScrollArea`].
5959
pub id: Id,
6060

6161
/// The current state of the scroll area.
@@ -136,7 +136,7 @@ impl ScrollArea {
136136

137137
/// The maximum width of the outer frame of the scroll area.
138138
///
139-
/// Use `f32::INFINITY` if you want the scroll area to expand to fit the surrounding `Ui` (default).
139+
/// Use `f32::INFINITY` if you want the scroll area to expand to fit the surrounding [`Ui`] (default).
140140
///
141141
/// See also [`Self::auto_shrink`].
142142
pub fn max_width(mut self, max_width: f32) -> Self {
@@ -146,7 +146,7 @@ impl ScrollArea {
146146

147147
/// The maximum height of the outer frame of the scroll area.
148148
///
149-
/// Use `f32::INFINITY` if you want the scroll area to expand to fit the surrounding `Ui` (default).
149+
/// Use `f32::INFINITY` if you want the scroll area to expand to fit the surrounding [`Ui`] (default).
150150
///
151151
/// See also [`Self::auto_shrink`].
152152
pub fn max_height(mut self, max_height: f32) -> Self {
@@ -156,7 +156,7 @@ impl ScrollArea {
156156

157157
/// The minimum width of a horizontal scroll area which requires scroll bars.
158158
///
159-
/// The `ScrollArea` will only become smaller than this if the content is smaller than this
159+
/// The [`ScrollArea`] will only become smaller than this if the content is smaller than this
160160
/// (and so we don't require scroll bars).
161161
///
162162
/// Default: `64.0`.
@@ -167,7 +167,7 @@ impl ScrollArea {
167167

168168
/// The minimum height of a vertical scroll area which requires scroll bars.
169169
///
170-
/// The `ScrollArea` will only become smaller than this if the content is smaller than this
170+
/// The [`ScrollArea`] will only become smaller than this if the content is smaller than this
171171
/// (and so we don't require scroll bars).
172172
///
173173
/// Default: `64.0`.
@@ -183,7 +183,7 @@ impl ScrollArea {
183183
self
184184
}
185185

186-
/// A source for the unique `Id`, e.g. `.id_source("second_scroll_area")` or `.id_source(loop_index)`.
186+
/// A source for the unique [`Id`], e.g. `.id_source("second_scroll_area")` or `.id_source(loop_index)`.
187187
pub fn id_source(mut self, id_source: impl std::hash::Hash) -> Self {
188188
self.id_source = Some(Id::new(id_source));
189189
self
@@ -241,7 +241,7 @@ impl ScrollArea {
241241
/// If `false`, the scroll area will not respond to user scrolling
242242
///
243243
/// This can be used, for example, to optionally freeze scrolling while the user
244-
/// is inputing text in a `TextEdit` widget contained within the scroll area.
244+
/// is inputing text in a [`TextEdit`] widget contained within the scroll area.
245245
///
246246
/// This controls both scrolling directions.
247247
pub fn enable_scrolling(mut self, enable: bool) -> Self {
@@ -358,7 +358,7 @@ impl ScrollArea {
358358
let mut inner_size = outer_size - current_bar_use;
359359

360360
// Don't go so far that we shrink to zero.
361-
// In particular, if we put a `ScrollArea` inside of a `ScrollArea`, the inner
361+
// In particular, if we put a [`ScrollArea`] inside of a [`ScrollArea`], the inner
362362
// one shouldn't collapse into nothingness.
363363
// See https://github.com/emilk/egui/issues/1097
364364
for d in 0..2 {
@@ -414,7 +414,7 @@ impl ScrollArea {
414414
}
415415
}
416416

417-
/// Show the `ScrollArea`, and add the contents to the viewport.
417+
/// Show the [`ScrollArea`], and add the contents to the viewport.
418418
///
419419
/// If the inner area can be very long, consider using [`Self::show_rows`] instead.
420420
pub fn show<R>(

egui/src/context.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl ContextImpl {
114114
/// [`Context`] is cheap to clone, and any clones refers to the same mutable data
115115
/// ([`Context`] uses refcounting internally).
116116
///
117-
/// All methods are marked `&self`; `Context` has interior mutability (protected by a mutex).
117+
/// All methods are marked `&self`; [`Context`] has interior mutability (protected by a mutex).
118118
///
119119
///
120120
/// You can store
@@ -287,7 +287,7 @@ impl Context {
287287
self.interact_with_hovered(layer_id, id, rect, sense, enabled, hovered)
288288
}
289289

290-
/// You specify if a thing is hovered, and the function gives a `Response`.
290+
/// You specify if a thing is hovered, and the function gives a [`Response`].
291291
pub(crate) fn interact_with_hovered(
292292
&self,
293293
layer_id: LayerId,

egui/src/data/input.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub enum Event {
163163
Paste(String),
164164
/// Text input, e.g. via keyboard.
165165
///
166-
/// When the user presses enter/return, do not send a `Text` (just [`Key::Enter`]).
166+
/// When the user presses enter/return, do not send a [`Text`](Event::Text) (just [`Key::Enter`]).
167167
Text(String),
168168
/// A key was pressed or released.
169169
Key {
@@ -255,7 +255,7 @@ pub const NUM_POINTER_BUTTONS: usize = 3;
255255

256256
/// State of the modifier keys. These must be fed to egui.
257257
///
258-
/// The best way to compare `Modifiers` is by using [`Modifiers::matches`].
258+
/// The best way to compare [`Modifiers`] is by using [`Modifiers::matches`].
259259
#[derive(Clone, Copy, Debug, Default, PartialEq)]
260260
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
261261
pub struct Modifiers {

egui/src/data/output.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub struct PlatformOutput {
6666
/// Events that may be useful to e.g. a screen reader.
6767
pub events: Vec<OutputEvent>,
6868

69-
/// Is there a mutable `TextEdit` under the cursor?
69+
/// Is there a mutable [`TextEdit`](crate::TextEdit) under the cursor?
7070
/// Use by `egui_web` to show/hide mobile keyboard and IME agent.
7171
pub mutable_text_under_cursor: bool,
7272

@@ -321,7 +321,7 @@ pub struct WidgetInfo {
321321
pub enabled: bool,
322322
/// The text on labels, buttons, checkboxes etc.
323323
pub label: Option<String>,
324-
/// The contents of some editable text (for `TextEdit` fields).
324+
/// The contents of some editable text (for [`TextEdit`](crate::TextEdit) fields).
325325
pub current_text_value: Option<String>,
326326
// The previous text value.
327327
pub prev_text_value: Option<String>,

0 commit comments

Comments
 (0)