pub fn read_input<R: Read>(input: R) -> Result<Value, Error>
Expand description

Reads input from a stream, decoded according to Chrome’s own documentation on native messaging. (https://developer.chrome.com/extensions/nativeMessaging)

  1. A 32bit unsigned integer specifies how long the message is.
  2. The message is encoded in JSON

Example

use std::io;
use chrome_native_messaging::{read_input, Error};

read_input(io::stdin())
    .err().expect("doctest should return unexpected eof");