Mark various enums that can signal errors as #[must_use]

See https://github.com/sdroege/gstreamer-rs/issues/44
This commit is contained in:
Sebastian Dröge 2017-11-05 19:16:50 +02:00
parent 3179806f01
commit e8638c1630
2 changed files with 24 additions and 4 deletions

View file

@ -18,11 +18,9 @@ generate = [
"Gst.ClockTimeDiff", "Gst.ClockTimeDiff",
"Gst.Pipeline", "Gst.Pipeline",
"Gst.State", "Gst.State",
"Gst.StateChangeReturn",
"Gst.StateChange", "Gst.StateChange",
"Gst.SeekFlags", "Gst.SeekFlags",
"Gst.SeekType", "Gst.SeekType",
"Gst.FlowReturn",
"Gst.PadDirection", "Gst.PadDirection",
"Gst.PadPresence", "Gst.PadPresence",
"Gst.URIHandler", "Gst.URIHandler",
@ -44,7 +42,6 @@ generate = [
"Gst.DeviceMonitor", "Gst.DeviceMonitor",
"Gst.StreamType", "Gst.StreamType",
"Gst.StreamFlags", "Gst.StreamFlags",
"Gst.PadLinkReturn",
"Gst.ProgressType", "Gst.ProgressType",
"Gst.BusSyncReply", "Gst.BusSyncReply",
"Gst.TagMergeMode", "Gst.TagMergeMode",
@ -65,7 +62,6 @@ generate = [
"Gst.TocLoopType", "Gst.TocLoopType",
"Gst.TocSetter", "Gst.TocSetter",
"Gst.ClockType", "Gst.ClockType",
"Gst.ClockReturn",
"Gst.ElementFlags", "Gst.ElementFlags",
"Gst.Rank", "Gst.Rank",
"Gst.PadLinkCheck", "Gst.PadLinkCheck",
@ -705,3 +701,23 @@ status = "generate"
pattern = "parse.*full" pattern = "parse.*full"
# wrong mutable for context parameter # wrong mutable for context parameter
ignore = true ignore = true
[[object]]
name = "Gst.StateChangeReturn"
status = "generate"
must_use = true
[[object]]
name = "Gst.FlowReturn"
status = "generate"
must_use = true
[[object]]
name = "Gst.PadLinkReturn"
status = "generate"
must_use = true
[[object]]
name = "Gst.ClockReturn"
status = "generate"
must_use = true

View file

@ -191,6 +191,7 @@ impl SetValue for CapsIntersectMode {
} }
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
#[must_use]
pub enum ClockReturn { pub enum ClockReturn {
Ok, Ok,
Early, Early,
@ -677,6 +678,7 @@ impl SetValue for EventType {
} }
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
#[must_use]
pub enum FlowReturn { pub enum FlowReturn {
CustomSuccess2, CustomSuccess2,
CustomSuccess1, CustomSuccess1,
@ -993,6 +995,7 @@ impl SetValue for PadDirection {
} }
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
#[must_use]
pub enum PadLinkReturn { pub enum PadLinkReturn {
Ok, Ok,
WrongHierarchy, WrongHierarchy,
@ -1950,6 +1953,7 @@ impl SetValue for StateChange {
} }
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
#[must_use]
pub enum StateChangeReturn { pub enum StateChangeReturn {
Failure, Failure,
Success, Success,