pub fn apply(self, stored_value: StoredValue) -> Result<StoredValue, Error> {
        match self {
            Transform::Identity => Ok(stored_value),
            Transform::Write(new_value) => Ok(new_value),
            Transform::AddInt32(to_add) => wrapping_addition(stored_value, to_add),
            Transform::AddUInt64(to_add) => wrapping_addition(stored_value, to_add),
            Transform::AddUInt128(to_add) => wrapping_addition(stored_value, to_add),
            Transform::AddUInt256(to_add) => wrapping_addition(stored_value, to_add),
            Transform::AddUInt512(to_add) => wrapping_addition(stored_value, to_add),
            Transform::AddKeys(mut keys) => match stored_value {
                StoredValue::Contract(mut contract) => {
                    contract.named_keys_append(&mut keys);
                    Ok(StoredValue::Contract(contract))
                }
                StoredValue::Account(mut account) => {
                    account.named_keys_append(&mut keys);
                    Ok(StoredValue::Account(account))
                }
                StoredValue::CLValue(cl_value) => {
                    let expected = "Contract or Account".to_string();
                    let found = format!("{:?}", cl_value.cl_type());
                    Err(StoredValueTypeMismatch::new(expected, found).into())
                }
                StoredValue::ContractPackage(_) => {
                    let expected = "Contract or Account".to_string();
                    let found = "ContractPackage".to_string();
                    Err(StoredValueTypeMismatch::new(expected, found).into())
                }
                StoredValue::ContractWasm(_) => {
                    let expected = "Contract or Account".to_string();
                    let found = "ContractWasm".to_string();
                    Err(StoredValueTypeMismatch::new(expected, found).into())
                }
                StoredValue::Transfer(_) => {
                    let expected = "Contract or Account".to_string();
                    let found = "Transfer".to_string();
                    Err(StoredValueTypeMismatch::new(expected, found).into())
                }
                StoredValue::DeployInfo(_) => {
                    let expected = "Contract or Account".to_string();
                    let found = "DeployInfo".to_string();
                    Err(StoredValueTypeMismatch::new(expected, found).into())
                }
                StoredValue::EraInfo(_) => {
                    let expected = "Contract or Account".to_string();
                    let found = "EraInfo".to_string();
                    Err(StoredValueTypeMismatch::new(expected, found).into())
                }
                StoredValue::Bid(_) => {
                    let expected = "Contract or Account".to_string();
                    let found = "Bid".to_string();
                    Err(StoredValueTypeMismatch::new(expected, found).into())
                }
                StoredValue::Withdraw(_) => {
                    let expected = "Contract or Account".to_string();
                    let found = "Withdraw".to_string();
                    Err(StoredValueTypeMismatch::new(expected, found).into())
                }
            },
            Transform::Failure(error) => Err(error),
        }
    }
/// Applies the transformation on a specified stored value instance.
///
/// This method produces a new [`StoredValue`] instance based on the [`Transform`] variant.
Applies the transformation on a specified stored value instance.
This method produces a new [`StoredValue`] instance based on the [`Transform`] variant.
Applies the transformation on a specified stored value instance . This method produces a new [ ` StoredValue ` ] instance based on the [ ` Transform ` ] variant .
pub fn apply(self, stored_value: StoredValue) -> Result<StoredValue, Error> {
        match self {
            Transform::Identity => Ok(stored_value),
            Transform::Write(new_value) => Ok(new_value),
            Transform::AddInt32(to_add) => wrapping_addition(stored_value, to_add),
            Transform::AddUInt64(to_add) => wrapping_addition(stored_value, to_add),
            Transform::AddUInt128(to_add) => wrapping_addition(stored_value, to_add),
            Transform::AddUInt256(to_add) => wrapping_addition(stored_value, to_add),
            Transform::AddUInt512(to_add) => wrapping_addition(stored_value, to_add),
            Transform::AddKeys(mut keys) => match stored_value {
                StoredValue::Contract(mut contract) => {
                    contract.named_keys_append(&mut keys);
                    Ok(StoredValue::Contract(contract))
                }
                StoredValue::Account(mut account) => {
                    account.named_keys_append(&mut keys);
                    Ok(StoredValue::Account(account))
                }
                StoredValue::CLValue(cl_value) => {
                    let expected = "Contract or Account".to_string();
                    let found = format!("{:?}", cl_value.cl_type());
                    Err(StoredValueTypeMismatch::new(expected, found).into())
                }
                StoredValue::ContractPackage(_) => {
                    let expected = "Contract or Account".to_string();
                    let found = "ContractPackage".to_string();
                    Err(StoredValueTypeMismatch::new(expected, found).into())
                }
                StoredValue::ContractWasm(_) => {
                    let expected = "Contract or Account".to_string();
                    let found = "ContractWasm".to_string();
                    Err(StoredValueTypeMismatch::new(expected, found).into())
                }
                StoredValue::Transfer(_) => {
                    let expected = "Contract or Account".to_string();
                    let found = "Transfer".to_string();
                    Err(StoredValueTypeMismatch::new(expected, found).into())
                }
                StoredValue::DeployInfo(_) => {
                    let expected = "Contract or Account".to_string();
                    let found = "DeployInfo".to_string();
                    Err(StoredValueTypeMismatch::new(expected, found).into())
                }
                StoredValue::EraInfo(_) => {
                    let expected = "Contract or Account".to_string();
                    let found = "EraInfo".to_string();
                    Err(StoredValueTypeMismatch::new(expected, found).into())
                }
                StoredValue::Bid(_) => {
                    let expected = "Contract or Account".to_string();
                    let found = "Bid".to_string();
                    Err(StoredValueTypeMismatch::new(expected, found).into())
                }
                StoredValue::Withdraw(_) => {
                    let expected = "Contract or Account".to_string();
                    let found = "Withdraw".to_string();
                    Err(StoredValueTypeMismatch::new(expected, found).into())
                }
            },
            Transform::Failure(error) => Err(error),
        }
    }
