Skip to content

Commit

Permalink
Give a more structure hint for iteration exercises (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeMathWalker authored Dec 18, 2024
1 parent 60947aa commit d5e1c00
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions exercises/06_ticket_management/04_iterators/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ use ticket_fields::{TicketDescription, TicketTitle};
// it contains using a `for` loop.
//
// Hint: you shouldn't have to implement the `Iterator` trait in this case.
// You want to *delegate* the iteration to the `Vec<Ticket>` field in `TicketStore`.
// Look at the standard library documentation for `Vec` to find the right type
// to return from `into_iter`.
#[derive(Clone)]
pub struct TicketStore {
tickets: Vec<Ticket>,
Expand Down
4 changes: 4 additions & 0 deletions exercises/06_ticket_management/05_iter/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
use ticket_fields::{TicketDescription, TicketTitle};

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

0 comments on commit d5e1c00

Please sign in to comment.