pub struct ScopeKey {
pub namespace: String,
pub domain: Option<String>,
pub workspace_id: Option<String>,
pub repo_id: Option<String>,
}Expand description
Compact, hashable representation of all scope dimensions.
This is the canonical partition key for the stack. Two ScopeKeys
are equal iff all four fields match exactly.
§Display format
namespace[/domain][@workspace_id][#repo_id]
Examples:
prod— namespace onlyprod/code— with domainprod/code@ws1#myrepo— fully specified
Fields§
§namespace: String§domain: Option<String>§workspace_id: Option<String>§repo_id: Option<String>Implementations§
Source§impl ScopeKey
impl ScopeKey
Sourcepub fn namespace_only(ns: impl Into<String>) -> ScopeKey
pub fn namespace_only(ns: impl Into<String>) -> ScopeKey
Create from just a namespace (all other dimensions None).
Sourcepub fn from_legacy_namespace(namespace: impl Into<String>) -> ScopeKey
pub fn from_legacy_namespace(namespace: impl Into<String>) -> ScopeKey
Deterministic migration from a legacy bare namespace string.
This is the canonical namespace→ScopeKey mapping. All bridge, importer, and test code must use this for legacy namespace conversion.
Mapping: "foo" → ScopeKey { namespace: "foo", domain: None, workspace_id: None, repo_id: None }
Sourcepub fn to_legacy_namespace(&self) -> &str
pub fn to_legacy_namespace(&self) -> &str
Reverse mapping: extract the legacy namespace string.
This is only valid for ScopeKeys that were created from a legacy namespace
(i.e. all dimensions except namespace are None). For multi-dimensional
scopes, use the namespace field directly.
Sourcepub fn is_namespace_only(&self) -> bool
pub fn is_namespace_only(&self) -> bool
Returns true if this scope has only a namespace (no domain/workspace/repo).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ScopeKey
impl<'de> Deserialize<'de> for ScopeKey
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ScopeKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ScopeKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for ScopeKey
Source§impl JsonSchema for ScopeKey
impl JsonSchema for ScopeKey
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreSource§impl Ord for ScopeKey
impl Ord for ScopeKey
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for ScopeKey
impl PartialOrd for ScopeKey
Source§impl Serialize for ScopeKey
impl Serialize for ScopeKey
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for ScopeKey
Auto Trait Implementations§
impl Freeze for ScopeKey
impl RefUnwindSafe for ScopeKey
impl Send for ScopeKey
impl Sync for ScopeKey
impl Unpin for ScopeKey
impl UnsafeUnpin for ScopeKey
impl UnwindSafe for ScopeKey
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
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.