Struct rspack_sources::SourceMap

source ·
pub struct SourceMap { /* private fields */ }
Expand description

The source map created by Source::map.

Implementations§

source§

impl SourceMap

source

pub fn new( file: Option<String>, mappings: String, sources: Vec<Cow<'static, str>>, sources_content: Vec<Cow<'static, str>>, names: Vec<Cow<'static, str>>, ) -> Self

Create a SourceMap.

source

pub fn file(&self) -> Option<&str>

Get the file field in SourceMap.

source

pub fn set_file(&mut self, file: Option<String>)

Set the file field in SourceMap.

source

pub fn decoded_mappings(&self) -> impl IntoIterator<Item = Mapping> + '_

Get the decoded mappings in SourceMap.

source

pub fn mappings(&self) -> &str

Get the mappings string in SourceMap.

source

pub fn sources(&self) -> &[Cow<'static, str>]

Get the sources field in SourceMap.

source

pub fn sources_mut(&mut self) -> &mut [Cow<'static, str>]

Get the mutable sources field in SourceMap.

source

pub fn get_source(&self, index: usize) -> Option<&str>

Get the source by index from sources field in SourceMap.

source

pub fn get_source_mut(&mut self, index: usize) -> Option<&mut Cow<'static, str>>

Get the mutable source by index from sources field in SourceMap.

source

pub fn sources_content(&self) -> &[Cow<'static, str>]

Get the sourcesContent field in SourceMap.

source

pub fn sources_content_mut(&mut self) -> &mut [Cow<'static, str>]

Get the mutable sourcesContent field in SourceMap.

source

pub fn get_source_content(&self, index: usize) -> Option<&str>

Get the source content by index from sourcesContent field in SourceMap.

source

pub fn get_source_content_mut( &mut self, index: usize, ) -> Option<&mut Cow<'static, str>>

Get the mutable source content by index from sourcesContent field in SourceMap.

source

pub fn names(&self) -> &[Cow<'static, str>]

Get the names field in SourceMap.

source

pub fn names_mut(&mut self) -> &mut [Cow<'static, str>]

Get the names field in SourceMap.

source

pub fn get_name(&self, index: usize) -> Option<&str>

Get the name by index from names field in SourceMap.

source

pub fn get_name_mut(&mut self, index: usize) -> Option<&mut Cow<'static, str>>

Get the mutable name by index from names field in SourceMap.

source

pub fn source_root(&self) -> Option<&str>

Get the source_root field in SourceMap.

source

pub fn set_source_root(&mut self, source_root: Option<String>)

Set the source_root field in SourceMap.

source§

impl SourceMap

source

pub fn from_json(s: &str) -> Result<Self>

Create a SourceMap from json string.

source

pub fn from_slice(s: &[u8]) -> Result<Self>

Create a SourceMap from [&u8].

source

pub fn from_reader<R: Read>(s: R) -> Result<Self>

Create a SourceMap from reader.

source

pub fn to_json(self) -> Result<String>

Generate source map to a json string.

source

pub fn to_writer<W: Write>(self, w: W) -> Result<()>

Generate source map to writer.

Trait Implementations§

source§

impl Clone for SourceMap

source§

fn clone(&self) -> SourceMap

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SourceMap

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for SourceMap

source§

fn default() -> SourceMap

Returns the “default value” for a type. Read more
source§

impl Hash for SourceMap

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for SourceMap

source§

fn eq(&self, other: &SourceMap) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for SourceMap

source§

impl StructuralPartialEq for SourceMap

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where 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.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.