ASDF.Info (asdf v0.1.0)

Copy Markdown View Source

What ASDF.info/1 can say without reading a block payload.

blocks_scanned is true after open/2 finishes the header scan. block_count is the number of block headers found. Payloads are not read. warnings holds permissive-mode recoveries. Strict mode leaves it empty.

Examples

iex> bytes = ASDF.write!(:binary, %{"n" => 1})
...> handle = ASDF.open!({:binary, bytes})
...> info = ASDF.info!(handle)
...> ASDF.close(handle)
...> {info.format_version, info.standard_version, info.block_count, info.source,
...>  info.mode, info.blocks_scanned, info.warnings}
{{1, 0, 0}, {1, 5, 0}, 0, :binary, :strict, true, []}

Summary

Types

t()

Summary of one open file.

A major.minor.patch triple parsed from #ASDF or #ASDF_STANDARD.

Types

t()

@type t() :: %ASDF.Info{
  block_count: non_neg_integer() | nil,
  blocks_scanned: boolean(),
  format_version: version(),
  mode: :strict | :permissive,
  source: String.t() | :binary,
  standard_version: version() | nil,
  tree_bytes: non_neg_integer(),
  warnings: [ASDF.Warning.t()]
}

Summary of one open file.

  • :format_version — the #ASDF version, a version/0 triple
  • :standard_version — the #ASDF_STANDARD comment, or nil
  • :tree_bytes — bytes in the YAML document, including its newline
  • :block_count — number of block headers, or nil before a scan
  • :source — filesystem path, or :binary
  • :mode — :strict or :permissive
  • :blocks_scanned — true after ASDF.open/2 finishes the scan
  • :warnings — permissive-mode recoveries

version()

@type version() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}

A major.minor.patch triple parsed from #ASDF or #ASDF_STANDARD.