pub struct PkgDir { /* private fields */ }Expand description
Base directory for cache + vendored output.
This is the single place that knows the internal layout:
<base>/
cache/ git clones, keyed by host/org/repo/sha (GitFetcher root)
vendored/ <name> -> ../cache/…/<entry> symlinks (VendoredResolver root)Callers pass one path; cache and
vendored derive the rest so no consumer has to
replicate the join("cache") / join("vendored") convention.
§Example
use mlua_pkg::PkgDir;
use std::path::Path;
let dir = PkgDir::new(".mlua-pkgs");
assert_eq!(dir.cache(), Path::new(".mlua-pkgs/cache"));
assert_eq!(dir.vendored(), Path::new(".mlua-pkgs/vendored"));Implementations§
Source§impl PkgDir
impl PkgDir
Sourcepub fn new(base: impl Into<PathBuf>) -> Self
pub fn new(base: impl Into<PathBuf>) -> Self
Wrap an explicit base directory. No filesystem access.
Sourcepub fn default_in(root: impl AsRef<Path>) -> Self
pub fn default_in(root: impl AsRef<Path>) -> Self
<root>/.mlua-pkgs — the conventional location under a project root.
Sourcepub fn cache(&self) -> PathBuf
pub fn cache(&self) -> PathBuf
<base>/cache — root handed to crate::fetcher::GitFetcher.
Sourcepub fn vendored(&self) -> PathBuf
pub fn vendored(&self) -> PathBuf
<base>/vendored — root handed to
crate::resolvers::VendoredResolver.
Sourcepub fn vendored_root(&self, name: &str) -> PathBuf
pub fn vendored_root(&self, name: &str) -> PathBuf
<base>/vendored/<name> — the symlink install creates for a
package without target_dir. It points at the package root
(upstream cache checkout or patch_dir); the require root inside
it is <root>/<entry> with entry taken from the lockfile
(LockedPkg::require_dir).
Trait Implementations§
impl Eq for PkgDir
impl StructuralPartialEq for PkgDir
Auto Trait Implementations§
impl Freeze for PkgDir
impl RefUnwindSafe for PkgDir
impl Send for PkgDir
impl Sync for PkgDir
impl Unpin for PkgDir
impl UnsafeUnpin for PkgDir
impl UnwindSafe for PkgDir
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