Crate codespan[][src]

Utilities for working with source code and printing nicely formatted diagnostic information like warnings and errors.

Optional Features

Extra functionality is accessible by enabling feature flags. The features currently available are:

  • serialization - Adds Serialize and Deserialize implementations for use with serde
  • memory_usage - Adds HeapSizeOf implementations for use with the heapsize crate

Structs

ByteIndex

A byte position in a source file

ByteOffset

A byte offset in a source file

CodeMap
ColumnIndex

A zero-indexed column offset into a source file

ColumnNumber

A 1-indexed column number. Useful for pretty printing source locations.

ColumnOffset

A column offset in a source file

FileMap

Some source code

LineIndex

A zero-indexed line offset into a source file

LineNumber

A 1-indexed line number. Useful for pretty printing source locations.

LineOffset

A line offset in a source file

Span

A region of code in a source file

Enums

ByteIndexError
FileName
LineIndexError
LocationError
SpanError

Traits

Index

Index types

Offset

A relative offset between two indices

Type Definitions

ByteSpan

A span of byte indices

RawIndex

The raw, untyped index. We use a 32-bit integer here for space efficiency, assuming we won't be working with sources larger than 4GB.

RawOffset

The raw, untyped offset.