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: String
§path: PathBuf
Implementations§
Source§impl Source
impl Source
Sourcepub fn new(source: &str, path: &Path) -> Rc<Source>
pub fn new(source: &str, path: &Path) -> Rc<Source>
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.
Trait Implementations§
impl Eq for Source
impl StructuralPartialEq for Source
Auto Trait Implementations§
impl Freeze for Source
impl RefUnwindSafe for Source
impl Send for Source
impl Sync for Source
impl Unpin for Source
impl UnwindSafe for Source
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more