Proposal: `subclass` API: use `Result` for functions that can fail
Note: the discussion about this enhancement proposal started here.
In the Rust
subclass API, some functions that can fail return a
This is a proposal to use
Result for every functions from the
subclass API which can fail. The binding would be in charge of taking care of the required adaptations to conform to the C API. E.g. for
BaseSinkImpl::render, this would be there.
Functions returning a boolean could return
Result<(), gst::ErrorMessage>. This used to be the case for
gst-plugin-simple. In the event of an
Err, the binding could also take care of calling
gst_element_message_full with the
GstGError and optional
Functions returning a
gst::FlowReturn could return
Result<gst::FlowSuccess, gst::FlowError>. The binding would take care of returning
GST_FLOW_OK in case of an
Edit: changed return type to
Result<gst::FlowSuccess, gst::FlowError> thanks to @arun's suggestion.