summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/padding.rs2
-rw-r--r--core/src/text.rs2
-rw-r--r--core/src/widget/operation.rs4
-rw-r--r--core/src/widget/operation/focusable.rs14
4 files changed, 14 insertions, 8 deletions
diff --git a/core/src/padding.rs b/core/src/padding.rs
index fdaa0236..e26cdd9b 100644
--- a/core/src/padding.rs
+++ b/core/src/padding.rs
@@ -32,7 +32,7 @@ use crate::{Pixels, Size};
/// let widget = Widget::new().padding(20); // 20px on all sides
/// let widget = Widget::new().padding([10, 20]); // top/bottom, left/right
/// ```
-#[derive(Debug, Copy, Clone, Default)]
+#[derive(Debug, Copy, Clone, PartialEq, Default)]
pub struct Padding {
/// Top padding
pub top: f32,
diff --git a/core/src/text.rs b/core/src/text.rs
index 436fee9a..dc8f5785 100644
--- a/core/src/text.rs
+++ b/core/src/text.rs
@@ -252,7 +252,7 @@ pub struct Span<'a, Link = (), Font = crate::Font> {
}
/// A text highlight.
-#[derive(Debug, Clone, Copy)]
+#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Highlight {
/// The [`Background`] of the highlight.
pub background: Background,
diff --git a/core/src/widget/operation.rs b/core/src/widget/operation.rs
index 741e1a5f..4ee4b4a7 100644
--- a/core/src/widget/operation.rs
+++ b/core/src/widget/operation.rs
@@ -295,7 +295,7 @@ where
/// Chains the output of an [`Operation`] with the provided function to
/// build a new [`Operation`].
-pub fn chain<A, B, O>(
+pub fn then<A, B, O>(
operation: impl Operation<A> + 'static,
f: fn(A) -> O,
) -> impl Operation<B>
@@ -361,7 +361,7 @@ where
Outcome::Chain(Box::new((self.next)(value)))
}
Outcome::Chain(operation) => {
- Outcome::Chain(Box::new(chain(operation, self.next)))
+ Outcome::Chain(Box::new(then(operation, self.next)))
}
}
}
diff --git a/core/src/widget/operation/focusable.rs b/core/src/widget/operation/focusable.rs
index 0a6f2e96..867c682e 100644
--- a/core/src/widget/operation/focusable.rs
+++ b/core/src/widget/operation/focusable.rs
@@ -94,7 +94,10 @@ pub fn count() -> impl Operation<Count> {
/// Produces an [`Operation`] that searches for the current focused widget, and
/// - if found, focuses the previous focusable widget.
/// - if not found, focuses the last focusable widget.
-pub fn focus_previous() -> impl Operation {
+pub fn focus_previous<T>() -> impl Operation<T>
+where
+ T: Send + 'static,
+{
struct FocusPrevious {
count: Count,
current: usize,
@@ -128,13 +131,16 @@ pub fn focus_previous() -> impl Operation {
}
}
- operation::chain(count(), |count| FocusPrevious { count, current: 0 })
+ operation::then(count(), |count| FocusPrevious { count, current: 0 })
}
/// Produces an [`Operation`] that searches for the current focused widget, and
/// - if found, focuses the next focusable widget.
/// - if not found, focuses the first focusable widget.
-pub fn focus_next() -> impl Operation {
+pub fn focus_next<T>() -> impl Operation<T>
+where
+ T: Send + 'static,
+{
struct FocusNext {
count: Count,
current: usize,
@@ -162,7 +168,7 @@ pub fn focus_next() -> impl Operation {
}
}
- operation::chain(count(), |count| FocusNext { count, current: 0 })
+ operation::then(count(), |count| FocusNext { count, current: 0 })
}
/// Produces an [`Operation`] that searches for the current focused widget