pub fn try_set_value<'b>(
        &mut self,
        storage: &'b mut dyn Storage,
        name: &String,
        value: Option<String>,
    ) -> Result<NameRecord> {
        if let Some(value) = &value {
            if value.len() > 256 {
                return Err(anyhow!(
                    "Value length {} exceeds max allowed length (256)",
                    value.len()
                ));
            }
        }

        let mut name_record = self.try_resolve_name(storage, name)?;
        let old_hash = name_record.hash();
        let old_hash = base32::encode(
            base32::Alphabet::RFC4648 { padding: false },
            old_hash.as_slice(),
        );

        name_record.value = value;
        name_record.lineage = Some(old_hash);

        self.try_save_record(storage, name, &name_record)?;

        Ok(name_record)
    }
/// Attempt to set the value associated with a given name
/// NOTE: Access control validation must be performed by the caller
Attempt to set the value associated with a given name
NOTE: Access control validation must be performed by the caller
Attempt to set the value associated with a given name NOTE : Access control validation must be performed by the caller
pub fn try_set_value<'b>(
        &mut self,
        storage: &'b mut dyn Storage,
        name: &String,
        value: Option<String>,
    ) -> Result<NameRecord> {
        if let Some(value) = &value {
            if value.len() > 256 {
                return Err(anyhow!(
                    "Value length {} exceeds max allowed length (256)",
                    value.len()
                ));
            }
        }
        let mut name_record = self.try_resolve_name(storage, name)?;
        let old_hash = name_record.hash();
        let old_hash = base32::encode(
            base32::Alphabet::RFC4648 { padding: false },
            old_hash.as_slice(),
        );
        name_record.value = value;
        name_record.lineage = Some(old_hash);
        self.try_save_record(storage, name, &name_record)?;
        Ok(name_record)
    }
pub fn try_set_value < ' b > ( & mut self , storage : & ' b mut dyn Storage , name : & String , value : Option < String > , ) -> Result < NameRecord > { if let Some ( value ) = & value { if value . len ( ) > 256 { return Err ( anyhow ! ( " " value len ( ) ) ) ; } } let mut name_record = self . try_resolve_name ( storage , name ) ? ; let old_hash = name_record . hash ( ) ; let old_hash = base32 :: encode ( base32 :: Alphabet :: RFC4648 { padding : false } , old_hash . as_slice ( ) , ) ; name_record . value = value ; name_record . lineage = Some ( old_hash ) ; self . try_save_record ( storage , name , & name_record ) ? ; Ok ( name_record ) }
Attempt to set the value associated with a given name
NOTE: Access control validation must be performed by the caller
Attempt to set the value associated with a given name NOTE : Access control validation must be performed by the caller
&mut self
storage
&'b mut dyn Storage
name
&String
value
Option<String>
&mut self
storage
&'b mut dyn Storage
name
&String
value
Option<String>