[][src]Module gazpatcho::request

Control running graph instance from the code.

While most of the changes on the graph are driven through the UI, there may be cases where one needs to control it from the underlying code: e.g. reverting unwanted operations or populating output node widgets. Request is intended for these operations.

When run_with_callback is used, list of Requests should be returned from the callback:

gazpatcho::run_with_callback("Application Name", config, |report| {
    // ...
    vec![
        Request::SetValue { ... },
        Request::RemovePatch { ... },
        Request::RemoveNode { ... },
        ...
    ]
});

When run_with_mpsc is used, Request should be passed through a mpsc connected to the request_rx:

// ...
let (request_tx, request_rx) = mpsc::channel::<Request>();

thread::spawn(move || {
    request_tx.send(Request::SetValue { ... }).unwrap();
    request_tx.send(Request::RemovePatch { ... }).unwrap();
    request_tx.send(Request::RemoveNode { ... }).unwrap();
});

gazpatcho::run_with_mpsc("Application Name", config, report_tx, request_rx);

Enums

Request

Actions that can be requested on a running instance of the UI.