datex-core 0.0.12

The DATEX Core Rust implementation
Documentation
use crate::{
    datex_proxy::{
        DatexProxyTypes, DatexValueProxy, DatexValueProxyDeserialize,
        DatexValueProxyInfallibleSerialize, DatexValueProxySerialize,
        TryFromDatexValueError, TryToDatexValueError,
    },
    libs::core::type_id::CoreLibBaseTypeId,
    runtime::cache::shared_references_cache::SharedReferencesCache,
    types::{r#type::Type, type_definition::TypeDefinition},
    values::{core_value::CoreValue, value::Value},
};

impl DatexValueProxyInfallibleSerialize for CoreValue {
    fn to_value(self) -> Value {
        Value::from(self)
    }
}
impl DatexValueProxySerialize for CoreValue {
    fn try_to_value(self) -> Result<Value, TryToDatexValueError> {
        Ok(self.to_value())
    }
}
impl DatexValueProxyDeserialize for CoreValue {
    fn try_from_value(value: Value) -> Result<Self, TryFromDatexValueError> {
        Ok(value.inner)
    }
}

impl DatexProxyTypes for CoreValue {
    fn datex_type(_memory: &mut SharedReferencesCache) -> Type {
        Type::Alias(
            TypeDefinition::CoreType(CoreLibBaseTypeId::Unknown.into()).into(),
        )
    }
}

impl DatexValueProxy for CoreValue {}