pub struct AppState {Show 13 fields
pub config: RwLock<Config>,
pub config_path: PathBuf,
pub db: Database,
pub templates: Tera,
pub markdown: MarkdownRenderer,
pub media_dir: PathBuf,
pub production_mode: bool,
pub csrf: Arc<CsrfManager>,
pub rate_limiter: Arc<RateLimiter>,
pub upload_rate_limiter: Arc<RateLimiter>,
pub write_rate_limiter: Arc<RateLimiter>,
pub analytics: Option<Arc<Analytics>>,
pub static_assets: HashMap<String, &'static str>,
}Fields§
§config: RwLock<Config>§config_path: PathBuf§db: Database§templates: Tera§markdown: MarkdownRenderer§media_dir: PathBuf§production_mode: bool§csrf: Arc<CsrfManager>§rate_limiter: Arc<RateLimiter>§upload_rate_limiter: Arc<RateLimiter>§write_rate_limiter: Arc<RateLimiter>Rate limiter for all write endpoints (content create/update/delete, settings, tags, users). 30 write operations per 60 seconds, 5-minute lockout.
analytics: Option<Arc<Analytics>>§static_assets: HashMap<String, &'static str>Implementations§
Source§impl AppState
impl AppState
pub fn new( config: Config, config_path: PathBuf, db: Database, production_mode: bool, ) -> Result<Self>
Sourcepub fn config(&self) -> RwLockReadGuard<'_, Config>
pub fn config(&self) -> RwLockReadGuard<'_, Config>
Get a read lock on the config
Sourcepub fn update_config(&self, new_config: Config) -> Result<()>
pub fn update_config(&self, new_config: Config) -> Result<()>
Update the config (writes to file and updates in-memory)
pub fn with_analytics(self, analytics: Arc<Analytics>) -> Self
Auto Trait Implementations§
impl !Freeze for AppState
impl !RefUnwindSafe for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin for AppState
impl !UnwindSafe for AppState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more