Skip to main content

host_modules

Function host_modules 

Source
pub fn host_modules(
    schemas: &HostSchemas,
) -> impl Iterator<Item = &'static str> + '_
Expand description

The host modules a package may name without declaring them.

This is HostSchemas, the one description of the host modules this compilation can see, rather than a list kept here in step with it: the compiler cannot ask the runtime, which depends on it, but it can read the schema both of them do. It used to be a hand-written array with a cross-crate test to catch the drift, written after http had already drifted out of it and let a package module shadow the host module in silence.

It is only consulted to refuse a package module that would shadow a host module. A use naming a module that is not here is still accepted, since a host may register any module it likes. Such a use warns instead: a module no schema describes is checked by nothing until the run reaches the boundary.