Hide internal Task constructors

This commit is contained in:
Héctor Ramón Jiménez 2024-07-05 01:13:28 +02:00
parent 2b19471d1c
commit 88611d7653
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
11 changed files with 140 additions and 136 deletions

View file

@ -13,7 +13,7 @@ use crate::core::{
Padding, Pixels, Point, Rectangle, Shadow, Shell, Size, Theme, Vector,
Widget,
};
use crate::runtime::Task;
use crate::runtime::task::{self, Task};
/// An element decorating some content.
///
@ -538,7 +538,7 @@ pub fn visible_bounds(id: Id) -> Task<Option<Rectangle>> {
}
}
Task::widget(VisibleBounds {
task::widget(VisibleBounds {
target: id.into(),
depth: 0,
scrollables: Vec::new(),

View file

@ -12,7 +12,8 @@ use crate::pick_list::{self, PickList};
use crate::progress_bar::{self, ProgressBar};
use crate::radio::{self, Radio};
use crate::rule::{self, Rule};
use crate::runtime::{Action, Task};
use crate::runtime::task::{self, Task};
use crate::runtime::Action;
use crate::scrollable::{self, Scrollable};
use crate::slider::{self, Slider};
use crate::text::{self, Text};
@ -930,12 +931,12 @@ where
/// Focuses the previous focusable widget.
pub fn focus_previous<T>() -> Task<T> {
Task::effect(Action::widget(operation::focusable::focus_previous()))
task::effect(Action::widget(operation::focusable::focus_previous()))
}
/// Focuses the next focusable widget.
pub fn focus_next<T>() -> Task<T> {
Task::effect(Action::widget(operation::focusable::focus_next()))
task::effect(Action::widget(operation::focusable::focus_next()))
}
/// A container intercepting mouse events.

View file

@ -15,7 +15,8 @@ use crate::core::{
self, Background, Border, Clipboard, Color, Element, Layout, Length,
Pixels, Point, Rectangle, Shell, Size, Theme, Vector, Widget,
};
use crate::runtime::{Action, Task};
use crate::runtime::task::{self, Task};
use crate::runtime::Action;
pub use operation::scrollable::{AbsoluteOffset, RelativeOffset};
@ -955,13 +956,13 @@ impl From<Id> for widget::Id {
/// Produces a [`Task`] that snaps the [`Scrollable`] with the given [`Id`]
/// to the provided `percentage` along the x & y axis.
pub fn snap_to<T>(id: Id, offset: RelativeOffset) -> Task<T> {
Task::effect(Action::widget(operation::scrollable::snap_to(id.0, offset)))
task::effect(Action::widget(operation::scrollable::snap_to(id.0, offset)))
}
/// Produces a [`Task`] that scrolls the [`Scrollable`] with the given [`Id`]
/// to the provided [`AbsoluteOffset`] along the x & y axis.
pub fn scroll_to<T>(id: Id, offset: AbsoluteOffset) -> Task<T> {
Task::effect(Action::widget(operation::scrollable::scroll_to(
task::effect(Action::widget(operation::scrollable::scroll_to(
id.0, offset,
)))
}

View file

@ -30,7 +30,8 @@ use crate::core::{
Background, Border, Color, Element, Layout, Length, Padding, Pixels, Point,
Rectangle, Shell, Size, Theme, Vector, Widget,
};
use crate::runtime::{Action, Task};
use crate::runtime::task::{self, Task};
use crate::runtime::Action;
/// A field that can be filled with text.
///
@ -1142,13 +1143,13 @@ impl From<Id> for widget::Id {
/// Produces a [`Task`] that focuses the [`TextInput`] with the given [`Id`].
pub fn focus<T>(id: Id) -> Task<T> {
Task::effect(Action::widget(operation::focusable::focus(id.0)))
task::effect(Action::widget(operation::focusable::focus(id.0)))
}
/// Produces a [`Task`] that moves the cursor of the [`TextInput`] with the given [`Id`] to the
/// end.
pub fn move_cursor_to_end<T>(id: 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(
id.0,
)))
}
@ -1156,7 +1157,7 @@ pub fn move_cursor_to_end<T>(id: Id) -> Task<T> {
/// Produces a [`Task`] that moves the cursor of the [`TextInput`] with the given [`Id`] to the
/// front.
pub fn move_cursor_to_front<T>(id: 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(
id.0,
)))
}
@ -1164,14 +1165,14 @@ pub fn move_cursor_to_front<T>(id: Id) -> Task<T> {
/// Produces a [`Task`] that moves the cursor of the [`TextInput`] with the given [`Id`] to the
/// provided position.
pub fn move_cursor_to<T>(id: Id, position: usize) -> Task<T> {
Task::effect(Action::widget(operation::text_input::move_cursor_to(
task::effect(Action::widget(operation::text_input::move_cursor_to(
id.0, position,
)))
}
/// Produces a [`Task`] that selects all the content of the [`TextInput`] with the given [`Id`].
pub fn select_all<T>(id: Id) -> Task<T> {
Task::effect(Action::widget(operation::text_input::select_all(id.0)))
task::effect(Action::widget(operation::text_input::select_all(id.0)))
}
/// The state of a [`TextInput`].