pub trait SourceMapper: Send + Sync {
// Required methods
fn lookup_char_pos(&self, pos: BytePos) -> Loc;
fn span_to_lines(&self, sp: Span) -> FileLinesResult;
fn span_to_string(&self, sp: Span) -> String;
fn span_to_filename(&self, sp: Span) -> Lrc<FileName> ⓘ;
fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>;
fn call_span_if_macro(&self, sp: Span) -> Span;
fn doctest_offset_line(&self, line: usize) -> usize;
fn span_to_snippet(&self, sp: Span) -> Result<String, Box<SpanSnippetError>>;
// Provided method
fn map_raw_pos(&self, raw_pos: BytePos) -> BytePos { ... }
}Required Methods§
fn lookup_char_pos(&self, pos: BytePos) -> Loc
fn span_to_lines(&self, sp: Span) -> FileLinesResult
fn span_to_string(&self, sp: Span) -> String
fn span_to_filename(&self, sp: Span) -> Lrc<FileName> ⓘ
fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>
fn call_span_if_macro(&self, sp: Span) -> Span
fn doctest_offset_line(&self, line: usize) -> usize
fn span_to_snippet(&self, sp: Span) -> Result<String, Box<SpanSnippetError>>
Provided Methods§
Sourcefn map_raw_pos(&self, raw_pos: BytePos) -> BytePos
fn map_raw_pos(&self, raw_pos: BytePos) -> BytePos
This function is called to change the BytePos in AST into an unmapped, real value.
By default, it returns the raw value because by default, the AST stores original values.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".