From 6ffb37b88e2740ab2c0b339f919502100333e394 Mon Sep 17 00:00:00 2001 From: alexeykoren <2365507+alexeykoren@users.noreply.github.com> Date: Mon, 10 Jun 2024 10:45:27 +0200 Subject: [PATCH 1/3] Add auth mapping --- src/issuance.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/issuance.rs b/src/issuance.rs index f5a368d7d..1ce3e35fc 100644 --- a/src/issuance.rs +++ b/src/issuance.rs @@ -255,6 +255,20 @@ impl IssueBundle { authorization, } } + + /// Transitions this bundle from one authorization state to another. + pub fn map_authorization( + self, + context: &mut R, + map_auth: impl FnOnce(&mut R, T) -> T2, + ) -> IssueBundle { + let authorization = self.authorization; + IssueBundle { + ik: self.ik, + actions: self.actions, + authorization: map_auth(context, authorization), + } + } } impl IssueBundle { From 8c5274d1c601a69960ce5f15b00fb0758dfc9519 Mon Sep 17 00:00:00 2001 From: alexeykoren <2365507+alexeykoren@users.noreply.github.com> Date: Mon, 10 Jun 2024 10:58:13 +0200 Subject: [PATCH 2/3] Simplify map authorization --- src/issuance.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/issuance.rs b/src/issuance.rs index 1ce3e35fc..bcd77f687 100644 --- a/src/issuance.rs +++ b/src/issuance.rs @@ -259,14 +259,13 @@ impl IssueBundle { /// Transitions this bundle from one authorization state to another. pub fn map_authorization( self, - context: &mut R, - map_auth: impl FnOnce(&mut R, T) -> T2, + map_auth: impl FnOnce(T) -> T2, ) -> IssueBundle { let authorization = self.authorization; IssueBundle { ik: self.ik, actions: self.actions, - authorization: map_auth(context, authorization), + authorization: map_auth(authorization), } } } From f7789bfb90c0435e5ca945ac7ddb5c92f8494ee6 Mon Sep 17 00:00:00 2001 From: alexeykoren <2365507+alexeykoren@users.noreply.github.com> Date: Mon, 10 Jun 2024 11:31:06 +0200 Subject: [PATCH 3/3] Simplify map authorization --- src/issuance.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/issuance.rs b/src/issuance.rs index bcd77f687..4ba3b8feb 100644 --- a/src/issuance.rs +++ b/src/issuance.rs @@ -257,7 +257,7 @@ impl IssueBundle { } /// Transitions this bundle from one authorization state to another. - pub fn map_authorization( + pub fn map_authorization( self, map_auth: impl FnOnce(T) -> T2, ) -> IssueBundle {