[−][src]Trait weldr::FileRefResolver
Resolver trait for sub-file references (Line Type 1 LDraw command).
An implementation of this trait must be passed to parse()
to allow resolving sub-file references recursively,
and parsing all dependent sub-files of the top-level file provided.
When loading parts and primitives from the official LDraw catalog, implementations are free to decide how to retrieve the file content, but must ensure that all canonical paths are in scope, as sub-file references can be relative to any of those:
/p/
- Parts primitives/p/48/
- High-resolution primitives/parts/
- Main catalog of parts/parts/s/
- Catalog of sub-parts commonly used
Required methods
pub fn resolve(&self, filename: &str) -> Result<Vec<u8>, ResolveError>
[src]
Resolve the given file reference filename
, given as it appears in a sub-file reference, and return
the content of the file as a UTF-8 encoded buffer of bytes, without BOM. Line ending can be indifferently
Unix style \n
or Windows style \r\n
.
See parse()
for usage.