Core Library0.xAPI reference

Choose documentation 1

pr-173

Current version

pr-173
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

MoreLess about this notice

function libtmux-elixir

Selection.one_or_nil/2

Returns one match or nil; a second match remains an error.

Source and package
Qualified name
LibTmux.Selection.one_or_nil/2
Module
LibTmux
Declared in
Selection
Package
libtmux
Source
lib/libtmux/selection.ex
one_or_nil(selection, criteria \\ []) @spec one_or_nil(t(item), LibTmux.Filter.input()) :: {:ok, item | nil} | {:error, LibTmux.Error.t()} when item: LibTmux.Schema.observation()
Type parameters
Parameters

Examples

iex> alias LibTmux.{Selection, Snapshot}
iex> {:ok, snapshot} = Snapshot.new(%{pane: [%{id: "%0"}, %{id: "%1"}]},
...> server_instance: "example", captured_from: 0, captured_until: 0,
...> fields: %{pane: [:id]})
iex> panes = Snapshot.panes(snapshot)
iex> Selection.one_or_nil(panes, id: "%9")
{:ok, nil}
iex> {:ok, pane} = Selection.one_or_nil(panes, id: "%0")
iex> pane.id
"%0"
iex> {:error, error} = Selection.one_or_nil(panes)
iex> error.kind
:multiple_matches

Recorded calls

source calls
No call edges in the Elixir model.

The Elixir reference records declarations, not calls, so this page shows no callers or callees. That is a limit of the extracted data, not a statement that nothing calls LibTmux.Selection.one_or_nil/2.

Guides

task material

Pages that discuss one_or_nil/2.

Esc
Search in

Type to search.

Reference previewOpen reference