diff --git a/src/component.rs b/src/component.rs index ff8526e7..c8ea7e03 100644 --- a/src/component.rs +++ b/src/component.rs @@ -152,7 +152,8 @@ impl Component { sid = value.to_owned(); } } - } + }, + _ => (), } break } diff --git a/src/connection.rs b/src/connection.rs index c209f37a..4b80cdc2 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -29,14 +29,14 @@ impl Connection for C2S { elem.push_attribute(("id", id)); elem.push_attribute(("xmlns", ns::CLIENT)); elem.push_attribute(("xmlns:stream", ns::STREAM)); - transport.write_event(WriterEvent::Start(elem)); + transport.write_event(WriterEvent::Start(elem))?; Ok(()) } fn close(transport: &mut T) -> Result<(), Error> { let name = "stream:stream"; let elem = BytesEnd::borrowed(name.as_bytes()); - transport.write_event(WriterEvent::End(elem)); + transport.write_event(WriterEvent::End(elem))?; Ok(()) } } @@ -56,14 +56,14 @@ impl Connection for Component2S { elem.push_attribute(("id", id)); elem.push_attribute(("xmlns", ns::COMPONENT_ACCEPT)); elem.push_attribute(("xmlns:stream", ns::STREAM)); - transport.write_event(WriterEvent::Start(elem)); + transport.write_event(WriterEvent::Start(elem))?; Ok(()) } fn close(transport: &mut T) -> Result<(), Error> { let name = "stream:stream"; let elem = BytesEnd::borrowed(name.as_bytes()); - transport.write_event(WriterEvent::End(elem)); + transport.write_event(WriterEvent::End(elem))?; Ok(()) } } diff --git a/src/transport.rs b/src/transport.rs index 288bfce2..2f147422 100644 --- a/src/transport.rs +++ b/src/transport.rs @@ -27,7 +27,7 @@ use sasl::common::ChannelBinding; /// A trait which transports are required to implement. pub trait Transport { /// Writes a `quick_xml::events::Event` to the stream. - fn write_event<'a, E: Into>>(&mut self, event: E) -> Result; + fn write_event<'a, E: Into>>(&mut self, event: E) -> Result<(), Error>; /// Reads a `quick_xml::events::Event` from the stream. fn read_event(&mut self) -> Result; @@ -58,8 +58,9 @@ pub struct PlainTransport { } impl Transport for PlainTransport { - fn write_event<'a, E: Into>>(&mut self, event: E) -> Result { - Ok(self.writer.write(&event.into())?) + fn write_event<'a, E: Into>>(&mut self, event: E) -> Result<(), Error> { + self.writer.write(&event.into())?; + Ok(()) } fn read_event(&mut self) -> Result { @@ -124,8 +125,9 @@ pub struct SslTransport { } impl Transport for SslTransport { - fn write_event<'a, E: Into>>(&mut self, event: E) -> Result { - Ok(self.writer.write(&event.into())?) + fn write_event<'a, E: Into>>(&mut self, event: E) -> Result<(), Error> { + self.writer.write(&event.into())?; + Ok(()) } fn read_event(&mut self) -> Result { @@ -179,7 +181,8 @@ impl SslTransport { return Err(Error::StreamError); } } - } + }, + _ => (), } } }