Selection.one/2
Returns exactly one match, or a structured cardinality error; stops at the second match.
Source and package
- Qualified name
-
LibTmux .Selection .one/2 - Module
- LibTmux
- Declared in
- Selection
- Package
- libtmux
- Source
- lib/libtmux/selection.ex
- one(selection, criteria \\ []) @spec one(t(item), Lib
Tmux ()) :: {:ok, item} | {:error, Lib.Filter .input Tmux ()} when item: Lib.Error .t Tmux ().Schema .observation -
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> {:ok, pane} = Selection.one(panes, id: "%1")iex> pane.id"%1"iex> {:error, error} = Selection.one(panes, id: "%9")iex> error.kind:no_matchiex> {:error, error} = Selection.one(panes)iex> error.kind:multiple_matches- Type parameters
-
-
Bound Lib
Tmux ().Schema .observation
-
- Parameters
Discussed in Observation and filter schema