Skip to main content

Project

Struct Project 

Source
pub struct Project {
    pub manifest: Manifest,
    pub lock: Option<Lock>,
    pub base: PathBuf,
    pub scope: Scope,
    pub cache: PathBuf,
    pub state: PathBuf,
    pub home: PathBuf,
    /* private fields */
}
Expand description

A chest.toml with its lock, and the folders its entries go to.

Fields§

§manifest: Manifest

The manifest.

§lock: Option<Lock>

Its lock, when there is one.

§base: PathBuf

The manifest’s folder, which its relative paths start from.

§scope: Scope

Whether it is a project’s manifest or the user’s global one.

§cache: PathBuf

Where git clones are cached and work is staged: ~/.chest/cache unless set otherwise.

§state: PathBuf

Where chest records what it placed on this machine, outside any repository: ~/.chest/state unless set otherwise.

§home: PathBuf

The canonical home folder, which ~ names.

Implementations§

Source§

impl Project

Source

pub fn open(path: &Path, scope: Scope) -> Result<Project, ChestError>

The manifest at path and its lock, the file beside it named with .lock for .toml: chest.dev.toml locks in chest.dev.lock.

The manifest’s folder is resolved to its canonical path once, so a project opened through a link or another spelling of its path places, records and removes the same paths. A manifest or lock that is itself a link is refused, as refuse_link says.

Source

pub fn global() -> Result<Project, ChestError>

The user’s global manifest, ~/.chest/chest.toml.

Source

pub fn lock_path(&self) -> PathBuf

Where the lock is.

Source

pub fn root(&self) -> PathBuf

The folder chest never writes outside of: the project’s own for a project manifest, home for the global one.

Source

pub fn store(&self) -> PathBuf

The extension store: [folders] extensions, else .yapi/chest in a project and ~/.chest/store for the global manifest.

Source

pub fn too_wide(&self, folder: &Path, also: &[&Path]) -> bool

Whether folder, an extension’s module root, holds far more than one package, so the extension could load any file there: it is, or holds, the home folder, the agent folder, the filesystem’s root, the manifest’s folder, which is the project’s for a project manifest, the store, which holds the other extensions, or a folder in also. A held folder that does not exist yet counts by the path it will have.

Source

pub fn placed(&self, section: Section, locked: &Locked) -> Vec<PathBuf>

The paths locked occupies: each of its items in each of its section’s folders, or its store folder.

Source

pub fn state(&self, section: Section, name: &str, entry: &Entry) -> &'static str

The state of entry name of section that yapi’s startup acts on, as chest list shows it: under [patch], missing when a copy chest placed is gone, edited when one changed since, else patched. Otherwise, no source for a path entry whose source is gone, stale when not locked or locked for another source, missing when not in place, edited when a copy chest placed changed since, whatever lock pinned it, outdated when in place as an older lock pinned it, else installed. Startup hashes no copies, so it loads an edited entry that the lock still pins, or that is patched, as it would unedited.

Source

pub fn present(&self, section: Section, locked: &Locked) -> bool

Whether everything locked occupies is there. A link in the first folder, where the copy belongs, counts as missing, as after the folders were reordered. An extension from a path loads where it is, so it always is.

Source

pub async fn sync( &mut self, mode: Mode, npm: &mut Npm, progress: &mut (dyn FnMut(&str) + Send), ) -> Result<Report, ChestError>

Brings the installed entries in line with the manifest and lock as mode says, holding the lock file’s lock and the project’s record lock throughout. Every entry is fetched and checked before anything is put in place, so a failed download changes nothing. Nothing is installed outside Project::root. Only chest’s cache and record, under ~/.chest unless set otherwise, are written elsewhere. progress hears a line for each entry fetched, and one while another chest command holds a lock.

Source

pub fn installed_root(&self, name: &str) -> Option<PathBuf>

The folder installed extension name loads from: its [patch] path, its store folder, the npm package inside it, or its path source. None for an entry that is not an installed extension.

Source

pub fn extension_roots(&self, name: &str) -> Option<(PathBuf, PathBuf)>

Where extension name loads from, as Project::installed_root says whether or not it exists, and the folder that holds the package and its own dependencies, which it may load modules from: the [patch] or path source, or <store>/<name> for git and npm.

Source

pub fn verify(&self) -> Result<Vec<String>, ChestError>

Checks every installed copy of a locked git or npm entry: canonical copies, copy fallbacks and store folders by their hash, and links by what they point to. Copies of path and [patch] entries are checked by chest’s record of what it placed, and each path entry’s source must be there. Returns one line per problem, so none means all match.

Source

pub async fn outdated(&self, npm: &mut Npm) -> Result<Vec<Outdated>, ChestError>

The newest revision each locked git or npm entry’s source offers: the commit its rev names now, or the newest npm version in its range with npm’s latest.

Source

pub async fn fetch_package( &self, entry: &Entry, npm: &mut Npm, ) -> Result<Fetched, ChestError>

Fetches the package entry names, without its dependencies, to read what it provides and requests before it is added: a git source at the commit its rev names, an npm source at the newest version in its range, or a path source where it is.

Trait Implementations§

Source§

impl Clone for Project

Source§

fn clone(&self) -> Self

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 Project

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more