pub struct Quota {
pub free: i64,
pub used: i64,
pub total: i64,
pub relative: f64,
}Expand description
User storage quota metrics and capacity constraints.
In Nextcloud, when a quota is set to unlimited, negative integer codes
(typically -3 or -2) are returned for free and total.
Official documentation: https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-api-overview.html#user-metadata
Fields§
§free: i64Space remaining in bytes, or negative code when unlimited.
used: i64Space consumed by user files in bytes.
total: i64Total storage capacity allocated in bytes, or negative code when unlimited.
relative: f64Storage usage ratio or percentage (e.g. 0.96 or 96.0).
Implementations§
Source§impl Quota
impl Quota
Sourcepub const fn new(free: i64, used: i64, total: i64, relative: f64) -> Self
pub const fn new(free: i64, used: i64, total: i64, relative: f64) -> Self
Creates a quota descriptor with explicit byte measurements.
Sourcepub const fn free(&self) -> i64
pub const fn free(&self) -> i64
Available free space in bytes, or a negative status code when unlimited.
Sourcepub const fn total(&self) -> i64
pub const fn total(&self) -> i64
Total storage allocation in bytes, or a negative status code when unlimited.
Sourcepub const fn is_unlimited(&self) -> bool
pub const fn is_unlimited(&self) -> bool
Whether the user has an unlimited storage allocation.
Sourcepub fn free_bytes(&self) -> Option<u64>
pub fn free_bytes(&self) -> Option<u64>
Available free storage in bytes, or None if quota is unlimited.
Sourcepub fn total_bytes(&self) -> Option<u64>
pub fn total_bytes(&self) -> Option<u64>
Total allocated storage capacity in bytes, or None if quota is unlimited.
Sourcepub fn used_bytes(&self) -> u64
pub fn used_bytes(&self) -> u64
Bytes currently consumed by user files.
Sourcepub fn relative_percentage(&self) -> f64
pub fn relative_percentage(&self) -> f64
Percentage of storage utilized (0.0 to 100.0).