pub struct ServerState { /* private fields */ }Implementations§
Source§impl ServerState
impl ServerState
pub fn new(args: Args) -> Self
pub fn should_return_error(&self) -> Option<u16>
pub fn get_response_length(&self) -> usize
pub fn get_slodown_ms(&self) -> u64
pub fn generate_lorem_content(&self, length: usize) -> String
pub fn count_tokens(&self, text: &str) -> Result<u32>
pub fn check_request_limit_exceeded(&self) -> bool
pub fn check_token_limit_exceeded(&self, new_tokens: u32) -> bool
pub fn increment_request_count(&self)
pub fn add_token_usage(&self, tokens: u32)
pub fn get_rate_limit_headers(&self) -> HeaderMap
Trait Implementations§
Source§impl Clone for ServerState
impl Clone for ServerState
Source§fn clone(&self) -> ServerState
fn clone(&self) -> ServerState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ServerState
impl RefUnwindSafe for ServerState
impl Send for ServerState
impl Sync for ServerState
impl Unpin for ServerState
impl UnsafeUnpin for ServerState
impl UnwindSafe for ServerState
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