use super::{
UriComponent,
UriRedactionReason,
UriRedactionStatus,
};
#[must_use]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct UriInspection {
pub(crate) status: UriRedactionStatus,
pub(crate) reasons: Vec<UriRedactionReason>,
pub(crate) components: Vec<UriComponent>,
}
impl UriInspection {
#[must_use = "inspect the URI processing status"]
#[inline]
pub const fn status(&self) -> UriRedactionStatus {
self.status
}
#[must_use = "inspect the URI processing reasons"]
#[inline]
pub fn reasons(&self) -> &[UriRedactionReason] {
&self.reasons
}
#[must_use]
#[inline]
pub const fn has_sensitive_components(&self) -> bool {
!self.components.is_empty()
}
#[must_use]
#[inline]
pub fn has_sensitive_component(&self, component: UriComponent) -> bool {
self.components.contains(&component)
}
#[must_use]
#[inline]
pub fn has_reason(&self, reason: UriRedactionReason) -> bool {
self.reasons.contains(&reason)
}
}