Struct passerine::common::source::Source[][src]

pub struct Source {
    pub contents: String,
    pub path: PathBuf,
}
Expand description

Source represents some literal source code. Whether a repl session, a file on disk, or some library code. It’s essentially a string with a path, the path serving as the source’s name. Source files without a path point to ./source, though this behaviour might change in the future.

Fields

contents: Stringpath: PathBuf

Implementations

Creates a new Source given both an &str and a PathBuf. Note that this function does not check that the contents of the file match the source. Source::path or Source::source should be used instead.

Build a Source from a path. This will read a file to create a new source.

Build an empty Source containing just a string. Note that this source will point towards ./source.

Trait Implementations

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.