diff options
Diffstat (limited to '')
| -rw-r--r-- | winit/src/application.rs | 43 | ||||
| -rw-r--r-- | winit/src/application/state.rs | 35 | ||||
| -rw-r--r-- | winit/src/clipboard.rs | 2 | ||||
| -rw-r--r-- | winit/src/conversion.rs | 13 | ||||
| -rw-r--r-- | winit/src/lib.rs | 3 | ||||
| -rw-r--r-- | winit/src/proxy.rs | 2 | ||||
| -rw-r--r-- | winit/src/settings.rs | 4 | 
7 files changed, 14 insertions, 88 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(); diff --git a/winit/src/clipboard.rs b/winit/src/clipboard.rs index 1ff029ab..93d53b11 100644 --- a/winit/src/clipboard.rs +++ b/winit/src/clipboard.rs @@ -5,8 +5,6 @@ pub struct Clipboard(window_clipboard::Clipboard);  impl Clipboard {      /// Creates a new [`Clipboard`] for the given window. -    /// -    /// [`Clipboard`]: struct.Clipboard.html      pub fn new(window: &winit::window::Window) -> Option<Clipboard> {          window_clipboard::Clipboard::new(window).map(Clipboard).ok()      } diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs index de38f246..6102b4b3 100644 --- a/winit/src/conversion.rs +++ b/winit/src/conversion.rs @@ -3,7 +3,7 @@  //! [`winit`]: https://github.com/rust-windowing/winit  //! [`iced_native`]: https://github.com/hecrj/iced/tree/master/native  use crate::{ -    keyboard::{self, KeyCode, ModifiersState}, +    keyboard::{self, KeyCode, Modifiers},      mouse, window, Event, Mode, Point,  }; @@ -89,7 +89,7 @@ pub fn window_event(              ..          } => Some(Event::Keyboard({              let key_code = key_code(*virtual_keycode); -            let modifiers = modifiers_state(modifiers); +            let modifiers = self::modifiers(modifiers);              match state {                  winit::event::ElementState::Pressed => { @@ -107,7 +107,7 @@ pub fn window_event(              }          })),          WindowEvent::ModifiersChanged(new_modifiers) => Some(Event::Keyboard( -            keyboard::Event::ModifiersChanged(modifiers_state(*new_modifiers)), +            keyboard::Event::ModifiersChanged(self::modifiers(*new_modifiers)),          )),          WindowEvent::HoveredFile(path) => {              Some(Event::Window(window::Event::FileHovered(path.clone()))) @@ -124,7 +124,6 @@ pub fn window_event(  /// Converts a [`Mode`] to a [`winit`] fullscreen mode.  /// -/// [`Mode`]: ../enum.Mode.html  /// [`winit`]: https://github.com/rust-windowing/winit  pub fn fullscreen(      monitor: Option<winit::monitor::MonitorHandle>, @@ -180,10 +179,8 @@ pub fn mouse_button(mouse_button: winit::event::MouseButton) -> mouse::Button {  ///  /// [`winit`]: https://github.com/rust-windowing/winit  /// [`iced_native`]: https://github.com/hecrj/iced/tree/master/native -pub fn modifiers_state( -    modifiers: winit::event::ModifiersState, -) -> ModifiersState { -    ModifiersState { +pub fn modifiers(modifiers: winit::event::ModifiersState) -> Modifiers { +    Modifiers {          shift: modifiers.shift(),          control: modifiers.ctrl(),          alt: modifiers.alt(), diff --git a/winit/src/lib.rs b/winit/src/lib.rs index 8ca8eec1..dfee99cb 100644 --- a/winit/src/lib.rs +++ b/winit/src/lib.rs @@ -13,8 +13,7 @@  //!  //! [`iced_native`]: https://github.com/hecrj/iced/tree/master/native  //! [`winit`]: https://github.com/rust-windowing/winit -//! [`Application`]: trait.Application.html -//! [`conversion`]: conversion +//! [`conversion`]: crate::conversion  #![deny(missing_docs)]  #![deny(missing_debug_implementations)]  #![deny(unused_results)] diff --git a/winit/src/proxy.rs b/winit/src/proxy.rs index 532f8c56..7b9074d7 100644 --- a/winit/src/proxy.rs +++ b/winit/src/proxy.rs @@ -21,8 +21,6 @@ impl<Message: 'static> Clone for Proxy<Message> {  impl<Message: 'static> Proxy<Message> {      /// Creates a new [`Proxy`] from an `EventLoopProxy`. -    /// -    /// [`Proxy`]: struct.Proxy.html      pub fn new(raw: winit::event_loop::EventLoopProxy<Message>) -> Self {          Self { raw }      } diff --git a/winit/src/settings.rs b/winit/src/settings.rs index a6b96ec7..2e8715cd 100644 --- a/winit/src/settings.rs +++ b/winit/src/settings.rs @@ -17,13 +17,11 @@ use winit::window::WindowBuilder;  #[derive(Debug, Clone, Default)]  pub struct Settings<Flags> {      /// The [`Window`] settings -    /// -    /// [`Window`]: struct.Window.html      pub window: Window,      /// The data needed to initialize an [`Application`].      /// -    /// [`Application`]: trait.Application.html +    /// [`Application`]: crate::Application      pub flags: Flags,  } | 
