Survey of functions returning `bool` under workspace `gstreamer-editing-services`
This is part of an overall effort throughout gstreamer-rs
, which started with discussions in #166 (closed) & !196 (closed) (closed) and continued with several merge requests.
The idea is to identify the functions returning a boolean as an indication of a failure and to have them return Result<(), glib::BoolError>
instead. The main benefits are:
- Users can use Rust's early exit operator (
?
),expect
ormap_err
. - The compiler will issue a warning when the result is not checked.
We decided to use Result<(), gst::LoggableError>
when the error is issued in a user implemented function. I didn't find any candidate in gstreamer-editing-services
.
Edit: the table was updated further to the feedback from @thiblahute.
Function | Location | Gst Function | Proposed Return Type | Comment |
---|---|---|---|---|
Asset.needs_reload | auto | ges_asset_needs_reload | keep bool
|
Returns TRUE if the asset was in the cache and could be set as needing reload, FALSE otherwise. Note: See comment from @thiblahute. |
Asset.set_proxy | auto | ges_asset_set_proxy | Result<(), glib::BoolError> |
Returns TRUE if proxy has been set on asset , FALSE otherwise. |
Asset.unproxy | auto | ges_asset_unproxy | Result<(), glib::BoolError> |
Returns TRUE if proxy was a known proxy for asset, FALSE otherwise |
Clip.move_to_layer | auto | ges_clip_move_to_layer | Result<(), glib::BoolError> |
Returns TRUE if clip could be moved FALSE otherwise |
Clip.set_top_effect_index | auto | ges_clip_set_top_effect_index | Result<(), glib::BoolError> |
Returns TRUE if effect was successfuly moved, FALSE otherwise. |
Clip.set_top_effect_priority | auto | ges_clip_set_top_effect_priority | Result<(), glib::BoolError> |
No doc. |
Extractable.set_asset | auto | ges_extractable_set_asset | Result<(), glib::BoolError> |
Returns TRUE if asset could be set FALSE otherwise |
Layer.add_clip | auto | ges_layer_add_clip | Result<(), glib::BoolError> |
Returns TRUE if the clip was properly added to the layer, or FALSE if the layer refuses to add the clip. |
Layer.get_auto_transition | auto | ges_layer_get_auto_transition | keep bool
|
Returns TRUE if transitions are automatically added, else FALSE. Note: See comment from @thiblahute. |
Layer.remove_clip | auto | ges_layer_remove_clip | Result<(), glib::BoolError> |
Returns TRUE if the clip could be removed, FALSE if the layer does not want to remove the clip. |
Pipeline.set_timeline | auto | ges_pipeline_set_timeline | Result<(), glib::BoolError> |
Returns TRUE if the timeline could be successfully set on the pipeline , else FALSE. |
Project.add_asset | auto | ges_project_add_asset | keep bool
|
Returns TRUE if the asset could be added FALSE it was already in the project. Note: FALSE is not an error but an indication |
Project.add_encoding_profile | auto | ges_project_add_encoding_profile | Result<(), glib::BoolError> |
Returns TRUE if profile could be added, FALSE otherwise |
Project.create_asset | auto | ges_project_create_asset | keep bool
|
Returns TRUE if the asset started to be added FALSE it was already in the project. Note: FALSE is not an error but an indication |
Project.remove_asset | auto | ges_project_remove_asset | Result<(), glib::BoolError> |
Returns TRUE if the asset could be removed FALSE otherwise |
Timeline.commit | auto | ges_timeline_commit | keep bool
|
Returns TRUE if pending changes were commited or FALSE if nothing needed to be commited. This means that if FALSE is returned then no "commited" signal will be emited. Note: FALSE is not an error but an indication |
Timeline.commit_sync | auto | ges_timeline_commit_sync | keep bool
|
Returns TRUE if pending changes were commited or FALSE if nothing needed to be commited. Note: FALSE is not an error but an indication |
Timeline.get_auto_transition | auto | ges_timeline_get_auto_transition | keep bool
|
Returns TRUE if transitions are automatically added, else FALSE. Note: returned value is a genuine boolean |
Timeline.remove_track | auto | ges_timeline_remove_track | Result<(), glib::BoolError> |
Returns TRUE if the track was properly removed, else FALSE. |
TimelineElement.ripple | auto | ges_timeline_element_ripple | Result<(), glib::BoolError> |
Returns TRUE if the self as been rippled properly, FALSE if an error occured |
TimelineElement.ripple_end | auto | ges_timeline_element_ripple_end | Result<(), glib::BoolError> |
Returns TRUE if the self as been rippled properly, FALSE if an error occured |
TimelineElement.roll_end | auto | ges_timeline_element_roll_end | Result<(), glib::BoolError> |
Returns TRUE if the self as been rolled properly, FALSE if an error occured |
TimelineElement.roll_start | auto | ges_timeline_element_roll_start | Result<(), glib::BoolError> |
Returns TRUE if the self as been roll properly, FALSE if an error occured |
TimelineElement.set_name | auto | ges_timeline_element_set_name | Result<(), glib::BoolError> |
No doc |
TimelineElement.set_parent | auto | ges_timeline_element_set_parent | Result<(), glib::BoolError> |
Returns TRUE if parent could be set or FALSE when self already had a parent or self and parent are the same. |
TimelineElement.set_timeline | auto | ges_timeline_element_set_timeline | Result<(), glib::BoolError> |
Returns TRUE if timeline could be set or FALSE when timeline already had a timeline. |
TimelineElement.trim | auto | ges_timeline_element_trim | Result<(), glib::BoolError> |
Returns TRUE if the self as been trimmed properly, FALSE if an error occured |
Track.commit | auto | ges_track_commit | keep bool
|
Returns TRUE if something as been commited FALSE if nothing needed to be commited. Note: FALSE is not an error but an indication |
Track.get_mixing | auto | ges_track_get_mixing | keep bool
|
Returns True if there is a mixer, False otherwise. Note: returned value is a genuine boolean |
TrackElement.edit | auto | ges_track_element_edit | Result<(), glib::BoolError> |
Returns TRUE if the object as been edited properly, FALSE if an error occured |
TrackElement.remove_control_binding | auto | ges_track_element_remove_control_binding | Result<(), glib::BoolError> |
Returns TRUE if the binding could be removed, FALSE if an error occured |
TrackElement.set_active | auto | ges_track_element_set_active | keep bool
|
Returns TRUE if the property was toggled, else FALSE. Note: FALSE is not an error but an indication |