diff --git a/src/client/dispatch.rs b/src/client/dispatch.rs index 4ae41c509d..c1744926c6 100644 --- a/src/client/dispatch.rs +++ b/src/client/dispatch.rs @@ -304,6 +304,15 @@ impl TrySendError { self.message.take() } + /// Returns a reference to the recovered message. + /// + /// The message will not always have been recovered. If an error occurs + /// after the message has been serialized onto the connection, it will not + /// be available here. + pub fn message(&self) -> Option<&T> { + self.message.as_ref() + } + /// Consumes this to return the inner error. pub fn into_error(self) -> crate::Error { self.error