Segment
public struct Segment: Hashable, Sendable
extension Segment: CustomStringConvertible
A decoded segment of the source map.
This maps a region from a particular generated line (not explicit in this type) and column range (really just start column) to a source region and optionally a name, or asserts that range is not related to a source.
All indices are 0-based.
Topics
Initializers
init(columns: Range<Int32>, sourcePos: SourcePos?)
init(columns: Range<Int32>, sourcePos: SourcePos?)
init(columns: ClosedRange<Int32>, sourcePos: SourcePos?)
init(columns: ClosedRange<Int32>, sourcePos: SourcePos?)
Initialize a segment from a ClosedRangeClosedRange of columns.
Declaration
public init(columns: ClosedRange<Int32>, sourcePos: SourcePos? = nil)
init(firstColumn: Int32, lastColumn: Int32?, sourcePos: SourcePos?)
init(firstColumn: Int32, lastColumn: Int32?, sourcePos: SourcePos?)
Properties
var columns: ClosedRange<Int32>?
var columns: ClosedRange<Int32>?
The range of columns covered by this segment, or nil if not known.
Declaration
public var columns: ClosedRange<Int32>? { get }
var description: String
var description: String
A short human-readable description of the segment.
Declaration
public var description: String { get }
var firstColumn: Int32
var firstColumn: Int32
0-based column in the generated code that starts the segment.
Declaration
public let firstColumn: Int32
var lastColumn: Int32?
var lastColumn: Int32?
0-based column in the generated code that ends the segment, or nil
indicating ‘until either the next segment or the end of the line’.
This field is optional and advisory - it’s not stored in the source map itself, rather
calculated (guessed) from the next firstColumn value. Its value is not
used in comparisons between two Segments.
Declaration
public internal(set) var lastColumn: Int32? { get }
var sourcePos: SourcePos?
var sourcePos: SourcePos?
The original source position associated with the segment, or nil if there is none.
Declaration
public let sourcePos: SourcePos?