Skip to main content

Context

Struct Context 

Source
pub struct Context {
    pub root: PathBuf,
    pub is_project: bool,
}

Fields§

§root: PathBuf

Root directory for libtorch storage. Either a project root or ~/.flodl.

§is_project: bool

Whether we are operating inside a detected project.

Implementations§

Source§

impl Context

Source

pub fn resolve() -> Self

Auto-detect: walk up from cwd looking for a flodl project, fall back to ~/.flodl/.

Source

pub fn global() -> Self

The global root, whether or not cwd sits inside a project: $FLODL_HOME, else ~/.flodl.

Context::resolve prefers a project root, which is right for a developer managing their checkout’s libtorch and wrong for a box that is only consuming artifacts: a dial-in worker’s project root is frequently a read-only shared mount, so its acquisitions (libtorch, the fetched source tree) belong under the root fdl manages on that one box. The two are named apart on purpose.

Source

pub fn with_root(root: PathBuf) -> Self

Force a specific root (for –path overrides).

Source

pub fn libtorch_dir(&self) -> PathBuf

The libtorch directory under this root.

Source

pub fn label(&self) -> String

Print a short context line (for diagnostics).

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