pub struct FilesystemLoader { /* private fields */ }Implementations§
Source§impl FilesystemLoader
impl FilesystemLoader
Sourcepub fn new(allowed_roots: Vec<PathBuf>) -> FilesystemLoader
pub fn new(allowed_roots: Vec<PathBuf>) -> FilesystemLoader
Construct a loader scoped to the given root directories. Files outside these roots — even when the href is absolute and points at them directly — will be refused.
Pass specific directories like the stylesheet’s own folder
or /usr/share/xml; never pass /. An empty list means
“refuse everything,” which is the safest choice for an
untrusted stylesheet that’s not expected to import.
Trait Implementations§
Source§impl Debug for FilesystemLoader
impl Debug for FilesystemLoader
Source§impl Default for FilesystemLoader
impl Default for FilesystemLoader
Source§fn default() -> FilesystemLoader
fn default() -> FilesystemLoader
Source§impl Loader for FilesystemLoader
impl Loader for FilesystemLoader
Source§fn load_parsed(
&self,
href: &str,
base: Option<&str>,
) -> Result<Arc<Document>, XsltError>
fn load_parsed( &self, href: &str, base: Option<&str>, ) -> Result<Arc<Document>, XsltError>
Cached parse for repeated lookups of the same on-disk file.
Keys on the canonical path so foo/../foo.xml and
foo.xml (resolved against the same base) share a cache
entry. Misses fall through to load + parse_str then
populate the cache.
Source§fn enumerate(&self, base: Option<&str>) -> Vec<String>
fn enumerate(&self, base: Option<&str>) -> Vec<String>
Walk every file under the loader’s allowed roots, returning
hrefs relative to base’s parent directory. Only files
whose extension is a typical XML / text resource are
returned, to keep speculative pre-loading from chewing
through every binary the test directory happens to
contain. Bounded depth (16) so a stray symlink loop can’t
hang the runtime.