4 ms·
Both approaches are useful at different times. For example you wouldn't want to accidentally multiple a meter by a centimeter but you may want to provide std::i
by kevincox 2y ago
Both approaches are useful at different times. For example you wouldn't want to accidentally multiple a meter by a centimeter but you may want to provide std::io::Result<T> which is equivalent to Result<T, std::io::Error> but just a bit nicer to type.
For example in Rust you can do:
type Foo = Bar;
Which is just an alias, interchangeable with Bar.
Or you can do:
struct Foo(Bar);
Which is a completely new type that just so happens to contain a Bar.