summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorLibravatar Bingus <shankern@protonmail.com>2023-07-12 12:23:18 -0700
committerLibravatar Bingus <shankern@protonmail.com>2023-07-12 12:23:18 -0700
commit633f405f3f78bc7f82d2b2061491b0e011137451 (patch)
tree5ebfc1f45d216a5c14a90492563599e6969eab4d /src/lib.rs
parent41836dd80d0534608e7aedfbf2319c540a23de1a (diff)
parent21bd51426d900e271206f314e0c915dd41065521 (diff)
downloadiced-633f405f3f78bc7f82d2b2061491b0e011137451.tar.gz
iced-633f405f3f78bc7f82d2b2061491b0e011137451.tar.bz2
iced-633f405f3f78bc7f82d2b2061491b0e011137451.zip
Merge remote-tracking branch 'origin/master' into feat/multi-window-support
# Conflicts: # Cargo.toml # core/src/window/icon.rs # core/src/window/id.rs # core/src/window/position.rs # core/src/window/settings.rs # examples/integration/src/main.rs # examples/integration_opengl/src/main.rs # glutin/src/application.rs # native/src/subscription.rs # native/src/window.rs # runtime/src/window/action.rs # src/lib.rs # src/window.rs # winit/Cargo.toml # winit/src/application.rs # winit/src/icon.rs # winit/src/settings.rs # winit/src/window.rs
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs159
1 files changed, 122 insertions, 37 deletions
diff --git a/src/lib.rs b/src/lib.rs
index e7481c77..4ddcd9d8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -24,13 +24,13 @@
//! [scrollables]: https://gfycat.com/perkybaggybaboon-rust-gui
//! [Debug overlay with performance metrics]: https://gfycat.com/incredibledarlingbee
//! [Modular ecosystem]: https://github.com/iced-rs/iced/blob/master/ECOSYSTEM.md
-//! [renderer-agnostic native runtime]: https://github.com/iced-rs/iced/tree/0.8/native
+//! [renderer-agnostic native runtime]: https://github.com/iced-rs/iced/tree/0.9/native
//! [`wgpu`]: https://github.com/gfx-rs/wgpu-rs
-//! [built-in renderer]: https://github.com/iced-rs/iced/tree/0.8/wgpu
-//! [windowing shell]: https://github.com/iced-rs/iced/tree/0.8/winit
+//! [built-in renderer]: https://github.com/iced-rs/iced/tree/0.9/wgpu
+//! [windowing shell]: https://github.com/iced-rs/iced/tree/0.9/winit
//! [`dodrio`]: https://github.com/fitzgen/dodrio
//! [web runtime]: https://github.com/iced-rs/iced_web
-//! [examples]: https://github.com/iced-rs/iced/tree/0.8/examples
+//! [examples]: https://github.com/iced-rs/iced/tree/0.9/examples
//! [repository]: https://github.com/iced-rs/iced
//!
//! # Overview
@@ -163,62 +163,147 @@
)]
#![forbid(rust_2018_idioms, unsafe_code)]
#![allow(clippy::inherent_to_string, clippy::type_complexity)]
-#![cfg_attr(docsrs, feature(doc_cfg))]
+#![cfg_attr(docsrs, feature(doc_auto_cfg))]
+use iced_widget::graphics;
+use iced_widget::renderer;
+use iced_widget::style;
+use iced_winit as shell;
+use iced_winit::core;
+use iced_winit::runtime;
+
+pub use iced_futures::futures;
-mod element;
mod error;
-mod result;
mod sandbox;
pub mod application;
-pub mod clipboard;
-pub mod executor;
-pub mod keyboard;
-pub mod mouse;
-pub mod overlay;
pub mod settings;
pub mod time;
-pub mod touch;
-pub mod widget;
pub mod window;
-#[cfg(all(not(feature = "glow"), feature = "multi-window"))]
+#[cfg(feature = "advanced")]
+pub mod advanced;
+
+#[cfg(feature = "multi-window")]
pub mod multi_window;
-#[cfg(all(not(feature = "glow"), feature = "wgpu"))]
-use iced_winit as runtime;
+pub use style::theme;
+
+pub use crate::core::alignment;
+pub use crate::core::event;
+pub use crate::core::gradient;
+pub use crate::core::{
+ color, Alignment, Background, Color, ContentFit, Degrees, Gradient, Length,
+ Padding, Pixels, Point, Radians, Rectangle, Size, Vector,
+};
+pub use crate::runtime::Command;
+
+pub mod clipboard {
+ //! Access the clipboard.
+ pub use crate::runtime::clipboard::{read, write};
+}
+
+pub mod executor {
+ //! Choose your preferred executor to power your application.
+ pub use iced_futures::Executor;
+
+ /// A default cross-platform executor.
+ ///
+ /// - On native platforms, it will use:
+ /// - `iced_futures::backend::native::tokio` when the `tokio` feature is enabled.
+ /// - `iced_futures::backend::native::async-std` when the `async-std` feature is
+ /// enabled.
+ /// - `iced_futures::backend::native::smol` when the `smol` feature is enabled.
+ /// - `iced_futures::backend::native::thread_pool` otherwise.
+ ///
+ /// - On Wasm, it will use `iced_futures::backend::wasm::wasm_bindgen`.
+ pub type Default = iced_futures::backend::default::Executor;
+}
+
+pub mod font {
+ //! Load and use fonts.
+ pub use crate::core::font::*;
+ pub use crate::runtime::font::*;
+}
+
+pub mod keyboard {
+ //! Listen and react to keyboard events.
+ pub use crate::core::keyboard::{Event, KeyCode, Modifiers};
+}
-#[cfg(feature = "glow")]
-use iced_glutin as runtime;
+pub mod mouse {
+ //! Listen and react to mouse events.
+ pub use crate::core::mouse::{
+ Button, Cursor, Event, Interaction, ScrollDelta,
+ };
+}
-#[cfg(all(not(feature = "glow"), feature = "wgpu"))]
-use iced_wgpu as renderer;
+pub mod subscription {
+ //! Listen to external events in your application.
+ pub use iced_futures::subscription::{
+ channel, events, events_with, run, run_with_id, unfold, Subscription,
+ };
+}
-#[cfg(feature = "glow")]
-use iced_glow as renderer;
+#[cfg(feature = "system")]
+pub mod system {
+ //! Retrieve system information.
+ pub use crate::runtime::system::Information;
+ pub use crate::shell::system::*;
+}
+
+pub mod overlay {
+ //! Display interactive elements on top of other widgets.
+
+ /// A generic [`Overlay`].
+ ///
+ /// This is an alias of an `iced_native` element with a default `Renderer`.
+ ///
+ /// [`Overlay`]: iced_native::Overlay
+ pub type Element<'a, Message, Renderer = crate::Renderer> =
+ crate::core::overlay::Element<'a, Message, Renderer>;
+
+ pub use iced_widget::overlay::*;
+}
+
+pub mod touch {
+ //! Listen and react to touch events.
+ pub use crate::core::touch::{Event, Finger};
+}
-pub use iced_native::theme;
-pub use runtime::event;
-pub use runtime::subscription;
+pub mod widget {
+ //! Use the built-in widgets or create your own.
+ pub use iced_widget::*;
+
+ // We hide the re-exported modules by `iced_widget`
+ mod core {}
+ mod graphics {}
+ mod native {}
+ mod renderer {}
+ mod style {}
+ mod runtime {}
+}
pub use application::Application;
-pub use element::Element;
pub use error::Error;
pub use event::Event;
pub use executor::Executor;
-pub use renderer::Renderer;
-pub use result::Result;
+pub use font::Font;
pub use sandbox::Sandbox;
pub use settings::Settings;
pub use subscription::Subscription;
pub use theme::Theme;
-pub use runtime::alignment;
-pub use runtime::futures;
-pub use runtime::{
- color, Alignment, Background, Color, Command, ContentFit, Font, Length,
- Padding, Point, Rectangle, Size, Vector,
-};
+/// The default renderer.
+pub type Renderer<Theme = style::Theme> = renderer::Renderer<Theme>;
-#[cfg(feature = "system")]
-pub use runtime::system;
+/// A generic widget.
+///
+/// This is an alias of an `iced_native` element with a default `Renderer`.
+pub type Element<'a, Message, Renderer = crate::Renderer> =
+ crate::core::Element<'a, Message, Renderer>;
+
+/// The result of running an [`Application`].
+///
+/// [`Application`]: crate::Application
+pub type Result = std::result::Result<(), Error>;