This commit is contained in:
Nathan Sobo
2021-08-22 13:29:54 -06:00
parent 24639ec900
commit 638b533fc7
4 changed files with 312 additions and 304 deletions
+3 -3
View File
@@ -132,7 +132,7 @@ impl AnyAction for () {
#[macro_export]
macro_rules! action {
($name:ident, $arg:ty) => {
#[derive(Clone, Debug, Eq, PartialEq)]
#[derive(Clone, Debug)]
pub struct $name(pub $arg);
impl $crate::Action for $name {
@@ -3677,13 +3677,13 @@ mod tests {
});
let actions_clone = actions.clone();
cx.add_action(move |view: &mut ViewB, action: &Action, cx| {
cx.add_action(move |view: &mut ViewB, _: &Action, cx| {
cx.propagate_action();
actions_clone.borrow_mut().push(format!("{} c", view.id));
});
let actions_clone = actions.clone();
cx.add_action(move |view: &mut ViewB, action: &Action, cx| {
cx.add_action(move |view: &mut ViewB, _: &Action, cx| {
cx.propagate_action();
actions_clone.borrow_mut().push(format!("{} d", view.id));
});
+8 -1
View File
@@ -419,6 +419,13 @@ mod tests {
action!(B);
action!(Ab);
impl PartialEq for A {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}
impl Eq for A {}
#[derive(Clone, Debug, Eq, PartialEq)]
struct ActionArg {
a: &'static str,
@@ -465,7 +472,7 @@ mod tests {
}
impl Matcher {
fn test_keystroke<A: Action>(
fn test_keystroke<A: Action + Eq>(
&mut self,
keystroke: &str,
view_id: usize,