From a027271a6ce6a42478e9648b1d36268bca2e0e26 Mon Sep 17 00:00:00 2001 From: Bogdan Opanchuk Date: Wed, 13 Nov 2024 10:04:47 -0800 Subject: [PATCH] Add a `SessionReport::result()` helper method --- manul/src/session/transcript.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/manul/src/session/transcript.rs b/manul/src/session/transcript.rs index 3f678e5..6739ee0 100644 --- a/manul/src/session/transcript.rs +++ b/manul/src/session/transcript.rs @@ -209,4 +209,12 @@ where missing_messages: transcript.missing_messages, } } + + /// Returns the protocol result if the session outcome contains it, otherwise `None`. + pub fn result(self) -> Option { + match self.outcome { + SessionOutcome::Result(result) => Some(result), + _ => None, + } + } }