Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
docs: Fix more legacy linking. (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys authored Jul 30, 2023
1 parent 2421555 commit 1337a0f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 42 deletions.
23 changes: 7 additions & 16 deletions src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,16 @@ impl Application {

/// Get the current globally active `Application`.
///
/// A globally active `Application` exists
/// after [`new`] is called and until [`run`] returns.
/// A globally active `Application` exists after [`Application::new()`]
/// is called and until [`Application::run()`] returns.
///
/// # Panics
///
/// Panics if there is no globally active `Application`.
/// For a non-panicking function use [`try_global`].
/// For a non-panicking function use [`Application::try_global()`].
///
/// This function will also panic if called from a non-main thread.
/// Use [`AppHandle`] instead.
///
/// [`new`]: #method.new
/// [`run`]: #method.run
/// [`try_global`]: #method.try_global
#[inline]
pub fn global() -> Application {
// Main thread assertion takes place in try_global()
Expand All @@ -113,15 +109,12 @@ impl Application {

/// Get the current globally active `Application`.
///
/// A globally active `Application` exists
/// after [`new`] is called and until [`run`] returns.
/// A globally active `Application` exists after [`Application::new()`]
/// is called and until [`Application::run()`] returns.
///
/// # Panics
///
/// Panics if called from a non-main thread.
///
/// [`new`]: #method.new
/// [`run`]: #method.run
pub fn try_global() -> Option<Application> {
util::assert_main_thread_or_main_unclaimed();
GLOBAL_APP.with(|global_app| global_app.borrow().clone())
Expand Down Expand Up @@ -165,9 +158,7 @@ impl Application {

/// Quit the `Application`.
///
/// This will cause [`run`] to return control back to the calling function.
///
/// [`run`]: #method.run
/// This will cause [`Application::run`] to return control back to the calling function.
pub fn quit(&self) {
self.backend_app.quit()
}
Expand All @@ -179,7 +170,7 @@ impl Application {

/// Returns the current locale string.
///
/// This should a [Unicode language identifier].
/// This should be a [Unicode language identifier].
///
/// [Unicode language identifier]: https://unicode.org/reports/tr35/#Unicode_language_identifier
pub fn get_locale() -> String {
Expand Down
10 changes: 0 additions & 10 deletions src/mouse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,40 +77,30 @@ pub enum MouseButton {

impl MouseButton {
/// Returns `true` if this is [`MouseButton::Left`].
///
/// [`MouseButton::Left`]: #variant.Left
#[inline]
pub fn is_left(self) -> bool {
self == MouseButton::Left
}

/// Returns `true` if this is [`MouseButton::Right`].
///
/// [`MouseButton::Right`]: #variant.Right
#[inline]
pub fn is_right(self) -> bool {
self == MouseButton::Right
}

/// Returns `true` if this is [`MouseButton::Middle`].
///
/// [`MouseButton::Middle`]: #variant.Middle
#[inline]
pub fn is_middle(self) -> bool {
self == MouseButton::Middle
}

/// Returns `true` if this is [`MouseButton::X1`].
///
/// [`MouseButton::X1`]: #variant.X1
#[inline]
pub fn is_x1(self) -> bool {
self == MouseButton::X1
}

/// Returns `true` if this is [`MouseButton::X2`].
///
/// [`MouseButton::X2`]: #variant.X2
#[inline]
pub fn is_x2(self) -> bool {
self == MouseButton::X2
Expand Down
10 changes: 0 additions & 10 deletions src/pointer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,40 +239,30 @@ impl From<crate::MouseButton> for PointerButton {

impl PointerButton {
/// Returns `true` if this is [`PointerButton::Left`].
///
/// [`MouseButton::Left`]: #variant.Left
#[inline]
pub fn is_left(self) -> bool {
self == PointerButton::Left
}

/// Returns `true` if this is [`PointerButton::Right`].
///
/// [`PointerButton::Right`]: #variant.Right
#[inline]
pub fn is_right(self) -> bool {
self == PointerButton::Right
}

/// Returns `true` if this is [`PointerButton::Middle`].
///
/// [`PointerButton::Middle`]: #variant.Middle
#[inline]
pub fn is_middle(self) -> bool {
self == PointerButton::Middle
}

/// Returns `true` if this is [`PointerButton::X1`].
///
/// [`PointerButton::X1`]: #variant.X1
#[inline]
pub fn is_x1(self) -> bool {
self == PointerButton::X1
}

/// Returns `true` if this is [`PointerButton::X2`].
///
/// [`PointerButton::X2`]: #variant.X2
#[inline]
pub fn is_x2(self) -> bool {
self == PointerButton::X2
Expand Down
9 changes: 3 additions & 6 deletions src/scale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ use crate::kurbo::{Insets, Line, Point, Rect, Size, Vec2};
/// ## Converting with `Scale`
///
/// To translate coordinates between pixels and display points you should use one of the
/// helper conversion methods of `Scale` or for manual conversion [`x`] / [`y`].
/// helper conversion methods of `Scale` or for manual conversion [`Scale::x()`] / [`Scale::y()`].
///
/// `Scale` is designed for responsive applications, including responding to platform scale changes.
/// The platform scale can change quickly, e.g. when moving a window from one monitor to another.
///
/// A copy of `Scale` will be stale as soon as the platform scale changes.
///
/// [`x`]: #method.x
/// [`y`]: #method.y
/// [in the Druid book]: https://linebender.org/druid/07_resolution_independence.html
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct Scale {
Expand Down Expand Up @@ -277,9 +275,8 @@ impl ScaledArea {
///
/// The calculated size in pixels is rounded away from zero to integers.
/// That means that the scaled area size in display points isn't always the same
/// as the `size` given to this function. To find out the new size in points use [`size_dp`].
///
/// [`size_dp`]: #method.size_dp
/// as the `size` given to this function. To find out the new size in points use
/// [`ScaledArea::size_dp()`].
pub fn from_dp<T: Into<Size>>(size: T, scale: Scale) -> ScaledArea {
let size_px = size.into().to_px(scale).expand();
let size_dp = size_px.to_dp(scale);
Expand Down

0 comments on commit 1337a0f

Please sign in to comment.