Skip to content

Commit d5e1c00

Browse files
Give a more structure hint for iteration exercises (#235)
1 parent 60947aa commit d5e1c00

File tree

2 files changed

+7
-0
lines changed
  • exercises/06_ticket_management

2 files changed

+7
-0
lines changed

exercises/06_ticket_management/04_iterators/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ use ticket_fields::{TicketDescription, TicketTitle};
55
// it contains using a `for` loop.
66
//
77
// Hint: you shouldn't have to implement the `Iterator` trait in this case.
8+
// You want to *delegate* the iteration to the `Vec<Ticket>` field in `TicketStore`.
9+
// Look at the standard library documentation for `Vec` to find the right type
10+
// to return from `into_iter`.
811
#[derive(Clone)]
912
pub struct TicketStore {
1013
tickets: Vec<Ticket>,

exercises/06_ticket_management/05_iter/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
use ticket_fields::{TicketDescription, TicketTitle};
22

33
// TODO: Provide an `iter` method that returns an iterator over `&Ticket` items.
4+
//
5+
// Hint: just like in the previous exercise, you want to delegate the iteration to
6+
// the `Vec<Ticket>` field in `TicketStore`. Look at the standard library documentation
7+
// for `Vec` to find the right type to return from `iter`.
48
#[derive(Clone)]
59
pub struct TicketStore {
610
tickets: Vec<Ticket>,

0 commit comments

Comments
 (0)