pub fn select_embedder(
backend: Option<&str>,
) -> Result<EmbedderSelection, String>Expand description
Resolve an embedding backend name to what the caller must do about it.
backend is None when the selecting variable is unset, and
Some(value) for whatever it was set to. The distinction is load-bearing
and predates this seam: an unset variable means “no preference” and takes
the offline default, while an empty or misspelled value is a caller who
asked for something and got it wrong. Reading both as “unset” — the shape
an unwrap_or_default() at the call site would produce — would turn that
mistake into a silent default.
§Why this exists, and why it is in the library rather than the binary
The embedding selection used to be a bare match inside main.rs, so
nothing could exercise it without starting the daemon and reading its
stderr. Its counterpart crate::select_extractor already lives here for
the reasons #1734 made expensive; keeping the two apart meant only one of
the two roles was testable, and only one could gain a backend without
touching the binary.
§Errors
A human-readable message naming the accepted forms, for an unknown backend.