31 breaking releases

new 0.37.0 Sep 14, 2021
0.35.0 Aug 3, 2021
0.34.0 Jul 13, 2021
0.29.0 Mar 30, 2021
0.1.0 Nov 27, 2019

#66 in Command-line interface

Download history 696/week @ 2021-06-01 354/week @ 2021-06-08 921/week @ 2021-06-15 779/week @ 2021-06-22 445/week @ 2021-06-29 404/week @ 2021-07-06 884/week @ 2021-07-13 449/week @ 2021-07-20 437/week @ 2021-07-27 823/week @ 2021-08-03 366/week @ 2021-08-10 348/week @ 2021-08-17 678/week @ 2021-08-24 313/week @ 2021-08-31 409/week @ 2021-09-07 831/week @ 2021-09-14

2,303 downloads per month
Used in 45 crates (43 directly)

MIT license

46KB
1.5K SLoC

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 AnchorLocation 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

Dependencies

~0.8–1.5MB
~34K SLoC