2025-08-23 05:15:57 +02:00
|
|
|
//! Find and query widgets in your applications.
|
2024-11-05 14:06:36 +01:00
|
|
|
pub use iced_selector::{
|
2026-09-01 23:18:45 -04:00
|
|
|
Bounded, Candidate, Selector, Target, Text, focus, id, is_focused,
|
2024-11-05 14:06:36 +01:00
|
|
|
};
|
2025-08-27 10:54:53 +02:00
|
|
|
|
2025-08-23 05:15:57 +02:00
|
|
|
use crate::Task;
|
|
|
|
|
use crate::task;
|
|
|
|
|
|
2024-11-05 14:06:36 +01:00
|
|
|
/// Finds a widget matching the given [`Selector`].
|
|
|
|
|
pub fn find<S>(selector: S) -> Task<Option<S::Output>>
|
|
|
|
|
where
|
|
|
|
|
S: Selector + Send + 'static,
|
|
|
|
|
S::Output: Send + Clone + 'static,
|
|
|
|
|
{
|
|
|
|
|
task::widget(selector.find())
|
2025-08-23 05:15:57 +02:00
|
|
|
}
|
2025-08-27 10:54:53 +02:00
|
|
|
|
2024-11-05 14:06:36 +01:00
|
|
|
/// Finds all widgets matching the given [`Selector`].
|
|
|
|
|
pub fn find_all<S>(selector: S) -> Task<Vec<S::Output>>
|
2025-08-27 10:54:53 +02:00
|
|
|
where
|
|
|
|
|
S: Selector + Send + 'static,
|
2024-11-05 14:06:36 +01:00
|
|
|
S::Output: Send + Clone + 'static,
|
2025-08-27 10:54:53 +02:00
|
|
|
{
|
2024-11-05 14:06:36 +01:00
|
|
|
task::widget(selector.find_all())
|
2025-08-27 10:54:53 +02:00
|
|
|
}
|