From 20910b241556be175b64ac45abd0aa1b1b9cfe59 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Sat, 27 Oct 2018 20:19:42 +0100 Subject: [PATCH] Implement From instead of Into for FlowError -> FlowReturn It is recommended to implement From as that is more flexible and includes an implicit Into instance. --- gst-plugin/src/error.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gst-plugin/src/error.rs b/gst-plugin/src/error.rs index f407f799..4b70ac69 100644 --- a/gst-plugin/src/error.rs +++ b/gst-plugin/src/error.rs @@ -50,15 +50,15 @@ pub enum FlowError { Error(gst::ErrorMessage), } -impl Into for FlowError { - fn into(self) -> gst::FlowReturn { - (&self).into() +impl From for gst::FlowReturn { + fn from(err: FlowError) -> Self { + gst::FlowReturn::from(&err) } } -impl<'a> Into for &'a FlowError { - fn into(self) -> gst::FlowReturn { - match *self { +impl<'a> From<&'a FlowError> for gst::FlowReturn { + fn from(err: &FlowError) -> gst::FlowReturn { + match *err { FlowError::Flushing => gst::FlowReturn::Flushing, FlowError::Eos => gst::FlowReturn::Eos, FlowError::NotNegotiated(..) => gst::FlowReturn::NotNegotiated,