Wilfred Hughes 9c0d88cc07 internal: Include private definitions in generated rustdoc
rust-analyzer has handy prebuilt `cargo doc` output at
https://rust-lang.github.io/rust-analyzer/ide/

However, it doesn't include private definitions, which makes it less
useful when trying to learn unfamiliar parts of the codebase.

Instead, pass `--document-private-items` so the HTML includes
information on private types and modules too. rustdoc renders these
with a padlock icon, so it's still clear that they're private.

This change also exposes some more rustdoc warnings, which I've fixed.
2026-01-09 12:01:54 +00:00
..
2025-03-23 08:46:10 +01:00

line-index

This crate is developed as part of rust-analyzer.

line-index is a library to convert between text offsets and corresponding line/column coordinates.

Installation

To add this crate to a project simply run cargo add line-index.

Usage

The main structure is LineIndex.

It is constructed with an UTF-8 string, but also supports UTF-16 and UTF-32 offsets.

Example

use line_index::LineIndex;

let line_index = LineIndex::new("This is a\nmulti-line\ntext.");
line_index.line_col(3.into()); // LineCol { line: 0, col: 3 }
line_index.line_col(13.into()); // LineCol { line: 1, col: 3 }
line_index.offset(LineCol { line: 2, col: 3 }); // Some (24)

SemVer

This crate uses semver versioning.