Struct rustc_span::SourceFileDiffs
source · pub struct SourceFileDiffs {
pub(crate) line_start: BytePos,
pub(crate) bytes_per_diff: usize,
pub(crate) num_diffs: usize,
pub(crate) raw_diffs: Vec<u8>,
}
Expand description
The source file lines in difference list form. This matches the form used within metadata, which saves space by exploiting the fact that the lines list is sorted and individual lines are usually not that long.
We read it directly from metadata and only decode it into Lines
form
when necessary. This is a significant performance win, especially for
small crates where very little of std
’s metadata is used.
Fields§
§line_start: BytePos
Position of the first line. Note that this is always encoded as a
BytePos
because it is often much larger than any of the
differences.
bytes_per_diff: usize
Always 1, 2, or 4. Always as small as possible, while being big enough to hold the length of the longest line in the source file. The 1 case is by far the most common.
num_diffs: usize
The number of diffs encoded in raw_diffs
. Always one less than
the number of lines in the source file.
raw_diffs: Vec<u8>
The diffs in “raw” form. Each segment of bytes_per_diff
length
encodes one little-endian diff. Note that they aren’t LEB128
encoded. This makes for much faster decoding. Besides, the
bytes_per_diff==1 case is by far the most common, and LEB128
encoding has no effect on that case.
Trait Implementations§
source§impl Clone for SourceFileDiffs
impl Clone for SourceFileDiffs
source§fn clone(&self) -> SourceFileDiffs
fn clone(&self) -> SourceFileDiffs
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for SourceFileDiffs
impl Send for SourceFileDiffs
impl Sync for SourceFileDiffs
impl Unpin for SourceFileDiffs
impl UnwindSafe for SourceFileDiffs
Blanket Implementations§
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 48 bytes