pub struct SourceFile {
pub filename: String,
pub raw_content: Vec<u8>,
pub cmds: Vec<Command>,
}Expand description
Single LDraw source file loaded and optionally parsed.
Fields§
§filename: StringThe relative filename of the file as resolved.
raw_content: Vec<u8>Raw UTF-8 file content (without BOM) loaded from the resolved file. Line ending can be
Unix style \n or Windows style \r\n. As a convenience, parsing handles both indifferently,
so the file can contain a mix of both, although this is not recommended.
cmds: Vec<Command>LDraw commands parsed from the raw text content of the file.
Implementations§
Source§impl SourceFile
impl SourceFile
Sourcepub fn iter<'a>(&'a self, source_map: &'a SourceMap) -> CommandIterator<'a> ⓘ
pub fn iter<'a>(&'a self, source_map: &'a SourceMap) -> CommandIterator<'a> ⓘ
Return an iterator over all drawing commands, recursively stepping into sub-file references
without returning the corresponding SubFileRefCmd command nor any comment command.
Sourcepub fn local_iter<'a>(
&'a self,
source_map: &'a SourceMap,
) -> LocalCommandIterator<'a> ⓘ
pub fn local_iter<'a>( &'a self, source_map: &'a SourceMap, ) -> LocalCommandIterator<'a> ⓘ
Return an iterator over all commands local to this source file, including sub-file references
and comments. Unlike SourceFile::iter(), this doesn’t step into those sub-file references
but remains in the local source file.