Hi all,
I'm attempting to implement a linked list as part of the rust exercism track. I'm getting stuck on something that should be simple: implementing From
trait:
impl<'a, T: Clone> From<&'a [T]> for SimpleLinkedList<T> {
fn from(item: &[T]) -> Self {
let mut out: SimpleLinkedList<T>;
for i in item.iter() {
out.push(i);
//^^^ use of possibly uninitialized `out`
}
out
}
}
Why can't the for loop 'see' out
? Please forgive the naiveness, I'm very much a beginner (and my head seriously hurts).
Further, if there is a better way to implement this?
Mark