Guest User

Untitled

a guest
Jan 17th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. trait Store<I> where I: for<'a> IntoIterator<Item = &'a str> {
  2. fn query_valid_paths(&mut self, iter: I) -> Vec<String>;
  3. }
  4.  
  5. struct Bar<I> { vec: Vec<Box<dyn Store<I>>> }
  6. struct Foo {}
  7.  
  8. impl<I> Store<I> for Foo where I: for<'a> IntoIterator<Item = &'a str> {
  9. fn query_valid_paths(&mut self, iter: I) -> Vec<String> {
  10. iter.into_iter().map(|x| x.to_string()).collect()
  11. }
  12. }
  13.  
  14. fn main() {
  15. let something = "Something";
  16. let mut foo = Foo {};
  17. //println!("{:?}", foo.query_valid_paths(something.iter()));
  18. }
Add Comment
Please, Sign In to add comment