Write documentation for iced_test

This commit is contained in:
Héctor Ramón Jiménez 2024-12-17 04:13:19 +01:00
parent 8f6f5c13b0
commit 5220a064c5
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
7 changed files with 189 additions and 13 deletions

View file

@ -1,9 +1,13 @@
//! Select widgets of a user interface.
use crate::core::text;
use crate::core::widget;
/// A selector describes a strategy to find a certain widget in a user interface.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Selector {
/// Find the widget with the given [`widget::Id`].
Id(widget::Id),
/// Find the widget containing the given [`text::Fragment`].
Text(text::Fragment<'static>),
}
@ -19,6 +23,7 @@ impl From<&'static str> for Selector {
}
}
/// Creates [`Selector`] that finds the widget containing the given text fragment.
pub fn text(fragment: impl text::IntoFragment<'static>) -> Selector {
Selector::Text(fragment.into_fragment())
}