#[main]Expand description
Marks the entrypoint of a Witchcraft server.
This macro should be applied to a function taking 3 arguments: the server’s install config, a Refreshable of the
server’s runtime config, and a mutable reference to the Witchcraft context object. It is a simple convenience
function that wraps the annotated function in one that passes it to the witchcraft_server::init function.
§Examples
ⓘ
use conjure_error::Error;
use witchcraft_server::config::install::InstallConfig;
use witchcraft_server::config::runtime::RuntimeConfig;
use witchcraft_server::Witchcraft;
use refreshable::Refreshable;
#[witchcraft_server::main]
fn main(
install: InstallConfig,
runtime: Refreshable<RuntimeConfig, Error>,
wc: &mut Witchcraft,
) -> Result<(), Error> {
// initialization code...
Ok(())
}Expands to:
ⓘ
use conjure_error::Error;
use witchcraft_server::config::install::InstallConfig;
use witchcraft_server::config::runtime::RuntimeConfig;
use witchcraft_server::Witchcraft;
use refreshable::Refreshable;
fn main() {
fn inner_main(
install: InstallConfig,
runtime: Refreshable<RuntimeConfig, Error>,
wc: &mut Witchcraft,
) -> Result<(), Error> {
// initialization code...
Ok(())
}
witchcraft_server::init(inner_main)
}