Fix broken intra-doc links
This commit is contained in:
parent
fbe60feb7e
commit
885d45f435
7 changed files with 21 additions and 21 deletions
|
|
@ -3,7 +3,7 @@ use crate::runtime::Task;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
/// A specific boot strategy for a [`Program`].
|
/// A specific boot strategy for a [`Program`](crate::Program).
|
||||||
pub struct Preset<State, Message> {
|
pub struct Preset<State, Message> {
|
||||||
name: Cow<'static, str>,
|
name: Cow<'static, str>,
|
||||||
boot: Box<dyn Fn() -> (State, Task<Message>)>,
|
boot: Box<dyn Fn() -> (State, Task<Message>)>,
|
||||||
|
|
@ -26,7 +26,7 @@ impl<State, Message> Preset<State, Message> {
|
||||||
&self.name
|
&self.name
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Boots the [`Preset`], returning the initial [`Program`] state and
|
/// Boots the [`Preset`], returning the initial [`Program`](crate::Program) state and
|
||||||
/// a [`Task`] for concurrent booting.
|
/// a [`Task`] for concurrent booting.
|
||||||
pub fn boot(&self) -> (State, Task<Message>) {
|
pub fn boot(&self) -> (State, Task<Message>) {
|
||||||
(self.boot)()
|
(self.boot)()
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use std::sync::Arc;
|
||||||
/// A test error.
|
/// A test error.
|
||||||
#[derive(Debug, Clone, thiserror::Error)]
|
#[derive(Debug, Clone, thiserror::Error)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// No matching widget was found for the [`Selector`].
|
/// No matching widget was found for the [`Selector`](crate::Selector).
|
||||||
#[error("no matching widget was found for the selector: {selector}")]
|
#[error("no matching widget was found for the selector: {selector}")]
|
||||||
NotFound { selector: String },
|
NotFound { selector: String },
|
||||||
#[error("the matching target is not visible: {target:?}")]
|
#[error("the matching target is not visible: {target:?}")]
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@
|
||||||
//! let _ = ui.click("-");
|
//! let _ = ui.click("-");
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! [`Simulator::click`] takes a [`Selector`]. A [`Selector`] describes a way to query the widgets of an interface. In this case,
|
//! [`Simulator::click`] takes a type implementing the [`Selector`] trait. A [`Selector`] describes a way to query the widgets of an interface.
|
||||||
//! [`selector::text`] lets us select a widget by the text it contains.
|
//! In this case, we leverage the [`Selector`] implementation of `&str`, which selects a widget by the text it contains.
|
||||||
//!
|
//!
|
||||||
//! We can now process any messages produced by these interactions and then assert that the final value of our counter is
|
//! We can now process any messages produced by these interactions and then assert that the final value of our counter is
|
||||||
//! indeed `1`!
|
//! indeed `1`!
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Finds the [`Target`] of the given widget [`Selector`] in the [`Simulator`].
|
/// Finds the target of the given widget [`Selector`] in the [`Simulator`].
|
||||||
pub fn find<S>(&mut self, selector: S) -> Result<S::Output, Error>
|
pub fn find<S>(&mut self, selector: S) -> Result<S::Output, Error>
|
||||||
where
|
where
|
||||||
S: Selector + Send,
|
S: Selector + Send,
|
||||||
|
|
@ -135,10 +135,10 @@ where
|
||||||
self.cursor = mouse::Cursor::Available(position.into());
|
self.cursor = mouse::Cursor::Available(position.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clicks the [`Target`] found by the given [`Selector`], if any.
|
/// Clicks the [`Bounded`] target found by the given [`Selector`], if any.
|
||||||
///
|
///
|
||||||
/// This consists in:
|
/// This consists in:
|
||||||
/// - Pointing the mouse cursor at the center of the [`Target`].
|
/// - Pointing the mouse cursor at the center of the [`Bounded`] target.
|
||||||
/// - Simulating a [`click`].
|
/// - Simulating a [`click`].
|
||||||
pub fn click<S>(&mut self, selector: S) -> Result<S::Output, Error>
|
pub fn click<S>(&mut self, selector: S) -> Result<S::Output, Error>
|
||||||
where
|
where
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the [`Id`] of the [`Container`].
|
/// Sets the [`widget::Id`] of the [`Container`].
|
||||||
pub fn id(mut self, id: impl Into<widget::Id>) -> Self {
|
pub fn id(mut self, id: impl Into<widget::Id>) -> Self {
|
||||||
self.id = Some(id.into());
|
self.id = Some(id.into());
|
||||||
self
|
self
|
||||||
|
|
@ -458,7 +458,7 @@ pub fn draw_background<Renderer>(
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Produces a [`Task`] that queries the visible screen bounds of the
|
/// Produces a [`Task`] that queries the visible screen bounds of the
|
||||||
/// [`Container`] with the given [`Id`].
|
/// [`Container`] with the given [`widget::Id`].
|
||||||
pub fn visible_bounds(_id: impl Into<widget::Id>) -> Task<Option<Rectangle>> {
|
pub fn visible_bounds(_id: impl Into<widget::Id>) -> Task<Option<Rectangle>> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ where
|
||||||
self.validate()
|
self.validate()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the [`Id`] of the [`Scrollable`].
|
/// Sets the [`widget::Id`] of the [`Scrollable`].
|
||||||
pub fn id(mut self, id: impl Into<widget::Id>) -> Self {
|
pub fn id(mut self, id: impl Into<widget::Id>) -> Self {
|
||||||
self.id = Some(id.into());
|
self.id = Some(id.into());
|
||||||
self
|
self
|
||||||
|
|
@ -1262,7 +1262,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Produces a [`Task`] that snaps the [`Scrollable`] with the given [`Id`]
|
/// Produces a [`Task`] that snaps the [`Scrollable`] with the given [`widget::Id`]
|
||||||
/// to the provided [`RelativeOffset`].
|
/// to the provided [`RelativeOffset`].
|
||||||
pub fn snap_to<T>(
|
pub fn snap_to<T>(
|
||||||
id: impl Into<widget::Id>,
|
id: impl Into<widget::Id>,
|
||||||
|
|
@ -1274,7 +1274,7 @@ pub fn snap_to<T>(
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Produces a [`Task`] that scrolls the [`Scrollable`] with the given [`Id`]
|
/// Produces a [`Task`] that scrolls the [`Scrollable`] with the given [`widget::Id`]
|
||||||
/// to the provided [`AbsoluteOffset`].
|
/// to the provided [`AbsoluteOffset`].
|
||||||
pub fn scroll_to<T>(
|
pub fn scroll_to<T>(
|
||||||
id: impl Into<widget::Id>,
|
id: impl Into<widget::Id>,
|
||||||
|
|
@ -1286,7 +1286,7 @@ pub fn scroll_to<T>(
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Produces a [`Task`] that scrolls the [`Scrollable`] with the given [`Id`]
|
/// Produces a [`Task`] that scrolls the [`Scrollable`] with the given [`widget::Id`]
|
||||||
/// by the provided [`AbsoluteOffset`].
|
/// by the provided [`AbsoluteOffset`].
|
||||||
pub fn scroll_by<T>(
|
pub fn scroll_by<T>(
|
||||||
id: impl Into<widget::Id>,
|
id: impl Into<widget::Id>,
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the [`Id`] of the [`TextInput`].
|
/// Sets the [`widget::Id`] of the [`TextInput`].
|
||||||
pub fn id(mut self, id: impl Into<widget::Id>) -> Self {
|
pub fn id(mut self, id: impl Into<widget::Id>) -> Self {
|
||||||
self.id = Some(id.into());
|
self.id = Some(id.into());
|
||||||
self
|
self
|
||||||
|
|
@ -1445,17 +1445,17 @@ pub enum Side {
|
||||||
Right,
|
Right,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Produces a [`Task`] that returns whether the [`TextInput`] with the given [`Id`] is focused or not.
|
/// Produces a [`Task`] that returns whether the [`TextInput`] with the given [`widget::Id`] is focused or not.
|
||||||
pub fn is_focused(id: impl Into<widget::Id>) -> Task<bool> {
|
pub fn is_focused(id: impl Into<widget::Id>) -> Task<bool> {
|
||||||
task::widget(operation::focusable::is_focused(id.into()))
|
task::widget(operation::focusable::is_focused(id.into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Produces a [`Task`] that focuses the [`TextInput`] with the given [`Id`].
|
/// Produces a [`Task`] that focuses the [`TextInput`] with the given [`widget::Id`].
|
||||||
pub fn focus<T>(id: impl Into<widget::Id>) -> Task<T> {
|
pub fn focus<T>(id: impl Into<widget::Id>) -> Task<T> {
|
||||||
task::effect(Action::widget(operation::focusable::focus(id.into())))
|
task::effect(Action::widget(operation::focusable::focus(id.into())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Produces a [`Task`] that moves the cursor of the [`TextInput`] with the given [`Id`] to the
|
/// Produces a [`Task`] that moves the cursor of the [`TextInput`] with the given [`widget::Id`] to the
|
||||||
/// end.
|
/// end.
|
||||||
pub fn move_cursor_to_end<T>(id: impl Into<widget::Id>) -> Task<T> {
|
pub fn move_cursor_to_end<T>(id: impl Into<widget::Id>) -> Task<T> {
|
||||||
task::effect(Action::widget(operation::text_input::move_cursor_to_end(
|
task::effect(Action::widget(operation::text_input::move_cursor_to_end(
|
||||||
|
|
@ -1463,7 +1463,7 @@ pub fn move_cursor_to_end<T>(id: impl Into<widget::Id>) -> Task<T> {
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Produces a [`Task`] that moves the cursor of the [`TextInput`] with the given [`Id`] to the
|
/// Produces a [`Task`] that moves the cursor of the [`TextInput`] with the given [`widget::Id`] to the
|
||||||
/// front.
|
/// front.
|
||||||
pub fn move_cursor_to_front<T>(id: impl Into<widget::Id>) -> Task<T> {
|
pub fn move_cursor_to_front<T>(id: impl Into<widget::Id>) -> Task<T> {
|
||||||
task::effect(Action::widget(operation::text_input::move_cursor_to_front(
|
task::effect(Action::widget(operation::text_input::move_cursor_to_front(
|
||||||
|
|
@ -1471,7 +1471,7 @@ pub fn move_cursor_to_front<T>(id: impl Into<widget::Id>) -> Task<T> {
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Produces a [`Task`] that moves the cursor of the [`TextInput`] with the given [`Id`] to the
|
/// Produces a [`Task`] that moves the cursor of the [`TextInput`] with the given [`widget::Id`] to the
|
||||||
/// provided position.
|
/// provided position.
|
||||||
pub fn move_cursor_to<T>(
|
pub fn move_cursor_to<T>(
|
||||||
id: impl Into<widget::Id>,
|
id: impl Into<widget::Id>,
|
||||||
|
|
@ -1483,7 +1483,7 @@ pub fn move_cursor_to<T>(
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Produces a [`Task`] that selects all the content of the [`TextInput`] with the given [`Id`].
|
/// Produces a [`Task`] that selects all the content of the [`TextInput`] with the given [`widget::Id`].
|
||||||
pub fn select_all<T>(id: impl Into<widget::Id>) -> Task<T> {
|
pub fn select_all<T>(id: impl Into<widget::Id>) -> Task<T> {
|
||||||
task::effect(Action::widget(operation::text_input::select_all(id.into())))
|
task::effect(Action::widget(operation::text_input::select_all(id.into())))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue