Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn func<T: iter::Iterator<Item = char>>(i: T) {
- //...
- }
- fn option_iter(input: Option<char>) {
- let i: Box<iter::Iterator<Item = char>> =
- if let Some(input) = input {
- Box::new(iter::once(input))
- } else {
- Box::new(iter::empty())
- };
- func(i);
- }
- let i = if let Some(input) = input {
- iter::once(input)
- } else {
- iter::empty()
- };
- func(i);
Add Comment
Please, Sign In to add comment