Skip to main content

Locator

Struct Locator 

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

Resolves every filesystem location the application uses from a small set of roots plus the BRAND naming constants. Construct one per process (or one per sandbox in tests). Path methods are pure and cheap; the ensure_* methods are the only ones that touch disk.

Implementations§

Source§

impl Locator

Source

pub fn new(overrides: LocatorOverrides) -> Self

Construct a locator against the canonical BRAND, with the given overrides layered on the live-process defaults.

Source

pub fn with_brand(overrides: LocatorOverrides, brand: Brand) -> Self

Construct a locator against an explicit brand (injectable so an alternate identity can be resolved without mutating the global).

Source

pub fn home(&self) -> &Path

The resolved home root (read-only accessor, mostly for tests).

Source

pub fn cwd(&self) -> &Path

The resolved working directory (read-only accessor).

Source

pub fn profile_dir(&self) -> PathBuf

The per-user profile directory under the home root (e.g. ~/.indusagi).

Source

pub fn settings_path(&self) -> PathBuf

The global settings file inside the profile (e.g. ~/.indusagi/settings.json).

Source

pub fn project_settings_path(&self, cwd: Option<&Path>) -> PathBuf

The per-project settings file for a working directory. A relative cwd is resolved against the locator’s bound working directory.

Source

pub fn sessions_dir(&self) -> PathBuf

Directory holding persisted conversation sessions (e.g. ~/.indusagi/sessions).

Source

pub fn auth_store_path(&self) -> PathBuf

The credential/auth store file inside the profile (e.g. ~/.indusagi/auth.json).

Source

pub fn logs_dir(&self) -> PathBuf

Directory holding diagnostic and crash logs (e.g. ~/.indusagi/logs).

Source

pub async fn ensure_profile_dir(&self) -> Result<PathBuf>

Ensure the profile directory exists; returns its path.

Source

pub async fn ensure_sessions_dir(&self) -> Result<PathBuf>

Ensure the sessions directory exists; returns its path.

Source

pub async fn ensure_logs_dir(&self) -> Result<PathBuf>

Ensure the logs directory exists; returns its path.

Source

pub async fn ensure_parent_of(&self, file_path: PathBuf) -> Result<PathBuf>

Ensure the parent directory of file_path exists, then return file_path unchanged (use before writing settings/auth files).

Source

pub async fn ensure_dir(&self, dir: PathBuf) -> Result<PathBuf>

Create dir and any missing parents idempotently; returns its path.

Trait Implementations§

Source§

impl Clone for Locator

Source§

fn clone(&self) -> Locator

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 Locator

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

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

Source§

fn vzip(self) -> V