add note explaining the difference between an ideal API and the exercise's
@@ -38,6 +38,17 @@ impl<T> FromIterator<T> for SimpleLinkedList<T> {
}
}
+// In general, it would be preferable to implement IntoIterator for SimpleLinkedList<T>
+// instead of implementing an explicit conversion to a vector. This is because, together,
+// FromIterator and IntoIterator enable conversion between arbitrary collections.
+// Given that implementation, converting to a vector is trivial:
+//
+// let vec: Vec<_> = simple_linked_list.into_iter().collect();
+//
+// The reason this exercise's API includes an explicit conversion to Vec<T> instead
+// of IntoIterator is that implementing that interface is fairly complicated, and
+// demands more of the student than we expect at this point in the track.
+
impl<T> Into<Vec<T>> for SimpleLinkedList<T> {
fn into(self) -> Vec<T> {
unimplemented!()
