Struct passerine::common::source::Source [−][src]
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
impl Source
[src]
pub fn new(source: &str, path: PathBuf) -> Rc<Source>
[src]
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.
pub fn path(path: PathBuf) -> Result<Rc<Source>>
[src]
Build a Source
from a path.
This will read a file to create a new source.
pub fn source(source: &str) -> Rc<Source>
[src]
Build an empty Source
containing just a string.
Note that this source will point towards ./source
.
Trait Implementations
impl Debug for Source
[src]
impl Eq for Source
[src]
impl PartialEq<Source> for Source
[src]
impl StructuralEq for Source
[src]
impl StructuralPartialEq for Source
[src]
Auto Trait Implementations
impl RefUnwindSafe for Source
impl Send for Source
impl Sync for Source
impl Unpin for Source
impl UnwindSafe for Source
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,