pub struct Patched {
pub name: String,
pub dir: PathBuf,
pub entry: PathBuf,
}Expand description
A dependency the project took into its tree: the name the manifest declares it under,
the directory patch_dir points at, and the directory inside it that require reads.
Both paths absolute.
The name is carried beside the directory because it is what a report says. htl’s own
layout puts mathx in patches/mathx, but the manifest may name any directory, and a
type error in there is the dependency’s name to report either way.
Fields§
§name: StringThe [deps] key, which is also the module name require reaches the dependency
by — and so the name a diagnostic in the copy is reported under.
dir: PathBufWhere patch_dir points, made absolute against the project root. The manifest
writes it relative; a walker asked whether it may enter a directory needs the
absolute form.
entry: PathBuf<dir>/<entry>: the dependency’s own require root inside the copy, the same
directory entries/<name> is a link to. require("<name>.x") reads x.tl from
here. How it is arrived at is patch_entry’s to say, below; what goes on the
search path is search_dir.
Implementations§
Source§impl Patched
impl Patched
Sourcepub fn search_dir(&self) -> PathBuf
pub fn search_dir(&self) -> PathBuf
The directory to put on the search path so that the copy answers to the dependency’s name.
A directory on the path is consulted as <dir>/<module>, <dir>/<module>/init
and <dir>/<module>/<module> (the three templates add_path writes), with the
dots of the module name as separators. So the directory that resolves a
dependency exactly as .htl/modules/entries does is the one holding
entry as a child named after the dependency — which is what
the link entries/<name> is, made out of a name and a directory rather than
found as one.
There is such a directory whenever the entry is named after the dependency:
src/<name> and lua/<name>, the layout most packages have, and the copy root
itself for a package whose entry is ., since htl pkg patch writes
patches/<dep>. Its parent is the answer, and every name then resolves to the
file an install would have resolved it to.
A flat package — entry = "src" holding <name>.tl beside its other modules —
has no such directory anywhere, because nothing in the copy is named after the
dependency. The entry itself is the answer there: require("<name>") reads
<entry>/<name>.tl, which is the file the link resolves it to as well, and
require("<name>.sub") does not resolve, since the link reaches that at
<entry>/sub.tl and no directory on a path reaches it as <name>/sub. Such a
dependency needs its link, and an install is what writes one.
Both go on the path before everything else, which puts them last in it
(Htl::apply_project): a name the copy answers is
one the project’s own sources, the entry links and every other dependency have
already declined, so the flat case’s extra names cannot shadow anything.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Patched
impl RefUnwindSafe for Patched
impl Send for Patched
impl Sync for Patched
impl Unpin for Patched
impl UnsafeUnpin for Patched
impl UnwindSafe for Patched
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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