use core::net::{IpAddr, SocketAddr};
#[cfg(feature = "tera")]
use super::{
config::HtmlTemplates,
errors::AppError,
};
#[cfg(feature = "tera")]
use ::{
core::future::Future,
tera::{Context, Tera},
};
pub trait StateProvider: Send + Sync + 'static {
fn address(&self) -> Option<SocketAddr>;
#[cfg(feature = "tera")]
fn html_templates_config(&self) -> &HtmlTemplates;
fn host(&self) -> IpAddr;
fn port(&self) -> u16;
#[cfg(feature = "tera")]
fn render<T: AsRef<str> + Send>(
&self,
template: T,
context: &Context,
) -> impl Future<Output = Result<String, AppError>> + Send;
fn set_address(&self, address: Option<SocketAddr>);
#[cfg(feature = "tera")]
fn tera(&self) -> &Tera;
fn title(&self) -> &String;
}