Skip to main content

Project

Struct Project 

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

Everything an operation in crate::ops needs to locate files.

Built once by the caller and passed by reference to install / add / update / clean. Paths are used as given (relative paths resolve against the process working directory, as with any std::fs call).

§Example

use mlua_pkg::{PkgDir, Project};
use std::path::Path;

// Conventional layout: <root>/mlua-pkg.toml, <root>/mlua-pkg.lock,
// <root>/.mlua-pkgs/{cache,vendored}
let p = Project::in_dir("/srv/app", PkgDir::default_in("/srv/app"));
assert_eq!(p.manifest_path(), Path::new("/srv/app/mlua-pkg.toml"));
assert_eq!(p.lock_path(), Path::new("/srv/app/mlua-pkg.lock"));
assert_eq!(p.pkg_dir().vendored(), Path::new("/srv/app/.mlua-pkgs/vendored"));

Implementations§

Source§

impl Project

Source

pub fn new( manifest_path: impl Into<PathBuf>, lock_path: impl Into<PathBuf>, pkg_dir: impl Into<PkgDir>, ) -> Self

Fully explicit constructor.

Source

pub fn in_dir(root: impl AsRef<Path>, pkg_dir: impl Into<PkgDir>) -> Self

Conventional filenames under root, with an explicit PkgDir.

manifest = <root>/mlua-pkg.toml, lock = <root>/mlua-pkg.lock.

Source

pub fn manifest_path(&self) -> &Path

Path to mlua-pkg.toml.

Source

pub fn lock_path(&self) -> &Path

Path to mlua-pkg.lock.

Source

pub fn pkg_dir(&self) -> &PkgDir

Base directory for cache + vendored output.

Source

pub fn manifest_root(&self) -> PathBuf

Directory that contains the manifest.

Dep::target_dir values are resolved relative to this. A bare filename ("mlua-pkg.toml") yields ".".

Trait Implementations§

Source§

impl Clone for Project

Source§

fn clone(&self) -> Project

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

impl Eq for Project

Source§

impl From<Project> for Config

Source§

fn from(project: Project) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Project

Source§

fn eq(&self, other: &Project) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Project

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MaybeSend for T

Source§

impl<T> MaybeSync for T

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.