pub struct ScopeSet {
pub scopes: Arc<[String]>,
pub fingerprint_cache: OnceLock<String>,
}Expand description
Normalized set of OAuth scopes with a stable fingerprint cache.
Scopes are deduplicated and sorted so equality, ordering, and hashing
remain consistent across platforms. The fingerprint helper
lazily caches a base64 (no padding) SHA-256 digest of the normalized string and
the Hash implementation reuses that cache so hashing stays stable without
re-normalizing the strings.
Fields§
§scopes: Arc<[String]>The normalized scopes.
fingerprint_cache: OnceLock<String>The fingerprint of the normalized scopes.
Implementations§
Source§impl ScopeSet
impl ScopeSet
Sourcepub fn new<I, S>(scopes: I) -> Result<Self, ScopeValidationError>
pub fn new<I, S>(scopes: I) -> Result<Self, ScopeValidationError>
Creates a normalized scope set from any iterator.
Sourcepub fn contains(&self, scope: &str) -> bool
pub fn contains(&self, scope: &str) -> bool
Returns true if the normalized set contains the provided scope.
Sourcepub fn normalized(&self) -> String
pub fn normalized(&self) -> String
Returns the normalized string representation (space-delimited).
Sourcepub fn fingerprint(&self) -> String
pub fn fingerprint(&self) -> String
Stable fingerprint derived from the normalized scope list.
The fingerprint is a base64 (no padding) encoding of the SHA-256 digest for the normalized, space-delimited scope string and is cached after the first calculation.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ScopeSet
impl<'de> Deserialize<'de> for ScopeSet
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<'a> IntoIterator for &'a ScopeSet
impl<'a> IntoIterator for &'a ScopeSet
Source§impl Ord for ScopeSet
impl Ord for ScopeSet
Source§impl PartialOrd for ScopeSet
impl PartialOrd for ScopeSet
impl Eq for ScopeSet
Auto Trait Implementations§
impl !Freeze for ScopeSet
impl RefUnwindSafe for ScopeSet
impl Send for ScopeSet
impl Sync for ScopeSet
impl Unpin for ScopeSet
impl UnwindSafe for ScopeSet
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.