pub fn into_type_name(self) -> Result<String, VmError> {
        let hash = Hash::instance_function(self.type_hash()?, Protocol::INTO_TYPE_NAME);

        crate::env::with(|context, unit| {
            if let Some(name) = context.constant(hash) {
                match name {
                    ConstValue::String(s) => return Ok(s.clone()),
                    ConstValue::StaticString(s) => return Ok((*s).to_string()),
                    _ => return Err(VmError::expected::<String>(name.type_info())),
                }
            }

            if let Some(name) = unit.constant(hash) {
                match name {
                    ConstValue::String(s) => return Ok(s.clone()),
                    ConstValue::StaticString(s) => return Ok((*s).to_string()),
                    _ => return Err(VmError::expected::<String>(name.type_info())),
                }
            }

            self.type_info().map(|v| format!("{}", v))
        })
    }
/// Retrieves a human readable type name for the current value.
///
/// Note that this function will always failed if called outside of a
/// virtual machine.
Retrieves a human readable type name for the current value.
Note that this function will always failed if called outside of a
virtual machine.
Retrieves a human readable type name for the current value . Note that this function will always failed if called outside of a virtual machine .
pub fn into_type_name(self) -> Result<String, VmError> {
        let hash = Hash::instance_function(self.type_hash()?, Protocol::INTO_TYPE_NAME);
        crate::env::with(|context, unit| {
            if let Some(name) = context.constant(hash) {
                match name {
                    ConstValue::String(s) => return Ok(s.clone()),
                    ConstValue::StaticString(s) => return Ok((*s).to_string()),
                    _ => return Err(VmError::expected::<String>(name.type_info())),
                }
            }
            if let Some(name) = unit.constant(hash) {
                match name {
                    ConstValue::String(s) => return Ok(s.clone()),
                    ConstValue::StaticString(s) => return Ok((*s).to_string()),
                    _ => return Err(VmError::expected::<String>(name.type_info())),
                }
            }
            self.type_info().map(|v| format!("{}", v))
        })
    }
pub fn into_type_name ( self ) -> Result < String , VmError > { let hash = Hash :: instance_function ( self . type_hash ( ) ? , Protocol :: INTO_TYPE_NAME ) ; crate :: env :: with ( | context , unit | { if let Some ( name ) = context . constant ( hash ) { match name { ConstValue :: String ( s ) => return Ok ( s . clone ( ) ) , ConstValue :: StaticString ( s ) => return Ok ( ( * s ) . to_string ( ) ) , _ => return Err ( VmError :: expected :: < String > ( name . type_info ( ) ) ) , } } if let Some ( name ) = unit . constant ( hash ) { match name { ConstValue :: String ( s ) => return Ok ( s . clone ( ) ) , ConstValue :: StaticString ( s ) => return Ok ( ( * s ) . to_string ( ) ) , _ => return Err ( VmError :: expected :: < String > ( name . type_info ( ) ) ) , } } self . type_info ( ) . map ( | v | format ! ( " " v ) ) } ) }
Retrieves a human readable type name for the current value.
Retrieves a human readable type name for the current value .
self
self