Result Type and File::open ->Result<File>

It has become convention in Rust to define "local" type aliases called Result that incorporate the local error type, in exactly this way that std::io does it. You'll also find the same in many crates, or in other type aliases called Result in other parts of libstd.

In the docs, you can quickly see the difference by looking at the color! Type aliases are orangeish and enums are green.

See also: doc search for Result

1 Like