pub enum ModuleKind {
Source,
Declaration,
Lua,
}Expand description
What a file on the search path is, for Htl::module_candidates. The three the
searchers try, in the order they try them: a .tl source beats a .d.tl declaration
wherever the two sit, and a plain .lua is what is left when neither is reachable.
Variants§
Source
A .tl the checker compiles and the program runs — the only kind that is both.
Declaration
A .d.tl: types with no implementation. What a require of one gets at run time
when nothing implements the name depends on the resolver, and under
Htl::install_searcher on the caller:
-
Htl::install_searcher, arequirewritten in Teal (the calling chunk’s source ends in.tl): an empty table that explains itself when indexed, which is why a checked module that resolves to a declaration and nothing else loads and then fails on first use. The checker typed it against the declaration; a module that calls its host in one function runs, and is tested, without the host. -
Htl::install_searcher, arequirefrom plain Lua (any other chunk, throughpcallor not): therequirefails naming the declaration, sopcall(require, name)isfalse. A.luasees no declaration.The table is never stored in
package.loaded, whererequirewould answer every later caller with it and a.luaasking after a.tlwould find the module there. A metatable onpackage.loadedkeeps it in a side table instead, keyed by name, and hands it back only to a read from Teal: a second Tealrequiregets the same table, a later.luais still declined, andrawget(package.loaded, name)isnil. A real module stored under the name afterwards (apreload_valuea Tealrequirethen loads, a host’s own assignment) replaces it for every caller. Apackage.loadedthat already carries a metatable when the searcher is installed is the host’s and is left alone; there the first caller’s answer is every later caller’s, as before this rule (thepkgmodule doc). -
a
pkg::TealResolverin aRegistry, any caller: the declaration steps aside and therequirefails outright, with the same text, if nothing else implements the name.
Lua
A plain .lua, which the checker has nothing to say about. What is left when
neither of the other two is reachable.
Implementations§
Trait Implementations§
Source§impl Clone for ModuleKind
impl Clone for ModuleKind
impl Copy for ModuleKind
Source§impl Debug for ModuleKind
impl Debug for ModuleKind
Source§impl Display for ModuleKind
impl Display for ModuleKind
impl Eq for ModuleKind
Source§impl PartialEq for ModuleKind
impl PartialEq for ModuleKind
Source§impl Serialize for ModuleKind
impl Serialize for ModuleKind
impl StructuralPartialEq for ModuleKind
Auto Trait Implementations§
impl Freeze for ModuleKind
impl RefUnwindSafe for ModuleKind
impl Send for ModuleKind
impl Sync for ModuleKind
impl Unpin for ModuleKind
impl UnsafeUnpin for ModuleKind
impl UnwindSafe for ModuleKind
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<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
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> ⓘ
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