How do I handle/circumvent “Cannot assign to … which is behind a & reference” in Rust?
问题 I'd implementing a simple linked list. This is the (working) code I had so far: pub struct LinkedList<T> { start: Option<Box<Link<T>>>, } impl<T> LinkedList<T> { pub fn new() -> LinkedList<T> { return LinkedList { start: None }; } } struct Link<T> { value: Box<T>, next: Option<Box<Link<T>>>, } impl<T> Link<T> { fn new_end(value: T) -> Link<T> { return Link::new(value, None); } fn new(value: T, next: Option<Box<Link<T>>>) -> Link<T> { return Link { value: Box::new(value), next, }; } } Next on