From 8e417446d32ea88eea7d13d5b3c24d293ecffc8b Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Thu, 10 Oct 2024 12:32:41 +0300 Subject: [PATCH] cleanup --- .../scenario/src/facade/result_handlers.rs | 4 +-- .../result_handlers/returns_handled_or_err.rs | 35 ++++++++++--------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/framework/scenario/src/facade/result_handlers.rs b/framework/scenario/src/facade/result_handlers.rs index fe3ad47902..454f235b22 100644 --- a/framework/scenario/src/facade/result_handlers.rs +++ b/framework/scenario/src/facade/result_handlers.rs @@ -2,11 +2,11 @@ mod expect_error; mod expect_message; mod expect_status; mod expect_value; +mod returns_handled_or_err; mod returns_logs; mod returns_message; mod returns_new_bech32_address; mod returns_new_token_identifier; -mod returns_handled_or_err; mod returns_status; mod returns_tx_hash; mod with_tx_raw_response; @@ -15,11 +15,11 @@ pub use expect_error::ExpectError; pub use expect_message::ExpectMessage; pub use expect_status::ExpectStatus; pub use expect_value::ExpectValue; +pub use returns_handled_or_err::ReturnsHandledOrError; pub use returns_logs::ReturnsLogs; pub use returns_message::ReturnsMessage; pub use returns_new_bech32_address::ReturnsNewBech32Address; pub use returns_new_token_identifier::ReturnsNewTokenIdentifier; -pub use returns_handled_or_err::ReturnsHandledOrError; pub use returns_status::ReturnsStatus; pub use returns_tx_hash::ReturnsTxHash; pub use with_tx_raw_response::WithRawTxResponse; diff --git a/framework/scenario/src/facade/result_handlers/returns_handled_or_err.rs b/framework/scenario/src/facade/result_handlers/returns_handled_or_err.rs index 6b3cffdb49..12dede24ff 100644 --- a/framework/scenario/src/facade/result_handlers/returns_handled_or_err.rs +++ b/framework/scenario/src/facade/result_handlers/returns_handled_or_err.rs @@ -11,15 +11,15 @@ use multiversx_sc::{ use crate::scenario_model::{CheckValue, TxExpect, TxResponse, TxResponseStatus}; /// Indicates that a `Result` will be returned, either with the handled result, -/// according to the inner result handlers, or with an error in case of a failed transaction. -pub struct ReturnsHandledOrError +/// according to the nested result handlers, or with an error in case of a failed transaction. +pub struct ReturnsHandledOrError where Env: TxEnv, - Ok: RHList, + NHList: RHList, { _phantom_env: PhantomData, _phantom_original: PhantomData, - pub nested_handlers: Ok, + pub nested_handlers: NHList, } impl Default for ReturnsHandledOrError> @@ -44,15 +44,15 @@ where } } -impl ReturnsHandledOrError +impl ReturnsHandledOrError where Env: TxEnv, - Ok: RHListExec, + NHList: RHListExec, { - pub fn returns(self, item: RH) -> ReturnsHandledOrError + pub fn returns(self, item: RH) -> ReturnsHandledOrError where - RH: RHListItem, - Ok: RHListAppendRet, + RH: RHListItem, + NHList: RHListAppendRet, { ReturnsHandledOrError { _phantom_env: PhantomData, @@ -62,21 +62,22 @@ where } } -impl RHListItem for ReturnsHandledOrError +impl RHListItem + for ReturnsHandledOrError where Env: TxEnv, - Ok: RHListExec, - Ok::ListReturns: NestedTupleFlatten, + NHList: RHListExec, + NHList::ListReturns: NestedTupleFlatten, { - type Returns = Result<::Unpacked, TxResponseStatus>; + type Returns = Result<::Unpacked, TxResponseStatus>; } -impl RHListItemExec - for ReturnsHandledOrError +impl RHListItemExec + for ReturnsHandledOrError where Env: TxEnv, - Ok: RHListExec, - Ok::ListReturns: NestedTupleFlatten, + NHList: RHListExec, + NHList::ListReturns: NestedTupleFlatten, { fn item_tx_expect(&self, mut prev: TxExpect) -> TxExpect { prev.status = CheckValue::Star;