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
impl Project
Sourcepub fn new(
manifest_path: impl Into<PathBuf>,
lock_path: impl Into<PathBuf>,
pkg_dir: impl Into<PkgDir>,
) -> Self
pub fn new( manifest_path: impl Into<PathBuf>, lock_path: impl Into<PathBuf>, pkg_dir: impl Into<PkgDir>, ) -> Self
Fully explicit constructor.
Sourcepub fn in_dir(root: impl AsRef<Path>, pkg_dir: impl Into<PkgDir>) -> Self
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.
Sourcepub fn manifest_path(&self) -> &Path
pub fn manifest_path(&self) -> &Path
Path to mlua-pkg.toml.
Sourcepub fn manifest_root(&self) -> PathBuf
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§
impl Eq for Project
impl StructuralPartialEq for Project
Auto Trait Implementations§
impl Freeze for Project
impl RefUnwindSafe for Project
impl Send for Project
impl Sync for Project
impl Unpin for Project
impl UnsafeUnpin for Project
impl UnwindSafe for Project
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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