Skip to content

Query: proposal to solve the deref/deref_mut issue

François Laignel requested to merge fengalin:query_deref into master

While trying to solve the deref/deref_mut issue on concrete types, I came up with the approach in this commit. The idea is to allow working with concrete implementations directly. Except for pad probes, views are no longer necessary. See unit test and examples.

In pad probes, the user gets the query view directly. E.g.:

    src_pad.add_probe(PadProbeType::QUERY_UPSTREAM, |_, probe_info| {
        if let Some(PadProbeData::Query(ref mut query_view)) = probe_info.data {
            match query_view {
                &mut QueryView::Duration(ref mut duration) => {
                    duration.set(2 * SECOND);
                },
                _ => (),
            }
        }
        PadProbeReturn::Ok
    });

Note: calling view consumes the query, but I don't think this is an issue as the idea is to work on concrete implementations and the user should no longer need to call view anyway.

If I'm not mistaken, this could apply to Events & Messages too.

Merge request reports