#[main]Expand description
An attribute macro that defines an entry point to a Cot-powered app.
This macro is meant to wrap a function returning a structure implementing
[CotProject]. It should just initialize a [CotProject] and return it,
while the macro takes care of initializing an async runtime, creating a CLI
and running the app.
ยงExamples
use cot::project::RegisterAppsContext;
use cot::{App, AppBuilder, Project};
struct HelloApp;
impl App for HelloApp {
fn name(&self) -> &'static str {
env!("CARGO_PKG_NAME")
}
}
struct HelloProject;
impl Project for HelloProject {
fn register_apps(&self, apps: &mut AppBuilder, _context: &RegisterAppsContext) {
apps.register_with_views(HelloApp, "");
}
}
#[cot::main]
fn main() -> impl Project {
HelloProject
}