pub fn apply ( self , stored_value : StoredValue ) -> Result < StoredValue , Error > { match self { Transform :: Identity => Ok ( stored_value ) , Transform :: Write ( new_value ) => Ok ( new_value ) , Transform :: AddInt32 ( to_add ) => wrapping_addition ( stored_value , to_add ) , Transform :: AddUInt64 ( to_add ) => wrapping_addition ( stored_value , to_add ) , Transform :: AddUInt128 ( to_add ) => wrapping_addition ( stored_value , to_add ) , Transform :: AddUInt256 ( to_add ) => wrapping_addition ( stored_value , to_add ) , Transform :: AddUInt512 ( to_add ) => wrapping_addition ( stored_value , to_add ) , Transform :: AddKeys ( mut keys ) => match stored_value { StoredValue :: Contract ( mut contract ) => { contract . named_keys_append ( & mut keys ) ; Ok ( StoredValue :: Contract ( contract ) ) } StoredValue :: Account ( mut account ) => { account . named_keys_append ( & mut keys ) ; Ok ( StoredValue :: Account ( account ) ) } StoredValue :: CLValue ( cl_value ) => { let expected = " " . to_string ( ) ; let found = format ! ( " " cl_value cl_type ( ) ) ; Err ( StoredValueTypeMismatch :: new ( expected , found ) . into ( ) ) } StoredValue :: ContractPackage ( _ ) => { let expected = " " . to_string ( ) ; let found = " " . to_string ( ) ; Err ( StoredValueTypeMismatch :: new ( expected , found ) . into ( ) ) } StoredValue :: ContractWasm ( _ ) => { let expected = " " . to_string ( ) ; let found = " " . to_string ( ) ; Err ( StoredValueTypeMismatch :: new ( expected , found ) . into ( ) ) } StoredValue :: Transfer ( _ ) => { let expected = " " . to_string ( ) ; let found = " " . to_string ( ) ; Err ( StoredValueTypeMismatch :: new ( expected , found ) . into ( ) ) } StoredValue :: DeployInfo ( _ ) => { let expected = " " . to_string ( ) ; let found = " " . to_string ( ) ; Err ( StoredValueTypeMismatch :: new ( expected , found ) . into ( ) ) } StoredValue :: EraInfo ( _ ) => { let expected = " " . to_string ( ) ; let found = " " . to_string ( ) ; Err ( StoredValueTypeMismatch :: new ( expected , found ) . into ( ) ) } StoredValue :: Bid ( _ ) => { let expected = " " . to_string ( ) ; let found = " " . to_string ( ) ; Err ( StoredValueTypeMismatch :: new ( expected , found ) . into ( ) ) } StoredValue :: Withdraw ( _ ) => { let expected = " " . to_string ( ) ; let found = " " . to_string ( ) ; Err ( StoredValueTypeMismatch :: new ( expected , found ) . into ( ) ) } } , Transform :: Failure ( error ) => Err ( error ) , } }
Applies the transformation on a specified stored value instance.
Applies the transformation on a specified stored value instance .
self
stored_value
StoredValue
self
stored_value
StoredValue