pub struct AppState { /* private fields */ }Expand description
Application state management structure Provides thread-safe tracking of:
- Application status (running/stopped)
- Concurrent request processing
- Processing limits
- Application start time
Implementations§
Source§impl AppState
impl AppState
Sourcepub fn new(processing_limit: i32, commit_id: String) -> Self
pub fn new(processing_limit: i32, commit_id: String) -> Self
Creates a new AppState instance with specified processing limit
Sourcepub fn get_processing_limit(&self) -> i32
pub fn get_processing_limit(&self) -> i32
Returns the configured processing limit
Sourcepub fn get_commit_id(&self) -> &str
pub fn get_commit_id(&self) -> &str
Returns the application commit id
Sourcepub fn inc_processing(&self) -> i32
pub fn inc_processing(&self) -> i32
Atomically increments the processing counter Returns the previous value
Sourcepub fn dec_processing(&self) -> i32
pub fn dec_processing(&self) -> i32
Atomically decrements the processing counter Returns the previous value
Sourcepub fn get_processing(&self) -> i32
pub fn get_processing(&self) -> i32
Returns the current number of requests being processed
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Checks if the application is currently running
Sourcepub fn get_started_at(&self) -> SystemTime
pub fn get_started_at(&self) -> SystemTime
Returns the application start time
Auto Trait Implementations§
impl !Freeze for AppState
impl RefUnwindSafe for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin 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