| Crates.io | nu-source |
| lib.rs | nu-source |
| version | 0.44.0 |
| created_at | 2019-11-27 04:15:38.529723+00 |
| updated_at | 2022-02-08 10:12:36.61745+00 |
| description | A source string characterizer for Nushell |
| homepage | |
| repository | |
| max_upload_size | |
| id | 184711 |
| size | 45,835 |
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.