pub fn serve<R: BufRead, W: Write>(
input: R,
output: W,
capabilities: Value,
handler: impl FnMut(&str, Value) -> Result<Value, Refusal>,
) -> Result<()>Expand description
The loop of a plugin: reads a line at a time from input, answers the requests on output, calls handler for
each method but the two of the handshake it answers itself (initialize with capabilities, shutdown, after
which it returns). A line that is no request is answered with a parse error. Returns when input ends or after
shutdown.