#source #nushell #metadata #1 #value #source-string #url #keeping-track #keep-track


A source string characterizer for Nushell

38 breaking releases

0.44.0 Feb 8, 2022
0.42.0 Dec 28, 2021
0.40.0 Nov 16, 2021
0.34.0 Jul 13, 2021
0.1.0 Nov 27, 2019

#732 in Command-line interface

Download history 685/week @ 2023-11-07 420/week @ 2023-11-14 569/week @ 2023-11-21 552/week @ 2023-11-28 428/week @ 2023-12-05 404/week @ 2023-12-12 543/week @ 2023-12-19 549/week @ 2023-12-26 578/week @ 2024-01-02 494/week @ 2024-01-09 443/week @ 2024-01-16 449/week @ 2024-01-23 505/week @ 2024-01-30 403/week @ 2024-02-06 806/week @ 2024-02-13 1464/week @ 2024-02-20

3,231 downloads per month
Used in 34 crates (31 directly)

MIT license

1.5K SLoC



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


~44K SLoC