I'm developing a GStreamer plugin using Rust. I want to send back an array of objects from rust to c++. Each object has two fields. word
and confidence
. I tried this code. but it did not compile. I can send the structure
whenever it just has text
. But when I want to add words
, I couldn't make it compile at all.
let v = vec![];
for word in transcript.words {
v.push(gst::Structure::new("word-info",
&[("word", &word.word), ("confidence", &word.confidence)]));
}
let structure = gst::Structure::new(
"result",
&[
("text", &transcript.text),
("words", &gst::Array::from(&v[..]))
],
);
element
.emit_by_name("new-transcript", &[&structure])
.unwrap();
So I want to send back structure
. It has two fields. text
and words
. words
is a list of (word, confidence) pairs.