Function device_tree_source::include::include_files
[−]
[src]
pub fn include_files<P: AsRef<Path>, I: AsRef<Path>>(
file: P,
include_dirs: &[I]
) -> Result<(Vec<u8>, Vec<IncludeBounds>), IncludeError>
Parses /include/
statements in the file returning a buffer with all files
included.
Also returns the bounds of each included file within the buffer to allow
mapping from the buffer to the original files. See
IncludeBounds::file_line_from_global
for more information. The
IncludeBounds
can be ignored if mapping from the final buffer to the
original file is not needed.
If C style #include
statements need to be parsed that step should be
performed, usually by running CPP, before calling this function on the file
output from that step.
include_dirs
should be a list of all directories to search for included
files. No directories are assumed, including the current directory. If no
directories are passed in, the function will fail.
Errors
Returns IOError
if any file cannot be opened.
Returns ParseError
if any line is unable to be converted to
an offset.
Returns NoBoundReturned
if something really went wrong
while parsing a included file.
Returns LinemarkerInDtsi
if a C preprocessor linemarker is found within a
file included by an /include/
statement. This should never happen, and if
it does that file needs to be cleaned up.