pub fn into_value(self) -> Value {
        return match self {
            Self::Unit => Value::Unit,
            Self::Byte(b) => Value::Byte(b),
            Self::Char(c) => Value::Char(c),
            Self::Bool(b) => Value::Bool(b),
            Self::Integer(n) => Value::Integer(n),
            Self::String(s) => match s {
                StringKey::String(s) => Value::String(Shared::new(String::from(s))),
                StringKey::StaticString(s) => Value::StaticString(s),
            },
            Self::Bytes(b) => Value::Bytes(Shared::new(b)),
            Self::Option(option) => {
                Value::Option(Shared::new(option.map(|some| some.into_value())))
            }
            Self::Vec(vec) => {
                let mut v = Vec::with_capacity(vec.len());

                for value in vec {
                    v.push(value.into_value());
                }

                Value::Vec(Shared::new(v))
            }
            Self::Tuple(tuple) => Value::Tuple(Shared::new(tuple_into_value(tuple))),
            Self::Variant(variant) => {
                let data = match variant.data {
                    VariantKeyData::Unit => VariantData::Unit,
                    VariantKeyData::Tuple(tuple) => VariantData::Tuple(tuple_into_value(tuple)),
                    VariantKeyData::Struct(st) => VariantData::Struct(struct_into_value(st)),
                };

                Value::Variant(Shared::new(Variant {
                    rtti: variant.rtti,
                    data,
                }))
            }
        };

        fn tuple_into_value(data: Box<[Key]>) -> Tuple {
            let mut t = vec::Vec::with_capacity(data.len());

            for value in vec::Vec::from(data) {
                t.push(value.into_value());
            }

            Tuple::from(t)
        }

        fn struct_into_value(data: Box<[(Box<str>, Key)]>) -> Object {
            let mut object = Object::with_capacity(data.len());

            for (key, value) in vec::Vec::from(data) {
                object.insert(key.into(), value.into_value());
            }

            object
        }
    }
/// Convert into virtual machine value.
///
/// We provide this associated method since a constant value can be
/// converted into a value infallibly, which is not captured by the trait
/// otherwise.
Convert into virtual machine value.
We provide this associated method since a constant value can be
converted into a value infallibly, which is not captured by the trait
otherwise.
Convert into virtual machine value . We provide this associated method since a constant value can be converted into a value infallibly which is not captured by the trait otherwise .
pub fn into_value(self) -> Value {
        return match self {
            Self::Unit => Value::Unit,
            Self::Byte(b) => Value::Byte(b),
            Self::Char(c) => Value::Char(c),
            Self::Bool(b) => Value::Bool(b),
            Self::Integer(n) => Value::Integer(n),
            Self::String(s) => match s {
                StringKey::String(s) => Value::String(Shared::new(String::from(s))),
                StringKey::StaticString(s) => Value::StaticString(s),
            },
            Self::Bytes(b) => Value::Bytes(Shared::new(b)),
            Self::Option(option) => {
                Value::Option(Shared::new(option.map(|some| some.into_value())))
            }
            Self::Vec(vec) => {
                let mut v = Vec::with_capacity(vec.len());
                for value in vec {
                    v.push(value.into_value());
                }
                Value::Vec(Shared::new(v))
            }
            Self::Tuple(tuple) => Value::Tuple(Shared::new(tuple_into_value(tuple))),
            Self::Variant(variant) => {
                let data = match variant.data {
                    VariantKeyData::Unit => VariantData::Unit,
                    VariantKeyData::Tuple(tuple) => VariantData::Tuple(tuple_into_value(tuple)),
                    VariantKeyData::Struct(st) => VariantData::Struct(struct_into_value(st)),
                };
                Value::Variant(Shared::new(Variant {
                    rtti: variant.rtti,
                    data,
                }))
            }
        };
        fn tuple_into_value(data: Box<[Key]>) -> Tuple {
            let mut t = vec::Vec::with_capacity(data.len());
            for value in vec::Vec::from(data) {
                t.push(value.into_value());
            }
            Tuple::from(t)
        }
        fn struct_into_value(data: Box<[(Box<str>, Key)]>) -> Object {
            let mut object = Object::with_capacity(data.len());
            for (key, value) in vec::Vec::from(data) {
                object.insert(key.into(), value.into_value());
            }
            object
        }
    }
pub fn into_value ( self ) -> Value { return match self { Self :: Unit => Value :: Unit , Self :: Byte ( b ) => Value :: Byte ( b ) , Self :: Char ( c ) => Value :: Char ( c ) , Self :: Bool ( b ) => Value :: Bool ( b ) , Self :: Integer ( n ) => Value :: Integer ( n ) , Self :: String ( s ) => match s { StringKey :: String ( s ) => Value :: String ( Shared :: new ( String :: from ( s ) ) ) , StringKey :: StaticString ( s ) => Value :: StaticString ( s ) , } , Self :: Bytes ( b ) => Value :: Bytes ( Shared :: new ( b ) ) , Self :: Option ( option ) => { Value :: Option ( Shared :: new ( option . map ( | some | some . into_value ( ) ) ) ) } Self :: Vec ( vec ) => { let mut v = Vec :: with_capacity ( vec . len ( ) ) ; for value in vec { v . push ( value . into_value ( ) ) ; } Value :: Vec ( Shared :: new ( v ) ) } Self :: Tuple ( tuple ) => Value :: Tuple ( Shared :: new ( tuple_into_value ( tuple ) ) ) , Self :: Variant ( variant ) => { let data = match variant . data { VariantKeyData :: Unit => VariantData :: Unit , VariantKeyData :: Tuple ( tuple ) => VariantData :: Tuple ( tuple_into_value ( tuple ) ) , VariantKeyData :: Struct ( st ) => VariantData :: Struct ( struct_into_value ( st ) ) , } ; Value :: Variant ( Shared :: new ( Variant { rtti : variant . rtti , data , } ) ) } } ; fn tuple_into_value ( data : Box < [ Key ] > ) -> Tuple { let mut t = vec :: Vec :: with_capacity ( data . len ( ) ) ; for value in vec :: Vec :: from ( data ) { t . push ( value . into_value ( ) ) ; } Tuple :: from ( t ) } fn struct_into_value ( data : Box < [ ( Box < str > , Key ) ] > ) -> Object { let mut object = Object :: with_capacity ( data . len ( ) ) ; for ( key , value ) in vec :: Vec :: from ( data ) { object . insert ( key . into ( ) , value . into_value ( ) ) ; } object } }
Convert into virtual machine value.
Convert into virtual machine value .
self
self