pub struct SourceFile {
pub id: FileId,
pub path: Option<PathBuf>,
pub text: String,
}Expand description
One file that contributed forms to a ResolvedProgram.
Fields§
§id: FileIdIts handle in the program that owns it.
path: Option<PathBuf>Where it came from.
None only for an entry program handed to the pipeline as bare text —
an embedder, a test, a WASM host. An imported file always has one,
because a Loader cannot name a package without naming a place.
text: StringThe file’s text.
Kept, not dropped after parsing, because a Span is a byte range and
nothing else: turning one into line:col needs the exact string it
indexes. Before this, resolve_uses read a package’s source and let it
fall out of scope one line later, which is why an imported type error
had no position to report.
Trait Implementations§
Source§impl Clone for SourceFile
impl Clone for SourceFile
Source§fn clone(&self) -> SourceFile
fn clone(&self) -> SourceFile
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SourceFile
impl RefUnwindSafe for SourceFile
impl Send for SourceFile
impl Sync for SourceFile
impl Unpin for SourceFile
impl UnsafeUnpin for SourceFile
impl UnwindSafe for SourceFile
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