Skip to main content

IdRef

Enum IdRef 

Source
pub enum IdRef {
    Local(Id),
    Foreign {
        workspace: String,
        id: Id,
    },
    Malformed,
}
Expand description

What an id:-scheme target names.

The scheme carries three distinguishable things, and keeping them apart is the whole point: a reference prov can resolve, one it deliberately cannot, and one that is broken. See docs/reference-styles.md.

Variants§

§

Local(Id)

id:<id> — a document in this workspace, resolved through the registry.

§

Foreign

id:<workspace>/<id> — a document in the workspace named workspace.

prov resolves this only when workspace is the reading workspace’s own workspace_id, in which case it is local and is treated as such. Any other name is somewhere prov cannot see: the library holds no map from a workspace name to a location (that is a fact about a device, not about an archive), so the reference is carried, never rewritten, and never reported broken.

Fields

§workspace: String

The workspace qualifier, exactly as written.

§id: Id

The id, exactly as written. Not check-verified: the foreign workspace owns its id space and need not be a prov workspace at all (a diaryx ARK blade is a different length and alphabet), so applying prov’s check character here would reject valid references.

§

Malformed

The id: scheme with a body that is no reference at all — an empty half (id:, id:/x, id:ws/) or more than one separator (id:a/b/c).

Deliberately its own case rather than falling through to a path: the author wrote id:, so silently resolving the text as a filename would turn a typo into a dangling path and hide what actually went wrong.

Trait Implementations§

Source§

impl Clone for IdRef

Source§

fn clone(&self) -> IdRef

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IdRef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for IdRef

Source§

impl PartialEq for IdRef

Source§

fn eq(&self, other: &IdRef) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for IdRef

Auto Trait Implementations§

§

impl Freeze for IdRef

§

impl RefUnwindSafe for IdRef

§

impl Send for IdRef

§

impl Sync for IdRef

§

impl Unpin for IdRef

§

impl UnsafeUnpin for IdRef

§

impl UnwindSafe for IdRef

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.