Struct syntax::codemap::CodeMap [−] [src]

pub struct CodeMap {
    pub files: RefCell<Vec<Rc<FileMap>>>,
    // some fields omitted
}
Unstable

Fields

files
Unstable

Methods

impl CodeMap

fn new() -> CodeMap

Unstable

fn new_filemap(&self, filename: FileName, src: String) -> Rc<FileMap>

Unstable

fn new_imported_filemap(&self, filename: FileName, source_len: usize, file_local_lines: Vec<BytePos>, file_local_multibyte_chars: Vec<MultiByteChar>) -> Rc<FileMap>

Unstable

Allocates a new FileMap representing a source file from an external crate. The source code of such an "imported filemap" is not available, but we still know enough to generate accurate debuginfo location information for things inlined from other crates.

fn mk_substr_filename(&self, sp: Span) -> String

Unstable

fn lookup_char_pos(&self, pos: BytePos) -> Loc

Unstable

Lookup source information about a BytePos

fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt

Unstable

fn span_to_string(&self, sp: Span) -> String

Unstable

fn span_to_filename(&self, sp: Span) -> FileName

Unstable

fn span_to_lines(&self, sp: Span) -> FileLinesResult

Unstable

fn span_to_snippet(&self, sp: Span) -> Result<String, SpanSnippetError>

Unstable

fn get_filemap(&self, filename: &str) -> Rc<FileMap>

Unstable

fn lookup_byte_offset(&self, bpos: BytePos) -> FileMapAndBytePos

Unstable

For a global BytePos compute the local offset within the containing FileMap

fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos

Unstable

Converts an absolute BytePos to a CharPos relative to the filemap and above.

fn record_expansion(&self, expn_info: ExpnInfo) -> ExpnId

Unstable

fn with_expn_info<T, F>(&self, id: ExpnId, f: F) -> T where F: FnOnce(Option<&ExpnInfo>) -> T

Unstable

fn span_allows_unstable(&self, span: Span) -> bool

Unstable

Check if a span is "internal" to a macro in which #[unstable] items can be used (that is, a macro marked with #[allow_internal_unstable]).