21 breaking releases

new 0.27.1 Feb 19, 2021
0.26.0 Jan 26, 2021
0.24.1 Dec 15, 2020
0.23.0 Nov 24, 2020
0.1.0 Nov 27, 2019

#49 in Command-line interface

Download history 321/week @ 2020-11-04 187/week @ 2020-11-11 229/week @ 2020-11-18 376/week @ 2020-11-25 237/week @ 2020-12-02 252/week @ 2020-12-09 339/week @ 2020-12-16 142/week @ 2020-12-23 262/week @ 2020-12-30 594/week @ 2021-01-06 224/week @ 2021-01-13 196/week @ 2021-01-20 449/week @ 2021-01-27 277/week @ 2021-02-03 478/week @ 2021-02-10 692/week @ 2021-02-17

1,392 downloads per month
Used in 37 crates (36 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.4MB
~31K SLoC