mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-01-05 06:48:42 +00:00
ea25c9262b
This commit adds `_if_some()` variants for builder field setters. The variants aim at improving usability when setting optional fields. E.g. currently, we need to write something like: ```rust let opt_value = ...; let mut sb = gst::Structure::builder("test") .field("mandatory_field", "mandatory"); if let Some(value) = opt_value sb = sb.field("optional_field", value); } let s = sb.build(); ``` With `_if_some()`, this can be written like this: ```rust let opt_value = ...; let s = gst::Structure::builder("test") .field("mandatory_field", "mandatory") .field_if_some("optional_field", opt_value) .build(); ``` Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1424> |
||
---|---|---|
.. | ||
auto | ||
action.rs | ||
action_type.rs | ||
enums.rs | ||
functions.rs | ||
lib.rs | ||
reporter.rs |