use std::sync::Arc;
#[derive(Clone)]
pub struct AppState {
inner: Arc<Inner>,
}
struct Inner {
client: bezant::Client,
debug_token: Option<String>,
}
impl AppState {
#[must_use]
pub fn new(client: bezant::Client) -> Self {
Self {
inner: Arc::new(Inner {
client,
debug_token: None,
}),
}
}
#[must_use]
pub fn with_debug_token(client: bezant::Client, token: impl Into<String>) -> Self {
Self {
inner: Arc::new(Inner {
client,
debug_token: Some(token.into()),
}),
}
}
#[must_use]
pub fn client(&self) -> &bezant::Client {
&self.inner.client
}
#[must_use]
pub fn debug_token(&self) -> Option<&str> {
self.inner.debug_token.as_deref()
}
}