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>

source

pub fn ty(&self) -> SourceFileType

The type of the file the descriptor points to.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<I, T> ExtractContext<I, ()> for T

§

fn extract_context(self, _original_input: I)

Given the context attached to a nom error, and given the original input to the nom parser, extract more the useful context information. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<I> RecreateContext<I> for I

§

fn recreate_context(_original_input: I, tail: I) -> I

Given the original input, as well as the context reported by nom, recreate a context in the original string where the error occurred. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> Send for Twhere T: ?Sized,

§

impl<T> Sync for Twhere T: ?Sized,