nushell/crates/nu-source
2020-02-18 16:56:09 +13:00
..
src Ensure stable plugins get installed. (#1373) 2020-02-10 15:32:10 -05:00
build.rs Extract build.rs 2019-12-02 13:14:51 -08:00
Cargo.toml Bump version to 0.10.0 (#1403) 2020-02-18 16:56:09 +13:00
README.md Nu source overview (#1282) 2020-01-27 15:55:02 +13:00

nu-source

Overview

The nu-source crate contains types and traits used for keeping track of metadata about values being processed. Nu uses Tags to keep track of where a value came from, an AnchorLocation, as well as positional information about the value, a Span. An AchorLocation can be a Url, File, or Source text that a value was parsed from. The source Text is special in that it is a type similar to a String that comes with the ability to be cheaply cloned. A Span keeps track of a value's start and end positions. These types make up the metadata for a value and are wrapped up together in a Tagged struct, which holds everything needed to track and locate a value.

Nu's metadata system can be seen when reporting errors. In the following example Nu is able to report to the user where the typo of a column originated from.

1 | ls | get typ
  |          ^^^ did you mean 'type'?

In addition to metadata tracking, nu-source also contains types and traits related to debugging, tracing, and formatting the metadata and values it processes.

Other Resources