use std::borrow::Cow;
use autumn_web::app::AppBuilder;
use autumn_web::plugin::Plugin;
use autumn_web::plugin_contract::PluginContract;
use crate::assets::VANILLA_ASSETS;
pub const PLUGIN_NAME: &str = "autumn-plugin-vanilla";
#[derive(Debug, Default, Clone, Copy)]
#[must_use]
pub struct VanillaPlugin;
impl VanillaPlugin {
pub const fn new() -> Self {
Self
}
}
impl Plugin for VanillaPlugin {
fn name(&self) -> Cow<'static, str> {
Cow::Borrowed(PLUGIN_NAME)
}
fn contract(&self) -> Option<PluginContract> {
Some(
PluginContract::new(env!("CARGO_PKG_NAME"))
.plugin_version(env!("CARGO_PKG_VERSION"))
.autumn_web("0.10"),
)
}
fn build(self, app: AppBuilder) -> AppBuilder {
app.plugin_assets(&VANILLA_ASSETS)
}
}