[][src]Struct syntex_syntax2::codemap::CodeMap

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

Fields

files: RefCell<Vec<Rc<FileMap>>>

Methods

impl CodeMap[src]

pub fn new(path_mapping: FilePathMapping) -> CodeMap[src]

pub fn with_file_loader(
    file_loader: Box<dyn FileLoader>,
    path_mapping: FilePathMapping
) -> CodeMap
[src]

pub fn path_mapping(&self) -> &FilePathMapping[src]

pub fn file_exists(&self, path: &Path) -> bool[src]

pub fn load_file(&self, path: &Path) -> Result<Rc<FileMap>>[src]

pub fn files(&self) -> Ref<Vec<Rc<FileMap>>>[src]

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

Creates a new filemap without setting its line information. If you don't intend to set the line information yourself, you should use new_filemap_and_lines.

pub fn new_filemap_and_lines(&self, filename: &str, src: &str) -> Rc<FileMap>[src]

Creates a new filemap and sets its line information.

pub fn new_imported_filemap(
    &self,
    filename: FileName,
    name_was_remapped: bool,
    crate_of_origin: u32,
    source_len: usize,
    file_local_lines: Vec<BytePos>,
    file_local_multibyte_chars: Vec<MultiByteChar>
) -> Rc<FileMap>
[src]

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.

pub fn mk_substr_filename(&self, sp: Span) -> String[src]

pub fn lookup_char_pos(&self, pos: BytePos) -> Loc[src]

Lookup source information about a BytePos

pub fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt[src]

pub fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>[src]

Returns Some(span), a union of the lhs and rhs span. The lhs must precede the rhs. If there are gaps between lhs and rhs, the resulting union will cross these gaps. For this to work, the spans have to be:

  • the ctxt of both spans much match
  • the lhs span needs to end on the same line the rhs span begins
  • the lhs span must start at or before the rhs span

pub fn span_to_string(&self, sp: Span) -> String[src]

pub fn span_to_filename(&self, sp: Span) -> FileName[src]

pub fn span_to_lines(&self, sp: Span) -> FileLinesResult[src]

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

pub fn span_until_char(&self, sp: Span, c: char) -> Span[src]

Given a Span, try to get a shorter span ending before the first occurrence of c char

pub fn def_span(&self, sp: Span) -> Span[src]

pub fn get_filemap(&self, filename: &str) -> Option<Rc<FileMap>>[src]

pub fn lookup_byte_offset(&self, bpos: BytePos) -> FileMapAndBytePos[src]

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

pub fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos[src]

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

pub fn lookup_filemap_idx(&self, pos: BytePos) -> usize[src]

pub fn count_lines(&self) -> usize[src]

Trait Implementations

impl CodeMapper for CodeMap[src]

Auto Trait Implementations

impl !Sync for CodeMap

impl Unpin for CodeMap

impl !Send for CodeMap

impl !RefUnwindSafe for CodeMap

impl !UnwindSafe for CodeMap

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]