summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-10 00:34:21 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-10 00:34:21 +0200
commitb8e5693a3089d728b4f8d4b3b0b7197202ebd732 (patch)
tree79a9f84f9920525657fbe03d53ce33bab09053d7 /src
parent956512338905bac0b156fdaf16fe3c3e07e97a84 (diff)
parenta3489e4af960388e9f73988b88df361022a654a4 (diff)
downloadiced-b8e5693a3089d728b4f8d4b3b0b7197202ebd732.tar.gz
iced-b8e5693a3089d728b4f8d4b3b0b7197202ebd732.tar.bz2
iced-b8e5693a3089d728b4f8d4b3b0b7197202ebd732.zip
Merge branch 'master' into explicit-text-caching
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs27
-rw-r--r--src/settings.rs2
-rw-r--r--src/window/icon.rs11
3 files changed, 24 insertions, 16 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 36f48ba2..3cbe716a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -20,9 +20,9 @@
//! Check out the [repository] and the [examples] for more details!
//!
//! [Cross-platform support]: https://github.com/iced-rs/iced/blob/master/docs/images/todos_desktop.jpg?raw=true
-//! [text inputs]: https://gfycat.com/alertcalmcrow-rust-gui
-//! [scrollables]: https://gfycat.com/perkybaggybaboon-rust-gui
-//! [Debug overlay with performance metrics]: https://gfycat.com/incredibledarlingbee
+//! [text inputs]: https://iced.rs/examples/text_input.mp4
+//! [scrollables]: https://iced.rs/examples/scrollable.mp4
+//! [Debug overlay with performance metrics]: https://iced.rs/examples/debug.mp4
//! [Modular ecosystem]: https://github.com/iced-rs/iced/blob/master/ECOSYSTEM.md
//! [renderer-agnostic native runtime]: https://github.com/iced-rs/iced/tree/0.10/runtime
//! [`wgpu`]: https://github.com/gfx-rs/wgpu-rs
@@ -151,6 +151,7 @@
#![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
)]
+#![forbid(rust_2018_idioms, unsafe_code)]
#![deny(
missing_debug_implementations,
missing_docs,
@@ -159,9 +160,9 @@
clippy::from_over_into,
clippy::needless_borrow,
clippy::new_without_default,
- clippy::useless_conversion
+ clippy::useless_conversion,
+ rustdoc::broken_intra_doc_links
)]
-#![forbid(rust_2018_idioms, unsafe_code)]
#![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
use iced_widget::graphics;
@@ -187,7 +188,6 @@ pub mod advanced;
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, BorderRadius, Color, ContentFit, Degrees,
@@ -223,9 +223,16 @@ pub mod font {
pub use crate::runtime::font::*;
}
+pub mod event {
+ //! Handle events of a user interface.
+ pub use crate::core::event::{Event, MacOS, PlatformSpecific, Status};
+ pub use iced_futures::event::{listen, listen_raw, listen_with};
+}
+
pub mod keyboard {
//! Listen and react to keyboard events.
pub use crate::core::keyboard::{Event, KeyCode, Modifiers};
+ pub use iced_futures::keyboard::{on_key_press, on_key_release};
}
pub mod mouse {
@@ -238,7 +245,7 @@ pub mod mouse {
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,
+ channel, run, run_with_id, unfold, Subscription,
};
}
@@ -252,11 +259,11 @@ pub mod system {
pub mod overlay {
//! Display interactive elements on top of other widgets.
- /// A generic [`Overlay`].
+ /// A generic overlay.
///
- /// This is an alias of an `iced_native` element with a default `Renderer`.
+ /// This is an alias of an [`overlay::Element`] with a default `Renderer`.
///
- /// [`Overlay`]: iced_native::Overlay
+ /// [`overlay::Element`]: crate::core::overlay::Element
pub type Element<'a, Message, Renderer = crate::Renderer> =
crate::core::overlay::Element<'a, Message, Renderer>;
diff --git a/src/settings.rs b/src/settings.rs
index 794f89fd..d9778d7e 100644
--- a/src/settings.rs
+++ b/src/settings.rs
@@ -23,7 +23,7 @@ pub struct Settings<Flags> {
/// The default [`Font`] to be used.
///
- /// By default, it uses [`Font::SansSerif`].
+ /// By default, it uses [`Family::SansSerif`](crate::font::Family::SansSerif).
pub default_font: Font,
/// The text size that will be used by default.
diff --git a/src/window/icon.rs b/src/window/icon.rs
index 0fe010ca..ef71c228 100644
--- a/src/window/icon.rs
+++ b/src/window/icon.rs
@@ -10,10 +10,10 @@ use std::path::Path;
/// Creates an icon from an image file.
///
-/// This will return an error in case the file is missing at run-time. You may prefer [`Self::from_file_data`] instead.
+/// This will return an error in case the file is missing at run-time. You may prefer [`from_file_data`] instead.
#[cfg(feature = "image")]
pub fn from_file<P: AsRef<Path>>(icon_path: P) -> Result<Icon, Error> {
- let icon = image_rs::io::Reader::open(icon_path)?.decode()?.to_rgba8();
+ let icon = image::io::Reader::open(icon_path)?.decode()?.to_rgba8();
Ok(icon::from_rgba(icon.to_vec(), icon.width(), icon.height())?)
}
@@ -25,9 +25,10 @@ pub fn from_file<P: AsRef<Path>>(icon_path: P) -> Result<Icon, Error> {
#[cfg(feature = "image")]
pub fn from_file_data(
data: &[u8],
- explicit_format: Option<image_rs::ImageFormat>,
+ explicit_format: Option<image::ImageFormat>,
) -> Result<Icon, Error> {
- let mut icon = image_rs::io::Reader::new(std::io::Cursor::new(data));
+ let mut icon = image::io::Reader::new(std::io::Cursor::new(data));
+
let icon_with_format = match explicit_format {
Some(format) => {
icon.set_format(format);
@@ -59,5 +60,5 @@ pub enum Error {
/// The `image` crate reported an error.
#[cfg(feature = "image")]
#[error("Unable to create icon from a file: {0}")]
- ImageError(#[from] image_rs::error::ImageError),
+ ImageError(#[from] image::error::ImageError),
}