# `LangExtract.Result`
[🔗](https://github.com/mdepolli/lang_extract/blob/v0.10.0/lib/lang_extract/result.ex#L1)

A completed extraction run: document-ordered spans plus per-chunk errors.

The return value of `LangExtract.run/4` and `LangExtract.Runner.run/4` —
returned bare, since neither can fail: `errors` is the failure channel.
A struct rather than a positional tuple so future fields (usage, timing)
can be added without breaking consumer matches — bind only the keys you
need:

    %LangExtract.Result{spans: spans, errors: errors} =
      LangExtract.run(client, source, template)

`spans` are in document order (by `byte_start`); `errors` carry the byte
range of each failed chunk, also in document order. An empty `errors`
list means every chunk extracted cleanly.

`usage` totals the token counts across chunks whose provider response
reported them — `nil` when none did. Failed chunks and providers that
omit usage blocks contribute nothing, so with partial failures the
totals cover the successful chunks only.

# `t`

```elixir
@type t() :: %LangExtract.Result{
  errors: [LangExtract.ChunkError.t()],
  spans: [LangExtract.Span.t()],
  usage: LangExtract.Provider.Response.usage() | nil
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
