Skip to main content

Workspace

Struct Workspace 

Source
pub struct Workspace { /* private fields */ }
Expand description

An open workspace: its root, .omgbase/ directory, database path and store.

Implementations§

Source§

impl Workspace

Source

pub fn open(root: impl AsRef<Path>) -> Result<Self>

Open the workspace rooted exactly at root, creating .omgbase/ and the database as needed.

Source

pub fn open_with_minter( root: impl AsRef<Path>, minter: Box<dyn IdMinter>, ) -> Result<Self>

Workspace::open with a replaceable id minter (spec/store §2.2).

Source

pub fn find(start: &Path) -> Result<Option<Self>>

The workspace containing start (walk up), or None.

Source

pub fn locate(explicit: Option<&Path>, start: &Path) -> Result<Option<Self>>

§1 precedence: an explicit --workspace value, else $OMGBASE_WORKSPACE, else discovery from start.

Source

pub fn root(&self) -> &Path

Source

pub fn omgbase_dir(&self) -> &Path

<root>/.omgbase — where the locks live (§7).

Source

pub fn db_path(&self) -> &Path

Source

pub fn store(&self) -> &Store

Source

pub fn store_mut(&mut self) -> &mut Store

Source

pub fn repos(&self) -> Result<Vec<RepoRow>>

The repos with their derived roots, by slug.

Source

pub fn repo_by_slug(&self, slug: &str) -> Result<Option<RepoRow>>

Source

pub fn select_repo(&self, cwd: &Path, slug: Option<&str>) -> Result<RepoRow>

select_repo over this workspace’s repos.

Source

pub fn has_repo(&self, slug: &str) -> Result<bool>

Whether slug exists (a cheap probe the registry uses).

Source

pub fn close(self) -> Result<()>

Close the store.

Trait Implementations§

Source§

impl Debug for Workspace

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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, 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.