mirror of https://github.com/rust-lang/reference
Merge pull request #1461 from clubby789/imported-main
Document importing `main`
This commit is contained in:
commit
824b9156b2
|
@ -86,6 +86,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:
|
||||
>
|
||||
> * `()`
|
||||
|
|
Loading…
Reference in New Issue