Home Explore Blog CI



nushell

17th chunk of `contributor-book/plugin_protocol_reference.md`
2c07aaebd1540b622b36f816fe21c668ff1c7ea1c10a01940000000100000fee
Identical to [`IntRange`](#intrange) but for floats instead.

| Field     | Type           |
| --------- | -------------- |
| **start** | double         |
| **step**  | double         |
| **end**   | `Bound` double |

Example:

```nu
7.5..10.5
```

```json
{
  "Range": {
    "val": {
      "FloatRange": {
        "start": 7.5,
        "step": 1,
        "end": { "Included": 10.5 }
      }
    },
    "span": {
      "start": 1380,
      "end": 1389
    }
  }
}
```

### `String`

A UTF-8 string.

| Field    | Type            |
| -------- | --------------- |
| **val**  | string          |
| **span** | [`Span`](#span) |

Example:

```nu
"Hello, nu!"
```

```json
{
  "String": {
    "val": "Hello, nu!",
    "span": {
      "start": 8990,
      "end": 9002
    }
  }
}
```

### `Glob`

A filesystem glob, selecting multiple files or directories depending on the expansion of wildcards.

If `no_expand` is true, the expansion of wildcards is disabled and this just acts as a literal path.

| Field         | Type            |
| ------------- | --------------- |
| **val**       | string          |
| **no_expand** | boolean         |
| **span**      | [`Span`](#span) |

Example:

```nu
"src/**/*.rs" | into glob
```

```json
{
  "Glob": {
    "val": "src/**/*.rs",
    "no_expand": false,
    "span": {
      "start": 9400,
      "end": 9413
    }
  }
}
```

### `Record`

An associative key-value map. If records are contained in a list, this renders as a table. The keys are always strings, but the values may be any type.

| Field    | Type                            |
| -------- | ------------------------------- |
| **val**  | map: string ⇒ [`Value`](#value) |
| **span** | [`Span`](#span)                 |

Example:

```nu
{foo: 5, bar: "hello nushell"}
```

```json
{
  "Record": {
    "val": {
      "foo": {
        "Int": {
          "val": 42,
          "span": {
            "start": 659813,
            "end": 659814
          }
        }
      },
      "bar": {
        "String": {
          "val": "hello nushell",
          "span": {
            "start": 659821,
            "end": 659836
          }
        }
      }
    },
    "span": {
      "start": 659807,
      "end": 659837
    }
  }
}
```

### `List`

A list of values of any type.

| Field    | Type                    |
| -------- | ----------------------- |
| **vals** | [`Value`](#value) array |
| **span** | [`Span`](#span)         |

Example:

```nu
[1, 2, foo, bar]
```

```json
{
  "List": {
    "vals": [
      {
        "Int": {
          "val": 1,
          "span": {
            "start": 659951,
            "end": 659952
          }
        }
      },
      {
        "Int": {
          "val": 2,
          "span": {
            "start": 659954,
            "end": 659955
          }
        }
      },
      {
        "String": {
          "val": "foo",
          "span": {
            "start": 659957,
            "end": 659960
          }
        }
      },
      {
        "String": {
          "val": "bar",
          "span": {
            "start": 659962,
            "end": 659965
          }
        }
      }
    ],
    "span": {
      "start": 659950,
      "end": 659966
    }
  }
}
```

### `Block`

A reference to a parsed block of Nushell code, without any captured variables.

| Field    | Type                        |
| -------- | --------------------------- |
| **val**  | unsigned integer (block id) |
| **span** | [`Span`](#span)             |

Example:

```json
{
  "Block": {
    "val": 44500,
    "span": {
      "start": 59400,
      "end": 59480
    }
  }
}
```

### `Closure`

A reference to a parsed block of Nushell code, with variables captured from scope.

| Field    | Type            |
| -------- | --------------- |
| **val**  | `Closure`       |
| **span** | [`Span`](#span) |

`Closure` is defined as:

| Field        | Type                                                          |
| ------------ | ------------------------------------------------------------- |
| **block_id** | unsigned integer                                              |

Title: Nu Value Types: String, Glob, Record, List, Block, and Closure
Summary
This section details more Nu `Value` types. It describes `String` (UTF-8 string), `Glob` (filesystem glob with optional wildcard expansion), `Record` (associative key-value map), `List` (list of values), `Block` (reference to a parsed Nushell code block), and `Closure` (parsed code block with captured variables). Each type includes field descriptions, Nu examples, and corresponding JSON representations.