pub(crate) fn dictionary_get(
        &mut self,
        uref: URef,
        dictionary_item_key: &str,
    ) -> Result<Option<CLValue>, Error> {
        self.validate_readable(&uref.into())?;
        self.validate_key(&uref.into())?;
        let dictionary_item_key_bytes = dictionary_item_key.as_bytes();

        if dictionary_item_key_bytes.len() > DICTIONARY_ITEM_KEY_MAX_LENGTH {
            return Err(Error::DictionaryItemKeyExceedsLength);
        }

        let dictionary_key = Key::dictionary(uref, dictionary_item_key_bytes);

        let maybe_stored_value = self
            .tracking_copy
            .borrow_mut()
            .read(self.correlation_id, &dictionary_key)
            .map_err(Into::into)?;

        if let Some(stored_value) = maybe_stored_value {
            let cl_value_indirect: CLValue =
                stored_value.try_into().map_err(Error::TypeMismatch)?;
            let dictionary_value: DictionaryValue =
                cl_value_indirect.into_t().map_err(Error::from)?;
            let cl_value = dictionary_value.into_cl_value();
            Ok(Some(cl_value))
        } else {
            Ok(None)
        }
    }
/// Gets a dictionary item key from a dictionary referenced by a `uref`.
Gets a dictionary item key from a dictionary referenced by a `uref`.
Gets a dictionary item key from a dictionary referenced by a ` uref ` .
pub(crate) fn dictionary_get(
        &mut self,
        uref: URef,
        dictionary_item_key: &str,
    ) -> Result<Option<CLValue>, Error> {
        self.validate_readable(&uref.into())?;
        self.validate_key(&uref.into())?;
        let dictionary_item_key_bytes = dictionary_item_key.as_bytes();
        if dictionary_item_key_bytes.len() > DICTIONARY_ITEM_KEY_MAX_LENGTH {
            return Err(Error::DictionaryItemKeyExceedsLength);
        }
        let dictionary_key = Key::dictionary(uref, dictionary_item_key_bytes);
        let maybe_stored_value = self
            .tracking_copy
            .borrow_mut()
            .read(self.correlation_id, &dictionary_key)
            .map_err(Into::into)?;
        if let Some(stored_value) = maybe_stored_value {
            let cl_value_indirect: CLValue =
                stored_value.try_into().map_err(Error::TypeMismatch)?;
            let dictionary_value: DictionaryValue =
                cl_value_indirect.into_t().map_err(Error::from)?;
            let cl_value = dictionary_value.into_cl_value();
            Ok(Some(cl_value))
        } else {
            Ok(None)
        }
    }
pub ( crate ) fn dictionary_get ( & mut self , uref : URef , dictionary_item_key : & str , ) -> Result < Option < CLValue > , Error > { self . validate_readable ( & uref . into ( ) ) ? ; self . validate_key ( & uref . into ( ) ) ? ; let dictionary_item_key_bytes = dictionary_item_key . as_bytes ( ) ; if dictionary_item_key_bytes . len ( ) > DICTIONARY_ITEM_KEY_MAX_LENGTH { return Err ( Error :: DictionaryItemKeyExceedsLength ) ; } let dictionary_key = Key :: dictionary ( uref , dictionary_item_key_bytes ) ; let maybe_stored_value = self . tracking_copy . borrow_mut ( ) . read ( self . correlation_id , & dictionary_key ) . map_err ( Into :: into ) ? ; if let Some ( stored_value ) = maybe_stored_value { let cl_value_indirect : CLValue = stored_value . try_into ( ) . map_err ( Error :: TypeMismatch ) ? ; let dictionary_value : DictionaryValue = cl_value_indirect . into_t ( ) . map_err ( Error :: from ) ? ; let cl_value = dictionary_value . into_cl_value ( ) ; Ok ( Some ( cl_value ) ) } else { Ok ( None ) } }
Gets a dictionary item key from a dictionary referenced by a `uref`.
Gets a dictionary item key from a dictionary referenced by a ` uref ` .
&mut self
uref
URef
dictionary_item_key
&str
&mut self
uref
URef
dictionary_item_key
&str