Write documentation for new iced_winit API

This commit is contained in:
Héctor Ramón Jiménez 2020-05-28 02:49:32 +02:00
parent 508128436c
commit ef28347f1c
5 changed files with 14 additions and 1 deletions

View File

@ -1,3 +1,4 @@
#![allow(missing_docs)]
#[derive(Debug)]
pub struct Debug;

View File

@ -1,3 +1,4 @@
//! Create interactive, native cross-platform applications.
use crate::{
conversion, mouse, Clipboard, Command, Debug, Executor, Mode, Proxy,
Runtime, Settings, Size, Subscription,
@ -72,6 +73,10 @@ 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,
@ -254,6 +259,8 @@ pub fn run<A, E, C>(
})
}
/// Handles a `WindowEvent` and mutates the provided control flow, keyboard
/// modifiers, viewport, and resized flag accordingly.
pub fn handle_window_event(
event: &winit::event::WindowEvent<'_>,
window: &winit::window::Window,

View File

@ -15,7 +15,7 @@
//! [`winit`]: https://github.com/rust-windowing/winit
//! [`Application`]: trait.Application.html
//! [`conversion`]: conversion
//#![deny(missing_docs)]
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![deny(unused_results)]
#![forbid(unsafe_code)]

View File

@ -5,6 +5,7 @@ use iced_native::futures::{
};
use std::pin::Pin;
/// An event loop proxy that implements `Sink`.
#[derive(Debug)]
pub struct Proxy<Message: 'static> {
raw: winit::event_loop::EventLoopProxy<Message>,
@ -19,6 +20,9 @@ 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 }
}

View File

@ -44,6 +44,7 @@ pub struct Window {
}
impl Window {
/// Converts the window settings into a `WindowBuilder` from `winit`.
pub fn into_builder(
self,
title: &str,