pub struct Scope {
pub platform: PlatformTag,
pub source_kind: SourceKind,
pub locator: String,
}Expand description
The canonical identity of an import source.
locator is the platform’s canonical, reinstall-stable locator per the owner doc’s
table — the iOS smart-album subtype name or collection localIdentifier, the Android
MediaStore relative path (never BUCKET_ID), the desktop canonicalized path, or a
removable volume’s UUID plus relative path. Producing it is the platform adapter’s job;
this type only fixes how the three parts become an id.
Fields§
§platform: PlatformTagThe platform the source lives on (shared closed enum with device cohorts).
source_kind: SourceKindWhat kind of source it is.
locator: StringThe platform’s canonical locator for this source.
Implementations§
Source§impl Scope
impl Scope
Sourcepub fn new(
platform: PlatformTag,
source_kind: SourceKind,
locator: impl Into<String>,
) -> Self
pub fn new( platform: PlatformTag, source_kind: SourceKind, locator: impl Into<String>, ) -> Self
Build a scope from its three parts.
Sourcepub fn scope_id(&self) -> Hash32
pub fn scope_id(&self) -> Hash32
The scope id:
SHA-256( canonical-CBOR([ "capsule-import-scope/v1", platform, source_kind, locator ]) ).
Domain-separated canonical CBOR — never naive concatenation — so a locator that happens to contain a separator can never collide with a different scope, and the id is byte-reproducible on any device and any platform implementation.
Trait Implementations§
impl Eq for Scope
impl StructuralPartialEq for Scope
Auto Trait Implementations§
impl Freeze for Scope
impl RefUnwindSafe for Scope
impl Send for Scope
impl Sync for Scope
impl Unpin for Scope
impl UnsafeUnpin for Scope
impl UnwindSafe for Scope
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more