Crate webext [] [src]

A library to make native messaging even easier than it already is.

Typically you'd use this in a loop, reading a message in and writing a message out until there are none left to read. Perhaps something like this:

struct Input { n: usize }

struct Output { n: usize }

// An extension that just adds one to the input number `n`.

while let Some(msg) = webext::read::<Input>() {
    let inp = msg.unwrap();
    let out = Output { n: inp.n + 1 };


I strongly recommend that you use this with serde_derive so that you can use your own structs for input and output. Alternatively, you can use the Json type, but that's a lot more annoying to deal with. My favorite enum attributes are #[serde(tag = "type", rename_all = "snake_case")].



Read a message from standard input.


Write a message to standard output.

Type Definitions


A type that can encode to and decode from any JSON string.