mirror of https://github.com/rust-lang/reference
Document importing `main`
This commit is contained in:
parent
a0b119535e
commit
50a2c87f82
|
@ -119,6 +119,17 @@ fn main() -> impl std::process::Termination {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The `main` function may be an import, e.g. from an external crate or from the current one.
|
||||||
|
|
||||||
|
```rust
|
||||||
|
mod foo {
|
||||||
|
pub fn bar() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
use foo::bar as main;
|
||||||
|
```
|
||||||
|
|
||||||
> **Note**: Types with implementations of [`Termination`] in the standard library include:
|
> **Note**: Types with implementations of [`Termination`] in the standard library include:
|
||||||
>
|
>
|
||||||
> * `()`
|
> * `()`
|
||||||
|
|
Loading…
Reference in New Issue