Skip to content

Commit 865c84b

Browse files
committed
Document importing main
1 parent a0b1195 commit 865c84b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/crates-and-source-files.md

+11
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,17 @@ fn main() -> impl std::process::Termination {
119119
}
120120
```
121121

122+
The `main` function may be a re-export, e.g. from an external crate or from the current one.
123+
124+
```rust
125+
mod foo {
126+
pub fn bar() {
127+
println!("Hello, world!");
128+
}
129+
}
130+
use foo::bar as main;
131+
```
132+
122133
> **Note**: Types with implementations of [`Termination`] in the standard library include:
123134
>
124135
> * `()`

0 commit comments

Comments
 (0)