SourceFile

Struct SourceFile 

Source
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: String

The 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

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for SourceFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for SourceFile

Source§

fn eq(&self, other: &SourceFile) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for SourceFile

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.