pub struct UserQuota {
pub storage: StorageQuota,
pub bandwidth: BandwidthQuota,
pub rate_limit: RateLimitQuota,
}Expand description
Combined quota information for a user.
Fields§
§storage: StorageQuotaStorage quota.
bandwidth: BandwidthQuotaBandwidth quota.
rate_limit: RateLimitQuotaAPI rate limit quota.
Implementations§
Source§impl UserQuota
impl UserQuota
Sourcepub fn new(
storage: StorageQuota,
bandwidth: BandwidthQuota,
rate_limit: RateLimitQuota,
) -> Self
pub fn new( storage: StorageQuota, bandwidth: BandwidthQuota, rate_limit: RateLimitQuota, ) -> Self
Create new user quota.
Sourcepub fn can_perform_operation(
&self,
storage_bytes: Bytes,
bandwidth_bytes: Bytes,
) -> bool
pub fn can_perform_operation( &self, storage_bytes: Bytes, bandwidth_bytes: Bytes, ) -> bool
Check if user can perform an operation requiring both storage and bandwidth.
Sourcepub fn has_warning_threshold(&self) -> bool
pub fn has_warning_threshold(&self) -> bool
Check if any quota is nearly exhausted (>90%).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for UserQuota
impl<'de> Deserialize<'de> for UserQuota
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for UserQuota
impl RefUnwindSafe for UserQuota
impl Send for UserQuota
impl Sync for UserQuota
impl Unpin for UserQuota
impl UnwindSafe for UserQuota
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