do_the_walk may be generic now?
This commit is contained in:
parent
c647301662
commit
54e6613f14
@ -136,7 +136,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn do_the_walk<'a>(c: &'a (dyn Walkable<Output = &str>), path: &str) -> &'a str {
|
fn do_the_walk<'a, O: Walkable>(c: &'a dyn Walkable<Output = O>, path: &str) -> &'a O {
|
||||||
c.walk(path)
|
c.walk(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,6 +147,10 @@ mod tests {
|
|||||||
.iter()
|
.iter()
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect();
|
.collect();
|
||||||
assert_eq!(do_the_walk(&context, "cat"), "kitty");
|
let number_context: HashMap<&str, u32> = [("cat", 1), ("dog", 2), ("tiger", 3)]
|
||||||
|
.iter()
|
||||||
|
.cloned()
|
||||||
|
.collect();
|
||||||
|
assert_eq!(do_the_walk(&context, "cat"), &"kitty");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user