Struct magic_string::SourceMap[][src]

pub struct SourceMap {
    pub version: u8,
    pub mappings: String,
    pub names: Vec<String>,
    pub sources: Vec<Option<String>>,
    pub sources_content: Vec<Option<String>>,
    pub file: Option<String>,
    pub source_root: Option<String>,
}

Fields

version: u8mappings: Stringnames: Vec<String>sources: Vec<Option<String>>sources_content: Vec<Option<String>>file: Option<String>source_root: Option<String>

Implementations

Create a SourceMap instance from a decoded map

DecodedMap can be created by utilizing generate_decoded_map.

Example:

use magic_string::{MagicString, GenerateDecodedMapOptions, SourceMap};

let mut s = MagicString::new("export default React");
s.prepend("import React from 'react'\n");

let decoded_map = s.generate_decoded_map(GenerateDecodedMapOptions {
file: Some("index.js".to_owned()),
  source: Some("index.ts".to_owned()),
  source_root: Some("./".to_owned()),
  include_content: true,
  hires: false,
}).expect("failed to generate decoded map");

SourceMap::new_from_decoded(decoded_map);

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.