Skip to main content

WorkspaceBuilder

Struct WorkspaceBuilder 

Source
pub struct WorkspaceBuilder<FS, Id, Ix> { /* private fields */ }
Expand description

exactly the layers requested — and none it does not. Builder for Workspace. Setting an identity policy or index store returns a builder with a new type parameter, so the composed Workspace carries

Implementations§

Source§

impl<FS, Id, Ix> WorkspaceBuilder<FS, Id, Ix>

Source

pub fn root(self, root: impl Into<PathBuf>) -> Self

Set the workspace root.

Source

pub fn relations(self, relations: RelationSet) -> Self

Set the relation vocabulary.

Set the link style this workspace authors in (typically read from the root’s link_format).

Author durable structural links by id (Obsidian-style) rather than paths. A convenience over reference_style; effective only when identity registers on a link.

Source

pub fn fixity(self, fixity: Fixity) -> Self

Set how far content checksums are recorded (attachments only by default).

Source

pub fn record_deletions(self, record_deletions: bool) -> Self

Set whether a delete records what it destroyed (on by default) — see Workspace::record_deletions.

Source

pub fn embed_style(self, embed_style: EmbedStyle) -> Self

Set the metadata embedding family — the (style, format) half that resolves to a concrete carrier. Defaults to EmbedStyle::Delimited, matching the config default.

Source

pub fn id_storage(self, id_storage: IdStorage) -> Self

Set where a document’s stable id is persisted (DESIGN §5). Under a frontmatter-stamping mode (IdStorage::stamps_frontmatter) every document prov authors carries its own id, so identity travels with the file and the registry becomes a rebuildable cache rather than the sole authority.

Source

pub fn workspace_id(self, name: impl Into<String>) -> Self

Set what this workspace calls itself — the qualifier a cross-workspace reference (id:<name>/<id>) names it by. Empty (the default) leaves the workspace anonymous: it can hold foreign references, but a reference written to it can never be recognized here as local.

Source

pub fn out_of_scope(self, dirs: impl IntoIterator<Item = PathBuf>) -> Self

Declare directories that are on disk beside the workspace but are not the workspace — see Workspace::out_of_scope. Each is workspace-relative; anything absolute or reaching outside is the caller’s error to avoid, since a builder has no config document to file a ConfigIssue against.

Source

pub fn reference_style(self, style: ReferenceStyle) -> Self

Set the workspace-default reference style — the fallback for relations without their own override. Supersedes the link_style/id_links convenience inputs when set.

Source

pub fn default_embed_format(self, format: Format) -> Self

Set the metadata format new documents get when they inherit no parent block (a default, not a constraint).

Source

pub fn settings(self, settings: Settings) -> Self

Set every policy knob at once, from a Settings built elsewhere — typically Settings::from(&config), which is the whole of what a workspace’s config document declares.

Supersedes anything the individual setters put there, so call it first if you mean to override one knob afterwards.

Source

pub fn identity<Id2>(self, identity: Id2) -> WorkspaceBuilder<FS, Id2, Ix>

Attach an identity policy, turning identity on.

Source

pub fn index<Ix2>(self, index: Ix2) -> WorkspaceBuilder<FS, Id, Ix2>

Attach an index store (where IDs are persisted).

Source

pub fn build(self) -> Workspace<FS, Id, Ix>

Finish building.

This is where the ten authoring settings are split: the three the read core needs are copied into the Graph’s ReadSettings, and the whole set is kept alongside for the verbs. Nothing mutates either afterwards, so the two copies of those three cannot drift.

Trait Implementations§

Source§

impl<FS: Clone, Id: Clone, Ix: Clone> Clone for WorkspaceBuilder<FS, Id, Ix>

Source§

fn clone(&self) -> WorkspaceBuilder<FS, Id, Ix>

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<FS: Debug, Id: Debug, Ix: Debug> Debug for WorkspaceBuilder<FS, Id, Ix>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<FS, Id, Ix> Freeze for WorkspaceBuilder<FS, Id, Ix>
where FS: Freeze, Id: Freeze, Ix: Freeze,

§

impl<FS, Id, Ix> RefUnwindSafe for WorkspaceBuilder<FS, Id, Ix>

§

impl<FS, Id, Ix> Send for WorkspaceBuilder<FS, Id, Ix>
where FS: Send, Id: Send, Ix: Send,

§

impl<FS, Id, Ix> Sync for WorkspaceBuilder<FS, Id, Ix>
where FS: Sync, Id: Sync, Ix: Sync,

§

impl<FS, Id, Ix> Unpin for WorkspaceBuilder<FS, Id, Ix>
where FS: Unpin, Id: Unpin, Ix: Unpin,

§

impl<FS, Id, Ix> UnsafeUnpin for WorkspaceBuilder<FS, Id, Ix>
where FS: UnsafeUnpin, Id: UnsafeUnpin, Ix: UnsafeUnpin,

§

impl<FS, Id, Ix> UnwindSafe for WorkspaceBuilder<FS, Id, Ix>
where FS: UnwindSafe, Id: UnwindSafe, Ix: UnwindSafe,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.