summaryrefslogtreecommitdiffstats
path: root/winit/src/application
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--winit/src/application.rs43
-rw-r--r--winit/src/application/state.rs35
2 files changed, 7 insertions, 71 deletions
diff --git a/winit/src/application.rs b/winit/src/application.rs
index ded60366..d1a94864 100644
--- a/winit/src/application.rs
+++ b/winit/src/application.rs
@@ -24,17 +24,13 @@ use std::mem::ManuallyDrop;
/// your GUI application by simply calling [`run`](#method.run). It will run in
/// its own window.
///
-/// An [`Application`](trait.Application.html) can execute asynchronous actions
-/// by returning a [`Command`](struct.Command.html) in some of its methods.
+/// An [`Application`] can execute asynchronous actions by returning a
+/// [`Command`] in some of its methods.
///
/// When using an [`Application`] with the `debug` feature enabled, a debug view
/// can be toggled by pressing `F12`.
-///
-/// [`Application`]: trait.Application.html
pub trait Application: Program {
/// The data needed to initialize your [`Application`].
- ///
- /// [`Application`]: trait.Application.html
type Flags;
/// Initializes the [`Application`] with the flags provided to
@@ -42,22 +38,15 @@ pub trait Application: Program {
///
/// Here is where you should return the initial state of your app.
///
- /// Additionally, you can return a [`Command`](struct.Command.html) if you
- /// need to perform some async action in the background on startup. This is
- /// useful if you want to load state from a file, perform an initial HTTP
- /// request, etc.
- ///
- /// [`Application`]: trait.Application.html
- /// [`run`]: #method.run.html
- /// [`Settings`]: ../settings/struct.Settings.html
+ /// Additionally, you can return a [`Command`] if you need to perform some
+ /// async action in the background on startup. This is useful if you want to
+ /// load state from a file, perform an initial HTTP request, etc.
fn new(flags: Self::Flags) -> (Self, Command<Self::Message>);
/// Returns the current title of the [`Application`].
///
/// This title can be dynamic! The runtime will automatically update the
/// title of your application when necessary.
- ///
- /// [`Application`]: trait.Application.html
fn title(&self) -> String;
/// Returns the event `Subscription` for the current state of the
@@ -79,8 +68,6 @@ pub trait Application: Program {
/// is returned.
///
/// By default, an application will run in windowed mode.
- ///
- /// [`Application`]: trait.Application.html
fn mode(&self) -> Mode {
Mode::Windowed
}
@@ -88,10 +75,6 @@ pub trait Application: Program {
/// Returns the background [`Color`] of the [`Application`].
///
/// By default, it returns [`Color::WHITE`].
- ///
- /// [`Color`]: struct.Color.html
- /// [`Application`]: trait.Application.html
- /// [`Color::WHITE`]: struct.Color.html#const.WHITE
fn background_color(&self) -> Color {
Color::WHITE
}
@@ -105,8 +88,6 @@ pub trait Application: Program {
/// while a scale factor of `0.5` will shrink them to half their size.
///
/// By default, it returns `1.0`.
- ///
- /// [`Application`]: trait.Application.html
fn scale_factor(&self) -> f64 {
1.0
}
@@ -114,8 +95,6 @@ pub trait Application: Program {
/// Runs an [`Application`] with an executor, compositor, and the provided
/// settings.
-///
-/// [`Application`]: trait.Application.html
pub fn run<A, E, C>(
settings: Settings<A::Flags>,
compositor_settings: C::Settings,
@@ -382,8 +361,6 @@ async fn run_instance<A, E, C>(
/// Returns true if the provided event should cause an [`Application`] to
/// exit.
-///
-/// [`Application`]: trait.Application.html
pub fn requests_exit(
event: &winit::event::WindowEvent<'_>,
_modifiers: winit::event::ModifiersState,
@@ -407,11 +384,7 @@ pub fn requests_exit(
}
/// Builds a [`UserInterface`] for the provided [`Application`], logging
-/// [`Debug`] information accordingly.
-///
-/// [`UserInterface`]: struct.UserInterface.html
-/// [`Application`]: trait.Application.html
-/// [`Debug`]: struct.Debug.html
+/// [`struct@Debug`] information accordingly.
pub fn build_user_interface<'a, A: Application>(
application: &'a mut A,
cache: Cache,
@@ -432,10 +405,6 @@ pub fn build_user_interface<'a, A: Application>(
/// Updates an [`Application`] by feeding it the provided messages, spawning any
/// resulting [`Command`], and tracking its [`Subscription`].
-///
-/// [`Application`]: trait.Application.html
-/// [`Command`]: struct.Command.html
-/// [`Subscription`]: struct.Subscription.html
pub fn update<A: Application, E: Executor>(
application: &mut A,
runtime: &mut Runtime<E, Proxy<A::Message>, A::Message>,
diff --git a/winit/src/application/state.rs b/winit/src/application/state.rs
index 4c0bfd34..58bc7ed6 100644
--- a/winit/src/application/state.rs
+++ b/winit/src/application/state.rs
@@ -6,8 +6,6 @@ use winit::event::WindowEvent;
use winit::window::Window;
/// The state of a windowed [`Application`].
-///
-/// [`Application`]: ../trait.Application.html
#[derive(Debug, Clone)]
pub struct State<A: Application> {
title: String,
@@ -23,9 +21,6 @@ pub struct State<A: Application> {
impl<A: Application> State<A> {
/// Creates a new [`State`] for the provided [`Application`] and window.
- ///
- /// [`State`]: struct.State.html
- /// [`Application`]: ../trait.Application.html
pub fn new(application: &A, window: &Window) -> Self {
let title = application.title();
let mode = application.mode();
@@ -56,17 +51,11 @@ impl<A: Application> State<A> {
}
/// Returns the current background [`Color`] of the [`State`].
- ///
- /// [`Color`]: ../struct.Color.html
- /// [`State`]: struct.State.html
pub fn background_color(&self) -> Color {
self.background_color
}
/// Returns the current [`Viewport`] of the [`State`].
- ///
- /// [`Viewport`]: ../struct.Viewport.html
- /// [`State`]: struct.State.html
pub fn viewport(&self) -> &Viewport {
&self.viewport
}
@@ -74,42 +63,26 @@ impl<A: Application> State<A> {
/// Returns the version of the [`Viewport`] of the [`State`].
///
/// The version is incremented every time the [`Viewport`] changes.
- ///
- /// [`Viewport`]: ../struct.Viewport.html
- /// [`State`]: struct.State.html
pub fn viewport_version(&self) -> usize {
self.viewport_version
}
/// Returns the physical [`Size`] of the [`Viewport`] of the [`State`].
- ///
- /// [`Size`]: ../struct.Size.html
- /// [`Viewport`]: ../struct.Viewport.html
- /// [`State`]: struct.State.html
pub fn physical_size(&self) -> Size<u32> {
self.viewport.physical_size()
}
/// Returns the logical [`Size`] of the [`Viewport`] of the [`State`].
- ///
- /// [`Size`]: ../struct.Size.html
- /// [`Viewport`]: ../struct.Viewport.html
- /// [`State`]: struct.State.html
pub fn logical_size(&self) -> Size<f32> {
self.viewport.logical_size()
}
/// Returns the current scale factor of the [`Viewport`] of the [`State`].
- ///
- /// [`Viewport`]: ../struct.Viewport.html
- /// [`State`]: struct.State.html
pub fn scale_factor(&self) -> f64 {
self.viewport.scale_factor()
}
/// Returns the current cursor position of the [`State`].
- ///
- /// [`State`]: struct.State.html
pub fn cursor_position(&self) -> Point {
conversion::cursor_position(
self.cursor_position,
@@ -118,16 +91,12 @@ impl<A: Application> State<A> {
}
/// Returns the current keyboard modifiers of the [`State`].
- ///
- /// [`State`]: struct.State.html
pub fn modifiers(&self) -> winit::event::ModifiersState {
self.modifiers
}
/// Processes the provided window event and updates the [`State`]
/// accordingly.
- ///
- /// [`State`]: struct.State.html
pub fn update(
&mut self,
window: &Window,
@@ -190,9 +159,7 @@ impl<A: Application> State<A> {
/// Normally an [`Application`] should be synchronized with its [`State`]
/// and window after calling [`Application::update`].
///
- /// [`State`]: struct.State.html
- /// [`Application`]: ../trait.Application.html
- /// [`Application::update`]: ../trait.Application.html#tymethod.update
+ /// [`Application::update`]: crate::Program::update
pub fn synchronize(&mut self, application: &A, window: &Window) {
// Update window title
let new_title = application.title();