Skip to main content

WorkspaceDir

Struct WorkspaceDir 

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

Per-project workspace directory (<project>/.astrid/).

Contains only committable project-level config. A workspace-id UUID links the project to its global state in ~/.astrid/.

Implementations§

Source§

impl WorkspaceDir

Source

pub fn detect(start_dir: &Path) -> Self

Detect the workspace directory by walking up from start_dir.

Detection order:

  1. Directory containing .astrid/
  2. Directory containing .git
  3. Directory containing ASTRID.md
  4. Fallback to start_dir itself
Source

pub fn from_path(project_root: impl Into<PathBuf>) -> Self

Create from an explicit project root (useful for testing).

Source

pub fn ensure(&self) -> Result<()>

Ensure the .astrid/ directory exists and generate a workspace ID if one does not already exist.

§Errors

Returns an error if directory creation or workspace ID generation fails.

Source

pub fn root(&self) -> &Path

Project root directory (parent of .astrid/).

Source

pub fn dot_astrid(&self) -> PathBuf

The .astrid/ directory itself.

Source

pub fn capsules_dir(&self) -> PathBuf

Workspace capsules directory (.astrid/capsules/).

Source

pub fn workspace_id_path(&self) -> PathBuf

Path to the workspace-id file (.astrid/workspace-id).

Source

pub fn workspace_id(&self) -> Result<Uuid>

Read or generate the workspace ID.

If the file exists (e.g. cloned from a repo), its UUID is adopted. Otherwise a new UUID is generated and written.

§Errors

Returns an error if the file cannot be read or written.

Source

pub fn instructions_path(&self) -> PathBuf

Path to the project-level instructions file (.astrid/ASTRID.md).

Trait Implementations§

Source§

impl Clone for WorkspaceDir

Source§

fn clone(&self) -> WorkspaceDir

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 WorkspaceDir

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> 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> 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V