The answer above suggests:
fn file_colour(stat: &io::FileStat) -> Box<Colour> { /* ... */ }
which works, but you need to wrap all of the returns in a Box::new()
call.
However, in Rust 1.26 you can now say
fn file_colour(stat: &io::FileStat) -> impl Colour { /* ... */ }
and simply return the value. No Box
needed.