[−][src]Attribute Macro smol_potat_derive::main
#[main]
Enables an async main function.
Examples
Single-Threaded
By default, this spawns the single thread executor.
ⓘThis example is not tested
#[smol_potat::main] async fn main() -> std::io::Result<()> { Ok(()) }
Automatic Threadpool
Alternatively, smol_potat::main
can used to automatically
set the number of threads by adding the auto
feature (off
by default).
ⓘThis example is not tested
#[smol_potat::main] // with 'auto' feature enabled async fn main() -> std::io::Result<()> { Ok(()) }
Manually Configure Threads
To manually set the number of threads, add this to the attribute:
ⓘThis example is not tested
#[smol_potat::main(threads=3)] async fn main() -> std::io::Result<()> { Ok(()) }