From d5e1c001081631453299db779ba5426077f91188 Mon Sep 17 00:00:00 2001 From: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:03:24 +0100 Subject: [PATCH] Give a more structure hint for iteration exercises (#235) --- exercises/06_ticket_management/04_iterators/src/lib.rs | 3 +++ exercises/06_ticket_management/05_iter/src/lib.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/exercises/06_ticket_management/04_iterators/src/lib.rs b/exercises/06_ticket_management/04_iterators/src/lib.rs index d55906c..e7eb9f9 100644 --- a/exercises/06_ticket_management/04_iterators/src/lib.rs +++ b/exercises/06_ticket_management/04_iterators/src/lib.rs @@ -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` 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, diff --git a/exercises/06_ticket_management/05_iter/src/lib.rs b/exercises/06_ticket_management/05_iter/src/lib.rs index da75366..71d3e51 100644 --- a/exercises/06_ticket_management/05_iter/src/lib.rs +++ b/exercises/06_ticket_management/05_iter/src/lib.rs @@ -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` 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,