pub struct TierInfo {
pub name: String,
pub features: HashMap<String, FeatureAccess>,
}Expand description
Resolved tier information for an owner.
Fields§
§name: StringPlan name (e.g., “free”, “pro”, “enterprise”).
features: HashMap<String, FeatureAccess>Feature map: feature name → access level.
Implementations§
Source§impl TierInfo
impl TierInfo
Sourcepub fn has_feature(&self, name: &str) -> bool
pub fn has_feature(&self, name: &str) -> bool
Feature is available (Toggle=true or Limit>0).
Sourcepub fn is_enabled(&self, name: &str) -> bool
pub fn is_enabled(&self, name: &str) -> bool
Feature is explicitly enabled (Toggle only, false for Limit or missing).
Sourcepub fn limit(&self, name: &str) -> Option<u64>
pub fn limit(&self, name: &str) -> Option<u64>
Get the limit ceiling (Limit only, None for Toggle or missing).
Sourcepub fn limit_ceiling(&self, name: &str) -> Result<u64>
pub fn limit_ceiling(&self, name: &str) -> Result<u64>
Get the limit ceiling, returning typed errors for missing or non-limit features.
Returns Ok(ceiling) for Limit features.
§Errors
Error::forbiddenif the feature is missing.Error::internalif the feature is aToggle(not a limit).
Sourcepub fn check_limit(&self, name: &str, current: u64) -> Result<()>
pub fn check_limit(&self, name: &str, current: u64) -> Result<()>
Check current usage against limit ceiling.
Returns Ok(()) if usage is under the limit.
§Errors
Error::forbiddenif the feature is missing or usage >= limit.Error::internalif the feature is aToggle(not a limit).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TierInfo
impl<'de> Deserialize<'de> for TierInfo
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>,
Source§impl<S: Send + Sync> FromRequestParts<S> for TierInfo
Extracts TierInfo from request extensions.
impl<S: Send + Sync> FromRequestParts<S> for TierInfo
Extracts TierInfo from request extensions.
§Errors
Returns Error::internal if TierLayer
has not been applied (i.e., TierInfo is missing from extensions).
Source§impl<S: Send + Sync> OptionalFromRequestParts<S> for TierInfo
Optionally extracts TierInfo from request extensions.
impl<S: Send + Sync> OptionalFromRequestParts<S> for TierInfo
Optionally extracts TierInfo from request extensions.
Returns Ok(None) when TierLayer has not been applied
or the owner extractor returned None without a default tier configured.