package fzf

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type 'a t
val of_escaped_strings : string Async.Pipe.Reader.t -> string t
val of_strings_raise_on_newlines : string Async.Pipe.Reader.t -> string t
val of_escaped_strings_assoc : (string * 'a) Async.Pipe.Reader.t -> on_collision: (old_item:'a -> new_item:'a -> [ `Raise of Core.Error.t | `Update | `Ignore ]) -> 'a t

of_assoc is useful when you want to summarize/display 'a in some human friendly way that's not necessary easy to parse (i.e. string -> 'a does not exist). The resultant t will maintain the reverse map on your behalf (so it consumes memory proportional to the # of items read from the pipe).

In the case where more than one item appears on the pipe which maps to the same string, you must decide what to do. This might happen because:

  • You wrote duplicate items in the pipe (in which case you may want to ignore)
  • There's a bug in your to-string mapping (i.e. it generates ambiguous strings, in which case you may want to raise)
  • The item that string maps to has changed since fzf started (in which case you may want to update).
val lookup_selection : 'a t -> string -> 'a option