pub struct SourceFileDescriptor<'a> { /* private fields */ }
Expand description
A descriptor that provides information about a source file.
This descriptor is returned from source_by_path
and friends.
This descriptor holds information that can be used to retrieve information about the source file. A descriptor has to have at least one of the following to be valid:
Debug sessions are not permitted to return invalid source file descriptors.
Implementations§
source§impl<'a> SourceFileDescriptor<'a>
impl<'a> SourceFileDescriptor<'a>
sourcepub fn ty(&self) -> SourceFileType
pub fn ty(&self) -> SourceFileType
The type of the file the descriptor points to.
sourcepub fn contents(&self) -> Option<&str>
pub fn contents(&self) -> Option<&str>
The contents of the source file as string, if it’s available.
Portable PDBs for instance will often have source information, but rely on
remote file fetching via Sourcelink to get to the contents. In that case
a file descriptor is created, but the contents are missing and instead the
url
can be used.
sourcepub fn into_contents(self) -> Option<Cow<'a, str>>
pub fn into_contents(self) -> Option<Cow<'a, str>>
The contents of the source file as string, if it’s available.
This unwraps the SourceFileDescriptor
directly and might avoid a copy of contents
later on.
sourcepub fn url(&self) -> Option<&str>
pub fn url(&self) -> Option<&str>
If available returns the URL of this source.
For certain files this is the canoncial URL of where the file is placed. This for instance is the case for minified JavaScript files or source maps which might have a canonical URL. In case of portable PDBs this is also where you would fetch the source code from if source links are used.
sourcepub fn path(&self) -> Option<&str>
pub fn path(&self) -> Option<&str>
If available returns the file path of this source.
For source bundles that are a companion file to a debug file, this is the canonical path of the source file.
sourcepub fn debug_id(&self) -> Option<DebugId>
pub fn debug_id(&self) -> Option<DebugId>
The debug ID of the file if available.
For source maps or minified source files symbolic supports embedded debug IDs. If they
are in use, the debug ID is returned from here. The debug ID is discovered from the
file’s debug-id
header or the embedded debugId
reference in the file body.
sourcepub fn source_mapping_url(&self) -> Option<&str>
pub fn source_mapping_url(&self) -> Option<&str>
The source mapping URL reference of the file.
This is used to refer to a source map from a minified file. Only minified source files
will have a relationship to a source map. The source mapping is discovered either from
a sourcemap
header in the source manifest, or the sourceMappingURL
reference in the body.