pub fn from_const(value: ConstValue) -> Self {
        match value {
            ConstValue::Unit => Self::Unit,
            ConstValue::Byte(b) => Self::Byte(b),
            ConstValue::Char(c) => Self::Char(c),
            ConstValue::Bool(b) => Self::Bool(b),
            ConstValue::Integer(n) => Self::Integer(n.into()),
            ConstValue::Float(n) => Self::Float(n),
            ConstValue::String(s) => Self::String(Shared::new(s)),
            ConstValue::StaticString(s) => Self::String(Shared::new((**s).to_owned())),
            ConstValue::Bytes(b) => Self::Bytes(Shared::new(b.into_vec())),
            ConstValue::Option(option) => {
                Self::Option(Shared::new(option.map(|some| Self::from_const(*some))))
            }
            ConstValue::Vec(vec) => {
                let mut ir_vec = Vec::with_capacity(vec.len());

                for value in vec {
                    ir_vec.push(Self::from_const(value));
                }

                Self::Vec(Shared::new(ir_vec))
            }
            ConstValue::Tuple(tuple) => {
                let mut ir_tuple = Vec::with_capacity(tuple.len());

                for value in Vec::from(tuple) {
                    ir_tuple.push(Self::from_const(value));
                }

                Self::Tuple(Shared::new(ir_tuple.into_boxed_slice()))
            }
            ConstValue::Object(object) => {
                let mut ir_object = HashMap::with_capacity(object.len());

                for (key, value) in object {
                    ir_object.insert(key, Self::from_const(value));
                }

                Self::Object(Shared::new(ir_object))
            }
        }
    }
/// Convert a constant value into an interpreter value.
Convert a constant value into an interpreter value.
Convert a constant value into an interpreter value .
pub fn from_const(value: ConstValue) -> Self {
        match value {
            ConstValue::Unit => Self::Unit,
            ConstValue::Byte(b) => Self::Byte(b),
            ConstValue::Char(c) => Self::Char(c),
            ConstValue::Bool(b) => Self::Bool(b),
            ConstValue::Integer(n) => Self::Integer(n.into()),
            ConstValue::Float(n) => Self::Float(n),
            ConstValue::String(s) => Self::String(Shared::new(s)),
            ConstValue::StaticString(s) => Self::String(Shared::new((**s).to_owned())),
            ConstValue::Bytes(b) => Self::Bytes(Shared::new(b.into_vec())),
            ConstValue::Option(option) => {
                Self::Option(Shared::new(option.map(|some| Self::from_const(*some))))
            }
            ConstValue::Vec(vec) => {
                let mut ir_vec = Vec::with_capacity(vec.len());
                for value in vec {
                    ir_vec.push(Self::from_const(value));
                }
                Self::Vec(Shared::new(ir_vec))
            }
            ConstValue::Tuple(tuple) => {
                let mut ir_tuple = Vec::with_capacity(tuple.len());
                for value in Vec::from(tuple) {
                    ir_tuple.push(Self::from_const(value));
                }
                Self::Tuple(Shared::new(ir_tuple.into_boxed_slice()))
            }
            ConstValue::Object(object) => {
                let mut ir_object = HashMap::with_capacity(object.len());
                for (key, value) in object {
                    ir_object.insert(key, Self::from_const(value));
                }
                Self::Object(Shared::new(ir_object))
            }
        }
    }
pub fn from_const ( value : ConstValue ) -> Self { match value { ConstValue :: Unit => Self :: Unit , ConstValue :: Byte ( b ) => Self :: Byte ( b ) , ConstValue :: Char ( c ) => Self :: Char ( c ) , ConstValue :: Bool ( b ) => Self :: Bool ( b ) , ConstValue :: Integer ( n ) => Self :: Integer ( n . into ( ) ) , ConstValue :: Float ( n ) => Self :: Float ( n ) , ConstValue :: String ( s ) => Self :: String ( Shared :: new ( s ) ) , ConstValue :: StaticString ( s ) => Self :: String ( Shared :: new ( ( * * s ) . to_owned ( ) ) ) , ConstValue :: Bytes ( b ) => Self :: Bytes ( Shared :: new ( b . into_vec ( ) ) ) , ConstValue :: Option ( option ) => { Self :: Option ( Shared :: new ( option . map ( | some | Self :: from_const ( * some ) ) ) ) } ConstValue :: Vec ( vec ) => { let mut ir_vec = Vec :: with_capacity ( vec . len ( ) ) ; for value in vec { ir_vec . push ( Self :: from_const ( value ) ) ; } Self :: Vec ( Shared :: new ( ir_vec ) ) } ConstValue :: Tuple ( tuple ) => { let mut ir_tuple = Vec :: with_capacity ( tuple . len ( ) ) ; for value in Vec :: from ( tuple ) { ir_tuple . push ( Self :: from_const ( value ) ) ; } Self :: Tuple ( Shared :: new ( ir_tuple . into_boxed_slice ( ) ) ) } ConstValue :: Object ( object ) => { let mut ir_object = HashMap :: with_capacity ( object . len ( ) ) ; for ( key , value ) in object { ir_object . insert ( key , Self :: from_const ( value ) ) ; } Self :: Object ( Shared :: new ( ir_object ) ) } } }
Convert a constant value into an interpreter value.
Convert a constant value into an interpreter value .
value
ConstValue
value
ConstValue