Skip to main content

VaultScope

Struct VaultScope 

Source
pub struct VaultScope<'a> {
    pub project: Option<&'a str>,
    pub members: &'a BTreeSet<String>,
}
Expand description

Which vault a note is being rendered into: a single project’s, or one member of a workspace vault spanning several repositories.

This is the whole of the workspace-vault naming rule, in one place, because the rule has a hard compatibility half. Node keys are repository-relative (file:README.md names no repo), so every member of a workspace produces the same note name for its README.md and one would silently overwrite the rest. Qualifying the key with its project fixes that — but a single-project vault’s note names must not move: Obsidian resolves [[links]] by name, and a user’s own notes live outside the vault and link into it (issue #442), so a rename breaks every such link silently, with no error and nothing to grep for.

Hence VaultScope::PROJECT (project: None) is not a degenerate case but the contract: it makes every name in this module reduce to exactly note_name of the bare key, byte for byte.

Fields§

§project: Option<&'a str>

The member project this note belongs to, qualifying its name as <project>::<key> — the same form ADR-0009’s cross-repo links already use. None ⇒ a single-project vault, and names are unqualified exactly as before.

§members: &'a BTreeSet<String>

The workspace’s member project names. An external-ref placeholder whose target names one of these is a cross-repo edge the vault can actually follow, so it is rendered as a link straight to that member’s note. Empty for a single-project vault.

Implementations§

Source§

impl VaultScope<'_>

Source

pub const PROJECT: Self

A single-project vault: names are unqualified, and no cross-repo reference resolves. Every name this produces is byte-identical to note_name of the bare key — see the type’s documentation for why that is load-bearing.

Source§

impl VaultScope<'_>

Source

pub fn redirects_external_ref(&self, key: &str) -> bool

Whether an external-ref placeholder key is one this vault resolves for itself — its target names a member, so every edge to it points at the real note and the placeholder need not be rendered at all.

The single rule behind both halves of that: [link_target] redirects exactly the keys this accepts, and the caller skips writing exactly the notes this accepts. They cannot disagree.

Trait Implementations§

Source§

impl<'a> Clone for VaultScope<'a>

Source§

fn clone(&self) -> VaultScope<'a>

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<'a> Copy for VaultScope<'a>

Source§

impl<'a> Debug for VaultScope<'a>

Source§

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

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

impl Default for VaultScope<'_>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for VaultScope<'a>

§

impl<'a> RefUnwindSafe for VaultScope<'a>

§

impl<'a> Send for VaultScope<'a>

§

impl<'a> Sync for VaultScope<'a>

§

impl<'a> Unpin for VaultScope<'a>

§

impl<'a> UnsafeUnpin for VaultScope<'a>

§

impl<'a> UnwindSafe for VaultScope<'a>

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<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> Same for T

Source§

type Output = T

Should always be Self
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.